mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38:00 +00:00
- Code deduplication.
This commit is contained in:
@@ -106,12 +106,7 @@ public class CopySpellAbilityEffect extends SpellAbilityEffect {
|
|||||||
mayChoseNewTargets = false;
|
mayChoseNewTargets = false;
|
||||||
for (GameEntity o : candidates) {
|
for (GameEntity o : candidates) {
|
||||||
SpellAbility copy = CardFactory.copySpellAbilityAndSrcCard(card, chosenSA.getHostCard(), chosenSA, true);
|
SpellAbility copy = CardFactory.copySpellAbilityAndSrcCard(card, chosenSA.getHostCard(), chosenSA, true);
|
||||||
copy.resetFirstTarget(o, targetedSA);
|
resetFirstTargetOnCopy(copy, o, targetedSA);
|
||||||
AbilitySub subAb = copy.getSubAbility();
|
|
||||||
while (subAb != null) {
|
|
||||||
subAb.resetFirstTarget(o, targetedSA);
|
|
||||||
subAb = subAb.getSubAbility();
|
|
||||||
}
|
|
||||||
copies.add(copy);
|
copies.add(copy);
|
||||||
}
|
}
|
||||||
} else {// Precursor Golem, Ink-Treader Nephilim
|
} else {// Precursor Golem, Ink-Treader Nephilim
|
||||||
@@ -128,12 +123,7 @@ public class CopySpellAbilityEffect extends SpellAbilityEffect {
|
|||||||
mayChoseNewTargets = false;
|
mayChoseNewTargets = false;
|
||||||
for (Card c : valid) {
|
for (Card c : valid) {
|
||||||
SpellAbility copy = CardFactory.copySpellAbilityAndSrcCard(card, chosenSA.getHostCard(), chosenSA, true);
|
SpellAbility copy = CardFactory.copySpellAbilityAndSrcCard(card, chosenSA.getHostCard(), chosenSA, true);
|
||||||
copy.resetFirstTarget(c, targetedSA);
|
resetFirstTargetOnCopy(copy, c, targetedSA);
|
||||||
AbilitySub subAb = copy.getSubAbility();
|
|
||||||
while (subAb != null) {
|
|
||||||
subAb.resetFirstTarget(c, targetedSA);
|
|
||||||
subAb = subAb.getSubAbility();
|
|
||||||
}
|
|
||||||
copies.add(copy);
|
copies.add(copy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -151,4 +141,13 @@ public class CopySpellAbilityEffect extends SpellAbilityEffect {
|
|||||||
}
|
}
|
||||||
} // end resolve
|
} // end resolve
|
||||||
|
|
||||||
|
private void resetFirstTargetOnCopy(SpellAbility copy, GameEntity obj, SpellAbility targetedSA) {
|
||||||
|
copy.resetFirstTarget(obj, targetedSA);
|
||||||
|
AbilitySub subAb = copy.getSubAbility();
|
||||||
|
while (subAb != null) {
|
||||||
|
subAb.resetFirstTarget(obj, targetedSA);
|
||||||
|
subAb = subAb.getSubAbility();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user