This commit is contained in:
tool4EvEr
2022-12-11 20:14:22 +01:00
parent 6d6bcdc92c
commit 1f6c4a430d
13 changed files with 44 additions and 63 deletions

View File

@@ -606,7 +606,7 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
if (sa.hasParam("GainControl")) {
final String g = sa.getParam("GainControl");
Player newController = g.equals("True") ? player :
AbilityUtils.getDefinedPlayers(sa.getHostCard(), g, sa).get(0);
AbilityUtils.getDefinedPlayers(hostCard, g, sa).get(0);
if (newController != null) {
if (newController != gameCard.getController()) {
gameCard.runChangeControllerCommands();
@@ -1318,7 +1318,7 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
if (sa.hasParam("GainControl")) {
final String g = sa.getParam("GainControl");
Player newController = g.equals("True") ? sa.getActivatingPlayer() :
AbilityUtils.getDefinedPlayers(sa.getHostCard(), g, sa).get(0);
AbilityUtils.getDefinedPlayers(source, g, sa).get(0);
if (newController != c.getController()) {
c.runChangeControllerCommands();
}

View File

@@ -39,12 +39,7 @@ public class DamageDealEffect extends DamageBaseEffect {
// when damageStackDescription is called, just build exactly what is happening
final StringBuilder stringBuilder = new StringBuilder();
final String damage = spellAbility.getParam("NumDmg");
int dmg;
try { // try-catch to fix Volcano Hellion Crash
dmg = AbilityUtils.calculateAmount(spellAbility.getHostCard(), damage, spellAbility);
} catch (NullPointerException e) {
dmg = 0;
}
int dmg = AbilityUtils.calculateAmount(spellAbility.getHostCard(), damage, spellAbility);
List<GameObject> targets = SpellAbilityEffect.getTargets(spellAbility);
final List<Card> definedSources = AbilityUtils.getDefinedCards(spellAbility.getHostCard(), spellAbility.getParam("DamageSource"), spellAbility);

View File

@@ -63,7 +63,6 @@ import java.util.*;
}
Card chosenCard = player.getController().chooseSingleCardForZoneChange(ZoneType.None, new ArrayList<ZoneType>(), sa, new CardCollection(draftOptions), null, Localizer.getInstance().getMessage("lblChooseCardDraft"), false, player);
chosenCard.setTokenCard(true);
game.getAction().moveTo(ZoneType.None, chosenCard, sa, moveParams);
drafted.add(chosenCard);
}

View File

@@ -87,8 +87,7 @@ public class MakeCardEffect extends SpellAbilityEffect {
int toMake = amount;
if (!name.equals("")) {
while (toMake > 0) {
Card card = Card.fromPaperCard(StaticData.instance().getCommonCards().getUniqueByName(name),
player);
Card card = Card.fromPaperCard(StaticData.instance().getCommonCards().getUniqueByName(name), player);
if (sa.hasParam("TokenCard")) {
card.setTokenCard(true);
}

View File

@@ -80,11 +80,6 @@ public class TriggerDamagePrevented extends Trigger {
if (!Expressions.compare(actualAmount, operator, operand)) {
return false;
}
System.out.print("DamageDone Amount Operator: ");
System.out.println(operator);
System.out.print("DamageDone Amount Operand: ");
System.out.println(operand);
}
return true;

View File

@@ -75,11 +75,6 @@ public class TriggerDamagePreventedOnce extends Trigger {
if (!Expressions.compare(actualAmount, operator, operand)) {
return false;
}
System.out.print("DamageDone Amount Operator: ");
System.out.println(operator);
System.out.print("DamageDone Amount Operand: ");
System.out.println(operand);
}
return true;

View File

@@ -440,7 +440,8 @@ public class SpellAbilityPickerSimulationTest extends SimulationTest {
AssertJUnit.assertEquals(blocker, sa.getTargetCard());
}
@Test
// Run the test 100 times to ensure there's no flakiness.
@Test(invocationCount = 100)
public void testChoicesResultingFromRandomEffects() {
// Sometimes, the effect of a spell can be random, and as a result of that, new choices
// could be selected during simulation. This test verifies that this doesn't cause problems.
@@ -449,8 +450,6 @@ public class SpellAbilityPickerSimulationTest extends SimulationTest {
// seed during choice evaluation, although in the future, it may make sense to handle it
// some other way.
// Run the test 100 times to ensure there's no flakiness.
for (int i = 0; i < 100; i++) {
Game game = initAndCreateGame();
Player p = game.getPlayers().get(1);
Player opponent = game.getPlayers().get(0);
@@ -485,4 +484,3 @@ public class SpellAbilityPickerSimulationTest extends SimulationTest {
AssertJUnit.assertEquals(expectedTarget, sa.getTargetCard());
}
}
}

View File

@@ -7,7 +7,7 @@ T:Mode$ Blocks | ValidCard$ Card.Self | Execute$ TrigPump | Secondary$ True | Tr
SVar:TrigPump:DB$ PumpAll | ValidCards$ Rat.Other+YouCtrl | NumAtt$ +X | NumDef$ +X
SVar:X:Count$Valid Rat.YouCtrl
T:Mode$ Phase | Phase$ End of Turn | ValidPlayer$ You | TriggerZones$ Battlefield | Execute$ TrigChange | TriggerDescription$ At the beginning of your end step, you may mill four cards. If you do, return up to two Rat creature cards from your graveyard to your hand. (To mill a card, put the top card of your library into your graveyard.)
SVar:TrigChange:AB$ ChangeZone | Cost$ Mill<4> | Origin$ Graveyard | Destination$ Hand | ChangeType$ Rat.Creature+YouOwn | ChangeNum$ 2 | SelectPrompt$ Select up to two Rat creature cards
SVar:TrigChange:AB$ ChangeZone | Cost$ Mill<4> | Origin$ Graveyard | Destination$ Hand | ChangeType$ Rat.Creature+YouOwn | ChangeNum$ 2 | Hidden$ True | SelectPrompt$ Select up to two Rat creature cards
SVar:HasAttackEffect:TRUE
SVar:HasBlockEffect:TRUE
DeckNeeds:Type$Rat

View File

@@ -1,7 +1,7 @@
Name:Hunter's Insight
ManaCost:2 G
Types:Instant
A:SP$ Effect | ValidTgts$ Creature | TgtPrompt$ Select target creature | Triggers$ TrigDamage | RememberObjects$ Targeted | SpellDescription$ Choose target creature you control. Whenever that creature deals combat damage to a player or planeswalker this turn, draw that many cards.
A:SP$ Effect | ValidTgts$ Creature.YouCtrl | TgtPrompt$ Select target creature | Triggers$ TrigDamage | RememberObjects$ Targeted | SpellDescription$ Choose target creature you control. Whenever that creature deals combat damage to a player or planeswalker this turn, draw that many cards.
SVar:TrigDamage:Mode$ DamageDone | ValidSource$ Creature.IsRemembered | ValidTarget$ Player,Planeswalker | Execute$ TrigDraw | CombatDamage$ True | TriggerDescription$ Whenever that creature deals combat damage to a player or planeswalker this turn, draw that many cards.
SVar:TrigDraw:DB$ Draw | Defined$ You | NumCards$ X
SVar:X:TriggerCount$DamageAmount

View File

@@ -1,7 +1,7 @@
Name:Mandate of Abaddon
ManaCost:3 B
Types:Sorcery
A:SP$ ChooseCard | Choices$ Creature.YouCtrl | TgtPrompt$ Choose target creature you control | SubAbility$ DBDestroyAll | SpellDescription$ Choose target creature you control. Destroy all creatures with power less than that creature's power.
A:SP$ ChooseCard | ValidTgts$ Creature.YouCtrl | TgtPrompt$ Choose target creature you control | SubAbility$ DBDestroyAll | SpellDescription$ Choose target creature you control. Destroy all creatures with power less than that creature's power.
SVar:DBDestroyAll:DB$ DestroyAll | ValidCards$ Creature.powerLTX
SVar:X:Targeted$CardPower
Oracle:Choose target creature you control. Destroy all creatures with power less than that creature's power.

View File

@@ -5,7 +5,7 @@ Loyalty:4
S:Mode$ Continuous | Affected$ Card.Self | EffectZone$ Battlefield | GainsAbilitiesOf$ Planeswalker.Other | GainsValidAbilities$ Activated.Loyalty | Description$ CARDNAME has all loyalty abilities of all other planeswalkers on the battlefield.
A:AB$ Draw | Cost$ AddCounter<1/LOYALTY> | NumCards$ 1 | SubAbility$ DBChangeZone | Planeswalker$ True | SpellDescription$ You draw a card. Each opponent exiles a card from their hand or a permanent they control.
SVar:DBChangeZone:DB$ ChangeZone | Origin$ Battlefield,Hand | Destination$ Exile | DefinedPlayer$ Player.Opponent | ChangeType$ Card | ChangeNum$ 1 | Mandatory$ True
AI:RemoveDeck:Random
A:AB$ Destroy | Cost$ SubCounter<3/LOYALTY> | ValidTgts$ Creature,Planeswalker | TgtPrompt$ Select target creature or planeswalker | Planeswalker$ True | SpellDescription$ Destroy target creature or planeswalker.
A:AB$ LosesGame | Cost$ SubCounter<8/LOYALTY> | Defined$ Player.Opponent+controlsLegendary.Creature_EQ0+controlsPlaneswalker_LE0 | Planeswalker$ True | Ultimate$ True | SpellDescription$ Each opponent who doesn't control a legendary creature or planeswalker loses the game.
AI:RemoveDeck:Random
Oracle:Nicol Bolas, Dragon-God has all loyalty abilities of all other planeswalkers on the battlefield.\n[+1]: You draw a card. Each opponent exiles a card from their hand or a permanent they control.\n[-3]: Destroy target creature or planeswalker.\n[-8]: Each opponent who doesn't control a legendary creature or planeswalker loses the game.