forked from External/mage
[TLA] Implement Avatar Aang / Aang, Master of Elements
This commit is contained in:
parent
84a7e9f5b8
commit
0865b94875
3 changed files with 272 additions and 0 deletions
112
Mage.Sets/src/mage/cards/a/AangMasterOfElements.java
Normal file
112
Mage.Sets/src/mage/cards/a/AangMasterOfElements.java
Normal file
|
|
@ -0,0 +1,112 @@
|
|||
package mage.cards.a;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.CostImpl;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.dynamicvalue.common.StaticValue;
|
||||
import mage.abilities.effects.common.DamagePlayersEffect;
|
||||
import mage.abilities.effects.common.DoIfCostPaid;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
import mage.abilities.effects.common.GainLifeEffect;
|
||||
import mage.abilities.effects.common.cost.SpellsCostReductionControllerEffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.SuperType;
|
||||
import mage.constants.TargetController;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.game.Game;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class AangMasterOfElements extends CardImpl {
|
||||
|
||||
private static final FilterCard filter = new FilterCard("spells");
|
||||
|
||||
public AangMasterOfElements(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "");
|
||||
|
||||
this.supertype.add(SuperType.LEGENDARY);
|
||||
this.subtype.add(SubType.AVATAR);
|
||||
this.subtype.add(SubType.ALLY);
|
||||
this.power = new MageInt(6);
|
||||
this.toughness = new MageInt(6);
|
||||
this.nightCard = true;
|
||||
|
||||
// Flying
|
||||
this.addAbility(FlyingAbility.getInstance());
|
||||
|
||||
// Spells you cast cost {W}{U}{B}{R}{G} less to cast.
|
||||
this.addAbility(new SimpleStaticAbility(new SpellsCostReductionControllerEffect(
|
||||
filter, new ManaCostsImpl<>("{W}{U}{B}{R}{G}"), StaticValue.get(1), true
|
||||
)));
|
||||
|
||||
// At the beginning of each upkeep, you may transform Aang, Master of Elements. If you do, you gain 4 life, draw four cards, put four +1/+1 counters on him, and he deals 4 damage to each opponent.
|
||||
this.addAbility(new BeginningOfUpkeepTriggeredAbility(
|
||||
TargetController.ANY,
|
||||
new DoIfCostPaid(new GainLifeEffect(4), new AangMasterOfElementsCost())
|
||||
.addEffect(new DrawCardSourceControllerEffect(4).concatBy(","))
|
||||
.addEffect(new AddCountersSourceEffect(CounterType.P1P1.createInstance(4))
|
||||
.setText(", put four +1/+1 counters on him"))
|
||||
.addEffect(new DamagePlayersEffect(4, TargetController.OPPONENT)
|
||||
.setText(", and he deals 4 damage to each opponent")),
|
||||
false
|
||||
));
|
||||
}
|
||||
|
||||
private AangMasterOfElements(final AangMasterOfElements card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AangMasterOfElements copy() {
|
||||
return new AangMasterOfElements(this);
|
||||
}
|
||||
}
|
||||
|
||||
class AangMasterOfElementsCost extends CostImpl {
|
||||
|
||||
AangMasterOfElementsCost() {
|
||||
super();
|
||||
text = "transform {this}";
|
||||
}
|
||||
|
||||
private AangMasterOfElementsCost(final AangMasterOfElementsCost cost) {
|
||||
super(cost);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AangMasterOfElementsCost copy() {
|
||||
return new AangMasterOfElementsCost(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) {
|
||||
return Optional
|
||||
.ofNullable(source.getSourcePermanentIfItStillExists(game))
|
||||
.filter(Card::isTransformable)
|
||||
.isPresent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) {
|
||||
paid = Optional
|
||||
.ofNullable(source.getSourcePermanentIfItStillExists(game))
|
||||
.filter(permanent -> permanent.transform(source, game))
|
||||
.isPresent();
|
||||
return paid;
|
||||
}
|
||||
}
|
||||
156
Mage.Sets/src/mage/cards/a/AvatarAang.java
Normal file
156
Mage.Sets/src/mage/cards/a/AvatarAang.java
Normal file
|
|
@ -0,0 +1,156 @@
|
|||
package mage.cards.a;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.decorator.ConditionalOneShotEffect;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
import mage.abilities.effects.common.TransformSourceEffect;
|
||||
import mage.abilities.keyword.FirebendingAbility;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.watchers.Watcher;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class AvatarAang extends CardImpl {
|
||||
|
||||
public AvatarAang(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{R}{G}{W}{U}");
|
||||
|
||||
this.supertype.add(SuperType.LEGENDARY);
|
||||
this.subtype.add(SubType.HUMAN);
|
||||
this.subtype.add(SubType.AVATAR);
|
||||
this.subtype.add(SubType.ALLY);
|
||||
this.power = new MageInt(4);
|
||||
this.toughness = new MageInt(4);
|
||||
|
||||
this.secondSideCardClazz = mage.cards.a.AangMasterOfElements.class;
|
||||
|
||||
// Flying
|
||||
this.addAbility(FlyingAbility.getInstance());
|
||||
|
||||
// Firebending 2
|
||||
this.addAbility(new FirebendingAbility(2));
|
||||
|
||||
// Whenever you waterbend, earthbend, firebend, or airbend, draw a card. Then if you've done all four this turn, transform Avatar Aang.
|
||||
this.addAbility(new AvatarAangTriggeredAbility());
|
||||
}
|
||||
|
||||
private AvatarAang(final AvatarAang card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AvatarAang copy() {
|
||||
return new AvatarAang(this);
|
||||
}
|
||||
}
|
||||
|
||||
class AvatarAangTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
private enum AvatarAangCondition implements Condition {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return AvatarAangWatcher.checkPlayer(game, source);
|
||||
}
|
||||
}
|
||||
|
||||
AvatarAangTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new DrawCardSourceControllerEffect(1));
|
||||
this.addEffect(new ConditionalOneShotEffect(
|
||||
new TransformSourceEffect(), AvatarAangCondition.instance,
|
||||
"Then if you've done all four this turn, transform {this}"
|
||||
));
|
||||
this.setTriggerPhrase("Whenever you waterbend, earthbend, firebend, or airbend, ");
|
||||
this.addWatcher(new AvatarAangWatcher());
|
||||
}
|
||||
|
||||
private AvatarAangTriggeredAbility(final AvatarAangTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AvatarAangTriggeredAbility copy() {
|
||||
return new AvatarAangTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
switch (event.getType()) {
|
||||
case EARTHBENDED:
|
||||
case AIRBENDED:
|
||||
case FIREBENDED:
|
||||
case WATERBENDED:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
return isControlledBy(event.getPlayerId());
|
||||
}
|
||||
}
|
||||
|
||||
class AvatarAangWatcher extends Watcher {
|
||||
|
||||
private final Set<UUID> earthSet = new HashSet<>();
|
||||
private final Set<UUID> airSet = new HashSet<>();
|
||||
private final Set<UUID> fireSet = new HashSet<>();
|
||||
private final Set<UUID> waterSet = new HashSet<>();
|
||||
|
||||
AvatarAangWatcher() {
|
||||
super(WatcherScope.GAME);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void watch(GameEvent event, Game game) {
|
||||
switch (event.getType()) {
|
||||
case EARTHBENDED:
|
||||
earthSet.add(event.getPlayerId());
|
||||
return;
|
||||
case AIRBENDED:
|
||||
airSet.add(event.getPlayerId());
|
||||
return;
|
||||
case FIREBENDED:
|
||||
fireSet.add(event.getPlayerId());
|
||||
return;
|
||||
case WATERBENDED:
|
||||
waterSet.add(event.getPlayerId());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
earthSet.clear();
|
||||
airSet.clear();
|
||||
fireSet.clear();
|
||||
earthSet.clear();
|
||||
}
|
||||
|
||||
private boolean checkPlayer(UUID playerId) {
|
||||
return earthSet.contains(playerId)
|
||||
&& airSet.contains(playerId)
|
||||
&& fireSet.contains(playerId)
|
||||
&& earthSet.contains(playerId);
|
||||
}
|
||||
|
||||
static boolean checkPlayer(Game game, Ability source) {
|
||||
return game.getState().getWatcher(AvatarAangWatcher.class).checkPlayer(source.getControllerId());
|
||||
}
|
||||
}
|
||||
|
|
@ -27,8 +27,12 @@ public final class AvatarTheLastAirbender extends ExpansionSet {
|
|||
|
||||
cards.add(new SetCardInfo("Aang's Iceberg", 336, Rarity.RARE, mage.cards.a.AangsIceberg.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Aang's Iceberg", 5, Rarity.RARE, mage.cards.a.AangsIceberg.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Aang, Master of Elements", 207, Rarity.MYTHIC, mage.cards.a.AangMasterOfElements.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Aang, Master of Elements", 363, Rarity.MYTHIC, mage.cards.a.AangMasterOfElements.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Appa, Steadfast Guardian", 10, Rarity.MYTHIC, mage.cards.a.AppaSteadfastGuardian.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Appa, Steadfast Guardian", 316, Rarity.MYTHIC, mage.cards.a.AppaSteadfastGuardian.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Avatar Aang", 207, Rarity.MYTHIC, mage.cards.a.AvatarAang.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Avatar Aang", 363, Rarity.MYTHIC, mage.cards.a.AvatarAang.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Avatar Enthusiasts", 11, Rarity.COMMON, mage.cards.a.AvatarEnthusiasts.class));
|
||||
cards.add(new SetCardInfo("Earthbending Lesson", 176, Rarity.COMMON, mage.cards.e.EarthbendingLesson.class));
|
||||
cards.add(new SetCardInfo("Fire Nation Attacks", 133, Rarity.UNCOMMON, mage.cards.f.FireNationAttacks.class));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue