This commit is contained in:
ssk97 2025-12-19 16:06:01 +01:00 committed by GitHub
commit a1c50f1259
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 94 additions and 193 deletions

View file

@ -1,20 +1,12 @@
package mage.cards.b; package mage.cards.b;
import mage.abilities.Ability;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.TapTargetEffect; import mage.abilities.effects.common.TapTargetEffect;
import mage.abilities.keyword.OverloadAbility; import mage.abilities.keyword.OverloadAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome;
import mage.filter.StaticFilters;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.TargetPermanent; import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID; import java.util.UUID;
@ -29,11 +21,10 @@ public final class Blustersquall extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{U}"); super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{U}");
// Tap target creature you don't control. // Tap target creature you don't control.
this.getSpellAbility().addTarget(new TargetPermanent(FILTER_CREATURE_YOU_DONT_CONTROL));
this.getSpellAbility().addEffect(new TapTargetEffect());
// Overload {3}{U} (You may cast this spell for its overload cost. If you do, change its text by replacing all instances of "target" with "each.") // Overload {3}{U} (You may cast this spell for its overload cost. If you do, change its text by replacing all instances of "target" with "each.")
this.addAbility(new OverloadAbility(this, new BlustersqallTapAllEffect(), new ManaCostsImpl<>("{3}{U}"))); OverloadAbility.ImplementOverloadAbility(this, new ManaCostsImpl<>("{3}{U}"),
new TargetPermanent(FILTER_CREATURE_YOU_DONT_CONTROL), new TapTargetEffect());
} }
private Blustersquall(final Blustersquall card) { private Blustersquall(final Blustersquall card) {
@ -45,28 +36,3 @@ public final class Blustersquall extends CardImpl {
return new Blustersquall(this); return new Blustersquall(this);
} }
} }
class BlustersqallTapAllEffect extends OneShotEffect {
BlustersqallTapAllEffect() {
super(Outcome.Tap);
staticText = "Tap each creature you don't control";
}
private BlustersqallTapAllEffect(final BlustersqallTapAllEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
for (Permanent creature : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_CREATURE_YOU_DONT_CONTROL, source.getControllerId(), source, game)) {
creature.tap(source, game);
}
return true;
}
@Override
public BlustersqallTapAllEffect copy() {
return new BlustersqallTapAllEffect(this);
}
}

View file

