evennia / ainneve

A full example game created in Evennia (under development, anyone can help!)
77 stars 52 forks source link

Customize combat messaging for weapons #92

Open feend78 opened 7 years ago

feend78 commented 7 years ago

Currently, all weapons use the base Weapon typeclass's combat messaging. They are stored in an dict attribute called messages that has four keys for the four possible weapon attack outcomes.

Here is a link to the messages' definition in the base typeclass: https://github.com/evennia/ainneve/blob/master/typeclasses/weapons.py#L29

To implement this, a messages key will need to be added to each weapon prototype in the prototypes_weapons.py file.

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/40769047-customize-combat-messaging-for-weapons?utm_campaign=plugin&utm_content=tracker%2F18622666&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F18622666&utm_medium=issues&utm_source=github).
stefanludlow commented 7 years ago

Spent some time working on this over the weekend, mainly pondering how best to do it. It's a touch beyond my skills, but if you could provide me with an example of what this would look like on the prototypes_weapons.py file, I'd be happy to fill this in for all the other records.

For my own notes, weapons.py line 29, rulebook.py 438

feend78 commented 7 years ago

@stefanludlow, here's an example:

HAND_AXE = {
    "key": "a hand axe",
    "aliases": ["hand axe", "axe"],
    "typeclass": "typeclasses.weapons.Weapon",
    "desc": "The blade of this axe appears well-used and slightly "
            "tarnished, but its handle is straight and sturdy.",
    "weight": 1,
    "value": 60*CC,
    "damage": 2,
    "range": "melee",
    "messages": {
            "dmg_hp": "{weapon} files silently through the air as {actor} slices {target} with its flashing blade.",
            "dmg_sp": "{actor} strikes {target} with the flat side of {weapon}, stunning them.",
            "dodged": "{weapon} fails to meet its target as {target} dodges {actor}'s attack.",
            "missed": "{actor} attacks {target} with {weapon} and misses."
    }
}