use of mage.abilities.effects.common.DamageTargetEffect in project mage by magefree.
the class SunflareShamanEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
int ElementalsInYourGraveyard = controller.getGraveyard().count(filter, game);
new DamageTargetEffect(ElementalsInYourGraveyard).apply(game, source);
new DamageSelfEffect(ElementalsInYourGraveyard).apply(game, source);
return true;
}
return false;
}
use of mage.abilities.effects.common.DamageTargetEffect in project mage by magefree.
the class TigerTribeHunterEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
TargetPermanent target = new TargetPermanent(0, 1, StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE, true);
player.choose(outcome, target, source.getSourceId(), game);
Permanent permanent = game.getPermanent(target.getFirstTarget());
if (permanent == null) {
return false;
}
int power = Math.max(permanent.getPower().getValue(), 0);
if (!permanent.sacrifice(source, game)) {
return false;
}
ReflexiveTriggeredAbility ability = new ReflexiveTriggeredAbility(new DamageTargetEffect(power), false, "{this} deals damage equal to the sacrificed creature's power to target creature.");
ability.addTarget(new TargetCreaturePermanent());
game.fireReflexiveTriggeredAbility(ability, source);
return true;
}
use of mage.abilities.effects.common.DamageTargetEffect in project mage by magefree.
the class ExplosionOfRichesEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
Player player = game.getPlayer(playerId);
if (player == null) {
continue;
}
if (!playerId.equals(source.getControllerId()) && !player.chooseUse(outcome, "Draw a card?", source, game)) {
continue;
}
if (player.drawCards(1, source, game) >= 1) {
continue;
}
ReflexiveTriggeredAbility ability = new ReflexiveTriggeredAbility(new DamageTargetEffect(5), false, "{this} deals damage to target opponent chosen at random");
Target target = new TargetOpponent();
target.setRandom(true);
ability.addTarget(target);
game.fireReflexiveTriggeredAbility(ability, source);
}
return true;
}
use of mage.abilities.effects.common.DamageTargetEffect in project mage by magefree.
the class ImminentDoomEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent imminentDoom = game.getPermanent(source.getSourceId());
if (imminentDoom != null) {
Effect effect = new DamageTargetEffect((int) game.getState().getValue("ImminentDoomCount" + source.getSourceId().toString()));
effect.apply(game, source);
imminentDoom.addCounters(CounterType.DOOM.createInstance(), source.getControllerId(), source, game);
return true;
}
return false;
}
use of mage.abilities.effects.common.DamageTargetEffect in project mage by magefree.
the class LandsEdgeEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
DiscardCardCost cost = (DiscardCardCost) source.getCosts().get(0);
if (cost != null) {
List<Card> cards = cost.getCards();
if (cards.size() == 1 && cards.get(0).isLand(game)) {
Effect effect = new DamageTargetEffect(2);
effect.setTargetPointer(getTargetPointer());
effect.apply(game, source);
}
}
return true;
}
return false;
}
Aggregations