Skip to content

Commit

Permalink
Little fix
Browse files Browse the repository at this point in the history
  • Loading branch information
JayDi85 committed Feb 15, 2020
1 parent e12db6d commit 30ab06b
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions Mage/src/main/java/mage/abilities/keyword/SunburstAbility.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@

package mage.abilities.keyword;

import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.dynamicvalue.DynamicValue;
Expand All @@ -17,8 +13,11 @@
import mage.game.permanent.Permanent;
import mage.players.Player;

import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

/**
*
* @author Plopman
*/
public class SunburstAbility extends EntersBattlefieldAbility {
Expand Down Expand Up @@ -66,18 +65,21 @@ public SunburstEffect(final SunburstEffect effect) {
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanentEntering(source.getSourceId());
if (permanent != null) {
Counter counter;
if (permanent.isCreature()) {
counter = CounterType.P1P1.createInstance(amount.calculate(game, source, this));
} else {
counter = CounterType.CHARGE.createInstance(amount.calculate(game, source, this));
}
List<UUID> appliedEffects = (ArrayList<UUID>) this.getValue("appliedEffects"); // the basic event is the EntersBattlefieldEvent, so use already applied replacement effects from that event
permanent.addCounters(counter, source, game, appliedEffects);
if (!game.isSimulation()) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
game.informPlayers(player.getLogName() + " puts " + counter.getCount() + ' ' + counter.getName() + " counter on " + permanent.getName());
int countersAmount = amount.calculate(game, source, this);
if (countersAmount > 0) {
Counter counter;
if (permanent.isCreature()) {
counter = CounterType.P1P1.createInstance(countersAmount);
} else {
counter = CounterType.CHARGE.createInstance(countersAmount);
}
List<UUID> appliedEffects = (ArrayList<UUID>) this.getValue("appliedEffects"); // the basic event is the EntersBattlefieldEvent, so use already applied replacement effects from that event
permanent.addCounters(counter, source, game, appliedEffects);
if (!game.isSimulation()) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
game.informPlayers(player.getLogName() + " puts " + counter.getCount() + ' ' + counter.getName() + " counter on " + permanent.getName());
}
}
}
}
Expand Down

0 comments on commit 30ab06b

Please sign in to comment.