Implement Ashaya and Cleric of Life's Blood (#7041)

* Implement Ashaya and Cleric of Life's Blood

* Implement Ashaya, Soul of the Wild

* Implement Cleric of Life's Bond
This commit is contained in:
jmharmon 2020-09-03 06:35:05 -07:00 committed by GitHub
parent fbdb2456e9
commit 05285072b4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 229 additions and 0 deletions

View file

@ -0,0 +1,121 @@
package mage.cards.a;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.effects.common.continuous.SetPowerToughnessSourceEffect;
import mage.abilities.mana.GreenManaAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.filter.common.FilterControlledLandPermanent;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.permanent.TokenPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import java.util.List;
import java.util.UUID;
/**
* @author jmharmon
*/
public final class AshayaSoulOfTheWild extends CardImpl {
private static final FilterControlledPermanent filter = new FilterControlledLandPermanent("lands you control");
public AshayaSoulOfTheWild(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}{G}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.ELEMENTAL);
this.power = new MageInt(0);
this.toughness = new MageInt(0);
// Ashaya, Soul of the Wilds power and toughness are each equal to the number of lands you control.
this.addAbility(new SimpleStaticAbility(Zone.ALL, new SetPowerToughnessSourceEffect(new PermanentsOnBattlefieldCount(filter), Duration.EndOfGame)));
// Nontoken creatures you control are Forest lands in addition to their other types. (Theyre still affected by summoning sickness.)
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new AshayaSoulOfTheWildEffect()));
}
public AshayaSoulOfTheWild(final AshayaSoulOfTheWild card) {
super(card);
}
@Override
public AshayaSoulOfTheWild copy() {
return new AshayaSoulOfTheWild(this);
}
}
class AshayaSoulOfTheWildEffect extends ContinuousEffectImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("nontoken creatures");
static {
filter.add(Predicates.not(TokenPredicate.instance));
}
public AshayaSoulOfTheWildEffect() {
super(Duration.WhileOnBattlefield, Outcome.Neutral);
staticText = "Nontoken creatures you control are Forest lands in addition to their other types";
}
public AshayaSoulOfTheWildEffect(final AshayaSoulOfTheWildEffect effect) {
super(effect);
}
@Override
public AshayaSoulOfTheWildEffect copy() {
return new AshayaSoulOfTheWildEffect(this);
}
@Override
public boolean apply(Layer layer, SubLayer subLayer, Ability source, Game game) {
Player you = game.getPlayer(source.getControllerId());
List<Permanent> creatures = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game);
if (you != null) {
for (Permanent creature : creatures) {
if (creature != null) {
switch (layer) {
case TypeChangingEffects_4:
creature.addCardType(CardType.LAND);
creature.getSubtype(game).add(SubType.FOREST);
break;
case AbilityAddingRemovingEffects_6:
boolean flag = false;
for (Ability ability : creature.getAbilities(game)) {
if (ability instanceof GreenManaAbility) {
flag = true;
break;
}
}
if (!flag) {
creature.addAbility(new GreenManaAbility(), source.getSourceId(), game);
}
break;
}
}
}
return true;
}
return false;
}
@Override
public boolean apply(Game game, Ability source) {
return false;
}
@Override
public boolean hasLayer(Layer layer) {
return layer == Layer.TypeChangingEffects_4 || layer == Layer.AbilityAddingRemovingEffects_6;
}
}

View file

