Refactor Monster base class.

Issue #8 new
Stian Andreassen created an issue

Basically, we should remove the "set" from the name, and get rid of unnecessary tuple. All chances should, consistantly be 0-1 range.

fire_devil = genMonster("Fire Devil", (40, 5985), "a fire devil")
fire_devil.setHealth(200)
fire_devil.bloodType("blood")
fire_devil.setDefense(armor=13, fire=0, earth=0.8, energy=0.7, ice=1.2, holy=1.1, death=0.8, physical=0.9, drown=1)
fire_devil.setExperience(145)
fire_devil.setSpeed(190)
fire_devil.setBehavior(summonable=530, hostile=1, illusionable=1, convinceable=530, pushable=0, pushItems=1, pushCreatures=0, targetDistance=4, runOnHealth=0)
fire_devil.walkAround(energy=1, fire=0, poison=1)
fire_devil.setImmunity(paralyze=0, invisible=0, lifedrain=0, drunk=0)
fire_devil.voices("Hot, eh?", "Hell, oh, hell!")
fire_devil.regMelee(35)
fire_devil = genMonster("Fire Devil", 40, 5985) # Description is optional, use inflict to make the description by default.
fire_devil.health(200)
fire_devil.type("blood")
fire_devil.defense(armor=13, fire=0, earth=0.8, energy=0.7, ice=1.2, holy=1.1, death=0.8, physical=0.9, drown=1)
fire_devil.experience(145)
fire_devil.speed(190)
fire_devil.behavior(summonable=530, hostile=1, illusionable=1, convinceable=530, pushable=0, pushItems=1, pushCreatures=0, targetDistance=4, runOnHealth=0)
fire_devil.walkAround(energy=1, fire=0, poison=1)
fire_devil.immunity(paralyze=0, invisible=0, lifedrain=0, drunk=0)
fire_devil.voices("Hot, eh?", "Hell, oh, hell!")
fire_devil.regMelee(35)

"set" is used rather inconsistantly, etc, we didn't use "setBloodType", bloodtype is also a bit wrong, as it's used for the entier monster classification, and not just what blood the creature uses.

Should receive some comments from our Master of Monsters soul4soul :)

Comments (6)

  1. soul4soul
    • removal of set is nice, shorter names and now they will all be consistent.
    • I was annoyed by bloodType as well. I was contemplating creating a "race" with valid inputs being venom, blood, fire, energy, undead, and water to start with.
    • Id like to add more defense/damage types lifedrain and manadrain. For anyone wondering there are conditions named dazzled, freezing, and bleeding and they have the damage types holy, ice, and physical respectively.
    • I agree all chances should be 0-1 eg.
    demon.summon("Fire Elemental", 10)
    

    should become

    demon.summon("Fire Elemental", 0.1)
    
    • All damage/defense modifiers should be percentages with 1 being 100% (I believe this is already true for all creatures)
    • I was wondering about changing all Boolean inputs to true/false instead of 0/1?
    • We need a better way for setting creature looktype if it uses an outfit with head/body/legs/feet
    • Ideally we need a way to set a creature looktype as an item, but its few and far between. there is a mimic, a few towers in ank, lava holes, and maybe a few others.
    • Creatures appear to have skills in RL tibia. if you train on a slime over time it hits harder. Im not sure if we need to worry about this, even on RL tibia people rarely train anymore. Its unlikely anyone will be attacking the same creature for 4-8 hours in an OT unless its a training monk.
  2. Stian Andreassen reporter
    • All damage/defense modifiers should be percentages with 1 being 100% (I believe this is already true for all creatures)*

    It is.

    • I was wondering about changing all Boolean inputs to true/false instead of 0/1?*

    Sure. I think internally we just check if they are True anyway, and 1 == True holds true. So it shouldn't need any change.

    • We need a better way for setting creature looktype if it uses an outfit with head/body/legs/feet*

    Currently its done by a tuple of 5 elements i believe.

    • Ideally we need a way to set a creature looktype as an item, but its few and far between. there is a mimic, a few towers in ank, lava holes, and maybe a few others.*

    You can do that by just setting the lookId to an id > 1000. If I recall.

    • Creatures appear to have skills in RL tibia. if you train on a slime over time it hits harder. Im not sure if we need to worry about this, even on RL tibia people rarely train anymore. Its unlikely anyone will be attacking the same creature for 4-8 hours in an OT unless its a training monk.* We dont save monsters, so it wouldn't be kept over time, but there is no problem for anyone to just add a death script at any given time and change the modifiers for the creature.
  3. Stian Andreassen reporter

    An alternativ altogether.

    def demon():
       type="blood"
       speed = 1500
       look = 123
       corpse = 1234
       voices = "Hot, eh?", "Hell, oh, hell!"
       # .... The rest of the stuff here.
       return locals() # Basically, this makes a dict of all the values. All nice
    
    genMonster("Demon", demon) # Call callback, use this to get the dict.
    

    Or taking it even a step futher:

    type="blood"
    speed = 1500
    look = 123
    corpse = 1234
    voices = "Hot, eh?", "Hell, oh, hell!"
    # .... The rest of the stuff here.
    genMonster("Demon", locals()) # This method doesn't allow multiple monster per file, but both ways can be support.
    

    I was wondering about changing all Boolean inputs to true/false instead of 0/1? Remember that Python is case sensitive, "True" and "False", not "true" and "false". :)

  4. soul4soul

    ha I already double checked using the interactive environment on python.org if it was "True" or "true". Hmm.. the first approach looks kind of cool. I know the second option is nearly the same. But I think I'm happy with the way it is now.

    updated the list of missing creatures in this post, http://vapus.net/forum/viewtopic.php?f=287&t=4388&p=24787#p24787. Creatures from the latest updates still need to be sorted.

    Any other ideas to implement for creatures?

  5. Log in to comment