From f382ac5fc0137d0a2a58be30a893dfa9aa2723bd Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Thu, 20 Nov 2008 21:47:40 +0000 Subject: Add tiles for the sewers' murky (deep and shallow) water, as well as a yellow background for melded items in inventory. Allow higher level transformations (level 5 and above) to work even if your to-be-melded equipment is cursed, exempting weapons, as before. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7522 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/transfor.cc | 43 ++++++++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 13 deletions(-) (limited to 'crawl-ref/source/transfor.cc') diff --git a/crawl-ref/source/transfor.cc b/crawl-ref/source/transfor.cc index f677f4830a..0643dbef37 100644 --- a/crawl-ref/source/transfor.cc +++ b/crawl-ref/source/transfor.cc @@ -203,10 +203,24 @@ bool remove_one_equip(equipment_type eq) return remove_equipment(r); } +static bool _tran_may_meld_cursed(int transformation) +{ + switch (transformation) + { + case TRAN_SPIDER: + case TRAN_BAT: // Maybe this should depend on xp? + case TRAN_AIR: + case TRAN_ICE_BEAST: + return (false); + default: + return (true); + } +} + // Returns true if any piece of equipment that has to be removed is cursed. // Useful for keeping low level transformations from being too useful. -static bool check_for_cursed_equipment(const std::set &remove, - bool quiet = false) +static bool _check_for_cursed_equipment(const std::set &remove, + const int trans, bool quiet = false) { std::set::const_iterator iter; for (iter = remove.begin(); iter != remove.end(); ++iter) @@ -215,8 +229,11 @@ static bool check_for_cursed_equipment(const std::set &remove, if (you.equip[e] == -1) continue; - if (item_cursed( you.inv[ you.equip[e] ] )) + if (item_cursed( you.inv[ you.equip[e] ])) { + if (e != EQ_WEAPON && _tran_may_meld_cursed(trans)) + continue; + if (!quiet) { mpr( "Your cursed equipment won't allow you to complete the " @@ -228,7 +245,7 @@ static bool check_for_cursed_equipment(const std::set &remove, } return (false); -} // end check_for_cursed_equipment() +} // Count the stat boosts yielded by all items to be removed, and count // future losses (caused by the transformation) like a current stat boost, @@ -423,7 +440,7 @@ bool transform(int pow, transformation_type which_trans, bool quiet) switch (which_trans) { case TRAN_SPIDER: // also AC +3, ev +3, fast_run - if (check_for_cursed_equipment(rem_stuff, quiet)) + if (_check_for_cursed_equipment(rem_stuff, which_trans, quiet)) return (false); // Check in case we'll auto-remove stat boosting equipment. @@ -447,7 +464,7 @@ bool transform(int pow, transformation_type which_trans, bool quiet) return (true); case TRAN_BAT: - if (check_for_cursed_equipment(rem_stuff, quiet)) + if (_check_for_cursed_equipment(rem_stuff, which_trans, quiet)) return (false); if (check_transformation_stat_loss(rem_stuff, quiet, 5)) // Str loss = 5 @@ -475,7 +492,7 @@ bool transform(int pow, transformation_type which_trans, bool quiet) return (true); case TRAN_ICE_BEAST: // also AC +3, cold +3, fire -1, pois +1 - if (check_for_cursed_equipment(rem_stuff, quiet)) + if (_check_for_cursed_equipment(rem_stuff, which_trans, quiet)) return (false); // Check in case we'll auto-remove stat boosting equipment. @@ -502,7 +519,7 @@ bool transform(int pow, transformation_type which_trans, bool quiet) return (true); case TRAN_BLADE_HANDS: - if (check_for_cursed_equipment( rem_stuff )) + if (_check_for_cursed_equipment(rem_stuff, which_trans, quiet)) return (false); // Check in case we'll auto-remove stat boosting equipment. @@ -520,7 +537,7 @@ bool transform(int pow, transformation_type which_trans, bool quiet) return (true); case TRAN_STATUE: // also AC +20, ev -5, elec +1, pois +1, neg +1, slow - if (check_for_cursed_equipment(rem_stuff, quiet)) + if (_check_for_cursed_equipment(rem_stuff, which_trans, quiet)) return (false); if (check_transformation_stat_loss(rem_stuff, quiet, 0, 2)) // Dex loss = 2 @@ -556,7 +573,7 @@ bool transform(int pow, transformation_type which_trans, bool quiet) return (true); case TRAN_DRAGON: // also AC +10, ev -3, cold -1, fire +2, pois +1, flight - if (check_for_cursed_equipment(rem_stuff, quiet)) + if (_check_for_cursed_equipment(rem_stuff, which_trans, quiet)) return (false); // Check in case we'll auto-remove stat boosting equipment. @@ -618,7 +635,7 @@ bool transform(int pow, transformation_type which_trans, bool quiet) rem_stuff.insert(EQ_WEAPON); } - if (check_for_cursed_equipment(rem_stuff, quiet)) + if (_check_for_cursed_equipment(rem_stuff, which_trans, quiet)) return (false); if (check_transformation_stat_loss(rem_stuff, quiet)) @@ -654,7 +671,7 @@ bool transform(int pow, transformation_type which_trans, bool quiet) return (true); case TRAN_AIR: - if (check_for_cursed_equipment( rem_stuff )) + if (_check_for_cursed_equipment(rem_stuff, which_trans, quiet)) return (false); // Check in case we'll auto-remove stat boosting equipment. @@ -691,7 +708,7 @@ bool transform(int pow, transformation_type which_trans, bool quiet) return (true); case TRAN_SERPENT_OF_HELL: - if (check_for_cursed_equipment(rem_stuff, quiet)) + if (_check_for_cursed_equipment(rem_stuff, which_trans, quiet)) return (false); // Check in case we'll auto-remove stat boosting equipment. -- cgit v1.2.3-54-g00ecf