diff --git a/Mage.Common/src/mage/view/CardView.java b/Mage.Common/src/mage/view/CardView.java index 1500a926324..fafd5af104f 100644 --- a/Mage.Common/src/mage/view/CardView.java +++ b/Mage.Common/src/mage/view/CardView.java @@ -190,15 +190,15 @@ public class CardView extends SimpleCardView { this.isSplitCard = true; leftSplitName = splitCard.getLeftHalfCard().getName(); leftSplitCosts = splitCard.getLeftHalfCard().getManaCost(); - leftSplitRules = splitCard.getLeftHalfCard().getRules(); + leftSplitRules = splitCard.getLeftHalfCard().getRules(game); rightSplitName = splitCard.getRightHalfCard().getName(); rightSplitCosts = splitCard.getRightHalfCard().getManaCost(); - rightSplitRules = splitCard.getRightHalfCard().getRules(); + rightSplitRules = splitCard.getRightHalfCard().getRules(game); } this.name = card.getImageName(); this.displayName = card.getName(); - this.rules = card.getRules(); + this.rules = card.getRules(game); this.manaCost = card.getManaCost().getSymbols(); this.convertedManaCost = card.getManaCost().convertedManaCost(); @@ -254,7 +254,7 @@ public class CardView extends SimpleCardView { } // // set code und card number for token copies to get the image - this.rules = ((PermanentToken) card).getRules(); + this.rules = ((PermanentToken) card).getRules(game); this.type = ((PermanentToken)card).getToken().getTokenType(); } else { this.rarity = card.getRarity(); diff --git a/Mage.Common/src/mage/view/PermanentView.java b/Mage.Common/src/mage/view/PermanentView.java index dfc3c49b89f..376e63e69a6 100644 --- a/Mage.Common/src/mage/view/PermanentView.java +++ b/Mage.Common/src/mage/view/PermanentView.java @@ -64,7 +64,7 @@ public class PermanentView extends CardView { public PermanentView(Permanent permanent, Card card, UUID createdForPlayerId, Game game) { super(permanent, game, null, permanent.getControllerId().equals(createdForPlayerId)); this.controlled = permanent.getControllerId().equals(createdForPlayerId); - this.rules = permanent.getRules(); + this.rules = permanent.getRules(game); this.tapped = permanent.isTapped(); this.flipped = permanent.isFlipped(); this.phasedIn = permanent.isPhasedIn(); diff --git a/Mage.Sets/src/mage/sets/avacynrestored/CavernOfSouls.java b/Mage.Sets/src/mage/sets/avacynrestored/CavernOfSouls.java index 5c2702bcd3d..5e0b1e5f2b6 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/CavernOfSouls.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/CavernOfSouls.java @@ -120,7 +120,7 @@ class CavernOfSoulsEffect extends OneShotEffect { } game.informPlayers(permanent.getName() + ": " + player.getName() + " has chosen " + typeChoice.getChoice()); game.getState().setValue(permanent.getId() + "_type", typeChoice.getChoice()); - permanent.addInfo("chosen type", CardUtil.addToolTipMarkTags("Chosen type: " + typeChoice.getChoice())); + permanent.addInfo("chosen type", CardUtil.addToolTipMarkTags("Chosen type: " + typeChoice.getChoice()), game); } return false; } diff --git a/Mage.Sets/src/mage/sets/avacynrestored/RidersOfGavony.java b/Mage.Sets/src/mage/sets/avacynrestored/RidersOfGavony.java index 00234ae24ae..fb1ffba09b6 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/RidersOfGavony.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/RidersOfGavony.java @@ -110,7 +110,7 @@ class RidersOfGavonyEffect extends OneShotEffect { if (typeChoice.getChoice() != null) { game.informPlayers(permanent.getName() + ": " + player.getName() + " has chosen " + typeChoice.getChoice()); game.getState().setValue(permanent.getId() + "_type", typeChoice.getChoice()); - permanent.addInfo("chosen type", "Chosen type: " + typeChoice.getChoice().toString() + ""); + permanent.addInfo("chosen type", "Chosen type: " + typeChoice.getChoice().toString() + "", game); } } return false; diff --git a/Mage.Sets/src/mage/sets/bornofthegods/KioraTheCrashingWave.java b/Mage.Sets/src/mage/sets/bornofthegods/KioraTheCrashingWave.java index 4057da0b812..79e1b6c7615 100644 --- a/Mage.Sets/src/mage/sets/bornofthegods/KioraTheCrashingWave.java +++ b/Mage.Sets/src/mage/sets/bornofthegods/KioraTheCrashingWave.java @@ -131,7 +131,7 @@ class KioraPreventionEffect extends PreventionEffectImpl { for(UUID targetId :this.getTargetPointer().getTargets(game, source)) { Permanent permanent = game.getPermanent(targetId); if (permanent != null) { - permanent.addInfo(new StringBuilder("kioraPrevention").append(getId()).toString(),CardUtil.addToolTipMarkTags("All damage that would be dealt to and dealt by this permanent is prevented.")); + permanent.addInfo(new StringBuilder("kioraPrevention").append(getId()).toString(),CardUtil.addToolTipMarkTags("All damage that would be dealt to and dealt by this permanent is prevented."), game); } } } @@ -154,7 +154,7 @@ class KioraPreventionEffect extends PreventionEffectImpl { for(UUID targetId :this.getTargetPointer().getTargets(game, source)) { Permanent permanent = game.getPermanent(targetId); if (permanent != null) { - permanent.addInfo(new StringBuilder("kioraPrevention").append(getId()).toString(),""); + permanent.addInfo(new StringBuilder("kioraPrevention").append(getId()).toString(),"", game); } } return true; diff --git a/Mage.Sets/src/mage/sets/commander2013/TrueNameNemesis.java b/Mage.Sets/src/mage/sets/commander2013/TrueNameNemesis.java index fdd6816cb4d..c7a8c341940 100644 --- a/Mage.Sets/src/mage/sets/commander2013/TrueNameNemesis.java +++ b/Mage.Sets/src/mage/sets/commander2013/TrueNameNemesis.java @@ -113,7 +113,7 @@ class TrueNameNemesisChoosePlayerEffect extends OneShotEffect { if (chosenPlayer != null) { game.informPlayers(permanent.getName() + ": " + player.getName() + " has chosen " + chosenPlayer.getName()); game.getState().setValue(permanent.getId() + "_player", target.getFirstTarget()); - permanent.addInfo("chosen player", "Chosen player: " + chosenPlayer.getName() + ""); + permanent.addInfo("chosen player", "Chosen player: " + chosenPlayer.getName() + "", game); return true; } } diff --git a/Mage.Sets/src/mage/sets/commander2014/BitterFeud.java b/Mage.Sets/src/mage/sets/commander2014/BitterFeud.java index 249638ba05c..7e9579dbc64 100644 --- a/Mage.Sets/src/mage/sets/commander2014/BitterFeud.java +++ b/Mage.Sets/src/mage/sets/commander2014/BitterFeud.java @@ -103,7 +103,7 @@ class BitterFeudEntersBattlefieldEffect extends OneShotEffect { game.getState().setValue(source.getSourceId() + "_player1", player1); game.getState().setValue(source.getSourceId() + "_player2", player2); game.informPlayers(permanent.getName() + ": " + controller.getName() + " has chosen " + player1.getName() + " and " + player2.getName()); - permanent.addInfo("chosen players", "Chosen players: " + player1.getName() +", " + player2.getName() + ""); + permanent.addInfo("chosen players", "Chosen players: " + player1.getName() +", " + player2.getName() + "", game); return true; } } diff --git a/Mage.Sets/src/mage/sets/dissension/UtopiaSprawl.java b/Mage.Sets/src/mage/sets/dissension/UtopiaSprawl.java index 5137108041d..ea255023794 100644 --- a/Mage.Sets/src/mage/sets/dissension/UtopiaSprawl.java +++ b/Mage.Sets/src/mage/sets/dissension/UtopiaSprawl.java @@ -115,7 +115,7 @@ class ChooseColorEffect extends OneShotEffect { if (player.choose(Outcome.Neutral, colorChoice, game)) { game.informPlayers(permanent.getName() + ": " + player.getName() + " has chosen " + colorChoice.getChoice()); game.getState().setValue(permanent.getId() + "_color", colorChoice.getColor()); - permanent.addInfo("chosen color", "Chosen color: " + colorChoice.getColor().getDescription() + ""); + permanent.addInfo("chosen color", "Chosen color: " + colorChoice.getColor().getDescription() + "", game); } } return false; diff --git a/Mage.Sets/src/mage/sets/eventide/BatwingBrume.java b/Mage.Sets/src/mage/sets/eventide/BatwingBrume.java index ef6380c78f6..b94e083198b 100644 --- a/Mage.Sets/src/mage/sets/eventide/BatwingBrume.java +++ b/Mage.Sets/src/mage/sets/eventide/BatwingBrume.java @@ -35,6 +35,7 @@ import mage.abilities.decorator.ConditionalOneShotEffect; import mage.abilities.decorator.ConditionalReplacementEffect; import mage.abilities.effects.Effect; import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.InfoEffect; import mage.abilities.effects.common.PreventAllDamageByAllEffect; import mage.cards.CardImpl; import mage.constants.CardType; @@ -69,7 +70,7 @@ public class BatwingBrume extends CardImpl { this.getSpellAbility().addEffect(new ConditionalOneShotEffect( new BatwingBrumeEffect(), new ManaWasSpentCondition(ColoredManaSymbol.B), "Each player loses 1 life for each attacking creature he or she controls if {B} was spent to cast {this}")); - this.addInfo("Info1", "(Do both if {W}{B} was spent.)"); + this.getSpellAbility().addEffect(new InfoEffect("(Do both if {W}{B} was spent.)")); this.getSpellAbility().addWatcher(new ManaSpentToCastWatcher()); } diff --git a/Mage.Sets/src/mage/sets/eventide/CankerousThirst.java b/Mage.Sets/src/mage/sets/eventide/CankerousThirst.java index f63cb1393b3..cd138504119 100644 --- a/Mage.Sets/src/mage/sets/eventide/CankerousThirst.java +++ b/Mage.Sets/src/mage/sets/eventide/CankerousThirst.java @@ -31,6 +31,7 @@ import java.util.UUID; import mage.abilities.condition.LockedInCondition; import mage.abilities.condition.common.ManaWasSpentCondition; import mage.abilities.decorator.ConditionalContinuousEffect; +import mage.abilities.effects.common.InfoEffect; import mage.abilities.effects.common.continuous.BoostTargetEffect; import mage.cards.CardImpl; import mage.constants.CardType; @@ -65,7 +66,7 @@ public class CankerousThirst extends CardImpl { new LockedInCondition(new ManaWasSpentCondition(ColoredManaSymbol.G)), "If {G} was spent to cast {this}, you may have target creature get +3/+3 until end of turn")); this.getSpellAbility().addTarget(new TargetCreaturePermanent()); - this.addInfo("Info1", "(Do both if {B}{G} was spent.)"); + this.getSpellAbility().addEffect(new InfoEffect("(Do both if {B}{G} was spent.)")); this.getSpellAbility().addWatcher(new ManaSpentToCastWatcher()); } diff --git a/Mage.Sets/src/mage/sets/eventide/InvertTheSkies.java b/Mage.Sets/src/mage/sets/eventide/InvertTheSkies.java index 20c23c87160..42da5ffbb7b 100644 --- a/Mage.Sets/src/mage/sets/eventide/InvertTheSkies.java +++ b/Mage.Sets/src/mage/sets/eventide/InvertTheSkies.java @@ -34,6 +34,7 @@ import mage.abilities.condition.LockedInCondition; import mage.abilities.condition.common.ManaWasSpentCondition; import mage.abilities.decorator.ConditionalContinuousEffect; import mage.abilities.effects.ContinuousEffectImpl; +import mage.abilities.effects.common.InfoEffect; import mage.abilities.effects.common.continuous.GainAbilityControlledEffect; import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; @@ -72,7 +73,7 @@ public class InvertTheSkies extends CardImpl { new GainAbilityControlledEffect(FlyingAbility.getInstance(), Duration.EndOfTurn), new LockedInCondition(new ManaWasSpentCondition(ColoredManaSymbol.U)), "and creatures you control gain flying until end of turn if {U} was spent to cast it")); - this.addInfo("Info1", "(Do both if {G}{U} was spent.)"); + this.getSpellAbility().addEffect(new InfoEffect("(Do both if {G}{U} was spent.)")); this.getSpellAbility().addWatcher(new ManaSpentToCastWatcher()); } diff --git a/Mage.Sets/src/mage/sets/eventide/Moonhold.java b/Mage.Sets/src/mage/sets/eventide/Moonhold.java index b0ff6baac49..513917758c4 100644 --- a/Mage.Sets/src/mage/sets/eventide/Moonhold.java +++ b/Mage.Sets/src/mage/sets/eventide/Moonhold.java @@ -35,6 +35,7 @@ import mage.abilities.condition.common.ManaWasSpentCondition; import mage.abilities.decorator.ConditionalContinuousRuleModifyingEffect; import mage.abilities.effects.ContinuousRuleModifyingEffect; import mage.abilities.effects.ContinuousRuleModifyingEffectImpl; +import mage.abilities.effects.common.InfoEffect; import mage.cards.Card; import mage.cards.CardImpl; import mage.constants.CardType; @@ -72,7 +73,7 @@ public class Moonhold extends CardImpl { effect2, new LockedInCondition(new ManaWasSpentCondition(ColoredManaSymbol.W)))); this.getSpellAbility().addTarget(new TargetPlayer()); - this.addInfo("Info1", "(Do both if {R}{W} was spent.)"); + this.getSpellAbility().addEffect(new InfoEffect("(Do both if {R}{W} was spent.)")); this.getSpellAbility().addWatcher(new ManaSpentToCastWatcher()); } diff --git a/Mage.Sets/src/mage/sets/eventide/UnnervingAssault.java b/Mage.Sets/src/mage/sets/eventide/UnnervingAssault.java index d7d7dea31d7..df6aeb823e8 100644 --- a/Mage.Sets/src/mage/sets/eventide/UnnervingAssault.java +++ b/Mage.Sets/src/mage/sets/eventide/UnnervingAssault.java @@ -30,6 +30,7 @@ package mage.sets.eventide; import java.util.UUID; import mage.abilities.condition.common.ManaWasSpentCondition; import mage.abilities.decorator.ConditionalContinuousEffect; +import mage.abilities.effects.common.InfoEffect; import mage.abilities.effects.common.continuous.BoostAllEffect; import mage.cards.CardImpl; import mage.constants.CardType; @@ -71,7 +72,7 @@ public class UnnervingAssault extends CardImpl { this.getSpellAbility().addEffect(new ConditionalContinuousEffect( new BoostAllEffect(1, 0, Duration.EndOfTurn, filter2, false), new ManaWasSpentCondition(ColoredManaSymbol.R), " and creatures you control get +1/0 until end of turn if {R} was spent to cast it")); - this.addInfo("Info1", "(Do both if {U}{R} was spent.)"); + this.getSpellAbility().addEffect(new InfoEffect("(Do both if {U}{R} was spent.)")); this.getSpellAbility().addWatcher(new ManaSpentToCastWatcher()); } diff --git a/Mage.Sets/src/mage/sets/fifthdawn/SummonersEgg.java b/Mage.Sets/src/mage/sets/fifthdawn/SummonersEgg.java index 764fff6aca1..ecb14fc5433 100644 --- a/Mage.Sets/src/mage/sets/fifthdawn/SummonersEgg.java +++ b/Mage.Sets/src/mage/sets/fifthdawn/SummonersEgg.java @@ -102,7 +102,7 @@ class SummonersEggImprintEffect extends OneShotEffect { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { permanent.imprint(card.getId(), game); - permanent.addInfo("imprint", CardUtil.addToolTipMarkTags("[Imprinted card]")); + permanent.addInfo("imprint", CardUtil.addToolTipMarkTags("[Imprinted card]"), game); } } } diff --git a/Mage.Sets/src/mage/sets/innistrad/Nevermore.java b/Mage.Sets/src/mage/sets/innistrad/Nevermore.java index f8138cf1442..7cd1f805f58 100644 --- a/Mage.Sets/src/mage/sets/innistrad/Nevermore.java +++ b/Mage.Sets/src/mage/sets/innistrad/Nevermore.java @@ -107,7 +107,7 @@ class NevermoreEffect1 extends OneShotEffect { String cardName = cardChoice.getChoice(); game.informPlayers(permanent.getLogName() + ", named card: [" + cardName + "]"); game.getState().setValue(source.getSourceId().toString(), cardName); - permanent.addInfo("named card", CardUtil.addToolTipMarkTags("Named card: [" + cardName +"]")); + permanent.addInfo("named card", CardUtil.addToolTipMarkTags("Named card: [" + cardName +"]"), game); return true; } return false; diff --git a/Mage.Sets/src/mage/sets/journeyintonyx/HallOfTriumph.java b/Mage.Sets/src/mage/sets/journeyintonyx/HallOfTriumph.java index 63d1d9726d3..1e0088195f7 100644 --- a/Mage.Sets/src/mage/sets/journeyintonyx/HallOfTriumph.java +++ b/Mage.Sets/src/mage/sets/journeyintonyx/HallOfTriumph.java @@ -102,7 +102,7 @@ class HallOfTriumphEffect extends OneShotEffect { if (colorChoice.getChoice() != null) { game.informPlayers(permanent.getName() + ": " + player.getName() + " has chosen " + colorChoice.getChoice()); game.getState().setValue(permanent.getId() + "_color", colorChoice.getColor()); - permanent.addInfo("chosen color", "Chosen color: " + colorChoice.getColor().getDescription() + ""); + permanent.addInfo("chosen color", "Chosen color: " + colorChoice.getColor().getDescription() + "", game); } } return false; diff --git a/Mage.Sets/src/mage/sets/magic2012/AdaptiveAutomaton.java b/Mage.Sets/src/mage/sets/magic2012/AdaptiveAutomaton.java index 328d877f804..dbe6f8d852b 100644 --- a/Mage.Sets/src/mage/sets/magic2012/AdaptiveAutomaton.java +++ b/Mage.Sets/src/mage/sets/magic2012/AdaptiveAutomaton.java @@ -102,7 +102,7 @@ class AdaptiveAutomatonEffect extends OneShotEffect { } game.informPlayers(permanent.getName() + ": " + player.getName() + " has chosen " + typeChoice.getChoice()); game.getState().setValue(permanent.getId() + "_type", typeChoice.getChoice()); - permanent.addInfo("chosen type", "Chosen type: " + typeChoice.getChoice().toString() + ""); + permanent.addInfo("chosen type", "Chosen type: " + typeChoice.getChoice().toString() + "", game); } return false; } diff --git a/Mage.Sets/src/mage/sets/magic2014/DoorOfDestinies.java b/Mage.Sets/src/mage/sets/magic2014/DoorOfDestinies.java index 4f2e6f0a574..83b84120e58 100644 --- a/Mage.Sets/src/mage/sets/magic2014/DoorOfDestinies.java +++ b/Mage.Sets/src/mage/sets/magic2014/DoorOfDestinies.java @@ -114,7 +114,7 @@ class ChooseCreatureTypeEffect extends OneShotEffect { } game.informPlayers(permanent.getName() + ": " + player.getName() + " has chosen " + typeChoice.getChoice()); game.getState().setValue(permanent.getId() + "_type", typeChoice.getChoice()); - permanent.addInfo("chosen type", "Chosen type: " + typeChoice.getChoice().toString() + ""); + permanent.addInfo("chosen type", "Chosen type: " + typeChoice.getChoice().toString() + "", game); } return false; } diff --git a/Mage.Sets/src/mage/sets/magic2014/EliteArcanist.java b/Mage.Sets/src/mage/sets/magic2014/EliteArcanist.java index aa103d157c4..cf29b600682 100644 --- a/Mage.Sets/src/mage/sets/magic2014/EliteArcanist.java +++ b/Mage.Sets/src/mage/sets/magic2014/EliteArcanist.java @@ -130,7 +130,7 @@ class EliteArcanistImprintEffect extends OneShotEffect { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { permanent.imprint(card.getId(), game); - permanent.addInfo("imprint", new StringBuilder("[Exiled card - ").append(card.getName()).append("]").toString()); + permanent.addInfo("imprint", new StringBuilder("[Exiled card - ").append(card.getName()).append("]").toString(), game); } return true; } diff --git a/Mage.Sets/src/mage/sets/magic2014/ShadowbornApostle.java b/Mage.Sets/src/mage/sets/magic2014/ShadowbornApostle.java index d2832c7cbb7..06c26882ec9 100644 --- a/Mage.Sets/src/mage/sets/magic2014/ShadowbornApostle.java +++ b/Mage.Sets/src/mage/sets/magic2014/ShadowbornApostle.java @@ -34,6 +34,7 @@ import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.common.SacrificeTargetCost; import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.effects.Effect; +import mage.abilities.effects.common.InfoEffect; import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect; import mage.cards.CardImpl; import mage.constants.CardType; @@ -70,7 +71,7 @@ public class ShadowbornApostle extends CardImpl { this.toughness = new MageInt(1); // A deck can have any number of cards named Shadowborn Apostle. - this.addInfo("rule", "A deck can have any number of cards named Shadowborn Apostle."); + this.getSpellAbility().addEffect(new InfoEffect("A deck can have any number of cards named Shadowborn Apostle.")); // {B}, Sacrifice six creatures named Shadowborn Apostle: Search your library for a Demon creature and put it onto the battlefield. Then shuffle your library. Effect effect = new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter), false, true); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{B}")); diff --git a/Mage.Sets/src/mage/sets/magic2015/ObeliskOfUrd.java b/Mage.Sets/src/mage/sets/magic2015/ObeliskOfUrd.java index 9e2f984ac02..4c55ee768aa 100644 --- a/Mage.Sets/src/mage/sets/magic2015/ObeliskOfUrd.java +++ b/Mage.Sets/src/mage/sets/magic2015/ObeliskOfUrd.java @@ -111,7 +111,7 @@ class ObeliskOfUrdEnterBattlefieldEffect extends OneShotEffect { } game.informPlayers(permanent.getName() + ": " + player.getName() + " has chosen " + typeChoice.getChoice()); game.getState().setValue(permanent.getId() + "_type", typeChoice.getChoice()); - permanent.addInfo("chosen type", "Chosen type: " + typeChoice.getChoice() + ""); + permanent.addInfo("chosen type", "Chosen type: " + typeChoice.getChoice() + "", game); } return false; } diff --git a/Mage.Sets/src/mage/sets/mirrodin/Duplicant.java b/Mage.Sets/src/mage/sets/mirrodin/Duplicant.java index 012ff4a1d9c..097ad9b5bbb 100644 --- a/Mage.Sets/src/mage/sets/mirrodin/Duplicant.java +++ b/Mage.Sets/src/mage/sets/mirrodin/Duplicant.java @@ -109,7 +109,7 @@ class ExileTargetEffect extends OneShotEffect { if (permanent != null) { if(sourcePermananent != null){ sourcePermananent.imprint(permanent.getId(), game); - sourcePermananent.addInfo("imprint", new StringBuilder("[Imprinted card - ").append(permanent.getName()).append("]").toString()); + sourcePermananent.addInfo("imprint", new StringBuilder("[Imprinted card - ").append(permanent.getName()).append("]").toString(), game); } return permanent.moveToExile(null, null, source.getSourceId(), game); } diff --git a/Mage.Sets/src/mage/sets/mirrodin/ExtraplanarLens.java b/Mage.Sets/src/mage/sets/mirrodin/ExtraplanarLens.java index 26fabac7db1..dad4a998ab9 100644 --- a/Mage.Sets/src/mage/sets/mirrodin/ExtraplanarLens.java +++ b/Mage.Sets/src/mage/sets/mirrodin/ExtraplanarLens.java @@ -109,7 +109,7 @@ class ExtraplanarLensImprintEffect extends OneShotEffect { if (targetLand != null) { targetLand.moveToExile(null, extraplanarLens.getLogName() + " (Imprint)", source.getSourceId(), game); extraplanarLens.imprint(targetLand.getId(), game); - extraplanarLens.addInfo("imprint", CardUtil.addToolTipMarkTags("[Imprinted card - " + targetLand.getLogName() + "]")); + extraplanarLens.addInfo("imprint", CardUtil.addToolTipMarkTags("[Imprinted card - " + targetLand.getLogName() + "]"), game); } } return true; diff --git a/Mage.Sets/src/mage/sets/mirrodin/IsochronScepter.java b/Mage.Sets/src/mage/sets/mirrodin/IsochronScepter.java index 502958450b0..f8a1af20458 100644 --- a/Mage.Sets/src/mage/sets/mirrodin/IsochronScepter.java +++ b/Mage.Sets/src/mage/sets/mirrodin/IsochronScepter.java @@ -113,7 +113,7 @@ class IsochronScepterImprintEffect extends OneShotEffect { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { permanent.imprint(card.getId(), game); - permanent.addInfo("imprint", CardUtil.addToolTipMarkTags("[Imprinted card - " + card.getLogName() + "]")); + permanent.addInfo("imprint", CardUtil.addToolTipMarkTags("[Imprinted card - " + card.getLogName() + "]"), game); } } } diff --git a/Mage.Sets/src/mage/sets/mirrodin/SoulFoundry.java b/Mage.Sets/src/mage/sets/mirrodin/SoulFoundry.java index 21843f6da21..f0ff3462b7a 100644 --- a/Mage.Sets/src/mage/sets/mirrodin/SoulFoundry.java +++ b/Mage.Sets/src/mage/sets/mirrodin/SoulFoundry.java @@ -134,7 +134,7 @@ class SoulFoundryImprintEffect extends OneShotEffect { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { permanent.imprint(card.getId(), game); - permanent.addInfo("imprint", CardUtil.addToolTipMarkTags("[Imprinted card - " + card.getLogName() + "]")); + permanent.addInfo("imprint", CardUtil.addToolTipMarkTags("[Imprinted card - " + card.getLogName() + "]"), game); } } } diff --git a/Mage.Sets/src/mage/sets/mirrodinbesieged/PhyrexianRevoker.java b/Mage.Sets/src/mage/sets/mirrodinbesieged/PhyrexianRevoker.java index b8938d1849d..fd0a2c97d80 100644 --- a/Mage.Sets/src/mage/sets/mirrodinbesieged/PhyrexianRevoker.java +++ b/Mage.Sets/src/mage/sets/mirrodinbesieged/PhyrexianRevoker.java @@ -110,7 +110,7 @@ class PhyrexianRevokerEffect1 extends OneShotEffect { String cardName = cardChoice.getChoice(); game.informPlayers(permanent.getLogName() + ", named card: [" + cardName + "]"); game.getState().setValue(source.getSourceId().toString(), cardName); - permanent.addInfo("named card", CardUtil.addToolTipMarkTags("Named card: [" + cardName +"]")); + permanent.addInfo("named card", CardUtil.addToolTipMarkTags("Named card: [" + cardName +"]"), game); return true; } return false; diff --git a/Mage.Sets/src/mage/sets/newphyrexia/Xenograft.java b/Mage.Sets/src/mage/sets/newphyrexia/Xenograft.java index 9af106fa1fc..7ab55a16d2e 100644 --- a/Mage.Sets/src/mage/sets/newphyrexia/Xenograft.java +++ b/Mage.Sets/src/mage/sets/newphyrexia/Xenograft.java @@ -104,7 +104,7 @@ class XenograftEffect extends OneShotEffect { } game.informPlayers(permanent.getName() + ": " + player.getName() + " has chosen " + typeChoice.getChoice()); game.getState().setValue(source.getSourceId() + "_XenograftType", typeChoice.getChoice()); - permanent.addInfo("chosen type", "Chosen type: " + typeChoice.getChoice().toString() + ""); + permanent.addInfo("chosen type", "Chosen type: " + typeChoice.getChoice().toString() + "", game); } return false; } diff --git a/Mage.Sets/src/mage/sets/planarchaos/VoidstoneGargoyle.java b/Mage.Sets/src/mage/sets/planarchaos/VoidstoneGargoyle.java index a954dadde11..c55118b3909 100644 --- a/Mage.Sets/src/mage/sets/planarchaos/VoidstoneGargoyle.java +++ b/Mage.Sets/src/mage/sets/planarchaos/VoidstoneGargoyle.java @@ -111,7 +111,7 @@ class VoidstoneGargoyleChooseCardEffect extends OneShotEffect { String cardName = cardChoice.getChoice(); game.informPlayers(permanent.getLogName() + ", named card: [" + cardName + "]"); game.getState().setValue(source.getSourceId().toString(), cardName); - permanent.addInfo("named card", CardUtil.addToolTipMarkTags("Named card: [" + cardName +"]")); + permanent.addInfo("named card", CardUtil.addToolTipMarkTags("Named card: [" + cardName +"]"), game); return true; } return false; diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/CurseOfWizardry.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/CurseOfWizardry.java index 558c38cd378..4f6b1818eeb 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/CurseOfWizardry.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/CurseOfWizardry.java @@ -97,7 +97,7 @@ class CurseOfWizardryChooseColorEffect extends OneShotEffect { if (player.choose(Outcome.Detriment, colorChoice, game)) { game.informPlayers(curseOfWizardry.getName() + ": " + player.getName() + " has chosen " + colorChoice.getChoice()); game.getState().setValue(curseOfWizardry.getId() + "_color", colorChoice.getColor()); - curseOfWizardry.addInfo("chosen color", "Chosen color: " + colorChoice.getColor().getDescription() + ""); + curseOfWizardry.addInfo("chosen color", "Chosen color: " + colorChoice.getColor().getDescription() + "", game); } } return false; diff --git a/Mage.Sets/src/mage/sets/shadowmoor/DawnglowInfusion.java b/Mage.Sets/src/mage/sets/shadowmoor/DawnglowInfusion.java index 27723c73509..dd985af2a65 100644 --- a/Mage.Sets/src/mage/sets/shadowmoor/DawnglowInfusion.java +++ b/Mage.Sets/src/mage/sets/shadowmoor/DawnglowInfusion.java @@ -36,6 +36,7 @@ import mage.abilities.decorator.ConditionalOneShotEffect; import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.common.ManacostVariableValue; import mage.abilities.effects.common.GainLifeEffect; +import mage.abilities.effects.common.InfoEffect; import mage.cards.CardImpl; import mage.constants.ColoredManaSymbol; import mage.constants.ManaType; @@ -62,7 +63,7 @@ public class DawnglowInfusion extends CardImpl { this.getSpellAbility().addEffect(new ConditionalOneShotEffect( new GainLifeEffect(xValue), new ManaWasSpentCondition(ColoredManaSymbol.W), " And X life if {W} was spent to cast it")); - this.addInfo("Info1", "(Do both if {G}{W} was spent.)"); + this.getSpellAbility().addEffect(new InfoEffect("(Do both if {G}{W} was spent.)")); this.getSpellAbility().addWatcher(new ManaSpentToCastWatcher()); diff --git a/Mage.Sets/src/mage/sets/shadowmoor/Firespout.java b/Mage.Sets/src/mage/sets/shadowmoor/Firespout.java index 61d128aeb59..df34048116f 100644 --- a/Mage.Sets/src/mage/sets/shadowmoor/Firespout.java +++ b/Mage.Sets/src/mage/sets/shadowmoor/Firespout.java @@ -31,6 +31,7 @@ import java.util.UUID; import mage.abilities.condition.common.ManaWasSpentCondition; import mage.abilities.decorator.ConditionalOneShotEffect; import mage.abilities.effects.common.DamageAllEffect; +import mage.abilities.effects.common.InfoEffect; import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; import mage.constants.CardType; @@ -68,7 +69,7 @@ public class Firespout extends CardImpl { this.getSpellAbility().addEffect(new ConditionalOneShotEffect( new DamageAllEffect(3, filter2), new ManaWasSpentCondition(ColoredManaSymbol.G), " And 3 damage to each creature with flying if {G} was spent to cast it")); - this.addInfo("Info1", "(Do both if {R}{G} was spent.)"); + this.getSpellAbility().addEffect(new InfoEffect("(Do both if {R}{G} was spent.)")); this.getSpellAbility().addWatcher(new ManaSpentToCastWatcher()); diff --git a/Mage.Sets/src/mage/sets/shadowmoor/LureboundScarecrow.java b/Mage.Sets/src/mage/sets/shadowmoor/LureboundScarecrow.java index 0fb2545d21f..288e5cb8cf9 100644 --- a/Mage.Sets/src/mage/sets/shadowmoor/LureboundScarecrow.java +++ b/Mage.Sets/src/mage/sets/shadowmoor/LureboundScarecrow.java @@ -100,7 +100,7 @@ class LureboundScarecrowChooseColorEffect extends OneShotEffect { if (player.choose(Outcome.BoostCreature, colorChoice, game)) { game.informPlayers(sourceStackObject.getName() + ": " + player.getName() + " has chosen " + colorChoice.getChoice()); game.getState().setValue(permanent.getId() + "_color", colorChoice.getColor()); - permanent.addInfo("chosen color", new StringBuilder("Chosen color: ").append(colorChoice.getColor().getDescription()).append("").toString()); + permanent.addInfo("chosen color", new StringBuilder("Chosen color: ").append(colorChoice.getColor().getDescription()).append("").toString(), game); } } return false; diff --git a/Mage.Sets/src/mage/sets/shadowmoor/PaintersServant.java b/Mage.Sets/src/mage/sets/shadowmoor/PaintersServant.java index 081984f48ad..db41305754c 100644 --- a/Mage.Sets/src/mage/sets/shadowmoor/PaintersServant.java +++ b/Mage.Sets/src/mage/sets/shadowmoor/PaintersServant.java @@ -104,7 +104,7 @@ class ChooseColorEffect extends OneShotEffect { if (player.choose(Outcome.Neutral, colorChoice, game)) { game.informPlayers(new StringBuilder(permanent.getName()).append(": ").append(player.getName()).append(" has chosen ").append(colorChoice.getChoice()).toString()); game.getState().setValue(source.getSourceId() + "_color", colorChoice.getColor()); - permanent.addInfo("chosen color", "Chosen color: " + colorChoice.getColor().getDescription() + ""); + permanent.addInfo("chosen color", "Chosen color: " + colorChoice.getColor().getDescription() + "", game); } return true; } diff --git a/Mage.Sets/src/mage/sets/shadowmoor/RepelIntruders.java b/Mage.Sets/src/mage/sets/shadowmoor/RepelIntruders.java index 3eaec05a997..f06ae825a65 100644 --- a/Mage.Sets/src/mage/sets/shadowmoor/RepelIntruders.java +++ b/Mage.Sets/src/mage/sets/shadowmoor/RepelIntruders.java @@ -32,6 +32,7 @@ import mage.abilities.condition.common.ManaWasSpentCondition; import mage.abilities.decorator.ConditionalOneShotEffect; import mage.abilities.effects.common.CounterTargetEffect; import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.effects.common.InfoEffect; import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.ColoredManaSymbol; @@ -64,7 +65,7 @@ public class RepelIntruders extends CardImpl { new CounterTargetEffect(), new ManaWasSpentCondition(ColoredManaSymbol.U), " Counter up to one target creature spell if {U} was spent to cast {this}")); this.getSpellAbility().addTarget(target); - this.addInfo("Info1", "(Do both if {W}{U} was spent.)"); + this.getSpellAbility().addEffect(new InfoEffect("(Do both if {W}{U} was spent.)")); this.getSpellAbility().addWatcher(new ManaSpentToCastWatcher()); } diff --git a/Mage.Sets/src/mage/sets/shadowmoor/RiversGrasp.java b/Mage.Sets/src/mage/sets/shadowmoor/RiversGrasp.java index 408316bce89..5d6cc24269c 100644 --- a/Mage.Sets/src/mage/sets/shadowmoor/RiversGrasp.java +++ b/Mage.Sets/src/mage/sets/shadowmoor/RiversGrasp.java @@ -32,6 +32,7 @@ import mage.abilities.Ability; import mage.abilities.condition.common.ManaWasSpentCondition; import mage.abilities.decorator.ConditionalOneShotEffect; import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.InfoEffect; import mage.abilities.effects.common.ReturnToHandTargetEffect; import mage.cards.Card; import mage.cards.CardImpl; @@ -74,7 +75,7 @@ public class RiversGrasp extends CardImpl { this.getSpellAbility().addTarget(targetCreature); this.getSpellAbility().addTarget(targetPlayer); - this.addInfo("Info1", "(Do both if {U}{B} was spent.)"); + this.getSpellAbility().addEffect(new InfoEffect("(Do both if {U}{B} was spent.)")); this.getSpellAbility().addWatcher(new ManaSpentToCastWatcher()); } diff --git a/Mage.Sets/src/mage/sets/sorinvstibalt/TorrentOfSouls.java b/Mage.Sets/src/mage/sets/sorinvstibalt/TorrentOfSouls.java index 2ed6e74fd63..344e27d803b 100644 --- a/Mage.Sets/src/mage/sets/sorinvstibalt/TorrentOfSouls.java +++ b/Mage.Sets/src/mage/sets/sorinvstibalt/TorrentOfSouls.java @@ -33,6 +33,7 @@ import mage.abilities.condition.common.ManaWasSpentCondition; import mage.abilities.decorator.ConditionalOneShotEffect; import mage.abilities.effects.ContinuousEffect; import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.InfoEffect; import mage.abilities.effects.common.ReturnToBattlefieldUnderYourControlTargetEffect; import mage.abilities.effects.common.continuous.BoostAllEffect; import mage.abilities.effects.common.continuous.GainAbilityAllEffect; @@ -76,7 +77,7 @@ public class TorrentOfSouls extends CardImpl { this.getSpellAbility().addTarget(targetCreature); this.getSpellAbility().addTarget(targetPlayer); - this.addInfo("Info1", "(Do both if {B}{R} was spent.)"); + this.getSpellAbility().addEffect(new InfoEffect("(Do both if {B}{R} was spent.)")); this.getSpellAbility().addWatcher(new ManaSpentToCastWatcher()); } diff --git a/Mage.Sets/src/mage/sets/tenth/RelentlessRats.java b/Mage.Sets/src/mage/sets/tenth/RelentlessRats.java index a4f830854d3..c9943bf0cef 100644 --- a/Mage.Sets/src/mage/sets/tenth/RelentlessRats.java +++ b/Mage.Sets/src/mage/sets/tenth/RelentlessRats.java @@ -40,6 +40,7 @@ import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.ContinuousEffectImpl; +import mage.abilities.effects.common.InfoEffect; import mage.cards.CardImpl; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.mageobject.NamePredicate; @@ -70,7 +71,7 @@ public class RelentlessRats extends CardImpl { this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new RelentlessRatsEffect())); // A deck can have any number of cards named Relentless Rats. - this.addInfo("rule", "A deck can have any number of cards named Relentless Rats."); + this.getSpellAbility().addEffect(new InfoEffect("A deck can have any number of cards named Relentless Rats.")); } public RelentlessRats(final RelentlessRats card) { diff --git a/Mage.Sets/src/mage/sets/zendikar/IonaShieldOfEmeria.java b/Mage.Sets/src/mage/sets/zendikar/IonaShieldOfEmeria.java index da3319687eb..90cc8037047 100644 --- a/Mage.Sets/src/mage/sets/zendikar/IonaShieldOfEmeria.java +++ b/Mage.Sets/src/mage/sets/zendikar/IonaShieldOfEmeria.java @@ -107,7 +107,7 @@ class IonaShieldOfEmeriaChooseColorEffect extends OneShotEffect { if (player.choose(Outcome.Detriment, colorChoice, game)) { game.informPlayers(permanent.getName() + ": " + player.getName() + " has chosen " + colorChoice.getChoice()); game.getState().setValue(permanent.getId() + "_color", colorChoice.getColor()); - permanent.addInfo("chosen color", CardUtil.addToolTipMarkTags("Chosen color: " + colorChoice.getColor().getDescription())); + permanent.addInfo("chosen color", CardUtil.addToolTipMarkTags("Chosen color: " + colorChoice.getColor().getDescription()), game); } return true; } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/HauntTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/HauntTest.java new file mode 100644 index 00000000000..dc75c058882 --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/HauntTest.java @@ -0,0 +1,130 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package org.mage.test.cards.abilities.keywords; + +import mage.cards.Card; +import mage.constants.PhaseStep; +import mage.constants.Zone; +import org.junit.Assert; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; + +/** + * + * @author BetaSteward + */ +public class HauntTest extends CardTestPlayerBase { + + /** + * Blind Hunter - 2WB + * Creature — Bat + * 2/2 + * Flying + * Haunt (When this creature dies, exile it haunting target creature.) + * When Blind Hunter enters the battlefield or the creature it haunts dies, target player loses 2 life and you gain 2 life. + * + */ + + // test that Haunting and Haunted by rules are added to cards + @Test + public void testAddHaunt() { + + addCard(Zone.BATTLEFIELD, playerA, "Blind Hunter", 1); + addCard(Zone.BATTLEFIELD, playerA, "Goblin Roughrider"); + addCard(Zone.HAND, playerA, "Lightning Bolt", 1); + addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", "Blind Hunter"); + + setStopAt(1, PhaseStep.BEGIN_COMBAT); + execute(); + + assertGraveyardCount(playerA, "Lightning Bolt", 1); + assertExileCount("Blind Hunter", 1); + + boolean found = false; + for (Card card : currentGame.getExile().getAllCards(currentGame)) { + if (card.getName().equals("Blind Hunter")) { + for (String rule : card.getRules(currentGame)) { + if (rule.startsWith("Haunting Goblin Roughrider")) { + found = true; + } + } + } + } + Assert.assertTrue("Couldn't find Haunting rule text displayed for the card", found); + + found = false; + for (Card card : currentGame.getBattlefield().getAllActivePermanents()) { + if (card.getName().equals("Goblin Roughrider")) { + for (String rule : card.getRules(currentGame)) { + if (rule.startsWith("Haunted by Blind Hunter")) { + found = true; + } + } + } + } + Assert.assertTrue("Couldn't find Haunted by rule text displayed for the card", found); + + } + + // test that Haunted by rule is removed from cards (it is only added to permanent) + @Test + public void testRemoveHaunt() { + + addCard(Zone.BATTLEFIELD, playerA, "Blind Hunter", 1); + addCard(Zone.BATTLEFIELD, playerA, "Goblin Roughrider"); + addCard(Zone.HAND, playerA, "Lightning Bolt", 2); + addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", "Blind Hunter"); + castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Lightning Bolt", "Goblin Roughrider"); + + setStopAt(1, PhaseStep.END_TURN); + execute(); + + assertGraveyardCount(playerA, "Lightning Bolt", 2); + assertExileCount("Blind Hunter", 1); + assertGraveyardCount(playerA, "Goblin Roughrider", 1); + + + boolean found = false; + for (Card card : currentGame.getPlayer(playerA.getId()).getGraveyard().getCards(currentGame)) { + if (card.getName().equals("Goblin Roughrider")) { + for (String rule : card.getRules(currentGame)) { + if (rule.startsWith("Haunted by Blind Hunter")) { + found = true; + } + } + } + } + Assert.assertFalse("Found Haunted by rule text displayed for the card", found); + + } + +} diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/rules/AlternativeCostRuleTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/rules/AlternativeCostRuleTest.java index f5f3d2d7d60..2efc8e23a0e 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/rules/AlternativeCostRuleTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/rules/AlternativeCostRuleTest.java @@ -22,7 +22,7 @@ public class AlternativeCostRuleTest extends CardTestPlayerBase { Card firewildBorderpost = playerA.getGraveyard().getCards(currentGame).iterator().next(); boolean found = false; - for (String rule : firewildBorderpost.getRules()) { + for (String rule : firewildBorderpost.getRules(currentGame)) { if (rule.startsWith("You may pay")) { found = true; break; diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/roe/CastThroughTimeTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/roe/CastThroughTimeTest.java index eaf025e30ca..5ded9e333a0 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/single/roe/CastThroughTimeTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/roe/CastThroughTimeTest.java @@ -66,7 +66,7 @@ public class CastThroughTimeTest extends CardTestPlayerBase { boolean found = false; for (Card card : currentGame.getPlayer(playerA.getId()).getHand().getCards(currentGame)) { if (card.getName().equals("Lightning Bolt")) { - for (String rule : card.getRules()) { + for (String rule : card.getRules(currentGame)) { if (rule.startsWith("Rebound")) { found = true; } diff --git a/Mage/src/mage/abilities/effects/common/ChooseColorEffect.java b/Mage/src/mage/abilities/effects/common/ChooseColorEffect.java index cf8c00e1f01..e1bd51539fa 100644 --- a/Mage/src/mage/abilities/effects/common/ChooseColorEffect.java +++ b/Mage/src/mage/abilities/effects/common/ChooseColorEffect.java @@ -65,7 +65,7 @@ public class ChooseColorEffect extends OneShotEffect { } game.informPlayers(new StringBuilder(permanent.getLogName()).append(": ").append(controller.getName()).append(" has chosen ").append(choice.getChoice()).toString()); game.getState().setValue(source.getSourceId() + "_color", choice.getColor()); - permanent.addInfo("chosen color", "Chosen color: " + choice.getColor().getDescription() + ""); + permanent.addInfo("chosen color", "Chosen color: " + choice.getColor().getDescription() + "", game); return true; } return false; diff --git a/Mage/src/mage/abilities/effects/common/ChooseCreatureTypeEffect.java b/Mage/src/mage/abilities/effects/common/ChooseCreatureTypeEffect.java index db9a3f80798..553e3269e4f 100644 --- a/Mage/src/mage/abilities/effects/common/ChooseCreatureTypeEffect.java +++ b/Mage/src/mage/abilities/effects/common/ChooseCreatureTypeEffect.java @@ -69,7 +69,7 @@ public class ChooseCreatureTypeEffect extends OneShotEffect { } game.informPlayers(permanent.getName() + ": " + controller.getName() + " has chosen " + typeChoice.getChoice()); game.getState().setValue(permanent.getId() + "_type", typeChoice.getChoice()); - permanent.addInfo("chosen type", CardUtil.addToolTipMarkTags("Chosen type: " + typeChoice.getChoice())); + permanent.addInfo("chosen type", CardUtil.addToolTipMarkTags("Chosen type: " + typeChoice.getChoice()), game); } return false; } diff --git a/Mage/src/mage/abilities/effects/common/ChooseModeEffect.java b/Mage/src/mage/abilities/effects/common/ChooseModeEffect.java index 6b8fb7f930d..4cc8792fbc4 100644 --- a/Mage/src/mage/abilities/effects/common/ChooseModeEffect.java +++ b/Mage/src/mage/abilities/effects/common/ChooseModeEffect.java @@ -82,7 +82,7 @@ public class ChooseModeEffect extends OneShotEffect { if (choice.isChosen()) { game.informPlayers(new StringBuilder(sourcePermanent.getLogName()).append(": ").append(controller.getName()).append(" has chosen ").append(choice.getChoice()).toString()); game.getState().setValue(source.getSourceId() + "_modeChoice", choice.getChoice()); - sourcePermanent.addInfo("_modeChoice", "Chosen mode: " + choice.getChoice() + ""); + sourcePermanent.addInfo("_modeChoice", "Chosen mode: " + choice.getChoice() + "", game); } return true; } diff --git a/Mage/src/mage/abilities/effects/common/DetainAllEffect.java b/Mage/src/mage/abilities/effects/common/DetainAllEffect.java index e820cb2375d..5aa0e28c309 100644 --- a/Mage/src/mage/abilities/effects/common/DetainAllEffect.java +++ b/Mage/src/mage/abilities/effects/common/DetainAllEffect.java @@ -105,7 +105,7 @@ class DetainAllRestrictionEffect extends RestrictionEffect { for(FixedTarget fixedTarget :this.detainedObjects) { Permanent permanent = game.getPermanent(fixedTarget.getFirst(game, source)); if (permanent != null) { - permanent.addInfo(new StringBuilder("detain").append(getId()).toString(),"[Detained]"); + permanent.addInfo(new StringBuilder("detain").append(getId()).toString(),"[Detained]", game); } } } @@ -118,7 +118,7 @@ class DetainAllRestrictionEffect extends RestrictionEffect { for(FixedTarget fixedTarget :this.detainedObjects) { Permanent permanent = game.getPermanent(fixedTarget.getFirst(game, source)); if (permanent != null) { - permanent.addInfo(new StringBuilder("detain").append(getId()).toString(),""); + permanent.addInfo(new StringBuilder("detain").append(getId()).toString(),"", game); } } return true; diff --git a/Mage/src/mage/abilities/effects/common/DetainTargetEffect.java b/Mage/src/mage/abilities/effects/common/DetainTargetEffect.java index 36aba4cb269..0a55e8dd652 100644 --- a/Mage/src/mage/abilities/effects/common/DetainTargetEffect.java +++ b/Mage/src/mage/abilities/effects/common/DetainTargetEffect.java @@ -141,7 +141,7 @@ class DetainRestrictionEffect extends RestrictionEffect { for(UUID targetId :this.getTargetPointer().getTargets(game, source)) { Permanent permanent = game.getPermanent(targetId); if (permanent != null) { - permanent.addInfo(new StringBuilder("detain").append(getId()).toString(),"[Detained]"); + permanent.addInfo(new StringBuilder("detain").append(getId()).toString(),"[Detained]", game); } } } @@ -154,7 +154,7 @@ class DetainRestrictionEffect extends RestrictionEffect { for(UUID targetId :this.getTargetPointer().getTargets(game, source)) { Permanent permanent = game.getPermanent(targetId); if (permanent != null) { - permanent.addInfo(new StringBuilder("detain").append(getId()).toString(),""); + permanent.addInfo(new StringBuilder("detain").append(getId()).toString(),"", game); } } return true; diff --git a/Mage/src/mage/abilities/effects/common/InfoEffect.java b/Mage/src/mage/abilities/effects/common/InfoEffect.java new file mode 100644 index 00000000000..381b33e9c47 --- /dev/null +++ b/Mage/src/mage/abilities/effects/common/InfoEffect.java @@ -0,0 +1,61 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ + +package mage.abilities.effects.common; + +import mage.constants.Outcome; +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.game.Game; + +/** + * + * @author BetaSteward_at_googlemail.com + */ +public class InfoEffect extends OneShotEffect { + + public InfoEffect(String text) { + super(Outcome.Neutral); + this.staticText = text; + } + + public InfoEffect(final InfoEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + return true; + } + + @Override + public InfoEffect copy() { + return new InfoEffect(this); + } + +} diff --git a/Mage/src/mage/abilities/effects/common/NameACardEffect.java b/Mage/src/mage/abilities/effects/common/NameACardEffect.java index 77dc429d123..4650bfcbbf1 100644 --- a/Mage/src/mage/abilities/effects/common/NameACardEffect.java +++ b/Mage/src/mage/abilities/effects/common/NameACardEffect.java @@ -96,7 +96,7 @@ public class NameACardEffect extends OneShotEffect { game.informPlayers(sourceObject.getLogName() + ", named card: [" + cardName + "]"); game.getState().setValue(source.getSourceId().toString() + INFO_KEY, cardName); if (sourceObject instanceof Permanent) { - ((Permanent)sourceObject).addInfo(INFO_KEY, CardUtil.addToolTipMarkTags("Named card: " + cardName)); + ((Permanent)sourceObject).addInfo(INFO_KEY, CardUtil.addToolTipMarkTags("Named card: " + cardName), game); } return true; } diff --git a/Mage/src/mage/abilities/keyword/HauntAbility.java b/Mage/src/mage/abilities/keyword/HauntAbility.java index 7f4bd40612c..694d80af8d3 100644 --- a/Mage/src/mage/abilities/keyword/HauntAbility.java +++ b/Mage/src/mage/abilities/keyword/HauntAbility.java @@ -180,8 +180,8 @@ class HauntEffect extends OneShotEffect { // remember the haunted creature String key = new StringBuilder("Haunting_").append(source.getSourceId().toString()).append("_").append(card.getZoneChangeCounter()).toString(); game.getState().setValue(key, new FixedTarget(targetPointer.getFirst(game, source))); - card.addInfo("hauntinfo", new StringBuilder("Haunting ").append(hauntedCreature.getLogName()).toString()); - hauntedCreature.addInfo("hauntinfo", new StringBuilder("Haunted by ").append(card.getLogName()).toString()); + card.addInfo("hauntinfo", new StringBuilder("Haunting ").append(hauntedCreature.getLogName()).toString(), game); + hauntedCreature.addInfo("hauntinfo", new StringBuilder("Haunted by ").append(card.getLogName()).toString(), game); game.informPlayers(new StringBuilder(card.getName()).append(" haunting ").append(hauntedCreature.getLogName()).toString()); } return true; diff --git a/Mage/src/mage/cards/Card.java b/Mage/src/mage/cards/Card.java index aa53894b2e2..50cc60e67c0 100644 --- a/Mage/src/mage/cards/Card.java +++ b/Mage/src/mage/cards/Card.java @@ -40,7 +40,6 @@ import mage.constants.Zone; import mage.counters.Counter; import mage.counters.Counters; import mage.game.Game; -import mage.watchers.Watcher; public interface Card extends MageObject { @@ -51,7 +50,8 @@ public interface Card extends MageObject { void addAbility(Ability ability); void setSpellAbility(SpellAbility ability); SpellAbility getSpellAbility(); - List getRules(); + List getRules(); // gets base card rules + List getRules(Game game); // gets card rules + in game modifications String getExpansionSetCode(); String getTokenSetCode(); void setFaceDown(boolean value); @@ -71,7 +71,7 @@ public interface Card extends MageObject { int getZoneChangeCounter(); void updateZoneChangeCounter(); - void addInfo(String key, String value); + void addInfo(String key, String value, Game game); /** * Moves the card to the specified zone diff --git a/Mage/src/mage/cards/CardImpl.java b/Mage/src/mage/cards/CardImpl.java index 505ffe95035..ca42ecaaf89 100644 --- a/Mage/src/mage/cards/CardImpl.java +++ b/Mage/src/mage/cards/CardImpl.java @@ -31,9 +31,7 @@ package mage.cards; import java.lang.reflect.Constructor; import java.util.ArrayList; import java.util.Arrays; -import java.util.HashMap; import java.util.List; -import java.util.Map; import java.util.UUID; import mage.MageObject; import mage.MageObjectImpl; @@ -59,6 +57,7 @@ import static mage.constants.Zone.PICK; import static mage.constants.Zone.STACK; import mage.counters.Counter; import mage.counters.Counters; +import mage.game.CardState; import mage.game.Game; import mage.game.command.Commander; import mage.game.events.GameEvent; @@ -87,7 +86,6 @@ public abstract class CardImpl extends MageObjectImpl implements Card { protected boolean flipCard; protected String flipCardName; protected int zoneChangeCounter = 1; - protected Map info; protected boolean usesVariousArt = false; protected boolean splitCard; protected boolean morphCard; @@ -153,10 +151,6 @@ public abstract class CardImpl extends MageObjectImpl implements Card { nightCard = card.nightCard; } zoneChangeCounter = card.zoneChangeCounter; - if (card.info != null) { - info = new HashMap<>(); - info.putAll(card.info); - } flipCard = card.flipCard; flipCardName = card.flipCardName; splitCard = card.splitCard; @@ -207,23 +201,39 @@ public abstract class CardImpl extends MageObjectImpl implements Card { return rarity; } + @Override + public void addInfo(String key, String value, Game game) { + game.getState().getCardState(objectId).addInfo(key, value); + } + + protected static final ArrayList rulesError = new ArrayList() {{add("Exception occured in rules generation");}}; + @Override public List getRules() { try { - List rules = abilities.getRules(this.getLogName()); - if (info != null) { - for (String data : info.values()) { - rules.add(data); - } + return abilities.getRules(this.getLogName()); + } catch (Exception e) { + logger.info("Exception in rules generation for card: " + this.getName(), e); + } + return rulesError; + } + + @Override + public List getRules(Game game) { + try { + List rules = getRules(); + CardState state = game.getState().getCardState(objectId); + for (String data : state.getInfo().values()) { + rules.add(data); } +// for (Ability ability: state.getAbilities()) { +// rules.add(ability.getRule()); +// } return rules; } catch (Exception e) { - System.out.println("Exception in rules generation for card: " + this.getName()); - e.printStackTrace(); + logger.error("Exception in rules generation for card: " + this.getName(), e); } - ArrayList rules = new ArrayList<>(); - rules.add("Exception occured in rules generation"); - return rules; + return rulesError; } @Override @@ -621,18 +631,6 @@ public abstract class CardImpl extends MageObjectImpl implements Card { // logger.info(name + " set= " + zoneChangeCounter + " " + ((this instanceof Permanent) ? " Permanent":"Card")); } - @Override - public void addInfo(String key, String value) { - if (info == null) { - info = new HashMap<>(); - } - if (value == null || value.isEmpty()) { - info.remove(key); - } else { - info.put(key, value); - } - } - @Override public void build() {} diff --git a/Mage/src/mage/filter/predicate/other/CardTextPredicate.java b/Mage/src/mage/filter/predicate/other/CardTextPredicate.java index f36cfacac90..8f340aacbaa 100644 --- a/Mage/src/mage/filter/predicate/other/CardTextPredicate.java +++ b/Mage/src/mage/filter/predicate/other/CardTextPredicate.java @@ -59,7 +59,7 @@ public class CardTextPredicate implements Predicate { boolean found = false; if (!token.isEmpty()) { // then try to find in rules - for (String rule : input.getRules()) { + for (String rule : input.getRules(game)) { if (rule.toLowerCase().contains(token)) { found = true; break; diff --git a/Mage/src/mage/game/permanent/PermanentImpl.java b/Mage/src/mage/game/permanent/PermanentImpl.java index 5ad9148bc78..e8f3f50d36f 100644 --- a/Mage/src/mage/game/permanent/PermanentImpl.java +++ b/Mage/src/mage/game/permanent/PermanentImpl.java @@ -63,6 +63,7 @@ import mage.constants.Zone; import mage.counters.Counter; import mage.counters.CounterType; import mage.counters.Counters; +import mage.game.CardState; import mage.game.Game; import mage.game.events.DamageCreatureEvent; import mage.game.events.DamagePlaneswalkerEvent; @@ -110,7 +111,8 @@ public abstract class PermanentImpl extends CardImpl implements Permanent { protected Counters counters; protected List markedDamage; protected int timesLoyaltyUsed = 0; - + protected Map info; + private static final List emptyList = Collections.unmodifiableList(new ArrayList()); public PermanentImpl(UUID ownerId, UUID controllerId, String name) { @@ -154,6 +156,10 @@ public abstract class PermanentImpl extends CardImpl implements Permanent { markedDamage.add(counter.copy()); } } + if (permanent.info != null) { + info = new HashMap<>(); + info.putAll(permanent.info); + } this.counters = permanent.counters.copy(); this.attachedTo = permanent.attachedTo; this.minBlockedBy = permanent.minBlockedBy; @@ -209,6 +215,33 @@ public abstract class PermanentImpl extends CardImpl implements Permanent { return sb.toString(); } + @Override + public void addInfo(String key, String value, Game game) { + if (info == null) { + info = new HashMap<>(); + } + if (value == null || value.isEmpty()) { + info.remove(key); + } else { + info.put(key, value); + } + } + + @Override + public List getRules(Game game) { + try { + List rules = getRules(); + if (info != null) { + for (String data : info.values()) { + rules.add(data); + } + } + return rules; + } catch (Exception e) { + return rulesError; + } + } + @Override @Deprecated public void addAbility(Ability ability) { diff --git a/Mage/src/mage/game/stack/Spell.java b/Mage/src/mage/game/stack/Spell.java index 472f84daa03..23ed93bdae9 100644 --- a/Mage/src/mage/game/stack/Spell.java +++ b/Mage/src/mage/game/stack/Spell.java @@ -701,6 +701,11 @@ public class Spell implements StackObject, Card { return card.getRules(); } + @Override + public List getRules(Game game) { + return card.getRules(game); + } + @Override public String getExpansionSetCode() { return card.getExpansionSetCode(); @@ -900,7 +905,7 @@ public class Spell implements StackObject, Card { } @Override - public void addInfo(String key, String value) { + public void addInfo(String key, String value, Game game) { // do nothing } diff --git a/Mage/src/mage/watchers/common/CommanderCombatDamageWatcher.java b/Mage/src/mage/watchers/common/CommanderCombatDamageWatcher.java index 44515342a02..f0a0f5c9aee 100644 --- a/Mage/src/mage/watchers/common/CommanderCombatDamageWatcher.java +++ b/Mage/src/mage/watchers/common/CommanderCombatDamageWatcher.java @@ -108,21 +108,21 @@ public class CommanderCombatDamageWatcher extends Watcher { if (castCount != null) { sb.append(" ").append(castCount).append(castCount.intValue() == 1 ? " time":" times").append(" casted from the command zone."); } - this.addInfo(object, "Commander",sb.toString()); + this.addInfo(object, "Commander",sb.toString(), game); for (Map.Entry entry : damageToPlayer.entrySet()) { Player damagedPlayer = game.getPlayer(entry.getKey()); sb.setLength(0); sb.append("Commander did ").append(entry.getValue()).append(" combat damage to player ").append(damagedPlayer.getName()).append("."); - this.addInfo(object, new StringBuilder("Commander").append(entry.getKey()).toString(),sb.toString()); + this.addInfo(object, new StringBuilder("Commander").append(entry.getKey()).toString(),sb.toString(), game); } } } - private void addInfo(MageObject object, String key, String value) { + private void addInfo(MageObject object, String key, String value, Game game) { if (object instanceof Card) { - ((Card) object).addInfo(key, value); + ((Card) object).addInfo(key, value, game); } else if (object instanceof Permanent) { - ((Permanent) object).addInfo(key, value); + ((Permanent) object).addInfo(key, value, game); } }