Ejemplo n.º 1
0
 public ExileAGoblinOrShaman(GameState state) {
   super(
       state,
       "Goblin or Shaman",
       Union.instance(
           HasSubType.instance(SubType.GOBLIN), HasSubType.instance(SubType.SHAMAN)),
       ReturnAGoblinOrShaman.class);
 }
Ejemplo n.º 2
0
    public DearlyDepartedAbility1(GameState state) {
      super(
          state,
          "As long as Dearly Departed is in your graveyard, each Human creature you control enters the battlefield with an additional +1/+1 counter on it.");
      this.canApply = THIS_IS_IN_A_GRAVEYARD;

      SetGenerator humanCreatures =
          Intersect.instance(HasSubType.instance(SubType.HUMAN), HasType.instance(Type.CREATURE));

      ZoneChangeReplacementEffect replacement =
          new ZoneChangeReplacementEffect(this.game, this.getName());
      replacement.addPattern(
          new SimpleZoneChangePattern(
              null, Battlefield.instance(), humanCreatures, You.instance(), false));

      SetGenerator zoneChange = ReplacedBy.instance(Identity.instance(replacement));

      EventFactory factory = new EventFactory(EventType.PUT_COUNTERS, this.getName());
      factory.parameters.put(EventType.Parameter.CAUSE, CauseOf.instance(zoneChange));
      factory.parameters.put(
          EventType.Parameter.COUNTER, Identity.instance(Counter.CounterType.PLUS_ONE_PLUS_ONE));
      factory.parameters.put(EventType.Parameter.OBJECT, NewObjectOf.instance(zoneChange));
      replacement.addEffect(factory);

      this.addEffectPart(replacementEffectPart(replacement));
    }
Ejemplo n.º 3
0
    public GrantShroud(GameState state) {
      super(state, "Other Faeries you control have shroud.");

      SetGenerator faeries =
          Intersect.instance(HasSubType.instance(SubType.FAERIE), CREATURES_YOU_CONTROL);
      SetGenerator who = RelativeComplement.instance(faeries, This.instance());
      this.addEffectPart(addAbilityToObject(who, org.rnd.jmagic.abilities.keywords.Shroud.class));
    }
Ejemplo n.º 4
0
        @Override
        public boolean perform(Game game, Event event, Map<Parameter, MagicSet> parameters) {
          event.setResult(Empty.set);

          MagicSet cause = parameters.get(Parameter.CAUSE);
          Player you = parameters.get(Parameter.PLAYER).getOne(Player.class);
          Zone library = you.getLibrary(game.actualState);

          Map<Parameter, MagicSet> zombieParameters = new HashMap<Parameter, MagicSet>();
          zombieParameters.put(Parameter.CAUSE, cause);
          zombieParameters.put(Parameter.PLAYER, new MagicSet(you));
          zombieParameters.put(Parameter.NUMBER, ONE);
          zombieParameters.put(Parameter.CARD, new MagicSet(library));
          zombieParameters.put(Parameter.TYPE, new MagicSet(HasSubType.instance(SubType.ZOMBIE)));
          Event zombieSearch =
              createEvent(game, "Search your library for a Zombie card", SEARCH, zombieParameters);
          zombieSearch.perform(event, false);

          Map<Parameter, MagicSet> swampParameters =
              new HashMap<Parameter, MagicSet>(zombieParameters);
          swampParameters.put(Parameter.TYPE, new MagicSet(HasSubType.instance(SubType.SWAMP)));
          Event swampSearch =
              createEvent(game, "Search your library for a Swamp card", SEARCH, swampParameters);
          swampSearch.perform(event, false);

          MagicSet thoseCards = new MagicSet();
          thoseCards.addAll(zombieSearch.getResult());
          thoseCards.addAll(swampSearch.getResult());

          Map<Parameter, MagicSet> moveParameters = new HashMap<Parameter, MagicSet>();
          moveParameters.put(Parameter.CAUSE, cause);
          moveParameters.put(Parameter.TO, new MagicSet(you.getHand(game.actualState)));
          moveParameters.put(Parameter.OBJECT, thoseCards);
          Event move =
              createEvent(game, "Put those cards into your hand", MOVE_OBJECTS, moveParameters);
          move.perform(event, true);

          Map<Parameter, MagicSet> shuffleParameters = new HashMap<Parameter, MagicSet>();
          shuffleParameters.put(Parameter.CAUSE, cause);
          shuffleParameters.put(Parameter.PLAYER, new MagicSet(you));
          Event shuffle =
              createEvent(game, "Shuffle your library", SHUFFLE_LIBRARY, shuffleParameters);
          shuffle.perform(event, true);

          return true;
        }
