use of mage.game.permanent.PermanentToken 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.game.permanent.PermanentToken in project mage by magefree.
the class GutterGrimeEffect method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
UUID targetId = event.getTargetId();
MageObject card = game.getLastKnownInformation(targetId, Zone.BATTLEFIELD);
if (card instanceof Permanent && !(card instanceof PermanentToken)) {
Permanent permanent = (Permanent) card;
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (zEvent.isDiesEvent() && permanent.isControlledBy(this.controllerId) && (targetId.equals(this.getSourceId()) || (permanent.isCreature(game) && !(permanent instanceof PermanentToken)))) {
return true;
}
}
return false;
}
use of mage.game.permanent.PermanentToken in project mage by magefree.
the class ProwlingGeistcatcherReturnEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Card card = game.getCard(getTargetPointer().getFirst(game, source));
if (player != null && card != null) {
player.moveCardsToExile(card, source, game, true, CardUtil.getExileZoneId(game, source), CardUtil.getSourceName(game, source));
}
Permanent exiled = (Permanent) getValue("sacrificedPermanent");
Permanent permanent = source.getSourcePermanentIfItStillExists(game);
if (exiled instanceof PermanentToken && permanent != null) {
permanent.addCounters(CounterType.P1P1.createInstance(), source, game);
}
return true;
}
use of mage.game.permanent.PermanentToken in project mage by magefree.
the class SkullSkaabTriggeredAbility method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent exploiter = game.getPermanentOrLKIBattlefield(event.getSourceId());
Permanent exploited = game.getPermanentOrLKIBattlefield(event.getTargetId());
return exploiter != null && exploited != null && exploiter.isCreature(game) && exploited.isCreature(game) && exploiter.isControlledBy(getControllerId()) && !(exploited instanceof PermanentToken);
}
use of mage.game.permanent.PermanentToken in project mage by magefree.
the class GarthOneEyeTest method testShivanDragon.
@Test
public void testShivanDragon() {
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 6);
addCard(Zone.BATTLEFIELD, playerA, garth);
setChoice(playerA, dragon);
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Choose");
setStopAt(1, PhaseStep.END_TURN);
execute();
assertAllCommandsUsed();
assertTapped(garth, true);
assertTapped("Mountain", true);
Permanent permanent = getPermanent(dragon);
Assert.assertNotNull(dragon + " should be on the battlefield", permanent);
Assert.assertTrue(dragon + " should be a token", permanent instanceof PermanentToken);
}
Aggregations