Premonition in Lua Affliction Tracking

Hi Everyone,

I put together my aff tracking by looking at other people's code, writing my own, and using snippets and converting the syntax to fit MUSH (as well as writing some of my own). That means, that, while I understand what I've now got, I'm not that great at adding in additional functionality.

Right now, my aff tracking doesn't take into account if they have premonition or not. Does anyone have a moment to take a look at my code, and give me some hints on how I could add in a check for premonition?

Thanks in advance!

(It's in pastebin because the new forums hate me, and quotes, spoilers etc. don't seem to work)



Comments

  • Oh, in case anyone doesn't know, Premonition is a focusable aff that is cured last in the focus order, and which prevents them curing Infest and Blight. 





  • edited June 2013
    Since its only cured by FOCUS and I guess you have a focus list for target afflictions curing since focus isn't trackable by Discernment, So I would put it at the bottom of the list like I did below...

    (this is out of my mudlet system)

    ------------------------------------------------------------

    function TrackingFocus()

    for _,v in ipairs(EnemyFocusOrder) do

    if combat.afflictions[v] then

    combat.afflictions[v] = false

    echo("\nENEMY CURED " .. string.upper(v))

    end

    end

    refreshEnemy()

    end




    EnemyFocusOrder = {

    "stupidity",

    "anorexia",

    "epilepsy",

    "paranoia",

    "hallucinations",

    "shyness",

    "stuttering",

    "dizziness",

    "indifference",

    "berserking ",

    "pacifism",

    "lovers",

    "hatred",

    "generosity",

    "claustrophobia",

    "vertigo",

    "loneliness",

    "agoraphobia",

    "masochism",

    "recklessness",

    "weariness",

    "confusion",

    "dementia",

    "premonition",

    }



  • HavenHaven World Burner Flight School
    @Azton should add mirroring in there.
    ¤ Si vis pacem, para bellum. ¤
    Someone powerful says, "We're going to have to delete you."
    havenbanner2

  • Haven said:
    @Azton should add mirroring in there.
    it was just an example...

  • @azton thanks for the response. Re-reading what I wrote, I think I wasn't super clear on what I needed...

    I do have tracking for premonition. Here's my focus tracking:

    -- Start Focus Tracking
    enemyCanFocus = os.clock()

    function EnemyFocus(name, line, wildcs)

    focuser = string.lower(wildcs[1])
    if focuser == TARGET then
    ColourTell("White", "", TARGET)
    ColourTell("orange", "", "--------------")
    ColourTell("White", "", "Focused")
    ColourTell("orange", "", "-------------")
    ColourTell("orange", "", "--------------")
    local focusCures = {
    "stupidity",
    "anorexia",
    "recklessness",
    "indifference",
    "vertigo",
    "confusion",
    "dizziness",
    "epilepsy",
    "berserk",
    "masochism",
    "dissonance",
    "agoraphobia",
    "claustrophobia",
    "weariness",
    "paranoia",
    "dementia",
    "hallucinations",
    "hatred",
    "pacifism",
    "lonely",
    "premonition"
    }
    enemyafflictionlist.impatience = nil
    for _, key in ipairs(focusCures) do
    if enemyafflictionlist[key] and hasTimerExpired(enemyCanFocus, 3)then
    enemyafflictionlist[key]=nil
    enemyCanFocus = os.clock()
    break
    end
    end --if
    end --for
    end --func

    -- End Focus Tracking

    What I need help with is to set the system up so that when it attempts to cure infest or blight, it first checks for premonition and if they have it, doesn't cure it. Premonition prevents infest and blight from being cured. The issue I'm running into is that I don't know how to integrate that into the herb part.

    e.g.

    if eating ash AND curing blight then
    if enemyafflictionlist == premonition then
    do nothing
    elseif enemyafflictionlist ~= premonition then
    cure blight
    end
    end

    I don't know how to integrate that sort of check when it's iterating through arrays for the herb cure orders, as it does in the link I posted of my herb tracking.

    Hopefully that makes more sense?

  • edited June 2013
    Here's a tip, which I have no idea why you people do it this way. Just move all of their affs and balances to a table, so you can visually see them. Stop spamming yourselves with HAS EATEN, unless it's like a cleave/death/judge message I don't really see a point to spam yourself. 

    Also to handle your problem, just have an additional statement that is if they would be 
    For the two functions provided in this script:

    function ECC(aff)

    if enemyAfflictionList[aff] then

    return true

    else

    return false

    end

    end


    function ERM(aff)

    enemyAfflictionList[aff]=nil

    end


    For the main example of what the cure would be

    if enemyCanHerb then
    if matching(CheckingTarget, target) then

    elseif plantEaten=="ash" or plantEaten=="whatever" then

    for _, key in ipairs(ginseng) do

    if key~="blighted" and ECC(key) and enemyCanHerb then

    ERM(key)

    enemyCanHerb=false

    tempTimer(1.2, [[enemyCanHerb=true]])

    elseif key=="blighted" and ECC(key) then

    if ECC("premonitions") then

    enemyCanHerb=false

    tempTimer(1.2, [[enemyCanHerb=true]])

    else

    ERM(key)

    enemyCanHerb=false

    tempTimer(1.2, [[enemyCanHerb=true]])

    end

    end

    end

    end

    end

    end

    Technically the most efficient way to do this would be to convert undead cures to living cures before this, but it's a neglible increase. 

  • @xiuhcoatl thanks, that makes sense. Now I just have to figure out how to convert it to MUSH's odd style of Lua.
  • edited June 2013
    Thanks to @azton helping me with testing, I got it sorted out. Here's the final solution, if anyone cares:

    if plantEaten=="ash" or plantEaten=="bladder" then
    for _, key in ipairs(ash) do
    if key == "blighted" and enemyafflictionlist.premonition and hasTimerExpired(enemyCanEat, 1.5) then 
    print("Premonition- didn't cure blight")
    enemyCanEat = os.clock()
    elseif enemyafflictionlist[key] and hasTimerExpired(enemyCanEat, 1.5)then
    enemyafflictionlist[key]=nil
    enemyCanEat = os.clock()
    end
    end
Sign In or Register to comment.