Exemplo n.º 1
0
    public MysticRemoraAbility1(GameState state) {
      super(
          state,
          "Whenever an opponent casts a noncreature spell, you may draw a card unless that player pays (4).");

      SimpleEventPattern pattern = new SimpleEventPattern(EventType.BECOMES_PLAYED);
      pattern.put(EventType.Parameter.PLAYER, OpponentsOf.instance(You.instance()));
      pattern.put(
          EventType.Parameter.OBJECT,
          RelativeComplement.instance(Spells.instance(), HasType.instance(Type.CREATURE)));
      this.addPattern(pattern);

      SetGenerator thatPlayer =
          EventParameter.instance(
              TriggerEvent.instance(This.instance()), EventType.Parameter.PLAYER);

      EventFactory mayDraw =
          youMay(drawCards(You.instance(), 1, "Draw a card"), "You may draw a card");

      EventFactory pay = new EventFactory(EventType.PAY_MANA, "Pay (4)");
      pay.parameters.put(EventType.Parameter.CAUSE, This.instance());
      pay.parameters.put(EventType.Parameter.PLAYER, thatPlayer);
      pay.parameters.put(EventType.Parameter.MANA, Identity.instance(new ManaPool("4")));
      this.addEffect(
          unless(thatPlayer, mayDraw, pay, "You may draw a card unless that player pays (4)."));
    }
Exemplo n.º 2
0
    public PsychosisCrawlerAbility1(GameState state) {
      super(state, "Whenever you draw a card, each opponent loses 1 life.");

      SimpleEventPattern pattern = new SimpleEventPattern(EventType.DRAW_ONE_CARD);
      pattern.put(EventType.Parameter.PLAYER, You.instance());
      this.addPattern(pattern);

      this.addEffect(
          loseLife(OpponentsOf.instance(You.instance()), 1, "Each opponent loses 1 life."));
    }
Exemplo n.º 3
0
    public FathomMageAbility1(GameState state) {
      super(state, "Whenever a +1/+1 counter is placed on Fathom Mage, you may draw a card.");

      SimpleEventPattern pattern = new SimpleEventPattern(EventType.PUT_ONE_COUNTER);
      pattern.put(EventType.Parameter.OBJECT, ABILITY_SOURCE_OF_THIS);
      pattern.put(
          EventType.Parameter.COUNTER, Identity.instance(Counter.CounterType.PLUS_ONE_PLUS_ONE));
      this.addPattern(pattern);

      this.addEffect(youMay(drawACard()));
    }
Exemplo n.º 4
0
    public LunarMysticAbility0(GameState state) {
      super(state, "Whenever you cast an instant spell, you may pay (1). If you do, draw a card.");

      SimpleEventPattern whenYouCastASpell = new SimpleEventPattern(EventType.BECOMES_PLAYED);
      whenYouCastASpell.put(EventType.Parameter.PLAYER, You.instance());
      whenYouCastASpell.put(EventType.Parameter.OBJECT, HasType.instance(Type.INSTANT));
      this.addPattern(whenYouCastASpell);

      this.addEffect(
          ifThen(youMayPay("(1)"), drawACard(), "You may pay (1). If you do, draw a card."));
    }
Exemplo n.º 5
0
    public SlateStreetRuffianAbility0(GameState state) {
      super(
          state,
          "Whenever Slate Street Ruffian becomes blocked, defending player discards a card.");

      SimpleEventPattern pattern = new SimpleEventPattern(EventType.DECLARE_ONE_BLOCKER);
      pattern.put(EventType.Parameter.ATTACKER, ABILITY_SOURCE_OF_THIS);
      this.addPattern(pattern);

      this.addEffect(
          discardCards(
              DefendingPlayer.instance(ABILITY_SOURCE_OF_THIS),
              1,
              "Defending player discards a card."));
    }
Exemplo n.º 6
0
    public Glass(GameState state) {
      super(
          state,
          "Whenever this creature becomes the target of a spell or ability for the first time in a turn, counter that spell or ability.");

      SimpleEventPattern pattern = new SimpleEventPattern(EventType.BECOMES_TARGET);
      pattern.put(
          EventType.Parameter.TARGET,
          RelativeComplement.instance(ABILITY_SOURCE_OF_THIS, TargetedThisTurn.instance()));
      state.ensureTracker(new TargetedThisTurn.Tracker());

      SetGenerator thatSpell =
          EventParameter.instance(
              TriggerEvent.instance(This.instance()), EventType.Parameter.OBJECT);
      this.addEffect(counter(thatSpell, "Counter that spell or ability."));
    }
Exemplo n.º 7
0
    public Vampiricism(GameState state) {
      super(state, "Whenever you gain life, target opponent loses that much life.");

      SimpleEventPattern pattern = new SimpleEventPattern(EventType.GAIN_LIFE);
      pattern.put(EventType.Parameter.PLAYER, You.instance());
      this.addPattern(pattern);

      Target target = this.addTarget(OpponentsOf.instance(You.instance()), "target opponent");

      this.addEffect(
          loseLife(
              targetedBy(target),
              EventParameter.instance(
                  TriggerEvent.instance(This.instance()), EventType.Parameter.NUMBER),
              "Target opponent loses that much life."));
    }
Exemplo n.º 8
0
    public SigardaHostofHeronsAbility1(GameState state) {
      super(
          state,
          "Spells and abilities your opponents control can't cause you to sacrifice permanents.");

      SimpleEventPattern youSacrificePermanents =
          new SimpleEventPattern(EventType.SACRIFICE_ONE_PERMANENT);
      youSacrificePermanents.put(
          EventType.Parameter.CAUSE,
          ControlledBy.instance(OpponentsOf.instance(You.instance()), Stack.instance()));
      youSacrificePermanents.put(EventType.Parameter.PERMANENT, Permanents.instance());
      youSacrificePermanents.put(EventType.Parameter.PLAYER, You.instance());

      ContinuousEffect.Part part = new ContinuousEffect.Part(ContinuousEffectType.PROHIBIT);
      part.parameters.put(
          ContinuousEffectType.Parameter.PROHIBITION, Identity.instance(youSacrificePermanents));
      this.addEffectPart(part);
    }
Exemplo n.º 9
0
    public GolemFoundryAbility0(GameState state) {
      super(
          state,
          "Whenever you cast an artifact spell, you may put a charge counter on Golem Foundry.");

      SimpleEventPattern pattern = new SimpleEventPattern(EventType.BECOMES_PLAYED);
      pattern.put(EventType.Parameter.PLAYER, You.instance());
      pattern.withResult(HasType.instance(Type.ARTIFACT));
      this.addPattern(pattern);

      this.addEffect(
          youMay(
              putCounters(
                  1,
                  Counter.CounterType.CHARGE,
                  ABILITY_SOURCE_OF_THIS,
                  "Put a charge counter on Golem Foundry."),
              "You may put a charge counter on Golem Foundry."));
    }
Exemplo n.º 10
0
    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."));
    }
Exemplo n.º 11
0
    public Blind(GameState state) {
      super(
          state,
          "Whenever Blinding Angel deals combat damage to a player, that player skips his or her next combat phase.");

      this.addPattern(whenDealsCombatDamageToAPlayer(ABILITY_SOURCE_OF_THIS));

      SetGenerator thatPlayer = TakerOfDamage.instance(TriggerDamage.instance(This.instance()));
      SetGenerator combat = CombatPhaseOf.instance(thatPlayer);

      SimpleEventPattern nextCombatPhase = new SimpleEventPattern(EventType.BEGIN_PHASE);
      nextCombatPhase.put(EventType.Parameter.PHASE, combat);

      EventReplacementEffect skip =
          new EventReplacementEffect(
              state.game, "That player skips his or her next combat phase", nextCombatPhase);
      // skip.addEffect(nothing)

      this.addEffect(
          createFloatingReplacement(skip, "That player skips his or her next combat phase."));
    }
  @Override
  public boolean perform(Game game, Event event, Map<Parameter, MagicSet> parameters) {
    Event damageEvent =
        createEvent(game, event.getName(), EventType.DEAL_DAMAGE_EVENLY, parameters);
    boolean ret = damageEvent.perform(event, false);

    SetPattern affectedCreatures =
        new SimpleSetPattern(
            Intersect.instance(
                TakerOfDamage.instance(EventDamage.instance(Identity.instance(event))),
                CreaturePermanents.instance()));

    SimpleEventPattern regenerate = new SimpleEventPattern(EventType.REGENERATE);
    regenerate.put(EventType.Parameter.OBJECT, affectedCreatures);

    EventReplacementEffectStopper stopRegen =
        new EventReplacementEffectStopper(
            parameters.get(Parameter.SOURCE).getOne(GameObject.class), null, regenerate);
    ContinuousEffect.Part part =
        new ContinuousEffect.Part(ContinuousEffectType.STOP_REPLACEMENT_EFFECT);
    part.parameters.put(ContinuousEffectType.Parameter.PROHIBITION, Identity.instance(stopRegen));

    Map<EventType.Parameter, MagicSet> stopRegenParameters =
        new HashMap<EventType.Parameter, MagicSet>();
    stopRegenParameters.put(EventType.Parameter.CAUSE, parameters.get(Parameter.SOURCE));
    stopRegenParameters.put(EventType.Parameter.EFFECT, new MagicSet(part));
    Event regenStopper =
        createEvent(
            game,
            "A creature dealt damage this way can't be regenerated this turn.",
            EventType.CREATE_FLOATING_CONTINUOUS_EFFECT,
            stopRegenParameters);
    ret = regenStopper.perform(event, false) && ret;

    event.setResult(Empty.set);

    return ret;
  }