public Pyroblast(GameState state) { super(state); { Target target = this.addTarget(1, Spells.instance(), "target spell"); EventFactory counter = new EventFactory(EventType.IF_CONDITION_THEN_ELSE, "Counter target spell if it's blue."); counter.parameters.put( EventType.Parameter.IF, Intersect.instance(targetedBy(target), HasColor.instance(Color.BLUE))); counter.parameters.put( EventType.Parameter.THEN, Identity.instance(counter(targetedBy(target), "Counter target spell."))); this.addEffect(1, counter); } { Target target = this.addTarget(2, Permanents.instance(), "target permanent"); EventFactory destroy = new EventFactory( EventType.IF_CONDITION_THEN_ELSE, "Destroy target permanent if it's blue."); destroy.parameters.put( EventType.Parameter.IF, Intersect.instance(targetedBy(target), HasColor.instance(Color.BLUE))); destroy.parameters.put( EventType.Parameter.THEN, Identity.instance(destroy(targetedBy(target), "Destroy target permanent."))); this.addEffect(2, destroy); } }
public IndestructibleChaos(GameState state) { super( state, "Whenever you roll (C), put a divinity counter on target green, white, or blue creature. That creature is indestructible as long as it has a divinity counter on it."); this.addPattern(Planechase.wheneverYouRollChaos()); Target target = this.addTarget( Intersect.instance( CreaturePermanents.instance(), HasColor.instance(Color.GREEN, Color.WHITE, Color.BLUE)), "target green, white, or blue creature"); this.addEffect( putCounters( 1, Counter.CounterType.DIVINITY, targetedBy(target), "Put a divinity counter on target green, white, or blue creature.")); this.addEffect( createFloatingEffect( CountersOn.instance(targetedBy(target), Counter.CounterType.DIVINITY), "That creature is indestructible as long as it has a divinity counter on it.", indestructible(targetedBy(target)))); this.canTrigger = Planechase.triggeredAbilityCanTrigger; }
public RuthlessRipper(GameState state) { super(state); this.setPower(1); this.setToughness(1); // Deathtouch this.addAbility(new org.rnd.jmagic.abilities.keywords.Deathtouch(state)); // Morph\u2014Reveal a black card in your hand. (You may cast this card // face down as a 2/2 creature for (3). Turn it face up any time for its // morph cost.) SetGenerator blueStuff = Intersect.instance( HasColor.instance(Color.BLACK), InZone.instance(HandOf.instance(You.instance()))); EventFactory reveal = new EventFactory(EventType.REVEAL_CHOICE, "Reveal a black card in your hand"); reveal.parameters.put(EventType.Parameter.CAUSE, This.instance()); reveal.parameters.put(EventType.Parameter.OBJECT, blueStuff); reveal.parameters.put(EventType.Parameter.PLAYER, You.instance()); CostCollection morphCost = new CostCollection(org.rnd.jmagic.abilities.keywords.Morph.COST_TYPE, reveal); this.addAbility( new org.rnd.jmagic.abilities.keywords.Morph( state, "Morph\u2014Reveal a black card in your hand.", morphCost)); // When Ruthless Ripper is turned face up, target player loses 2 life. this.addAbility(new RuthlessRipperAbility2(state)); }
public DoomBlade(GameState state) { super(state); // Destroy target nonblack creature. SetGenerator nonblackCreatures = RelativeComplement.instance(CreaturePermanents.instance(), HasColor.instance(Color.BLACK)); Target target = this.addTarget(nonblackCreatures, "target nonblack creature"); this.addEffect(destroy(targetedBy(target), "Destroy target nonblack creature.")); }
public BellowingTanglewurmAbility1(GameState state) { super(state, "Other green creatures you control have intimidate."); SetGenerator otherGreenCreaturesYouControl = RelativeComplement.instance( Intersect.instance(HasColor.instance(Color.GREEN), CREATURES_YOU_CONTROL), This.instance()); this.addEffectPart(addAbilityToObject(otherGreenCreaturesYouControl, Intimidate.class)); }
public ElephantGrassAbility1(GameState state) { super(state, "Black creatures can't attack you."); SetGenerator restriction = Intersect.instance(HasColor.instance(Color.BLACK), Attacking.instance(You.instance())); ContinuousEffect.Part part = new ContinuousEffect.Part(ContinuousEffectType.ATTACKING_RESTRICTION); part.parameters.put( ContinuousEffectType.Parameter.RESTRICTION, Identity.instance(restriction)); this.addEffectPart(part); }
public UntargetableByBU(GameState state) { super(state, "Karplusan Strider can't be the target of blue or black spells."); ContinuousEffect.Part part = new ContinuousEffect.Part(ContinuousEffectType.CANT_BE_THE_TARGET_OF); part.parameters.put(ContinuousEffectType.Parameter.OBJECT, This.instance()); SetGenerator blueOrBlackSpells = Intersect.instance(Spells.instance(), HasColor.instance(Color.BLUE, Color.BLACK)); part.parameters.put( ContinuousEffectType.Parameter.RESTRICTION, Identity.instance(new SimpleSetPattern(blueOrBlackSpells))); this.addEffectPart(part); }
public Execute(GameState state) { super( state, "(1)(B), (T), Sacrifice Executioner's Capsule: Destroy target nonblack creature."); this.setManaCost(new ManaPool("1B")); this.costsTap = true; this.addCost(sacrificeThis("Executioner's Capsule")); Target target = this.addTarget( RelativeComplement.instance( CreaturePermanents.instance(), HasColor.instance(Color.BLACK)), "target nonblack creature"); this.addEffect(destroy(targetedBy(target), "Destroy target nonblack creature.")); }
@Override public boolean perform(Game game, Event event, Map<Parameter, MagicSet> parameters) { MagicSet cause = parameters.get(Parameter.CAUSE); event.setResult(Empty.set); Set<Color> choices = parameters.get(Parameter.CHOICE).getAll(Color.class); Player player = parameters.get(Parameter.PLAYER).getOne(Player.class); PlayerInterface.ChooseParameters<Color> chooseParameters = new PlayerInterface.ChooseParameters<Color>( 1, 1, new LinkedList<Color>(choices), PlayerInterface.ChoiceType.COLOR, PlayerInterface.ChooseReason.CHOOSE_COLOR); chooseParameters.thisID = cause.getOne(GameObject.class).ID; List<Color> chosenList = player.choose(chooseParameters); if (chosenList.isEmpty()) return false; Color color = chosenList.get(0); Class<? extends Protection> ability = Protection.from(color); ContinuousEffect.Part part = new ContinuousEffect.Part(ContinuousEffectType.ADD_ABILITY_TO_OBJECT); part.parameters.put( ContinuousEffectType.Parameter.OBJECT, Intersect.instance( HasColor.instance(Color.WHITE), Intersect.instance( HasType.instance(Type.CREATURE), ControlledBy.instance(You.instance())))); part.parameters.put( ContinuousEffectType.Parameter.ABILITY, Identity.instance(new SimpleAbilityFactory(ability))); Map<Parameter, MagicSet> fceParameters = new HashMap<Parameter, MagicSet>(); fceParameters.put(Parameter.CAUSE, cause); fceParameters.put(Parameter.EFFECT, new MagicSet(part)); Event protection = createEvent( game, "White creatures you control gain protection from the chosen color until end of turn.", EventType.CREATE_FLOATING_CONTINUOUS_EFFECT, fceParameters); protection.perform(event, false); return true; }
public ElephantGrassAbility2(GameState state) { super( state, "Nonblack creatures can't attack you unless their controller pays (2) for each creature he or she controls that's attacking you."); SetGenerator nonblackCreatures = RelativeComplement.instance( CreaturePermanents.instance(), HasColor.instance(Color.BLACK)); ContinuousEffect.Part part = new ContinuousEffect.Part(ContinuousEffectType.ATTACKING_COST); part.parameters.put( ContinuousEffectType.Parameter.COST, Identity.fromCollection(new ManaPool("2"))); part.parameters.put( ContinuousEffectType.Parameter.OBJECT, Identity.instance(nonblackCreatures)); part.parameters.put(ContinuousEffectType.Parameter.PLAYER, You.instance()); this.addEffectPart(part); }
public Vendetta(GameState state) { super(state); // Destroy target nonblack creature. It can't be regenerated. SetGenerator target = targetedBy( this.addTarget( RelativeComplement.instance( CreaturePermanents.instance(), HasColor.instance(Color.BLACK)), "target nonblack creature")); this.addEffects( bury(this, target, "Destroy target nonblack creature. It can't be regenerated.")); // You lose life equal to that creature's toughness. this.addEffect( loseLife( You.instance(), ToughnessOf.instance(target), "You lose life equal to that creature's toughness.")); }
public ShrineofBoundlessGrowthAbility0(GameState state) { super( state, "At the beginning of your upkeep or whenever you cast a green spell, put a charge counter on Shrine of Boundless Growth."); this.addPattern(atTheBeginningOfYourUpkeep()); SimpleEventPattern castABlueSpell = new SimpleEventPattern(EventType.BECOMES_PLAYED); castABlueSpell.put(EventType.Parameter.PLAYER, You.instance()); castABlueSpell.put( EventType.Parameter.OBJECT, Intersect.instance(Spells.instance(), HasColor.instance(Color.GREEN))); this.addPattern(castABlueSpell); this.addEffect( putCounters( 1, Counter.CounterType.CHARGE, ABILITY_SOURCE_OF_THIS, "Put a charge counter on Shrine of Boundless Growth.")); }