forked from External/mage
[DSC] Implement Fear of Sleep Paralysis
Also fix UntapSourceCost to allow 'consuming a stun counter' to count as paying untap cost, per rule 118.11, but only if Fear of Sleep Paralysis isn't making stun permanent.
This commit is contained in:
parent
c6bec887b9
commit
8f3cd5a106
3 changed files with 100 additions and 0 deletions
|
|
@ -6,6 +6,7 @@ import mage.abilities.Ability;
|
|||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.CostImpl;
|
||||
import mage.constants.AsThoughEffectType;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
|
|
@ -27,7 +28,13 @@ public class UntapSourceCost extends CostImpl {
|
|||
public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) {
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
int stunCount = permanent.getCounters(game).getCount(CounterType.STUN);
|
||||
paid = permanent.untap(game);
|
||||
// 118.11 - if a stun counter replaces the untap, the cost has still been paid.
|
||||
// Fear of Sleep Paralysis ruling - if the stun counter can't be removed, the untap cost hasn't been paid.
|
||||
if (stunCount > 0) {
|
||||
paid = permanent.getCounters(game).getCount(CounterType.STUN) < stunCount;
|
||||
}
|
||||
}
|
||||
return paid;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue