public ScreechingSilcawAbility1(GameState state) {
   super(
       state,
       "Whenever Screeching Silcaw deals combat damage to a player, if you control three or more artifacts, that player puts the top four cards of his or her library into his or her graveyard.");
   this.addPattern(whenDealsCombatDamageToAPlayer(ABILITY_SOURCE_OF_THIS));
   this.interveningIf = Metalcraft.instance();
   this.addEffect(
       millCards(
           TakerOfDamage.instance(TriggerDamage.instance(This.instance())),
           4,
           "That player puts the top four cards of his or her library into his or her graveyard."));
 }
Exemple #2
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;
  }