Merge branch 'master' into master2

This commit is contained in:
Anthony Calosa
2024-09-20 20:19:12 +08:00
14 changed files with 38 additions and 16 deletions

View File

@@ -137,6 +137,7 @@ public enum AbilityKey {
Targets("Targets"), Targets("Targets"),
Token("Token"), Token("Token"),
TokenNum("TokenNum"), TokenNum("TokenNum"),
Valiant("Valiant"),
Vehicle("Vehicle"), Vehicle("Vehicle"),
Won("Won"), Won("Won"),

View File

@@ -188,7 +188,7 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars, ITr
private boolean startsGameInPlay = false; private boolean startsGameInPlay = false;
private boolean drawnThisTurn = false; private boolean drawnThisTurn = false;
private boolean foughtThisTurn = false; private boolean foughtThisTurn = false;
private boolean becameTargetThisTurn = false; private boolean becameTargetThisTurn, valiant = false;
private boolean enlistedThisCombat = false; private boolean enlistedThisCombat = false;
private boolean startedTheTurnUntapped = false; private boolean startedTheTurnUntapped = false;
private boolean cameUnderControlSinceLastUpkeep = true; // for Echo private boolean cameUnderControlSinceLastUpkeep = true; // for Echo
@@ -3702,6 +3702,12 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars, ITr
public void setBecameTargetThisTurn(boolean becameTargetThisTurn0) { public void setBecameTargetThisTurn(boolean becameTargetThisTurn0) {
becameTargetThisTurn = becameTargetThisTurn0; becameTargetThisTurn = becameTargetThisTurn0;
} }
public boolean isValiant() {
return valiant;
}
public void setValiant(boolean v) {
valiant = v;
}
public boolean hasStartedTheTurnUntapped() { public boolean hasStartedTheTurnUntapped() {
return startedTheTurnUntapped; return startedTheTurnUntapped;

View File

@@ -144,9 +144,6 @@ public class SpellAbilityStackInstance implements IIdentifiable, IHasCardView {
view.updateTargetPlayers(this); view.updateTargetPlayers(this);
view.updateText(this); view.updateText(this);
// Run BecomesTargetTrigger
Map<AbilityKey, Object> runParams = AbilityKey.newMap();
runParams.put(AbilityKey.SourceSA, ability);
Set<GameObject> distinctObjects = Sets.newHashSet(); Set<GameObject> distinctObjects = Sets.newHashSet();
for (final GameObject tgt : target) { for (final GameObject tgt : target) {
if (oldTarget != null && oldTarget.contains(tgt)) { if (oldTarget != null && oldTarget.contains(tgt)) {
@@ -157,16 +154,22 @@ public class SpellAbilityStackInstance implements IIdentifiable, IHasCardView {
continue; continue;
} }
Map<AbilityKey, Object> runParams = AbilityKey.newMap();
runParams.put(AbilityKey.SourceSA, ability);
if (tgt instanceof Card && !((Card) tgt).hasBecomeTargetThisTurn()) { if (tgt instanceof Card && !((Card) tgt).hasBecomeTargetThisTurn()) {
runParams.put(AbilityKey.FirstTime, null); runParams.put(AbilityKey.FirstTime, null);
((Card) tgt).setBecameTargetThisTurn(true); ((Card) tgt).setBecameTargetThisTurn(true);
} }
if (tgt instanceof Card && !((Card) tgt).isValiant() && cause.getController().equals(((Card) tgt).getController())) {
runParams.put(AbilityKey.Valiant, null);
((Card) tgt).setValiant(true);
}
runParams.put(AbilityKey.Target, tgt); runParams.put(AbilityKey.Target, tgt);
getSourceCard().getGame().getTriggerHandler().runTrigger(TriggerType.BecomesTarget, runParams, false); getSourceCard().getGame().getTriggerHandler().runTrigger(TriggerType.BecomesTarget, runParams, false);
} }
// Only run BecomesTargetOnce when at least one target is changed // Only run BecomesTargetOnce when at least one target is changed
if (!distinctObjects.isEmpty()) { if (!distinctObjects.isEmpty()) {
runParams = AbilityKey.newMap(); Map<AbilityKey, Object> runParams = AbilityKey.newMap();
runParams.put(AbilityKey.SourceSA, ability); runParams.put(AbilityKey.SourceSA, ability);
runParams.put(AbilityKey.Targets, distinctObjects); runParams.put(AbilityKey.Targets, distinctObjects);
runParams.put(AbilityKey.Cause, cause); runParams.put(AbilityKey.Cause, cause);

View File

@@ -77,6 +77,12 @@ public class TriggerBecomesTarget extends Trigger {
} }
} }
if (hasParam("Valiant")) {
if (!runParams.containsKey(AbilityKey.Valiant)) {
return false;
}
}
return true; return true;
} }

View File

@@ -437,13 +437,11 @@ public class MagicStack /* extends MyObservable */ implements Iterable<SpellAbil
// Create a new object, since the triggers aren't happening right away // Create a new object, since the triggers aren't happening right away
List<TargetChoices> chosenTargets = sp.getAllTargetChoices(); List<TargetChoices> chosenTargets = sp.getAllTargetChoices();
if (!chosenTargets.isEmpty()) { if (!chosenTargets.isEmpty()) {
runParams = AbilityKey.newMap();
SpellAbility s = sp; SpellAbility s = sp;
if (si != null) { if (si != null) {
s = si.getSpellAbility(); s = si.getSpellAbility();
chosenTargets = s.getAllTargetChoices(); chosenTargets = s.getAllTargetChoices();
} }
runParams.put(AbilityKey.SourceSA, s);
Set<GameObject> distinctObjects = Sets.newHashSet(); Set<GameObject> distinctObjects = Sets.newHashSet();
for (final TargetChoices tc : chosenTargets) { for (final TargetChoices tc : chosenTargets) {
for (final GameObject tgt : tc) { for (final GameObject tgt : tc) {
@@ -453,14 +451,22 @@ public class MagicStack /* extends MyObservable */ implements Iterable<SpellAbil
continue; continue;
} }
runParams = AbilityKey.newMap();
runParams.put(AbilityKey.SourceSA, s);
if (tgt instanceof Card && !((Card) tgt).hasBecomeTargetThisTurn()) { if (tgt instanceof Card && !((Card) tgt).hasBecomeTargetThisTurn()) {
runParams.put(AbilityKey.FirstTime, null); runParams.put(AbilityKey.FirstTime, null);
((Card) tgt).setBecameTargetThisTurn(true); ((Card) tgt).setBecameTargetThisTurn(true);
} }
if (tgt instanceof Card && !((Card) tgt).isValiant() && activator.equals(((Card) tgt).getController())) {
runParams.put(AbilityKey.Valiant, null);
((Card) tgt).setValiant(true);
}
runParams.put(AbilityKey.Target, tgt); runParams.put(AbilityKey.Target, tgt);
game.getTriggerHandler().runTrigger(TriggerType.BecomesTarget, runParams, false); game.getTriggerHandler().runTrigger(TriggerType.BecomesTarget, runParams, false);
} }
} }
runParams = AbilityKey.newMap();
runParams.put(AbilityKey.SourceSA, s);
runParams.put(AbilityKey.Targets, distinctObjects); runParams.put(AbilityKey.Targets, distinctObjects);
runParams.put(AbilityKey.Cause, s.getHostCard()); runParams.put(AbilityKey.Cause, s.getHostCard());
game.getTriggerHandler().runTrigger(TriggerType.BecomesTargetOnce, runParams, false); game.getTriggerHandler().runTrigger(TriggerType.BecomesTargetOnce, runParams, false);

View File

@@ -4,7 +4,7 @@ Types:Creature Mouse Warrior
PT:2/2 PT:2/2
K:Haste K:Haste
K:Prowess K:Prowess
T:Mode$ BecomesTarget | ValidTarget$ Card.Self | ValidSource$ SpellAbility.YouCtrl | TriggerZones$ Battlefield | FirstTime$ True | Execute$ TrigExile | TriggerDescription$ Valiant — Whenever CARDNAME becomes the target of a spell or ability you control for the first time each turn, exile the top card of your library. Until end of turn, you may play that card. T:Mode$ BecomesTarget | ValidTarget$ Card.Self | ValidSource$ SpellAbility.YouCtrl | TriggerZones$ Battlefield | Valiant$ True | Execute$ TrigExile | TriggerDescription$ Valiant — Whenever CARDNAME becomes the target of a spell or ability you control for the first time each turn, exile the top card of your library. Until end of turn, you may play that card.
SVar:TrigExile:DB$ Dig | Defined$ You | DigNum$ 1 | ChangeNum$ All | DestinationZone$ Exile | RememberChanged$ True | SubAbility$ DBEffect SVar:TrigExile:DB$ Dig | Defined$ You | DigNum$ 1 | ChangeNum$ All | DestinationZone$ Exile | RememberChanged$ True | SubAbility$ DBEffect
SVar:DBEffect:DB$ Effect | RememberObjects$ RememberedCard | StaticAbilities$ Play | SubAbility$ DBCleanup | ExileOnMoved$ Exile SVar:DBEffect:DB$ Effect | RememberObjects$ RememberedCard | StaticAbilities$ Play | SubAbility$ DBCleanup | ExileOnMoved$ Exile
SVar:Play:Mode$ Continuous | MayPlay$ True | EffectZone$ Command | Affected$ Card.IsRemembered | AffectedZone$ Exile | Description$ You may play remembered card. SVar:Play:Mode$ Continuous | MayPlay$ True | EffectZone$ Command | Affected$ Card.IsRemembered | AffectedZone$ Exile | Description$ You may play remembered card.

View File

@@ -3,6 +3,6 @@ ManaCost:W
Types:Creature Mouse Soldier Types:Creature Mouse Soldier
PT:1/2 PT:1/2
K:Offspring:2 K:Offspring:2
T:Mode$ BecomesTarget | ValidTarget$ Card.Self | ValidSource$ SpellAbility.YouCtrl | TriggerZones$ Battlefield | FirstTime$ True | Execute$ TrigPumpAll | TriggerDescription$ Valiant — Whenever this creature becomes the target of a spell or ability you control for the first time each turn, Mice you control get +1/+0 until end of turn. T:Mode$ BecomesTarget | ValidTarget$ Card.Self | ValidSource$ SpellAbility.YouCtrl | TriggerZones$ Battlefield | Valiant$ True | Execute$ TrigPumpAll | TriggerDescription$ Valiant — Whenever this creature becomes the target of a spell or ability you control for the first time each turn, Mice you control get +1/+0 until end of turn.
SVar:TrigPumpAll:DB$ PumpAll | ValidCards$ Mouse.YouCtrl | NumAtt$ 1 SVar:TrigPumpAll:DB$ PumpAll | ValidCards$ Mouse.YouCtrl | NumAtt$ 1
Oracle:Offspring {2} (You may pay an additional {2} as you cast this spell. If you do, when this creature enters, create a 1/1 token copy of it.)\nValiant — Whenever this creature becomes the target of a spell or ability you control for the first time each turn, Mice you control get +1/+0 until end of turn. Oracle:Offspring {2} (You may pay an additional {2} as you cast this spell. If you do, when this creature enters, create a 1/1 token copy of it.)\nValiant — Whenever this creature becomes the target of a spell or ability you control for the first time each turn, Mice you control get +1/+0 until end of turn.

View File

@@ -2,7 +2,7 @@ Name:Heartfire Hero
ManaCost:R ManaCost:R
Types:Creature Mouse Soldier Types:Creature Mouse Soldier
PT:1/1 PT:1/1
T:Mode$ BecomesTarget | ValidTarget$ Card.Self | ValidSource$ SpellAbility.YouCtrl | TriggerZones$ Battlefield | FirstTime$ True | Execute$ TrigCounter | TriggerDescription$ Valiant — Whenever CARDNAME becomes the target of a spell or ability you control for the first time each turn, put a +1/+1 counter on it. T:Mode$ BecomesTarget | ValidTarget$ Card.Self | ValidSource$ SpellAbility.YouCtrl | TriggerZones$ Battlefield | Valiant$ True | Execute$ TrigCounter | TriggerDescription$ Valiant — Whenever CARDNAME becomes the target of a spell or ability you control for the first time each turn, put a +1/+1 counter on it.
SVar:TrigCounter:DB$ PutCounter | Defined$ Self | CounterType$ P1P1 | CounterNum$ 1 SVar:TrigCounter:DB$ PutCounter | Defined$ Self | CounterType$ P1P1 | CounterNum$ 1
T:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Graveyard | ValidCard$ Card.Self | Execute$ TrigDamageDies | TriggerDescription$ When CARDNAME dies, it deals damage equal to its power to each opponent. T:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Graveyard | ValidCard$ Card.Self | Execute$ TrigDamageDies | TriggerDescription$ When CARDNAME dies, it deals damage equal to its power to each opponent.
SVar:TrigDamageDies:DB$ DealDamage | Defined$ Opponent | NumDmg$ X SVar:TrigDamageDies:DB$ DealDamage | Defined$ Opponent | NumDmg$ X

View File

@@ -3,6 +3,6 @@ ManaCost:2 W
Types:Creature Mouse Soldier Types:Creature Mouse Soldier
PT:3/2 PT:3/2
K:Flash K:Flash
T:Mode$ BecomesTarget | ValidTarget$ Card.Self | ValidSource$ SpellAbility.YouCtrl | TriggerZones$ Battlefield | FirstTime$ True | Execute$ TrigTap | TriggerDescription$ Valiant — Whenever CARDNAME becomes the target of a spell or ability you control for the first time each turn, tap target creature an opponent controls. T:Mode$ BecomesTarget | ValidTarget$ Card.Self | ValidSource$ SpellAbility.YouCtrl | TriggerZones$ Battlefield | Valiant$ True | Execute$ TrigTap | TriggerDescription$ Valiant — Whenever CARDNAME becomes the target of a spell or ability you control for the first time each turn, tap target creature an opponent controls.
SVar:TrigTap:DB$ Tap | ValidTgts$ Creature.OppCtrl | TgtPrompt$ Choose target creature an opponent controls. SVar:TrigTap:DB$ Tap | ValidTgts$ Creature.OppCtrl | TgtPrompt$ Choose target creature an opponent controls.
Oracle:Flash\nValiant — Whenever Mouse Trapper becomes the target of a spell or ability you control for the first time each turn, tap target creature an opponent controls. Oracle:Flash\nValiant — Whenever Mouse Trapper becomes the target of a spell or ability you control for the first time each turn, tap target creature an opponent controls.

View File

@@ -2,7 +2,7 @@ Name:Nettle Guard
ManaCost:1 W ManaCost:1 W
Types:Creature Mouse Soldier Types:Creature Mouse Soldier
PT:3/1 PT:3/1
T:Mode$ BecomesTarget | ValidTarget$ Card.Self | ValidSource$ SpellAbility.YouCtrl | TriggerZones$ Battlefield | FirstTime$ True | Execute$ TrigPump | TriggerDescription$ Valiant — Whenever CARDNAME becomes the target of a spell or ability you control for the first time each turn, it gets +0/+2 until end of turn. T:Mode$ BecomesTarget | ValidTarget$ Card.Self | ValidSource$ SpellAbility.YouCtrl | TriggerZones$ Battlefield | Valiant$ True | Execute$ TrigPump | TriggerDescription$ Valiant — Whenever CARDNAME becomes the target of a spell or ability you control for the first time each turn, it gets +0/+2 until end of turn.
SVar:TrigPump:DB$ Pump | Defined$ Self | NumDef$ 2 SVar:TrigPump:DB$ Pump | Defined$ Self | NumDef$ 2
A:AB$ Destroy | Cost$ 1 Sac<1/CARDNAME> | ValidTgts$ Artifact,Enchantment | TgtPrompt$ Select target artifact or enchantment | SpellDescription$ Destroy target artifact or enchantment. A:AB$ Destroy | Cost$ 1 Sac<1/CARDNAME> | ValidTgts$ Artifact,Enchantment | TgtPrompt$ Select target artifact or enchantment | SpellDescription$ Destroy target artifact or enchantment.
Oracle:Valiant — Whenever Nettle Guard becomes the target of a spell or ability you control for the first time each turn, it gets +0/+2 until end of turn.\n{1}, Sacrifice Nettle Guard: Destroy target artifact or enchantment. Oracle:Valiant — Whenever Nettle Guard becomes the target of a spell or ability you control for the first time each turn, it gets +0/+2 until end of turn.\n{1}, Sacrifice Nettle Guard: Destroy target artifact or enchantment.

View File

@@ -4,7 +4,7 @@ Types:Creature Mouse Soldier
PT:3/2 PT:3/2
K:Vigilance K:Vigilance
K:Haste K:Haste
T:Mode$ BecomesTarget | ValidTarget$ Card.Self | ValidSource$ SpellAbility.YouCtrl | TriggerZones$ Battlefield | FirstTime$ True | Execute$ TrigCounter | TriggerDescription$ Valiant — Whenever CARDNAME becomes the target of a spell or ability you control for the first time each turn, put a +1/+1 counter on it. T:Mode$ BecomesTarget | ValidTarget$ Card.Self | ValidSource$ SpellAbility.YouCtrl | TriggerZones$ Battlefield | Valiant$ True | Execute$ TrigCounter | TriggerDescription$ Valiant — Whenever CARDNAME becomes the target of a spell or ability you control for the first time each turn, put a +1/+1 counter on it.
SVar:TrigCounter:DB$ PutCounter | Defined$ Self | CounterType$ P1P1 | CounterNum$ 1 SVar:TrigCounter:DB$ PutCounter | Defined$ Self | CounterType$ P1P1 | CounterNum$ 1
DeckHas:Ability$Counters DeckHas:Ability$Counters
Oracle:Vigilance, haste\nValiant — Whenever Seedglaive Mentor becomes the target of a spell or ability you control for the first time each turn, put a +1/+1 counter on it. Oracle:Vigilance, haste\nValiant — Whenever Seedglaive Mentor becomes the target of a spell or ability you control for the first time each turn, put a +1/+1 counter on it.

View File

@@ -2,7 +2,7 @@ Name:Veteran Guardmouse
ManaCost:3 RW ManaCost:3 RW
Types:Creature Mouse Soldier Types:Creature Mouse Soldier
PT:3/4 PT:3/4
T:Mode$ BecomesTarget | ValidTarget$ Card.Self | ValidSource$ SpellAbility.YouCtrl | TriggerZones$ Battlefield | FirstTime$ True | Execute$ TrigPump | TriggerDescription$ Valiant — Whenever CARDNAME becomes the target of a spell or ability you control for the first time each turn, it gets +1/+0 and gains first strike until end of turn. Scry 1. (Look at the top card of your library. You may put that card on the bottom.) T:Mode$ BecomesTarget | ValidTarget$ Card.Self | ValidSource$ SpellAbility.YouCtrl | TriggerZones$ Battlefield | Valiant$ True | Execute$ TrigPump | TriggerDescription$ Valiant — Whenever CARDNAME becomes the target of a spell or ability you control for the first time each turn, it gets +1/+0 and gains first strike until end of turn. Scry 1. (Look at the top card of your library. You may put that card on the bottom.)
SVar:TrigPump:DB$ Pump | Defined$ Self | NumAtt$ 1 | KW$ First Strike | SubAbility$ DBScry SVar:TrigPump:DB$ Pump | Defined$ Self | NumAtt$ 1 | KW$ First Strike | SubAbility$ DBScry
SVar:DBScry:DB$ Scry | ScryNum$ 1 SVar:DBScry:DB$ Scry | ScryNum$ 1
Oracle:Valiant — Whenever Veteran Guardmouse becomes the target of a spell or ability you control for the first time each turn, it gets +1/+0 and gains first strike until end of turn. Scry 1. (Look at the top card of your library. You may put that card on the bottom.) Oracle:Valiant — Whenever Veteran Guardmouse becomes the target of a spell or ability you control for the first time each turn, it gets +1/+0 and gains first strike until end of turn. Scry 1. (Look at the top card of your library. You may put that card on the bottom.)

View File

@@ -2,6 +2,6 @@ Name:Whiskerquill Scribe
ManaCost:1 R ManaCost:1 R
Types:Creature Mouse Citizen Types:Creature Mouse Citizen
PT:2/2 PT:2/2
T:Mode$ BecomesTarget | ValidTarget$ Card.Self | ValidSource$ SpellAbility.YouCtrl | TriggerZones$ Battlefield | FirstTime$ True | Execute$ TrigDraw | TriggerDescription$ Valiant — Whenever CARDNAME becomes the target of a spell or ability you control for the first time each turn, you may discard a card. If you do, draw a card. T:Mode$ BecomesTarget | ValidTarget$ Card.Self | ValidSource$ SpellAbility.YouCtrl | TriggerZones$ Battlefield | Valiant$ True | Execute$ TrigDraw | TriggerDescription$ Valiant — Whenever CARDNAME becomes the target of a spell or ability you control for the first time each turn, you may discard a card. If you do, draw a card.
SVar:TrigDraw:AB$ Draw | Cost$ Discard<1/Card> SVar:TrigDraw:AB$ Draw | Cost$ Discard<1/Card>
Oracle:Valiant — Whenever Whiskerquill Scribe becomes the target of a spell or ability you control for the first time each turn, you may discard a card. If you do, draw a card. Oracle:Valiant — Whenever Whiskerquill Scribe becomes the target of a spell or ability you control for the first time each turn, you may discard a card. If you do, draw a card.

View File

@@ -2,7 +2,7 @@ Name:Whiskervale Forerunner
ManaCost:3 W ManaCost:3 W
Types:Creature Mouse Bard Types:Creature Mouse Bard
PT:3/4 PT:3/4
T:Mode$ BecomesTarget | ValidTarget$ Card.Self | ValidSource$ SpellAbility.YouCtrl | TriggerZones$ Battlefield | FirstTime$ True | Execute$ TrigPeekAndReveal | TriggerDescription$ Valiant — Whenever CARDNAME becomes the target of a spell or ability you control for the first time each turn, look at the top five cards of your library. You may reveal a creature card with mana value 3 or less from among them. You may put it onto the battlefield if it's your turn. If you don't put it onto the battlefield, put it into your hand. Put the rest on the bottom of your library in a random order. T:Mode$ BecomesTarget | ValidTarget$ Card.Self | ValidSource$ SpellAbility.YouCtrl | TriggerZones$ Battlefield | Valiant$ True | Execute$ TrigPeekAndReveal | TriggerDescription$ Valiant — Whenever CARDNAME becomes the target of a spell or ability you control for the first time each turn, look at the top five cards of your library. You may reveal a creature card with mana value 3 or less from among them. You may put it onto the battlefield if it's your turn. If you don't put it onto the battlefield, put it into your hand. Put the rest on the bottom of your library in a random order.
SVar:TrigPeekAndReveal:DB$ PeekAndReveal | Defined$ You | PeekAmount$ 5 | NoReveal$ True | RememberPeeked$ True | SubAbility$ PickOne SVar:TrigPeekAndReveal:DB$ PeekAndReveal | Defined$ You | PeekAmount$ 5 | NoReveal$ True | RememberPeeked$ True | SubAbility$ PickOne
SVar:PickOne:DB$ ChooseCard | Defined$ You | Amount$ 1 | ChoiceTitle$ Choose a creature card to reveal | Choices$ Card.Creature+cmcLE3+IsRemembered | ChoiceZone$ Library | Reveal$ True | SubAbility$ DBChangeZoneBattlefield SVar:PickOne:DB$ ChooseCard | Defined$ You | Amount$ 1 | ChoiceTitle$ Choose a creature card to reveal | Choices$ Card.Creature+cmcLE3+IsRemembered | ChoiceZone$ Library | Reveal$ True | SubAbility$ DBChangeZoneBattlefield
SVar:DBChangeZoneBattlefield:DB$ ChangeZone | Origin$ Library | Destination$ Battlefield | Defined$ ChosenCard | ConditionPlayerTurn$ True | ConditionDefined$ Remembered | ConditionPresent$ Card.ChosenCard | ConditionCompare$ EQ1 | Optional$ True | SubAbility$ DBChangeZoneHand SVar:DBChangeZoneBattlefield:DB$ ChangeZone | Origin$ Library | Destination$ Battlefield | Defined$ ChosenCard | ConditionPlayerTurn$ True | ConditionDefined$ Remembered | ConditionPresent$ Card.ChosenCard | ConditionCompare$ EQ1 | Optional$ True | SubAbility$ DBChangeZoneHand