summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cmd5.cc19
-rw-r--r--src/cmd7.cc17
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)
{