Merge pull request #2408 from JOAC69/refactor-prep-card-refactor

Refactor prep card reorg/deletion
This commit is contained in:
LevelX2 2016-09-30 09:19:29 +02:00 committed by GitHub
commit 0981d329e9
431 changed files with 1850 additions and 2377 deletions

View file

@ -71,18 +71,18 @@ public class DragonBroodmother extends CardImpl {
public DragonBroodmother copy() {
return new DragonBroodmother(this);
}
}
class DragonToken extends Token {
DragonToken() {
super("Dragon", "1/1 red and green Dragon creature token with flying and devour 2");
cardType.add(CardType.CREATURE);
color.setGreen(true);
color.setRed(true);
subtype.add("Dragon");
power = new MageInt(1);
toughness = new MageInt(1);
addAbility(FlyingAbility.getInstance());
addAbility(new DevourAbility(DevourEffect.DevourFactor.Devour2));
class DragonToken extends Token {
DragonToken() {
super("Dragon", "1/1 red and green Dragon creature token with flying and devour 2");
cardType.add(CardType.CREATURE);
color.setGreen(true);
color.setRed(true);
subtype.add("Dragon");
power = new MageInt(1);
toughness = new MageInt(1);
addAbility(FlyingAbility.getInstance());
addAbility(new DevourAbility(DevourEffect.DevourFactor.Devour2));
}
}
}
}

View file

@ -32,7 +32,7 @@ import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.LoyaltyAbility;
import mage.abilities.common.PlanswalkerEntersWithLoyalityCountersAbility;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.CardsInTargetHandCount;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.effects.Effect;
@ -190,31 +190,3 @@ class TibaltTheFiendBloodedControlEffect extends ContinuousEffectImpl {
}
}
class CardsInTargetHandCount implements DynamicValue {
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
if (sourceAbility != null) {
Player player = game.getPlayer(sourceAbility.getFirstTarget());
if (player != null) {
return player.getHand().size();
}
}
return 0;
}
@Override
public DynamicValue copy() {
return new CardsInTargetHandCount();
}
@Override
public String getMessage() {
return "cards in that player's hand";
}
@Override
public String toString() {
return "";
}
}

View file

