mirror of
https://github.com/magefree/mage.git
synced 2025-12-24 20:41:58 -08:00
* Proliferate - Fixed a bug that only creatures could be used for the proliferate add counter effect.
This commit is contained in:
parent
ddb9c786b4
commit
eb89f95f07
4 changed files with 85 additions and 9 deletions
|
|
@ -27,11 +27,17 @@
|
|||
*/
|
||||
package mage.abilities.effects.common.counter;
|
||||
|
||||
import mage.constants.Outcome;
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.choices.Choice;
|
||||
import mage.choices.ChoiceImpl;
|
||||
import mage.constants.Outcome;
|
||||
import mage.counters.Counter;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
|
@ -39,8 +45,6 @@ import mage.players.Player;
|
|||
import mage.target.Target;
|
||||
import mage.target.common.TargetPermanentOrPlayerWithCounter;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author nantuko
|
||||
|
|
@ -84,7 +88,7 @@ public class ProliferateEffect extends OneShotEffect {
|
|||
}
|
||||
} else {
|
||||
Choice choice = new ChoiceImpl(true);
|
||||
Set<String> choices = new HashSet<String>();
|
||||
Set<String> choices = new HashSet<>();
|
||||
for (Counter counter : permanent.getCounters().values()) {
|
||||
choices.add(counter.getName());
|
||||
}
|
||||
|
|
@ -110,7 +114,7 @@ public class ProliferateEffect extends OneShotEffect {
|
|||
}
|
||||
} else {
|
||||
Choice choice = new ChoiceImpl(true);
|
||||
Set<String> choices = new HashSet<String>();
|
||||
Set<String> choices = new HashSet<>();
|
||||
for (Counter counter : player.getCounters().values()) {
|
||||
choices.add(counter.getName());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -198,7 +198,7 @@ public class TargetPermanentOrPlayer extends TargetImpl {
|
|||
|
||||
@Override
|
||||
public Set<UUID> possibleTargets(UUID sourceId, UUID sourceControllerId, Game game) {
|
||||
Set<UUID> possibleTargets = new HashSet<UUID>();
|
||||
Set<UUID> possibleTargets = new HashSet<>();
|
||||
MageObject targetSource = game.getObject(sourceId);
|
||||
for (UUID playerId: game.getPlayer(sourceControllerId).getInRange()) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
|
|
@ -206,7 +206,7 @@ public class TargetPermanentOrPlayer extends TargetImpl {
|
|||
possibleTargets.add(playerId);
|
||||
}
|
||||
}
|
||||
for (Permanent permanent: game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), sourceControllerId, game)) {
|
||||
for (Permanent permanent: game.getBattlefield().getActivePermanents(new FilterPermanent(), sourceControllerId, game)) {
|
||||
if (permanent.canBeTargetedBy(targetSource, sourceControllerId, game) && filter.match(permanent, sourceId, sourceControllerId, game)) {
|
||||
possibleTargets.add(permanent.getId());
|
||||
}
|
||||
|
|
@ -216,7 +216,7 @@ public class TargetPermanentOrPlayer extends TargetImpl {
|
|||
|
||||
@Override
|
||||
public Set<UUID> possibleTargets(UUID sourceControllerId, Game game) {
|
||||
Set<UUID> possibleTargets = new HashSet<UUID>();
|
||||
Set<UUID> possibleTargets = new HashSet<>();
|
||||
for (UUID playerId: game.getPlayer(sourceControllerId).getInRange()) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null && filter.match(player, game)) {
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ public class TargetPermanentOrPlayerWithCounter extends TargetPermanentOrPlayer
|
|||
}
|
||||
|
||||
public TargetPermanentOrPlayerWithCounter(int minNumTargets, int maxNumTargets, boolean notTarget) {
|
||||
this(minNumTargets, maxNumTargets);
|
||||
this(minNumTargets, maxNumTargets);
|
||||
this.notTarget = notTarget;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue