mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 19:41:59 -08:00
handle multiple replacement effects
This commit is contained in:
parent
9f64c00dc5
commit
2d0842f320
1 changed files with 25 additions and 15 deletions
|
|
@ -398,21 +398,31 @@ public class ContinuousEffects implements Serializable {
|
||||||
|
|
||||||
public boolean replaceEvent(GameEvent event, Game game) {
|
public boolean replaceEvent(GameEvent event, Game game) {
|
||||||
boolean caught = false;
|
boolean caught = false;
|
||||||
List<ReplacementEffect> rEffects = getApplicableReplacementEffects(event, game);
|
List<UUID> consumed = new ArrayList<UUID>();
|
||||||
if (rEffects.size() > 0) {
|
do {
|
||||||
int index;
|
List<ReplacementEffect> rEffects = getApplicableReplacementEffects(event, game);
|
||||||
if (rEffects.size() == 1) {
|
for (Iterator<ReplacementEffect> i = rEffects.iterator(); i.hasNext();) {
|
||||||
index = 0;
|
ReplacementEffect entry = i.next();
|
||||||
}
|
if (consumed.contains(entry.getId()))
|
||||||
else {
|
i.remove();
|
||||||
//20100716 - 616.1c
|
}
|
||||||
Player player = game.getPlayer(event.getPlayerId());
|
if (rEffects.isEmpty())
|
||||||
index = player.chooseEffect(rEffects, game);
|
break;
|
||||||
}
|
int index;
|
||||||
ReplacementEffect rEffect = rEffects.get(index);
|
if (rEffects.size() == 1) {
|
||||||
caught = rEffect.replaceEvent(event, abilityMap.get(rEffect.getId()), game);
|
index = 0;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
//20100716 - 616.1c
|
||||||
|
Player player = game.getPlayer(event.getPlayerId());
|
||||||
|
index = player.chooseEffect(rEffects, game);
|
||||||
|
}
|
||||||
|
ReplacementEffect rEffect = rEffects.get(index);
|
||||||
|
caught = rEffect.replaceEvent(event, abilityMap.get(rEffect.getId()), game);
|
||||||
|
if (caught)
|
||||||
|
break;
|
||||||
|
consumed.add(rEffect.getId());
|
||||||
|
} while (true);
|
||||||
return caught;
|
return caught;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue