use of mage.abilities.effects.common.continuous.BoostSourceEffect in project mage by magefree.
the class FreeRangeChickenWatcher method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
List<Integer> results = controller.rollDice(outcome, source, game, 6, 2, 0);
int firstRoll = results.get(0);
int secondRoll = results.get(1);
if (firstRoll == secondRoll) {
game.addEffect(new BoostSourceEffect(firstRoll, firstRoll, Duration.EndOfTurn), source);
}
FreeRangeChickenWatcher watcher = game.getState().getWatcher(FreeRangeChickenWatcher.class);
if (watcher != null) {
int totalRoll = firstRoll + secondRoll;
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
if (sourcePermanent != null) {
if (watcher.rolledThisTurn(sourcePermanent.getId(), totalRoll)) {
sourcePermanent.sacrifice(source, game);
} else {
watcher.addRoll(sourcePermanent.getId(), totalRoll);
}
}
}
return true;
}
return false;
}
use of mage.abilities.effects.common.continuous.BoostSourceEffect in project mage by magefree.
the class HeartlessActEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent != null) {
int toRemove = 3;
int removed = 0;
String[] counterNames = permanent.getCounters(game).keySet().toArray(new String[0]);
for (String counterName : counterNames) {
if (controller.chooseUse(Outcome.Neutral, "Remove " + counterName + " counters?", source, game)) {
if (permanent.getCounters(game).get(counterName).getCount() == 1 || (toRemove - removed == 1)) {
permanent.removeCounters(counterName, 1, source, game);
removed++;
} else {
int amount = controller.getAmount(1, Math.min(permanent.getCounters(game).get(counterName).getCount(), toRemove - removed), "How many?", game);
if (amount > 0) {
removed += amount;
permanent.removeCounters(counterName, amount, source, game);
}
}
}
if (removed >= toRemove) {
break;
}
}
game.addEffect(new BoostSourceEffect(removed, 0, Duration.EndOfTurn), source);
return true;
}
return true;
}
use of mage.abilities.effects.common.continuous.BoostSourceEffect in project mage by magefree.
the class ImpelledGiantBoostEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent impelledGiant = game.getPermanent(source.getSourceId());
Permanent tappedCreature = getTargetPointer().getFirstTargetPermanentOrLKI(game, source);
if (tappedCreature != null && impelledGiant != null) {
int amount = tappedCreature.getPower().getValue();
game.addEffect(new BoostSourceEffect(amount, 0, Duration.EndOfTurn), source);
}
return true;
}
use of mage.abilities.effects.common.continuous.BoostSourceEffect in project mage by magefree.
the class MyrBattlesphereEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Permanent myr = game.getPermanentOrLKIBattlefield(source.getSourceId());
int tappedAmount = 0;
TargetPermanent target = new TargetPermanent(0, 1, filter, true);
while (controller.canRespond()) {
target.clearChosen();
if (target.canChoose(source.getSourceId(), source.getControllerId(), game)) {
Map<String, Serializable> options = new HashMap<>();
options.put("UI.right.btn.text", "Myr tapping complete");
controller.choose(outcome, target, source.getControllerId(), game, options);
if (!target.getTargets().isEmpty()) {
UUID creature = target.getFirstTarget();
if (creature != null) {
game.getPermanent(creature).tap(source, game);
tappedAmount++;
}
} else {
break;
}
} else {
break;
}
}
if (tappedAmount > 0) {
game.informPlayers(controller.getLogName() + " taps " + tappedAmount + " Myrs");
// boost effect
game.addEffect(new BoostSourceEffect(tappedAmount, 0, Duration.EndOfTurn), source);
// damage to defender
return game.damagePlayerOrPlaneswalker(targetPointer.getFirst(game, source), tappedAmount, myr.getId(), source, game, false, true) > 0;
}
return true;
}
return false;
}
use of mage.abilities.effects.common.continuous.BoostSourceEffect in project mage by magefree.
the class BrightlingEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Permanent permanent = game.getPermanent(source.getSourceId());
if (player == null || permanent == null) {
return false;
}
int boost = (player.chooseUse(outcome, "Give +1/-1 or -1/+1?", null, "+1/-1", "-1/+1", source, game) ? 1 : -1);
game.addEffect(new BoostSourceEffect(boost, -1 * boost, Duration.EndOfTurn), source);
return true;
}
Aggregations