mirror of
https://github.com/magefree/mage.git
synced 2025-12-30 07:22:03 -08:00
redesigned evasion abilities and added restriction and requirement effects
This commit is contained in:
parent
ab1f0b5f11
commit
0ce1f50734
44 changed files with 839 additions and 356 deletions
|
|
@ -51,7 +51,7 @@ public class InkwellLeviathan extends CardImpl<InkwellLeviathan> {
|
|||
this.power = new MageInt(7);
|
||||
this.toughness = new MageInt(11);
|
||||
|
||||
this.addAbility(IslandwalkAbility.getInstance());
|
||||
this.addAbility(new IslandwalkAbility());
|
||||
this.addAbility(TrampleAbility.getInstance());
|
||||
this.addAbility(ShroudAbility.getInstance());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,8 @@ import mage.MageInt;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.effects.RequirementAttackEffect;
|
||||
import mage.abilities.effects.RequirementEffect;
|
||||
import mage.abilities.effects.common.AttacksIfAbleTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.game.Game;
|
||||
|
|
@ -85,7 +86,7 @@ public class AlluringSiren extends CardImpl<AlluringSiren> {
|
|||
|
||||
}
|
||||
|
||||
class AlluringSirenEffect extends RequirementAttackEffect<AlluringSirenEffect> {
|
||||
class AlluringSirenEffect extends AttacksIfAbleTargetEffect {
|
||||
|
||||
public AlluringSirenEffect() {
|
||||
super(Duration.EndOfTurn);
|
||||
|
|
@ -101,14 +102,8 @@ class AlluringSirenEffect extends RequirementAttackEffect<AlluringSirenEffect> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent creature = game.getPermanent(source.getFirstTarget());
|
||||
if (creature != null) {
|
||||
if (creature.canAttack(game)) {
|
||||
game.getCombat().declareAttacker(creature.getId(), source.getControllerId(), game);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
public UUID mustAttackDefender(Ability source, Game game) {
|
||||
return source.getControllerId();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ public class BogWraith extends CardImpl<BogWraith> {
|
|||
this.subtype.add("Wraith");
|
||||
this.power = new MageInt(3);
|
||||
this.toughness = new MageInt(3);
|
||||
this.addAbility(SwampwalkAbility.getInstance());
|
||||
this.addAbility(new SwampwalkAbility());
|
||||
}
|
||||
|
||||
public BogWraith(final BogWraith card) {
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ public class EmeraldOryx extends CardImpl<EmeraldOryx> {
|
|||
this.subtype.add("Antelope");
|
||||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(3);
|
||||
this.addAbility(ForestwalkAbility.getInstance());
|
||||
this.addAbility(new ForestwalkAbility());
|
||||
}
|
||||
|
||||
public EmeraldOryx(final EmeraldOryx card) {
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ package mage.sets.magic2010;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.Constants.CardType;
|
||||
import mage.Constants.Duration;
|
||||
import mage.Constants.Rarity;
|
||||
import mage.Constants.Zone;
|
||||
import mage.MageInt;
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ public class BogRaiders extends CardImpl<BogRaiders> {
|
|||
this.subtype.add("Zombie");
|
||||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(2);
|
||||
this.addAbility(SwampwalkAbility.getInstance());
|
||||
this.addAbility(new SwampwalkAbility());
|
||||
}
|
||||
|
||||
public BogRaiders(final BogRaiders card) {
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ class DryadsFavorEffect extends ContinuousEffectImpl<DryadsFavorEffect> {
|
|||
switch (layer) {
|
||||
case AbilityAddingRemovingEffects_6:
|
||||
if (sublayer == SubLayer.NA) {
|
||||
creature.addAbility(ForestwalkAbility.getInstance());
|
||||
creature.addAbility(new ForestwalkAbility());
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ public class HarborSerpent extends CardImpl<HarborSerpent> {
|
|||
this.power = new MageInt(5);
|
||||
this.toughness = new MageInt(5);
|
||||
|
||||
this.addAbility(IslandwalkAbility.getInstance());
|
||||
this.addAbility(new IslandwalkAbility());
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new HarborSerpentEffect()));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ public class Incite extends CardImpl<Incite> {
|
|||
this.color.setRed(true);
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
|
||||
this.getSpellAbility().addEffect(new InciteEffect());
|
||||
this.getSpellAbility().addEffect(new AttacksIfAbleTargetEffect());
|
||||
this.getSpellAbility().addEffect(new AttacksIfAbleTargetEffect(Duration.EndOfTurn));
|
||||
}
|
||||
|
||||
public Incite(final Incite card) {
|
||||
|
|
@ -93,6 +93,10 @@ class InciteEffect extends ContinuousEffectImpl<InciteEffect> {
|
|||
Permanent permanent = game.getPermanent(source.getFirstTarget());
|
||||
if (permanent != null) {
|
||||
permanent.getColor().setRed(true);
|
||||
permanent.getColor().setWhite(false);
|
||||
permanent.getColor().setGreen(false);
|
||||
permanent.getColor().setBlue(false);
|
||||
permanent.getColor().setBlack(false);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ public class MerfolkSpy extends CardImpl<MerfolkSpy> {
|
|||
this.power = new MageInt(1);
|
||||
this.toughness = new MageInt(1);
|
||||
|
||||
this.addAbility(IslandwalkAbility.getInstance());
|
||||
this.addAbility(new IslandwalkAbility());
|
||||
this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(new MerfolkSpyEffect(), false));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ public class StormtideLeviathan extends CardImpl<StormtideLeviathan> {
|
|||
this.power = new MageInt(8);
|
||||
this.toughness = new MageInt(8);
|
||||
|
||||
this.addAbility(IslandwalkAbility.getInstance());
|
||||
this.addAbility(new IslandwalkAbility());
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new StormtideLeviathanEffect()));
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new StormtideLeviathanEffect2()));
|
||||
|
||||
|
|
@ -119,6 +119,8 @@ class StormtideLeviathanEffect extends ContinuousEffectImpl<StormtideLeviathanEf
|
|||
|
||||
class StormtideLeviathanEffect2 extends ReplacementEffectImpl<StormtideLeviathanEffect2> {
|
||||
|
||||
private static IslandwalkAbility islandwalk = new IslandwalkAbility();
|
||||
|
||||
public StormtideLeviathanEffect2() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Detriment);
|
||||
}
|
||||
|
|
@ -150,7 +152,7 @@ class StormtideLeviathanEffect2 extends ReplacementEffectImpl<StormtideLeviathan
|
|||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player.getInRange().contains(permanent.getControllerId())) {
|
||||
if (!(permanent.getAbilities().containsKey(FlyingAbility.getInstance().getId()) ||
|
||||
permanent.getAbilities().containsKey(IslandwalkAbility.getInstance().getId())))
|
||||
permanent.getAbilities().contains(islandwalk)))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ class VolcanicStrengthEffect extends ContinuousEffectImpl<VolcanicStrengthEffect
|
|||
break;
|
||||
case AbilityAddingRemovingEffects_6:
|
||||
if (sublayer == SubLayer.NA) {
|
||||
creature.addAbility(MountainwalkAbility.getInstance());
|
||||
creature.addAbility(new MountainwalkAbility());
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ public class GrayscaledGharial extends CardImpl<GrayscaledGharial> {
|
|||
this.color.setBlue(true);
|
||||
this.power = new MageInt(1);
|
||||
this.toughness = new MageInt(1);
|
||||
this.addAbility(IslandwalkAbility.getInstance());
|
||||
this.addAbility(new IslandwalkAbility());
|
||||
}
|
||||
|
||||
public GrayscaledGharial (final GrayscaledGharial card) {
|
||||
|
|
|
|||
|
|
@ -32,10 +32,11 @@ import java.util.UUID;
|
|||
import mage.Constants.CardType;
|
||||
import mage.Constants.Duration;
|
||||
import mage.Constants.Rarity;
|
||||
import mage.Constants.TurnPhase;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.LoyaltyAbility;
|
||||
import mage.abilities.effects.RequirementAttackEffect;
|
||||
import mage.abilities.effects.RequirementEffect;
|
||||
import mage.abilities.effects.common.BecomesCreatureSourceEOTEffect;
|
||||
import mage.abilities.effects.common.DestroyTargetEffect;
|
||||
import mage.abilities.effects.common.PreventAllDamageSourceEffect;
|
||||
|
|
@ -112,10 +113,10 @@ class GideonJuraToken extends Token {
|
|||
|
||||
}
|
||||
|
||||
class GideonJuraEffect extends RequirementAttackEffect<GideonJuraEffect> {
|
||||
class GideonJuraEffect extends RequirementEffect<GideonJuraEffect> {
|
||||
|
||||
public GideonJuraEffect() {
|
||||
super(Duration.OneUse);
|
||||
super(Duration.Custom);
|
||||
}
|
||||
|
||||
public GideonJuraEffect(final GideonJuraEffect effect) {
|
||||
|
|
@ -128,30 +129,32 @@ class GideonJuraEffect extends RequirementAttackEffect<GideonJuraEffect> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (event.getType().equals(EventType.DECLARE_ATTACKERS_STEP_PRE) && event.getPlayerId().equals(source.getFirstTarget()))
|
||||
return true;
|
||||
if (event.getType().equals(EventType.END_PHASE_POST) && event.getPlayerId().equals(source.getFirstTarget()))
|
||||
used = true;
|
||||
return false;
|
||||
public boolean applies(Permanent permanent, Ability source, Game game) {
|
||||
return permanent.getControllerId().equals(source.getFirstTarget());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getFirstTarget());
|
||||
if (player != null) {
|
||||
for (Permanent creature: game.getBattlefield().getAllActivePermanents(new FilterCreatureForCombat(), player.getId())) {
|
||||
if (creature.canAttack(game)) {
|
||||
game.getCombat().declareAttacker(creature.getId(), source.getSourceId(), game);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
public boolean isInactive(Ability source, Game game) {
|
||||
return (game.getPhase().getType() == TurnPhase.END && game.getActivePlayerId().equals(source.getFirstTarget()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText(Ability source) {
|
||||
return "During target opponent's next turn, creatures that player controls attack {this} if able";
|
||||
return "During target opponent's next turn, creatures that player controls attack Gideon Jura if able";
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID mustAttackDefender(Ability source, Game game) {
|
||||
return source.getSourceId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mustAttack(Game game) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mustBlock(Game game) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -49,7 +49,7 @@ public class GoblinMountaineer extends CardImpl<GoblinMountaineer> {
|
|||
this.color.setRed(true);
|
||||
this.power = new MageInt(1);
|
||||
this.toughness = new MageInt(1);
|
||||
this.addAbility(MountainwalkAbility.getInstance());
|
||||
this.addAbility(new MountainwalkAbility());
|
||||
}
|
||||
|
||||
public GoblinMountaineer (final GoblinMountaineer card) {
|
||||
|
|
|
|||
|
|
@ -30,11 +30,12 @@ package mage.sets.tenth;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.Constants.CardType;
|
||||
import mage.Constants.Duration;
|
||||
import mage.Constants.Rarity;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.EvasionAbilityImpl;
|
||||
import mage.abilities.EvasionAbility;
|
||||
import mage.abilities.common.AttacksEachTurnStaticAbility;
|
||||
import mage.abilities.keyword.DefenderAbility;
|
||||
import mage.abilities.effects.common.CantBlockSourceEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
|
@ -72,19 +73,16 @@ public class Juggernaut extends CardImpl<Juggernaut> {
|
|||
|
||||
}
|
||||
|
||||
class JuggernautAbility extends EvasionAbilityImpl<JuggernautAbility> {
|
||||
class JuggernautAbility extends EvasionAbility<JuggernautAbility> {
|
||||
|
||||
public JuggernautAbility() {}
|
||||
public JuggernautAbility() {
|
||||
this.addEffect(new JuggernautEffect());
|
||||
}
|
||||
|
||||
public JuggernautAbility(final JuggernautAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBlock(Permanent blocker, Game game) {
|
||||
return !blocker.getSubtype().contains("Wall");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Juggernaut can't be blocked by Walls.";
|
||||
|
|
@ -96,3 +94,25 @@ class JuggernautAbility extends EvasionAbilityImpl<JuggernautAbility> {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
class JuggernautEffect extends CantBlockSourceEffect {
|
||||
|
||||
public JuggernautEffect() {
|
||||
super(Duration.WhileOnBattlefield);
|
||||
}
|
||||
|
||||
public JuggernautEffect(final JuggernautEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBlock(Permanent blocker, Game game) {
|
||||
return !blocker.getSubtype().contains("Wall");
|
||||
}
|
||||
|
||||
@Override
|
||||
public JuggernautEffect copy() {
|
||||
return new JuggernautEffect(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,13 +36,11 @@ import mage.Constants.Rarity;
|
|||
import mage.Constants.Zone;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.abilities.effects.RestrictionEffect;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.abilities.keyword.EnchantAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
|
@ -83,47 +81,42 @@ public class Pacifism extends CardImpl<Pacifism> {
|
|||
}
|
||||
}
|
||||
|
||||
class PacifismEffect extends ReplacementEffectImpl<PacifismEffect> {
|
||||
class PacifismEffect extends RestrictionEffect<PacifismEffect> {
|
||||
|
||||
public PacifismEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Detriment);
|
||||
super(Duration.WhileOnBattlefield);
|
||||
}
|
||||
|
||||
public PacifismEffect(final PacifismEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(Permanent permanent, Ability source, Game game) {
|
||||
if (permanent.getAttachments().contains((source.getSourceId()))) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAttack(Game game) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBlock(Permanent blocker, Game game) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacifismEffect copy() {
|
||||
return new PacifismEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (event.getType() == EventType.DECLARE_ATTACKER || event.getType() == EventType.DECLARE_BLOCKER) {
|
||||
Permanent enchantment = game.getPermanent(source.getSourceId());
|
||||
if (enchantment != null && enchantment.getAttachedTo() != null) {
|
||||
if (event.getSourceId().equals(enchantment.getAttachedTo())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText(Ability source) {
|
||||
return "Enchanted creature can't attack or block";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ public class CliffThreader extends CardImpl<CliffThreader> {
|
|||
this.color.setWhite(true);
|
||||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(1);
|
||||
this.addAbility(MountainwalkAbility.getInstance());
|
||||
this.addAbility(new MountainwalkAbility());
|
||||
}
|
||||
|
||||
public CliffThreader (final CliffThreader card) {
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ public class RiverBoa extends CardImpl<RiverBoa> {
|
|||
this.subtype.add("Snake");
|
||||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(1);
|
||||
this.addAbility(IslandwalkAbility.getInstance());
|
||||
this.addAbility(new IslandwalkAbility());
|
||||
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new RegenerateSourceEffect(), new ManaCostsImpl("{G}")));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue