mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
[TLA] Implement Earthbending Lessons
This commit is contained in:
parent
43191dcf54
commit
b552c850f4
4 changed files with 150 additions and 0 deletions
36
Mage.Sets/src/mage/cards/e/EarthbendingLesson.java
Normal file
36
Mage.Sets/src/mage/cards/e/EarthbendingLesson.java
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
package mage.cards.e;
|
||||
|
||||
import mage.abilities.effects.keyword.EarthbendEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.target.TargetPermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class EarthbendingLesson extends CardImpl {
|
||||
|
||||
public EarthbendingLesson(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{G}");
|
||||
|
||||
this.subtype.add(SubType.LESSON);
|
||||
|
||||
// Earthbend 4.
|
||||
this.getSpellAbility().addEffect(new EarthbendEffect(4));
|
||||
this.getSpellAbility().addTarget(new TargetPermanent(StaticFilters.FILTER_CONTROLLED_PERMANENT_LAND));
|
||||
}
|
||||
|
||||
private EarthbendingLesson(final EarthbendingLesson card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EarthbendingLesson copy() {
|
||||
return new EarthbendingLesson(this);
|
||||
}
|
||||
}
|
||||
|
|
@ -22,6 +22,7 @@ public final class AvatarTheLastAirbender extends ExpansionSet {
|
|||
this.hasBasicLands = false; // temporary
|
||||
|
||||
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("Katara, the Fearless", 230, Rarity.RARE, mage.cards.k.KataraTheFearless.class));
|
||||
cards.add(new SetCardInfo("Sokka's Haiku", 71, Rarity.UNCOMMON, mage.cards.s.SokkasHaiku.class));
|
||||
cards.add(new SetCardInfo("Southern Air Temple", 36, Rarity.UNCOMMON, mage.cards.s.SouthernAirTemple.class));
|
||||
|
|
|
|||
|
|
@ -0,0 +1,112 @@
|
|||
package mage.abilities.effects.keyword;
|
||||
|
||||
import mage.MageObjectReference;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.DelayedTriggeredAbility;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.ReturnToBattlefieldUnderOwnerControlTargetEffect;
|
||||
import mage.abilities.effects.common.continuous.BecomesCreatureTargetEffect;
|
||||
import mage.abilities.keyword.HasteAbility;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.ZoneChangeEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.token.custom.CreatureToken;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class EarthbendEffect extends OneShotEffect {
|
||||
|
||||
private final int amount;
|
||||
|
||||
public EarthbendEffect(int amount) {
|
||||
super(Outcome.Benefit);
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
private EarthbendEffect(final EarthbendEffect effect) {
|
||||
super(effect);
|
||||
this.amount = effect.amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EarthbendEffect copy() {
|
||||
return new EarthbendEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||
if (permanent == null) {
|
||||
return false;
|
||||
}
|
||||
game.addEffect(new BecomesCreatureTargetEffect(
|
||||
new CreatureToken(0, 0)
|
||||
.withAbility(HasteAbility.getInstance()),
|
||||
false, true, Duration.Custom
|
||||
), source);
|
||||
game.addDelayedTriggeredAbility(new EarthbendingDelayedTriggeredAbility(permanent, game), source);
|
||||
game.fireEvent(GameEvent.getEvent(
|
||||
GameEvent.EventType.EARTHBENDED, permanent.getId(),
|
||||
source, source.getControllerId(), amount
|
||||
));
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText(Mode mode) {
|
||||
if (staticText != null && !staticText.isEmpty()) {
|
||||
return staticText;
|
||||
}
|
||||
return "earthbend " + amount + ". <i>(Target land you control becomes a 0/0 creature " +
|
||||
"with haste that's still a land. Put " + CardUtil.numberToText(amount, "a") +
|
||||
" +1/+1 counter" + (amount > 1 ? "s" : "") + " on it. " +
|
||||
"When it dies or is exiled, return it to the battlefield tapped.)</i>";
|
||||
}
|
||||
}
|
||||
|
||||
class EarthbendingDelayedTriggeredAbility extends DelayedTriggeredAbility {
|
||||
|
||||
private final MageObjectReference mor;
|
||||
|
||||
EarthbendingDelayedTriggeredAbility(Permanent permanent, Game game) {
|
||||
super(new ReturnToBattlefieldUnderOwnerControlTargetEffect(true, false), Duration.Custom, true, false);
|
||||
this.mor = new MageObjectReference(permanent, game, 1);
|
||||
this.getAllEffects().setTargetPointer(new FixedTarget(this.mor));
|
||||
}
|
||||
|
||||
private EarthbendingDelayedTriggeredAbility(final EarthbendingDelayedTriggeredAbility ability) {
|
||||
super(ability);
|
||||
this.mor = ability.mor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EarthbendingDelayedTriggeredAbility copy() {
|
||||
return new EarthbendingDelayedTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.ZONE_CHANGE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
|
||||
return zEvent.getFromZone() == Zone.BATTLEFIELD
|
||||
&& (zEvent.getToZone() == Zone.GRAVEYARD || zEvent.getToZone() == Zone.EXILED)
|
||||
&& mor.refersTo(zEvent.getTarget(), game, -1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "When it dies or is exiled, return it to the battlefield tapped.";
|
||||
}
|
||||
}
|
||||
|
|
@ -695,6 +695,7 @@ public class GameEvent implements Serializable {
|
|||
data id of the ability being paid for
|
||||
*/
|
||||
PAY_SACRIFICE_COST,
|
||||
EARTHBENDED,
|
||||
// custom events - must store some unique data to track
|
||||
CUSTOM_EVENT;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue