mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 21:29:17 -08:00
[FIC] Implement Amarant Coral
This commit is contained in:
parent
d6d75edf34
commit
8bae73cea3
7 changed files with 130 additions and 172 deletions
|
|
@ -0,0 +1,47 @@
|
|||
package mage.abilities.effects.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.constants.Outcome;
|
||||
import mage.game.Game;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class DamageEachOtherOpponentThatMuchEffect extends OneShotEffect {
|
||||
|
||||
public DamageEachOtherOpponentThatMuchEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "it deals that much damage to each other opponent";
|
||||
}
|
||||
|
||||
private DamageEachOtherOpponentThatMuchEffect(final DamageEachOtherOpponentThatMuchEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DamageEachOtherOpponentThatMuchEffect copy() {
|
||||
return new DamageEachOtherOpponentThatMuchEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
int damage = (Integer) getValue("damage");
|
||||
if (damage < 1) {
|
||||
return false;
|
||||
}
|
||||
UUID playerId = getTargetPointer().getFirst(game, source);
|
||||
for (UUID opponentId : game.getOpponents(source.getControllerId())) {
|
||||
if (opponentId.equals(playerId)) {
|
||||
continue;
|
||||
}
|
||||
Optional.ofNullable(opponentId)
|
||||
.map(game::getPlayer)
|
||||
.ifPresent(player -> player.damage(damage, source, game));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue