mirror of
https://github.com/correl/mage.git
synced 2024-12-26 19:16:54 +00:00
Remove a counter from - fixed game error
This commit is contained in:
parent
35b00c3da1
commit
3b0de691c8
1 changed files with 16 additions and 10 deletions
|
@ -46,16 +46,22 @@ public class RemoveCountersSourceCost extends CostImpl {
|
|||
@Override
|
||||
public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) {
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
return permanent != null && name.isEmpty()
|
||||
? permanent
|
||||
.getCounters(game)
|
||||
.values()
|
||||
.stream()
|
||||
.map(Counter::getCount)
|
||||
.anyMatch(i -> i > 0)
|
||||
: permanent
|
||||
.getCounters(game)
|
||||
.getCount(name) >= amount;
|
||||
if (permanent == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.name.isEmpty()) {
|
||||
// any counter
|
||||
return permanent
|
||||
.getCounters(game)
|
||||
.values()
|
||||
.stream()
|
||||
.map(Counter::getCount)
|
||||
.anyMatch(i -> i >= amount);
|
||||
} else {
|
||||
// specific counter
|
||||
return permanent.getCounters(game).getCount(name) >= amount;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue