public ArrowVolleyTrap(GameState state) { super(state); SetGenerator trapCondition = Intersect.instance(Between.instance(4, null), Count.instance(Attacking.instance())); this.addAbility( new org.rnd.jmagic.abilities.Trap( state, this.getName(), trapCondition, "If four or more creatures are attacking", "(1)(W)")); Target target = this.addTarget(Attacking.instance(), "up to five target attacking creatures"); target.setNumber(1, 5); this.setDivision(Union.instance(numberGenerator(5), Identity.instance("damage"))); EventType.ParameterMap damageParameters = new EventType.ParameterMap(); damageParameters.put(EventType.Parameter.SOURCE, This.instance()); damageParameters.put( EventType.Parameter.TAKER, ChosenTargetsFor.instance(Identity.instance(target), This.instance())); this.addEffect( new EventFactory( EventType.DISTRIBUTE_DAMAGE, damageParameters, "Arrow Volley Trap deals 5 damage divided as you choose among any number of target attacking creatures.")); }
public InfernoTitanAbility1(GameState state) { super( state, "Whenever Inferno Titan enters the battlefield or attacks, it deals 3 damage divided as you choose among one, two, or three target creatures and/or players."); this.addPattern(whenThisEntersTheBattlefield()); this.addPattern(whenThisAttacks()); Target target = this.addTarget( CREATURES_AND_PLAYERS, "one, two, or three target creatures and/or players"); target.setNumber(1, 3); this.setDivision(Union.instance(numberGenerator(3), Identity.instance("damage"))); EventFactory damage = new EventFactory( EventType.DISTRIBUTE_DAMAGE, "It deals 3 damage divided as you choose among one, two, or three target creatures and/or players."); damage.parameters.put(EventType.Parameter.SOURCE, ABILITY_SOURCE_OF_THIS); damage.parameters.put( EventType.Parameter.TAKER, ChosenTargetsFor.instance(Identity.instance(target), This.instance())); this.addEffect(damage); }