@ -0,0 +1,106 @@
package mage.cards.c;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
import mage.abilities.effects.common.GainLifeEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.permanent.AnotherPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import java.util.UUID;
/**
* @author jmharmon
*/
public final class ClericOfLifesBond extends CardImpl {
private static final FilterPermanent filter = new FilterControlledPermanent("another Cleric");
static {
filter.add(AnotherPredicate.instance);
filter.add(SubType.CLERIC.getPredicate());
}
public ClericOfLifesBond(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{W}{B}");
this.subtype.add(SubType.VAMPIRE);
this.subtype.add(SubType.CLERIC);
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// Whenever another Cleric enters the battlefield under your control, you gain 1 life.
this.addAbility(new EntersBattlefieldControlledTriggeredAbility(new GainLifeEffect(1), filter));
// Whenever you gain life for the first time each turn, put a +1/+1 counter on Cleric of Lifes Bond.
this.addAbility(new ClericOfLifesBondCounterTriggeredAbility());
}
public ClericOfLifesBond(final ClericOfLifesBond card) {
super(card);
}
@Override
public ClericOfLifesBond copy() {
return new ClericOfLifesBond(this);
}
}
class ClericOfLifesBondCounterTriggeredAbility extends TriggeredAbilityImpl {
private boolean triggeredOnce = false;
ClericOfLifesBondCounterTriggeredAbility() {
super(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.P1P1.createInstance()), false);
}
private ClericOfLifesBondCounterTriggeredAbility(final ClericOfLifesBondCounterTriggeredAbility ability) {
super(ability);
this.triggeredOnce = ability.triggeredOnce;
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.GAINED_LIFE
|| event.getType() == GameEvent.EventType.END_PHASE_POST;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.END_PHASE_POST) {
triggeredOnce = false;
return false;
}
if (event.getType() != GameEvent.EventType.GAINED_LIFE
|| !event.getPlayerId().equals(getControllerId())) {
return false;
}
if (triggeredOnce) {
return false;
}
triggeredOnce = true;
return true;
}
@Override
public String getRule() {
return "When you gain life for the first time each turn, put a +1/+1 counter on {this}.";
}
@Override
public ClericOfLifesBondCounterTriggeredAbility copy() {
return new ClericOfLifesBondCounterTriggeredAbility(this);
}
}

View file

@ -75,11 +75,13 @@ public final class ZendikarRising extends ExpansionSet {
cards.add(new SetCardInfo("Akoum Hellhound", 133, Rarity.COMMON, mage.cards.a.AkoumHellhound.class));
cards.add(new SetCardInfo("Archpriest of Iona", 5, Rarity.RARE, mage.cards.a.ArchpriestOfIona.class));
cards.add(new SetCardInfo("Ardent Electromancer", 135, Rarity.COMMON, mage.cards.a.ArdentElectromancer.class));
cards.add(new SetCardInfo("Ashaya, Soul of the Wild", 179, Rarity.MYTHIC, mage.cards.a.AshayaSoulOfTheWild.class));
cards.add(new SetCardInfo("Bloodchief's Thirst", 94, Rarity.UNCOMMON, mage.cards.b.BloodchiefsThirst.class));
cards.add(new SetCardInfo("Boulderloft Pathway", 258, Rarity.RARE, mage.cards.b.BoulderloftPathway.class));
cards.add(new SetCardInfo("Branchloft Pathway", 258, Rarity.RARE, mage.cards.b.BranchloftPathway.class));
cards.add(new SetCardInfo("Brightclimb Pathway", 259, Rarity.RARE, mage.cards.b.BrightclimbPathway.class));
cards.add(new SetCardInfo("Clearwater Pathway", 260, Rarity.RARE, mage.cards.c.ClearwaterPathway.class));
cards.add(new SetCardInfo("Cleric of Life's Bond", 222, Rarity.UNCOMMON, mage.cards.c.ClericOfLifesBond.class));
cards.add(new SetCardInfo("Cliffhaven Sell-Sword", 8, Rarity.COMMON, mage.cards.c.CliffhavenSellSword.class));
cards.add(new SetCardInfo("Cragcrown Pathway", 261, Rarity.RARE, mage.cards.c.CragcrownPathway.class));
cards.add(new SetCardInfo("Demon's Disciple", 97, Rarity.UNCOMMON, mage.cards.d.DemonsDisciple.class));