allow 'where X is' in Draw

master
melvinzhang 2017-08-03 09:34:16 +08:00
parent ec5f99dc7a
commit 23cc972e33
3 changed files with 5 additions and 31 deletions

View File

@ -1,27 +0,0 @@
[
new ThisDamagePlayerTrigger() {
@Override
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicDamage damage) {
final int amount = permanent.getCounters(MagicCounterType.Charge);
return new MagicEvent(
permanent,
new MagicSimpleMayChoice(
MagicSimpleMayChoice.DRAW_CARDS,
amount,
MagicSimpleMayChoice.DEFAULT_NONE
),
this,
"PN may\$ draw X cards, where X is the number of charge counters on SN."
);
}
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
final int amount = event.getPermanent().getCounters(MagicCounterType.Charge);
final MagicPlayer player = event.getPlayer();
game.logAppendX(player, amount);
if (event.isYes()) {
game.doAction(new DrawAction(player, amount));
}
}
}
]

View File

@ -6,7 +6,7 @@ type=Creature
subtype=Surrakar
cost={1}{U}{U}
pt=2/1
ability=Whenever you cast an instant or sorcery spell, you may put a charge counter on SN.
ability=Whenever you cast an instant or sorcery spell, you may put a charge counter on SN.;\
Whenever SN deals combat damage to a player, you may draw X cards, where X is the number of charge counters on SN.
timing=main
requires_groovy_code
oracle=Whenever you cast an instant or sorcery spell, you may put a charge counter on Surrakar Spellblade.\nWhenever Surrakar Spellblade deals combat damage to a player, you may draw X cards, where X is the number of charge counters on it.

View File

@ -788,7 +788,7 @@ public enum MagicRuleEventAction {
}
},
Draw(
ARG.PLAYERS + "( )?draw(s)?( " + ARG.AMOUNT + ")? (additional )?card(s)?( (for each|equal to) " + ARG.WORDRUN + ")?",
ARG.PLAYERS + "( )?draw(s)?( " + ARG.AMOUNT + ")? (additional )?card(s)?(( for each| equal to|, where X is) " + ARG.WORDRUN + ")?",
MagicTargetHint.Positive,
MagicTiming.Draw,
"Draw"
@ -800,7 +800,8 @@ public enum MagicRuleEventAction {
final MagicTargetFilter<MagicPlayer> filter = ARG.playersParse(matcher);
return (game, event) -> {
final int multiplier = eachCount.getAmount(event);
final int total = cardCount.getAmount(event) * multiplier;
final int total = (eachCount != MagicAmountFactory.One && cardCount == MagicAmountFactory.XCost) ?
multiplier : cardCount.getAmount(event) * multiplier;
if (eachCount != MagicAmountFactory.One) {
game.logAppendValue(event.getPlayer(), total);
}