mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
Merge branch 'changetargets' into 'master'
ChangeTargets: Fix same choices See merge request core-developers/forge!5174
This commit is contained in:
@@ -76,12 +76,14 @@ public class ChangeTargetsEffect extends SpellAbilityEffect {
|
||||
GameObject oldTarget = chosenTarget.getValue();
|
||||
TargetChoices oldTargetBlock = replaceIn.getTargetChoices();
|
||||
TargetChoices newTargetBlock = oldTargetBlock.clone();
|
||||
// gets the divied value from old target
|
||||
// gets the divided value from old target
|
||||
Integer div = oldTargetBlock.getDividedValue(oldTarget);
|
||||
// 3. test if updated choices would be correct.
|
||||
GameObject newTarget = Iterables.getFirst(getDefinedCardsOrTargeted(sa, "DefinedMagnet"), null);
|
||||
|
||||
if (replaceIn.getSpellAbility(true).canTarget(newTarget)) {
|
||||
// CR 115.3. The same target can’t be chosen multiple times for
|
||||
// any one instance of the word “target” on a spell or ability.
|
||||
if (!oldTargetBlock.contains(newTarget) && replaceIn.getSpellAbility(true).canTarget(newTarget)) {
|
||||
newTargetBlock.remove(oldTarget);
|
||||
newTargetBlock.add(newTarget);
|
||||
if (div != null) {
|
||||
@@ -89,8 +91,7 @@ public class ChangeTargetsEffect extends SpellAbilityEffect {
|
||||
}
|
||||
replaceIn.updateTarget(newTargetBlock, sa.getHostCard());
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
while (changingTgtSI != null) {
|
||||
SpellAbility changingTgtSA = changingTgtSI.getSpellAbility(true);
|
||||
if (changingTgtSA.usesTargeting()) {
|
||||
@@ -126,8 +127,7 @@ public class ChangeTargetsEffect extends SpellAbilityEffect {
|
||||
changingTgtSA.addDividedAllocation(newTarget, div);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// Update targets, with a potential new target
|
||||
Predicate<GameObject> filter = sa.hasParam("TargetRestriction") ? GameObjectPredicates.restriction(sa.getParam("TargetRestriction").split(","), activator, sa.getHostCard(), sa) : null;
|
||||
// TODO Creature.Other might not work yet as it should
|
||||
|
||||
Reference in New Issue
Block a user