mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 04:08:01 +00:00
Update CopySpellAbilityEffect.java
This commit is contained in:
@@ -3,6 +3,7 @@ package forge.game.ability.effects;
|
|||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.function.Predicate;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
@@ -166,7 +167,12 @@ public class CopySpellAbilityEffect extends SpellAbilityEffect {
|
|||||||
if (sa.hasParam("RandomTarget")){
|
if (sa.hasParam("RandomTarget")){
|
||||||
List<GameEntity> candidates = copy.getTargetRestrictions().getAllCandidates(chosenSA, true);
|
List<GameEntity> candidates = copy.getTargetRestrictions().getAllCandidates(chosenSA, true);
|
||||||
if (sa.hasParam("RandomTargetRestriction")) {
|
if (sa.hasParam("RandomTargetRestriction")) {
|
||||||
candidates.removeIf(c -> !c.isValid(sa.getParam("RandomTargetRestriction").split(","), sa.getActivatingPlayer(), sa.getHostCard(), sa));
|
candidates.removeIf(new Predicate<GameEntity>() {
|
||||||
|
@Override
|
||||||
|
public boolean test(GameEntity c) {
|
||||||
|
return !c.isValid(sa.getParam("RandomTargetRestriction").split(","), sa.getActivatingPlayer(), sa.getHostCard(), sa);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
GameEntity choice = Aggregates.random(candidates);
|
GameEntity choice = Aggregates.random(candidates);
|
||||||
resetFirstTargetOnCopy(copy, choice, chosenSA);
|
resetFirstTargetOnCopy(copy, choice, chosenSA);
|
||||||
|
|||||||
Reference in New Issue
Block a user