- Compare Targets of SubAbilities to the StackInstance SubAbilities for full Targeting confirmation (Bugfix Jitte multi-activation)

This commit is contained in:
Sol
2013-04-21 17:32:33 +00:00
parent 084419d3de
commit b04959fa89

View File

@@ -257,6 +257,14 @@ public class SpellAbilityStackInstance {
return this.ability.isOptionalTrigger(); return this.ability.isOptionalTrigger();
} }
public final SpellAbilityStackInstance getSubInstace() {
return this.subInstace;
}
public final TargetChoices getTargetChoices() {
return this.tc;
}
public void updateTarget(Target target) { public void updateTarget(Target target) {
if (target != null) { if (target != null) {
this.tc = target.getTargetChoices(); this.tc = target.getTargetChoices();
@@ -268,7 +276,23 @@ public class SpellAbilityStackInstance {
public boolean compareToSpellAbility(SpellAbility sa) { public boolean compareToSpellAbility(SpellAbility sa) {
// Compare my target choices to the SA passed in // Compare my target choices to the SA passed in
// TODO? Compare other data points in the SI to the passed SpellAbility for confirmation // TODO? Compare other data points in the SI to the passed SpellAbility for confirmation
TargetChoices choices = sa.getTarget() != null ? sa.getTarget().getTargetChoices() : null; SpellAbility compare = sa;
return (sa.equals(this.ability) && (choices == null || choices.equals(this.tc))); 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;
} }
} }