Ejemplo n.º 5
0
    public EveryoneTapsForTwoGreen(GameState state) {
      super(state, "Elves you control have \"(T): Add (G)(G) to your mana pool.\"");

      SetGenerator elvesYouControl =
          Intersect.instance(
              HasSubType.instance(SubType.ELF), ControlledBy.instance(You.instance()));
      this.addEffectPart(addAbilityToObject(elvesYouControl, TapForTwoGreen.class));
    }
Ejemplo n.º 6
0
 public PrizedElephantAbility0(GameState state) {
   super(state, "Prized Elephant gets +1/+1 as long as you control a Forest.");
   this.addEffectPart(modifyPowerAndToughness(This.instance(), +1, +1));
   this.canApply =
       Both.instance(
           this.canApply,
           Intersect.instance(
               ControlledBy.instance(You.instance()), HasSubType.instance(SubType.FOREST)));
 }
Ejemplo n.º 7
0
 public MasterChief(GameState state) {
   super(state, "When Halo Hunter enters the battlefield, destroy target Angel.");
   this.addPattern(whenThisEntersTheBattlefield());
   Target target =
       this.addTarget(
           Intersect.instance(HasSubType.instance(SubType.ANGEL), Permanents.instance()),
           "target Angel");
   this.addEffect(destroy(targetedBy(target), "Destroy target Angel."));
 }
Ejemplo n.º 8
0
    public AngelofGlorysRiseAbility1(GameState state) {
      super(
          state,
          "When Angel of Glory's Rise enters the battlefield, exile all Zombies, then return all Human creature cards from your graveyard to the battlefield.");
      this.addPattern(whenThisEntersTheBattlefield());

      this.addEffect(
          exile(
              Intersect.instance(Permanents.instance(), HasSubType.instance(SubType.ZOMBIE)),
              "Exile all Zombies."));

      this.addEffect(
          putOntoBattlefield(
              Intersect.instance(
                  InZone.instance(GraveyardOf.instance(You.instance())),
                  HasSubType.instance(SubType.HUMAN),
                  HasType.instance(Type.CREATURE)),
              "Return all Human creature cards from your graveyard to the battlefield."));
    }
Ejemplo n.º 9
0
    public MasterofthePearlTridentAbility0(GameState state) {
      super(state, "Other Merfolk creatures you control get +1/+1 and have islandwalk.");

      SetGenerator fish =
          Intersect.instance(HasSubType.instance(SubType.MERFOLK), CREATURES_YOU_CONTROL);
      SetGenerator otherFish = RelativeComplement.instance(fish, This.instance());
      this.addEffectPart(modifyPowerAndToughness(otherFish, +1, +1));
      this.addEffectPart(
          addAbilityToObject(
              otherFish, org.rnd.jmagic.abilities.keywords.Landwalk.Islandwalk.class));
    }
Ejemplo n.º 10
0
 public ManaDenial(GameState state) {
   super(
       state,
       "When a Faerie is championed with Mistbind Clique, tap all lands target player controls.");
   this.addPattern(
       whenSomethingIsChampioned(ABILITY_SOURCE_OF_THIS, HasSubType.instance(SubType.FAERIE)));
   Target target = this.addTarget(Players.instance(), "target player");
   this.addEffect(
       tap(
           Intersect.instance(
               LandPermanents.instance(), ControlledBy.instance(targetedBy(target))),
           "Tap all lands target player controls."));
 }
