[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,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);
}
}