Added a new trigger type for mobs, called "Damage", that triggers every (#151)
time the mob is harmed, through any means. Valid return values: -1: prevents damage from occurring. Will also prevent a fight from starting. 0: forces a miss. >0 : the damage the mob will endure. Available variables: %actor%: the one doing the damage %victim%: typically the same as %self% - the one being attacked %damage%: the damage inflicted. Always a non-negative number. %attacktype%: The attack type. Will be UNDEFINED when hitting with a weapon.
This commit is contained in:
@@ -620,6 +620,11 @@ int damage(struct char_data *ch, struct char_data *victim, int dam, int attackty
|
||||
if (!IS_NPC(victim) && ((GET_LEVEL(victim) >= LVL_IMMORT) && PRF_FLAGGED(victim, PRF_NOHASSLE)))
|
||||
dam = 0;
|
||||
|
||||
dam = damage_mtrigger(ch, victim, dam, attacktype);
|
||||
if (dam == -1) {
|
||||
return (0);
|
||||
}
|
||||
|
||||
if (victim != ch) {
|
||||
/* Start the attacker fighting the victim */
|
||||
if (GET_POS(ch) > POS_STUNNED && (FIGHTING(ch) == NULL))
|
||||
|
||||
Reference in New Issue
Block a user