[TLE] Implement Earthshape

This commit is contained in:
theelk801 2025-11-11 11:21:37 -05:00
parent 6fb84830b3
commit f5802be133
3 changed files with 88 additions and 2 deletions

View file

@ -0,0 +1,81 @@
package mage.cards.e;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continuous.GainAbilityAllEffect;
import mage.abilities.effects.common.continuous.GainAbilityControllerEffect;
import mage.abilities.effects.keyword.EarthbendTargetEffect;
import mage.abilities.keyword.HexproofAbility;
import mage.abilities.keyword.IndestructibleAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.ComparisonType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.mageobject.PowerPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.common.TargetControlledLandPermanent;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class Earthshape extends CardImpl {
public Earthshape(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{W}");
// Earthbend 3. Then each creature you control with power less than or equal to that land's power gains hexproof and indestructible until end of turn. You gain hexproof until end of turn.
this.getSpellAbility().addEffect(new EarthshapeEffect());
this.getSpellAbility().addTarget(new TargetControlledLandPermanent());
this.getSpellAbility().addEffect(new GainAbilityControllerEffect(HexproofAbility.getInstance(), Duration.EndOfTurn));
}
private Earthshape(final Earthshape card) {
super(card);
}
@Override
public Earthshape copy() {
return new Earthshape(this);
}
}
class EarthshapeEffect extends OneShotEffect {
EarthshapeEffect() {
super(Outcome.Benefit);
staticText = "Earthbend 3. Then each creature you control with power less than or equal " +
"to that land's power gains hexproof and indestructible until end of turn";
}
private EarthshapeEffect(final EarthshapeEffect effect) {
super(effect);
}
@Override
public EarthshapeEffect copy() {
return new EarthshapeEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
if (permanent == null) {
return false;
}
EarthbendTargetEffect.doEarthBend(permanent, 3, game, source);
game.processAction();
int power = permanent.getPower().getValue();
FilterPermanent filter = new FilterControlledCreaturePermanent();
filter.add(new PowerPredicate(ComparisonType.OR_LESS, power));
game.addEffect(new GainAbilityAllEffect(HexproofAbility.getInstance(), Duration.EndOfTurn, filter), source);
game.addEffect(new GainAbilityAllEffect(IndestructibleAbility.getInstance(), Duration.EndOfTurn, filter), source);
return true;
}
}

View file

@ -91,6 +91,7 @@ public final class AvatarTheLastAirbenderEternal extends ExpansionSet {
cards.add(new SetCardInfo("Drannith Magistrate", 2, Rarity.MYTHIC, mage.cards.d.DrannithMagistrate.class));
cards.add(new SetCardInfo("Duelist's Heritage", 153, Rarity.RARE, mage.cards.d.DuelistsHeritage.class));
cards.add(new SetCardInfo("Earthbending Student", 249, Rarity.UNCOMMON, mage.cards.e.EarthbendingStudent.class));
cards.add(new SetCardInfo("Earthshape", 67, Rarity.RARE, mage.cards.e.Earthshape.class));
cards.add(new SetCardInfo("Eel-Hounds", 250, Rarity.UNCOMMON, mage.cards.e.EelHounds.class));
cards.add(new SetCardInfo("Eladamri's Call", 48, Rarity.MYTHIC, mage.cards.e.EladamrisCall.class));
cards.add(new SetCardInfo("Elemental Bond", 40, Rarity.MYTHIC, mage.cards.e.ElementalBond.class));

View file

@ -54,19 +54,23 @@ public class EarthbendTargetEffect extends OneShotEffect {
if (permanent == null) {
return false;
}
int value = amount.calculate(game, source, this);
doEarthBend(permanent, value, game, source);
return true;
}
public static void doEarthBend(Permanent permanent, int value, Game game, Ability source) {
game.addEffect(new BecomesCreatureTargetEffect(
new CreatureToken(0, 0)
.withAbility(HasteAbility.getInstance()),
false, true, Duration.Custom
), source);
int value = amount.calculate(game, source, this);
permanent.addCounters(CounterType.P1P1.createInstance(value), source, game);
game.addDelayedTriggeredAbility(new EarthbendingDelayedTriggeredAbility(permanent, game), source);
game.fireEvent(GameEvent.getEvent(
GameEvent.EventType.EARTHBENDED, permanent.getId(),
source, source.getControllerId(), value
));
return true;
}
@Override