@ -1,7 +1,6 @@
package mage.cards.b; package mage.cards.b;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.DestroyAllEffect;
import mage.abilities.effects.common.DestroyTargetEffect; import mage.abilities.effects.common.DestroyTargetEffect;
import mage.abilities.keyword.OverloadAbility; import mage.abilities.keyword.OverloadAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
@ -34,11 +33,9 @@ public final class BreakTheIce extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{B}{B}"); super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{B}{B}");
// Destroy target land that is snow or could produce {C}. // Destroy target land that is snow or could produce {C}.
this.getSpellAbility().addEffect(new DestroyTargetEffect());
this.getSpellAbility().addTarget(new TargetPermanent(filter));
// Overload {4}{B}{B} // Overload {4}{B}{B}
this.addAbility(new OverloadAbility(this, new DestroyAllEffect(filter), new ManaCostsImpl<>("{4}{B}{B}"))); OverloadAbility.ImplementOverloadAbility(this, new ManaCostsImpl<>("{4}{B}{B}"),
new TargetPermanent(filter), new DestroyTargetEffect());
} }
private BreakTheIce(final BreakTheIce card) { private BreakTheIce(final BreakTheIce card) {

View file

@ -1,23 +1,14 @@
package mage.cards.c; package mage.cards.c;
import mage.abilities.Ability;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.combat.AttacksIfAbleTargetEffect; import mage.abilities.effects.common.combat.AttacksIfAbleTargetEffect;
import mage.abilities.effects.common.continuous.BoostAllEffect;
import mage.abilities.effects.common.continuous.BoostTargetEffect; import mage.abilities.effects.common.continuous.BoostTargetEffect;
import mage.abilities.keyword.OverloadAbility; import mage.abilities.keyword.OverloadAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.Outcome;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.TargetPermanent; import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
import mage.target.targetpointer.FixedTarget;
import java.util.UUID; import java.util.UUID;
@ -33,14 +24,10 @@ public final class ChemistersTrick extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{U}{R}"); super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{U}{R}");
// Target creature you don't control gets -2/-0 until end of turn and attacks this turn if able. // Target creature you don't control gets -2/-0 until end of turn and attacks this turn if able.
this.getSpellAbility().addTarget(new TargetPermanent(FILTER_CREATURE_YOU_DONT_CONTROL));
this.getSpellAbility().addEffect(new BoostTargetEffect(-2, 0, Duration.EndOfTurn));
this.getSpellAbility().addEffect(new AttacksIfAbleTargetEffect(Duration.EndOfTurn).setText("and attacks this turn if able"));
// Overload {3}{U}{R} (You may cast this spell for its overload cost. If you do, change its text by replacing all instances of "target" with "each.") // Overload {3}{U}{R} (You may cast this spell for its overload cost. If you do, change its text by replacing all instances of "target" with "each.")
OverloadAbility ability = new OverloadAbility(this, new BoostAllEffect(-2, 0, Duration.EndOfTurn, StaticFilters.FILTER_CREATURE_YOU_DONT_CONTROL, false), new ManaCostsImpl<>("{3}{U}{R}")); OverloadAbility.ImplementOverloadAbility(this, new ManaCostsImpl<>("{3}{U}{R}"),
ability.addEffect(new ChemistersTrickEffect()); new TargetPermanent(FILTER_CREATURE_YOU_DONT_CONTROL), new BoostTargetEffect(-2, 0, Duration.EndOfTurn),
this.addAbility(ability); new AttacksIfAbleTargetEffect(Duration.EndOfTurn).setText("and attacks this turn if able"));
} }
private ChemistersTrick(final ChemistersTrick card) { private ChemistersTrick(final ChemistersTrick card) {
@ -52,31 +39,3 @@ public final class ChemistersTrick extends CardImpl {
return new ChemistersTrick(this); return new ChemistersTrick(this);
} }
} }
class ChemistersTrickEffect extends OneShotEffect {
ChemistersTrickEffect() {
super(Outcome.ReturnToHand);
staticText = "each creature you don't control attacks this turn if able";
}
private ChemistersTrickEffect(final ChemistersTrickEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
for (Permanent creature : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_CREATURE_YOU_DONT_CONTROL, source.getControllerId(), source, game)) {
AttacksIfAbleTargetEffect effect = new AttacksIfAbleTargetEffect(Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(creature.getId(), game));
game.addEffect(effect, source);
}
return true;
}
@Override
public ChemistersTrickEffect copy() {
return new ChemistersTrickEffect(this);
}
}

View file

