mirror of
https://github.com/correl/mage.git
synced 2024-11-25 11:09:53 +00:00
* Delaying Shield - Fixed that always only 1 counter was removed but all had to be paid.
This commit is contained in:
parent
27e62a07a3
commit
7375ba2819
1 changed files with 12 additions and 13 deletions
|
@ -62,10 +62,9 @@ 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()));
|
||||||
|
|
||||||
// At the beginning of your upkeep, remove all delay counters from Delaying Shield. For each delay counter removed this way, you lose 1 life unless you pay {1}{W}.
|
// At the beginning of your upkeep, remove all delay counters from Delaying Shield. For each delay counter removed this way, you lose 1 life unless you pay {1}{W}.
|
||||||
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new DelayingShieldUpkeepEffect(), TargetController.YOU, false));
|
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new DelayingShieldUpkeepEffect(), TargetController.YOU, false));
|
||||||
}
|
}
|
||||||
|
@ -81,7 +80,7 @@ public class DelayingShield extends CardImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
class DelayingShieldReplacementEffect extends ReplacementEffectImpl {
|
class DelayingShieldReplacementEffect extends ReplacementEffectImpl {
|
||||||
|
|
||||||
DelayingShieldReplacementEffect() {
|
DelayingShieldReplacementEffect() {
|
||||||
super(Duration.WhileOnBattlefield, Outcome.PreventDamage);
|
super(Duration.WhileOnBattlefield, Outcome.PreventDamage);
|
||||||
staticText = "If damage would be dealt to you, put that many delay counters on {this} instead";
|
staticText = "If damage would be dealt to you, put that many delay counters on {this} instead";
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,7 +101,7 @@ class DelayingShieldReplacementEffect extends ReplacementEffectImpl {
|
||||||
public boolean checksEventType(GameEvent event, Game game) {
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
return event.getType() == EventType.DAMAGE_PLAYER;
|
return event.getType() == EventType.DAMAGE_PLAYER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
return event.getTargetId().equals(source.getControllerId());
|
return event.getTargetId().equals(source.getControllerId());
|
||||||
|
@ -115,30 +114,30 @@ class DelayingShieldReplacementEffect extends ReplacementEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
class DelayingShieldUpkeepEffect extends OneShotEffect {
|
class DelayingShieldUpkeepEffect extends OneShotEffect {
|
||||||
|
|
||||||
DelayingShieldUpkeepEffect() {
|
DelayingShieldUpkeepEffect() {
|
||||||
super(Outcome.Benefit);
|
super(Outcome.Benefit);
|
||||||
this.staticText = "remove all delay counters from {this}. For each delay counter removed this way, you lose 1 life unless you pay {1}{W}";
|
this.staticText = "remove all delay counters from {this}. For each delay counter removed this way, you lose 1 life unless you pay {1}{W}";
|
||||||
}
|
}
|
||||||
|
|
||||||
DelayingShieldUpkeepEffect(final DelayingShieldUpkeepEffect effect) {
|
DelayingShieldUpkeepEffect(final DelayingShieldUpkeepEffect effect) {
|
||||||
super(effect);
|
super(effect);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DelayingShieldUpkeepEffect copy() {
|
public DelayingShieldUpkeepEffect copy() {
|
||||||
return new DelayingShieldUpkeepEffect(this);
|
return new DelayingShieldUpkeepEffect(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@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;
|
||||||
|
|
Loading…
Reference in a new issue