mirror of
https://github.com/correl/mage.git
synced 2024-11-15 11:09:30 +00:00
Animate Artifact please test this
This commit is contained in:
parent
cc1f4b563d
commit
0f90531b33
8 changed files with 129 additions and 3 deletions
120
Mage.Sets/src/mage/cards/a/AnimateArtifact.java
Normal file
120
Mage.Sets/src/mage/cards/a/AnimateArtifact.java
Normal file
|
@ -0,0 +1,120 @@
|
|||
/*
|
||||
* 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.cards.a;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.condition.common.EquippedMatchesFilterCondition;
|
||||
import mage.abilities.decorator.ConditionalContinuousEffect;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.abilities.effects.common.continuous.BecomesCreatureAttachedEffect;
|
||||
import mage.abilities.keyword.EnchantAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterArtifactPermanent;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.token.Token;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetArtifactPermanent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author MTGfan
|
||||
*/
|
||||
public class AnimateArtifact extends CardImpl {
|
||||
|
||||
private static final FilterPermanent filter = new FilterArtifactPermanent("noncreature artifact");
|
||||
|
||||
static {
|
||||
filter.add(Predicates.not(new CardTypePredicate(CardType.CREATURE)));
|
||||
}
|
||||
|
||||
public AnimateArtifact(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{U}");
|
||||
|
||||
this.subtype.add("Aura");
|
||||
|
||||
// Enchant artifact
|
||||
TargetPermanent auraTarget = new TargetArtifactPermanent();
|
||||
this.getSpellAbility().addTarget(auraTarget);
|
||||
this.getSpellAbility().addEffect(new AttachEffect(Outcome.Benefit));
|
||||
Ability ability = new EnchantAbility(auraTarget.getTargetName());
|
||||
this.addAbility(ability);
|
||||
|
||||
// As long as enchanted artifact isn't a creature, it's an artifact creature with power and toughness each equal to its converted mana cost.
|
||||
ConvertedManaCost cost = new ConvertedManaCost();
|
||||
int amount = cost.getConvertedManaCost();
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(new BecomesCreatureAttachedEffect(new AnimateArtifactToken(amount, amount), "it's an artifact creature with power and toughness each equal to its converted mana cost.", Duration.WhileOnBattlefield), new EquippedMatchesFilterCondition(filter), "As long as enchanted artifact isn't a creature")));
|
||||
}
|
||||
|
||||
public AnimateArtifact(final AnimateArtifact card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AnimateArtifact copy() {
|
||||
return new AnimateArtifact(this);
|
||||
}
|
||||
}
|
||||
|
||||
class AnimateArtifactToken extends Token {
|
||||
|
||||
AnimateArtifactToken(int power, int toughness) {
|
||||
super("", "");
|
||||
cardType.add(CardType.CREATURE);
|
||||
this.power = new MageInt(power);
|
||||
this.toughness = new MageInt(toughness);
|
||||
}
|
||||
}
|
||||
|
||||
class ConvertedManaCost {//need to figure out how this can be used to return CMC to variable amount in animate artifact token
|
||||
|
||||
int cmc;
|
||||
|
||||
int calculate(Game game, Ability source, Effect effect) {
|
||||
Permanent enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
||||
Permanent enchanted = game.getPermanentOrLKIBattlefield(enchantment.getAttachedTo());
|
||||
cmc = enchanted.getConvertedManaCost();
|
||||
return cmc;
|
||||
}
|
||||
|
||||
int getConvertedManaCost () {
|
||||
return cmc;
|
||||
}
|
||||
}
|
|
@ -62,6 +62,7 @@ public class FourthEdition extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Amrou Kithkin", 252, Rarity.COMMON, mage.cards.a.AmrouKithkin.class));
|
||||
cards.add(new SetCardInfo("Amulet of Kroog", 311, Rarity.COMMON, mage.cards.a.AmuletOfKroog.class));
|
||||
cards.add(new SetCardInfo("Angry Mob", 253, Rarity.UNCOMMON, mage.cards.a.AngryMob.class));
|
||||
cards.add(new SetCardInfo("Animate Artifact", 60, Rarity.UNCOMMON, mage.cards.a.AnimateArtifact.class));
|
||||
cards.add(new SetCardInfo("Animate Dead", 2, Rarity.UNCOMMON, mage.cards.a.AnimateDead.class));
|
||||
cards.add(new SetCardInfo("Animate Wall", 254, Rarity.RARE, mage.cards.a.AnimateWall.class));
|
||||
cards.add(new SetCardInfo("Ankh of Mishra", 312, Rarity.RARE, mage.cards.a.AnkhOfMishra.class));
|
||||
|
|
|
@ -27,6 +27,7 @@ public class LimitedEditionAlpha extends ExpansionSet {
|
|||
this.ratioBoosterMythic = 0;
|
||||
cards.add(new SetCardInfo("Air Elemental", 47, Rarity.UNCOMMON, mage.cards.a.AirElemental.class));
|
||||
cards.add(new SetCardInfo("Ancestral Recall", 48, Rarity.RARE, mage.cards.a.AncestralRecall.class));
|
||||
cards.add(new SetCardInfo("Animate Artifact", 49, Rarity.UNCOMMON, mage.cards.a.AnimateArtifact.class));
|
||||
cards.add(new SetCardInfo("Animate Dead", 1, Rarity.UNCOMMON, mage.cards.a.AnimateDead.class));
|
||||
cards.add(new SetCardInfo("Animate Wall", 185, Rarity.RARE, mage.cards.a.AnimateWall.class));
|
||||
cards.add(new SetCardInfo("Ankh of Mishra", 230, Rarity.RARE, mage.cards.a.AnkhOfMishra.class));
|
||||
|
|
|
@ -27,6 +27,7 @@ public class LimitedEditionBeta extends ExpansionSet {
|
|||
this.ratioBoosterMythic = 0;
|
||||
cards.add(new SetCardInfo("Air Elemental", 47, Rarity.UNCOMMON, mage.cards.a.AirElemental.class));
|
||||
cards.add(new SetCardInfo("Ancestral Recall", 48, Rarity.RARE, mage.cards.a.AncestralRecall.class));
|
||||
cards.add(new SetCardInfo("Animate Artifact", 49, Rarity.UNCOMMON, mage.cards.a.AnimateArtifact.class));
|
||||
cards.add(new SetCardInfo("Animate Dead", 1, Rarity.UNCOMMON, mage.cards.a.AnimateDead.class));
|
||||
cards.add(new SetCardInfo("Animate Wall", 186, Rarity.RARE, mage.cards.a.AnimateWall.class));
|
||||
cards.add(new SetCardInfo("Ankh of Mishra", 232, Rarity.RARE, mage.cards.a.AnkhOfMishra.class));
|
||||
|
|
|
@ -65,6 +65,7 @@ public class MastersEditionIV extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Ali from Cairo", 107, Rarity.RARE, mage.cards.a.AliFromCairo.class));
|
||||
cards.add(new SetCardInfo("Alluring Scent", 141, Rarity.COMMON, mage.cards.a.AlluringScent.class));
|
||||
cards.add(new SetCardInfo("Amulet of Kroog", 179, Rarity.COMMON, mage.cards.a.AmuletOfKroog.class));
|
||||
cards.add(new SetCardInfo("Animate Artifact", 38, Rarity.UNCOMMON, mage.cards.a.AnimateArtifact.class));
|
||||
cards.add(new SetCardInfo("Argivian Blacksmith", 4, Rarity.UNCOMMON, mage.cards.a.ArgivianBlacksmith.class));
|
||||
cards.add(new SetCardInfo("Argothian Pixies", 142, Rarity.COMMON, mage.cards.a.ArgothianPixies.class));
|
||||
cards.add(new SetCardInfo("Argothian Treefolk", 143, Rarity.UNCOMMON, mage.cards.a.ArgothianTreefolk.class));
|
||||
|
|
|
@ -28,6 +28,7 @@ public class RevisedEdition extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Air Elemental", 47, Rarity.UNCOMMON, mage.cards.a.AirElemental.class));
|
||||
cards.add(new SetCardInfo("Aladdin's Lamp", 231, Rarity.RARE, mage.cards.a.AladdinsLamp.class));
|
||||
cards.add(new SetCardInfo("Aladdin's Ring", 232, Rarity.RARE, mage.cards.a.AladdinsRing.class));
|
||||
cards.add(new SetCardInfo("Animate Artifact", 48, Rarity.UNCOMMON, mage.cards.a.AnimateArtifact.class));
|
||||
cards.add(new SetCardInfo("Animate Dead", 1, Rarity.UNCOMMON, mage.cards.a.AnimateDead.class));
|
||||
cards.add(new SetCardInfo("Animate Wall", 185, Rarity.RARE, mage.cards.a.AnimateWall.class));
|
||||
cards.add(new SetCardInfo("Ankh of Mishra", 233, Rarity.RARE, mage.cards.a.AnkhOfMishra.class));
|
||||
|
|
|
@ -27,6 +27,7 @@ public class UnlimitedEdition extends ExpansionSet {
|
|||
this.ratioBoosterMythic = 0;
|
||||
cards.add(new SetCardInfo("Air Elemental", 47, Rarity.UNCOMMON, mage.cards.a.AirElemental.class));
|
||||
cards.add(new SetCardInfo("Ancestral Recall", 48, Rarity.RARE, mage.cards.a.AncestralRecall.class));
|
||||
cards.add(new SetCardInfo("Animate Artifact", 49, Rarity.UNCOMMON, mage.cards.a.AnimateArtifact.class));
|
||||
cards.add(new SetCardInfo("Animate Dead", 1, Rarity.UNCOMMON, mage.cards.a.AnimateDead.class));
|
||||
cards.add(new SetCardInfo("Animate Wall", 185, Rarity.RARE, mage.cards.a.AnimateWall.class));
|
||||
cards.add(new SetCardInfo("Ankh of Mishra", 231, Rarity.RARE, mage.cards.a.AnkhOfMishra.class));
|
||||
|
|
|
@ -30,7 +30,7 @@ package mage.abilities.condition.common;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
|
@ -42,9 +42,9 @@ import mage.game.permanent.Permanent;
|
|||
*/
|
||||
public class EquippedMatchesFilterCondition implements Condition {
|
||||
|
||||
private final FilterCreaturePermanent filter;
|
||||
private final FilterPermanent filter;
|
||||
|
||||
public EquippedMatchesFilterCondition(FilterCreaturePermanent filter) {
|
||||
public EquippedMatchesFilterCondition(FilterPermanent filter) {
|
||||
this.filter = filter;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue