use of mage.abilities.effects.common.DamageEverythingEffect in project mage by magefree.
the class RancidEarthEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Effect effect1 = new DestroyTargetEffect("destroy that land");
effect1.apply(game, source);
return new DamageEverythingEffect(1).apply(game, source);
}
use of mage.abilities.effects.common.DamageEverythingEffect in project mage by magefree.
the class MagmasaurEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Permanent sourceObject = (Permanent) source.getSourceObjectIfItStillExists(game);
if (sourceObject != null && controller != null) {
if (controller.chooseUse(outcome, "Remove a +1/+1 counter from " + sourceObject.getLogName() + '?', source, game)) {
sourceObject.removeCounters(CounterType.P1P1.getName(), 1, source, game);
} else {
int counters = sourceObject.getCounters(game).getCount(CounterType.P1P1);
sourceObject.sacrifice(source, game);
new DamageEverythingEffect(counters, filter).apply(game, source);
}
return true;
}
return false;
}
use of mage.abilities.effects.common.DamageEverythingEffect in project mage by magefree.
the class ArcbondEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
int damage = (Integer) this.getValue("damage");
UUID sourceId = (UUID) this.getValue("sourceId");
MageObject sourceObject = game.getObject(source.getSourceId());
if (sourceObject != null && damage > 0 && sourceId != null) {
Permanent targetObject = game.getPermanentOrLKIBattlefield(sourceId);
if (targetObject != null) {
game.informPlayers(sourceObject.getLogName() + ": " + targetObject.getLogName() + " deals " + damage + " damage to each other creature and each player");
}
FilterPermanent filter = new FilterCreaturePermanent("each other creature");
filter.add(Predicates.not(new PermanentIdPredicate(sourceId)));
return new DamageEverythingEffect(StaticValue.get(damage), filter, sourceId).apply(game, source);
}
return false;
}
use of mage.abilities.effects.common.DamageEverythingEffect in project mage by magefree.
the class RuptureEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
int power = 0;
TargetControlledCreaturePermanent target = new TargetControlledCreaturePermanent(1, 1, new FilterControlledCreaturePermanent("creature to sacrifice"), true);
if (target.canChoose(source.getSourceId(), player.getId(), game)) {
while (!target.isChosen() && target.canChoose(source.getSourceId(), player.getId(), game) && player.canRespond()) {
player.chooseTarget(Outcome.Sacrifice, target, source, game);
}
Permanent permanent = game.getPermanent(target.getFirstTarget());
if (permanent != null) {
power = permanent.getPower().getValue();
permanent.sacrifice(source, game);
}
}
if (power > 0) {
new DamageEverythingEffect(power, filter).apply(game, source);
}
return true;
}
return false;
}
use of mage.abilities.effects.common.DamageEverythingEffect in project mage by magefree.
the class StrategySchmategyffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
int numTimesToDo = 1;
if (controller != null) {
// 6 - Repeat this process two more times
while (numTimesToDo > 0) {
// ai must try to choose min
int amount = controller.rollDice(Outcome.Detriment, source, game, 6);
numTimesToDo--;
if (amount == 2) {
List<Permanent> artifactPermanents = game.getBattlefield().getActivePermanents(new FilterArtifactPermanent(), controller.getId(), game);
for (Permanent permanent : artifactPermanents) {
permanent.destroy(source, game, false);
}
} else if (amount == 3) {
List<Permanent> landPermanents = game.getBattlefield().getActivePermanents(StaticFilters.FILTER_LANDS, controller.getId(), game);
for (Permanent permanent : landPermanents) {
permanent.destroy(source, game, false);
}
} else if (amount == 4) {
new DamageEverythingEffect(3, new FilterCreaturePermanent()).apply(game, source);
} else if (amount == 5) {
new DiscardHandAllEffect().apply(game, source);
new DrawCardAllEffect(7).apply(game, source);
} else if (amount == 6) {
numTimesToDo += 2;
}
}
}
return false;
}
Aggregations