mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
Fix Piracy mana restriction
This commit is contained in:
@@ -259,7 +259,7 @@ public final class GameActionUtil {
|
|||||||
if (sa.isManaAbility() && sa.isActivatedAbility() && activator.hasKeyword("Piracy") && source.isLand() && source.isInPlay() && !activator.equals(source.getController()) && sa.getPayCosts().hasTapCost()) {
|
if (sa.isManaAbility() && sa.isActivatedAbility() && activator.hasKeyword("Piracy") && source.isLand() && source.isInPlay() && !activator.equals(source.getController()) && sa.getPayCosts().hasTapCost()) {
|
||||||
SpellAbility newSA = sa.copy(activator);
|
SpellAbility newSA = sa.copy(activator);
|
||||||
// to bypass Activator restriction, set Activator to Player
|
// to bypass Activator restriction, set Activator to Player
|
||||||
sa.getRestrictions().setActivator("Player");
|
newSA.getRestrictions().setActivator("Player");
|
||||||
|
|
||||||
// extra Mana restriction to only Spells
|
// extra Mana restriction to only Spells
|
||||||
for (AbilityManaPart mp : newSA.getAllManaParts()) {
|
for (AbilityManaPart mp : newSA.getAllManaParts()) {
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ public class Mana {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return mp == mp2 || mp.getManaRestrictions().equals(mp2.getManaRestrictions());
|
return mp == mp2 || (mp.getManaRestrictions().equals(mp2.getManaRestrictions()) && mp.getExtraManaRestriction().equals(mp2.getExtraManaRestriction()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private byte color;
|
private byte color;
|
||||||
@@ -84,7 +84,7 @@ public class Mana {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final boolean isRestricted() {
|
public final boolean isRestricted() {
|
||||||
return this.manaAbility != null && !manaAbility.getManaRestrictions().isEmpty();
|
return this.manaAbility != null && (!manaAbility.getManaRestrictions().isEmpty() || !manaAbility.getExtraManaRestriction().isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -276,6 +276,10 @@ public class AbilityManaPart implements java.io.Serializable {
|
|||||||
this.extraManaRestrictions = str;
|
this.extraManaRestrictions = str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getExtraManaRestriction() {
|
||||||
|
return extraManaRestrictions;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean meetsManaRestrictions(final SpellAbility sa) {
|
public boolean meetsManaRestrictions(final SpellAbility sa) {
|
||||||
return meetsManaRestrictions(sa, this.manaRestrictions) && meetsManaRestrictions(sa, this.extraManaRestrictions);
|
return meetsManaRestrictions(sa, this.manaRestrictions) && meetsManaRestrictions(sa, this.extraManaRestrictions);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user