Added cards.

This commit is contained in:
North 2011-07-01 23:11:51 +03:00
parent f2f46ae9a9
commit f3c46c7141
7 changed files with 721 additions and 36 deletions

View file

@ -0,0 +1,106 @@
/*
* 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.mirrodin;
import java.util.List;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Duration;
import mage.Constants.Outcome;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.continious.BoostEquippedEffect;
import mage.abilities.keyword.EquipAbility;
import mage.cards.CardImpl;
import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
* @author North
*/
public class GolemSkinGauntlets extends CardImpl<GolemSkinGauntlets> {
public GolemSkinGauntlets(UUID ownerId) {
super(ownerId, 181, "Golem-Skin Gauntlets", Rarity.UNCOMMON, new CardType[]{CardType.ARTIFACT}, "{1}");
this.expansionSetCode = "MRD";
this.subtype.add("Equipment");
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEquippedEffect(new EquipmentAttachedCount(), new StaticValue(0), Duration.WhileOnBattlefield)));
this.addAbility(new EquipAbility(Outcome.BoostCreature, new GenericManaCost(2)));
}
public GolemSkinGauntlets(final GolemSkinGauntlets card) {
super(card);
}
@Override
public GolemSkinGauntlets copy() {
return new GolemSkinGauntlets(this);
}
private class EquipmentAttachedCount implements DynamicValue {
@Override
public int calculate(Game game, Ability source) {
int count = 0;
Permanent p = game.getPermanent(source.getSourceId());
if (p != null) {
List<UUID> attachments = p.getAttachments();
for (UUID attachmentId : attachments) {
Permanent attached = game.getPermanent(attachmentId);
if (attached != null && attached.getSubtype().contains("Equipment")) {
count++;
}
}
}
return count;
}
@Override
public DynamicValue clone() {
return new EquipmentAttachedCount();
}
@Override
public String toString() {
return "1";
}
@Override
public String getMessage() {
return "Equipment attached to it";
}
}
}

View file

@ -0,0 +1,108 @@
/*
* 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.mirrodin;
import java.util.List;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Duration;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.common.continious.BoostSourceEffect;
import mage.cards.CardImpl;
import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
* @author North
*/
public class LoxodonPunisher extends CardImpl<LoxodonPunisher> {
public LoxodonPunisher(UUID ownerId) {
super(ownerId, 14, "Loxodon Punisher", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{3}{W}");
this.expansionSetCode = "MRD";
this.subtype.add("Elephant");
this.subtype.add("Soldier");
this.color.setWhite(true);
this.power = new MageInt(2);
this.toughness = new MageInt(2);
EquipmentAttachedCount amount = new EquipmentAttachedCount();
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostSourceEffect(amount, amount, Duration.WhileOnBattlefield)));
}
public LoxodonPunisher(final LoxodonPunisher card) {
super(card);
}
@Override
public LoxodonPunisher copy() {
return new LoxodonPunisher(this);
}
private class EquipmentAttachedCount implements DynamicValue {
@Override
public int calculate(Game game, Ability source) {
int count = 0;
Permanent p = game.getPermanent(source.getSourceId());
if (p != null) {
List<UUID> attachments = p.getAttachments();
for (UUID attachmentId : attachments) {
Permanent attached = game.getPermanent(attachmentId);
if (attached != null && attached.getSubtype().contains("Equipment")) {
count++;
}
}
}
return 2 * count;
}
@Override
public DynamicValue clone() {
return new EquipmentAttachedCount();
}
@Override
public String toString() {
return "2";
}
@Override
public String getMessage() {
return "Equipment attached to it";
}
}
}

View file

@ -0,0 +1,106 @@
/*
* 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.mirrodin;
import java.util.List;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Duration;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.common.continious.BoostSourceEffect;
import mage.cards.CardImpl;
import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
* @author North
*/
public class MyrAdapter extends CardImpl<MyrAdapter> {
public MyrAdapter(UUID ownerId) {
super(ownerId, 210, "Myr Adapter", Rarity.COMMON, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{3}");
this.expansionSetCode = "MRD";
this.subtype.add("Myr");
this.power = new MageInt(1);
this.toughness = new MageInt(1);
EquipmentAttachedCount amount = new EquipmentAttachedCount();
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostSourceEffect(amount, amount, Duration.WhileOnBattlefield)));
}
public MyrAdapter(final MyrAdapter card) {
super(card);
}
@Override
public MyrAdapter copy() {
return new MyrAdapter(this);
}
private class EquipmentAttachedCount implements DynamicValue {
@Override
public int calculate(Game game, Ability source) {
int count = 0;
Permanent p = game.getPermanent(source.getSourceId());
if (p != null) {
List<UUID> attachments = p.getAttachments();
for (UUID attachmentId : attachments) {
Permanent attached = game.getPermanent(attachmentId);
if (attached != null && attached.getSubtype().contains("Equipment")) {
count++;
}
}
}
return count;
}
@Override
public DynamicValue clone() {
return new EquipmentAttachedCount();
}
@Override
public String toString() {
return "1";
}
@Override
public String getMessage() {
return "Equipment attached to it";
}
}
}

