This commit is contained in:
Alex W. Jackson 2021-12-01 23:30:44 -05:00
parent fc3bbe0ed7
commit 258ce763e5

View file

@ -1,4 +1,3 @@
package mage.cards.a;
import java.util.UUID;
@ -8,8 +7,10 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.TargetController;
import mage.filter.StaticFilters;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.permanent.PermanentIdPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
@ -21,19 +22,12 @@ import mage.target.common.TargetCreaturePermanent;
*/
public final class AlphaBrawl extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature an opponent controls");
static {
filter.add(TargetController.OPPONENT.getControllerPredicate());
}
public AlphaBrawl(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{6}{R}{R}");
// Target creature an opponent controls deals damage equal to its power to each other creature that player controls, then each of those creatures deals damage equal to its power to that creature.
this.getSpellAbility().addEffect(new AlphaBrawlEffect());
this.getSpellAbility().addTarget(new TargetCreaturePermanent(filter));
this.getSpellAbility().addTarget(new TargetCreaturePermanent(StaticFilters.FILTER_OPPONENTS_PERMANENT_CREATURE));
}
@ -49,8 +43,6 @@ public final class AlphaBrawl extends CardImpl {
class AlphaBrawlEffect extends OneShotEffect {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent();
public AlphaBrawlEffect() {
super(Outcome.Damage);
staticText = "Target creature an opponent controls deals damage equal to its power to each other creature that player controls, then each of those creatures deals damage equal to its power to that creature";
@ -62,7 +54,10 @@ class AlphaBrawlEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Permanent creature = game.getPermanent(source.getFirstTarget());
UUID targetId = source.getFirstTarget();
FilterCreaturePermanent filter = new FilterCreaturePermanent("each other creature that player controls");
filter.add(Predicates.not(new PermanentIdPredicate(targetId)));
Permanent creature = game.getPermanent(targetId);
if (creature != null) {
Player player = game.getPlayer(creature.getControllerId());
if (player != null) {
@ -84,4 +79,4 @@ class AlphaBrawlEffect extends OneShotEffect {
return new AlphaBrawlEffect(this);
}
}
}