[FIN] Implement Excalibur II

This commit is contained in:
theelk801 2025-05-28 22:03:11 -04:00 committed by Failure
parent 51d199f75b
commit 06f5fe0cff
3 changed files with 73 additions and 17 deletions

View file

@ -0,0 +1,52 @@
package mage.cards.e;
import mage.abilities.common.GainLifeControllerTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.CountersSourceCount;
import mage.abilities.effects.common.continuous.BoostEquippedEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.keyword.EquipAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.counters.CounterType;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class ExcaliburII extends CardImpl {
private static final DynamicValue xValue = new CountersSourceCount(CounterType.CHARGE);
public ExcaliburII(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{1}");
this.supertype.add(SuperType.LEGENDARY);
this.subtype.add(SubType.EQUIPMENT);
// Whenever you gain life, put a charge counter on Excalibur II.
this.addAbility(new GainLifeControllerTriggeredAbility(
new AddCountersSourceEffect(CounterType.CHARGE.createInstance())
));
// Equipped creature gets +1/+1 for each charge counter on Excalibur II.
this.addAbility(new SimpleStaticAbility(new BoostEquippedEffect(xValue, xValue)));
// Equip {3}
this.addAbility(new EquipAbility(3));
}
private ExcaliburII(final ExcaliburII card) {
super(card);
}
@Override
public ExcaliburII copy() {
return new ExcaliburII(this);
}
}

View file

@ -188,6 +188,8 @@ public final class FinalFantasy extends ExpansionSet {
cards.add(new SetCardInfo("Esper Terra", 511, Rarity.MYTHIC, mage.cards.e.EsperTerra.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Ether", 53, Rarity.UNCOMMON, mage.cards.e.Ether.class));
cards.add(new SetCardInfo("Evil Reawakened", 98, Rarity.UNCOMMON, mage.cards.e.EvilReawakened.class));
cards.add(new SetCardInfo("Excalibur II", 257, Rarity.RARE, mage.cards.e.ExcaliburII.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Excalibur II", 352, Rarity.RARE, mage.cards.e.ExcaliburII.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Fang, Fearless l'Cie", 381, Rarity.UNCOMMON, mage.cards.f.FangFearlessLCie.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Fang, Fearless l'Cie", 446, Rarity.UNCOMMON, mage.cards.f.FangFearlessLCie.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Fang, Fearless l'Cie", 526, Rarity.UNCOMMON, mage.cards.f.FangFearlessLCie.class, NON_FULL_USE_VARIOUS));

View file

@ -1,19 +1,20 @@
package mage.abilities.effects.common.continuous;
import mage.constants.Duration;
import mage.constants.Layer;
import mage.constants.Outcome;
import mage.constants.SubLayer;
import mage.abilities.Ability;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.constants.Duration;
import mage.constants.Layer;
import mage.constants.Outcome;
import mage.constants.SubLayer;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.targetpointer.FixedTarget;
import mage.util.CardUtil;
import java.util.Optional;
/**
* @author BetaSteward_at_googlemail.com
*/
@ -31,14 +32,14 @@ public class BoostEquippedEffect extends ContinuousEffectImpl {
this(StaticValue.get(power), StaticValue.get(toughness), duration);
}
public BoostEquippedEffect(DynamicValue powerDynamicValue, DynamicValue toughnessDynamicValue) {
this(powerDynamicValue, toughnessDynamicValue, Duration.WhileOnBattlefield);
public BoostEquippedEffect(DynamicValue power, DynamicValue toughness) {
this(power, toughness, Duration.WhileOnBattlefield);
}
public BoostEquippedEffect(DynamicValue powerDynamicValue, DynamicValue toughnessDynamicValue, Duration duration) {
public BoostEquippedEffect(DynamicValue power, DynamicValue toughness, Duration duration) {
super(duration, Layer.PTChangingEffects_7, SubLayer.ModifyPT_7c, Outcome.BoostCreature);
this.power = powerDynamicValue;
this.toughness = toughnessDynamicValue;
this.power = power;
this.toughness = toughness;
if (duration == Duration.EndOfTurn) {
fixedTarget = true;
}
@ -70,21 +71,22 @@ public class BoostEquippedEffect extends ContinuousEffectImpl {
@Override
public boolean apply(Game game, Ability source) {
Permanent creature = null;
Permanent creature;
if (fixedTarget) {
creature = game.getPermanent(getTargetPointer().getFirst(game, source));
} else {
Permanent equipment = game.getPermanent(source.getSourceId());
if (equipment != null && equipment.getAttachedTo() != null) {
creature = game.getPermanent(equipment.getAttachedTo());
}
creature = Optional
.ofNullable(source)
.map(Ability::getSourceId)
.map(game::getPermanent)
.map(Permanent::getAttachedTo)
.map(game::getPermanent)
.orElse(null);
}
if (creature != null) {
creature.addPower(power.calculate(game, source, this));
creature.addToughness(toughness.calculate(game, source, this));
}
return true;
}
}