View file

@ -0,0 +1,109 @@
/*
* 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.scarsofmirrodin;
import java.util.List;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Duration;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.continious.BoostSourceEffect;
import mage.cards.CardImpl;
import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
* @author North
*/
public class GoblinGaveleer extends CardImpl<GoblinGaveleer> {
public GoblinGaveleer(UUID ownerId) {
super(ownerId, 92, "Goblin Gaveleer", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{R}");
this.expansionSetCode = "SOM";
this.subtype.add("Goblin");
this.subtype.add("Warrior");
this.color.setRed(true);
this.power = new MageInt(1);
this.toughness = new MageInt(1);
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostSourceEffect(new EquipmentAttachedCount(),
new StaticValue(0), Duration.WhileOnBattlefield)));
}
public GoblinGaveleer(final GoblinGaveleer card) {
super(card);
}
@Override
public GoblinGaveleer copy() {
return new GoblinGaveleer(this);
}
private class EquipmentAttachedCount implements DynamicValue {
@Override
public int calculate(Game game, Ability source) {
int count = 0;
Permanent p = game.getPermanent(source.getSourceId());
if (p != null) {
List<UUID> attachments = p.getAttachments();
for (UUID attachmentId : attachments) {
Permanent attached = game.getPermanent(attachmentId);
if (attached != null && attached.getSubtype().contains("Equipment")) {
count++;
}
}
}
return 2 * count;
}
@Override
public DynamicValue clone() {
return new EquipmentAttachedCount();
}
@Override
public String toString() {
return "2";
}
@Override
public String getMessage() {
return "Equipment attached to it";
}
}
}

View file

