mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38:01 +00:00
Reconfigure: use StaticLayer (#6806)
This commit is contained in:
@@ -586,7 +586,7 @@ public abstract class SpellAbilityEffect {
|
||||
}
|
||||
|
||||
// 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 Card hostCard = sa.getHostCard();
|
||||
final Game game = hostCard.getGame();
|
||||
@@ -607,7 +607,9 @@ public abstract class SpellAbilityEffect {
|
||||
eff.setOwner(controller);
|
||||
eff.setSVars(sa.getSVars());
|
||||
|
||||
if (image != null) {
|
||||
eff.setImageKey(image);
|
||||
}
|
||||
|
||||
eff.setGamePieceType(GamePieceType.EFFECT);
|
||||
eff.setEffectSource(sa);
|
||||
|
||||
@@ -30,6 +30,7 @@ import forge.game.ability.AbilityFactory;
|
||||
import forge.game.ability.AbilityKey;
|
||||
import forge.game.ability.AbilityUtils;
|
||||
import forge.game.ability.ApiType;
|
||||
import forge.game.ability.SpellAbilityEffect;
|
||||
import forge.game.combat.Combat;
|
||||
import forge.game.combat.CombatLki;
|
||||
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);
|
||||
|
||||
if (hasKeyword(Keyword.RECONFIGURE)) {
|
||||
// need extra time stamp so it doesn't collide with existing ones
|
||||
long ts = getGame().getNextTimestamp();
|
||||
// 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.
|
||||
// it is not a Static Ability
|
||||
addChangedCardTypes(null, CardType.parse("Creature", true), false, EnumSet.noneOf(RemoveType.class), ts, 0, true, false);
|
||||
Card eff = SpellAbilityEffect.createEffect(sa, sa.getActivatingPlayer(), "Reconfigure Effect", getImageKey());
|
||||
eff.setSetCode(getSetCode());
|
||||
eff.setRarity(getRarity());
|
||||
eff.setRenderForUI(false);
|
||||
eff.addRemembered(this);
|
||||
|
||||
GameCommand unattach = new GameCommand() {
|
||||
private static final long serialVersionUID = 1L;
|
||||
String s = "Mode$ Continuous | Affected$ Card.IsRemembered | EffectZone$ Command | RemoveType$ Creature";
|
||||
eff.addStaticAbility(s);
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
removeChangedCardTypes(ts, 0);
|
||||
}
|
||||
};
|
||||
addUnattachCommand(unattach);
|
||||
GameCommand until = SpellAbilityEffect.exileEffectCommand(game, eff);
|
||||
addLeavesPlayCommand(until);
|
||||
addUnattachCommand(until);
|
||||
game.getAction().moveToCommand(eff, sa);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3470,7 +3470,7 @@ public class CardFactoryUtil {
|
||||
}
|
||||
String[] k = keyword.split(":");
|
||||
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();
|
||||
attachStr.append("AB$ Attach | ValidTgts$ Creature.YouCtrl+Other | TgtPrompt$ Select target creature you control ");
|
||||
attachStr.append("| AILogic$ Pump | SpellDescription$ Attach ").append(bothStr);
|
||||
|
||||
Reference in New Issue
Block a user