소스 검색

better approach

Laserlicht 1 년 전
부모
커밋
e46f5f705b
2개의 변경된 파일3개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      client/battle/BattleWindow.cpp
  2. 2 0
      lib/battle/CBattleInfoCallback.cpp

+ 1 - 1
client/battle/BattleWindow.cpp

@@ -838,7 +838,7 @@ void BattleWindow::blockUI(bool on)
 		ESpellCastProblem spellcastingProblem = owner.getBattle()->battleCanCastSpell(hero, spells::Mode::HERO);
 
 		//if magic is blocked, we leave button active, so the message can be displayed after button click
-		canCastSpells = (spellcastingProblem == ESpellCastProblem::OK || spellcastingProblem == ESpellCastProblem::MAGIC_IS_BLOCKED) && hero->hasSpellbook();
+		canCastSpells = spellcastingProblem == ESpellCastProblem::OK || spellcastingProblem == ESpellCastProblem::MAGIC_IS_BLOCKED;
 	}
 
 	bool canWait = owner.stacksController->getActiveStack() ? !owner.stacksController->getActiveStack()->waitedThisTurn : false;

+ 2 - 0
lib/battle/CBattleInfoCallback.cpp

@@ -128,6 +128,8 @@ ESpellCastProblem CBattleInfoCallback::battleCanCastSpell(const spells::Caster *
 			return ESpellCastProblem::NO_HERO_TO_CAST_SPELL;
 		if(hero->hasBonusOfType(BonusType::BLOCK_ALL_MAGIC))
 			return ESpellCastProblem::MAGIC_IS_BLOCKED;
+		if(!hero->hasSpellbook())
+			return ESpellCastProblem::NO_SPELLBOOK;
 	}
 		break;
 	default: