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 /src/cmd5.cc | |
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.
Diffstat (limited to 'src/cmd5.cc')
-rw-r--r-- | src/cmd5.cc | 19 |
1 files changed, 16 insertions, 3 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) { |