mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-12 16:58:57 +00:00
"this combat" bug (#4547)
* fixed bug in cards using 'this combat' * handle tracking when creature removed from combat early
This commit is contained in:
@@ -309,5 +309,8 @@ public class CardDamageHistory {
|
|||||||
|
|
||||||
public void endCombat() {
|
public void endCombat() {
|
||||||
damagedThisCombat.clear();
|
damagedThisCombat.clear();
|
||||||
|
setCreatureAttackedThisCombat(null, -1);
|
||||||
|
setCreatureBlockedThisCombat(false);
|
||||||
|
setCreatureGotBlockedThisCombat(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ import forge.game.spellability.SpellAbility;
|
|||||||
import forge.game.spellability.SpellAbilityStackInstance;
|
import forge.game.spellability.SpellAbilityStackInstance;
|
||||||
import forge.game.staticability.StaticAbilityAssignCombatDamageAsUnblocked;
|
import forge.game.staticability.StaticAbilityAssignCombatDamageAsUnblocked;
|
||||||
import forge.game.trigger.TriggerType;
|
import forge.game.trigger.TriggerType;
|
||||||
|
import forge.game.zone.ZoneType;
|
||||||
import forge.util.CardTranslation;
|
import forge.util.CardTranslation;
|
||||||
import forge.util.Localizer;
|
import forge.util.Localizer;
|
||||||
import forge.util.collect.FCollection;
|
import forge.util.collect.FCollection;
|
||||||
@@ -154,13 +155,18 @@ public class Combat {
|
|||||||
lkiCache.clear();
|
lkiCache.clear();
|
||||||
combatantsThatDealtFirstStrikeDamage.clear();
|
combatantsThatDealtFirstStrikeDamage.clear();
|
||||||
|
|
||||||
|
//clear tracking for cards that care about "this combat"
|
||||||
|
Game game = playerWhoAttacks.getGame();
|
||||||
|
for (Card c : game.getCardsIncludePhasingIn(ZoneType.Battlefield)) {
|
||||||
|
c.getDamageHistory().endCombat();
|
||||||
|
}
|
||||||
|
playerWhoAttacks.clearAttackedPlayersMyCombat();
|
||||||
|
|
||||||
//update view for all attackers and blockers
|
//update view for all attackers and blockers
|
||||||
for (Card c : attackers) {
|
for (Card c : attackers) {
|
||||||
c.getDamageHistory().endCombat();
|
|
||||||
c.updateAttackingForView();
|
c.updateAttackingForView();
|
||||||
}
|
}
|
||||||
for (Card c : blockers) {
|
for (Card c : blockers) {
|
||||||
c.getDamageHistory().endCombat();
|
|
||||||
c.updateBlockingForView();
|
c.updateBlockingForView();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -675,7 +675,6 @@ public class PhaseHandler implements java.io.Serializable {
|
|||||||
game.getTriggerHandler().runTrigger(TriggerType.AttackersDeclared, runParams, false);
|
game.getTriggerHandler().runTrigger(TriggerType.AttackersDeclared, runParams, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
playerTurn.clearAttackedPlayersMyCombat();
|
|
||||||
for (final Card c : combat.getAttackers()) {
|
for (final Card c : combat.getAttackers()) {
|
||||||
CombatUtil.checkDeclaredAttacker(game, c, combat, true);
|
CombatUtil.checkDeclaredAttacker(game, c, combat, true);
|
||||||
}
|
}
|
||||||
@@ -1275,9 +1274,6 @@ public class PhaseHandler implements java.io.Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void endCombat() {
|
public void endCombat() {
|
||||||
for (Player player : game.getPlayers()) {
|
|
||||||
player.resetCombatantsThisCombat();
|
|
||||||
}
|
|
||||||
game.getEndOfCombat().executeUntil();
|
game.getEndOfCombat().executeUntil();
|
||||||
game.getEndOfCombat().executeUntilEndOfPhase(playerTurn);
|
game.getEndOfCombat().executeUntilEndOfPhase(playerTurn);
|
||||||
if (inCombat()) {
|
if (inCombat()) {
|
||||||
|
|||||||
@@ -2741,23 +2741,6 @@ public class Player extends GameEntity implements Comparable<Player> {
|
|||||||
view.updateCurrentPlaneName(currentPlanes.toString().replaceAll(" \\(.*","").replace("[",""));
|
view.updateCurrentPlaneName(currentPlanes.toString().replaceAll(" \\(.*","").replace("[",""));
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void resetCombatantsThisCombat() {
|
|
||||||
// resets the status of attacked/blocked this phase
|
|
||||||
CardCollectionView list = getCardsIn(ZoneType.Battlefield, false);
|
|
||||||
|
|
||||||
for (Card c : list) {
|
|
||||||
if (c.getDamageHistory().getCreatureAttackedThisCombat() > 0) {
|
|
||||||
c.getDamageHistory().setCreatureAttackedThisCombat(null, -1);
|
|
||||||
}
|
|
||||||
if (c.getDamageHistory().getCreatureBlockedThisCombat()) {
|
|
||||||
c.getDamageHistory().setCreatureBlockedThisCombat(false);
|
|
||||||
}
|
|
||||||
if (c.getDamageHistory().getCreatureGotBlockedThisCombat()) {
|
|
||||||
c.getDamageHistory().setCreatureGotBlockedThisCombat(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public CardCollectionView getInboundTokens() {
|
public CardCollectionView getInboundTokens() {
|
||||||
return inboundTokens;
|
return inboundTokens;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user