Ejemplo n.º 11
0
  public VeteranSwordsmith(GameState state) {
    super(state);

    this.setPower(3);
    this.setToughness(2);

    SetGenerator soldiers =
        Intersect.instance(HasSubType.instance(SubType.SOLDIER), CREATURES_YOU_CONTROL);
    SetGenerator others = RelativeComplement.instance(soldiers, This.instance());
    this.addAbility(
        new org.rnd.jmagic.abilities.StaticPTChange(
            state, others, "Other Soldier creatures you control", +1, +0, true));
  }
Ejemplo n.º 12
0
    public KembasLegionAbility1(GameState state) {
      super(
          state,
          "Kemba's Legion can block an additional creature for each Equipment attached to Kemba's Legion.");

      ContinuousEffect.Part part =
          new ContinuousEffect.Part(ContinuousEffectType.CAN_BLOCK_AN_ADDITIONAL_CREATURE);
      part.parameters.put(ContinuousEffectType.Parameter.OBJECT, This.instance());
      part.parameters.put(
          ContinuousEffectType.Parameter.NUMBER,
          Count.instance(
              Intersect.instance(
                  HasSubType.instance(SubType.EQUIPMENT), AttachedTo.instance(This.instance()))));
      this.addEffectPart(part);
    }
Ejemplo n.º 13
0
    public OgreJailbreakerAbility1(GameState state) {
      super(
          state,
          "Ogre Jailbreaker can attack as though it didn't have defender as long as you control a Gate.");

      ContinuousEffect.Part part =
          new ContinuousEffect.Part(ContinuousEffectType.ATTACK_AS_THOUGH_DOESNT_HAVE_DEFENDER);
      part.parameters.put(ContinuousEffectType.Parameter.OBJECT, This.instance());
      this.addEffectPart(part);

      SetGenerator youControlAGate =
          Intersect.instance(
              ControlledBy.instance(You.instance()), HasSubType.instance(SubType.GATE));
      this.canApply = Intersect.instance(this.canApply, youControlAGate);
    }
Ejemplo n.º 14
0
  public Mutilate(GameState state) {
    super(state);

    // All creatures get -1/-1 until end of turn for each Swamp you control.
    SetGenerator count =
        Count.instance(
            Intersect.instance(
                ControlledBy.instance(You.instance()), HasSubType.instance(SubType.SWAMP)));
    SetGenerator amount = Subtract.instance(numberGenerator(0), count);
    this.addEffect(
        ptChangeUntilEndOfTurn(
            CreaturePermanents.instance(),
            amount,
            amount,
            "All creatures get -1/-1 until end of turn for each Swamp you control."));
  }
Ejemplo n.º 15
0
    public ZombiePT(GameState state) {
      super(
          state,
          "Soulless One's power and toughness are each equal to the number of Zombies on the battlefield plus the number of Zombie cards in all graveyards.",
          Characteristics.Characteristic.POWER,
          Characteristics.Characteristic.TOUGHNESS);

      SetGenerator aliveAndDead =
          InZone.instance(
              Union.instance(Battlefield.instance(), GraveyardOf.instance(Players.instance())));
      SetGenerator zombiesAndDeadZombies =
          Intersect.instance(HasSubType.instance(SubType.ZOMBIE), aliveAndDead);
      SetGenerator number = Count.instance(zombiesAndDeadZombies);

      this.addEffectPart(setPowerAndToughness(This.instance(), number, number));
    }
Ejemplo n.º 16
0
    public KrakenoftheStraitsAbility0(GameState state) {
      super(
          state,
          "Creatures with power less than the number of Islands you control can't block Kraken of the Straits.");

      SetGenerator yourIslands =
          Intersect.instance(
              ControlledBy.instance(You.instance()), HasSubType.instance(SubType.ISLAND));
      SetGenerator weak =
          HasPower.instance(Between.instance(numberGenerator(0), Count.instance(yourIslands)));
      SetGenerator restriction = Intersect.instance(weak, Blocking.instance(This.instance()));

      ContinuousEffect.Part part =
          new ContinuousEffect.Part(ContinuousEffectType.BLOCKING_RESTRICTION);
      part.parameters.put(
          ContinuousEffectType.Parameter.RESTRICTION, Identity.instance(restriction));
      this.addEffectPart(part);
    }
