[LTR] Implement Boromir, Warden of the Tower (#10594)

* [LTR] Implement Boromir, Warden of the Tower

* group trigger from Boromir and Lavinia

* fix trigger text
This commit is contained in:
Susucre 2023-07-09 22:42:29 +02:00 committed by GitHub
parent f8b1ada369
commit 39904d0ca3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 112 additions and 46 deletions

View file

@ -0,0 +1,61 @@
package mage.cards.b;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SpellCastOpponentNoManaSpentTriggeredAbility;
import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.effects.common.CounterTargetEffect;
import mage.abilities.effects.common.continuous.GainAbilityAllEffect;
import mage.abilities.effects.keyword.TheRingTemptsYouEffect;
import mage.abilities.keyword.IndestructibleAbility;
import mage.abilities.keyword.VigilanceAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.filter.StaticFilters;
import java.util.UUID;
/**
*
* @author Susucr
*/
public final class BoromirWardenOfTheTower extends CardImpl {
public BoromirWardenOfTheTower(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{W}");
this.supertype.add(SuperType.LEGENDARY);
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.SOLDIER);
this.power = new MageInt(3);
this.toughness = new MageInt(3);
// Vigilance
this.addAbility(VigilanceAbility.getInstance());
// Whenever an opponent casts a spell, if no mana was spent to cast it, counter that spell.
this.addAbility(new SpellCastOpponentNoManaSpentTriggeredAbility(new CounterTargetEffect()));
// Sacrifice Boromir, Warden of the Tower: Creatures you control gain indestructible until end of turn. The Ring tempts you.
Ability ability = new SimpleActivatedAbility(new GainAbilityAllEffect(
IndestructibleAbility.getInstance(), Duration.EndOfTurn,
StaticFilters.FILTER_CONTROLLED_CREATURES, false
), new SacrificeSourceCost());
ability.addEffect(new TheRingTemptsYouEffect());
this.addAbility(ability);
}
private BoromirWardenOfTheTower(final BoromirWardenOfTheTower card) {
super(card);
}
@Override
public BoromirWardenOfTheTower copy() {
return new BoromirWardenOfTheTower(this);
}
}

View file

@ -4,10 +4,9 @@ package mage.cards.l;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.common.SpellCastOpponentNoManaSpentTriggeredAbility;
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.CounterTargetEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
@ -20,8 +19,6 @@ import mage.filter.predicate.mageobject.ManaValuePredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.game.stack.Spell;
import mage.target.targetpointer.FixedTarget;
import java.util.List;
import java.util.UUID;
@ -45,7 +42,7 @@ public final class LaviniaAzoriusRenegade extends CardImpl {
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new LaviniaAzoriusRenegadeReplacementEffect()));
// Whenever an opponent casts a spell, if no mana was spent to cast it, counter that spell.
this.addAbility(new LaviniaAzoriusRenegadeTriggeredAbility());
this.addAbility(new SpellCastOpponentNoManaSpentTriggeredAbility(new CounterTargetEffect()));
}
private LaviniaAzoriusRenegade(final LaviniaAzoriusRenegade card) {
@ -114,45 +111,4 @@ class LaviniaAzoriusRenegadeReplacementEffect extends ContinuousRuleModifyingEff
public LaviniaAzoriusRenegadeReplacementEffect copy() {
return new LaviniaAzoriusRenegadeReplacementEffect(this);
}
}
class LaviniaAzoriusRenegadeTriggeredAbility extends TriggeredAbilityImpl {
public LaviniaAzoriusRenegadeTriggeredAbility() {
super(Zone.BATTLEFIELD, new CounterTargetEffect(), false);
}
public LaviniaAzoriusRenegadeTriggeredAbility(final LaviniaAzoriusRenegadeTriggeredAbility ability) {
super(ability);
}
@Override
public LaviniaAzoriusRenegadeTriggeredAbility copy() {
return new LaviniaAzoriusRenegadeTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.SPELL_CAST;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (game.getPlayer(this.getControllerId()).hasOpponent(event.getPlayerId(), game)) {
Spell spell = game.getStack().getSpell(event.getTargetId());
if (spell != null && spell.getStackAbility().getManaCostsToPay().getUsedManaToPay().count() == 0) {
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(event.getTargetId()));
}
return true;
}
}
return false;
}
@Override
public String getRule() {
return "Whenever an opponent casts a spell, if no mana was spent to cast it, counter that spell.";
}
}

View file

@ -39,6 +39,7 @@ public final class TheLordOfTheRingsTalesOfMiddleEarth extends ExpansionSet {
cards.add(new SetCardInfo("Bombadil's Song", 154, Rarity.COMMON, mage.cards.b.BombadilsSong.class));
cards.add(new SetCardInfo("Book of Mazarbul", 116, Rarity.UNCOMMON, mage.cards.b.BookOfMazarbul.class));
cards.add(new SetCardInfo("Borne Upon a Wind", 44, Rarity.RARE, mage.cards.b.BorneUponAWind.class));
cards.add(new SetCardInfo("Boromir, Warden of the Tower", 4, Rarity.RARE, mage.cards.b.BoromirWardenOfTheTower.class));
cards.add(new SetCardInfo("Brandywine Farmer", 155, Rarity.COMMON, mage.cards.b.BrandywineFarmer.class));
cards.add(new SetCardInfo("Breaking of the Fellowship", 117, Rarity.COMMON, mage.cards.b.BreakingOfTheFellowship.class));
cards.add(new SetCardInfo("Butterbur, Bree Innkeeper", 197, Rarity.UNCOMMON, mage.cards.b.ButterburBreeInnkeeper.class));

View file

@ -0,0 +1,48 @@
package mage.abilities.common;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.stack.Spell;
import mage.target.targetpointer.FixedTarget;
/**
* @author Susucr
*/
public class SpellCastOpponentNoManaSpentTriggeredAbility extends TriggeredAbilityImpl {
public SpellCastOpponentNoManaSpentTriggeredAbility(Effect effect) {
super(Zone.BATTLEFIELD, effect, false);
this.setTriggerPhrase("Whenever an opponent casts a spell, if no mana was spent to cast it, ");
}
public SpellCastOpponentNoManaSpentTriggeredAbility(final SpellCastOpponentNoManaSpentTriggeredAbility ability) {
super(ability);
}
@Override
public SpellCastOpponentNoManaSpentTriggeredAbility copy() {
return new SpellCastOpponentNoManaSpentTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.SPELL_CAST;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (game.getPlayer(this.getControllerId()).hasOpponent(event.getPlayerId(), game)) {
Spell spell = game.getStack().getSpell(event.getTargetId());
if (spell != null && spell.getStackAbility().getManaCostsToPay().getUsedManaToPay().count() == 0) {
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(event.getTargetId()));
}
return true;
}
}
return false;
}
}