소스 검색

Consider wide units (avoiding self attack trouble)

Andrej Dudenhefner 1 개월 전
부모
커밋
7161ce858e
1개의 변경된 파일3개의 추가작업 그리고 3개의 파일을 삭제
  1. 3 3
      client/battle/BattleActionsController.cpp

+ 3 - 3
client/battle/BattleActionsController.cpp

@@ -653,11 +653,11 @@ bool BattleActionsController::actionIsLegal(PossiblePlayerBattleAction action, c
 		case PossiblePlayerBattleAction::WALK_AND_ATTACK:
 		case PossiblePlayerBattleAction::WALK_AND_ATTACK:
 		case PossiblePlayerBattleAction::ATTACK_AND_RETURN:
 		case PossiblePlayerBattleAction::ATTACK_AND_RETURN:
 			{
 			{
-				auto activeStackHex = owner.stacksController->getActiveStack()->getPosition();
-				if (targetHex != activeStackHex && owner.fieldController->isTileAttackable(targetHex)) // move isTileAttackable to be part of battleCanAttack?
+				auto activeStack = owner.stacksController->getActiveStack();
+				if (targetStack && targetStack != activeStack && owner.fieldController->isTileAttackable(targetHex)) // move isTileAttackable to be part of battleCanAttack?
 				{
 				{
 					BattleHex attackFromHex = owner.fieldController->fromWhichHexAttack(targetHex);
 					BattleHex attackFromHex = owner.fieldController->fromWhichHexAttack(targetHex);
-					if(owner.getBattle()->battleCanAttack(owner.stacksController->getActiveStack(), targetStack, attackFromHex))
+					if(owner.getBattle()->battleCanAttack(activeStack, targetStack, attackFromHex))
 						return true;
 						return true;
 				}
 				}
 				return false;
 				return false;