mirror of
https://github.com/magefree/mage.git
synced 2025-12-29 23:12:10 -08:00
fixed the LastTimeCounterRemovedCondition, moved the Chronozoa test to fit the package convention, added a test case
This commit is contained in:
parent
15e3101bf4
commit
9b44c9a087
4 changed files with 91 additions and 20 deletions
|
|
@ -2,6 +2,7 @@ package mage.abilities.condition.common;
|
|||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
|
@ -20,8 +21,15 @@ public class LastTimeCounterRemovedCondition implements Condition{
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
final Permanent p = game.getPermanent(source.getSourceId());
|
||||
final int timeCounters = p.getCounters().getCount(CounterType.TIME);
|
||||
return timeCounters == 0;
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent == null) {
|
||||
permanent = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
|
||||
}
|
||||
if (permanent != null) {
|
||||
final int timeCounters = permanent.getCounters().getCount(CounterType.TIME);
|
||||
return timeCounters == 0;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue