mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
Clean up logic (#6928)
This commit is contained in:
@@ -1185,6 +1185,12 @@ public class Game {
|
|||||||
for (Player player : getRegisteredPlayers()) {
|
for (Player player : getRegisteredPlayers()) {
|
||||||
player.onCleanupPhase();
|
player.onCleanupPhase();
|
||||||
}
|
}
|
||||||
|
for (final Card c : getCardsIncludePhasingIn(ZoneType.Battlefield)) {
|
||||||
|
c.onCleanupPhase(getPhaseHandler().getPlayerTurn());
|
||||||
|
}
|
||||||
|
for (final Card card : getCardsInGame()) {
|
||||||
|
card.resetActivationsPerTurn();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addCounterAddedThisTurn(Player putter, CounterType cType, Card card, Integer value) {
|
public void addCounterAddedThisTurn(Player putter, CounterType cType, Card card, Integer value) {
|
||||||
|
|||||||
@@ -82,12 +82,6 @@ public class GameAction {
|
|||||||
game = game0;
|
game = game0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void resetActivationsPerTurn() {
|
|
||||||
for (final Card card : game.getCardsInGame()) {
|
|
||||||
card.resetActivationsPerTurn();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Card changeZone(final Zone zoneFrom, Zone zoneTo, final Card c, Integer position, SpellAbility cause) {
|
public Card changeZone(final Zone zoneFrom, Zone zoneTo, final Card c, Integer position, SpellAbility cause) {
|
||||||
return changeZone(zoneFrom, zoneTo, c, position, cause, null);
|
return changeZone(zoneFrom, zoneTo, c, position, cause, null);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7271,10 +7271,6 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars, ITr
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onCleanupPhase(final Player turn) {
|
public void onCleanupPhase(final Player turn) {
|
||||||
if (!StaticAbilityNoCleanupDamage.damageNotRemoved(this)) {
|
|
||||||
setDamage(0);
|
|
||||||
}
|
|
||||||
setHasBeenDealtDeathtouchDamage(false);
|
|
||||||
resetExcessDamage();
|
resetExcessDamage();
|
||||||
setRegeneratedThisTurn(0);
|
setRegeneratedThisTurn(0);
|
||||||
resetShieldCount();
|
resetShieldCount();
|
||||||
|
|||||||
@@ -374,7 +374,6 @@ public class CombatUtil {
|
|||||||
final GameEntity defender = combat.getDefenderByAttacker(c);
|
final GameEntity defender = combat.getDefenderByAttacker(c);
|
||||||
final List<Card> otherAttackers = combat.getAttackers();
|
final List<Card> otherAttackers = combat.getAttackers();
|
||||||
|
|
||||||
// Run triggers
|
|
||||||
if (triggers) {
|
if (triggers) {
|
||||||
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
|
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
|
||||||
runParams.put(AbilityKey.Attacker, c);
|
runParams.put(AbilityKey.Attacker, c);
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ import forge.game.replacement.ReplacementResult;
|
|||||||
import forge.game.replacement.ReplacementType;
|
import forge.game.replacement.ReplacementType;
|
||||||
|
|
||||||
import forge.game.spellability.SpellAbility;
|
import forge.game.spellability.SpellAbility;
|
||||||
|
import forge.game.staticability.StaticAbilityNoCleanupDamage;
|
||||||
import forge.game.trigger.Trigger;
|
import forge.game.trigger.Trigger;
|
||||||
import forge.game.trigger.TriggerType;
|
import forge.game.trigger.TriggerType;
|
||||||
import forge.game.zone.Zone;
|
import forge.game.zone.Zone;
|
||||||
@@ -180,8 +181,6 @@ public class PhaseHandler implements java.io.Serializable {
|
|||||||
}
|
}
|
||||||
playerTurn.incrementTurn();
|
playerTurn.incrementTurn();
|
||||||
|
|
||||||
game.getAction().resetActivationsPerTurn();
|
|
||||||
|
|
||||||
final int lands = CardLists.count(playerTurn.getLandsInPlay(), CardPredicates.UNTAPPED);
|
final int lands = CardLists.count(playerTurn.getLandsInPlay(), CardPredicates.UNTAPPED);
|
||||||
playerTurn.setNumPowerSurgeLands(lands);
|
playerTurn.setNumPowerSurgeLands(lands);
|
||||||
}
|
}
|
||||||
@@ -395,7 +394,10 @@ public class PhaseHandler implements java.io.Serializable {
|
|||||||
// Rule 514.2
|
// Rule 514.2
|
||||||
// Reset Damage received map
|
// Reset Damage received map
|
||||||
for (final Card c : game.getCardsIncludePhasingIn(ZoneType.Battlefield)) {
|
for (final Card c : game.getCardsIncludePhasingIn(ZoneType.Battlefield)) {
|
||||||
c.onCleanupPhase(playerTurn);
|
if (!StaticAbilityNoCleanupDamage.damageNotRemoved(c)) {
|
||||||
|
c.setDamage(0);
|
||||||
|
}
|
||||||
|
c.setHasBeenDealtDeathtouchDamage(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
game.getEndOfTurn().executeUntil();
|
game.getEndOfTurn().executeUntil();
|
||||||
|
|||||||
@@ -1994,8 +1994,8 @@ public class Player extends GameEntity implements Comparable<Player> {
|
|||||||
final PlayerZone com = getZone(ZoneType.Command);
|
final PlayerZone com = getZone(ZoneType.Command);
|
||||||
DetachedCardEffect eff = new DetachedCardEffect(this, "Speed Effect");
|
DetachedCardEffect eff = new DetachedCardEffect(this, "Speed Effect");
|
||||||
String trigger = "Mode$ LifeLost | ValidPlayer$ Opponent | TriggerZones$ Command | ActivationLimit$ 1 | " +
|
String trigger = "Mode$ LifeLost | ValidPlayer$ Opponent | TriggerZones$ Command | ActivationLimit$ 1 | " +
|
||||||
"PlayerTurn$ True | TriggerDescription$ Your speed increases once on each of your turns when an " +
|
"PlayerTurn$ True | CheckSVar$ Count$YourSpeed | SVarCompare$ LT4 | "
|
||||||
"opponent loses life.";
|
+ "TriggerDescription$ Your speed increases once on each of your turns when an opponent loses life.";
|
||||||
String speedUp = "DB$ ChangeSpeed";
|
String speedUp = "DB$ ChangeSpeed";
|
||||||
Trigger lifeLostTrigger = TriggerHandler.parseTrigger(trigger, eff, true);
|
Trigger lifeLostTrigger = TriggerHandler.parseTrigger(trigger, eff, true);
|
||||||
lifeLostTrigger.setOverridingAbility(AbilityFactory.getAbility(speedUp, eff));
|
lifeLostTrigger.setOverridingAbility(AbilityFactory.getAbility(speedUp, eff));
|
||||||
|
|||||||
@@ -56,9 +56,6 @@ public class TriggerAttackerBlockedByCreature extends Trigger {
|
|||||||
public final boolean performTest(final Map<AbilityKey, Object> runParams) {
|
public final boolean performTest(final Map<AbilityKey, Object> runParams) {
|
||||||
final Object a = runParams.get(AbilityKey.Attacker),
|
final Object a = runParams.get(AbilityKey.Attacker),
|
||||||
b = runParams.get(AbilityKey.Blocker);
|
b = runParams.get(AbilityKey.Blocker);
|
||||||
if (!(a instanceof Card && b instanceof Card)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
final Card attacker = (Card) a,
|
final Card attacker = (Card) a,
|
||||||
blocker = (Card) b;
|
blocker = (Card) b;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ ManaCost:2 W
|
|||||||
Types:Instant
|
Types:Instant
|
||||||
A:SP$ UntapAll | ValidCards$ Creature.White+YouCtrl | SubAbility$ Battlecry | SpellDescription$ Untap all white creatures you control. Whenever a creature blocks this turn, it gets +0/+1 until end of turn.
|
A:SP$ UntapAll | ValidCards$ Creature.White+YouCtrl | SubAbility$ Battlecry | SpellDescription$ Untap all white creatures you control. Whenever a creature blocks this turn, it gets +0/+1 until end of turn.
|
||||||
SVar:Battlecry:DB$ Effect | Triggers$ TrigBlocking
|
SVar:Battlecry:DB$ Effect | Triggers$ TrigBlocking
|
||||||
SVar:TrigBlocking:Mode$ AttackerBlocked | Execute$ Pump | TriggerDescription$ Whenever a creature blocks this turn, it gets +0/+1 until end of turn.
|
SVar:TrigBlocking:Mode$ Blocks | Execute$ Pump | TriggerDescription$ Whenever a creature blocks this turn, it gets +0/+1 until end of turn.
|
||||||
SVar:Pump:DB$ Pump | Defined$ TriggeredBlockerLKICopy | NumDef$ 1
|
SVar:Pump:DB$ Pump | Defined$ TriggeredBlockerLKICopy | NumDef$ 1
|
||||||
AI:RemoveDeck:All
|
AI:RemoveDeck:All
|
||||||
Oracle:Untap all white creatures you control.\nWhenever a creature blocks this turn, it gets +0/+1 until end of turn.
|
Oracle:Untap all white creatures you control.\nWhenever a creature blocks this turn, it gets +0/+1 until end of turn.
|
||||||
|
|||||||
@@ -4,5 +4,5 @@ Types:Legendary Creature Human Scientist
|
|||||||
PT:2/2
|
PT:2/2
|
||||||
T:Mode$ Drawn | ValidPlayer$ Player | Number$ 2 | TriggerZones$ Battlefield | Execute$ TrigDig | TriggerDescription$ Whenever a player draws their second card each turn, that player exiles the top card of their library.
|
T:Mode$ Drawn | ValidPlayer$ Player | Number$ 2 | TriggerZones$ Battlefield | Execute$ TrigDig | TriggerDescription$ Whenever a player draws their second card each turn, that player exiles the top card of their library.
|
||||||
SVar:TrigDig:DB$ Dig | Defined$ TriggeredPlayer | DigNum$ 1 | Reveal$ True | ChangeNum$ All | ChangeValid$ Card | RememberChanged$ True | DestinationZone$ Exile
|
SVar:TrigDig:DB$ Dig | Defined$ TriggeredPlayer | DigNum$ 1 | Reveal$ True | ChangeNum$ All | ChangeValid$ Card | RememberChanged$ True | DestinationZone$ Exile
|
||||||
S:Mode$ Continuous | Affected$ Card.ExiledWithSource+YouDontOwn | MayPlay$ True | MayPlayLimit$ 1 | MayPlayIgnoreType$ True | MayPlayPlayer$ ActivePlayer | EffectZone$ Battlefield | AffectedZone$ Exile | Description$ During each player's turn, that player may cast a spell from among the cards they don't own exiled with CARDNAME and mana of any type can be spent to cast it.
|
S:Mode$ Continuous | Affected$ Card.ExiledWithSource+!OwnedBy ActivePlayer | MayPlay$ True | MayPlayLimit$ 1 | MayPlayIgnoreType$ True | MayPlayPlayer$ ActivePlayer | EffectZone$ Battlefield | AffectedZone$ Exile | Description$ During each player's turn, that player may cast a spell from among the cards they don't own exiled with CARDNAME and mana of any type can be spent to cast it.
|
||||||
Oracle:Whenever a player draws their second card each turn, that player exiles the top card of their library.\nDuring each player's turn, that player may cast a spell from among the cards they don't own exiled with Ian Malcolm, Chaotician, and mana of any type can be spent to cast it.
|
Oracle:Whenever a player draws their second card each turn, that player exiles the top card of their library.\nDuring each player's turn, that player may cast a spell from among the cards they don't own exiled with Ian Malcolm, Chaotician, and mana of any type can be spent to cast it.
|
||||||
|
|||||||
@@ -3,6 +3,6 @@ ManaCost:2 B B
|
|||||||
Types:Sorcery
|
Types:Sorcery
|
||||||
A:SP$ Destroy | ValidTgts$ Creature,Planeswalker | TgtPrompt$ Select target creature or planeswalker | SubAbility$ DBEffect | SpellDescription$ Destroy target creature or planeswalker.
|
A:SP$ Destroy | ValidTgts$ Creature,Planeswalker | TgtPrompt$ Select target creature or planeswalker | SubAbility$ DBEffect | SpellDescription$ Destroy target creature or planeswalker.
|
||||||
SVar:DBEffect:DB$ Effect | Triggers$ TrigBlocking
|
SVar:DBEffect:DB$ Effect | Triggers$ TrigBlocking
|
||||||
SVar:TrigBlocking:Mode$ AttackerBlocked | Execute$ TrigLoseLife | TriggerDescription$ Whenever a creature blocks this turn, its controller loses 1 life.
|
SVar:TrigBlocking:Mode$ Blocks | Execute$ TrigLoseLife | TriggerDescription$ Whenever a creature blocks this turn, its controller loses 1 life.
|
||||||
SVar:TrigLoseLife:DB$ LoseLife | Defined$ TriggeredBlockerController | LifeAmount$ 1
|
SVar:TrigLoseLife:DB$ LoseLife | Defined$ TriggeredBlockerController | LifeAmount$ 1
|
||||||
Oracle:Destroy target creature or planeswalker.\nWhenever a creature blocks this turn, its controller loses 1 life.
|
Oracle:Destroy target creature or planeswalker.\nWhenever a creature blocks this turn, its controller loses 1 life.
|
||||||
|
|||||||
@@ -6,10 +6,10 @@ T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.S
|
|||||||
SVar:TrigTreasure:DB$ Token | TokenAmount$ 1 | TokenScript$ c_a_treasure_sac | TokenOwner$ You
|
SVar:TrigTreasure:DB$ Token | TokenAmount$ 1 | TokenScript$ c_a_treasure_sac | TokenOwner$ You
|
||||||
T:Mode$ AttackersDeclared | AttackingPlayer$ You | Execute$ TrigSac | TriggerZones$ Battlefield | TriggerDescription$ Whenever you attack, you may sacrifice one or more Treasures. When you do, up to that many target creatures gain double strike until end of turn.
|
T:Mode$ AttackersDeclared | AttackingPlayer$ You | Execute$ TrigSac | TriggerZones$ Battlefield | TriggerDescription$ Whenever you attack, you may sacrifice one or more Treasures. When you do, up to that many target creatures gain double strike until end of turn.
|
||||||
SVar:TrigSac:DB$ Sacrifice | Defined$ You | Amount$ X | SacValid$ Treasure | SacMessage$ treasure | Optional$ True | RememberSacrificed$ True | SubAbility$ TrigImmediateTrig
|
SVar:TrigSac:DB$ Sacrifice | Defined$ You | Amount$ X | SacValid$ Treasure | SacMessage$ treasure | Optional$ True | RememberSacrificed$ True | SubAbility$ TrigImmediateTrig
|
||||||
SVar:TrigImmediateTrig:DB$ ImmediateTrigger | Execute$ DBPump | TriggerDescription$ When you do, up to that many target creatures gain double strike until end of turn.
|
SVar:TrigImmediateTrig:DB$ ImmediateTrigger | Execute$ DBPump | ConditionDefined$ RememberedLKI | ConditionPresent$ Card | RememberObjects$ RememberedLKI | SubAbility$ DBCleanup | TriggerDescription$ When you do, up to that many target creatures gain double strike until end of turn.
|
||||||
SVar:DBPump:DB$ Pump | ValidTgts$ Creature | KW$ Double Strike | TargetMin$ 0 | TargetMax$ DBSize | SubAbility$ DBCleanup | TgtPrompt$ Select target creatures | StackDescription$ {c:Targeted} gain double strike until end of turn. | SpellDescription$ Up to that many target creatures gain double strike until end of turn.
|
SVar:DBPump:DB$ Pump | ValidTgts$ Creature | KW$ Double Strike | TargetMin$ 0 | TargetMax$ DBSize | TgtPrompt$ Select target creatures | StackDescription$ {c:Targeted} gain double strike until end of turn. | SpellDescription$ Up to that many target creatures gain double strike until end of turn.
|
||||||
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
|
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
|
||||||
SVar:DBSize:Count$RememberedSize
|
SVar:DBSize:TriggerRemembered$Amount
|
||||||
SVar:X:Count$Valid Treasure.YouCtrl
|
SVar:X:Count$Valid Treasure.YouCtrl
|
||||||
AI:RemoveDeck:All
|
AI:RemoveDeck:All
|
||||||
DeckHas:Ability$Token|Sacrifice & Type$Treasure|Artifact
|
DeckHas:Ability$Token|Sacrifice & Type$Treasure|Artifact
|
||||||
|
|||||||
Reference in New Issue
Block a user