mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
GameAction & Player: move the Sacrifice Trigger to Player and add SacrificedThisTurn to keep track of what was sacrificed.
This commit is contained in:
@@ -1225,17 +1225,7 @@ public class GameAction {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Play the Sacrifice sound
|
c.getController().addSacrificedThisTurn(c, source);
|
||||||
game.fireEvent(new GameEventCardSacrificed());
|
|
||||||
|
|
||||||
// Run triggers
|
|
||||||
final HashMap<String, Object> runParams = new HashMap<String, Object>();
|
|
||||||
// use a copy that preserves last known information about the card (e.g. for Savra, Queen of the Golgari + Painter's Servant)
|
|
||||||
runParams.put("Card", CardFactory.copyCardWithChangedStats(c, false));
|
|
||||||
runParams.put("Cause", source);
|
|
||||||
runParams.put("CostStack", game.costPaymentStack);
|
|
||||||
runParams.put("IndividualCostPaymentInstance", game.costPaymentStack.peek());
|
|
||||||
game.getTriggerHandler().runTrigger(TriggerType.Sacrificed, runParams, false);
|
|
||||||
|
|
||||||
return sacrificeDestroy(c);
|
return sacrificeDestroy(c);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,6 +104,8 @@ public class Player extends GameEntity implements Comparable<Player> {
|
|||||||
private int numDiscardedThisTurn = 0;
|
private int numDiscardedThisTurn = 0;
|
||||||
private int numCardsInHandStartedThisTurnWith = 0;
|
private int numCardsInHandStartedThisTurnWith = 0;
|
||||||
|
|
||||||
|
private CardCollection sacrificedThisTurn = new CardCollection();
|
||||||
|
|
||||||
/** A list of tokens not in play, but on their way.
|
/** A list of tokens not in play, but on their way.
|
||||||
* This list is kept in order to not break ETB-replacement
|
* This list is kept in order to not break ETB-replacement
|
||||||
* on tokens. */
|
* on tokens. */
|
||||||
@@ -2239,6 +2241,31 @@ public class Player extends GameEntity implements Comparable<Player> {
|
|||||||
investigatedThisTurn = 0;
|
investigatedThisTurn = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final CardCollectionView getSacrificedThisTurn() {
|
||||||
|
return sacrificedThisTurn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final void addSacrificedThisTurn(final Card c, final SpellAbility source) {
|
||||||
|
// Play the Sacrifice sound
|
||||||
|
game.fireEvent(new GameEventCardSacrificed());
|
||||||
|
|
||||||
|
final Card cpy = CardFactory.copyCardWithChangedStats(c, false);
|
||||||
|
sacrificedThisTurn.add(cpy);
|
||||||
|
|
||||||
|
// Run triggers
|
||||||
|
final HashMap<String, Object> runParams = new HashMap<String, Object>();
|
||||||
|
// use a copy that preserves last known information about the card (e.g. for Savra, Queen of the Golgari + Painter's Servant)
|
||||||
|
runParams.put("Card", cpy);
|
||||||
|
runParams.put("Cause", source);
|
||||||
|
runParams.put("CostStack", game.costPaymentStack);
|
||||||
|
runParams.put("IndividualCostPaymentInstance", game.costPaymentStack.peek());
|
||||||
|
game.getTriggerHandler().runTrigger(TriggerType.Sacrificed, runParams, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public final void resetSacrificedThisTurn() {
|
||||||
|
sacrificedThisTurn.clear();
|
||||||
|
}
|
||||||
|
|
||||||
public final int getSpellsCastThisTurn() {
|
public final int getSpellsCastThisTurn() {
|
||||||
return spellsCastThisTurn;
|
return spellsCastThisTurn;
|
||||||
}
|
}
|
||||||
@@ -2436,6 +2463,7 @@ public class Player extends GameEntity implements Comparable<Player> {
|
|||||||
setTappedLandForManaThisTurn(false);
|
setTappedLandForManaThisTurn(false);
|
||||||
resetLandsPlayedThisTurn();
|
resetLandsPlayedThisTurn();
|
||||||
resetInvestigatedThisTurn();
|
resetInvestigatedThisTurn();
|
||||||
|
resetSacrificedThisTurn();
|
||||||
clearAssignedDamage();
|
clearAssignedDamage();
|
||||||
resetAttackersDeclaredThisTurn();
|
resetAttackersDeclaredThisTurn();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user