- Added the 'Amplify' keyword

Also added Kilnmouth Dragon which uses the keyword.
This commit is contained in:
FenrisulfrX 2015-04-03 01:44:47 -03:00
parent 7e361b4de1
commit f75c78cc7c
5 changed files with 384 additions and 0 deletions

View file

@ -0,0 +1,52 @@
/*
* 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.archenemy;
import java.util.UUID;
/**
*
* @author FenrisulfrX
*/
public class KilnmouthDragon extends mage.sets.knightsvsdragons.KilnmouthDragon {
public KilnmouthDragon(UUID ownerId) {
super(ownerId);
this.cardNumber = 44;
this.expansionSetCode = "ARC";
}
public KilnmouthDragon(final KilnmouthDragon card) {
super(card);
}
@Override
public KilnmouthDragon copy() {
return new KilnmouthDragon(this);
}
}

View file

@ -0,0 +1,81 @@
/*
* 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.knightsvsdragons;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.dynamicvalue.common.CountersCount;
import mage.abilities.effects.common.AmplifyEffect;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.keyword.AmplifyAbility;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.target.common.TargetCreatureOrPlayer;
/**
*
* @author FenrisulfrX
*/
public class KilnmouthDragon extends CardImpl {
public KilnmouthDragon(UUID ownerId) {
super(ownerId, 59, "Kilnmouth Dragon", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{5}{R}{R}");
this.expansionSetCode = "DDG";
this.subtype.add("Dragon");
this.power = new MageInt(5);
this.toughness = new MageInt(5);
// Amplify 3
this.addAbility(new AmplifyAbility(AmplifyEffect.AmplifyFactor.Amplify3));
// Flying
this.addAbility(FlyingAbility.getInstance());
// {tap}: Kilnmouth Dragon deals damage equal to the number of +1/+1 counters on it to target creature or player.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
new DamageTargetEffect(new CountersCount(CounterType.P1P1)), new TapSourceCost());
ability.addTarget(new TargetCreatureOrPlayer());
this.addAbility(ability);
}
public KilnmouthDragon(final KilnmouthDragon card) {
super(card);
}
@Override
public KilnmouthDragon copy() {
return new KilnmouthDragon(this);
}
}

View file

@ -0,0 +1,52 @@
/*
* 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.legions;
import java.util.UUID;
/**
*
* @author FenrisulfrX
*/
public class KilnmouthDragon extends mage.sets.knightsvsdragons.KilnmouthDragon {
public KilnmouthDragon(UUID ownerId) {
super(ownerId);
this.cardNumber = 104;
this.expansionSetCode = "LGN";
}
public KilnmouthDragon(final KilnmouthDragon card) {
super(card);
}
@Override
public KilnmouthDragon copy() {
return new KilnmouthDragon(this);
}
}

View file

@ -0,0 +1,145 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package mage.abilities.effects.common;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.counters.CounterType;
import mage.filter.common.FilterCreatureCard;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCardInHand;
/**
* Effect for the AmplifyAbility
*
* 702.37. Amplify
* 702.37a Amplify is a static ability. Amplify N means As
* this object enters the battlefield, reveal any number of cards from your hand
* that share a creature type with it. This permanent enters the battlefield
* with N +1/+1 counters on it for each card revealed this way. You cant reveal
* this card or any other cards that are entering the battlefield at the same
* time as this card.
* 702.37b If a creature has multiple instances of amplify,
* each one works separately.
*
*
* @author FenrisulfrX
*/
public class AmplifyEffect extends ReplacementEffectImpl {
private static final FilterCreatureCard filter = new FilterCreatureCard("creatures cards to reveal");
private final AmplifyFactor amplifyFactor;
public enum AmplifyFactor {
Amplify1("Amplify 1", "put one +1/+1 counters on it", 1),
Amplify2("Amplify 2", "put two +1/+1 counters on it", 2),
Amplify3("Amplify 3", "put three +1/+1 counters on it", 3);
private final String text;
private final String ruleText;
private final int factor;
AmplifyFactor(String text, String ruleText, int factor) {
this.text = text;
this.ruleText = ruleText;
this.factor = factor;
}
@Override
public String toString() {
return text;
}
public String getRuleText() {
return ruleText;
}
public int getFactor() {
return factor;
}
}
public AmplifyEffect(AmplifyFactor amplifyFactor) {
super(Duration.EndOfGame, Outcome.Benefit);
this.amplifyFactor = amplifyFactor;
}
public AmplifyEffect(final AmplifyEffect effect) {
super(effect);
this.amplifyFactor = effect.amplifyFactor;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getTargetId().equals(source.getSourceId())) {
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
game.getState().setValue(sourcePermanent.getId().toString() + "revealed", null);
return true;
}
return false;
}
@Override
public boolean apply(Game game, Ability source) {
return false;
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent creature = game.getPermanent(event.getTargetId());
Player controller = game.getPlayer(creature.getControllerId());
if (controller != null) {
for (String subtype : creature.getSubtype()) {
filter.add(new SubtypePredicate((subtype)));
}
if (controller.getHand().count(filter, source.getSourceId(), source.getControllerId(), game) > 0){
if (controller.chooseUse(Outcome.Benefit, "Reveal cards?", game)) {
TargetCardInHand target = new TargetCardInHand(0, Integer.MAX_VALUE, filter);
if (controller.choose(Outcome.Benefit, target, source.getSourceId(), game)) {
Cards cards = new CardsImpl();
for (UUID uuid : target.getTargets()) {
cards.add(controller.getHand().get(uuid, game));
}
int amountCounters = cards.size() * amplifyFactor.getFactor();
creature.addCounters(CounterType.P1P1.createInstance(amountCounters), game);
controller.revealCards("cards", cards, game);
}
}
}
}
return false;
}
@Override
public String getText(Mode mode) {
StringBuilder sb = new StringBuilder(amplifyFactor.toString());
sb.append("<i>(As this enter the battlefield, ");
sb.append(amplifyFactor.getRuleText()).append(" for each card" +
" you reveal that shares a type with it in your hand.)</i>");
return sb.toString();
}
@Override
public AmplifyEffect copy() {
return new AmplifyEffect(this);
}
}

View file

@ -0,0 +1,54 @@
/*
* Copyright 2011 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.abilities.keyword;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.AmplifyEffect;
import mage.abilities.effects.common.AmplifyEffect.AmplifyFactor;
import mage.constants.Zone;
/**
*
* @author FenrisulfrX
*/
public class AmplifyAbility extends SimpleStaticAbility {
public AmplifyAbility(AmplifyFactor amplifyFactor) {
super(Zone.BATTLEFIELD, new AmplifyEffect(amplifyFactor));
}
public AmplifyAbility(final AmplifyAbility ability) {
super(ability);
}
@Override
public AmplifyAbility copy() {
return new AmplifyAbility(this);
}
}