mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
- Attempt to fix NPEs related to SpellAbilityRestrictions queried with no activator set for the spell ability.
This commit is contained in:
@@ -123,6 +123,14 @@ public abstract class AbilityActivated extends SpellAbility implements java.io.S
|
||||
public boolean isPossible() {
|
||||
//consider activated abilities possible always and simply disable if not currently playable
|
||||
//the exception is to consider them not possible if there's a zone or activator restriction that's not met
|
||||
|
||||
// FIXME: Something is potentially leading to hard-to-reproducing conditions where this method is getting called
|
||||
// with no activator set for the SA. Most likely deserves a better fix in the future.
|
||||
if (this.getActivatingPlayer() == null) {
|
||||
this.setActivatingPlayer(this.getHostCard().getController());
|
||||
System.out.println(this.getHostCard().getName() + " Did not have activator set in AbilityActivated.isPossible");
|
||||
}
|
||||
|
||||
return this.getRestrictions().checkZoneRestrictions(this.getHostCard(), this) &&
|
||||
this.getRestrictions().checkActivatorRestrictions(this.getHostCard(), this);
|
||||
}
|
||||
|
||||
@@ -197,9 +197,6 @@ public class SpellAbilityRestriction extends SpellAbilityVariables {
|
||||
}
|
||||
|
||||
Player activator = sa.getActivatingPlayer();
|
||||
if (activator == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Zone cardZone = activator.getGame().getZoneOf(c);
|
||||
if (cardZone == null || !cardZone.is(this.getZone())) {
|
||||
|
||||
Reference in New Issue
Block a user