@ -1,15 +1,12 @@
package mage.cards.c; package mage.cards.c;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.continuous.GainAbilityAllEffect;
import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
import mage.abilities.keyword.MyriadAbility; import mage.abilities.keyword.MyriadAbility;
import mage.abilities.keyword.OverloadAbility; import mage.abilities.keyword.OverloadAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration;
import mage.filter.StaticFilters;
import mage.target.common.TargetControlledCreaturePermanent; import mage.target.common.TargetControlledCreaturePermanent;
import java.util.UUID; import java.util.UUID;
@ -23,17 +20,9 @@ public final class CorporealProjection extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{U}{R}"); super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{U}{R}");
// Target creature you control gains myriad until end of turn. // Target creature you control gains myriad until end of turn.
this.getSpellAbility().addEffect(new GainAbilityTargetEffect(new MyriadAbility(false)));
this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent());
// Overload {3}{U}{U}{R}{R} // Overload {3}{U}{U}{R}{R}
this.addAbility(new OverloadAbility( OverloadAbility.ImplementOverloadAbility(this, new ManaCostsImpl<>("{3}{U}{U}{R}{R}"),
this, new TargetControlledCreaturePermanent(), new GainAbilityTargetEffect(new MyriadAbility(false)));
new GainAbilityAllEffect(
new MyriadAbility(false), Duration.EndOfTurn,
StaticFilters.FILTER_CONTROLLED_CREATURE
), new ManaCostsImpl<>("{3}{U}{U}{R}{R}")
));
} }
private CorporealProjection(final CorporealProjection card) { private CorporealProjection(final CorporealProjection card) {

View file

@ -1,29 +1,23 @@
package mage.cards.c; package mage.cards.c;
import java.util.LinkedList;
import java.util.List;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.Effect; import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CantBeCounteredSourceEffect; import mage.abilities.effects.common.CantBeCounteredSourceEffect;
import mage.abilities.effects.common.CounterTargetEffect; import mage.abilities.effects.common.CounterTargetEffect;
import mage.abilities.keyword.OverloadAbility; import mage.abilities.keyword.OverloadAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.TargetController; import mage.constants.TargetController;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.FilterSpell; import mage.filter.FilterSpell;
import mage.game.Game;
import mage.game.stack.Spell;
import mage.game.stack.StackObject;
import mage.target.TargetSpell; import mage.target.TargetSpell;
import java.util.UUID;
/** /**
* *
@ -49,11 +43,9 @@ public final class Counterflux extends CardImpl {
this.addAbility(ability); this.addAbility(ability);
// Counter target spell you don't control. // Counter target spell you don't control.
this.getSpellAbility().addTarget(new TargetSpell(filter));
this.getSpellAbility().addEffect(new CounterTargetEffect());
// Overload {1}{U}{U}{R} (You may cast this spell for its overload cost. If you do, change its text by replacing all instances of "target" with "each.") // Overload {1}{U}{U}{R} (You may cast this spell for its overload cost. If you do, change its text by replacing all instances of "target" with "each.")
this.addAbility(new OverloadAbility(this, new CounterfluxEffect(), new ManaCostsImpl<>("{1}{U}{U}{R}"))); OverloadAbility.ImplementOverloadAbility(this, new ManaCostsImpl<>("{1}{U}{U}{R}"),
new TargetSpell(filter), new CounterTargetEffect());
} }
private Counterflux(final Counterflux card) { private Counterflux(final Counterflux card) {
@ -65,37 +57,3 @@ public final class Counterflux extends CardImpl {
return new Counterflux(this); return new Counterflux(this);
} }
} }
class CounterfluxEffect extends OneShotEffect {
CounterfluxEffect() {
super(Outcome.Detriment);
staticText = "Counter each spell you don't control.";
}
private CounterfluxEffect(final CounterfluxEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
List<Spell> spellsToCounter = new LinkedList<>();
for (StackObject stackObject : game.getStack()) {
if (stackObject instanceof Spell && !stackObject.isControlledBy(source.getControllerId())) {
spellsToCounter.add((Spell) stackObject);
}
}
for (Spell spell : spellsToCounter) {
game.getStack().counter(spell.getId(), source, game);
}
return true;
}
@Override
public CounterfluxEffect copy() {
return new CounterfluxEffect(this);
}
}

View file

@ -1,8 +1,6 @@
package mage.cards.c; package mage.cards.c;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.ReturnToHandFromBattlefieldAllEffect;
import mage.abilities.effects.common.ReturnToHandTargetEffect; import mage.abilities.effects.common.ReturnToHandTargetEffect;
import mage.abilities.keyword.OverloadAbility; import mage.abilities.keyword.OverloadAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
@ -29,13 +27,9 @@ public final class CyclonicRift extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{U}"); super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{U}");
// Return target nonland permanent you don't control to its owner's hand. // Return target nonland permanent you don't control to its owner's hand.
this.getSpellAbility().addTarget(new TargetPermanent(filter));
this.getSpellAbility().addEffect(new ReturnToHandTargetEffect());
// Overload {6}{U} (You may cast this spell for its overload cost. If you do, change its text by replacing all instances of "target" with "each.") // Overload {6}{U} (You may cast this spell for its overload cost. If you do, change its text by replacing all instances of "target" with "each.")
Effect effect = new ReturnToHandFromBattlefieldAllEffect(filter); OverloadAbility.ImplementOverloadAbility(this, new ManaCostsImpl<>("{6}{U}"),
effect.setText("Return each nonland permanent you don't control to its owner's hand"); new TargetPermanent(filter), new ReturnToHandTargetEffect());
this.addAbility(new OverloadAbility(this, effect, new ManaCostsImpl<>("{6}{U}")));
} }
private CyclonicRift(final CyclonicRift card) { private CyclonicRift(final CyclonicRift card) {

View file

@ -1,13 +1,11 @@
package mage.cards.d; package mage.cards.d;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.DestroyAllEffect;
import mage.abilities.effects.common.DestroyTargetEffect; import mage.abilities.effects.common.DestroyTargetEffect;
import mage.abilities.keyword.OverloadAbility; import mage.abilities.keyword.OverloadAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.filter.StaticFilters;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import java.util.UUID; import java.util.UUID;
@ -22,16 +20,10 @@ public final class Damn extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{B}{B}"); super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{B}{B}");
// Destroy target creature. A creature destroyed this way cant be regenerated. // Destroy target creature. A creature destroyed this way cant be regenerated.
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
this.getSpellAbility().addEffect(new DestroyTargetEffect(true)
.setText("destroy target creature. A creature destroyed this way can't be regenerated"));
// Overload {2}{W}{W} (You may cast this spell for its overload cost. If you do, change its text by replacing all instances of target with each.) // Overload {2}{W}{W} (You may cast this spell for its overload cost. If you do, change its text by replacing all instances of target with each.)
this.addAbility(new OverloadAbility( OverloadAbility.ImplementOverloadAbility(this, new ManaCostsImpl<>("{2}{W}{W}"),
this, new TargetCreaturePermanent(), new DestroyTargetEffect(true)
new DestroyAllEffect(StaticFilters.FILTER_PERMANENT_CREATURES, true), .setText("destroy target creature. A creature destroyed this way can't be regenerated"));
new ManaCostsImpl<>("{2}{W}{W}")
));
} }
private Damn(final Damn card) { private Damn(final Damn card) {

View file

@ -1,16 +1,13 @@
package mage.cards.d; package mage.cards.d;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.continuous.BoostAllEffect;
import mage.abilities.effects.common.continuous.BoostTargetEffect; import mage.abilities.effects.common.continuous.BoostTargetEffect;
import mage.abilities.keyword.OverloadAbility; import mage.abilities.keyword.OverloadAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.filter.StaticFilters;
import mage.target.TargetPermanent; import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID; import java.util.UUID;
@ -25,12 +22,9 @@ public final class Downsize extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{U}"); super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{U}");
// Target creature you don't control gets -4/-0 until end of turn. // Target creature you don't control gets -4/-0 until end of turn.
this.getSpellAbility().addTarget(new TargetPermanent(FILTER_CREATURE_YOU_DONT_CONTROL));
this.getSpellAbility().addEffect(new BoostTargetEffect(-4, 0, Duration.EndOfTurn));
// Overload {2}{U} (You may cast this spell for its overload cost. If you do, change its text by replacing all instances of "target" with "each.") // Overload {2}{U} (You may cast this spell for its overload cost. If you do, change its text by replacing all instances of "target" with "each.")
this.addAbility(new OverloadAbility(this, new BoostAllEffect(-4, 0, Duration.EndOfTurn, StaticFilters.FILTER_CREATURE_YOU_DONT_CONTROL, false), new ManaCostsImpl<>("{2}{U}"))); OverloadAbility.ImplementOverloadAbility(this, new ManaCostsImpl<>("{2}{U}"),
new TargetPermanent(FILTER_CREATURE_YOU_DONT_CONTROL), new BoostTargetEffect(-4, 0, Duration.EndOfTurn));
} }
private Downsize(final Downsize card) { private Downsize(final Downsize card) {

View file

@ -1,11 +1,8 @@
package mage.cards.d; package mage.cards.d;
import mage.abilities.Ability;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.Effect; import mage.abilities.effects.Effect;
import mage.abilities.effects.common.continuous.BecomesCreatureAllEffect;
import mage.abilities.effects.common.continuous.BecomesCreatureTargetEffect; import mage.abilities.effects.common.continuous.BecomesCreatureTargetEffect;
import mage.abilities.effects.common.continuous.LoseAllAbilitiesAllEffect;
import mage.abilities.keyword.FlyingAbility; import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.OverloadAbility; import mage.abilities.keyword.OverloadAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
@ -39,18 +36,9 @@ public final class Dragonshift extends CardImpl {
true, false, Duration.EndOfTurn) true, false, Duration.EndOfTurn)
.withDurationRuleAtStart(true); .withDurationRuleAtStart(true);
effect.setText("Until end of turn, target creature you control becomes a blue and red Dragon with base power and toughness 4/4, loses all abilities, and gains flying."); effect.setText("Until end of turn, target creature you control becomes a blue and red Dragon with base power and toughness 4/4, loses all abilities, and gains flying.");
this.getSpellAbility().addEffect(effect);
this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent());
// Overload {3}{U}{U}{R}{R} // Overload {3}{U}{U}{R}{R}
Ability ability = new OverloadAbility(this, new LoseAllAbilitiesAllEffect(new FilterControlledCreaturePermanent(""), Duration.EndOfTurn), new ManaCostsImpl<>("{3}{U}{U}{R}{R}")); OverloadAbility.ImplementOverloadAbility(this, new ManaCostsImpl<>("{3}{U}{U}{R}{R}"),
ability.addEffect(new BecomesCreatureAllEffect( new TargetControlledCreaturePermanent(), effect);
new CreatureToken(4, 4, "blue and red Dragon with base power and toughness 4/4 and with flying")
.withColor("UR")
.withSubType(SubType.DRAGON)
.withAbility(FlyingAbility.getInstance()),
null, filter, Duration.EndOfTurn, true, false, true));
this.addAbility(ability);
} }
private Dragonshift(final Dragonshift card) { private Dragonshift(final Dragonshift card) {
@ -61,4 +49,4 @@ public final class Dragonshift extends CardImpl {
public Dragonshift copy() { public Dragonshift copy() {
return new Dragonshift(this); return new Dragonshift(this);
} }
} }

View file

@ -1,9 +1,7 @@
package mage.cards.d; package mage.cards.d;
import java.util.UUID;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.continuous.BoostControlledEffect;
import mage.abilities.effects.common.continuous.BoostTargetEffect; import mage.abilities.effects.common.continuous.BoostTargetEffect;
import mage.abilities.keyword.OverloadAbility; import mage.abilities.keyword.OverloadAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
@ -12,6 +10,8 @@ import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.target.common.TargetControlledCreaturePermanent; import mage.target.common.TargetControlledCreaturePermanent;
import java.util.UUID;
/** /**
* *
* @author LevelX2 * @author LevelX2
@ -23,11 +23,9 @@ public final class Dynacharge extends CardImpl {
// Target creature you control gets +2/+0 until end of turn. // Target creature you control gets +2/+0 until end of turn.
this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent());
this.getSpellAbility().addEffect(new BoostTargetEffect(2,0, Duration.EndOfTurn));
// Overload {2}{R} (You may cast this spell for its overload cost. If you do, change its text by replacing all instances of "target" with "each.") // Overload {2}{R} (You may cast this spell for its overload cost. If you do, change its text by replacing all instances of "target" with "each.")
this.addAbility(new OverloadAbility(this, new BoostControlledEffect(2,0, Duration.EndOfTurn), new ManaCostsImpl<>("{2}{R}"))); OverloadAbility.ImplementOverloadAbility(this, new ManaCostsImpl<>("{2}{R}"),
new TargetControlledCreaturePermanent(), new BoostTargetEffect(2,0, Duration.EndOfTurn));
} }
private Dynacharge(final Dynacharge card) { private Dynacharge(final Dynacharge card) {
@ -38,4 +36,4 @@ public final class Dynacharge extends CardImpl {
public Dynacharge copy() { public Dynacharge copy() {
return new Dynacharge(this); return new Dynacharge(this);
} }
} }

View file

@ -1,11 +1,21 @@
package mage.abilities.keyword; package mage.abilities.keyword;
import mage.MageObjectReference;
import mage.abilities.Ability;
import mage.abilities.SpellAbility; import mage.abilities.SpellAbility;
import mage.abilities.costs.mana.ManaCosts; import mage.abilities.costs.mana.ManaCosts;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.Effect; import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card; import mage.cards.Card;
import mage.constants.Outcome;
import mage.constants.SpellAbilityType; import mage.constants.SpellAbilityType;
import mage.constants.TimingRule; import mage.constants.TimingRule;
import mage.game.Game;
import mage.target.Target;
import mage.target.targetpointer.FixedTargets;
import java.util.stream.Collectors;
/** /**
* 702.94. Overload * 702.94. Overload
@ -30,6 +40,26 @@ import mage.constants.TimingRule;
*/ */
public class OverloadAbility extends SpellAbility { public class OverloadAbility extends SpellAbility {
public static void ImplementOverloadAbility(Card card, ManaCosts costs, Target target, Effect... effects) {
card.getSpellAbility().addTarget(target.copy());
Ability overload = new OverloadAbility(card, costs);
for (Effect effect : effects) {
card.getSpellAbility().addEffect(effect.copy());
OverloadedEffect overloadEffect = new OverloadedEffect(effect, target.copy());
overloadEffect.setText(effect.getText(card.getSpellAbility().getModes().getMode())
.replace("target", "each"));
overload.addEffect(overloadEffect);
}
card.addAbility(overload);
}
public OverloadAbility(Card card, ManaCosts costs) {
super(costs, card.getName() + " with overload");
this.spellAbilityType = SpellAbilityType.BASE_ALTERNATE;
this.timing = (card.isSorcery(null) ? TimingRule.SORCERY : TimingRule.INSTANT);
}
//TODO: Remove once all Overload cards have been converted
public OverloadAbility(Card card, Effect effect, ManaCosts costs) { public OverloadAbility(Card card, Effect effect, ManaCosts costs) {
super(costs, card.getName() + " with overload"); super(costs, card.getName() + " with overload");
this.spellAbilityType = SpellAbilityType.BASE_ALTERNATE; this.spellAbilityType = SpellAbilityType.BASE_ALTERNATE;
@ -57,3 +87,39 @@ public class OverloadAbility extends SpellAbility {
} }
} }
class OverloadedEffect extends OneShotEffect {
Effect innerEffect;
Target target;
public OverloadedEffect(Effect innerEffect, Target target) {
super(Outcome.Benefit);
this.innerEffect = innerEffect;
this.target = target.withNotTarget(true);
}
protected OverloadedEffect(final OverloadedEffect effect) {
super(effect);
this.innerEffect = effect.innerEffect;
this.target = effect.target;
}
@Override
public boolean apply(Game game, Ability source) {
innerEffect.setTargetPointer(new FixedTargets(
target.possibleTargets(source.getControllerId(), source, game)
.stream().map(id -> new MageObjectReference(id, game))
.collect(Collectors.toSet())));
if (innerEffect instanceof OneShotEffect) {
return innerEffect.apply(game, source);
} else {
game.addEffect((ContinuousEffect) innerEffect, source);
return true;
}
}
@Override
public OverloadedEffect copy() {
return new OverloadedEffect(this);
}
}