mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
Merge pull request #166 from tool4ever/esix2
Fix Esix replacing too much from other effects
This commit is contained in:
@@ -251,7 +251,7 @@ public class CopyPermanentEffect extends TokenEffectBase {
|
|||||||
}
|
}
|
||||||
} // end resolve
|
} // end resolve
|
||||||
|
|
||||||
private Card getProtoType(final SpellAbility sa, final Card original, final Player newOwner) {
|
public static Card getProtoType(final SpellAbility sa, final Card original, final Player newOwner) {
|
||||||
final Card host = sa.getHostCard();
|
final Card host = sa.getHostCard();
|
||||||
int id = newOwner == null ? 0 : newOwner.getGame().nextCardId();
|
int id = newOwner == null ? 0 : newOwner.getGame().nextCardId();
|
||||||
final Card copy = new Card(id, original.getPaperCard(), host.getGame());
|
final Card copy = new Card(id, original.getPaperCard(), host.getGame());
|
||||||
|
|||||||
@@ -17,11 +17,15 @@ import forge.game.ability.AbilityKey;
|
|||||||
import forge.game.ability.AbilityUtils;
|
import forge.game.ability.AbilityUtils;
|
||||||
import forge.game.ability.SpellAbilityEffect;
|
import forge.game.ability.SpellAbilityEffect;
|
||||||
import forge.game.card.Card;
|
import forge.game.card.Card;
|
||||||
|
import forge.game.card.CardCollectionView;
|
||||||
|
import forge.game.card.CardLists;
|
||||||
import forge.game.card.TokenCreateTable;
|
import forge.game.card.TokenCreateTable;
|
||||||
import forge.game.card.token.TokenInfo;
|
import forge.game.card.token.TokenInfo;
|
||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
import forge.game.replacement.ReplacementResult;
|
import forge.game.replacement.ReplacementResult;
|
||||||
import forge.game.spellability.SpellAbility;
|
import forge.game.spellability.SpellAbility;
|
||||||
|
import forge.game.zone.ZoneType;
|
||||||
|
import forge.util.Localizer;
|
||||||
|
|
||||||
public class ReplaceTokenEffect extends SpellAbilityEffect {
|
public class ReplaceTokenEffect extends SpellAbilityEffect {
|
||||||
|
|
||||||
@@ -86,6 +90,16 @@ public class ReplaceTokenEffect extends SpellAbilityEffect {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if ("ReplaceToken".equals(sa.getParam("Type"))) {
|
} else if ("ReplaceToken".equals(sa.getParam("Type"))) {
|
||||||
|
Card chosen = null;
|
||||||
|
if (sa.hasParam("ValidChoices")) {
|
||||||
|
CardCollectionView choices = CardLists.getValidCards(game.getCardsIn(ZoneType.Battlefield), sa.getParam("ValidChoices").split(","), p, card, sa);
|
||||||
|
if (choices.isEmpty()) {
|
||||||
|
originalParams.put(AbilityKey.ReplacementResult, ReplacementResult.NotReplaced);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
chosen = p.getController().chooseSingleEntityForEffect(choices, sa, Localizer.getInstance().getMessage("lblChooseaCard"), false, null);
|
||||||
|
}
|
||||||
|
|
||||||
long timestamp = game.getNextTimestamp();
|
long timestamp = game.getNextTimestamp();
|
||||||
|
|
||||||
Multimap<Player, Pair<Integer, Iterable<Object>>> toInsertMap = ArrayListMultimap.create();
|
Multimap<Player, Pair<Integer, Iterable<Object>>> toInsertMap = ArrayListMultimap.create();
|
||||||
@@ -111,7 +125,12 @@ public class ReplaceTokenEffect extends SpellAbilityEffect {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
for (String script : sa.getParam("TokenScript").split(",")) {
|
for (String script : sa.getParam("TokenScript").split(",")) {
|
||||||
final Card token = TokenInfo.getProtoType(script, sa, pe.getKey());
|
final Card token;
|
||||||
|
if (script.equals("Chosen")) {
|
||||||
|
token = CopyPermanentEffect.getProtoType(sa, chosen, pe.getKey());
|
||||||
|
} else {
|
||||||
|
token = TokenInfo.getProtoType(script, sa, pe.getKey());
|
||||||
|
}
|
||||||
|
|
||||||
if (token == null) {
|
if (token == null) {
|
||||||
throw new RuntimeException("don't find Token for TokenScript: " + script);
|
throw new RuntimeException("don't find Token for TokenScript: " + script);
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ Types:Legendary Creature Fractal
|
|||||||
PT:4/4
|
PT:4/4
|
||||||
K:Flying
|
K:Flying
|
||||||
R:Event$ CreateToken | ActiveZones$ Battlefield | CheckSVar$ X | SVarCompare$ EQ0 | ValidPlayer$ You | PlayerTurn$ True | Optional$ True | ReplaceWith$ DBCopy | Description$ The first time you would create one or more tokens during each of your turns, you may instead choose a creature other than CARDNAME and create that many tokens that are copies of that creature.
|
R:Event$ CreateToken | ActiveZones$ Battlefield | CheckSVar$ X | SVarCompare$ EQ0 | ValidPlayer$ You | PlayerTurn$ True | Optional$ True | ReplaceWith$ DBCopy | Description$ The first time you would create one or more tokens during each of your turns, you may instead choose a creature other than CARDNAME and create that many tokens that are copies of that creature.
|
||||||
SVar:DBCopy:DB$ CopyPermanent | Choices$ Creature.Other | NumCopies$ Y
|
SVar:DBCopy:DB$ ReplaceToken | Type$ ReplaceToken | ValidChoices$ Creature.Other | TokenScript$ Chosen
|
||||||
SVar:X:PlayerCountPropertyYou$TokensCreatedThisTurn
|
SVar:X:PlayerCountPropertyYou$TokensCreatedThisTurn
|
||||||
SVar:Y:ReplaceCount$TokenNum
|
|
||||||
DeckHas:Ability$Token
|
DeckHas:Ability$Token
|
||||||
|
AI:RemoveDeck:All
|
||||||
Oracle:Flying\nThe first time you would create one or more tokens during each of your turns, you may instead choose a creature other than Esix, Fractal Bloom and create that many tokens that are copies of that creature.
|
Oracle:Flying\nThe first time you would create one or more tokens during each of your turns, you may instead choose a creature other than Esix, Fractal Bloom and create that many tokens that are copies of that creature.
|
||||||
|
|||||||
Reference in New Issue
Block a user