use of mage.game.permanent.Permanent in project mage by magefree.
the class DeliriumEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent creature = game.getPermanent(source.getFirstTarget());
if (creature != null) {
int amount = creature.getPower().getValue();
Player controller = game.getPlayer(creature.getControllerId());
if (controller != null) {
controller.damage(amount, creature.getId(), source, game);
return true;
}
}
return false;
}
use of mage.game.permanent.Permanent in project mage by magefree.
the class DeepglowSkateEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
boolean didOne = false;
for (Target target : source.getTargets()) {
for (UUID targetID : target.getTargets()) {
Permanent permanent = game.getPermanent(targetID);
if (permanent != null) {
for (Counter counter : permanent.getCounters(game).values()) {
Counter newCounter = new Counter(counter.getName(), counter.getCount());
permanent.addCounters(newCounter, source.getControllerId(), source, game);
didOne = true;
}
}
}
}
return didOne;
}
use of mage.game.permanent.Permanent in project mage by magefree.
the class DiffusionSliverTriggeredAbility method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (!game.getOpponents(this.controllerId).contains(event.getPlayerId())) {
return false;
}
Permanent creature = game.getPermanent(event.getTargetId());
if (creature == null || !filter.match(creature, getSourceId(), getControllerId(), game)) {
return false;
}
this.getEffects().clear();
Effect effect = new CounterUnlessPaysEffect(new GenericManaCost(2));
effect.setTargetPointer(new FixedTarget(event.getSourceId(), game));
this.addEffect(effect);
return true;
}
use of mage.game.permanent.Permanent in project mage by magefree.
the class DinosaurHunterAbility method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (!event.getSourceId().equals(getSourceId())) {
return false;
}
Permanent targetPermanent = game.getPermanentOrLKIBattlefield(event.getTargetId());
if (targetPermanent == null || !targetPermanent.hasSubtype(SubType.DINOSAUR, game)) {
return false;
}
getEffects().setTargetPointer(new FixedTarget(targetPermanent, game));
return true;
}
use of mage.game.permanent.Permanent in project mage by magefree.
the class DinrovaHorrorEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent target = game.getPermanent(source.getFirstTarget());
if (target != null) {
Player controller = game.getPlayer(target.getControllerId());
if (controller != null) {
controller.moveCards(target, Zone.HAND, source, game);
controller.discard(1, false, false, source, game);
return true;
}
}
return false;
}
Aggregations