void TroopsMover::moveTroops(Army* army, Hexagon* endHex) { // used for achievements and shake const int armySize = army->getTroopsCount(); const int endHexArmySize = endHex->getTroopsCount(); Hexagon* startHex = army->getCurrentHex(); const int troops = army->getTroopsCount(); startHex->removeArmy(army); if(troops == 0){ army->free(); return; } if(endHex->getOwner() == startHex->getOwner()){ endHex->addArmy(army); }else{ AttackResult attackResult = getAttackResult(army, endHex); updateAchievements(army->getCurrentHex()->getOwner(), attackResult, armySize, endHexArmySize, endHex); handleAttackResult(attackResult, army, startHex, endHex); if(attackResult == DefenderWins){ if(endHex->getOwner()) EffectPlayer::playAttackEffect(); } checkAndShake(armySize, endHexArmySize, endHex); } if((endHex->getTroopsCount() > 0) && (startHex != endHex)){ endHex->runScaleAction(); } }