fix github issue #109 - healing spells

Fixes #109

Spells of healing and extra healing cast at monsters were handling
monster blindness differently from other forms of healing.  (Potions
also work differently when drunk by monsters but I haven't changed
that since it seems to be intentional.)

Hero:
   potion of healing cures blindness if blessed; spell of healing
      cast at skilled or better now behaves likewise;
   potion of extra healing cures blindness if not cursed; spell of
      extra healing is inherently not cursed and already behaved
      likewise;
   potion of full healing always cures blindness even if cursed.

Monsters quaffing potions:
   plain healing cures blindness if not cursed;
   extra healing and full healing always cure blindess.

Hero casting healing spell at monster:
   plain healing behaves like the hero plain healing case:  cures
      blindness as if blessed when cast at skilled or expert level;
      this is a change in hehavior--it used to cure timed blindness
      even if unskilled and not cure 'permanent' blindness at all;
   extra healing cast by hero is inherently not cursed so always
      cures blindness.
This commit is contained in:
PatR
2018-06-20 14:53:20 -07:00
parent 3c979cb0a5
commit 800a898b51
3 changed files with 31 additions and 17 deletions

View File

@@ -886,7 +886,7 @@ int spell;
boolean atme;
{
int energy, damage, chance, n, intell;
int skill, role_skill, res = 0;
int otyp, skill, role_skill, res = 0;
boolean confused = (Confusion != 0);
boolean physical_damage = FALSE;
struct obj *pseudo;
@@ -1029,10 +1029,11 @@ boolean atme;
* Find the skill the hero has in a spell type category.
* See spell_skilltype for categories.
*/
skill = spell_skilltype(pseudo->otyp);
otyp = pseudo->otyp;
skill = spell_skilltype(otyp);
role_skill = P_SKILL(skill);
switch (pseudo->otyp) {
switch (otyp) {
/*
* At first spells act as expected. As the hero increases in skill
* with the appropriate spell type, some spells increase in their
@@ -1056,9 +1057,9 @@ boolean atme;
}
} else {
explode(u.dx, u.dy,
pseudo->otyp - SPE_MAGIC_MISSILE + 10,
otyp - SPE_MAGIC_MISSILE + 10,
spell_damage_bonus(u.ulevel / 2 + 1), 0,
(pseudo->otyp == SPE_CONE_OF_COLD)
(otyp == SPE_CONE_OF_COLD)
? EXPL_FROSTY
: EXPL_FIERY);
}
@@ -1073,12 +1074,13 @@ boolean atme;
}
}
break;
} /* else fall through... */
} /* else */
/*FALLTHRU*/
/* these spells are all duplicates of wand effects */
case SPE_FORCE_BOLT:
physical_damage = TRUE;
/* fall through */
/*FALLTHRU*/
case SPE_SLEEP:
case SPE_MAGIC_MISSILE:
case SPE_KNOCK:
@@ -1096,7 +1098,13 @@ boolean atme;
case SPE_EXTRA_HEALING:
case SPE_DRAIN_LIFE:
case SPE_STONE_TO_FLESH:
if (!(objects[pseudo->otyp].oc_dir == NODIR)) {
if (objects[otyp].oc_dir != NODIR) {
if (otyp == SPE_HEALING || otyp == SPE_EXTRA_HEALING) {
/* healing and extra healing are actually potion effects,
but they've been extended to take a direction like wands */
if (role_skill >= P_SKILLED)
pseudo->blessed = 1;
}
if (atme) {
u.dx = u.dy = u.dz = 0;
} else if (!getdir((char *) 0)) {
@@ -1136,7 +1144,7 @@ boolean atme;
/* high skill yields effect equivalent to blessed scroll */
if (role_skill >= P_SKILLED)
pseudo->blessed = 1;
/* fall through */
/*FALLTHRU*/
case SPE_CHARM_MONSTER:
case SPE_MAGIC_MAPPING:
case SPE_CREATE_MONSTER:
@@ -1152,7 +1160,7 @@ boolean atme;
/* high skill yields effect equivalent to blessed potion */
if (role_skill >= P_SKILLED)
pseudo->blessed = 1;
/* fall through */
/*FALLTHRU*/
case SPE_INVISIBILITY:
(void) peffects(pseudo);
break;

View File

@@ -138,7 +138,7 @@ struct obj *otmp;
boolean wake = TRUE; /* Most 'zaps' should wake monster */
boolean reveal_invis = FALSE, learn_it = FALSE;
boolean dbldam = Role_if(PM_KNIGHT) && u.uhave.questart;
boolean helpful_gesture = FALSE;
boolean skilled_spell, helpful_gesture = FALSE;
int dmg, otyp = otmp->otyp;
const char *zap_type_text = "spell";
struct obj *obj;
@@ -149,10 +149,12 @@ struct obj *otmp;
reveal_invis = FALSE;
notonhead = (mtmp->mx != bhitpos.x || mtmp->my != bhitpos.y);
skilled_spell = (otmp && otmp->oclass == SPBOOK_CLASS && otmp->blessed);
switch (otyp) {
case WAN_STRIKING:
zap_type_text = "wand";
/* fall through */
/*FALLTHRU*/
case SPE_FORCE_BOLT:
reveal_invis = TRUE;
if (disguised_mimic)
@@ -343,10 +345,12 @@ struct obj *otmp;
mtmp->mhp += d(6, otyp == SPE_EXTRA_HEALING ? 8 : 4);
if (mtmp->mhp > mtmp->mhpmax)
mtmp->mhp = mtmp->mhpmax;
if (mtmp->mblinded) {
mtmp->mblinded = 0;
mtmp->mcansee = 1;
}
/* plain healing must be blessed to cure blindness; extra
healing only needs to not be cursed, so spell always cures
[potions quaffed by monsters behave slightly differently;
we use the rules for the hero here...] */
if (skilled_spell || otyp == SPE_EXTRA_HEALING)
mcureblindness(mtmp, canseemon(mtmp));
if (canseemon(mtmp)) {
if (disguised_mimic) {
if (is_obj_mappear(mtmp,STRANGE_OBJECT)) {
@@ -2407,7 +2411,7 @@ boolean ordinary;
case SPE_EXTRA_HEALING:
learn_it = TRUE; /* (no effect for spells...) */
healup(d(6, obj->otyp == SPE_EXTRA_HEALING ? 8 : 4), 0, FALSE,
(obj->otyp == SPE_EXTRA_HEALING));
(obj->blessed || obj->otyp == SPE_EXTRA_HEALING));
You_feel("%sbetter.", obj->otyp == SPE_EXTRA_HEALING ? "much " : "");
break;
case WAN_LIGHT: /* (broken wand) */