Implemented Wolfwillow Haven

This commit is contained in:
Evan Kranzler 2020-01-10 08:06:51 -05:00
parent 18e23a3853
commit 1f5b1e389a
3 changed files with 124 additions and 25 deletions

View file

@ -1,21 +1,14 @@
package mage.cards.w;
import java.util.UUID;
import mage.Mana;
import mage.abilities.Ability;
import mage.abilities.effects.Effect;
import mage.abilities.effects.mana.AddManaToManaPoolTargetControllerEffect;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.mana.AddManaToManaPoolTargetControllerEffect;
import mage.abilities.keyword.EnchantAbility;
import mage.abilities.mana.TriggeredManaAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.ColoredManaSymbol;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.constants.*;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
@ -24,28 +17,29 @@ import mage.target.TargetPermanent;
import mage.target.common.TargetLandPermanent;
import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
/**
*
* @author Plopman
*/
public final class WildGrowth extends CardImpl {
public WildGrowth(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{G}");
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{G}");
this.subtype.add(SubType.AURA);
// Enchant land
TargetPermanent auraTarget = new TargetLandPermanent();
this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.AddAbility));
Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability);
// Whenever enchanted land is tapped for mana, its controller adds {G}.
this.addAbility(new WildGrowthTriggeredAbility());
}
public WildGrowth(final WildGrowth card) {
private WildGrowth(final WildGrowth card) {
super(card);
}
@ -58,11 +52,11 @@ public final class WildGrowth extends CardImpl {
class WildGrowthTriggeredAbility extends TriggeredManaAbility {
public WildGrowthTriggeredAbility() {
WildGrowthTriggeredAbility() {
super(Zone.BATTLEFIELD, new AddManaToManaPoolTargetControllerEffect(new Mana(ColoredManaSymbol.G), "their"));
}
public WildGrowthTriggeredAbility(final WildGrowthTriggeredAbility ability) {
private WildGrowthTriggeredAbility(final WildGrowthTriggeredAbility ability) {
super(ability);
}
@ -79,21 +73,20 @@ class WildGrowthTriggeredAbility extends TriggeredManaAbility {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent enchantment = game.getPermanent(this.getSourceId());
if (enchantment != null && event.getSourceId().equals(enchantment.getAttachedTo())) {
Permanent permanent = game.getPermanent(event.getSourceId());
if (permanent != null) {
for(Effect effect : getEffects()) {
effect.setTargetPointer(new FixedTarget(permanent.getControllerId()));
}
return true;
}
if (enchantment == null || !event.getSourceId().equals(enchantment.getAttachedTo())) {
return false;
}
return false;
Permanent permanent = game.getPermanent(event.getSourceId());
if (permanent == null) {
return false;
}
this.getEffects().setTargetPointer(new FixedTarget(permanent.getControllerId()));
return true;
}
@Override
public String getRule() {
return "Whenever enchanted land is tapped for mana, its controller adds {G}";
return "Whenever enchanted land is tapped for mana, its controller adds an additional {G}";
}
}

View file

@ -0,0 +1,105 @@
package mage.cards.w;
import mage.Mana;
import mage.abilities.Ability;
import mage.abilities.common.ActivateIfConditionActivatedAbility;
import mage.abilities.condition.common.MyTurnCondition;
import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.mana.AddManaToManaPoolTargetControllerEffect;
import mage.abilities.keyword.EnchantAbility;
import mage.abilities.mana.TriggeredManaAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.WolfToken;
import mage.target.TargetPermanent;
import mage.target.common.TargetLandPermanent;
import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class WolfwillowHaven extends CardImpl {
public WolfwillowHaven(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{G}");
this.subtype.add(SubType.AURA);
// Enchant land
TargetPermanent auraTarget = new TargetLandPermanent();
this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature));
Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability);
// Whenever enchanted land is tapped for mana, its controller adds an additional {G}.
this.addAbility(new WolfwillowHavenTriggeredAbility());
// {4}{G}, Sacrifice Wolfwillow Haven: Create a 2/2 green Wolf creature token. Activate this ability only during your turn.
ability = new ActivateIfConditionActivatedAbility(
Zone.BATTLEFIELD, new CreateTokenEffect(new WolfToken()),
new ManaCostsImpl("{4}{G}"), MyTurnCondition.instance
);
ability.addCost(new SacrificeSourceCost());
this.addAbility(ability);
}
private WolfwillowHaven(final WolfwillowHaven card) {
super(card);
}
@Override
public WolfwillowHaven copy() {
return new WolfwillowHaven(this);
}
}
class WolfwillowHavenTriggeredAbility extends TriggeredManaAbility {
WolfwillowHavenTriggeredAbility() {
super(Zone.BATTLEFIELD, new AddManaToManaPoolTargetControllerEffect(new Mana(ColoredManaSymbol.G), "their"));
}
private WolfwillowHavenTriggeredAbility(final WolfwillowHavenTriggeredAbility ability) {
super(ability);
}
@Override
public WolfwillowHavenTriggeredAbility copy() {
return new WolfwillowHavenTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.TAPPED_FOR_MANA;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent enchantment = game.getPermanent(this.getSourceId());
if (enchantment == null || !event.getSourceId().equals(enchantment.getAttachedTo())) {
return false;
}
Permanent permanent = game.getPermanent(event.getSourceId());
if (permanent == null) {
return false;
}
this.getEffects().setTargetPointer(new FixedTarget(permanent.getControllerId()));
return true;
}
@Override
public String getRule() {
return "Whenever enchanted land is tapped for mana, its controller adds an additional {G}";
}
}

View file

@ -194,5 +194,6 @@ public final class TherosBeyondDeath extends ExpansionSet {
cards.add(new SetCardInfo("Wavebreak Hippocamp", 80, Rarity.RARE, mage.cards.w.WavebreakHippocamp.class));
cards.add(new SetCardInfo("Whirlwind Denial", 81, Rarity.UNCOMMON, mage.cards.w.WhirlwindDenial.class));
cards.add(new SetCardInfo("Woe Strider", 123, Rarity.RARE, mage.cards.w.WoeStrider.class));
cards.add(new SetCardInfo("Wolfwillow Haven", 205, Rarity.UNCOMMON, mage.cards.w.WolfwillowHaven.class));
}
}