From 6ca45199e87459ed3c457a6205f3f8994a0d6987 Mon Sep 17 00:00:00 2001 From: dolorous Date: Wed, 23 Apr 2008 04:57:11 +0000 Subject: Expand the rarest possible (5%) blessings for TSO and Beogh, for when branding a monster's weapon with holy wrath and promoting an orc to an orc priest fail. TSO can now brand a monster's armor with positive energy, and Beogh can now brand a monster's weapon with electrocution. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@4507 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/religion.cc | 70 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) (limited to 'crawl-ref/source/religion.cc') diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index 7cd51a7a22..ae6abdc45f 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -881,6 +881,39 @@ static bool _blessing_healing(monsters *mon, bool extra) return heal_monster(mon, mon->max_hit_points, extra); } +static bool _tso_blessing_holy_arm(monsters* mon) +{ + if (mons_res_negative_energy(mon) == 3) + return false; + + // Pick either a monster's armour or its shield. + const int armour = mon->inv[MSLOT_ARMOUR]; + const int shield = mon->inv[MSLOT_SHIELD]; + + if (armour == NON_ITEM && shield == NON_ITEM) + return false; + + int slot; + + do + { + slot = (coinflip()) ? armour : shield; + } + while (slot == NON_ITEM); + + item_def& arm(mitm[slot]); + + if (is_artefact(arm) || get_armour_ego_type(arm) == SPARM_POSITIVE_ENERGY) + return false; + + // And make it resistant to negative energy. + set_equip_desc(arm, ISFLAG_GLOWING); + set_item_ego_type(arm, OBJ_ARMOUR, SPARM_POSITIVE_ENERGY); + arm.colour = YELLOW; + + return true; +} + static bool _tso_blessing_holy_wpn(monsters *mon) { // Pick a monster's weapon. @@ -1000,6 +1033,27 @@ static bool _beogh_blessing_priesthood(monsters* mon) return false; } +static bool _beogh_blessing_elec_wpn(monsters *mon) +{ + // Pick a monster's weapon. + const int weapon = mon->inv[MSLOT_WEAPON]; + + if (weapon == NON_ITEM) + return false; + + item_def& wpn(mitm[weapon]); + + if (is_artefact(wpn) || get_weapon_brand(wpn) == SPWPN_ELECTROCUTION) + return false; + + // And make it electric. + set_equip_desc(wpn, ISFLAG_GLOWING); + set_item_ego_type(wpn, OBJ_WEAPONS, SPWPN_ELECTROCUTION); + wpn.colour = YELLOW; + + return true; +} + // Bless the follower indicated in follower, if any. If there isn't // one, bless a random follower within sight of the player, if any. bool bless_follower(monsters* follower, @@ -1073,6 +1127,14 @@ bool bless_follower(monsters* follower, switch (god) { case GOD_SHINING_ONE: + // Brand a monster's armour with positive energy, if + // possible. + if (_tso_blessing_holy_arm(mon)) + { + result = "life defence"; + goto blessing_done; + } + // Brand a monster's weapon with holy wrath, if // possible. if (_tso_blessing_holy_wpn(mon)) @@ -1089,6 +1151,14 @@ bool bless_follower(monsters* follower, result = "priesthood"; goto blessing_done; } + + // Brand a monster's weapon with electrocution, if + // possible. + if (_beogh_blessing_elec_wpn(mon)) + { + result = "electric attack power"; + goto blessing_done; + } break; default: -- cgit v1.2.3-54-g00ecf