mirror of
https://github.com/correl/mage.git
synced 2024-11-15 11:09:30 +00:00
Refactoring.
This commit is contained in:
parent
e8497f1760
commit
96e3834ab7
18 changed files with 133 additions and 428 deletions
|
@ -27,23 +27,19 @@
|
|||
*/
|
||||
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.EquipmentAttachedCount;
|
||||
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;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -68,39 +64,4 @@ public class GolemSkinGauntlets extends CardImpl<GolemSkinGauntlets> {
|
|||
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";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,20 +27,16 @@
|
|||
*/
|
||||
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.dynamicvalue.common.EquipmentAttachedCount;
|
||||
import mage.abilities.effects.common.continious.BoostSourceEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -58,7 +54,7 @@ public class LoxodonPunisher extends CardImpl<LoxodonPunisher> {
|
|||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(2);
|
||||
|
||||
EquipmentAttachedCount amount = new EquipmentAttachedCount();
|
||||
EquipmentAttachedCount amount = new EquipmentAttachedCount(2);
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostSourceEffect(amount, amount, Duration.WhileOnBattlefield)));
|
||||
}
|
||||
|
||||
|
@ -70,39 +66,4 @@ public class LoxodonPunisher extends CardImpl<LoxodonPunisher> {
|
|||
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";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,20 +27,16 @@
|
|||
*/
|
||||
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.dynamicvalue.common.EquipmentAttachedCount;
|
||||
import mage.abilities.effects.common.continious.BoostSourceEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -68,39 +64,4 @@ public class MyrAdapter extends CardImpl<MyrAdapter> {
|
|||
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";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,6 @@ package mage.sets.mirrodinbesieged;
|
|||
import java.util.UUID;
|
||||
import mage.Constants.CardType;
|
||||
import mage.Constants.Rarity;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.common.DestroyAllEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.filter.common.FilterArtifactPermanent;
|
||||
|
|
|
@ -30,10 +30,15 @@ package mage.sets.mirrodinbesieged;
|
|||
import java.util.UUID;
|
||||
import mage.Constants.CardType;
|
||||
import mage.Constants.Rarity;
|
||||
import mage.Constants.Zone;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.common.ArtifactIntoGraveFromBattlefieldTriggeredAbility;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.common.GainLifeEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.events.ZoneChangeEvent;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -50,7 +55,7 @@ public class FangrenMarauder extends CardImpl<FangrenMarauder> {
|
|||
this.power = new MageInt(5);
|
||||
this.toughness = new MageInt(5);
|
||||
|
||||
this.addAbility(new ArtifactIntoGraveFromBattlefieldTriggeredAbility(new GainLifeEffect(5), true));
|
||||
this.addAbility(new FangrenMarauderTriggeredAbility());
|
||||
}
|
||||
|
||||
public FangrenMarauder(final FangrenMarauder card) {
|
||||
|
@ -62,3 +67,37 @@ public class FangrenMarauder extends CardImpl<FangrenMarauder> {
|
|||
return new FangrenMarauder(this);
|
||||
}
|
||||
}
|
||||
|
||||
class FangrenMarauderTriggeredAbility extends TriggeredAbilityImpl<FangrenMarauderTriggeredAbility> {
|
||||
|
||||
public FangrenMarauderTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new GainLifeEffect(5), true);
|
||||
}
|
||||
|
||||
public FangrenMarauderTriggeredAbility(final FangrenMarauderTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getType() == EventType.ZONE_CHANGE) {
|
||||
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
|
||||
if (zEvent.getFromZone() == Zone.BATTLEFIELD
|
||||
&& zEvent.getToZone() == Zone.GRAVEYARD
|
||||
&& zEvent.getTarget().getCardType().contains(CardType.ARTIFACT)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever an artifact is put into a graveyard from the battlefield, you may gain 5 life.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public FangrenMarauderTriggeredAbility copy() {
|
||||
return new FangrenMarauderTriggeredAbility(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,16 +30,12 @@ package mage.sets.mirrodinbesieged;
|
|||
|
||||
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.keyword.FirstStrikeAbility;
|
||||
import mage.abilities.keyword.InfectAbility;
|
||||
import mage.abilities.keyword.ProtectionAbility;
|
||||
import mage.abilities.mana.ColorlessManaAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.filter.Filter.ComparisonScope;
|
||||
import mage.filter.FilterCard;
|
||||
|
||||
/**
|
||||
|
@ -48,17 +44,15 @@ import mage.filter.FilterCard;
|
|||
*/
|
||||
public class PhyrexianCrusader extends CardImpl<PhyrexianCrusader> {
|
||||
|
||||
private static FilterCard filter = new FilterCard("Red");
|
||||
private static FilterCard filter2 = new FilterCard("White");
|
||||
private static final FilterCard filter = new FilterCard("Red");
|
||||
private static final FilterCard filter2 = new FilterCard("White");
|
||||
|
||||
static {
|
||||
filter.setUseColor(true);
|
||||
filter.getColor().setRed(true);
|
||||
filter.setScopeColor(ComparisonScope.Any);
|
||||
|
||||
filter2.setUseColor(true);
|
||||
filter2.getColor().setWhite(true);
|
||||
filter2.setScopeColor(ComparisonScope.Any);
|
||||
}
|
||||
|
||||
public PhyrexianCrusader (UUID ownerId) {
|
||||
|
|
|
@ -57,7 +57,7 @@ public class PhyrexianVatmother extends CardImpl<PhyrexianVatmother> {
|
|||
this.power = new MageInt(4);
|
||||
this.toughness = new MageInt(5);
|
||||
this.addAbility(InfectAbility.getInstance());
|
||||
this.addAbility(new OnEventTriggeredAbility(EventType.UPKEEP_STEP_PRE, "beginning of your upkeep", new PoisonControllerEffect(1)));
|
||||
this.addAbility(new OnEventTriggeredAbility(EventType.UPKEEP_STEP_PRE, "beginning of your upkeep", new PoisonControllerEffect()));
|
||||
}
|
||||
|
||||
public PhyrexianVatmother (final PhyrexianVatmother card) {
|
||||
|
@ -73,18 +73,14 @@ public class PhyrexianVatmother extends CardImpl<PhyrexianVatmother> {
|
|||
|
||||
class PoisonControllerEffect extends OneShotEffect<PoisonControllerEffect> {
|
||||
|
||||
protected int amount;
|
||||
|
||||
public PoisonControllerEffect(int amount) {
|
||||
public PoisonControllerEffect() {
|
||||
super(Outcome.Damage);
|
||||
this.amount = amount;
|
||||
staticText = "you get " + amount + " poison counter(s)";
|
||||
staticText = "you get a poison counter";
|
||||
|
||||
}
|
||||
|
||||
public PoisonControllerEffect(final PoisonControllerEffect effect) {
|
||||
super(effect);
|
||||
this.amount = effect.amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -96,7 +92,7 @@ class PoisonControllerEffect extends OneShotEffect<PoisonControllerEffect> {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
player.getCounters().addCounter(CounterType.POISON.createInstance(amount));
|
||||
player.getCounters().addCounter(CounterType.POISON.createInstance());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -38,7 +38,6 @@ import mage.Constants.Zone;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.costs.AlternativeCost;
|
||||
import mage.abilities.costs.common.SacrificeTargetCost;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.abilities.effects.common.continious.BoostEquippedEffect;
|
||||
|
@ -50,21 +49,22 @@ import mage.target.common.TargetControlledPermanent;
|
|||
|
||||
/**
|
||||
*
|
||||
* @author Viserion
|
||||
* @author Viserion, North
|
||||
*/
|
||||
public class PistonSledge extends CardImpl<PistonSledge> {
|
||||
|
||||
private static FilterControlledPermanent filter = new FilterControlledPermanent("an artifact");
|
||||
|
||||
public PistonSledge (UUID ownerId) {
|
||||
super(ownerId, 124, "Piston Sledge", Rarity.UNCOMMON, new CardType[]{CardType.ARTIFACT}, "{3}");
|
||||
this.expansionSetCode = "MBS";
|
||||
this.subtype.add("Equipment");
|
||||
this.addAbility(new EquipAbility(Constants.Outcome.AddAbility, new PistonSledgeEquipCost()));
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEquippedEffect(3, 1)));
|
||||
|
||||
Ability ability = new EntersBattlefieldTriggeredAbility(new PistonSledgeEffect(Constants.Outcome.AddAbility), false);
|
||||
Ability ability = new EntersBattlefieldTriggeredAbility(new AttachEffect(Outcome.BoostCreature, "attach it to target creature you control"), false);
|
||||
ability.addTarget(new TargetControlledCreaturePermanent());
|
||||
this.addAbility(ability);
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEquippedEffect(3, 1)));
|
||||
this.addAbility(new EquipAbility(Constants.Outcome.AddAbility, new SacrificeTargetCost(new TargetControlledPermanent(filter))));
|
||||
}
|
||||
|
||||
public PistonSledge (final PistonSledge card) {
|
||||
|
@ -76,43 +76,3 @@ public class PistonSledge extends CardImpl<PistonSledge> {
|
|||
return new PistonSledge(this);
|
||||
}
|
||||
}
|
||||
|
||||
class PistonSledgeEquipCost extends AlternativeCost<PistonSledgeEquipCost> {
|
||||
private static FilterControlledPermanent filter = new FilterControlledPermanent("artifact");
|
||||
|
||||
static {
|
||||
filter.getCardType().add(CardType.ARTIFACT);
|
||||
}
|
||||
|
||||
public PistonSledgeEquipCost() {
|
||||
super("sacrifice an artifact");
|
||||
this.add(new SacrificeTargetCost(new TargetControlledPermanent(1, 1, filter, false)));
|
||||
}
|
||||
|
||||
public PistonSledgeEquipCost(final PistonSledgeEquipCost cost) {
|
||||
super(cost);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PistonSledgeEquipCost copy() {
|
||||
return new PistonSledgeEquipCost(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText() {
|
||||
return " sacrifice an artifact";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class PistonSledgeEffect extends AttachEffect{
|
||||
public PistonSledgeEffect(Outcome outcome) {
|
||||
super(outcome);
|
||||
staticText = "attach it to target creature you control";
|
||||
}
|
||||
|
||||
public PistonSledgeEffect(final AttachEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
}
|
|
@ -51,7 +51,7 @@ import mage.target.common.TargetCreaturePermanent;
|
|||
*/
|
||||
public class PistusStrike extends CardImpl<PistusStrike> {
|
||||
|
||||
private static FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with flying");
|
||||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with flying");
|
||||
|
||||
static {
|
||||
filter.getAbilities().add(FlyingAbility.getInstance());
|
||||
|
@ -62,10 +62,9 @@ public class PistusStrike extends CardImpl<PistusStrike> {
|
|||
this.expansionSetCode = "MBS";
|
||||
this.color.setGreen(true);
|
||||
|
||||
TargetCreaturePermanent target1 = new TargetCreaturePermanent(filter);
|
||||
this.getSpellAbility().addTarget(target1);
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent(filter));
|
||||
this.getSpellAbility().addEffect(new DestroyTargetEffect());
|
||||
this.getSpellAbility().addEffect(new PoisonControllerTargetCreatureEffect(1));
|
||||
this.getSpellAbility().addEffect(new PoisonControllerTargetCreatureEffect());
|
||||
}
|
||||
|
||||
public PistusStrike(final PistusStrike card) {
|
||||
|
@ -80,17 +79,13 @@ public class PistusStrike extends CardImpl<PistusStrike> {
|
|||
|
||||
class PoisonControllerTargetCreatureEffect extends OneShotEffect<PoisonControllerTargetCreatureEffect> {
|
||||
|
||||
protected int amount;
|
||||
|
||||
public PoisonControllerTargetCreatureEffect(int amount) {
|
||||
public PoisonControllerTargetCreatureEffect() {
|
||||
super(Outcome.Damage);
|
||||
this.amount = amount;
|
||||
setText();
|
||||
staticText = "Its controller gets a poison counter";
|
||||
}
|
||||
|
||||
public PoisonControllerTargetCreatureEffect(final PoisonControllerTargetCreatureEffect effect) {
|
||||
super(effect);
|
||||
this.amount = effect.amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -107,17 +102,9 @@ class PoisonControllerTargetCreatureEffect extends OneShotEffect<PoisonControlle
|
|||
if (p != null) {
|
||||
Player player = game.getPlayer(p.getControllerId());
|
||||
if (player != null) {
|
||||
player.getCounters().addCounter(CounterType.POISON.createInstance(amount));
|
||||
player.getCounters().addCounter(CounterType.POISON.createInstance());
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setText() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("That creature's controller gets ").append(Integer.toString(amount)).append(" poison counter");
|
||||
sb.append((amount == 1?"":"s"));
|
||||
staticText = sb.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -45,13 +45,11 @@ import mage.abilities.effects.common.continious.GainAbilityAttachedEffect;
|
|||
import mage.abilities.keyword.EquipAbility;
|
||||
import mage.abilities.keyword.ProtectionAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.filter.Filter;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.DamagedPlayerEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.TargetPlayer;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
/**
|
||||
|
@ -59,13 +57,12 @@ import mage.target.targetpointer.FixedTarget;
|
|||
* @author Viserion
|
||||
*/
|
||||
public class SwordOfFeastAndFamine extends CardImpl<SwordOfFeastAndFamine> {
|
||||
private static FilterCard filter = new FilterCard("green and from black");
|
||||
private static final FilterCard filter = new FilterCard("green and from black");
|
||||
|
||||
static {
|
||||
filter.setUseColor(true);
|
||||
filter.getColor().setBlack(true);
|
||||
filter.getColor().setGreen(true);
|
||||
filter.setScopeColor(Filter.ComparisonScope.Any);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -27,21 +27,17 @@
|
|||
*/
|
||||
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.EquipmentAttachedCount;
|
||||
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;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -59,7 +55,7 @@ public class GoblinGaveleer extends CardImpl<GoblinGaveleer> {
|
|||
this.power = new MageInt(1);
|
||||
this.toughness = new MageInt(1);
|
||||
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostSourceEffect(new EquipmentAttachedCount(),
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostSourceEffect(new EquipmentAttachedCount(2),
|
||||
new StaticValue(0), Duration.WhileOnBattlefield)));
|
||||
}
|
||||
|
||||
|
@ -71,39 +67,4 @@ public class GoblinGaveleer extends CardImpl<GoblinGaveleer> {
|
|||
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";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,24 +25,19 @@
|
|||
* 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;
|
||||
import mage.Constants.CardType;
|
||||
import mage.Constants.Rarity;
|
||||
import mage.Constants.TargetController;
|
||||
import mage.MageInt;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.dynamicvalue.common.EquipmentAttachedCount;
|
||||
import mage.abilities.effects.common.CreateTokenEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.token.Token;
|
||||
|
||||
/**
|
||||
|
@ -63,7 +58,7 @@ public class KembaKhaRegent extends CardImpl<KembaKhaRegent> {
|
|||
this.toughness = new MageInt(4);
|
||||
|
||||
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new CreateTokenEffect(new CatToken(), new EquipmentAttachedCount()),
|
||||
Constants.TargetController.YOU, false));
|
||||
TargetController.YOU, false));
|
||||
}
|
||||
|
||||
public KembaKhaRegent(final KembaKhaRegent card) {
|
||||
|
@ -74,44 +69,10 @@ public class KembaKhaRegent extends CardImpl<KembaKhaRegent> {
|
|||
public KembaKhaRegent copy() {
|
||||
return new KembaKhaRegent(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 {this}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class CatToken extends Token {
|
||||
|
||||
public CatToken() {
|
||||
super("Cat", "a 2/2 white Cat creature token");
|
||||
cardType.add(CardType.CREATURE);
|
||||
|
|
|
@ -25,23 +25,26 @@
|
|||
* 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.UUID;
|
||||
import mage.Constants;
|
||||
import mage.Constants.CardType;
|
||||
import mage.Constants.Rarity;
|
||||
import mage.Constants.Zone;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.common.ArtifactIntoGraveFromBattlefieldTriggeredAbility;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.common.continious.BoostSourceEffect;
|
||||
import mage.abilities.keyword.TrampleAbility;
|
||||
import mage.cards.CardImpl;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.events.ZoneChangeEvent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Loki
|
||||
* @author Loki, North
|
||||
*/
|
||||
public class MolderBeast extends CardImpl<MolderBeast> {
|
||||
|
||||
|
@ -55,7 +58,7 @@ public class MolderBeast extends CardImpl<MolderBeast> {
|
|||
this.toughness = new MageInt(3);
|
||||
|
||||
this.addAbility(TrampleAbility.getInstance());
|
||||
this.addAbility(new ArtifactIntoGraveFromBattlefieldTriggeredAbility(new BoostSourceEffect(2, 0, Constants.Duration.EndOfTurn), false));
|
||||
this.addAbility(new MolderBeastTriggeredAbility());
|
||||
}
|
||||
|
||||
public MolderBeast(final MolderBeast card) {
|
||||
|
@ -66,5 +69,38 @@ public class MolderBeast extends CardImpl<MolderBeast> {
|
|||
public MolderBeast copy() {
|
||||
return new MolderBeast(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class MolderBeastTriggeredAbility extends TriggeredAbilityImpl<MolderBeastTriggeredAbility> {
|
||||
|
||||
public MolderBeastTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new BoostSourceEffect(2, 0, Constants.Duration.EndOfTurn), false);
|
||||
}
|
||||
|
||||
public MolderBeastTriggeredAbility(final MolderBeastTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getType() == EventType.ZONE_CHANGE) {
|
||||
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
|
||||
if (zEvent.getFromZone() == Zone.BATTLEFIELD
|
||||
&& zEvent.getToZone() == Zone.GRAVEYARD
|
||||
&& zEvent.getTarget().getCardType().contains(CardType.ARTIFACT)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever an artifact is put into a graveyard from the battlefield, {this} gets +2/+0 until end of turn.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public MolderBeastTriggeredAbility copy() {
|
||||
return new MolderBeastTriggeredAbility(this);
|
||||
}
|
||||
}
|
|
@ -33,13 +33,10 @@ import mage.Constants.CardType;
|
|||
import mage.Constants.Outcome;
|
||||
import mage.Constants.Rarity;
|
||||
import mage.Constants.Zone;
|
||||
import mage.abilities.ActivatedAbilityImpl;
|
||||
import mage.abilities.common.LandfallAbility;
|
||||
import mage.abilities.costs.Costs;
|
||||
import mage.abilities.costs.CostsImpl;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.common.RemoveCountersSourceCost;
|
||||
import mage.abilities.costs.common.SacrificeSourceCost;
|
||||
import mage.abilities.effects.common.CounterTargetEffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||
import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect;
|
||||
import mage.cards.CardImpl;
|
||||
|
@ -60,7 +57,12 @@ public class KhalniHeartExpedition extends CardImpl<KhalniHeartExpedition> {
|
|||
this.color.setGreen(true);
|
||||
|
||||
this.addAbility(new LandfallAbility(new AddCountersSourceEffect(new QuestCounter()), true));
|
||||
this.addAbility(new KhalniHeartExpeditionAbility());
|
||||
TargetCardInLibrary target = new TargetCardInLibrary(0, 2, new FilterBasicLandCard());
|
||||
SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
|
||||
new SearchLibraryPutInPlayEffect(target, true, Outcome.PutLandInPlay),
|
||||
new RemoveCountersSourceCost(CounterType.QUEST.createInstance(3)));
|
||||
ability.addCost(new SacrificeSourceCost());
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
public KhalniHeartExpedition(final KhalniHeartExpedition card) {
|
||||
|
@ -72,32 +74,3 @@ public class KhalniHeartExpedition extends CardImpl<KhalniHeartExpedition> {
|
|||
return new KhalniHeartExpedition(this);
|
||||
}
|
||||
}
|
||||
|
||||
class KhalniHeartExpeditionAbility extends ActivatedAbilityImpl<KhalniHeartExpeditionAbility> {
|
||||
|
||||
public KhalniHeartExpeditionAbility() {
|
||||
super(Zone.BATTLEFIELD, null);
|
||||
|
||||
Costs additionalCosts = new CostsImpl();
|
||||
additionalCosts.add(new RemoveCountersSourceCost(CounterType.QUEST.createInstance(3)));
|
||||
additionalCosts.add(new SacrificeSourceCost());
|
||||
costs.add(additionalCosts);
|
||||
TargetCardInLibrary target = new TargetCardInLibrary(0, 2, new FilterBasicLandCard());
|
||||
addEffect(new SearchLibraryPutInPlayEffect(target, true, Outcome.PutLandInPlay));
|
||||
}
|
||||
|
||||
public KhalniHeartExpeditionAbility(final KhalniHeartExpeditionAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public KhalniHeartExpeditionAbility copy() {
|
||||
return new KhalniHeartExpeditionAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Remove three quest counters from {this} and sacrifice it: Search your library for up to two basic land cards, put them onto the battlefield tapped, then shuffle your library.";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -45,7 +45,6 @@ import mage.game.events.GameEvent.EventType;
|
|||
import mage.game.events.ZoneChangeEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.common.TargetCreatureOrPlayer;
|
||||
import mage.watchers.WatcherImpl;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -53,7 +52,7 @@ import mage.watchers.WatcherImpl;
|
|||
*/
|
||||
public class ValakutTheMoltenPinnacle extends CardImpl<ValakutTheMoltenPinnacle> {
|
||||
|
||||
static FilterLandPermanent filter = new FilterLandPermanent("Mountain");
|
||||
static final FilterLandPermanent filter = new FilterLandPermanent("Mountain");
|
||||
|
||||
static {
|
||||
filter.getSubtype().add("Mountain");
|
||||
|
|
|
@ -1,75 +0,0 @@
|
|||
/*
|
||||
* 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.abilities.common;
|
||||
|
||||
import mage.Constants;
|
||||
import mage.Constants.Zone;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.events.ZoneChangeEvent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author North
|
||||
*/
|
||||
public class ArtifactIntoGraveFromBattlefieldTriggeredAbility extends TriggeredAbilityImpl<ArtifactIntoGraveFromBattlefieldTriggeredAbility> {
|
||||
|
||||
public ArtifactIntoGraveFromBattlefieldTriggeredAbility(Effect effect, boolean optional) {
|
||||
super(Zone.BATTLEFIELD, effect, optional);
|
||||
}
|
||||
|
||||
public ArtifactIntoGraveFromBattlefieldTriggeredAbility(final ArtifactIntoGraveFromBattlefieldTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getType() == EventType.ZONE_CHANGE) {
|
||||
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
|
||||
if (zEvent.getFromZone() == Zone.BATTLEFIELD
|
||||
&& zEvent.getToZone() == Zone.GRAVEYARD
|
||||
&& zEvent.getTarget().getCardType().contains(Constants.CardType.ARTIFACT)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever an artifact is put into a graveyard from the battlefield, " + super.getRule();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArtifactIntoGraveFromBattlefieldTriggeredAbility copy() {
|
||||
return new ArtifactIntoGraveFromBattlefieldTriggeredAbility(this);
|
||||
}
|
||||
}
|
|
@ -32,7 +32,6 @@ import mage.Constants.Outcome;
|
|||
import mage.Constants.TimingRule;
|
||||
import mage.Constants.Zone;
|
||||
import mage.abilities.ActivatedAbilityImpl;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.target.common.TargetControlledCreaturePermanent;
|
||||
|
|
|
@ -31,9 +31,7 @@ package mage.game.permanent;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.Constants.CardType;
|
||||
import mage.Constants.Zone;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbility;
|
||||
import mage.abilities.common.ZoneChangeTriggeredAbility;
|
||||
|
@ -42,11 +40,9 @@ import mage.cards.Card;
|
|||
import mage.cards.LevelerCard;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.ZoneChangeEvent;
|
||||
import mage.players.Player;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue