mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-13 01:08:25 +07:00
Fix crash when melee unit captures civilian then tries to attack it (#7282)
This commit is contained in:

committed by
GitHub

parent
51caf7a4ed
commit
50a8ff3ce0
@ -58,6 +58,10 @@ object Battle {
|
|||||||
* but the hidden tile is actually IMPASSIBLE so you stop halfway!
|
* but the hidden tile is actually IMPASSIBLE so you stop halfway!
|
||||||
*/
|
*/
|
||||||
if (attacker.getTile() != attackableTile.tileToAttackFrom) return false
|
if (attacker.getTile() != attackableTile.tileToAttackFrom) return false
|
||||||
|
/** Rarely, a melee unit will target a civilian then move through the civilian to get
|
||||||
|
* to attackableTile.tileToAttackFrom, meaning that they take the civilian. This check stops
|
||||||
|
* the melee unit from trying to capture their own unit if this happens */
|
||||||
|
if (getMapCombatantOfTile(attackableTile.tileToAttack)!!.getCivInfo() == attacker.getCivInfo()) return false
|
||||||
/** Alternatively, maybe we DID reach that tile, but it turned out to be a hill or something,
|
/** Alternatively, maybe we DID reach that tile, but it turned out to be a hill or something,
|
||||||
* so we expended all of our movement points!
|
* so we expended all of our movement points!
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user