ainneve
ainneve copied to clipboard
Customize combat messaging for weapons
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.
-
dmg_hp
- displayed when the weapon is used to damage the target's HP -
dmg_sp
- displayed when the weapon is used to damage the target's SP -
dodged
- displayed when the attack is dodged -
missed
- displayed when the attack misses
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! We accept bounties via Bountysource.
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
@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."
}
}