summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/source/beam.cc2
-rw-r--r--crawl-ref/source/direct.cc2
-rw-r--r--crawl-ref/source/monstuff.cc47
-rw-r--r--crawl-ref/source/religion.cc7
-rw-r--r--crawl-ref/source/spells1.cc31
-rw-r--r--crawl-ref/source/spells1.h2
6 files changed, 63 insertions, 28 deletions
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index d2c8c10293..a1116db1f6 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -2083,7 +2083,7 @@ int mons_ench_f2(monsters *monster, bolt &pbolt)
if (YOU_KILL(pbolt.thrower))
{
if (cast_healing(5 + roll_dice( pbolt.damage ),
- monster->x - you.x_pos, monster->y - you.y_pos) > 0)
+ monster->x, monster->y) > 0)
{
pbolt.obvious_effect = true;
}
diff --git a/crawl-ref/source/direct.cc b/crawl-ref/source/direct.cc
index 76b6fc40dd..512bca6d62 100644
--- a/crawl-ref/source/direct.cc
+++ b/crawl-ref/source/direct.cc
@@ -470,7 +470,9 @@ void direction(dist& moves, targeting_type restricts,
if ((mode == TARG_ANY || mode == TARG_FRIEND)
&& moves.tx == you.x_pos && moves.ty == you.y_pos)
+ {
terse_describe_square(moves.target());
+ }
show_prompt = false;
}
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index f6f2f044a4..9bcb773088 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -470,13 +470,44 @@ static bool _is_pet_kill(killer_type killer, int i)
&& (me.who == KC_YOU || me.who == KC_FRIENDLY));
}
+// Elyvilon will occasionally (5% chance) protect the life of
+// one of your allies.
+static bool _ely_protects_ally(monsters *monster)
+{
+ ASSERT(you.religion == GOD_ELYVILON);
+
+ if (mons_holiness(monster) != MH_NATURAL
+ || !mons_friendly(monster)
+ || !one_chance_in(20))
+ {
+ return (false);
+ }
+
+ if (player_monster_visible(monster) && mons_near(monster))
+ {
+ monster->hit_points = 1;
+ snprintf(info, INFO_SIZE, " protects %s%s from harm!%s",
+ mons_is_unique(monster->type) ? "" : "your ",
+ monster->name(DESC_PLAIN).c_str(),
+ coinflip() ? "" : " You feel responsible.");
+ simple_god_message(info);
+ }
+ lose_piety(1);
+
+ return (true);
+}
+
+// Elyvilon retribution effect: heal hostile monsters that were about to
+// be killed by you or one of your friends
static bool _ely_heals_monster(monsters *monster, killer_type killer, int i)
{
+ ASSERT(you.religion != GOD_ELYVILON);
god_type god = GOD_ELYVILON;
- ASSERT(you.religion != god);
+
+ if (!you.penance[god] || !is_evil_god(you.religion))
+ return false;
const int ely_penance = you.penance[god];
- ASSERT(ely_penance > 0);
if (mons_holiness(monster) != MH_NATURAL
|| mons_friendly(monster)
@@ -531,14 +562,16 @@ static bool _monster_avoided_death(monsters *monster, killer_type killer, int i)
return (false);
}
- if (you.religion != GOD_ELYVILON && you.penance[GOD_ELYVILON]
- && _ely_heals_monster(monster, killer, i))
- {
+ // Elyvilon specials
+ if (you.religion == GOD_ELYVILON && _ely_protects_ally(monster))
return (true);
- }
- bool convert = false;
+ if (you.religion != GOD_ELYVILON && _ely_heals_monster(monster, killer, i))
+ return (true);
+ // Beogh special
+ bool convert = false;
+
if (you.religion == GOD_BEOGH
&& mons_species(monster->type) == MONS_ORC
&& !player_under_penance() && you.piety >= piety_breakpoint(2)
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc
index f5471f1182..24ad2d472a 100644
--- a/crawl-ref/source/religion.cc
+++ b/crawl-ref/source/religion.cc
@@ -1434,8 +1434,11 @@ bool did_god_conduct( conduct_type thing_done, int level, bool known,
case DID_FRIEND_DIES:
switch (you.religion)
{
- case GOD_ELYVILON:
- penance = level; // healer god cares more about this
+ case GOD_ELYVILON: // healer god cares more about this
+ if (you.penance[GOD_ELYVILON])
+ penance = 1; // if already under penance smaller bonus
+ else
+ penance = level;
// fall through
case GOD_ZIN: // in contrast to TSO, who doesn't mind martyrs
case GOD_OKAWARU:
diff --git a/crawl-ref/source/spells1.cc b/crawl-ref/source/spells1.cc
index ef903e2dec..01c06d2fd7 100644
--- a/crawl-ref/source/spells1.cc
+++ b/crawl-ref/source/spells1.cc
@@ -626,40 +626,37 @@ static bool _can_pacify_monster(const monsters *mon, const int healed)
return false;
}
-static int _healing_spell( int healed, int dir_x = 100, int dir_y = 100)
+static int _healing_spell( int healed, int target_x = -1, int target_y = -1)
{
ASSERT(healed >= 1);
- int mgr = 0;
- struct monsters *monster = 0; // NULL {dlb}
- struct dist bmove;
-
- if (dir_x == 100 || dir_y == 100)
+ dist bmove;
+ if (target_x == -1 || target_y == -1)
{
- mpr("Which direction?", MSGCH_PROMPT);
- direction( bmove, DIR_DIR, TARG_FRIEND );
+ mpr("Heal whom?", MSGCH_PROMPT);
+ direction( bmove, DIR_TARGET, TARG_FRIEND );
}
else
{
- bmove.dx = dir_x;
- bmove.dy = dir_y;
+ bmove.tx = target_x;
+ bmove.ty = target_y;
bmove.isValid = true;
}
- if (!bmove.isValid)
+ if (!bmove.isValid || !in_bounds(bmove.tx, bmove.ty))
{
canned_msg( MSG_OK );
return 0;
}
- if (bmove.dx == 0 && bmove.dy == 0)
+ if (bmove.tx == you.x_pos && bmove.ty == you.y_pos)
{
mpr("You are healed.");
inc_hp(healed, false);
return 1;
}
- mgr = mgrd[you.x_pos + bmove.dx][you.y_pos + bmove.dy];
+ const int mgr = mgrd[bmove.tx][bmove.ty];
if (mgr == NON_MONSTER)
{
@@ -667,7 +664,7 @@ static int _healing_spell( int healed, int dir_x = 100, int dir_y = 100)
return -1;
}
- monster = &menv[mgr];
+ monsters *monster = &menv[mgr];
// don't heal monster you can't pacify
if (you.religion == GOD_ELYVILON && _mons_hostile(monster)
@@ -738,12 +735,12 @@ char cast_greatest_healing( int pow )
}
#endif
-int cast_healing( int pow, int dir_x, int dir_y )
+int cast_healing( int pow, int target_x, int target_y )
{
if (pow > 50)
pow = 50;
- return (_healing_spell( pow + roll_dice( 2, pow ) - 2, dir_x, dir_y ));
+ return (_healing_spell( pow + roll_dice( 2, pow ) - 2, target_x, target_y ));
}
int cast_revitalisation( int pow )
@@ -752,7 +749,7 @@ int cast_revitalisation( int pow )
inc_mp(5, false);
// then cast healing (as in Minor Healing)
- return cast_healing(pow);
+ return cast_healing(pow, you.x_pos, you.y_pos); // target yourself
}
bool cast_revivification(int power)
diff --git a/crawl-ref/source/spells1.h b/crawl-ref/source/spells1.h
index f7a7f92fe4..91558644db 100644
--- a/crawl-ref/source/spells1.h
+++ b/crawl-ref/source/spells1.h
@@ -53,7 +53,7 @@ char cast_lesser_healing(void);
/* ***********************************************************************
* called from: ability - spell
* *********************************************************************** */
-int cast_healing(int power, int dir_x = 100, int dir_y = 100);
+int cast_healing(int power, int target_x = -1, int target_y = -1);
int cast_revitalisation(int power);
// last updated 24may2000 {dlb}