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
|
// 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());
|
||||||
|
|
||||||
eff.setImageKey(image);
|
if (image != null) {
|
||||||
|
eff.setImageKey(image);
|
||||||
|
}
|
||||||
|
|
||||||
eff.setGamePieceType(GamePieceType.EFFECT);
|
eff.setGamePieceType(GamePieceType.EFFECT);
|
||||||
eff.setEffectSource(sa);
|
eff.setEffectSource(sa);
|
||||||
|
|||||||
@@ -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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user