* Delaying Shield - Fixed that always only 1 counter was removed but all had to be paid.

This commit is contained in:
LevelX2 2015-07-02 21:24:18 +02:00
parent 27e62a07a3
commit 7375ba2819

View file

@ -62,7 +62,6 @@ public class DelayingShield extends CardImpl {
super(ownerId, 17, "Delaying Shield", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{3}{W}"); super(ownerId, 17, "Delaying Shield", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{3}{W}");
this.expansionSetCode = "ODY"; this.expansionSetCode = "ODY";
// If damage would be dealt to you, put that many delay counters on Delaying Shield instead. // If damage would be dealt to you, put that many delay counters on Delaying Shield instead.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new DelayingShieldReplacementEffect())); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new DelayingShieldReplacementEffect()));
@ -94,7 +93,7 @@ class DelayingShieldReplacementEffect extends ReplacementEffectImpl {
@Override @Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) { public boolean replaceEvent(GameEvent event, Ability source, Game game) {
DamageEvent damageEvent = (DamageEvent) event; DamageEvent damageEvent = (DamageEvent) event;
new AddCountersSourceEffect(CounterType.DELAY.createInstance(damageEvent.getAmount())).apply(game, source); new AddCountersSourceEffect(CounterType.DELAY.createInstance(damageEvent.getAmount()), true).apply(game, source);
return true; return true;
} }
@ -132,13 +131,13 @@ class DelayingShieldUpkeepEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
Permanent permanent = game.getPermanent(source.getSourceId()); Permanent permanent = game.getPermanent(source.getSourceId());
if (player != null && permanent != null) { if (controller != null && permanent != null) {
int numCounters = permanent.getCounters().getCount(CounterType.DELAY); int numCounters = permanent.getCounters().getCount(CounterType.DELAY);
permanent.removeCounters(CounterType.DELAY.createInstance(), game); permanent.removeCounters(CounterType.DELAY.createInstance(numCounters), game);
for (int i = numCounters; i > 0; i--) { for (int i = numCounters; i > 0; i--) {
if (player.chooseUse(Outcome.Benefit, "Pay {1}{W}? (" + i + " counters left to pay)", source, game)) { if (controller.chooseUse(Outcome.Benefit, "Pay {1}{W}? (" + i + " counters left to pay)", source, game)) {
Cost cost = new ManaCostsImpl<>("{1}{W}"); Cost cost = new ManaCostsImpl<>("{1}{W}");
if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) { if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) {
continue; continue;