Ejemplo n.º 17
0
    public UnholyGrottoAbility1(GameState state) {
      super(state, "(B), (T): Put target Zombie card from your graveyard on top of your library.");
      this.setManaCost(new ManaPool("(B)"));
      this.costsTap = true;

      Target target =
          this.addTarget(
              Intersect.instance(
                  HasSubType.instance(SubType.ZOMBIE),
                  InZone.instance(GraveyardOf.instance(You.instance()))),
              "target Zombie card from your graveyard");

      EventFactory move =
          new EventFactory(
              EventType.PUT_INTO_LIBRARY,
              "Put target Zombie card from your graveyard on top of your library.");
      move.parameters.put(EventType.Parameter.CAUSE, This.instance());
      move.parameters.put(EventType.Parameter.INDEX, numberGenerator(1));
      move.parameters.put(EventType.Parameter.OBJECT, targetedBy(target));
      this.addEffect(move);
    }
Ejemplo n.º 18
0
  public ScionofOona(GameState state) {
    super(state);

    this.setPower(1);
    this.setToughness(1);

    // Flash
    this.addAbility(new org.rnd.jmagic.abilities.keywords.Flash(state));

    // Flying
    this.addAbility(new org.rnd.jmagic.abilities.keywords.Flying(state));

    // Other Faerie creatures you control get +1/+1.
    SetGenerator faeries =
        Intersect.instance(HasSubType.instance(SubType.FAERIE), CREATURES_YOU_CONTROL);
    SetGenerator who = RelativeComplement.instance(faeries, This.instance());
    this.addAbility(
        new org.rnd.jmagic.abilities.StaticPTChange(
            state, who, "Other Faerie creatures you control", +1, +1, true));

    // Other Faeries you control have shroud.
    this.addAbility(new GrantShroud(state));
  }
Ejemplo n.º 19
0
    public SylvanPrimordialAbility1(GameState state) {
      super(
          state,
          "When Sylvan Primordial enters the battlefield, for each opponent, destroy target noncreature permanent that player controls. For each permanent destroyed this way, search your library for a Forest card and put that card onto the battlefield tapped. Then shuffle your library.");
      this.addPattern(whenThisEntersTheBattlefield());

      SetGenerator noncreaturePermanents =
          RelativeComplement.instance(Permanents.instance(), HasType.instance(Type.CREATURE));
      SetGenerator legalTargets =
          Intersect.instance(
              noncreaturePermanents, ControlledBy.instance(OpponentsOf.instance(You.instance())));
      Target t =
          new SylvanTarget(legalTargets, "target noncreature permanent each oppenent controls");
      this.addTarget(t);

      EventFactory destroy =
          destroy(
              targetedBy(t),
              "For each opponent, destroy target noncreature permanent that player controls.");
      this.addEffect(destroy);

      SetGenerator X = Count.instance(NewObjectOf.instance(EffectResult.instance(destroy)));

      EventFactory search =
          new EventFactory(
              EventType.SEARCH_LIBRARY_AND_PUT_INTO,
              "For each permanent destroyed this way, search your library for a Forest card and put that card onto the battlefield tapped. Then shuffle your library.");
      search.parameters.put(EventType.Parameter.CAUSE, This.instance());
      search.parameters.put(EventType.Parameter.CONTROLLER, You.instance());
      search.parameters.put(EventType.Parameter.PLAYER, You.instance());
      search.parameters.put(EventType.Parameter.NUMBER, X);
      search.parameters.put(EventType.Parameter.TAPPED, Empty.instance());
      search.parameters.put(EventType.Parameter.TO, Battlefield.instance());
      search.parameters.put(
          EventType.Parameter.TYPE, Identity.instance(HasSubType.instance(SubType.FOREST)));
      this.addEffect(search);
    }
Ejemplo n.º 20
0
 public Exile(GameState state) {
   super(state, "Faerie", HasSubType.instance(SubType.FAERIE), Return.class);
 }