mirror of
https://github.com/magefree/mage.git
synced 2025-12-23 12:02:01 -08:00
Some fixes to M15 cards or by M15 used classes.
This commit is contained in:
parent
9ad45a6ab9
commit
18e78b8294
23 changed files with 105 additions and 50 deletions
|
|
@ -28,13 +28,12 @@
|
||||||
|
|
||||||
package mage.server.game;
|
package mage.server.game;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.concurrent.Callable;
|
||||||
import mage.MageException;
|
import mage.MageException;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.concurrent.Callable;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author BetaSteward_at_googlemail.com
|
* @author BetaSteward_at_googlemail.com
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,7 @@
|
||||||
*/
|
*/
|
||||||
package mage.sets.avacynrestored;
|
package mage.sets.avacynrestored;
|
||||||
|
|
||||||
import mage.constants.CardType;
|
import java.util.UUID;
|
||||||
import mage.constants.Rarity;
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleActivatedAbility;
|
import mage.abilities.common.SimpleActivatedAbility;
|
||||||
import mage.abilities.costs.common.TapSourceCost;
|
import mage.abilities.costs.common.TapSourceCost;
|
||||||
|
|
@ -36,7 +35,9 @@ import mage.abilities.costs.common.TapTargetCost;
|
||||||
import mage.abilities.costs.mana.GenericManaCost;
|
import mage.abilities.costs.mana.GenericManaCost;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
|
import mage.constants.CardType;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.Rarity;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.filter.common.FilterControlledPermanent;
|
import mage.filter.common.FilterControlledPermanent;
|
||||||
import mage.filter.predicate.Predicates;
|
import mage.filter.predicate.Predicates;
|
||||||
|
|
@ -50,8 +51,6 @@ import mage.players.Player;
|
||||||
import mage.target.common.TargetControlledPermanent;
|
import mage.target.common.TargetControlledPermanent;
|
||||||
import mage.target.common.TargetCreaturePermanent;
|
import mage.target.common.TargetCreaturePermanent;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author noxx
|
* @author noxx
|
||||||
*/
|
*/
|
||||||
|
|
@ -112,7 +111,7 @@ class GallowsAtWillowHillEffect extends OneShotEffect {
|
||||||
Player controller = game.getPlayer(permanent.getControllerId());
|
Player controller = game.getPlayer(permanent.getControllerId());
|
||||||
permanent.destroy(source.getId(), game, false);
|
permanent.destroy(source.getId(), game, false);
|
||||||
if (controller != null) {
|
if (controller != null) {
|
||||||
Token spirit = new SpiritWhiteToken();
|
Token spirit = new SpiritWhiteToken("AVR", 1);
|
||||||
spirit.putOntoBattlefield(1, game, source.getSourceId(), controller.getId());
|
spirit.putOntoBattlefield(1, game, source.getSourceId(), controller.getId());
|
||||||
}
|
}
|
||||||
affectedTargets++;
|
affectedTargets++;
|
||||||
|
|
|
||||||
|
|
@ -28,13 +28,12 @@
|
||||||
package mage.sets.darkascension;
|
package mage.sets.darkascension;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import mage.constants.CardType;
|
|
||||||
import mage.constants.Rarity;
|
|
||||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||||
import mage.abilities.effects.common.CreateTokenEffect;
|
import mage.abilities.effects.common.CreateTokenEffect;
|
||||||
import mage.abilities.keyword.FlashbackAbility;
|
import mage.abilities.keyword.FlashbackAbility;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.Rarity;
|
||||||
import mage.constants.TimingRule;
|
import mage.constants.TimingRule;
|
||||||
import mage.game.permanent.token.SpiritWhiteToken;
|
import mage.game.permanent.token.SpiritWhiteToken;
|
||||||
|
|
||||||
|
|
@ -51,7 +50,7 @@ public class LingeringSouls extends CardImpl {
|
||||||
this.color.setWhite(true);
|
this.color.setWhite(true);
|
||||||
|
|
||||||
// Put two 1/1 white Spirit creature tokens with flying onto the battlefield.
|
// Put two 1/1 white Spirit creature tokens with flying onto the battlefield.
|
||||||
this.getSpellAbility().addEffect(new CreateTokenEffect(new SpiritWhiteToken(), 2));
|
this.getSpellAbility().addEffect(new CreateTokenEffect(new SpiritWhiteToken("ISD"), 2));
|
||||||
// Flashback {1}{B}
|
// Flashback {1}{B}
|
||||||
this.addAbility(new FlashbackAbility(new ManaCostsImpl("{1}{B}"), TimingRule.SORCERY));
|
this.addAbility(new FlashbackAbility(new ManaCostsImpl("{1}{B}"), TimingRule.SORCERY));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -130,7 +130,7 @@ class EvershrikeEffect extends OneShotEffect {
|
||||||
Card aura = game.getCard(targetAura.getFirstTarget());
|
Card aura = game.getCard(targetAura.getFirstTarget());
|
||||||
if (aura != null) {
|
if (aura != null) {
|
||||||
game.getState().setValue("attachTo:" + aura.getId(), evershrikePermanent);
|
game.getState().setValue("attachTo:" + aura.getId(), evershrikePermanent);
|
||||||
aura.putOntoBattlefield(game, Zone.HAND, source.getId(), you.getId());
|
aura.putOntoBattlefield(game, Zone.HAND, source.getSourceId(), you.getId());
|
||||||
evershrikePermanent.addAttachment(aura.getId(), game);
|
evershrikePermanent.addAttachment(aura.getId(), game);
|
||||||
exiled = false;
|
exiled = false;
|
||||||
count = you.getHand().count(filterAuraCard, game);
|
count = you.getHand().count(filterAuraCard, game);
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,7 @@
|
||||||
*/
|
*/
|
||||||
package mage.sets.innistrad;
|
package mage.sets.innistrad;
|
||||||
|
|
||||||
import mage.constants.CardType;
|
import java.util.UUID;
|
||||||
import mage.constants.Rarity;
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
|
|
@ -37,13 +36,13 @@ import mage.abilities.effects.common.CreateTokenEffect;
|
||||||
import mage.abilities.effects.common.continious.SetPowerToughnessSourceEffect;
|
import mage.abilities.effects.common.continious.SetPowerToughnessSourceEffect;
|
||||||
import mage.abilities.keyword.VigilanceAbility;
|
import mage.abilities.keyword.VigilanceAbility;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
|
import mage.constants.CardType;
|
||||||
import mage.constants.Duration;
|
import mage.constants.Duration;
|
||||||
|
import mage.constants.Rarity;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||||
import mage.game.permanent.token.SpiritWhiteToken;
|
import mage.game.permanent.token.SpiritWhiteToken;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author nantuko
|
* @author nantuko
|
||||||
*/
|
*/
|
||||||
|
|
@ -65,7 +64,7 @@ public class GeistHonoredMonk extends CardImpl {
|
||||||
this.addAbility(new SimpleStaticAbility(Zone.ALL, new SetPowerToughnessSourceEffect(new PermanentsOnBattlefieldCount(new FilterControlledCreaturePermanent()), Duration.EndOfGame)));
|
this.addAbility(new SimpleStaticAbility(Zone.ALL, new SetPowerToughnessSourceEffect(new PermanentsOnBattlefieldCount(new FilterControlledCreaturePermanent()), Duration.EndOfGame)));
|
||||||
|
|
||||||
// When Geist-Honored Monk enters the battlefield, put two 1/1 white Spirit creature tokens with flying onto the battlefield.
|
// When Geist-Honored Monk enters the battlefield, put two 1/1 white Spirit creature tokens with flying onto the battlefield.
|
||||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new CreateTokenEffect(new SpiritWhiteToken(), 2)));
|
this.addAbility(new EntersBattlefieldTriggeredAbility(new CreateTokenEffect(new SpiritWhiteToken("ISD"), 2)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public GeistHonoredMonk(final GeistHonoredMonk card) {
|
public GeistHonoredMonk(final GeistHonoredMonk card) {
|
||||||
|
|
|
||||||
|
|
@ -27,16 +27,15 @@
|
||||||
*/
|
*/
|
||||||
package mage.sets.innistrad;
|
package mage.sets.innistrad;
|
||||||
|
|
||||||
import mage.constants.CardType;
|
import java.util.UUID;
|
||||||
import mage.constants.Rarity;
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.common.DiesTriggeredAbility;
|
import mage.abilities.common.DiesTriggeredAbility;
|
||||||
import mage.abilities.effects.common.CreateTokenEffect;
|
import mage.abilities.effects.common.CreateTokenEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.Rarity;
|
||||||
import mage.game.permanent.token.SpiritWhiteToken;
|
import mage.game.permanent.token.SpiritWhiteToken;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author nantuko
|
* @author nantuko
|
||||||
*/
|
*/
|
||||||
|
|
@ -53,7 +52,7 @@ public class MausoleumGuard extends CardImpl {
|
||||||
this.toughness = new MageInt(2);
|
this.toughness = new MageInt(2);
|
||||||
|
|
||||||
// When Mausoleum Guard dies, put two 1/1 white Spirit creature tokens with flying onto the battlefield.
|
// When Mausoleum Guard dies, put two 1/1 white Spirit creature tokens with flying onto the battlefield.
|
||||||
this.addAbility(new DiesTriggeredAbility(new CreateTokenEffect(new SpiritWhiteToken(), 2)));
|
this.addAbility(new DiesTriggeredAbility(new CreateTokenEffect(new SpiritWhiteToken("ISD"), 2)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public MausoleumGuard(final MausoleumGuard card) {
|
public MausoleumGuard(final MausoleumGuard card) {
|
||||||
|
|
|
||||||
|
|
@ -28,10 +28,10 @@
|
||||||
package mage.sets.innistrad;
|
package mage.sets.innistrad;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.constants.CardType;
|
|
||||||
import mage.constants.Rarity;
|
|
||||||
import mage.abilities.effects.common.CreateTokenEffect;
|
import mage.abilities.effects.common.CreateTokenEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.Rarity;
|
||||||
import mage.game.permanent.token.SpiritWhiteToken;
|
import mage.game.permanent.token.SpiritWhiteToken;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -47,7 +47,7 @@ public class MidnightHaunting extends CardImpl {
|
||||||
this.color.setWhite(true);
|
this.color.setWhite(true);
|
||||||
|
|
||||||
// Put two 1/1 white Spirit creature tokens with flying onto the battlefield.
|
// Put two 1/1 white Spirit creature tokens with flying onto the battlefield.
|
||||||
this.getSpellAbility().addEffect(new CreateTokenEffect(new SpiritWhiteToken(), 2));
|
this.getSpellAbility().addEffect(new CreateTokenEffect(new SpiritWhiteToken("ISD"), 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
public MidnightHaunting(final MidnightHaunting card) {
|
public MidnightHaunting(final MidnightHaunting card) {
|
||||||
|
|
|
||||||
|
|
@ -118,6 +118,7 @@ public class AjaniSteadfast extends CardImpl {
|
||||||
class AjaniSteadfastEmblem extends Emblem {
|
class AjaniSteadfastEmblem extends Emblem {
|
||||||
|
|
||||||
public AjaniSteadfastEmblem() {
|
public AjaniSteadfastEmblem() {
|
||||||
|
setName("Emblem Ajani Steadfast");
|
||||||
this.getAbilities().add(new SimpleStaticAbility(Zone.COMMAND, new AjaniSteadfastPreventEffect()));
|
this.getAbilities().add(new SimpleStaticAbility(Zone.COMMAND, new AjaniSteadfastPreventEffect()));
|
||||||
this.setExpansionSetCodeForImage("M15");
|
this.setExpansionSetCodeForImage("M15");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,7 @@ class BoonweaverGiantEffect extends OneShotEffect {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (player.chooseUse(Outcome.Neutral, "Search your Hand for an Aura card?", game)) {
|
if (card == null && player.chooseUse(Outcome.Neutral, "Search your Hand for an Aura card?", game)) {
|
||||||
TargetCardInHand target = new TargetCardInHand(filter);
|
TargetCardInHand target = new TargetCardInHand(filter);
|
||||||
if (player.choose(Outcome.PutCardInPlay, player.getHand(), target, game)) {
|
if (player.choose(Outcome.PutCardInPlay, player.getHand(), target, game)) {
|
||||||
card = game.getCard(target.getFirstTarget());
|
card = game.getCard(target.getFirstTarget());
|
||||||
|
|
@ -140,9 +140,9 @@ class BoonweaverGiantEffect extends OneShotEffect {
|
||||||
if (card != null) {
|
if (card != null) {
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
game.getState().setValue("attachTo:" + card.getId(), permanent.getId());
|
game.getState().setValue("attachTo:" + card.getId(), permanent);
|
||||||
}
|
}
|
||||||
card.putOntoBattlefield(game, zone, source.getSourceId(), source.getControllerId());
|
player.putOntoBattlefieldWithInfo(card, game, zone, source.getSourceId());
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
return permanent.addAttachment(card.getId(), game);
|
return permanent.addAttachment(card.getId(), game);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,6 @@ import mage.abilities.TriggeredAbilityImpl;
|
||||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.abilities.effects.common.DamageTargetEffect;
|
|
||||||
import mage.abilities.effects.common.ExileTargetEffect;
|
import mage.abilities.effects.common.ExileTargetEffect;
|
||||||
import mage.abilities.effects.common.continious.GainAbilityAllEffect;
|
import mage.abilities.effects.common.continious.GainAbilityAllEffect;
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
|
|
@ -81,7 +80,7 @@ public class ConstrictingSliver extends CardImpl {
|
||||||
|
|
||||||
// Sliver creatures you control have "When this creature enters the battlefield, you may exile target creature an opponent controls
|
// Sliver creatures you control have "When this creature enters the battlefield, you may exile target creature an opponent controls
|
||||||
// until this creature leaves the battlefield."
|
// until this creature leaves the battlefield."
|
||||||
Ability ability = new EntersBattlefieldTriggeredAbility(new DamageTargetEffect(1), true);
|
Ability ability = new EntersBattlefieldTriggeredAbility(new ExileTargetEffect(), true);
|
||||||
ability.addTarget(new TargetCreaturePermanent(filterTarget));
|
ability.addTarget(new TargetCreaturePermanent(filterTarget));
|
||||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD,
|
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD,
|
||||||
new GainAbilityAllEffect(ability,
|
new GainAbilityAllEffect(ability,
|
||||||
|
|
|
||||||
|
|
@ -92,6 +92,11 @@ class ResoluteArchangelEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
|
if (controller != null) {
|
||||||
|
controller.setLife(game.getLife(), game);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -74,9 +74,9 @@ public class ReturnToTheRanks extends CardImpl {
|
||||||
public void adjustTargets(Ability ability, Game game) {
|
public void adjustTargets(Ability ability, Game game) {
|
||||||
for (Effect effect : ability.getEffects()) {
|
for (Effect effect : ability.getEffects()) {
|
||||||
if (effect instanceof ReturnFromGraveyardToBattlefieldTargetEffect) {
|
if (effect instanceof ReturnFromGraveyardToBattlefieldTargetEffect) {
|
||||||
int xValue = new GetXValue().calculate(game, ability);
|
int xValue = ability.getManaCostsToPay().getX();
|
||||||
ability.getTargets().clear();
|
ability.getTargets().clear();
|
||||||
ability.addTarget(new TargetCardInYourGraveyard(xValue,xValue, new FilterCreatureCard("creature cards from your graveyard")));
|
ability.addTarget(new TargetCardInYourGraveyard(xValue,xValue, filter));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -167,7 +167,19 @@ public abstract class AbilityImpl implements Ability {
|
||||||
for (Effect effect: getEffects()) {
|
for (Effect effect: getEffects()) {
|
||||||
if (effect instanceof OneShotEffect) {
|
if (effect instanceof OneShotEffect) {
|
||||||
if (!(effect instanceof PostResolveEffect)) {
|
if (!(effect instanceof PostResolveEffect)) {
|
||||||
result &= effect.apply(game, this);
|
boolean effectResult = effect.apply(game, this);
|
||||||
|
result &= effectResult;
|
||||||
|
if (logger.isDebugEnabled()) {
|
||||||
|
if (!effectResult) {
|
||||||
|
if (this.getSourceId() != null) {
|
||||||
|
MageObject mageObject = game.getObject(this.getSourceId());
|
||||||
|
if (mageObject != null) {
|
||||||
|
logger.debug("AbilityImpl.resolve: object: " + mageObject.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
logger.debug("AbilityImpl.resolve: effect returned false -" + effect.getText(this.getModes().getMode()));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,8 @@ import mage.abilities.condition.Condition;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
|
|
||||||
public class NotMyTurnCondition implements Condition {
|
public class NotMyTurnCondition implements Condition {
|
||||||
private static NotMyTurnCondition fInstance = new NotMyTurnCondition();
|
|
||||||
|
private static final NotMyTurnCondition fInstance = new NotMyTurnCondition();
|
||||||
|
|
||||||
public static Condition getInstance() {
|
public static Condition getInstance() {
|
||||||
return fInstance;
|
return fInstance;
|
||||||
|
|
@ -42,8 +43,9 @@ public class NotMyTurnCondition implements Condition {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
UUID activePlayerId = game.getActivePlayerId();
|
UUID activePlayerId = game.getActivePlayerId();
|
||||||
if (activePlayerId != null)
|
if (activePlayerId != null) {
|
||||||
return !activePlayerId.equals(source.getControllerId());
|
return !activePlayerId.equals(source.getControllerId());
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,9 +28,10 @@
|
||||||
|
|
||||||
package mage.abilities.effects.common;
|
package mage.abilities.effects.common;
|
||||||
|
|
||||||
import mage.constants.Outcome;
|
import mage.MageObject;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
|
import mage.constants.Outcome;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.command.Emblem;
|
import mage.game.command.Emblem;
|
||||||
|
|
||||||
|
|
@ -40,7 +41,7 @@ import mage.game.command.Emblem;
|
||||||
*/
|
*/
|
||||||
public class GetEmblemEffect extends OneShotEffect {
|
public class GetEmblemEffect extends OneShotEffect {
|
||||||
|
|
||||||
private Emblem emblem;
|
private final Emblem emblem;
|
||||||
|
|
||||||
public GetEmblemEffect(Emblem emblem) {
|
public GetEmblemEffect(Emblem emblem) {
|
||||||
super(Outcome.Benefit);
|
super(Outcome.Benefit);
|
||||||
|
|
@ -60,6 +61,10 @@ public class GetEmblemEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
|
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||||
|
if (sourceObject == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
game.addEmblem(emblem, source);
|
game.addEmblem(emblem, source);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -48,15 +48,18 @@ import mage.game.stack.Spell;
|
||||||
public class ProtectionAbility extends StaticAbility {
|
public class ProtectionAbility extends StaticAbility {
|
||||||
|
|
||||||
protected Filter filter;
|
protected Filter filter;
|
||||||
|
protected boolean removeAuras;
|
||||||
|
|
||||||
public ProtectionAbility(Filter filter) {
|
public ProtectionAbility(Filter filter) {
|
||||||
super(Zone.BATTLEFIELD, null);
|
super(Zone.BATTLEFIELD, null);
|
||||||
this.filter = filter;
|
this.filter = filter;
|
||||||
|
this.removeAuras = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProtectionAbility(final ProtectionAbility ability) {
|
public ProtectionAbility(final ProtectionAbility ability) {
|
||||||
super(ability);
|
super(ability);
|
||||||
this.filter = ability.filter.copy();
|
this.filter = ability.filter.copy();
|
||||||
|
this.removeAuras = ability.removeAuras;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -66,7 +69,7 @@ public class ProtectionAbility extends StaticAbility {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getRule() {
|
public String getRule() {
|
||||||
return "Protection from " + filter.getMessage();
|
return "Protection from " + filter.getMessage() + (removeAuras ? "":". This effect doesn't remove auras.");
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canTarget(MageObject source, Game game) {
|
public boolean canTarget(MageObject source, Game game) {
|
||||||
|
|
@ -101,4 +104,12 @@ public class ProtectionAbility extends StaticAbility {
|
||||||
public void setFilter(FilterCard filter) {
|
public void setFilter(FilterCard filter) {
|
||||||
this.filter = filter;
|
this.filter = filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setRemovesAuras(boolean removeAuras) {
|
||||||
|
this.removeAuras = removeAuras;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean removesAuras() {
|
||||||
|
return removeAuras;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -507,6 +507,10 @@ public abstract class CardImpl extends MageObjectImpl implements Card {
|
||||||
break;
|
break;
|
||||||
case EXILED:
|
case EXILED:
|
||||||
game.getExile().removeCard(this, game);
|
game.getExile().removeCard(this, game);
|
||||||
|
if (isFaceDown()) {
|
||||||
|
// 110.6b Permanents enter the battlefield untapped, unflipped, face up, and phased in unless a spell or ability says otherwise.
|
||||||
|
this.setFaceDown(false);
|
||||||
|
}
|
||||||
removed = true;
|
removed = true;
|
||||||
break;
|
break;
|
||||||
case COMMAND:
|
case COMMAND:
|
||||||
|
|
|
||||||
|
|
@ -1419,13 +1419,14 @@ public abstract class GameImpl implements Game, Serializable {
|
||||||
else {
|
else {
|
||||||
Filter auraFilter = perm.getSpellAbility().getTargets().get(0).getFilter();
|
Filter auraFilter = perm.getSpellAbility().getTargets().get(0).getFilter();
|
||||||
if (auraFilter instanceof FilterControlledCreaturePermanent) {
|
if (auraFilter instanceof FilterControlledCreaturePermanent) {
|
||||||
if (!((FilterControlledCreaturePermanent)auraFilter).match(attachedTo, perm.getId(), perm.getControllerId(), this) || attachedTo.hasProtectionFrom(perm, this)) {
|
if (!((FilterControlledCreaturePermanent)auraFilter).match(attachedTo, perm.getId(), perm.getControllerId(), this)
|
||||||
|
|| attachedTo.cantBeEnchantedBy(perm, this)) {
|
||||||
if (movePermanentToGraveyardWithInfo(perm)) {
|
if (movePermanentToGraveyardWithInfo(perm)) {
|
||||||
somethingHappened = true;
|
somethingHappened = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!auraFilter.match(attachedTo, this) || attachedTo.hasProtectionFrom(perm, this)) {
|
if (!auraFilter.match(attachedTo, this) || attachedTo.cantBeEnchantedBy(perm, this)) {
|
||||||
// handle bestow unattachment
|
// handle bestow unattachment
|
||||||
Card card = this.getCard(perm.getId());
|
Card card = this.getCard(perm.getId());
|
||||||
if (card != null && card.getCardType().contains(CardType.CREATURE)) {
|
if (card != null && card.getCardType().contains(CardType.CREATURE)) {
|
||||||
|
|
@ -1442,15 +1443,15 @@ public abstract class GameImpl implements Game, Serializable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (target instanceof TargetPlayer) {
|
else if (target instanceof TargetPlayer) {
|
||||||
Player attachedTo = getPlayer(perm.getAttachedTo());
|
Player attachedToPlayer = getPlayer(perm.getAttachedTo());
|
||||||
if (attachedTo == null) {
|
if (attachedToPlayer == null) {
|
||||||
if (movePermanentToGraveyardWithInfo(perm)) {
|
if (movePermanentToGraveyardWithInfo(perm)) {
|
||||||
somethingHappened = true;
|
somethingHappened = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Filter auraFilter = perm.getSpellAbility().getTargets().get(0).getFilter();
|
Filter auraFilter = perm.getSpellAbility().getTargets().get(0).getFilter();
|
||||||
if (!auraFilter.match(attachedTo, this) || attachedTo.hasProtectionFrom(perm, this)) {
|
if (!auraFilter.match(attachedToPlayer, this) || attachedToPlayer.hasProtectionFrom(perm, this)) {
|
||||||
if (movePermanentToGraveyardWithInfo(perm)) {
|
if (movePermanentToGraveyardWithInfo(perm)) {
|
||||||
somethingHappened = true;
|
somethingHappened = true;
|
||||||
}
|
}
|
||||||
|
|
@ -1988,9 +1989,9 @@ public abstract class GameImpl implements Game, Serializable {
|
||||||
targetName = targetPlayer.getName();
|
targetName = targetPlayer.getName();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
targetName = targetObject.getName();
|
targetName = targetObject.getLogName();
|
||||||
}
|
}
|
||||||
StringBuilder message = new StringBuilder(preventionSource.getName()).append(": Prevented ");
|
StringBuilder message = new StringBuilder(preventionSource.getLogName()).append(": Prevented ");
|
||||||
message.append(Integer.toString(result.getPreventedDamage())).append(" damage from ").append(damageSource.getName());
|
message.append(Integer.toString(result.getPreventedDamage())).append(" damage from ").append(damageSource.getName());
|
||||||
if (!targetName.isEmpty()) {
|
if (!targetName.isEmpty()) {
|
||||||
message.append(" to ").append(targetName);
|
message.append(" to ").append(targetName);
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,7 @@ public class Emblem implements CommandObject {
|
||||||
|
|
||||||
public Emblem(final Emblem emblem) {
|
public Emblem(final Emblem emblem) {
|
||||||
this.id = emblem.id;
|
this.id = emblem.id;
|
||||||
|
this.name = emblem.name;
|
||||||
this.controllerId = emblem.controllerId;
|
this.controllerId = emblem.controllerId;
|
||||||
this.sourceId = emblem.sourceId;
|
this.sourceId = emblem.sourceId;
|
||||||
this.abilites = emblem.abilites.copy();
|
this.abilites = emblem.abilites.copy();
|
||||||
|
|
|
||||||
|
|
@ -78,6 +78,7 @@ public interface Permanent extends Card, Controllable {
|
||||||
|
|
||||||
boolean canBeTargetedBy(MageObject source, UUID controllerId, Game game);
|
boolean canBeTargetedBy(MageObject source, UUID controllerId, Game game);
|
||||||
boolean hasProtectionFrom(MageObject source, Game game);
|
boolean hasProtectionFrom(MageObject source, Game game);
|
||||||
|
boolean cantBeEnchantedBy(MageObject source, Game game);
|
||||||
boolean hasSummoningSickness();
|
boolean hasSummoningSickness();
|
||||||
int getDamage();
|
int getDamage();
|
||||||
int damage(int damage, UUID sourceId, Game game, boolean preventable, boolean combat);
|
int damage(int damage, UUID sourceId, Game game, boolean preventable, boolean combat);
|
||||||
|
|
|
||||||
|
|
@ -765,6 +765,16 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean cantBeEnchantedBy(MageObject source, Game game) {
|
||||||
|
for (ProtectionAbility ability : abilities.getProtectionAbilities()) {
|
||||||
|
if (!(source.getSubtype().contains("Aura") && !ability.removesAuras()) && !ability.canTarget(source, game)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
protected boolean canDamage(MageObject source, Game game) {
|
protected boolean canDamage(MageObject source, Game game) {
|
||||||
//noxx: having protection doesn't prevents from dealing damage
|
//noxx: having protection doesn't prevents from dealing damage
|
||||||
// instead it adds damage prevention
|
// instead it adds damage prevention
|
||||||
|
|
|
||||||
|
|
@ -37,13 +37,24 @@ import mage.constants.CardType;
|
||||||
public class SpiritWhiteToken extends Token {
|
public class SpiritWhiteToken extends Token {
|
||||||
|
|
||||||
public SpiritWhiteToken() {
|
public SpiritWhiteToken() {
|
||||||
|
this("SHM", 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SpiritWhiteToken(String setCode) {
|
||||||
|
this(setCode, 0);
|
||||||
|
}
|
||||||
|
public SpiritWhiteToken(String setCode, int tokenType) {
|
||||||
super("Spirit", "1/1 white Spirit creature token with flying");
|
super("Spirit", "1/1 white Spirit creature token with flying");
|
||||||
|
setOriginalExpansionSetCode(setCode);
|
||||||
|
if (tokenType > 0) {
|
||||||
|
setTokenType(tokenType);
|
||||||
|
}
|
||||||
cardType.add(CardType.CREATURE);
|
cardType.add(CardType.CREATURE);
|
||||||
subtype.add("Spirit");
|
subtype.add("Spirit");
|
||||||
color.setWhite(true);
|
color.setWhite(true);
|
||||||
power = new MageInt(1);
|
power = new MageInt(1);
|
||||||
toughness = new MageInt(1);
|
toughness = new MageInt(1);
|
||||||
|
|
||||||
addAbility(FlyingAbility.getInstance());
|
addAbility(FlyingAbility.getInstance());
|
||||||
this.setOriginalExpansionSetCode("SHM");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -63,9 +63,6 @@ public class PlayerLostLifeWatcher extends Watcher {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void watch(GameEvent event, Game game) {
|
public void watch(GameEvent event, Game game) {
|
||||||
if (event.getType() == GameEvent.EventType.UNTAP_STEP_PRE) {
|
|
||||||
reset();
|
|
||||||
}
|
|
||||||
if (event.getType() == GameEvent.EventType.LOST_LIFE) {
|
if (event.getType() == GameEvent.EventType.LOST_LIFE) {
|
||||||
UUID playerId = event.getPlayerId();
|
UUID playerId = event.getPlayerId();
|
||||||
if (playerId != null) {
|
if (playerId != null) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue