mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 10:48:00 +00:00
TokenEffect: make the Kalitas + Anointed Possession working
This commit is contained in:
@@ -185,6 +185,13 @@ public class TokenEffect extends SpellAbilityEffect {
|
|||||||
final Card host = sa.getHostCard();
|
final Card host = sa.getHostCard();
|
||||||
final SpellAbility root = sa.getRootAbility();
|
final SpellAbility root = sa.getRootAbility();
|
||||||
readParameters(sa);
|
readParameters(sa);
|
||||||
|
|
||||||
|
// Cause of the Token Effect, in general it should be this
|
||||||
|
// but if its a Replacement Effect, it might be something else or null
|
||||||
|
SpellAbility cause = sa;
|
||||||
|
if (root.isReplacementAbility() && root.hasReplacingObject("Cause")) {
|
||||||
|
cause = (SpellAbility)root.getReplacingObject("Cause");
|
||||||
|
}
|
||||||
|
|
||||||
String cost = "";
|
String cost = "";
|
||||||
|
|
||||||
@@ -266,7 +273,7 @@ public class TokenEffect extends SpellAbilityEffect {
|
|||||||
final String imageName = imageNames.get(MyRandom.getRandom().nextInt(imageNames.size()));
|
final String imageName = imageNames.get(MyRandom.getRandom().nextInt(imageNames.size()));
|
||||||
final CardFactory.TokenInfo tokenInfo = new CardFactory.TokenInfo(substitutedName, imageName,
|
final CardFactory.TokenInfo tokenInfo = new CardFactory.TokenInfo(substitutedName, imageName,
|
||||||
cost, substitutedTypes, this.tokenKeywords, finalPower, finalToughness);
|
cost, substitutedTypes, this.tokenKeywords, finalPower, finalToughness);
|
||||||
final List<Card> tokens = CardFactory.makeToken(tokenInfo, controller);
|
final List<Card> tokens = CardFactory.makeToken(tokenInfo, controller, cause != null);
|
||||||
|
|
||||||
// Grant rule changes
|
// Grant rule changes
|
||||||
if (this.tokenHiddenKeywords != null) {
|
if (this.tokenHiddenKeywords != null) {
|
||||||
|
|||||||
@@ -796,10 +796,6 @@ public class CardFactory {
|
|||||||
return new TokenInfo(tokenInfo[0], imageName, manaCost, types, keywords, power, toughness);
|
return new TokenInfo(tokenInfo[0], imageName, manaCost, types, keywords, power, toughness);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<Card> makeToken(final TokenInfo tokenInfo, final Player controller) {
|
|
||||||
return makeToken(tokenInfo, controller, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static List<Card> makeToken(final TokenInfo tokenInfo, final Player controller, final boolean applyMultiplier) {
|
public static List<Card> makeToken(final TokenInfo tokenInfo, final Player controller, final boolean applyMultiplier) {
|
||||||
final List<Card> list = Lists.newArrayList();
|
final List<Card> list = Lists.newArrayList();
|
||||||
|
|||||||
@@ -1300,8 +1300,7 @@ public class GameSimulatorTest extends SimulationTestCase {
|
|||||||
assertNotNull(fatalPushSA);
|
assertNotNull(fatalPushSA);
|
||||||
fatalPushSA.setTargetCard(goblin);
|
fatalPushSA.setTargetCard(goblin);
|
||||||
|
|
||||||
// Electrify: should only generate 1 token (FIXME: Forge currently generates 2 tokens!)
|
// Electrify: should only generate 1 token
|
||||||
// (check http://magicjudge.tumblr.com/post/160491073029/weird-card-interaction-alert-kalitas-anointed )
|
|
||||||
Card electrify = addCardToZone("Electrify", p, ZoneType.Hand);
|
Card electrify = addCardToZone("Electrify", p, ZoneType.Hand);
|
||||||
SpellAbility electrifySA = electrify.getFirstSpellAbility();
|
SpellAbility electrifySA = electrify.getFirstSpellAbility();
|
||||||
assertNotNull(electrifySA);
|
assertNotNull(electrifySA);
|
||||||
@@ -1314,9 +1313,6 @@ public class GameSimulatorTest extends SimulationTestCase {
|
|||||||
|
|
||||||
score = sim.simulateSpellAbility(electrifySA).value;
|
score = sim.simulateSpellAbility(electrifySA).value;
|
||||||
assertTrue(score > 0);
|
assertTrue(score > 0);
|
||||||
// TODO: this will currently fail because Forge does not implement this interaction correctly,
|
assertTrue(countCardsWithName(sim.getSimulatedGameState(), "Zombie") == 3);
|
||||||
// generating two tokens instead of one after Electrify.
|
|
||||||
// Please fix and then enable the assertion line below to ensure it stays properly implemented.
|
|
||||||
//assertTrue(countCardsWithName(sim.getSimulatedGameState(), "Zombie") == 3);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user