use of mage.util.CardUtil in project mage by magefree.
the class HawkinsNationalLaboratoryWatcher method watch.
@Override
public void watch(GameEvent event, Game game) {
if (event.getType() != GameEvent.EventType.SACRIFICED_PERMANENT) {
return;
}
Permanent permanent = game.getPermanentOrLKIBattlefield(event.getSourceId());
if (permanent == null || !permanent.hasSubtype(SubType.CLUE, game)) {
return;
}
playerMap.compute(event.getPlayerId(), CardUtil::setOrIncrementValue);
}
use of mage.util.CardUtil in project mage by magefree.
the class GyomeMasterChefWatcher method watch.
@Override
public void watch(GameEvent event, Game game) {
if (event.getType() != GameEvent.EventType.ENTERS_THE_BATTLEFIELD) {
return;
}
Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget();
if (permanent == null || permanent instanceof PermanentToken || !permanent.isCreature(game)) {
return;
}
playerMap.compute(event.getPlayerId(), CardUtil::setOrIncrementValue);
}
use of mage.util.CardUtil in project mage by magefree.
the class SerpentsSoulJarWatcher method addPlayable.
static void addPlayable(Ability source, Game game) {
MageObjectReference mor = new MageObjectReference(source);
game.getState().getWatcher(SerpentsSoulJarWatcher.class).morMap.computeIfAbsent(mor, m -> new HashMap<>()).compute(source.getControllerId(), CardUtil::setOrIncrementValue);
}
use of mage.util.CardUtil in project mage by magefree.
the class IdolOfEnduranceWatcher method addPlayable.
static void addPlayable(Ability source, Game game) {
MageObjectReference mor = new MageObjectReference(source);
game.getState().getWatcher(IdolOfEnduranceWatcher.class).morMap.computeIfAbsent(mor, m -> new HashMap<>()).compute(source.getControllerId(), CardUtil::setOrIncrementValue);
}
use of mage.util.CardUtil in project mage by magefree.
the class ValiantRescuerWatcher method watch.
@Override
public void watch(GameEvent event, Game game) {
if (event.getType() != GameEvent.EventType.ACTIVATED_ABILITY || game.getState().getStack().isEmpty()) {
return;
}
StackObject item = game.getState().getStack().getFirst();
if (item instanceof StackAbility && item.getStackAbility() instanceof CyclingAbility) {
playerMap.computeIfAbsent(event.getPlayerId(), u -> new HashMap<>());
playerMap.get(event.getPlayerId()).compute(event.getSourceId(), CardUtil::setOrIncrementValue);
}
}
Aggregations