@ -28,6 +28,7 @@
package mage.sets.scarsofmirrodin;
import java.util.List;
import java.util.UUID;
import mage.Constants;
@ -37,7 +38,8 @@ import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.cards.CardImpl;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -45,7 +47,7 @@ import mage.game.permanent.token.Token;
/**
*
* @author Loki
* @author Loki, North
*/
public class KembaKhaRegent extends CardImpl<KembaKhaRegent> {
@ -55,10 +57,13 @@ public class KembaKhaRegent extends CardImpl<KembaKhaRegent> {
this.subtype.add("Legendary");
this.subtype.add("Cat");
this.subtype.add("Cleric");
this.color.setWhite(true);
this.power = new MageInt(2);
this.toughness = new MageInt(4);
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new KembaKhaRegentEffect(), Constants.TargetController.YOU, false));
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new CreateTokenEffect(new CatToken(), new EquipmentAttachedCount()),
Constants.TargetController.YOU, false));
}
public KembaKhaRegent (final KembaKhaRegent card) {
@ -69,46 +74,40 @@ public class KembaKhaRegent extends CardImpl<KembaKhaRegent> {
public KembaKhaRegent copy() {
return new KembaKhaRegent(this);
}
}
class KembaKhaRegentEffect extends OneShotEffect<KembaKhaRegentEffect> {
public KembaKhaRegentEffect() {
super(Constants.Outcome.PutCreatureInPlay);
}
private class EquipmentAttachedCount implements DynamicValue {
public KembaKhaRegentEffect(final KembaKhaRegentEffect effect) {
super(effect);
}
@Override
public int calculate(Game game, Ability source) {
int count = 0;
Permanent p = game.getPermanent(source.getSourceId());
if (p != null) {
List<UUID> attachments = p.getAttachments();
for (UUID attachmentId : attachments) {
Permanent attached = game.getPermanent(attachmentId);
if (attached != null && attached.getSubtype().contains("Equipment")) {
count++;
}
}
@Override
public boolean apply(Game game, Ability source) {
Permanent p = game.getPermanent(source.getSourceId());
int count = 0;
if (p != null) {
for (UUID attachmentId : p.getAttachments()) {
Permanent attached = game.getPermanent(attachmentId);
if (attached != null && attached.getSubtype().contains("Equipment"))
count++;
}
if (count > 0) {
CatToken token = new CatToken();
for (int i = 0; i < count; i++) {
token.putOntoBattlefield(game, source.getId(), source.getControllerId());
}
}
return count;
}
return false;
}
@Override
public KembaKhaRegentEffect copy() {
return new KembaKhaRegentEffect(this);
}
@Override
public DynamicValue clone() {
return new EquipmentAttachedCount();
}
@Override
public String getText(Ability source) {
return "put a 2/2 white Cat creature token onto the battlefield for each Equipment attached to Kemba, Kha Regent";
@Override
public String toString() {
return "1";
}
@Override
public String getMessage() {
return "Equipment attached to {this}";
}
}
}

View file

@ -0,0 +1,105 @@
/*
* 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.scarsofmirrodin;
import java.util.ArrayList;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Outcome;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.abilities.Ability;
import mage.abilities.common.PutIntoGraveFromBattlefieldTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DoIfCostPaid;
import mage.abilities.effects.common.DrawCardControllerEffect;
import mage.cards.CardImpl;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetPlayer;
/**
*
* @author North
*/
public class NihilSpellbomb extends CardImpl<NihilSpellbomb> {
public NihilSpellbomb(UUID ownerId) {
super(ownerId, 187, "Nihil Spellbomb", Rarity.COMMON, new CardType[]{CardType.ARTIFACT}, "{1}");
this.expansionSetCode = "SOM";
SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new NihilSpellbombEffect(), new TapSourceCost());
ability.addCost(new SacrificeSourceCost());
ability.addTarget(new TargetPlayer());
this.addAbility(ability);
this.addAbility(new PutIntoGraveFromBattlefieldTriggeredAbility(new DoIfCostPaid(new DrawCardControllerEffect(1), new ManaCostsImpl("{B}")), false));
}
public NihilSpellbomb(final NihilSpellbomb card) {
super(card);
}
@Override
public NihilSpellbomb copy() {
return new NihilSpellbomb(this);
}
}
class NihilSpellbombEffect extends OneShotEffect<NihilSpellbombEffect> {
public NihilSpellbombEffect() {
super(Outcome.Exile);
}
@Override
public NihilSpellbombEffect copy() {
return new NihilSpellbombEffect();
}
@Override
public boolean apply(Game game, Ability source) {
Player targetPlayer = game.getPlayer(source.getFirstTarget());
if (targetPlayer != null) {
ArrayList<UUID> graveyard = new ArrayList<UUID>(targetPlayer.getGraveyard());
for (UUID cardId : graveyard) {
game.getCard(cardId).moveToZone(Zone.EXILED, cardId, game, false);
}
return true;
}
return false;
}
@Override
public String getText(Ability source) {
return "Exile all cards from target player's graveyard";
}
}

View file

@ -0,0 +1,152 @@
/*
* 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.zendikar;
import java.util.List;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Duration;
import mage.Constants.Layer;
import mage.Constants.Outcome;
import mage.Constants.Rarity;
import mage.Constants.SubLayer;
import mage.Constants.Zone;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
* @author North
*/
public class ArmamentMaster extends CardImpl<ArmamentMaster> {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Other Kor creatures you control");
static {
filter.getSubtype().add("Kor");
}
public ArmamentMaster(UUID ownerId) {
super(ownerId, 1, "Armament Master", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{W}{W}");
this.expansionSetCode = "ZEN";
this.subtype.add("Kor");
this.subtype.add("Soldier");
this.color.setWhite(true);
this.power = new MageInt(2);
this.toughness = new MageInt(2);
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ArmamentMasterEffect()));
}
public ArmamentMaster(final ArmamentMaster card) {
super(card);
}
@Override
public ArmamentMaster copy() {
return new ArmamentMaster(this);
}
}
class ArmamentMasterEffect extends ContinuousEffectImpl<ArmamentMasterEffect> {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Other Kor creatures you control");
static {
filter.getSubtype().add("Kor");
}
public ArmamentMasterEffect() {
super(Duration.WhileOnBattlefield, Layer.PTChangingEffects_7, SubLayer.ModifyPT_7c, Outcome.BoostCreature);
}
public ArmamentMasterEffect(final ArmamentMasterEffect effect) {
super(effect);
}
@Override
public ArmamentMasterEffect copy() {
return new ArmamentMasterEffect(this);
}
@Override
public void init(Ability source, Game game) {
super.init(source, game);
if (this.affectedObjectsSet) {
List<Permanent> permanents = game.getBattlefield().getAllActivePermanents(filter, source.getControllerId());
for (Permanent perm : permanents) {
if (!perm.getId().equals(source.getSourceId())) {
objects.add(perm.getId());
}
}
}
}
@Override
public boolean apply(Game game, Ability source) {
int count = countEquipment(game, source);
List<Permanent> permanents = game.getBattlefield().getAllActivePermanents(filter, source.getControllerId());
for (Permanent perm : permanents) {
if (!this.affectedObjectsSet || objects.contains(perm.getId())) {
if (!perm.getId().equals(source.getSourceId())) {
perm.addPower(2 * count);
perm.addToughness(2 * count);
}
}
}
return true;
}
private int countEquipment(Game game, Ability source) {
int count = 0;
Permanent p = game.getPermanent(source.getSourceId());
if (p != null) {
List<UUID> attachments = p.getAttachments();
for (UUID attachmentId : attachments) {
Permanent attached = game.getPermanent(attachmentId);
if (attached != null && attached.getSubtype().contains("Equipment")) {
count++;
}
}
}
return count;
}
@Override
public String getText(Ability source) {
return "Other Kor creatures you control get +2/+2 for each Equipment attached to Armament Master";
}
}