@Override public DealsDamageToOneOrMoreCreaturesTriggeredAbility copy() { return new DealsDamageToOneOrMoreCreaturesTriggeredAbility(this); }
@Override public boolean checkTrigger(GameEvent event, Game game) { if (super.checkTrigger(event, game)) { // check that combat damage does only once trigger also if multiple creatures were damaged because they block or were blocked by source if (game.getTurn().getStepType() == PhaseStep.COMBAT_DAMAGE || game.getTurn().getStepType() == PhaseStep.FIRST_COMBAT_DAMAGE) { String stepHash = (String) game.getState().getValue("damageStep" + getOriginalId()); String newStepHash = game.getStep().getType().toString() + game.getTurnNum(); if (!newStepHash.equals(stepHash)) { // this ability did not trigger during this damage step game.getState().setValue("damageStep" + getOriginalId(), game.getStep().getType().toString() + game.getTurnNum()); return true; } } else { game.getState().setValue("damageStep" + getOriginalId(), null); return true; } // TODO: check that if the source did non combat damage to multiple targets at the same time, it may only trigger one time // I don't know currently how this can happen for a source creature that this has not already build in } return false; }
public BriarbridgePatrol(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}"); this.subtype.add(SubType.HUMAN, SubType.WARRIOR); this.power = new MageInt(3); this.toughness = new MageInt(3); // Whenever Briarbridge Patrol deals damage to one or more creatures, investigate (Create a colorless Clue artifact token with "2, Sacrifice this artifact: Draw a card."). this.addAbility(new DealsDamageToOneOrMoreCreaturesTriggeredAbility(new InvestigateEffect(), false, false, false)); // At the beginning of each end step, if you sacrificed three or more Clues this turn, you may put a creature card from your hand onto the battlefield. this.addAbility(new BeginningOfEndStepTriggeredAbility(Zone.BATTLEFIELD, new PutCardFromHandOntoBattlefieldEffect(StaticFilters.FILTER_CARD_CREATURE_A), TargetController.ANY, BriarbridgePatrolCondition.instance, true), new PermanentsSacrificedWatcher()); }