Reconfigure: use StaticLayer (#6806)

This commit is contained in:
Hans Mackowiak
2025-01-21 09:31:34 +01:00
committed by GitHub
parent 297c6d283c
commit e2e76e101e
3 changed files with 17 additions and 16 deletions

View File

@@ -586,7 +586,7 @@ public abstract class SpellAbilityEffect {
} }
// create a basic template for Effect to be used somewhere else // create a basic template for Effect to be used somewhere else
protected static Card createEffect(final SpellAbility sa, final Player controller, final String name, public static Card createEffect(final SpellAbility sa, final Player controller, final String name,
final String image) { final String image) {
final Card hostCard = sa.getHostCard(); final Card hostCard = sa.getHostCard();
final Game game = hostCard.getGame(); final Game game = hostCard.getGame();
@@ -607,7 +607,9 @@ public abstract class SpellAbilityEffect {
eff.setOwner(controller); eff.setOwner(controller);
eff.setSVars(sa.getSVars()); eff.setSVars(sa.getSVars());
if (image != null) {
eff.setImageKey(image); eff.setImageKey(image);
}
eff.setGamePieceType(GamePieceType.EFFECT); eff.setGamePieceType(GamePieceType.EFFECT);
eff.setEffectSource(sa); eff.setEffectSource(sa);

View File

@@ -30,6 +30,7 @@ import forge.game.ability.AbilityFactory;
import forge.game.ability.AbilityKey; import forge.game.ability.AbilityKey;
import forge.game.ability.AbilityUtils; import forge.game.ability.AbilityUtils;
import forge.game.ability.ApiType; import forge.game.ability.ApiType;
import forge.game.ability.SpellAbilityEffect;
import forge.game.combat.Combat; import forge.game.combat.Combat;
import forge.game.combat.CombatLki; import forge.game.combat.CombatLki;
import forge.game.cost.Cost; import forge.game.cost.Cost;
@@ -4096,21 +4097,19 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars, ITr
getController().getGame().getTriggerHandler().runTrigger(TriggerType.Attached, runParams, false); getController().getGame().getTriggerHandler().runTrigger(TriggerType.Attached, runParams, false);
if (hasKeyword(Keyword.RECONFIGURE)) { if (hasKeyword(Keyword.RECONFIGURE)) {
// need extra time stamp so it doesn't collide with existing ones Card eff = SpellAbilityEffect.createEffect(sa, sa.getActivatingPlayer(), "Reconfigure Effect", getImageKey());
long ts = getGame().getNextTimestamp(); eff.setSetCode(getSetCode());
// 702.151b Attaching an Equipment with reconfigure to another creature causes the Equipment to stop being a creature until it becomes unattached from that creature. eff.setRarity(getRarity());
// it is not a Static Ability eff.setRenderForUI(false);
addChangedCardTypes(null, CardType.parse("Creature", true), false, EnumSet.noneOf(RemoveType.class), ts, 0, true, false); eff.addRemembered(this);
GameCommand unattach = new GameCommand() { String s = "Mode$ Continuous | Affected$ Card.IsRemembered | EffectZone$ Command | RemoveType$ Creature";
private static final long serialVersionUID = 1L; eff.addStaticAbility(s);
@Override GameCommand until = SpellAbilityEffect.exileEffectCommand(game, eff);
public void run() { addLeavesPlayCommand(until);
removeChangedCardTypes(ts, 0); addUnattachCommand(until);
} game.getAction().moveToCommand(eff, sa);
};
addUnattachCommand(unattach);
} }
} }

View File

@@ -3470,7 +3470,7 @@ public class CardFactoryUtil {
} }
String[] k = keyword.split(":"); String[] k = keyword.split(":");
String extra = k.length > 2 ? " | AlternateCost$ " + k[2] : ""; String extra = k.length > 2 ? " | AlternateCost$ " + k[2] : "";
String bothStr = "| Cost$ " + k[1] + " | SorcerySpeed$ True | Reconfigure$ True | PrecostDesc$ Reconfigure | Secondary$ True" + extra; String bothStr = "| Cost$ " + k[1] + " | SorcerySpeed$ True | PrecostDesc$ Reconfigure | Secondary$ True" + extra;
final StringBuilder attachStr = new StringBuilder(); final StringBuilder attachStr = new StringBuilder();
attachStr.append("AB$ Attach | ValidTgts$ Creature.YouCtrl+Other | TgtPrompt$ Select target creature you control "); attachStr.append("AB$ Attach | ValidTgts$ Creature.YouCtrl+Other | TgtPrompt$ Select target creature you control ");
attachStr.append("| AILogic$ Pump | SpellDescription$ Attach ").append(bothStr); attachStr.append("| AILogic$ Pump | SpellDescription$ Attach ").append(bothStr);