mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
[TLA] Implement Energybending
This commit is contained in:
parent
998b737ab5
commit
5ce393f617
6 changed files with 96 additions and 26 deletions
|
|
@ -31,7 +31,7 @@ public final class DryadOfTheIlysianGrove extends CardImpl {
|
||||||
));
|
));
|
||||||
|
|
||||||
// Lands you control are every basic land type in addition to their other types.
|
// 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) {
|
private DryadOfTheIlysianGrove(final DryadOfTheIlysianGrove card) {
|
||||||
|
|
|
||||||
39
Mage.Sets/src/mage/cards/e/Energybending.java
Normal file
39
Mage.Sets/src/mage/cards/e/Energybending.java
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -30,7 +30,7 @@ public final class LeylineOfTheGuildpact extends CardImpl {
|
||||||
this.addAbility(new SimpleStaticAbility(new LeylineOfTheGuildpactEffect()));
|
this.addAbility(new SimpleStaticAbility(new LeylineOfTheGuildpactEffect()));
|
||||||
|
|
||||||
// Lands you control are every basic land type in addition to their other types.
|
// 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) {
|
private LeylineOfTheGuildpact(final LeylineOfTheGuildpact card) {
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import mage.abilities.effects.common.continuous.BecomesAllBasicsControlledEffect
|
||||||
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 java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
|
@ -17,7 +18,7 @@ public final class PrismaticOmen extends CardImpl {
|
||||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{G}");
|
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{G}");
|
||||||
|
|
||||||
// Lands you control are every basic land type in addition to their other types.
|
// 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) {
|
private PrismaticOmen(final PrismaticOmen card) {
|
||||||
|
|
|
||||||
|
|
@ -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", 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("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("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("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("Epic Downfall", 96, Rarity.UNCOMMON, mage.cards.e.EpicDownfall.class));
|
||||||
cards.add(new SetCardInfo("Fancy Footwork", 19, Rarity.UNCOMMON, mage.cards.f.FancyFootwork.class));
|
cards.add(new SetCardInfo("Fancy Footwork", 19, Rarity.UNCOMMON, mage.cards.f.FancyFootwork.class));
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package mage.abilities.effects.common.continuous;
|
package mage.abilities.effects.common.continuous;
|
||||||
|
|
||||||
|
import mage.MageObjectReference;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.effects.ContinuousEffectImpl;
|
import mage.abilities.effects.ContinuousEffectImpl;
|
||||||
import mage.abilities.mana.*;
|
import mage.abilities.mana.*;
|
||||||
|
|
@ -8,6 +9,8 @@ import mage.filter.StaticFilters;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author TheElk801
|
* @author TheElk801
|
||||||
*/
|
*/
|
||||||
|
|
@ -21,9 +24,9 @@ public class BecomesAllBasicsControlledEffect extends ContinuousEffectImpl {
|
||||||
new GreenManaAbility()
|
new GreenManaAbility()
|
||||||
};
|
};
|
||||||
|
|
||||||
public BecomesAllBasicsControlledEffect() {
|
public BecomesAllBasicsControlledEffect(Duration duration) {
|
||||||
super(Duration.WhileOnBattlefield, Layer.TypeChangingEffects_4, SubLayer.NA, Outcome.Detriment);
|
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";
|
this.staticText = "lands you control are every basic land type in addition to their other types";
|
||||||
dependendToTypes.add(DependencyType.BecomeNonbasicLand);
|
dependendToTypes.add(DependencyType.BecomeNonbasicLand);
|
||||||
dependencyTypes.add(DependencyType.BecomeMountain);
|
dependencyTypes.add(DependencyType.BecomeMountain);
|
||||||
dependencyTypes.add(DependencyType.BecomeForest);
|
dependencyTypes.add(DependencyType.BecomeForest);
|
||||||
|
|
@ -42,29 +45,55 @@ public class BecomesAllBasicsControlledEffect extends ContinuousEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public void init(Ability source, Game game) {
|
||||||
for (Permanent permanent : game.getBattlefield().getActivePermanents(
|
super.init(source, game);
|
||||||
StaticFilters.FILTER_CONTROLLED_PERMANENT_LAND, source.getControllerId(), game)) {
|
if (getAffectedObjectsSet()) {
|
||||||
permanent.addSubType(game,
|
for (Permanent permanent : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_CONTROLLED_PERMANENT_LAND, source.getControllerId(), game)) {
|
||||||
SubType.PLAINS,
|
affectedObjectList.add(new MageObjectReference(permanent, game));
|
||||||
SubType.ISLAND,
|
|
||||||
SubType.SWAMP,
|
|
||||||
SubType.MOUNTAIN,
|
|
||||||
SubType.FOREST);
|
|
||||||
// Optimization: Remove basic mana abilities since they are redundant with AnyColorManaAbility
|
|
||||||
// and keeping them will only produce too many combinations inside ManaOptions
|
|
||||||
for (Ability basicManaAbility : basicManaAbilities) {
|
|
||||||
if (permanent.getAbilities(game).containsRule(basicManaAbility)) {
|
|
||||||
permanent.removeAbility(basicManaAbility, source.getSourceId(), game);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// Add the {T}: Add one mana of any color ability
|
}
|
||||||
// This is functionally equivalent to having five "{T}: Add {COLOR}" for each COLOR in {W}{U}{B}{R}{G}
|
}
|
||||||
AnyColorManaAbility ability = new AnyColorManaAbility();
|
|
||||||
if (!permanent.getAbilities(game).containsRule(ability)) {
|
@Override
|
||||||
permanent.addAbility(ability, source.getSourceId(), game);
|
public boolean apply(Game game, Ability source) {
|
||||||
|
if (!getAffectedObjectsSet()) {
|
||||||
|
for (Permanent permanent : game.getBattlefield().getActivePermanents(
|
||||||
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void removeTypes(Permanent permanent, Game game, Ability source) {
|
||||||
|
permanent.addSubType(game,
|
||||||
|
SubType.PLAINS,
|
||||||
|
SubType.ISLAND,
|
||||||
|
SubType.SWAMP,
|
||||||
|
SubType.MOUNTAIN,
|
||||||
|
SubType.FOREST);
|
||||||
|
// Optimization: Remove basic mana abilities since they are redundant with AnyColorManaAbility
|
||||||
|
// and keeping them will only produce too many combinations inside ManaOptions
|
||||||
|
for (Ability basicManaAbility : basicManaAbilities) {
|
||||||
|
if (permanent.getAbilities(game).containsRule(basicManaAbility)) {
|
||||||
|
permanent.removeAbility(basicManaAbility, source.getSourceId(), game);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Add the {T}: Add one mana of any color ability
|
||||||
|
// This is functionally equivalent to having five "{T}: Add {COLOR}" for each COLOR in {W}{U}{B}{R}{G}
|
||||||
|
AnyColorManaAbility ability = new AnyColorManaAbility();
|
||||||
|
if (!permanent.getAbilities(game).containsRule(ability)) {
|
||||||
|
permanent.addAbility(ability, source.getSourceId(), game);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue