diff options
author | Bardur Arantsson <bardur@scientician.net> | 2016-03-10 18:41:54 +0100 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2016-03-10 19:02:23 +0100 |
commit | e0063a85b00ce615387ef637e1a3c6d542594338 (patch) | |
tree | e0161f1205895e31b43d9bfd9c2aefaaed4a7864 | |
parent | 8915788267bb1036c110195eb0a8826b6592cbd5 (diff) |
Don't allow Possessors to cast "too expensive" spells
This fixes the utter stupidity that is "system shock", aka. the ever
so clever "always-check-SP-before-casting-or-die" mechanic.
-rw-r--r-- | src/cmd5.cc | 19 | ||||
-rw-r--r-- | src/cmd7.cc | 17 |
2 files changed, 17 insertions, 19 deletions
diff --git a/src/cmd5.cc b/src/cmd5.cc index a7589e6c..986ed18f 100644 --- a/src/cmd5.cc +++ b/src/cmd5.cc @@ -709,7 +709,6 @@ static std::tuple<int, int> choose_monster_power(monster_race const *r_ptr, bool byte y = 1, x = 0; int ctr = 0; char dummy[80]; - strcpy(dummy, ""); prt ("", y++, x); @@ -720,11 +719,16 @@ static std::tuple<int, int> choose_monster_power(monster_race const *r_ptr, bool label = (ctr < 26) ? I2A(ctr) : I2D(ctr - 26); + byte color = TERM_L_GREEN; if (!symbiosis) { int mana = calc_monster_spell_mana(mp_ptr); strnfmt(dummy, 80, " %c) %2d %s", label, mana, mp_ptr->name); + // Gray out if player doesn't have enough mana to cast. + if (mana > p_ptr->csp) { + color = TERM_L_DARK; + } } else { @@ -734,11 +738,11 @@ static std::tuple<int, int> choose_monster_power(monster_race const *r_ptr, bool if (ctr < 17) { - prt(dummy, y + ctr, x); + c_prt(color, dummy, y + ctr, x); } else { - prt(dummy, y + ctr - 17, x + 40); + c_prt(color, dummy, y + ctr - 17, x + 40); } ctr++; @@ -797,6 +801,15 @@ static std::tuple<int, int> choose_monster_power(monster_race const *r_ptr, bool /* Save the spell index */ power = powers[i]; + /* Make sure it's actually possible for the player to cast */ + if (!symbiosis) { + if (p_ptr->csp < calc_monster_spell_mana(&monster_powers[power])) + { + bell(); + continue; + } + } + /* Verify it */ if (ask) { diff --git a/src/cmd7.cc b/src/cmd7.cc index a27d7e4b..7b6cd8d2 100644 --- a/src/cmd7.cc +++ b/src/cmd7.cc @@ -1842,22 +1842,7 @@ void do_cmd_possessor() /* Select power */ use_monster_power(p_ptr->body_monster, use_great); - - if (p_ptr->csp < 0) - { - msg_print("You lose control of your body!"); - if (!do_cmd_leave_body(FALSE)) - { - cmsg_print(TERM_VIOLET, - "You are forced back into your body by your cursed items, " - "you suffer a system shock!"); - - p_ptr->chp = 1; - - /* Display the hitpoints */ - p_ptr->redraw |= (PR_FRAME); - } - } + assert(p_ptr->csp >= 0); // Sanity check } else if (ext == 2) { |