mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 04:08:01 +00:00
- Check if creatures in combat are actually still creatures during state checks
This commit is contained in:
@@ -874,6 +874,9 @@ public class GameAction {
|
|||||||
// 704.5m World rule
|
// 704.5m World rule
|
||||||
checkAgain |= this.handleWorldRule();
|
checkAgain |= this.handleWorldRule();
|
||||||
|
|
||||||
|
if (game.getCombat() != null)
|
||||||
|
game.getCombat().removeAbsentCombatants();
|
||||||
|
|
||||||
if (!checkAgain) {
|
if (!checkAgain) {
|
||||||
break; // do not continue the loop
|
break; // do not continue the loop
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -378,26 +378,27 @@ public class Combat {
|
|||||||
|
|
||||||
public final void removeAbsentCombatants() {
|
public final void removeAbsentCombatants() {
|
||||||
// iterate all attackers and remove them
|
// iterate all attackers and remove them
|
||||||
|
List<Card> missingCombatants = new ArrayList<>();
|
||||||
for(Entry<GameEntity, AttackingBand> ee : attackedByBands.entries()) {
|
for(Entry<GameEntity, AttackingBand> ee : attackedByBands.entries()) {
|
||||||
List<Card> atk = ee.getValue().getAttackers();
|
List<Card> atk = ee.getValue().getAttackers();
|
||||||
for(int i = atk.size() - 1; i >= 0; i--) { // might remove items from collection, so no iterators
|
for(int i = atk.size() - 1; i >= 0; i--) { // might remove items from collection, so no iterators
|
||||||
Card c = atk.get(i);
|
Card c = atk.get(i);
|
||||||
if ( !c.isInPlay() ) {
|
if ( !c.isInPlay() || !c.isCreature() ) {
|
||||||
unregisterAttacker(c, ee.getValue());
|
missingCombatants.add(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Collection<Card> toRemove = Lists.newArrayList();
|
Collection<Card> toRemove = Lists.newArrayList();
|
||||||
for(Entry<AttackingBand, Card> be : blockedBands.entries()) {
|
for(Entry<AttackingBand, Card> be : blockedBands.entries()) {
|
||||||
if ( !be.getValue().isInPlay() ) {
|
Card blocker = be.getValue();
|
||||||
unregisterDefender(be.getValue(), be.getKey());
|
if ( !blocker.isInPlay() || !blocker.isCreature() ) {
|
||||||
toRemove.add(be.getValue());
|
missingCombatants.add(blocker);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
blockedBands.values().removeAll(toRemove);
|
for (Card c : missingCombatants)
|
||||||
|
removeFromCombat(c);
|
||||||
} // verifyCreaturesInPlay()
|
}
|
||||||
|
|
||||||
|
|
||||||
// Call this method right after turn-based action of declare blockers has been performed
|
// Call this method right after turn-based action of declare blockers has been performed
|
||||||
|
|||||||
Reference in New Issue
Block a user