@ -27,8 +27,6 @@
*/
package mage.sets.battleforzendikar;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Mode;
import mage.abilities.common.LandfallAbility;
import mage.abilities.effects.common.CreateTokenEffect;
@ -37,7 +35,9 @@ import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.game.permanent.token.Token;
import mage.game.permanent.token.KorAllyToken;
import java.util.UUID;
/**
*
@ -66,16 +66,3 @@ public class RetreatToEmeria extends CardImpl {
return new RetreatToEmeria(this);
}
}
class KorAllyToken extends Token {
public KorAllyToken() {
super("Kor Ally", "1/1 white Kor Ally creature token");
cardType.add(CardType.CREATURE);
subtype.add("Kor");
subtype.add("Ally");
color.setWhite(true);
power = new MageInt(1);
toughness = new MageInt(1);
}
}

View file

@ -35,6 +35,7 @@ import mage.cards.CardImpl;
import mage.constants.AbilityWord;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.game.permanent.token.KorAllyToken;
/**
*

View file

@ -44,7 +44,7 @@ import mage.game.combat.CombatGroup;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.Token;
import mage.players.Player;
import mage.sets.bornofthegods.TokenAndCounters.CatSoldierCreatureToken;
import mage.game.permanent.token.CatSoldierCreatureToken;
/**
*

View file

@ -35,7 +35,7 @@ import mage.abilities.effects.keyword.ScryEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.sets.bornofthegods.TokenAndCounters.CentaurEnchantmentCreatureToken;
import mage.game.permanent.token.CentaurEnchantmentCreatureToken;
/**
*

View file

@ -34,7 +34,7 @@ import mage.abilities.effects.common.ExileTargetEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.sets.bornofthegods.TokenAndCounters.GoldToken;
import mage.game.permanent.token.GoldToken;
import mage.target.common.TargetCreaturePermanent;
/**

View file

@ -36,7 +36,7 @@ import mage.abilities.keyword.InspiredAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.sets.bornofthegods.TokenAndCounters.CentaurEnchantmentCreatureToken;
import mage.game.permanent.token.CentaurEnchantmentCreatureToken;
/**
*

View file

@ -33,7 +33,7 @@ import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.keyword.HeroicAbility;
import mage.abilities.keyword.VigilanceAbility;
import mage.cards.CardImpl;
import mage.sets.bornofthegods.TokenAndCounters.CatSoldierCreatureToken;
import mage.game.permanent.token.CatSoldierCreatureToken;
import mage.constants.CardType;
import mage.constants.Rarity;

View file

@ -30,6 +30,7 @@ package mage.sets.championsofkamigawa;
import java.util.UUID;
import mage.abilities.dynamicvalue.common.ZuberasDiedDynamicValue;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.MageInt;
@ -38,6 +39,7 @@ import mage.abilities.common.DiesTriggeredAbility;
import mage.abilities.effects.common.discard.DiscardTargetEffect;
import mage.cards.CardImpl;
import mage.target.common.TargetOpponent;
import mage.watchers.common.ZuberasDiedWatcher;
/**
* @author Loki

View file

@ -29,6 +29,8 @@
package mage.sets.championsofkamigawa;
import java.util.UUID;
import mage.abilities.dynamicvalue.common.ZuberasDiedDynamicValue;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.MageInt;
@ -36,6 +38,7 @@ import mage.abilities.common.DiesTriggeredAbility;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.cards.CardImpl;
import mage.game.permanent.token.SpiritToken;
import mage.watchers.common.ZuberasDiedWatcher;
/**
*

View file

@ -30,6 +30,7 @@ package mage.sets.championsofkamigawa;
import java.util.UUID;
import mage.abilities.dynamicvalue.common.ZuberasDiedDynamicValue;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.MageInt;
@ -38,6 +39,7 @@ import mage.abilities.common.DiesTriggeredAbility;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.cards.CardImpl;
import mage.target.common.TargetCreatureOrPlayer;
import mage.watchers.common.ZuberasDiedWatcher;
/**
*

View file

@ -28,28 +28,22 @@
package mage.sets.championsofkamigawa;
import java.util.UUID;
import mage.abilities.common.FeralDeceiverAbility;
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.LimitedTimesPerTurnActivatedAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.Cost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.LookLibraryControllerEffect;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
import mage.abilities.keyword.TrampleAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.game.Game;
import mage.players.Player;
/**
*
@ -84,38 +78,3 @@ public class FeralDeceiver extends CardImpl {
}
}
class FeralDeceiverAbility extends LimitedTimesPerTurnActivatedAbility {
public FeralDeceiverAbility(Zone zone, Effect effect, Cost cost) {
super(zone, effect, cost);
}
public FeralDeceiverAbility(FeralDeceiverAbility ability) {
super(ability);
}
@Override
public FeralDeceiverAbility copy() {
return new FeralDeceiverAbility(this);
}
@Override
public boolean checkIfClause(Game game) {
Player player = game.getPlayer(this.getControllerId());
if (player != null) {
Cards cards = new CardsImpl();
Card card = player.getLibrary().getFromTop(game);
cards.add(card);
player.revealCards("Feral Deceiver", cards, game);
if (card != null && card.getCardType().contains(CardType.LAND)) {
return true;
}
}
return false;
}
@Override
public String getRule() {
return "{2}: Reveal the top card of your library. If it's a land card, {this} gets +2/+2 and gains trample until end of turn. Activate this ability only once each turn.";
}
}

View file

@ -29,21 +29,13 @@
package mage.sets.championsofkamigawa;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.DiesTriggeredAbility;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
import mage.abilities.dynamicvalue.common.ZuberasDiedDynamicValue;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.WatcherScope;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.ZoneChangeEvent;
import mage.watchers.Watcher;
import mage.watchers.common.ZuberasDiedWatcher;
import java.util.UUID;
@ -75,62 +67,3 @@ public class FloatingDreamZubera extends CardImpl {
}
class ZuberasDiedWatcher extends Watcher {
public int zuberasDiedThisTurn = 0;
public ZuberasDiedWatcher() {
super("ZuberasDied", WatcherScope.GAME);
}
public ZuberasDiedWatcher(final ZuberasDiedWatcher watcher) {
super(watcher);
this.zuberasDiedThisTurn = watcher.zuberasDiedThisTurn;
}
@Override
public ZuberasDiedWatcher copy() {
return new ZuberasDiedWatcher(this);
}
@Override
public void watch(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE && ((ZoneChangeEvent) event).isDiesEvent()) {
MageObject card = game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD);
if (card != null && card.hasSubtype("Zubera", game)) {
zuberasDiedThisTurn++;
}
}
}
@Override
public void reset() {
super.reset();
zuberasDiedThisTurn = 0;
}
}
class ZuberasDiedDynamicValue implements DynamicValue {
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
ZuberasDiedWatcher watcher = (ZuberasDiedWatcher) game.getState().getWatchers().get("ZuberasDied");
return watcher.zuberasDiedThisTurn;
}
@Override
public ZuberasDiedDynamicValue copy() {
return new ZuberasDiedDynamicValue();
}
@Override
public String toString() {
return "1";
}
@Override
public String getMessage() {
return "Zubera that died this turn";
}
}

View file

@ -33,14 +33,12 @@ import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.AdditionalCombatPhaseEffect;
import mage.abilities.effects.common.UntapAllControllerEffect;
import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.TurnPhase;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.common.FilterControlledCreaturePermanent;
@ -51,7 +49,6 @@ import mage.filter.predicate.permanent.PermanentIdPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.turn.TurnMod;
import mage.target.common.TargetCardInLibrary;
import mage.util.CardUtil;
@ -145,25 +142,3 @@ class GodoBanditWarlordAttacksTriggeredAbility extends TriggeredAbilityImpl {
}
}
class AdditionalCombatPhaseEffect extends OneShotEffect {
public AdditionalCombatPhaseEffect() {
super(Outcome.Benefit);
staticText = "After this phase, there is an additional combat phase";
}
public AdditionalCombatPhaseEffect(final AdditionalCombatPhaseEffect effect) {
super(effect);
}
@Override
public AdditionalCombatPhaseEffect copy() {
return new AdditionalCombatPhaseEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
game.getState().getTurnMods().add(new TurnMod(source.getControllerId(), TurnPhase.COMBAT, null, false));
return true;
}
}

View file

@ -29,27 +29,20 @@ package mage.sets.championsofkamigawa;
import java.util.UUID;
import mage.abilities.common.FeralDeceiverAbility;
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.LimitedTimesPerTurnActivatedAbility;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.Cost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.LookLibraryControllerEffect;
import mage.abilities.effects.common.UntapSourceEffect;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.game.Game;
import mage.players.Player;
/**
*
@ -83,39 +76,3 @@ public class HarshDeceiver extends CardImpl {
return new HarshDeceiver(this);
}
}
class HarshDeceiverAbility extends LimitedTimesPerTurnActivatedAbility {
public HarshDeceiverAbility(Zone zone, Effect effect, Cost cost) {
super(zone, effect, cost);
}
public HarshDeceiverAbility(HarshDeceiverAbility ability) {
super(ability);
}
@Override
public HarshDeceiverAbility copy() {
return new HarshDeceiverAbility(this);
}
@Override
public boolean checkIfClause(Game game) {
Player player = game.getPlayer(this.getControllerId());
if (player != null) {
Cards cards = new CardsImpl();
Card card = player.getLibrary().getFromTop(game);
cards.add(card);
player.revealCards("Harsh Deceiver", cards, game);
if (card != null && card.getCardType().contains(CardType.LAND)) {
return true;
}
}
return false;
}
@Override
public String getRule() {
return "{2}: Reveal the top card of your library. If it's a land card, untap {this} and it gets +1/+1 until end of turn. Activate this ability only once each turn.";
}
}

View file

@ -38,6 +38,7 @@ import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.game.Game;
import mage.watchers.common.ZuberasDiedWatcher;
import java.util.UUID;

View file

@ -64,18 +64,18 @@ public class CallTheSkybreaker extends CardImpl {
public CallTheSkybreaker copy() {
return new CallTheSkybreaker(this);
}
}
class ElementalToken extends Token {
class ElementalToken extends Token {
public ElementalToken() {
super("Elemental", "a 5/5 blue and red Elemental creature token with flying");
cardType.add(CardType.CREATURE);
color.setBlue(true);
color.setRed(true);
subtype.add("Elemental");
power = new MageInt(5);
toughness = new MageInt(5);
this.addAbility(FlyingAbility.getInstance());
public ElementalToken() {
super("Elemental", "a 5/5 blue and red Elemental creature token with flying");
cardType.add(CardType.CREATURE);
color.setBlue(true);
color.setRed(true);
subtype.add("Elemental");
power = new MageInt(5);
toughness = new MageInt(5);
this.addAbility(FlyingAbility.getInstance());
}
}
}
}

View file

@ -27,27 +27,14 @@
*/
package mage.sets.commander;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfCombatTriggeredAbility;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.RequirementEffect;
import mage.abilities.effects.common.combat.AttackIfAbleTargetRandomOpponentSourceEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.targetpointer.FixedTarget;
import mage.util.RandomUtil;
/**
*
@ -66,7 +53,7 @@ public class RuhanOfTheFomori extends CardImpl {
this.toughness = new MageInt(7);
// At the beginning of combat on your turn, choose an opponent at random. Ruhan of the Fomori attacks that player this combat if able.
this.addAbility(new BeginningOfCombatTriggeredAbility(new RuhanOfTheFomoriEffect(), TargetController.YOU, false));
this.addAbility(new BeginningOfCombatTriggeredAbility(new AttackIfAbleTargetRandomOpponentSourceEffect(), TargetController.YOU, false));
}
public RuhanOfTheFomori(final RuhanOfTheFomori card) {
@ -79,77 +66,3 @@ public class RuhanOfTheFomori extends CardImpl {
}
}
class RuhanOfTheFomoriEffect extends OneShotEffect {
public RuhanOfTheFomoriEffect() {
super(Outcome.Benefit);
this.staticText = "choose an opponent at random. {this} attacks that player this combat if able";
}
public RuhanOfTheFomoriEffect(final RuhanOfTheFomoriEffect effect) {
super(effect);
}
@Override
public RuhanOfTheFomoriEffect copy() {
return new RuhanOfTheFomoriEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
List<UUID> opponents = new ArrayList<>();
opponents.addAll(game.getOpponents(controller.getId()));
Player opponent = game.getPlayer(opponents.get(RandomUtil.nextInt(opponents.size())));
if (opponent != null) {
ContinuousEffect effect = new AttacksIfAbleTargetPlayerSourceEffect();
effect.setTargetPointer(new FixedTarget(opponent.getId()));
game.addEffect(effect, source);
return true;
}
}
return false;
}
}
class AttacksIfAbleTargetPlayerSourceEffect extends RequirementEffect {
public AttacksIfAbleTargetPlayerSourceEffect() {
super(Duration.EndOfTurn);
staticText = "{this} attacks that player this combat if able";
}
public AttacksIfAbleTargetPlayerSourceEffect(final AttacksIfAbleTargetPlayerSourceEffect effect) {
super(effect);
}
@Override
public AttacksIfAbleTargetPlayerSourceEffect copy() {
return new AttacksIfAbleTargetPlayerSourceEffect(this);
}
@Override
public boolean applies(Permanent permanent, Ability source, Game game) {
if (permanent.getId().equals(source.getSourceId())) {
return true;
}
return false;
}
@Override
public boolean mustAttack(Game game) {
return true;
}
@Override
public boolean mustBlock(Game game) {
return false;
}
@Override
public UUID mustAttackDefender(Ability source, Game game) {
return getTargetPointer().getFirst(game, source);
}
}

View file

@ -38,6 +38,7 @@ import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.RequirementEffect;
import mage.abilities.effects.common.combat.AttackIfAbleTargetRandomOpponentSourceEffect;
import mage.abilities.keyword.DeathtouchAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
@ -68,7 +69,7 @@ public class RavingDead extends CardImpl {
// Deathtouch
this.addAbility(DeathtouchAbility.getInstance());
// At the beginning of combat on your turn, choose an opponent at random. Raving Dead attacks that player this combat if able.
this.addAbility(new BeginningOfCombatTriggeredAbility(new RavingDeadEffect(), TargetController.YOU, false));
this.addAbility(new BeginningOfCombatTriggeredAbility(new AttackIfAbleTargetRandomOpponentSourceEffect(), TargetController.YOU, false));
// Whenever Raving Dead deals combat damage to a player, that player loses half his or her life, rounded down.
this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(new RavingDeadDamageEffect(), false, true));
}
@ -83,40 +84,6 @@ public class RavingDead extends CardImpl {
}
}
class RavingDeadEffect extends OneShotEffect {
public RavingDeadEffect() {
super(Outcome.Benefit);
this.staticText = "choose an opponent at random. {this} attacks that player this combat if able";
}
public RavingDeadEffect(final RavingDeadEffect effect) {
super(effect);
}
@Override
public RavingDeadEffect copy() {
return new RavingDeadEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
List<UUID> opponents = new ArrayList<>();
opponents.addAll(game.getOpponents(controller.getId()));
Player opponent = game.getPlayer(opponents.get(RandomUtil.nextInt(opponents.size())));
if (opponent != null) {
ContinuousEffect effect = new AttacksIfAbleTargetPlayerSourceEffect();
effect.setTargetPointer(new FixedTarget(opponent.getId()));
game.addEffect(effect, source);
return true;
}
}
return false;
}
}
class RavingDeadDamageEffect extends OneShotEffect {
public RavingDeadDamageEffect() {
@ -146,44 +113,3 @@ class RavingDeadDamageEffect extends OneShotEffect {
return false;
}
}
class AttacksIfAbleTargetPlayerSourceEffect extends RequirementEffect {
public AttacksIfAbleTargetPlayerSourceEffect() {
super(Duration.EndOfTurn);
staticText = "{this} attacks that player this combat if able";
}
public AttacksIfAbleTargetPlayerSourceEffect(final AttacksIfAbleTargetPlayerSourceEffect effect) {
super(effect);
}
@Override
public AttacksIfAbleTargetPlayerSourceEffect copy() {
return new AttacksIfAbleTargetPlayerSourceEffect(this);
}
@Override
public boolean applies(Permanent permanent, Ability source, Game game) {
if (permanent.getId().equals(source.getSourceId())) {
return true;
}
return false;
}
@Override
public boolean mustAttack(Game game) {
return true;
}
@Override
public boolean mustBlock(Game game) {
return false;
}
@Override
public UUID mustAttackDefender(Ability source, Game game) {
return getTargetPointer().getFirst(game, source);
}
}

View file

@ -74,17 +74,17 @@ class AwakenTheSkyTyrantTriggeredAbility extends TriggeredAbilityImpl {
super(ability);
}
@java.lang.Override
@Override
public AwakenTheSkyTyrantTriggeredAbility copy() {
return new AwakenTheSkyTyrantTriggeredAbility(this);
}
@java.lang.Override
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType().equals(GameEvent.EventType.DAMAGED_PLAYER);
}
@java.lang.Override
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getTargetId().equals(controllerId)) {
UUID sourceControllerId = game.getControllerId(event.getSourceId());
@ -95,7 +95,7 @@ class AwakenTheSkyTyrantTriggeredAbility extends TriggeredAbilityImpl {
return false;
}
@java.lang.Override
@Override
public String getRule() {
return "When a source an opponent controls deals damage to you, " + super.getRule();
}

View file

@ -72,17 +72,17 @@ public class RakkaMar extends CardImpl {
public RakkaMar copy() {
return new RakkaMar(this);
}
}
class ElementalToken extends Token {
static class ElementalToken extends Token {
public ElementalToken() {
super("Elemental", "3/1 red Elemental creature with Haste");
cardType.add(CardType.CREATURE);
color.setRed(true);
subtype.add("Elemental");
power = new MageInt(3);
toughness = new MageInt(1);
addAbility(HasteAbility.getInstance());
public ElementalToken() {
super("Elemental", "3/1 red Elemental creature with Haste");
cardType.add(CardType.CREATURE);
color.setRed(true);
subtype.add("Elemental");
power = new MageInt(3);
toughness = new MageInt(1);
addAbility(HasteAbility.getInstance());
}
}
}

View file

@ -29,21 +29,14 @@ package mage.sets.conflux;
import java.util.UUID;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.RevealTopLandToBattlefieldElseHandEffect;
import mage.abilities.keyword.VigilanceAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.players.Player;
/**
* @author North
@ -62,7 +55,7 @@ public class SkywardEyeProphets extends CardImpl {
// Vigilance
this.addAbility(VigilanceAbility.getInstance());
// {tap}: Reveal the top card of your library. If it's a land card, put it onto the battlefield. Otherwise, put it into your hand.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new SkywardEyeProphetsEffect(), new TapSourceCost()));
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new RevealTopLandToBattlefieldElseHandEffect(), new TapSourceCost()));
}
public SkywardEyeProphets(final SkywardEyeProphets card) {
@ -73,45 +66,4 @@ public class SkywardEyeProphets extends CardImpl {
public SkywardEyeProphets copy() {
return new SkywardEyeProphets(this);
}
public static class SkywardEyeProphetsEffect extends OneShotEffect {
public SkywardEyeProphetsEffect() {
super(Outcome.DrawCard);
this.staticText = "Reveal the top card of your library. If it's a land card, put it onto the battlefield. Otherwise, put it into your hand";
}
public SkywardEyeProphetsEffect(final SkywardEyeProphetsEffect effect) {
super(effect);
}
@Override
public SkywardEyeProphetsEffect copy() {
return new SkywardEyeProphetsEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = game.getObject(source.getSourceId());
if (sourceObject == null || controller == null) {
return false;
}
if (controller.getLibrary().size() > 0) {
CardsImpl cards = new CardsImpl();
Card card = controller.getLibrary().getFromTop(game);
if (card == null) {
return false;
}
cards.add(card);
controller.revealCards(sourceObject.getName(), cards, game);
if (card.getCardType().contains(CardType.LAND)) {
return controller.moveCards(card, Zone.BATTLEFIELD, source, game);
} else {
controller.moveCards(card, Zone.HAND, source, game);
}
}
return true;
}
}
}

View file

@ -80,7 +80,7 @@ public class SorinLordOfInnistrad extends CardImpl {
this.addAbility(new LoyaltyAbility(new CreateTokenEffect(new VampireToken()), 1));
// -2: You get an emblem with "Creatures you control get +1/+0."
this.addAbility(new LoyaltyAbility(new GetEmblemEffect(new SorinEmblem()), -2));
this.addAbility(new LoyaltyAbility(new GetEmblemEffect(new SorinLordOfInnistradEmblem()), -2));
// -6: Destroy up to three target creatures and/or other planeswalkers. Return each card put into a graveyard this way to the battlefield under your control.
LoyaltyAbility ability = new LoyaltyAbility(new SorinLordOfInnistradEffect(), -6);
@ -96,24 +96,23 @@ public class SorinLordOfInnistrad extends CardImpl {
public SorinLordOfInnistrad copy() {
return new SorinLordOfInnistrad(this);
}
}
class VampireToken extends Token {
VampireToken() {
super("Vampire", "a 1/1 black Vampire creature token with lifelink");
cardType.add(CardType.CREATURE);
color.setBlack(true);
subtype.add("Vampire");
power = new MageInt(1);
toughness = new MageInt(1);
addAbility(LifelinkAbility.getInstance());
class VampireToken extends Token {
VampireToken() {
super("Vampire", "a 1/1 black Vampire creature token with lifelink");
cardType.add(CardType.CREATURE);
color.setBlack(true);
subtype.add("Vampire");
power = new MageInt(1);
toughness = new MageInt(1);
addAbility(LifelinkAbility.getInstance());
}
}
}
class SorinEmblem extends Emblem {
class SorinLordOfInnistradEmblem extends Emblem {
public SorinEmblem() {
public SorinLordOfInnistradEmblem() {
this.setName("EMBLEM: Sorin, Lord of Innistrad");
BoostControlledEffect effect = new BoostControlledEffect(1, 0, Duration.EndOfGame);
Ability ability = new SimpleStaticAbility(Zone.COMMAND, effect);

View file

@ -27,12 +27,10 @@
*/
package mage.sets.darksteel;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.common.CastOnlyDuringPhaseStepSourceAbility;
import mage.abilities.condition.common.MyTurnCondition;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.AdditionalCombatPhaseEffect;
import mage.abilities.effects.common.UntapAllControllerEffect;
import mage.abilities.effects.common.continuous.GainAbilityControlledEffect;
import mage.abilities.keyword.DoubleStrikeAbility;
@ -40,13 +38,12 @@ import mage.abilities.keyword.EntwineAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.TurnPhase;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.turn.TurnMod;
import java.util.UUID;
/**
*
@ -68,7 +65,7 @@ public class SavageBeating extends CardImpl {
// or untap all creatures you control and after this phase, there is an additional combat phase.
Mode mode = new Mode();
mode.getEffects().add(new UntapAllControllerEffect(new FilterControlledCreaturePermanent(), "untap all creatures you control"));
mode.getEffects().add(new AdditionalCombatPhaseEffect());
mode.getEffects().add(new AdditionalCombatPhaseEffect("and after this phase, there is an additional combat phase"));
this.getSpellAbility().getModes().addMode(mode);
// Entwine {1}{R}
@ -84,26 +81,3 @@ public class SavageBeating extends CardImpl {
return new SavageBeating(this);
}
}
class AdditionalCombatPhaseEffect extends OneShotEffect {
AdditionalCombatPhaseEffect() {
super(Outcome.Benefit);
staticText = "and after this phase, there is an additional combat phase";
}
AdditionalCombatPhaseEffect(final AdditionalCombatPhaseEffect effect) {
super(effect);
}
@Override
public AdditionalCombatPhaseEffect copy() {
return new AdditionalCombatPhaseEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
game.getState().getTurnMods().add(new TurnMod(source.getControllerId(), TurnPhase.COMBAT, null, false));
return true;
}
}

View file

@ -30,10 +30,10 @@ package mage.sets.dissension;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.common.RevealTopLandToBattlefieldElseHandEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.sets.conflux.SkywardEyeProphets.SkywardEyeProphetsEffect;
/**
* @author mluds
@ -51,7 +51,7 @@ public class CoilingOracle extends CardImpl {
this.toughness = new MageInt(1);
// When Coiling Oracle enters the battlefield, reveal the top card of your library. If it's a land card, put it onto the battlefield. Otherwise, put that card into your hand.
this.addAbility(new EntersBattlefieldTriggeredAbility(new SkywardEyeProphetsEffect()));
this.addAbility(new EntersBattlefieldTriggeredAbility(new RevealTopLandToBattlefieldElseHandEffect()));
}
public CoilingOracle(final CoilingOracle card) {

View file

@ -28,20 +28,18 @@
package mage.sets.dragonsmaze;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.CardsInTargetHandCount;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.effects.common.DrawCardTargetEffect;
import mage.abilities.effects.common.LoseLifeTargetEffect;
import mage.cards.SplitCard;
import mage.game.Game;
import mage.players.Player;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.target.TargetPlayer;
import java.util.UUID;
/**
*
* @author LevelX2
@ -62,7 +60,7 @@ public class ToilTrouble extends SplitCard {
// Trouble
// Trouble deals damage to target player equal to the number of cards in that player's hand.
Effect effect = new DamageTargetEffect(new TargetPlayerCardsInHandCount());
Effect effect = new DamageTargetEffect(new CardsInTargetHandCount());
effect.setText("Trouble deals damage to target player equal to the number of cards in that player's hand");
getRightHalfCard().getSpellAbility().addEffect(effect);
getRightHalfCard().getSpellAbility().addTarget(new TargetPlayer());
@ -78,31 +76,3 @@ public class ToilTrouble extends SplitCard {
return new ToilTrouble(this);
}
}
class TargetPlayerCardsInHandCount implements DynamicValue {
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
Player targetPlayer = game.getPlayer(sourceAbility.getFirstTarget());
if (targetPlayer != null) {
return targetPlayer.getHand().size();
}
return 0;
}
@Override
public DynamicValue copy() {
return new TargetPlayerCardsInHandCount();
}
@Override
public String toString() {
return "1";
}
@Override
public String getMessage() {
return "target player's cards in hand";
}
}

View file

@ -41,6 +41,7 @@ import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.permanent.token.EldraziHorrorToken;
/**
*

View file

@ -49,7 +49,7 @@ import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.game.permanent.token.Token;
import mage.game.permanent.token.HumanWizardToken;
import mage.players.Player;
/**
@ -134,15 +134,3 @@ class DocentOfPerfectionEffect extends OneShotEffect {
}
}
class HumanWizardToken extends Token {
public HumanWizardToken() {
super("Human Wizard", "1/1 blue Human Wizard creature token");
cardType.add(CardType.CREATURE);
subtype.add("Human");
subtype.add("Wizard");
color.setBlue(true);
power = new MageInt(1);
toughness = new MageInt(1);
}
}

View file

@ -46,6 +46,7 @@ import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.AnotherPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.EldraziHorrorToken;
import mage.players.Player;
import mage.target.Target;
import mage.target.common.TargetControlledCreaturePermanent;

View file

@ -34,6 +34,7 @@ import mage.abilities.effects.common.CreateTokenEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.game.permanent.token.EldraziHorrorToken;
/**
*

View file

@ -46,6 +46,7 @@ import mage.constants.Zone;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.permanent.token.EldraziHorrorToken;
import mage.target.common.TargetControlledCreaturePermanent;
/**

View file

@ -45,6 +45,7 @@ import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.permanent.AnotherPredicate;
import mage.game.permanent.token.EldraziHorrorToken;
import mage.target.common.TargetControlledPermanent;
/**

View file

@ -49,6 +49,7 @@ import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.permanent.token.HumanWizardToken;
/**
*

View file

@ -43,6 +43,7 @@ import mage.filter.FilterCard;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.token.EldraziHorrorToken;
import mage.game.stack.Spell;
/**

View file

@ -36,6 +36,7 @@ import mage.abilities.keyword.TrampleAbility;
import mage.cards.MeldCard;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.game.permanent.token.EldraziHorrorToken;
/**
*

View file

@ -37,6 +37,7 @@ import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.permanent.token.EldraziHorrorToken;
/**
*

View file

@ -43,6 +43,7 @@ import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.token.EldraziHorrorToken;
import mage.target.common.TargetCreaturePermanent;
/**

View file

@ -120,12 +120,12 @@ class SavageAllianceGainTrampleEffect extends OneShotEffect {
super(effect);
}
@java.lang.Override
@Override
public SavageAllianceGainTrampleEffect copy() {
return new SavageAllianceGainTrampleEffect(this);
}
@java.lang.Override
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(this.getTargetPointer().getFirst(game, source));
if (player != null) {

View file

@ -39,7 +39,7 @@ import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.permanent.token.Token;
import mage.game.permanent.token.HumanSoldierToken;
/**
*
@ -71,16 +71,3 @@ public class ThrabenStandardBearer extends CardImpl {
return new ThrabenStandardBearer(this);
}
}
class HumanSoldierToken extends Token {
public HumanSoldierToken() {
super("Human Soldier", "1/1 white Human Soldier creature token");
cardType.add(CardType.CREATURE);
subtype.add("Human");
subtype.add("Soldier");
color.setWhite(true);
power = new MageInt(1);
toughness = new MageInt(1);
}
}

View file

@ -45,6 +45,7 @@ import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.token.EldraziHorrorToken;
import mage.game.permanent.token.Token;
/**
@ -120,15 +121,3 @@ class WharfInfiltratorDiscardAbility extends TriggeredAbilityImpl {
return "Whenever you discard a creature card, " + super.getRule();
}
}
class EldraziHorrorToken extends Token {
public EldraziHorrorToken() {
super("Eldrazi Horror", "3/2 colorless Eldrazi Horror creature token");
cardType.add(CardType.CREATURE);
subtype.add("Eldrazi");
subtype.add("Horror");
power = new MageInt(3);
toughness = new MageInt(2);
}
}

View file

@ -31,6 +31,7 @@ import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.ChromaOutrageShamanCount;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.Effect;

View file

@ -31,15 +31,12 @@ import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.ChromaOutrageShamanCount;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.filter.common.FilterControlledPermanent;
import mage.game.Game;
import mage.target.common.TargetCreaturePermanent;
/**
@ -77,31 +74,3 @@ public class OutrageShaman extends CardImpl {
}
}
class ChromaOutrageShamanCount implements DynamicValue {
private int chroma;
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
chroma = 0;
for (Card card : game.getBattlefield().getAllActivePermanents(new FilterControlledPermanent(), sourceAbility.getControllerId(), game)) {
chroma += card.getManaCost().getMana().getRed();
}
return chroma;
}
@Override
public DynamicValue copy() {
return new ChromaOutrageShamanCount();
}
@Override
public String toString() {
return "1";
}
@Override
public String getMessage() {
return "";
}
}

View file

@ -101,12 +101,12 @@ class DwarvenArmorerEffect extends OneShotEffect {
super(effect);
}
@java.lang.Override
@Override
public DwarvenArmorerEffect copy() {
return new DwarvenArmorerEffect(this);
}
@java.lang.Override
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if(controller != null) {

View file

@ -27,23 +27,20 @@
*/
package mage.sets.fatereforged;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.condition.LockedInCondition;
import mage.abilities.condition.common.FerociousCondition;
import mage.abilities.decorator.ConditionalContinuousRuleModifyingEffect;
import mage.abilities.effects.ContinuousRuleModifyingEffect;
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.effects.common.continuous.DamageCantBePreventedEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.target.common.TargetCreatureOrPlayer;
import java.util.UUID;
/**
*
* @author jeffwadsworth
@ -55,7 +52,7 @@ public class WildSlash extends CardImpl {
this.expansionSetCode = "FRF";
// <i>Ferocious</i> If you control a creature with power 4 or greater, damage can't be prevented this turn.
ContinuousRuleModifyingEffect effect = new DamageCantBePreventedEffect();
ContinuousRuleModifyingEffect effect = new DamageCantBePreventedEffect(Duration.EndOfTurn, "damage can't be prevented this turn", false, false);
effect.setText("<i>Ferocious</i> &mdash; If you control a creature with power 4 or greater, damage can't be prevented this turn.<br>");
this.getSpellAbility().addEffect(new ConditionalContinuousRuleModifyingEffect(effect,
new LockedInCondition(FerociousCondition.getInstance())));
@ -75,30 +72,3 @@ public class WildSlash extends CardImpl {
return new WildSlash(this);
}
}
class DamageCantBePreventedEffect extends ContinuousRuleModifyingEffectImpl {
public DamageCantBePreventedEffect() {
super(Duration.EndOfTurn, Outcome.Benefit, false, false);
staticText = "damage can't be prevented this turn";
}
public DamageCantBePreventedEffect(final DamageCantBePreventedEffect effect) {
super(effect);
}
@Override
public DamageCantBePreventedEffect copy() {
return new DamageCantBePreventedEffect(this);
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.PREVENT_DAMAGE;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
return true;
}
}

View file

@ -76,91 +76,91 @@ public class PrimalClay extends CardImpl {
public PrimalClay copy() {
return new PrimalClay(this);
}
}
class PrimalPlasmaReplacementEffect extends ReplacementEffectImpl {
class PrimalPlasmaReplacementEffect extends ReplacementEffectImpl {
private final String choice33 = "a 3/3 creature";
private final String choice22 = "a 2/2 creature with flying";
private final String choice16 = "a 1/6 creature with defender";
private final String choice33 = "a 3/3 artifact creature";
private final String choice22 = "a 2/2 artifact creature with flying";
private final String choice16 = "a 1/6 artifact creature with defender";
public PrimalPlasmaReplacementEffect() {
super(Duration.WhileOnBattlefield, Outcome.Benefit);
staticText = "As {this} enters the battlefield, it becomes your choice of a 3/3 artifact creature, a 2/2 artifact creature with flying, or a 1/6 Wall artifact creature with defender in addition to its other types";
}
public PrimalPlasmaReplacementEffect(PrimalPlasmaReplacementEffect effect) {
super(effect);
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType().equals(EventType.ENTERS_THE_BATTLEFIELD);
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getTargetId().equals(source.getSourceId())) {
Permanent sourcePermanent = ((EntersTheBattlefieldEvent) event).getTarget();
if (sourcePermanent != null && !sourcePermanent.isFaceDown(game)) {
return true;
}
public PrimalPlasmaReplacementEffect() {
super(Duration.WhileOnBattlefield, Outcome.Benefit);
staticText = "As {this} enters the battlefield, it becomes your choice of a 3/3 artifact creature, a 2/2 artifact creature with flying, or a 1/6 Wall artifact creature with defender in addition to its other types";
}
return false;
}
@Override
public boolean apply(Game game, Ability source) {
return false;
}
public PrimalPlasmaReplacementEffect(PrimalPlasmaReplacementEffect effect) {
super(effect);
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget();
if (permanent != null) {
Choice choice = new ChoiceImpl(true);
choice.setMessage("Choose what " + permanent.getIdName() + " becomes to");
choice.getChoices().add(choice33);
choice.getChoices().add(choice22);
choice.getChoices().add(choice16);
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
while (!choice.isChosen()) {
controller.choose(Outcome.Neutral, choice, game);
if (!controller.canRespond()) {
return false;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType().equals(EventType.ENTERS_THE_BATTLEFIELD);
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getTargetId().equals(source.getSourceId())) {
Permanent sourcePermanent = ((EntersTheBattlefieldEvent) event).getTarget();
if (sourcePermanent != null && !sourcePermanent.isFaceDown(game)) {
return true;
}
}
int power = 0;
int toughness = 0;
switch (choice.getChoice()) {
case choice33:
power = 3;
toughness = 3;
break;
case choice22:
power = 2;
toughness = 2;
game.addEffect(new GainAbilitySourceEffect(FlyingAbility.getInstance(), Duration.Custom), source);
break;
case choice16:
power = 1;
toughness = 6;
game.addEffect(new GainAbilitySourceEffect(DefenderAbility.getInstance(), Duration.Custom), source);
break;
}
permanent.getPower().modifyBaseValue(power);
permanent.getToughness().modifyBaseValue(toughness);
// game.addEffect(new SetPowerToughnessSourceEffect(power, toughness, Duration.Custom, SubLayer.SetPT_7b), source);
return false;
}
@Override
public boolean apply(Game game, Ability source) {
return false;
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget();
if (permanent != null) {
Choice choice = new ChoiceImpl(true);
choice.setMessage("Choose what " + permanent.getIdName() + " becomes to");
choice.getChoices().add(choice33);
choice.getChoices().add(choice22);
choice.getChoices().add(choice16);
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
while (!choice.isChosen()) {
controller.choose(Outcome.Neutral, choice, game);
if (!controller.canRespond()) {
return false;
}
}
}
int power = 0;
int toughness = 0;
switch (choice.getChoice()) {
case choice33:
power = 3;
toughness = 3;
break;
case choice22:
power = 2;
toughness = 2;
game.addEffect(new GainAbilitySourceEffect(FlyingAbility.getInstance(), Duration.Custom), source);
break;
case choice16:
power = 1;
toughness = 6;
game.addEffect(new GainAbilitySourceEffect(DefenderAbility.getInstance(), Duration.Custom), source);
break;
}
permanent.getPower().modifyBaseValue(power);
permanent.getToughness().modifyBaseValue(toughness);
// game.addEffect(new SetPowerToughnessSourceEffect(power, toughness, Duration.Custom, SubLayer.SetPT_7b), source);
}
return false;
}
@Override
public PrimalPlasmaReplacementEffect copy() {
return new PrimalPlasmaReplacementEffect(this);
}
return false;
}
@Override
public PrimalPlasmaReplacementEffect copy() {
return new PrimalPlasmaReplacementEffect(this);
}
}

View file

@ -123,7 +123,7 @@ class ClockworkAvianEffect extends OneShotEffect {
super(effect);
}
@java.lang.Override
@Override
public boolean apply(Game game, Ability source) {
Permanent p = game.getPermanent(source.getSourceId());
if (p != null) {
@ -133,7 +133,7 @@ class ClockworkAvianEffect extends OneShotEffect {
return false;
}
@java.lang.Override
@Override
public ClockworkAvianEffect copy() {
return new ClockworkAvianEffect(this);
}

View file

@ -27,12 +27,11 @@
*/
package mage.sets.gatecrash;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.AdditionalCombatPhaseEffect;
import mage.abilities.effects.common.UntapAllControllerEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.HasteAbility;
@ -40,15 +39,14 @@ import mage.abilities.keyword.VigilanceAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.TurnPhase;
import mage.constants.Zone;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.turn.TurnMod;
import java.util.UUID;
/**
*
@ -156,26 +154,3 @@ class AureliaAttacksTriggeredAbility extends TriggeredAbilityImpl {
return new AureliaAttacksTriggeredAbility(this);
}
}
class AdditionalCombatPhaseEffect extends OneShotEffect {
public AdditionalCombatPhaseEffect() {
super(Outcome.Benefit);
staticText = "After this phase, there is an additional combat phase";
}
public AdditionalCombatPhaseEffect(final AdditionalCombatPhaseEffect effect) {
super(effect);
}
@Override
public AdditionalCombatPhaseEffect copy() {
return new AdditionalCombatPhaseEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
game.getState().getTurnMods().add(new TurnMod(source.getControllerId(), TurnPhase.COMBAT, null, false));
return true;
}
}

View file

@ -27,21 +27,21 @@
*/
package mage.sets.gatecrash;
import java.util.List;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.Token;
import mage.game.permanent.token.OozeToken;
import mage.players.Player;
import java.util.List;
import java.util.UUID;
/**
*
* @author LevelX2
@ -103,15 +103,3 @@ class MimingSlimeEffect extends OneShotEffect {
return false;
}
}
class OozeToken extends Token {
public OozeToken() {
super("Ooze", "X/X green Ooze creature token");
cardType.add(CardType.CREATURE);
subtype.add("Ooze");
color.setGreen(true);
power = new MageInt(0);
toughness = new MageInt(0);
setOriginalExpansionSetCode("RTR");
}
}

View file

@ -42,6 +42,7 @@ import mage.cards.CardImpl;
import mage.counters.CounterType;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.game.Game;
import mage.game.permanent.token.OozeToken;
import mage.game.permanent.token.Token;
/**

View file

@ -66,7 +66,7 @@ public class PrimeSpeakerZegana extends CardImpl {
//Prime Speaker Zegana enters the battlefield with X +1/+1 counters on it, where X is the greatest power among other creatures you control.
this.addAbility(new EntersBattlefieldAbility(
new AddCountersSourceEffect(CounterType.P1P1.createInstance(0),
new greatestPowerCount(), true),
new GreatestPowerCount(), true),
"where X is the greatest power among other creatures you control"));
//When Prime Speaker Zegana enters the battlefield, draw cards equal to its power.
this.addAbility(new EntersBattlefieldTriggeredAbility(new DrawCardSourceControllerEffect(new SourcePermanentPowerCount())));
@ -82,7 +82,7 @@ public class PrimeSpeakerZegana extends CardImpl {
}
}
class greatestPowerCount implements DynamicValue {
class GreatestPowerCount implements DynamicValue {
@Override
@ -98,7 +98,7 @@ class greatestPowerCount implements DynamicValue {
@Override
public DynamicValue copy() {
return new greatestPowerCount();
return new GreatestPowerCount();
}
@Override

View file

@ -27,21 +27,17 @@
*/
package mage.sets.gatecrash;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.effects.common.continuous.CantGainLifeAllEffect;
import mage.abilities.effects.common.continuous.DamageCantBePreventedEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.constants.Rarity;
import mage.target.TargetPlayer;
import java.util.UUID;
/**
*
* @author LevelX2
@ -55,7 +51,7 @@ public class Skullcrack extends CardImpl {
// Players can't gain life this turn. Damage can't be prevented this turn. Skullcrack deals 3 damage to target player.
this.getSpellAbility().addEffect(new CantGainLifeAllEffect(Duration.EndOfTurn));
this.getSpellAbility().addEffect(new DamageCantBePreventedEffect());
this.getSpellAbility().addEffect(new DamageCantBePreventedEffect(Duration.EndOfTurn, "Damage can't be prevented this turn", true, false));
this.getSpellAbility().addEffect(new DamageTargetEffect(3));
this.getSpellAbility().addTarget(new TargetPlayer());
@ -70,35 +66,3 @@ public class Skullcrack extends CardImpl {
return new Skullcrack(this);
}
}
class DamageCantBePreventedEffect extends ContinuousRuleModifyingEffectImpl {
public DamageCantBePreventedEffect() {
super(Duration.EndOfTurn, Outcome.Benefit);
staticText = "Damage can't be prevented this turn";
}
public DamageCantBePreventedEffect(final DamageCantBePreventedEffect effect) {
super(effect);
}
@Override
public DamageCantBePreventedEffect copy() {
return new DamageCantBePreventedEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.PREVENT_DAMAGE;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
return true;
}
}

View file

@ -96,7 +96,7 @@ class SpellRuptureCounterUnlessPaysEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = game.getObject(source.getSourceId());
if (player != null && controller != null && sourceObject != null) {
int amount = new greatestPowerCountCreatureYouControl().calculate(game, source, this);
int amount = new GreatestPowerCountCreatureYouControl().calculate(game, source, this);
GenericManaCost cost = new GenericManaCost(amount);
StringBuilder sb = new StringBuilder("Pay {").append(amount).append("}? (otherwise ").append(spell.getName()).append(" will be countered)");
if (player.chooseUse(Outcome.Benefit, sb.toString(), source, game)) {
@ -120,7 +120,7 @@ class SpellRuptureCounterUnlessPaysEffect extends OneShotEffect {
}
}
class greatestPowerCountCreatureYouControl implements DynamicValue {
class GreatestPowerCountCreatureYouControl implements DynamicValue {
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
@ -135,7 +135,7 @@ class greatestPowerCountCreatureYouControl implements DynamicValue {
@Override
public DynamicValue copy() {
return new greatestPowerCount();
return new GreatestPowerCountCreatureYouControl();
}
@Override

View file

@ -36,6 +36,7 @@ import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.HauntAbility;
import mage.cards.CardImpl;
import mage.game.permanent.token.BatToken;
/**
*

View file

@ -43,7 +43,7 @@ import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.permanent.token.Token;
import mage.game.permanent.token.BatToken;
import mage.target.common.TargetControlledCreaturePermanent;
/**
@ -89,17 +89,3 @@ public class SkeletalVampire extends CardImpl {
}
}
class BatToken extends Token {
BatToken() {
super("Bat", "1/1 black Bat creature token with flying");
cardType.add(CardType.CREATURE);
color.setBlack(true);
subtype.add("Bat");
power = new MageInt(1);
toughness = new MageInt(1);
this.addAbility(FlyingAbility.getInstance());
this.setOriginalExpansionSetCode("MMA");
}
}

View file

@ -27,7 +27,6 @@
*/
package mage.sets.homelands;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.LeavesBattlefieldTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
@ -36,7 +35,6 @@ import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.DestroyAllEffect;
import mage.abilities.effects.common.RegenerateSourceEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
@ -45,9 +43,11 @@ import mage.filter.FilterPermanent;
import mage.filter.common.FilterCreatureCard;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.TokenPredicate;
import mage.game.permanent.token.Token;
import mage.game.permanent.token.SkeletonToken;
import mage.target.common.TargetCardInYourGraveyard;
import java.util.UUID;
/**
*
* @author fireshoes
@ -85,18 +85,3 @@ public class DrudgeSpell extends CardImpl {
return new DrudgeSpell(this);
}
}
class SkeletonToken extends Token {
SkeletonToken() {
super("Skeleton", "1/1 black Skeleton creature token onto the battlefield. It has \"{B}: Regenerate this creature.\"");
this.setOriginalExpansionSetCode("HML");
this.getPower().modifyBaseValue(1);
this.getToughness().modifyBaseValue(1);
this.color.setBlack(true);
this.getSubtype(null).add("Skeleton");
this.getCardType().add(CardType.CREATURE);
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new RegenerateSourceEffect(), new ManaCostsImpl("{B}")));
}
}

View file

@ -91,16 +91,16 @@ public class BloodlineKeeper extends CardImpl {
public BloodlineKeeper copy() {
return new BloodlineKeeper(this);
}
}
class VampireToken extends Token {
VampireToken() {
super("Vampire", "a 2/2 black Vampire creature token with flying");
cardType.add(CardType.CREATURE);
color.setBlack(true);
subtype.add("Vampire");
power = new MageInt(2);
toughness = new MageInt(2);
addAbility(FlyingAbility.getInstance());
class VampireToken extends Token {
VampireToken() {
super("Vampire", "a 2/2 black Vampire creature token with flying");
cardType.add(CardType.CREATURE);
color.setBlack(true);
subtype.add("Vampire");
power = new MageInt(2);
toughness = new MageInt(2);
addAbility(FlyingAbility.getInstance());
}
}
}

View file

@ -43,6 +43,7 @@ import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.permanent.token.Token;
/**
*
@ -83,4 +84,16 @@ public class LordOfLineage extends CardImpl {
public LordOfLineage copy() {
return new LordOfLineage(this);
}
class VampireToken extends Token {
VampireToken() {
super("Vampire", "a 2/2 black Vampire creature token with flying");
cardType.add(CardType.CREATURE);
color.setBlack(true);
subtype.add("Vampire");
power = new MageInt(2);
toughness = new MageInt(2);
addAbility(FlyingAbility.getInstance());
}
}
}

View file

@ -37,7 +37,7 @@ import mage.abilities.keyword.InspiredAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.sets.bornofthegods.TokenAndCounters.GoldToken;
import mage.game.permanent.token.GoldToken;
import mage.target.common.TargetCreaturePermanent;

View file

@ -27,19 +27,16 @@
*/
package mage.sets.judgment;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
import mage.abilities.effects.common.continuous.DamageCantBePreventedEffect;
import mage.abilities.keyword.FlashbackAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.TimingRule;
import mage.game.Game;
import mage.game.events.GameEvent;
import java.util.UUID;
/**
*
@ -53,7 +50,7 @@ public class FlaringPain extends CardImpl {
// Damage can't be prevented this turn.
this.getSpellAbility().addEffect(new DamageCantBePreventedEffect());
this.getSpellAbility().addEffect(new DamageCantBePreventedEffect(Duration.EndOfTurn, "Damage can't be prevented this turn", false, false));
// Flashback {R}
this.addAbility(new FlashbackAbility(new ManaCostsImpl("{R}"), TimingRule.INSTANT));
}
@ -67,33 +64,3 @@ public class FlaringPain extends CardImpl {
return new FlaringPain(this);
}
}
class DamageCantBePreventedEffect extends ContinuousRuleModifyingEffectImpl {
public DamageCantBePreventedEffect() {
super(Duration.EndOfTurn, Outcome.Benefit, false, false);
staticText = "Damage can't be prevented this turn";
}
public DamageCantBePreventedEffect(final DamageCantBePreventedEffect effect) {
super(effect);
}
@Override
public DamageCantBePreventedEffect copy() {
return new DamageCantBePreventedEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType().equals(GameEvent.EventType.PREVENT_DAMAGE)) {
return true;
}
return false;
}
}

View file

@ -31,6 +31,7 @@ import java.util.UUID;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.CrewsVehicleSourceTriggeredAbility;
import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
import mage.abilities.keyword.FirstStrikeAbility;
import mage.cards.CardImpl;
@ -72,41 +73,3 @@ public class GearshiftAce extends CardImpl {
return new GearshiftAce(this);
}
}
class GearshiftAceTriggeredAbility extends TriggeredAbilityImpl {
public GearshiftAceTriggeredAbility(Effect effect) {
super(Zone.BATTLEFIELD, effect, false);
}
public GearshiftAceTriggeredAbility(final GearshiftAceTriggeredAbility ability) {
super(ability);
}
@Override
public GearshiftAceTriggeredAbility copy() {
return new GearshiftAceTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.CREWED_VEHICLE;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getTargetId().equals(getSourceId())) {
for (Effect effect : getEffects()) {
// set the vehicle id as target
effect.setTargetPointer(new FixedTarget(event.getSourceId()));
}
return true;
}
return false;
}
@Override
public String getRule() {
return "When {this} crews a Vehicle, " + super.getRule();
}
}

View file

@ -29,18 +29,13 @@ package mage.sets.kaladesh;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.CrewsVehicleSourceTriggeredAbility;
import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
import mage.abilities.keyword.HasteAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.target.targetpointer.FixedTarget;
/**
*
@ -74,40 +69,3 @@ public class SpeedwayFanatic extends CardImpl {
}
}
class CrewsVehicleSourceTriggeredAbility extends TriggeredAbilityImpl {
public CrewsVehicleSourceTriggeredAbility(Effect effect) {
super(Zone.BATTLEFIELD, effect, false);
}
public CrewsVehicleSourceTriggeredAbility(final CrewsVehicleSourceTriggeredAbility ability) {
super(ability);
}
@Override
public CrewsVehicleSourceTriggeredAbility copy() {
return new CrewsVehicleSourceTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.CREWED_VEHICLE;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getTargetId().equals(getSourceId())) {
for (Effect effect : getEffects()) {
// set the vehicle id as target
effect.setTargetPointer(new FixedTarget(event.getSourceId()));
}
return true;
}
return false;
}
@Override
public String getRule() {
return "When {this} crews a Vehicle, " + super.getRule();
}
}

View file

@ -32,6 +32,7 @@ import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.CrewsVehicleSourceTriggeredAbility;
import mage.abilities.effects.common.continuous.BoostTargetEffect;
import mage.abilities.effects.keyword.ScryEffect;
import mage.cards.CardImpl;
@ -63,7 +64,7 @@ public class VeteranMotorist extends CardImpl {
// Whenever Veteran Motorist crews a Vehicle, that Vehicle gets +1/+1 until end of turn.
Effect effect = new BoostTargetEffect(1, 1, Duration.EndOfTurn);
effect.setText("that Vehicle gets +1/+1 until end of turn");
this.addAbility(new VeteranMotoristCrewsTriggeredAbility(effect));
this.addAbility(new CrewsVehicleSourceTriggeredAbility(effect));
}
public VeteranMotorist(final VeteranMotorist card) {
@ -75,41 +76,3 @@ public class VeteranMotorist extends CardImpl {
return new VeteranMotorist(this);
}
}
class VeteranMotoristCrewsTriggeredAbility extends TriggeredAbilityImpl {
public VeteranMotoristCrewsTriggeredAbility(Effect effect) {
super(Zone.BATTLEFIELD, effect, false);
}
public VeteranMotoristCrewsTriggeredAbility(final VeteranMotoristCrewsTriggeredAbility ability) {
super(ability);
}
@Override
public VeteranMotoristCrewsTriggeredAbility copy() {
return new VeteranMotoristCrewsTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.CREWED_VEHICLE;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getTargetId().equals(getSourceId())) {
for (Effect effect : getEffects()) {
// set the vehicle id as target
effect.setTargetPointer(new FixedTarget(event.getSourceId()));
}
return true;
}
return false;
}
@Override
public String getRule() {
return "When {this} crews a Vehicle, " + super.getRule();
}
}

View file

@ -77,7 +77,7 @@ public class SorinSolemnVisitor extends CardImpl {
this.addAbility(new LoyaltyAbility(new CreateTokenEffect(new SorinSolemnVisitorVampireToken()), -2));
// -6: You get an emblem with "At the beginning of each opponent's upkeep, that player sacrifices a creature."
this.addAbility(new LoyaltyAbility(new GetEmblemEffect(new SorinEmblem()), -6));
this.addAbility(new LoyaltyAbility(new GetEmblemEffect(new SorinSolemnVisitorEmblem()), -6));
}
@ -95,9 +95,9 @@ public class SorinSolemnVisitor extends CardImpl {
* Emblem: "At the beginning of each opponent's upkeep, that player sacrifices a
* creature."
*/
class SorinEmblem extends Emblem {
class SorinSolemnVisitorEmblem extends Emblem {
public SorinEmblem() {
public SorinSolemnVisitorEmblem() {
this.setName("EMBLEM: Sorin, Solemn Visitor");
Ability ability = new BeginningOfUpkeepTriggeredAbility(Zone.COMMAND, new SacrificeEffect(new FilterCreaturePermanent(), 1, "that player"), TargetController.OPPONENT, false, true);
this.getAbilities().add(ability);

View file

@ -78,17 +78,17 @@ class PresenceOfTheMasterTriggeredAbility extends TriggeredAbilityImpl {
super(abiltity);
}
@java.lang.Override
@Override
public PresenceOfTheMasterTriggeredAbility copy() {
return new PresenceOfTheMasterTriggeredAbility(this);
}
@java.lang.Override
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.SPELL_CAST;
}
@java.lang.Override
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Spell spell = game.getStack().getSpell(event.getTargetId());
if (spell != null && (spell.getCardType().contains(CardType.ENCHANTMENT))){
@ -100,7 +100,7 @@ class PresenceOfTheMasterTriggeredAbility extends TriggeredAbilityImpl {
return false;
}
@java.lang.Override
@Override
public String getRule() {
return "Whenever a player casts an enchantment spell, counter it";
}
@ -117,12 +117,12 @@ class CounterEffect extends OneShotEffect {
super(effect);
}
@java.lang.Override
@Override
public CounterEffect copy() {
return new CounterEffect(this);
}
@java.lang.Override
@Override
public boolean apply(Game game, Ability source) {
return game.getStack().counter(this.getTargetPointer().getFirst(game, source), source.getSourceId(), game);
}

View file

@ -32,13 +32,13 @@ import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.RestrictionEffect;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.combat.CantBeBlockedByCreaturesAttachedEffect;
import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.constants.*;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.TargetPermanent;
@ -50,12 +50,16 @@ import mage.target.common.TargetCreaturePermanent;
*/
public class Invisibility extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("except by Walls");
static {
filter.add(Predicates.not(new SubtypePredicate("Wall")));
}
public Invisibility(UUID ownerId) {
super(ownerId, 60, "Invisibility", Rarity.COMMON, new CardType[]{CardType.ENCHANTMENT}, "{U}{U}");
this.expansionSetCode = "LEA";
this.subtype.add("Aura");
// Enchant creature
TargetPermanent auraTarget = new TargetCreaturePermanent();
this.getSpellAbility().addTarget(auraTarget);
@ -64,7 +68,8 @@ public class Invisibility extends CardImpl {
this.addAbility(ability);
// Enchanted creature can't be blocked except by Walls.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantBeBlockedByWallsEffect()));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD,
new CantBeBlockedByCreaturesAttachedEffect(Duration.WhileOnBattlefield, filter, AttachmentType.AURA)));
}
public Invisibility(final Invisibility card) {
@ -76,39 +81,3 @@ public class Invisibility extends CardImpl {
return new Invisibility(this);
}
}
class CantBeBlockedByWallsEffect extends RestrictionEffect {
public CantBeBlockedByWallsEffect() {
super(Duration.WhileOnBattlefield);
staticText = "Enchanted creature can't be blocked except by Walls";
}
public CantBeBlockedByWallsEffect(final CantBeBlockedByWallsEffect effect) {
super(effect);
}
@Override
public boolean applies(Permanent permanent, Ability source, Game game) {
Permanent enchantment = game.getPermanent(source.getSourceId());
if (enchantment != null && enchantment.getAttachedTo() != null) {
if (permanent.getId().equals(enchantment.getAttachedTo())) {
return true;
}
}
return false;
}
@Override
public boolean canBeBlocked(Permanent attacker, Permanent blocker, Ability source, Game game) {
if (!blocker.hasSubtype("Wall", game)) {
return false;
}
return true;
}
@Override
public CantBeBlockedByWallsEffect copy() {
return new CantBeBlockedByWallsEffect(this);
}
}

View file

@ -39,16 +39,12 @@ import mage.cards.CardImpl;
*
* @author Loki
*/
public class SnappingDrake extends CardImpl {
public class SnappingDrake extends mage.sets.ravnica.SnappingDrake {
public SnappingDrake(UUID ownerId) {
super(ownerId, 72, "Snapping Drake", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{3}{U}");
super(ownerId);
this.cardNumber = "72";
this.expansionSetCode = "M10";
this.subtype.add("Drake");
this.power = new MageInt(3);
this.toughness = new MageInt(2);
this.addAbility(FlyingAbility.getInstance());
}
public SnappingDrake(final SnappingDrake card) {

View file

@ -35,6 +35,7 @@ import mage.MageInt;
import mage.abilities.common.DiesTriggeredAbility;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.cards.CardImpl;
import mage.game.permanent.token.OozeToken;
import mage.game.permanent.token.Token;
/**
@ -74,18 +75,6 @@ class Ooze2Token extends Token {
color.setGreen(true);
power = new MageInt(2);
toughness = new MageInt(2);
this.addAbility(new DiesTriggeredAbility(new CreateTokenEffect(new Ooze1Token(), 2), false));
}
}
class Ooze1Token extends Token {
public Ooze1Token() {
super("Ooze", "1/1 green Ooze creature tokens");
cardType.add(CardType.CREATURE);
subtype.add("Ooze");
color.setGreen(true);
power = new MageInt(1);
toughness = new MageInt(1);
this.addAbility(new DiesTriggeredAbility(new CreateTokenEffect(new OozeToken(new MageInt(1), new MageInt(1)), 2), false));
}
}

View file

@ -81,16 +81,16 @@ public class HellionCrucible extends CardImpl {
public HellionCrucible copy() {
return new HellionCrucible(this);
}
}
class HellionToken extends Token {
public HellionToken() {
super("Hellion", "4/4 red Hellion creature token with haste");
cardType.add(CardType.CREATURE);
color.setRed(true);
subtype.add("Hellion");
power = new MageInt(4);
toughness = new MageInt(4);
addAbility(HasteAbility.getInstance());
class HellionToken extends Token {
public HellionToken() {
super("Hellion", "4/4 red Hellion creature token with haste");
cardType.add(CardType.CREATURE);
color.setRed(true);
subtype.add("Hellion");
power = new MageInt(4);
toughness = new MageInt(4);
addAbility(HasteAbility.getInstance());
}
}
}

View file

@ -73,20 +73,20 @@ public class DragonEgg extends CardImpl {
public DragonEgg copy() {
return new DragonEgg(this);
}
}
class DragonToken extends Token {
class DragonToken extends Token {
DragonToken() {
super("Dragon", "2/2 red Dragon creature token with flying that has \"{R}: This creature gets +1/+0 until end of turn");
this.setOriginalExpansionSetCode("M14");
cardType.add(CardType.CREATURE);
color.setRed(true);
subtype.add("Dragon");
power = new MageInt(2);
toughness = new MageInt(2);
addAbility(FlyingAbility.getInstance());
addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(1, 0, Duration.EndOfTurn), new ManaCostsImpl("{R}")));
DragonToken() {
super("Dragon", "2/2 red Dragon creature token with flying that has \"{R}: This creature gets +1/+0 until end of turn");
this.setOriginalExpansionSetCode("M14");
cardType.add(CardType.CREATURE);
color.setRed(true);
subtype.add("Dragon");
power = new MageInt(2);
toughness = new MageInt(2);
addAbility(FlyingAbility.getInstance());
addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(1, 0, Duration.EndOfTurn), new ManaCostsImpl("{R}")));
}
}
}
}

View file

@ -100,18 +100,18 @@ class MoltenBirthEffect extends OneShotEffect {
}
return false;
}
}
class ElementalToken extends Token {
class ElementalToken extends Token {
public ElementalToken() {
super("Elemental", "1/1 red Elemental creature");
this.setOriginalExpansionSetCode("M14");
this.setTokenType(RandomUtil.nextInt(2) + 1);
cardType.add(CardType.CREATURE);
color.setRed(true);
subtype.add("Elemental");
power = new MageInt(1);
toughness = new MageInt(1);
public ElementalToken() {
super("Elemental", "1/1 red Elemental creature");
this.setOriginalExpansionSetCode("M14");
this.setTokenType(RandomUtil.nextInt(2) + 1);
cardType.add(CardType.CREATURE);
color.setRed(true);
subtype.add("Elemental");
power = new MageInt(1);
toughness = new MageInt(1);
}
}
}
}

View file

@ -37,6 +37,8 @@ import mage.constants.Rarity;
import mage.filter.FilterSpell;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.game.permanent.token.Token;
import mage.util.RandomUtil;
/**
*
@ -74,4 +76,18 @@ public class YoungPyromancer extends CardImpl {
public YoungPyromancer copy() {
return new YoungPyromancer(this);
}
class ElementalToken extends Token {
public ElementalToken() {
super("Elemental", "1/1 red Elemental creature");
this.setOriginalExpansionSetCode("M14");
this.setTokenType(RandomUtil.nextInt(2) + 1);
cardType.add(CardType.CREATURE);
color.setRed(true);
subtype.add("Elemental");
power = new MageInt(1);
toughness = new MageInt(1);
}
}
}

View file

@ -39,19 +39,12 @@ import mage.constants.Rarity;
*
* @author LevelX2
*/
public class EagleOfTheWatch extends CardImpl {
public class EagleOfTheWatch extends mage.sets.journeyintonyx.EagleOfTheWatch {
public EagleOfTheWatch(UUID ownerId) {
super(ownerId, 275, "Eagle of the Watch", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{2}{W}");
super(ownerId);
this.cardNumber = "275";
this.expansionSetCode = "ORI";
this.subtype.add("Bird");
this.power = new MageInt(2);
this.toughness = new MageInt(1);
// Flying
this.addAbility(FlyingAbility.getInstance());
// Vigilance
this.addAbility(VigilanceAbility.getInstance());
}
public EagleOfTheWatch(final EagleOfTheWatch card) {

View file

@ -27,18 +27,16 @@
*/
package mage.sets.mastersedition;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.CardsInTargetHandCount;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetPlayer;
import java.util.UUID;
/**
*
* @author hanasu
@ -50,7 +48,7 @@ public class StormSeeker extends CardImpl {
this.expansionSetCode = "MED";
// Storm Seeker deals damage to target player equal to the number of cards in that player's hand.
Effect effect = new DamageTargetEffect(new TargetPlayerCardsInHandCount());
Effect effect = new DamageTargetEffect(new CardsInTargetHandCount());
effect.setText("{this} deals damage to target player equal to the number of cards in that player's hand.");
this.getSpellAbility().addEffect(effect);
this.getSpellAbility().addTarget(new TargetPlayer());
@ -65,31 +63,3 @@ public class StormSeeker extends CardImpl {
return new StormSeeker(this);
}
}
class TargetPlayerCardsInHandCount implements DynamicValue {
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
Player targetPlayer = game.getPlayer(sourceAbility.getFirstTarget());
if (targetPlayer != null) {
return targetPlayer.getHand().size();
}
return 0;
}
@Override
public DynamicValue copy() {
return new TargetPlayerCardsInHandCount();
}
@Override
public String toString() {
return "1";
}
@Override
public String getMessage() {
return "target player's cards in hand";
}
}

View file

@ -94,12 +94,12 @@ class InstigatorEffect extends OneShotEffect {
super(effect);
}
@java.lang.Override
@Override
public InstigatorEffect copy() {
return new InstigatorEffect(this);
}
@java.lang.Override
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(this.getTargetPointer().getFirst(game, source));
if (player != null) {

View file

@ -32,6 +32,7 @@ import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.RestrictionEffect;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.combat.CantBeBlockedByCreaturesAttachedEffect;
import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect;
import mage.abilities.keyword.EnchantAbility;
import mage.abilities.keyword.PhasingAbility;
@ -42,6 +43,9 @@ import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.TargetPermanent;
@ -52,6 +56,10 @@ import mage.target.common.TargetCreaturePermanent;
* @author fireshoes
*/
public class CloakOfInvisibility extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("except by Walls");
static {
filter.add(Predicates.not(new SubtypePredicate("Wall")));
}
public CloakOfInvisibility(UUID ownerId) {
super(ownerId, 58, "Cloak of Invisibility", Rarity.COMMON, new CardType[]{CardType.ENCHANTMENT}, "{U}");
@ -67,7 +75,7 @@ public class CloakOfInvisibility extends CardImpl {
// Enchanted creature has phasing and can't be blocked except by Walls.
ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(PhasingAbility.getInstance(), AttachmentType.AURA));
ability.addEffect(new CantBeBlockedByWallsEffect());
ability.addEffect(new CantBeBlockedByCreaturesAttachedEffect(Duration.WhileOnBattlefield, filter, AttachmentType.AURA));
this.addAbility(ability);
}
@ -80,39 +88,3 @@ public class CloakOfInvisibility extends CardImpl {
return new CloakOfInvisibility(this);
}
}
class CantBeBlockedByWallsEffect extends RestrictionEffect {
public CantBeBlockedByWallsEffect() {
super(Duration.WhileOnBattlefield);
staticText = "Enchanted creature can't be blocked except by Walls";
}
public CantBeBlockedByWallsEffect(final CantBeBlockedByWallsEffect effect) {
super(effect);
}
@Override
public boolean applies(Permanent permanent, Ability source, Game game) {
Permanent enchantment = game.getPermanent(source.getSourceId());
if (enchantment != null && enchantment.getAttachedTo() != null) {
if (permanent.getId().equals(enchantment.getAttachedTo())) {
return true;
}
}
return false;
}
@Override
public boolean canBeBlocked(Permanent attacker, Permanent blocker, Ability source, Game game) {
if (!blocker.hasSubtype("Wall", game)) {
return false;
}
return true;
}
@Override
public CantBeBlockedByWallsEffect copy() {
return new CantBeBlockedByWallsEffect(this);
}
}

View file

@ -45,7 +45,7 @@ public class AetherSpellbomb extends mage.sets.elspethvstezzeret.AetherSpellbomb
super(card);
}
@java.lang.Override
@Override
public AetherSpellbomb copy() {
return new AetherSpellbomb(this);
}

View file

@ -52,7 +52,7 @@ public class AlphaMyr extends CardImpl {
super(card);
}
@java.lang.Override
@Override
public AlphaMyr copy() {
return new AlphaMyr(this);
}

View file

@ -74,7 +74,7 @@ public class AltarOfShadows extends CardImpl {
super(card);
}
@java.lang.Override
@Override
public AltarOfShadows copy() {
return new AltarOfShadows(this);
}
@ -91,12 +91,12 @@ class AltarOfShadowsEffect extends OneShotEffect {
super(effect);
}
@java.lang.Override
@Override
public AltarOfShadowsEffect copy() {
return new AltarOfShadowsEffect(this);
}
@java.lang.Override
@Override
public boolean apply(Game game, Ability source) {
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
Player player = game.getPlayer(source.getControllerId());

View file

@ -64,7 +64,7 @@ public class AltarsLight extends CardImpl {
super(card);
}
@java.lang.Override
@Override
public AltarsLight copy() {
return new AltarsLight(this);
}

View file

@ -50,7 +50,7 @@ public class AncientDen extends CardImpl {
super(card);
}
@java.lang.Override
@Override
public AncientDen copy() {
return new AncientDen(this);
}

View file

@ -63,7 +63,7 @@ public class Annul extends CardImpl {
super(card);
}
@java.lang.Override
@Override
public Annul copy() {
return new Annul(this);
}

View file

@ -65,7 +65,7 @@ public class ArcSlogger extends CardImpl {
super(card);
}
@java.lang.Override
@Override
public ArcSlogger copy() {
return new ArcSlogger(this);
}

View file

@ -70,7 +70,7 @@ public class Arrest extends CardImpl {
super(card);
}
@java.lang.Override
@Override
public Arrest copy() {
return new Arrest(this);
}

View file

@ -58,7 +58,7 @@ public class AssertAuthority extends CardImpl {
super(card);
}
@java.lang.Override
@Override
public AssertAuthority copy() {
return new AssertAuthority(this);
}

View file

@ -68,7 +68,7 @@ public class Atog extends CardImpl {
super(card);
}
@java.lang.Override
@Override
public Atog copy() {
return new Atog(this);
}

View file

@ -67,7 +67,7 @@ public class AuriokBladewarden extends CardImpl {
super(card);
}
@java.lang.Override
@Override
public AuriokBladewarden copy() {
return new AuriokBladewarden(this);
}

View file

@ -80,7 +80,7 @@ public class AuriokSteelshaper extends CardImpl {
super(card);
}
@java.lang.Override
@Override
public AuriokSteelshaper copy() {
return new AuriokSteelshaper(this);
}

View file

@ -73,7 +73,7 @@ public class AuriokTransfixer extends CardImpl {
super(card);
}
@java.lang.Override
@Override
public AuriokTransfixer copy() {
return new AuriokTransfixer(this);
}

View file

@ -71,7 +71,7 @@ public class BansheesBlade extends CardImpl {
super(card);
}
@java.lang.Override
@Override
public BansheesBlade copy() {
return new BansheesBlade(this);
}
@ -91,12 +91,12 @@ class BansheesBladeAbility extends TriggeredAbilityImpl {
this.usedInPhase = ability.usedInPhase;
}
@java.lang.Override
@Override
public BansheesBladeAbility copy() {
return new BansheesBladeAbility(this);
}
@java.lang.Override
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.DAMAGED_PLAYER
|| event.getType() == EventType.DAMAGED_CREATURE
@ -104,7 +104,7 @@ class BansheesBladeAbility extends TriggeredAbilityImpl {
|| event.getType() == EventType.COMBAT_DAMAGE_STEP_PRE;
}
@java.lang.Override
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event instanceof DamagedEvent && ((DamagedEvent) event).isCombatDamage() && !usedInPhase) {
Permanent permanent = game.getPermanent(event.getSourceId());
@ -119,7 +119,7 @@ class BansheesBladeAbility extends TriggeredAbilityImpl {
return false;
}
@java.lang.Override
@Override
public String getRule() {
return "Whenever equipped creature deals combat damage, put a charge counter on {this}.";
}

View file

@ -45,7 +45,7 @@ public class BarterInBlood extends mage.sets.avacynrestored.BarterInBlood {
super(card);
}
@java.lang.Override
@Override
public BarterInBlood copy() {
return new BarterInBlood(this);
}

View file

@ -53,7 +53,7 @@ public class Battlegrowth extends CardImpl {
super(card);
}
@java.lang.Override
@Override
public Battlegrowth copy() {
return new Battlegrowth(this);
}

View file

@ -72,7 +72,7 @@ public class BetrayalOfFlesh extends CardImpl {
super(card);
}
@java.lang.Override
@Override
public BetrayalOfFlesh copy() {
return new BetrayalOfFlesh(this);
}

View file

@ -45,7 +45,7 @@ public class BlindingBeam extends mage.sets.elspethvstezzeret.BlindingBeam {
super(card);
}
@java.lang.Override
@Override
public BlindingBeam copy() {
return new BlindingBeam(this);
}

View file

@ -41,7 +41,7 @@ public class BlinkmothUrn extends CardImpl {
super(card);
}
@java.lang.Override
@Override
public BlinkmothUrn copy() {
return new BlinkmothUrn(this);
}
@ -59,12 +59,12 @@ class BlinkmothUrnEffect extends OneShotEffect {
super(effect);
}
@java.lang.Override
@Override
public BlinkmothUrnEffect copy() {
return new BlinkmothUrnEffect(this);
}
@java.lang.Override
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(game.getActivePlayerId());
FilterArtifactPermanent filter = new FilterArtifactPermanent("artifacts you control");

View file

@ -72,7 +72,7 @@ public class BlinkmothWell extends CardImpl {
super(card);
}
@java.lang.Override
@Override
public BlinkmothWell copy() {
return new BlinkmothWell(this);
}

View file

@ -55,7 +55,7 @@ public class Bloodscent extends CardImpl {
super(card);
}
@java.lang.Override
@Override
public Bloodscent copy() {
return new Bloodscent(this);
}

View file

@ -58,7 +58,7 @@ public class Bonesplitter extends CardImpl {
super(card);
}
@java.lang.Override
@Override
public Bonesplitter copy() {
return new Bonesplitter(this);
}

View file

@ -45,7 +45,7 @@ public class BoshIronGolem extends mage.sets.planechase.BoshIronGolem {
super(card);
}
@java.lang.Override
@Override
public BoshIronGolem copy() {
return new BoshIronGolem(this);
}

View file

@ -45,7 +45,7 @@ public class BottleGnomes extends mage.sets.tempest.BottleGnomes {
super(card);
}
@java.lang.Override
@Override
public BottleGnomes copy() {
return new BottleGnomes(this);
}

Some files were not shown because too many files have changed in this diff Show more