Player: updated Commander code with using MayPlay

This commit is contained in:
Hanmac
2016-07-28 19:55:40 +00:00
parent 4a10466190
commit 0f4f6e9063
3 changed files with 7 additions and 38 deletions

View File

@@ -120,17 +120,6 @@ public class CardFactory {
} }
out.setCommander(in.isCommander()); out.setCommander(in.isCommander());
/*
if(out.isCommander())
{
out.addStaticAbility("Mode$ RaiseCost | Amount$ CommanderCostRaise | Type$ Spell | ValidCard$ Card.Self+wasCastFromCommand | EffectZone$ All | AffectedZone$ Stack");
SpellAbility sa = AbilityFactory.getAbility(
"SP$ PermanentCreature | SorcerySpeed$ True | ActivationZone$ Command | SubAbility$ DBCommanderIncCast | Cost$ " + out.getManaCost().toString(),
out);
out.addSpellAbility(sa);
}
*/
return out; return out;
} }

View File

@@ -2117,26 +2117,6 @@ public class CardFactoryUtil {
intrinsicAbility.setIntrinsic(true); intrinsicAbility.setIntrinsic(true);
} }
} }
/*
public static final void addCommanderAbilities(final Card cmd) {
ReplacementEffect re = ReplacementHandler.parseReplacement(
"Event$ Moved | Destination$ Graveyard,Exile | ValidCard$ Card.Self | Secondary$ True | Optional$ True | OptionalDecider$ You | ReplaceWith$ CommanderMoveReplacement | " +
"Description$ If a commander would be put into its owner's graveyard or exile from anywhere, that player may put it into the command zone instead.",
cmd, true);
cmd.addReplacementEffect(re);
if (StringUtils.isBlank(cmd.getSVar("CommanderCostRaise"))) // why condition check is needed?
cmd.setSVar("CommanderCostRaise", "Number$0");
String cmdManaCost = cmd.getManaCost().toString();
cmd.setSVar("CommanderMoveReplacement", "DB$ ChangeZone | Origin$ Battlefield,Graveyard,Exile,Library | Destination$ Command | Defined$ ReplacedCard");
cmd.setSVar("DBCommanderIncCast", "DB$ StoreSVar | SVar$ CommanderCostRaise | Type$ CountSVar | Expression$ CommanderCostRaise/Plus.2");
SpellAbility sa = AbilityFactory.getAbility("SP$ PermanentCreature | SorcerySpeed$ True | ActivationZone$ Command | SubAbility$ DBCommanderIncCast | Cost$ " + cmdManaCost, cmd);
cmd.addSpellAbility(sa);
cmd.addIntrinsicAbility("SP$ PermanentCreature | SorcerySpeed$ True | ActivationZone$ Command | SubAbility$ DBCommanderIncCast | Cost$ " + cmdManaCost);
cmd.addStaticAbility("Mode$ RaiseCost | Amount$ CommanderCostRaise | Type$ Spell | ValidCard$ Card.Self+wasCastFromCommand | EffectZone$ All | AffectedZone$ Stack");
}
*/
/** /**
* <p> * <p>

View File

@@ -2816,19 +2816,19 @@ public class Player extends GameEntity implements Comparable<Player> {
Trigger t = TriggerHandler.parseTrigger("Mode$ SpellCast | Static$ True | ValidCard$ Card.YouOwn+IsCommander+wasCastFromCommand | References$ CommanderCostRaise | Execute$ DBCommanderIncCast", eff, true); Trigger t = TriggerHandler.parseTrigger("Mode$ SpellCast | Static$ True | ValidCard$ Card.YouOwn+IsCommander+wasCastFromCommand | References$ CommanderCostRaise | Execute$ DBCommanderIncCast", eff, true);
eff.addTrigger(t); eff.addTrigger(t);
ReplacementEffect r; String moved = "Event$ Moved | ValidCard$ Card.IsCommander+YouOwn | Secondary$ True | Optional$ True | OptionalDecider$ You | ReplaceWith$ CommanderMoveReplacement ";
if (game.getRules().hasAppliedVariant(GameType.TinyLeaders)) { if (game.getRules().hasAppliedVariant(GameType.TinyLeaders)) {
r = ReplacementHandler.parseReplacement("Event$ Moved | Destination$ Graveyard,Exile | ValidCard$ Card.IsCommander+YouOwn | Secondary$ True | Optional$ True | OptionalDecider$ You | ReplaceWith$ CommanderMoveReplacement | Description$ If a commander would be put into its owner's graveyard or exile from anywhere, that player may put it into the command zone instead.", eff, true); moved += " | Destination$ Graveyard,Exile | Description$ If a commander would be put into its owner's graveyard or exile from anywhere, that player may put it into the command zone instead.";
} else { } else {
r = ReplacementHandler.parseReplacement("Event$ Moved | Destination$ Graveyard,Exile,Hand,Library | ValidCard$ Card.IsCommander+YouOwn | Secondary$ True | Optional$ True | OptionalDecider$ You | ReplaceWith$ CommanderMoveReplacement | Description$ If a commander would be exiled or put into hand, graveyard, or library from anywhere, that player may put it into the command zone instead.", eff, true); moved += " | Destination$ Graveyard,Exile,Hand,Library | Description$ If a commander would be exiled or put into hand, graveyard, or library from anywhere, that player may put it into the command zone instead.";
} }
eff.addReplacementEffect(r); eff.addReplacementEffect(ReplacementHandler.parseReplacement(moved, eff, true));
String mayBePlayedAbility = "Mode$ Continuous | EffectZone$ Command | AddKeyword$ May be played | Affected$ Card.YouOwn+IsCommander | AffectedZone$ Command"; String mayBePlayedAbility = "Mode$ Continuous | EffectZone$ Command | MayPlay$ True | Affected$ Card.YouOwn+IsCommander | AffectedZone$ Command";
if (game.getRules().hasAppliedVariant(GameType.Planeswalker)) { //support paying for Planeswalker with any color mana if (game.getRules().hasAppliedVariant(GameType.Planeswalker)) { //support paying for Planeswalker with any color mana
mayBePlayedAbility += " | AddHiddenKeyword$ May spend mana as though it were mana of any color to cast CARDNAME"; mayBePlayedAbility += " | MayPlayIgnoreColor$ True";
} }
eff.addStaticAbility(mayBePlayedAbility); eff.addStaticAbility(mayBePlayedAbility);
eff.addStaticAbility("Mode$ RaiseCost | EffectZone$ Command | References$ CommanderCostRaise | Amount$ CommanderCostRaise | Type$ Spell | ValidCard$ Card.YouOwn+IsCommander+wasCastFromCommand | EffectZone$ All | AffectedZone$ Command,Stack"); eff.addStaticAbility("Mode$ RaiseCost | EffectZone$ Command | References$ CommanderCostRaise | Amount$ CommanderCostRaise | Type$ Spell | ValidCard$ Card.YouOwn+IsCommander+wasCastFromCommand | AffectedZone$ Command,Stack");
return eff; return eff;
} }