[LTR] Implement Orcish Bowmasters (#10450)

Refactored [[Xyris, the Writhing Storm]] since the trigger is partly the same.
This commit is contained in:
Susucre 2023-06-23 02:05:08 +02:00 committed by GitHub
parent 09e0cba992
commit a75ec34a45
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 117 additions and 47 deletions

View file

@ -0,0 +1,63 @@
package mage.cards.o;
import mage.MageInt;
import mage.abilities.TriggeredAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.OpponentDrawCardExceptFirstCardDrawStepTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.effects.keyword.AmassEffect;
import mage.abilities.keyword.FlashAbility;
import mage.abilities.meta.OrTriggeredAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.target.common.TargetAnyTarget;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/**
* @author Susucr
*/
public class OrcishBowmasters extends CardImpl {
public OrcishBowmasters(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{B}");
this.addSubType(SubType.ORC);
this.addSubType(SubType.ARCHER);
this.power = new MageInt(1);
this.toughness = new MageInt(1);
// Flash
this.addAbility(FlashAbility.getInstance());
// When Orcish Bowmasters enters the battlefield and whenever an opponent draws a card except the first one they
// draw in each of their draw steps, Orcish Bowmasters deals 1 damage to any target. Then amass Orcs 1.
TriggeredAbility triggeredAbility =
new OrTriggeredAbility(Zone.BATTLEFIELD, new DamageTargetEffect(1, "{this}"),
new EntersBattlefieldTriggeredAbility(null, false),
new OpponentDrawCardExceptFirstCardDrawStepTriggeredAbility(Zone.BATTLEFIELD, null, false)
.setTriggerPhrase("When {this} enters the battlefield and whenever an opponent draws a card " +
"except the first one they draw in each of their draw steps, "));
triggeredAbility.addTarget(new TargetAnyTarget());
Effect amass = new AmassEffect(1, SubType.ORC);
amass.setText("Then amass Orcs 1.");
triggeredAbility.addEffect(amass);
this.addAbility(triggeredAbility);
};
private OrcishBowmasters(final OrcishBowmasters card) {
super(card);
}
@Override
public OrcishBowmasters copy() {
return new OrcishBowmasters(this);
}
}

View file

@ -2,9 +2,8 @@ package mage.cards.x;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.TriggeredAbility;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility; import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
import mage.abilities.common.OpponentDrawCardExceptFirstCardDrawStepTriggeredAbility;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.keyword.FlyingAbility; import mage.abilities.keyword.FlyingAbility;
@ -12,10 +11,8 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.*; import mage.constants.*;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.token.SnakeToken; import mage.game.permanent.token.SnakeToken;
import mage.players.Player; import mage.players.Player;
import mage.watchers.common.CardsDrawnDuringDrawStepWatcher;
import java.util.UUID; import java.util.UUID;
@ -37,7 +34,7 @@ public final class XyrisTheWrithingStorm extends CardImpl {
this.addAbility(FlyingAbility.getInstance()); this.addAbility(FlyingAbility.getInstance());
// Whenever an opponent draws a card except the first one they draw in each of their draw steps, create a 1/1 green Snake creature token. // Whenever an opponent draws a card except the first one they draw in each of their draw steps, create a 1/1 green Snake creature token.
this.addAbility(new XyrisTheWrithingStormDrawAbility(), new CardsDrawnDuringDrawStepWatcher()); this.addAbility(new OpponentDrawCardExceptFirstCardDrawStepTriggeredAbility(Zone.BATTLEFIELD, new CreateTokenEffect(new SnakeToken(), 1), false));
// Whenever Xyris, the Writhing Storm deals combat damage to a player, you and that player each draw that many cards. // Whenever Xyris, the Writhing Storm deals combat damage to a player, you and that player each draw that many cards.
this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(new XyrisTheWrithingStormCombatDamageEffect(), false, true)); this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(new XyrisTheWrithingStormCombatDamageEffect(), false, true));
} }
@ -52,48 +49,6 @@ public final class XyrisTheWrithingStorm extends CardImpl {
} }
} }
class XyrisTheWrithingStormDrawAbility extends TriggeredAbilityImpl {
public XyrisTheWrithingStormDrawAbility() {
super(Zone.BATTLEFIELD, new CreateTokenEffect(new SnakeToken(), 1), false);
}
public XyrisTheWrithingStormDrawAbility(final XyrisTheWrithingStormDrawAbility ability) {
super(ability);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DREW_CARD;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (game.getPlayer(this.getControllerId()).hasOpponent(event.getPlayerId(), game)) {
if (game.isActivePlayer(event.getPlayerId())
&& game.getPhase().getStep().getType() == PhaseStep.DRAW) {
CardsDrawnDuringDrawStepWatcher watcher = game.getState().getWatcher(CardsDrawnDuringDrawStepWatcher.class);
if (watcher != null && watcher.getAmountCardsDrawn(event.getPlayerId()) > 1) {
return true;
}
} else {
return true;
}
}
return false;
}
@Override
public TriggeredAbility copy() {
return new XyrisTheWrithingStormDrawAbility(this);
}
@Override
public String getRule() {
return "Whenever an opponent draws a card except the first one they draw in each of their draw steps, create a 1/1 green Snake creature token.";
}
}
class XyrisTheWrithingStormCombatDamageEffect extends OneShotEffect { class XyrisTheWrithingStormCombatDamageEffect extends OneShotEffect {

View file

@ -177,6 +177,7 @@ public final class TheLordOfTheRingsTalesOfMiddleEarth extends ExpansionSet {
cards.add(new SetCardInfo("Oliphaunt", 139, Rarity.COMMON, mage.cards.o.Oliphaunt.class)); cards.add(new SetCardInfo("Oliphaunt", 139, Rarity.COMMON, mage.cards.o.Oliphaunt.class));
cards.add(new SetCardInfo("Olog-hai Crusher", 140, Rarity.COMMON, mage.cards.o.OlogHaiCrusher.class)); cards.add(new SetCardInfo("Olog-hai Crusher", 140, Rarity.COMMON, mage.cards.o.OlogHaiCrusher.class));
cards.add(new SetCardInfo("One Ring to Rule Them All", 102, Rarity.RARE, mage.cards.o.OneRingToRuleThemAll.class)); cards.add(new SetCardInfo("One Ring to Rule Them All", 102, Rarity.RARE, mage.cards.o.OneRingToRuleThemAll.class));
cards.add(new SetCardInfo("Orcish Bowmasters", 103, Rarity.RARE, mage.cards.o.OrcishBowmasters.class));
cards.add(new SetCardInfo("Orcish Medicine", 104, Rarity.COMMON, mage.cards.o.OrcishMedicine.class)); cards.add(new SetCardInfo("Orcish Medicine", 104, Rarity.COMMON, mage.cards.o.OrcishMedicine.class));
cards.add(new SetCardInfo("Palantir of Orthanc", 247, Rarity.MYTHIC, mage.cards.p.PalantirOfOrthanc.class)); cards.add(new SetCardInfo("Palantir of Orthanc", 247, Rarity.MYTHIC, mage.cards.p.PalantirOfOrthanc.class));
cards.add(new SetCardInfo("Pelargir Survivor", 64, Rarity.COMMON, mage.cards.p.PelargirSurvivor.class)); cards.add(new SetCardInfo("Pelargir Survivor", 64, Rarity.COMMON, mage.cards.p.PelargirSurvivor.class));

View file

@ -0,0 +1,51 @@
package mage.abilities.common;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.watchers.common.CardsDrawnDuringDrawStepWatcher;
/**
* @author AsterAether, Susucr
*/
public class OpponentDrawCardExceptFirstCardDrawStepTriggeredAbility extends TriggeredAbilityImpl {
public OpponentDrawCardExceptFirstCardDrawStepTriggeredAbility(Zone zone, Effect effect, Boolean optional) {
super(zone, effect, optional);
this.addWatcher(new CardsDrawnDuringDrawStepWatcher());
setTriggerPhrase("Whenever an opponent draws a card except the first one they draw in each of their draw steps, ");
}
public OpponentDrawCardExceptFirstCardDrawStepTriggeredAbility(OpponentDrawCardExceptFirstCardDrawStepTriggeredAbility ability) {
super(ability);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DREW_CARD;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (game.getPlayer(this.getControllerId()).hasOpponent(event.getPlayerId(), game)) {
if (game.isActivePlayer(event.getPlayerId())
&& game.getPhase().getStep().getType() == PhaseStep.DRAW) {
CardsDrawnDuringDrawStepWatcher watcher = game.getState().getWatcher(CardsDrawnDuringDrawStepWatcher.class);
if (watcher != null && watcher.getAmountCardsDrawn(event.getPlayerId()) > 1) {
return true;
}
} else {
return true;
}
}
return false;
}
@Override
public OpponentDrawCardExceptFirstCardDrawStepTriggeredAbility copy() {
return new OpponentDrawCardExceptFirstCardDrawStepTriggeredAbility(this);
}
}