[TLA] Implement Energybending

This commit is contained in:
theelk801 2025-11-13 09:44:59 -05:00
parent 998b737ab5
commit 5ce393f617
6 changed files with 96 additions and 26 deletions

View file

@ -31,7 +31,7 @@ public final class DryadOfTheIlysianGrove extends CardImpl {
));
// Lands you control are every basic land type in addition to their other types.
this.addAbility(new SimpleStaticAbility(new BecomesAllBasicsControlledEffect()));
this.addAbility(new SimpleStaticAbility(new BecomesAllBasicsControlledEffect(Duration.WhileOnBattlefield)));
}
private DryadOfTheIlysianGrove(final DryadOfTheIlysianGrove card) {

View file

@ -0,0 +1,39 @@
package mage.cards.e;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.continuous.BecomesAllBasicsControlledEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SubType;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class Energybending extends CardImpl {
public Energybending(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}");
this.subtype.add(SubType.LESSON);
// Lands you control gain all basic land types until end of turn.
this.getSpellAbility().addEffect(new BecomesAllBasicsControlledEffect(Duration.EndOfTurn)
.setText("lands you control gain all basic land types until end of turn"));
// Draw a card.
this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(1).concatBy("<br>"));
}
private Energybending(final Energybending card) {
super(card);
}
@Override
public Energybending copy() {
return new Energybending(this);
}
}

View file

@ -30,7 +30,7 @@ public final class LeylineOfTheGuildpact extends CardImpl {
this.addAbility(new SimpleStaticAbility(new LeylineOfTheGuildpactEffect()));
// Lands you control are every basic land type in addition to their other types.
this.addAbility(new SimpleStaticAbility(new BecomesAllBasicsControlledEffect()));
this.addAbility(new SimpleStaticAbility(new BecomesAllBasicsControlledEffect(Duration.WhileOnBattlefield)));
}
private LeylineOfTheGuildpact(final LeylineOfTheGuildpact card) {

View file

@ -5,6 +5,7 @@ import mage.abilities.effects.common.continuous.BecomesAllBasicsControlledEffect
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import java.util.UUID;
@ -17,7 +18,7 @@ public final class PrismaticOmen extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{G}");
// Lands you control are every basic land type in addition to their other types.
this.addAbility(new SimpleStaticAbility(new BecomesAllBasicsControlledEffect()));
this.addAbility(new SimpleStaticAbility(new BecomesAllBasicsControlledEffect(Duration.WhileOnBattlefield)));
}
private PrismaticOmen(final PrismaticOmen card) {

View file

@ -129,6 +129,7 @@ public final class AvatarTheLastAirbender extends ExpansionSet {
cards.add(new SetCardInfo("Earthen Ally", 177, Rarity.RARE, mage.cards.e.EarthenAlly.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Earthen Ally", 377, Rarity.RARE, mage.cards.e.EarthenAlly.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Ember Island Production", 48, Rarity.UNCOMMON, mage.cards.e.EmberIslandProduction.class));
cards.add(new SetCardInfo("Energybending", 2, Rarity.UNCOMMON, mage.cards.e.Energybending.class));
cards.add(new SetCardInfo("Enter the Avatar State", 18, Rarity.UNCOMMON, mage.cards.e.EnterTheAvatarState.class));
cards.add(new SetCardInfo("Epic Downfall", 96, Rarity.UNCOMMON, mage.cards.e.EpicDownfall.class));
cards.add(new SetCardInfo("Fancy Footwork", 19, Rarity.UNCOMMON, mage.cards.f.FancyFootwork.class));

View file

@ -1,5 +1,6 @@
package mage.abilities.effects.common.continuous;
import mage.MageObjectReference;
import mage.abilities.Ability;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.mana.*;
@ -8,6 +9,8 @@ import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
import java.util.Iterator;
/**
* @author TheElk801
*/
@ -21,9 +24,9 @@ public class BecomesAllBasicsControlledEffect extends ContinuousEffectImpl {
new GreenManaAbility()
};
public BecomesAllBasicsControlledEffect() {
super(Duration.WhileOnBattlefield, Layer.TypeChangingEffects_4, SubLayer.NA, Outcome.Detriment);
this.staticText = "Lands you control are every basic land type in addition to their other types";
public BecomesAllBasicsControlledEffect(Duration duration) {
super(duration, Layer.TypeChangingEffects_4, SubLayer.NA, Outcome.Detriment);
this.staticText = "lands you control are every basic land type in addition to their other types";
dependendToTypes.add(DependencyType.BecomeNonbasicLand);
dependencyTypes.add(DependencyType.BecomeMountain);
dependencyTypes.add(DependencyType.BecomeForest);
@ -41,10 +44,38 @@ public class BecomesAllBasicsControlledEffect extends ContinuousEffectImpl {
return new BecomesAllBasicsControlledEffect(this);
}
@Override
public void init(Ability source, Game game) {
super.init(source, game);
if (getAffectedObjectsSet()) {
for (Permanent permanent : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_CONTROLLED_PERMANENT_LAND, source.getControllerId(), game)) {
affectedObjectList.add(new MageObjectReference(permanent, game));
}
}
}
@Override
public boolean apply(Game game, Ability source) {
if (!getAffectedObjectsSet()) {
for (Permanent permanent : game.getBattlefield().getActivePermanents(
StaticFilters.FILTER_CONTROLLED_PERMANENT_LAND, source.getControllerId(), game)) {
StaticFilters.FILTER_CONTROLLED_PERMANENT_LAND, source.getControllerId(), game
)) {
removeTypes(permanent, game, source);
}
return true;
}
for (Iterator<MageObjectReference> it = affectedObjectList.iterator(); it.hasNext(); ) {
Permanent permanent = it.next().getPermanent(game);
if (permanent != null) {
removeTypes(permanent, game, source);
} else {
it.remove();
}
}
return true;
}
private static void removeTypes(Permanent permanent, Game game, Ability source) {
permanent.addSubType(game,
SubType.PLAINS,
SubType.ISLAND,
@ -65,6 +96,4 @@ public class BecomesAllBasicsControlledEffect extends ContinuousEffectImpl {
permanent.addAbility(ability, source.getSourceId(), game);
}
}
return true;
}
}