mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
- Compare Targets of SubAbilities to the StackInstance SubAbilities for full Targeting confirmation (Bugfix Jitte multi-activation)
This commit is contained in:
@@ -257,6 +257,14 @@ public class SpellAbilityStackInstance {
|
||||
return this.ability.isOptionalTrigger();
|
||||
}
|
||||
|
||||
public final SpellAbilityStackInstance getSubInstace() {
|
||||
return this.subInstace;
|
||||
}
|
||||
|
||||
public final TargetChoices getTargetChoices() {
|
||||
return this.tc;
|
||||
}
|
||||
|
||||
public void updateTarget(Target target) {
|
||||
if (target != null) {
|
||||
this.tc = target.getTargetChoices();
|
||||
@@ -268,7 +276,23 @@ public class SpellAbilityStackInstance {
|
||||
public boolean compareToSpellAbility(SpellAbility sa) {
|
||||
// Compare my target choices to the SA passed in
|
||||
// TODO? Compare other data points in the SI to the passed SpellAbility for confirmation
|
||||
TargetChoices choices = sa.getTarget() != null ? sa.getTarget().getTargetChoices() : null;
|
||||
return (sa.equals(this.ability) && (choices == null || choices.equals(this.tc)));
|
||||
SpellAbility compare = sa;
|
||||
SpellAbilityStackInstance sub = this;
|
||||
|
||||
if (!compare.equals(sub.ability)){
|
||||
return false;
|
||||
}
|
||||
|
||||
while (compare != null && sub != null) {
|
||||
TargetChoices choices = compare.getTarget() != null ? compare.getTarget().getTargetChoices() : null;
|
||||
|
||||
if (choices != null && !choices.equals(sub.getTargetChoices())) {
|
||||
return false;
|
||||
}
|
||||
compare = compare.getSubAbility();
|
||||
sub = sub.getSubInstace();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user