mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 19:41:59 -08:00
- added message to inform players of a Proliferate event.
This commit is contained in:
parent
32f27e42c1
commit
59deea27e3
1 changed files with 19 additions and 7 deletions
|
|
@ -1,16 +1,11 @@
|
||||||
|
|
||||||
package mage.abilities.effects.common.counter;
|
package mage.abilities.effects.common.counter;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.choices.Choice;
|
|
||||||
import mage.choices.ChoiceImpl;
|
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
import mage.counters.Counter;
|
import mage.counters.Counter;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
|
|
@ -36,6 +31,8 @@ public class ProliferateEffect extends OneShotEffect {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
|
int numberOfCounters = 0;
|
||||||
|
Counter newCounter = null;
|
||||||
if (controller == null) {
|
if (controller == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -49,8 +46,16 @@ public class ProliferateEffect extends OneShotEffect {
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
if (!permanent.getCounters(game).isEmpty()) {
|
if (!permanent.getCounters(game).isEmpty()) {
|
||||||
for (Counter counter : permanent.getCounters(game).values()) {
|
for (Counter counter : permanent.getCounters(game).values()) {
|
||||||
Counter newCounter = new Counter(counter.getName());
|
newCounter = new Counter(counter.getName());
|
||||||
permanent.addCounters(newCounter, source, game);
|
permanent.addCounters(newCounter, source, game);
|
||||||
|
numberOfCounters = numberOfCounters + 1;
|
||||||
|
}
|
||||||
|
if (newCounter != null) {
|
||||||
|
game.informPlayers(permanent.getName()
|
||||||
|
+ " had "
|
||||||
|
+ numberOfCounters
|
||||||
|
+ " " + newCounter.getName()
|
||||||
|
+ " counter(s) added to it.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -58,8 +63,15 @@ public class ProliferateEffect extends OneShotEffect {
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
if (!player.getCounters().isEmpty()) {
|
if (!player.getCounters().isEmpty()) {
|
||||||
for (Counter counter : player.getCounters().values()) {
|
for (Counter counter : player.getCounters().values()) {
|
||||||
Counter newCounter = new Counter(counter.getName());
|
newCounter = new Counter(counter.getName());
|
||||||
player.addCounters(newCounter, game);
|
player.addCounters(newCounter, game);
|
||||||
|
numberOfCounters = numberOfCounters + 1;
|
||||||
|
}
|
||||||
|
if (newCounter != null) {
|
||||||
|
game.informPlayers(player.getName() + " had "
|
||||||
|
+ numberOfCounters + " "
|
||||||
|
+ newCounter.getName()
|
||||||
|
+ " counter(s) added to him or her.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue