Merge branch 'reconfigureWithoutStatic' into 'master'

Reconfigure: use unattach command instead of Static Ability on Card

See merge request core-developers/forge!6265
This commit is contained in:
Michael Kamensky
2022-02-20 09:25:03 +00:00
2 changed files with 18 additions and 5 deletions

View File

@@ -3482,6 +3482,23 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
runParams.put(AbilityKey.AttachSource, this);
runParams.put(AbilityKey.AttachTarget, entity);
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();
// TODO make it use a Static Layer Effect instead
addChangedCardTypes(null, CardType.parse("Creature", true), false, false, false, false, false, false, false, false, ts, 0, true, false);
GameCommand unattach = new GameCommand() {
private static final long serialVersionUID = 1L;
@Override
public void run() {
removeChangedCardTypes(ts, 0);
}
};
addUnattachCommand(unattach);
}
}
public final void unattachFromEntity(final GameEntity entity) {

View File

@@ -3122,7 +3122,7 @@ public class CardFactoryUtil {
attachStr.append("AB$ Attach | ValidTgts$ Creature.YouCtrl+Other | TgtPrompt$ Select target creature you ");
attachStr.append("control | AILogic$ Pump | Secondary$ True | SpellDescription$ Attach ").append(bothStr);
final StringBuilder unattachStr = new StringBuilder();
unattachStr.append("AB$ Unattach | Defined$ Self | SpellDescription$ Unattach | Secondary$ True ");
unattachStr.append("AB$ Unattach | Defined$ Self | SpellDescription$ Unattach | Secondary$ True | IsPresent$ Card.Self+AttachedTo Creature");
unattachStr.append(bothStr);
// instantiate attach ability
SpellAbility attachSA = AbilityFactory.getAbility(attachStr.toString(), card);
@@ -3606,10 +3606,6 @@ public class CardFactoryUtil {
}
effect += " | Description$ " + desc;
inst.addStaticAbility(StaticAbility.create(effect, state.getCard(), state, intrinsic));
} else if (keyword.startsWith("Reconfigure")) {
String effect = "Mode$ Continuous | Affected$ Card.Self | IsPresent$ Card.Self+AttachedTo Creature | "
+ "RemoveType$ Creature | Secondary$ True | Description$ Reconfigure (" + inst.getReminderText() + ")";
inst.addStaticAbility(StaticAbility.create(effect, state.getCard(), state, intrinsic));
} else if (keyword.equals("Shroud")) {
String effect = "Mode$ CantTarget | Shroud$ True | ValidCard$ Card.Self | Secondary$ True"
+ " | Description$ Shroud (" + inst.getReminderText() + ")";