mirror of
https://github.com/correl/mage.git
synced 2024-12-24 03:00:14 +00:00
moved info from CardImpl to CardState and PermanentImpl + created InfoEffect for displaying rule info on Card
This commit is contained in:
parent
eb86378bc1
commit
fe2cd395a6
55 changed files with 333 additions and 94 deletions
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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", "<i>Chosen type: " + typeChoice.getChoice().toString() + "</i>");
|
||||
permanent.addInfo("chosen type", "<i>Chosen type: " + typeChoice.getChoice().toString() + "</i>", game);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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", "<i>Chosen player: " + chosenPlayer.getName() + "</i>");
|
||||
permanent.addInfo("chosen player", "<i>Chosen player: " + chosenPlayer.getName() + "</i>", game);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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", "<font color = 'blue'>Chosen players: " + player1.getName() +", " + player2.getName() + "</font>");
|
||||
permanent.addInfo("chosen players", "<font color = 'blue'>Chosen players: " + player1.getName() +", " + player2.getName() + "</font>", game);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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", "<font color = 'blue'>Chosen color: " + colorChoice.getColor().getDescription() + "</font>");
|
||||
permanent.addInfo("chosen color", "<font color = 'blue'>Chosen color: " + colorChoice.getColor().getDescription() + "</font>", game);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -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", "<i>(Do both if {W}{B} was spent.)<i>");
|
||||
this.getSpellAbility().addEffect(new InfoEffect("<i>(Do both if {W}{B} was spent.)</i>"));
|
||||
this.getSpellAbility().addWatcher(new ManaSpentToCastWatcher());
|
||||
|
||||
}
|
||||
|
|
|
@ -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", "<i>(Do both if {B}{G} was spent.)<i>");
|
||||
this.getSpellAbility().addEffect(new InfoEffect("<i>(Do both if {B}{G} was spent.)</i>"));
|
||||
this.getSpellAbility().addWatcher(new ManaSpentToCastWatcher());
|
||||
}
|
||||
|
||||
|
|
|
@ -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", "<i>(Do both if {G}{U} was spent.)<i>");
|
||||
this.getSpellAbility().addEffect(new InfoEffect("<i>(Do both if {G}{U} was spent.)</i>"));
|
||||
this.getSpellAbility().addWatcher(new ManaSpentToCastWatcher());
|
||||
}
|
||||
|
||||
|
|
|
@ -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", "<i>(Do both if {R}{W} was spent.)</i>");
|
||||
this.getSpellAbility().addEffect(new InfoEffect("<i>(Do both if {R}{W} was spent.)</i>"));
|
||||
this.getSpellAbility().addWatcher(new ManaSpentToCastWatcher());
|
||||
}
|
||||
|
||||
|
|
|
@ -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", "<i>(Do both if {U}{R} was spent.)</i>");
|
||||
this.getSpellAbility().addEffect(new InfoEffect("<i>(Do both if {U}{R} was spent.)</i>"));
|
||||
this.getSpellAbility().addWatcher(new ManaSpentToCastWatcher());
|
||||
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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", "<font color = 'blue'>Chosen color: " + colorChoice.getColor().getDescription() + "</font>");
|
||||
permanent.addInfo("chosen color", "<font color = 'blue'>Chosen color: " + colorChoice.getColor().getDescription() + "</font>", game);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -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", "<i>Chosen type: " + typeChoice.getChoice().toString() + "</i>");
|
||||
permanent.addInfo("chosen type", "<i>Chosen type: " + typeChoice.getChoice().toString() + "</i>", game);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -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", "<i>Chosen type: " + typeChoice.getChoice().toString() + "</i>");
|
||||
permanent.addInfo("chosen type", "<i>Chosen type: " + typeChoice.getChoice().toString() + "</i>", game);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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}"));
|
||||
|
|
|
@ -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", "<i>Chosen type: " + typeChoice.getChoice() + "</i>");
|
||||
permanent.addInfo("chosen type", "<i>Chosen type: " + typeChoice.getChoice() + "</i>", game);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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", "<i>Chosen type: " + typeChoice.getChoice().toString() + "</i>");
|
||||
permanent.addInfo("chosen type", "<i>Chosen type: " + typeChoice.getChoice().toString() + "</i>", game);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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", "<font color = 'blue'>Chosen color: " + colorChoice.getColor().getDescription() + "</font>");
|
||||
curseOfWizardry.addInfo("chosen color", "<font color = 'blue'>Chosen color: " + colorChoice.getColor().getDescription() + "</font>", game);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -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", "<i>(Do both if {G}{W} was spent.)</i>");
|
||||
this.getSpellAbility().addEffect(new InfoEffect("<i>(Do both if {G}{W} was spent.)</i>"));
|
||||
this.getSpellAbility().addWatcher(new ManaSpentToCastWatcher());
|
||||
|
||||
|
||||
|
|
|
@ -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", "<i>(Do both if {R}{G} was spent.)</i>");
|
||||
this.getSpellAbility().addEffect(new InfoEffect("<i>(Do both if {R}{G} was spent.)</i>"));
|
||||
this.getSpellAbility().addWatcher(new ManaSpentToCastWatcher());
|
||||
|
||||
|
||||
|
|
|
@ -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("<font color='blue'>Chosen color: ").append(colorChoice.getColor().getDescription()).append("</font>").toString());
|
||||
permanent.addInfo("chosen color", new StringBuilder("<font color='blue'>Chosen color: ").append(colorChoice.getColor().getDescription()).append("</font>").toString(), game);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -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", "<font color = 'blue'>Chosen color: " + colorChoice.getColor().getDescription() + "</font>");
|
||||
permanent.addInfo("chosen color", "<font color = 'blue'>Chosen color: " + colorChoice.getColor().getDescription() + "</font>", game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -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", "<i>(Do both if {W}{U} was spent.)</i>");
|
||||
this.getSpellAbility().addEffect(new InfoEffect("<i>(Do both if {W}{U} was spent.)</i>"));
|
||||
this.getSpellAbility().addWatcher(new ManaSpentToCastWatcher());
|
||||
|
||||
}
|
||||
|
|
|
@ -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", "<i>(Do both if {U}{B} was spent.)</i>");
|
||||
this.getSpellAbility().addEffect(new InfoEffect("<i>(Do both if {U}{B} was spent.)</i>"));
|
||||
this.getSpellAbility().addWatcher(new ManaSpentToCastWatcher());
|
||||
}
|
||||
|
||||
|
|
|
@ -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", "<i>(Do both if {B}{R} was spent.)</i>");
|
||||
this.getSpellAbility().addEffect(new InfoEffect("<i>(Do both if {B}{R} was spent.)</i>"));
|
||||
this.getSpellAbility().addWatcher(new ManaSpentToCastWatcher());
|
||||
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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", "<font color = 'blue'>Chosen color: " + choice.getColor().getDescription() + "</font>");
|
||||
permanent.addInfo("chosen color", "<font color = 'blue'>Chosen color: " + choice.getColor().getDescription() + "</font>", game);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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", "<font color = 'blue'>Chosen mode: " + choice.getChoice() + "</font>");
|
||||
sourcePermanent.addInfo("_modeChoice", "<font color = 'blue'>Chosen mode: " + choice.getChoice() + "</font>", game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
61
Mage/src/mage/abilities/effects/common/InfoEffect.java
Normal file
61
Mage/src/mage/abilities/effects/common/InfoEffect.java
Normal file
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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<String> getRules();
|
||||
List<String> getRules(); // gets base card rules
|
||||
List<String> 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
|
||||
|
|
|
@ -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<String, String> 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<String> rulesError = new ArrayList<String>() {{add("Exception occured in rules generation");}};
|
||||
|
||||
@Override
|
||||
public List<String> getRules() {
|
||||
try {
|
||||
List<String> 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<String> getRules(Game game) {
|
||||
try {
|
||||
List<String> 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<String> 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() {}
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ public class CardTextPredicate implements Predicate<Card> {
|
|||
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;
|
||||
|
|
|
@ -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<Counter> markedDamage;
|
||||
protected int timesLoyaltyUsed = 0;
|
||||
|
||||
protected Map<String, String> info;
|
||||
|
||||
private static final List<UUID> emptyList = Collections.unmodifiableList(new ArrayList<UUID>());
|
||||
|
||||
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<String> getRules(Game game) {
|
||||
try {
|
||||
List<String> 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) {
|
||||
|
|
|
@ -701,6 +701,11 @@ public class Spell implements StackObject, Card {
|
|||
return card.getRules();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> 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
|
||||
}
|
||||
|
||||
|
|
|
@ -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<UUID, Integer> entry : damageToPlayer.entrySet()) {
|
||||
Player damagedPlayer = game.getPlayer(entry.getKey());
|
||||
sb.setLength(0);
|
||||
sb.append("<b>Commander</b> 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue