mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
Added Dust Elemental. Modified "bounce a permanent" effect so it doesn't fizzle if too few targets are selected-- this bug only affected Dust Elemental and Stormfront Riders to my knowledge.
This commit is contained in:
parent
f8532ab587
commit
58b0903dc4
3 changed files with 96 additions and 3 deletions
80
Mage.Sets/src/mage/sets/planarchaos/DustElemental.java
Normal file
80
Mage.Sets/src/mage/sets/planarchaos/DustElemental.java
Normal file
|
@ -0,0 +1,80 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package mage.sets.planarchaos;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.effects.common.ReturnToHandChosenControlledPermanentEffect;
|
||||
import mage.abilities.keyword.FlashAbility;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.abilities.keyword.FearAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetControlledPermanent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Zeplar1_at_googlemail.com
|
||||
*/
|
||||
public class DustElemental extends CardImpl {
|
||||
|
||||
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent(" creatures you control");
|
||||
|
||||
public DustElemental(UUID ownerId) {
|
||||
super(ownerId, 5, "Dust Elemental", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{2}{W}{W}");
|
||||
this.expansionSetCode = "PLC";
|
||||
this.subtype.add("Elemental");
|
||||
this.power = new MageInt(6);
|
||||
this.toughness = new MageInt(6);
|
||||
|
||||
// Flash
|
||||
this.addAbility(FlashAbility.getInstance());
|
||||
// Flying; fear
|
||||
this.addAbility(FlyingAbility.getInstance());
|
||||
this.addAbility(FearAbility.getInstance());
|
||||
// When Dust Elemental enters the battlefield, return three creatures you control to their owner's hand.
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new ReturnToHandChosenControlledPermanentEffect(filter,1,3)));
|
||||
}
|
||||
|
||||
public DustElemental(final DustElemental card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DustElemental copy() {
|
||||
return new DustElemental(this);
|
||||
}
|
||||
}
|
|
@ -39,7 +39,7 @@ import mage.constants.CardType;
|
|||
import mage.constants.Rarity;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterControlledPermanent;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.other.OwnerPredicate;
|
||||
import mage.game.permanent.token.SoldierToken;
|
||||
|
@ -68,7 +68,7 @@ public class StormfrontRiders extends CardImpl {
|
|||
// Flying
|
||||
this.addAbility(FlyingAbility.getInstance());
|
||||
// When Stormfront Riders enters the battlefield, return two creatures you control to their owner's hand.
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new ReturnToHandChosenControlledPermanentEffect(new FilterControlledPermanent("creatures you control"), 2)));
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new ReturnToHandChosenControlledPermanentEffect(new FilterControlledCreaturePermanent("creatures you control"),1,2)));
|
||||
// Whenever Stormfront Riders or another creature is returned to your hand from the battlefield, put a 1/1 white Soldier creature token onto the battlefield.
|
||||
this.addAbility(new ZoneChangeAllTriggeredAbility(Zone.BATTLEFIELD, Zone.BATTLEFIELD, Zone.HAND, new CreateTokenEffect(new SoldierToken()),
|
||||
filter,"Whenever {this} or another creature is returned to your hand from the battlefield, ", false));
|
||||
|
|
|
@ -47,6 +47,7 @@ public class ReturnToHandChosenControlledPermanentEffect extends OneShotEffect {
|
|||
|
||||
private final FilterControlledPermanent filter;
|
||||
private int number;
|
||||
private int minNumber;
|
||||
|
||||
public ReturnToHandChosenControlledPermanentEffect(FilterControlledPermanent filter) {
|
||||
this(filter, 1);
|
||||
|
@ -55,6 +56,15 @@ public class ReturnToHandChosenControlledPermanentEffect extends OneShotEffect {
|
|||
super(Outcome.ReturnToHand);
|
||||
this.filter = filter;
|
||||
this.number = number;
|
||||
this.minNumber = number;
|
||||
this.staticText = getText();
|
||||
}
|
||||
|
||||
public ReturnToHandChosenControlledPermanentEffect(FilterControlledPermanent filter, int minNumber, int maxNumber) {
|
||||
super(Outcome.ReturnToHand);
|
||||
this.filter = filter;
|
||||
this.number = maxNumber;
|
||||
this.minNumber = minNumber;
|
||||
this.staticText = getText();
|
||||
}
|
||||
|
||||
|
@ -62,7 +72,10 @@ public class ReturnToHandChosenControlledPermanentEffect extends OneShotEffect {
|
|||
super(effect);
|
||||
this.filter = effect.filter;
|
||||
this.number = effect.number;
|
||||
this.minNumber = this.minNumber;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public ReturnToHandChosenControlledPermanentEffect copy() {
|
||||
|
@ -73,7 +86,7 @@ public class ReturnToHandChosenControlledPermanentEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
TargetControlledPermanent target = new TargetControlledPermanent(number, number, filter, true);
|
||||
TargetControlledPermanent target = new TargetControlledPermanent(minNumber, number, filter, true);
|
||||
if (player.choose(this.outcome, target, source.getSourceId(), game)) {
|
||||
for (UUID targetCreatureId : target.getTargets()) {
|
||||
Permanent permanent = game.getPermanent(targetCreatureId);
|
||||
|
|
Loading…
Reference in a new issue