diff options
author | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-03-23 00:38:15 +0000 |
---|---|---|
committer | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-03-23 00:38:15 +0000 |
commit | 435e410c4c086fa96d6068c1f7da3bd7f16f7a1c (patch) | |
tree | ba8dbcb93804a8b5d79214fbf59f2025bd60c3a5 /crawl-ref/source/monstuff.cc | |
parent | c6e3890c040c7bcde1b16682f1ee519229be09e2 (diff) | |
download | crawl-ref-435e410c4c086fa96d6068c1f7da3bd7f16f7a1c.tar.gz crawl-ref-435e410c4c086fa96d6068c1f7da3bd7f16f7a1c.zip |
Elyvilon will now rarely (5% chance) protect allies from harm.
Since this only leaves them with 1 hp, they'll soon be dead anyway,
so I consider it as a mixture of flavour and a warning to the player
to heal the ally in question.
Make the retribution healing hostiles effect only happen if you
worship an evil god, as is done for the other retribution effects.
Allow healing to choose a target rather than a direction, but allow
Revitalisation (Zin!) to only work on the player. (That's how it was
intended, I think.)
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3817 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/monstuff.cc')
-rw-r--r-- | crawl-ref/source/monstuff.cc | 47 |
1 files changed, 40 insertions, 7 deletions
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) |