Skip to content

Commit

Permalink
Additional feedback when damaging monsters vulnerable to elemental da…
Browse files Browse the repository at this point in the history
…mage.

Provide additional feedback when damaging a monster that is vulnerable
to various types of elemental damage. Example - hitting a wolf with Fire
Brand burns it. Hitting a blue jelly with the same will 'severely burn'
it. This will give the (unspoiled) player some clue as to what elemental
damage types can do additional damage to a monster.
  • Loading branch information
k21971 committed Jul 16, 2024
1 parent 1e07f91 commit 241c763
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 15 deletions.
1 change: 1 addition & 0 deletions doc/evilhack-changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3548,4 +3548,5 @@ The following changes to date are:
- Fix: cursed Ogresmasher hitting oneself and knockback
- Fix: potential crash with dark elven objects falling down to the level below
- Fix: various player monster attacks not damaging other monsters
- Additional feedback when damaging monsters vulnerable to elemental damage

43 changes: 31 additions & 12 deletions src/artifact.c
Original file line number Diff line number Diff line change
Expand Up @@ -1791,10 +1791,11 @@ int dieroll; /* needed for Magicbane and vorpal blades */
* smaller targets. Knockback rate is set here as well in rn2(rate).
* Knockback will not trigger if Ogresmasher is cursed.
*/
int hurtle_distance = 0;
if (otmp->oartifact == ART_OGRESMASHER && !otmp->cursed
&& mdef->data->msize < MZ_LARGE && !rn2(5))
hurtle_distance = MZ_LARGE - mdef->data->msize;
int hurtle_distance = 0;

if (otmp->oartifact == ART_OGRESMASHER && !otmp->cursed
&& mdef->data->msize < MZ_LARGE && !rn2(5))
hurtle_distance = MZ_LARGE - mdef->data->msize;

/* incorporeal monsters are immune to various
types of damage */
Expand All @@ -1816,23 +1817,30 @@ int dieroll; /* needed for Magicbane and vorpal blades */
? "hits"
: can_vaporize(mdef->data)
? "vaporizes part of"
: def_underwater ? "hits" : "burns",
: def_underwater
? "hits"
: vulnerable_to(mdef, AD_FIRE)
? "severely burns" : "burns",
hittee, !spec_dbon_applies ? '.' : '!');
} else if (otmp->oartifact == ART_XIUHCOATL) {
pline_The("flaming spear %s %s%c",
!spec_dbon_applies
? "hits"
: can_vaporize(mdef->data)
? "vaporizes part of"
: def_underwater ? "hits" : "burns",
: def_underwater
? "hits"
: vulnerable_to(mdef, AD_FIRE)
? "severely burns" : "burns",
hittee, !spec_dbon_applies ? '.' : '!');
} else if (otmp->oartifact == ART_ANGELSLAYER) {
pline_The("infernal trident %s %s%c",
!spec_dbon_applies
? "hits"
: can_vaporize(mdef->data)
? "vaporizes part of"
: "burns",
: vulnerable_to(mdef, AD_FIRE)
? "severely burns" : "burns",
hittee, !spec_dbon_applies ? '.' : '!');
} else if ((otmp->oclass == WEAPON_CLASS
|| is_weptool(otmp) || is_bullet(otmp)
Expand All @@ -1846,7 +1854,10 @@ int dieroll; /* needed for Magicbane and vorpal blades */
? "hits"
: can_vaporize(mdef->data)
? "vaporizes part of"
: def_underwater ? "hits" : "burns",
: def_underwater
? "hits"
: vulnerable_to(mdef, AD_FIRE)
? "severely burns" : "burns",
hittee, !spec_dbon_applies ? '.' : '!');
}
}
Expand Down Expand Up @@ -1912,7 +1923,8 @@ int dieroll; /* needed for Magicbane and vorpal blades */
? "hits"
: can_freeze(mdef->data)
? "freezes part of"
: "freezes",
: vulnerable_to(mdef, AD_COLD)
? "severely freezes" : "freezes",
hittee, !spec_dbon_applies ? '.' : '!');
} else if ((otmp->oclass == WEAPON_CLASS
|| is_weptool(otmp) || is_bullet(otmp)
Expand All @@ -1926,7 +1938,8 @@ int dieroll; /* needed for Magicbane and vorpal blades */
? "hits"
: can_freeze(mdef->data)
? "freezes part of"
: "freezes",
: vulnerable_to(mdef, AD_COLD)
? "severely freezes" : "freezes",
hittee, !spec_dbon_applies ? '.' : '!');
}
}
Expand Down Expand Up @@ -1970,7 +1983,10 @@ int dieroll; /* needed for Magicbane and vorpal blades */
: simpleonames(otmp),
!spec_dbon_applies
? "hits"
: rn2(2) ? "jolts" : "shocks",
: vulnerable_to(mdef, AD_ELEC)
? "severely shocks"
: rn2(2)
? "jolts" : "shocks",
hittee, !spec_dbon_applies ? '.' : '!');
}
}
Expand Down Expand Up @@ -2131,7 +2147,10 @@ int dieroll; /* needed for Magicbane and vorpal blades */
? "hits"
: can_corrode(mdef->data)
? "eats away part of"
: def_underwater ? "hits" : "burns",
: def_underwater
? "hits"
: vulnerable_to(mdef, AD_ACID)
? "severely burns" : "burns",
hittee, !spec_dbon_applies ? '.' : '!');
}
if (!def_underwater) {
Expand Down
13 changes: 10 additions & 3 deletions src/uhitm.c
Original file line number Diff line number Diff line change
Expand Up @@ -2118,7 +2118,9 @@ int dieroll;
} else {
You("%s %s with your %s!",
can_vaporize(mon->data)
? "vaporize part of" : "burn",
? "vaporize part of"
: vulnerable_to(mon, AD_FIRE)
? "severely burn" : "burn",
mon_nam(mon), makeplural(body_part(HAND)));

if (!rn2(4) &&
Expand Down Expand Up @@ -2147,8 +2149,13 @@ int dieroll;
makeplural(body_part(HAND)),
mon_nam(mon));
} else {
You("shock %s with your %s!", mon_nam(mon),
makeplural(body_part(HAND)));
You("%s %s with your %s!",
vulnerable_to(mon, AD_ELEC)
? "severely shock"
: rn2(2)
? "jolt" : "shock",
mon_nam(mon),
makeplural(body_part(HAND)));
}
nohandshock();
}
Expand Down

0 comments on commit 241c763

Please sign in to comment.