Commit 4a3740da authored by Michael Kamensky's avatar Michael Kamensky

Merge branch 'staticAbilitySuspendedFix' into 'master'

StaticAbility: fix ability is removed by other ability

See merge request !2505
parents 23ab256f 31145ef2
......@@ -1039,15 +1039,7 @@ public class Card extends GameEntity implements Comparable<Card> {
}
public void updateTriggers(List<Trigger> list, CardState state) {
boolean removeIntrinsic = false;
for (final CardTraitChanges ck : changedCardTraits.values()) {
if (ck.isRemoveIntrinsic()) {
removeIntrinsic = true;
break;
}
}
if (removeIntrinsic) {
if (hasRemoveIntrinsic()) {
list.clear();
}
......@@ -2438,16 +2430,17 @@ public class Card extends GameEntity implements Comparable<Card> {
return currentState.hasSpellAbility(id);
}
public void updateSpellAbilities(List<SpellAbility> list, CardState state, Boolean mana) {
boolean removeIntrinsic = false;
public boolean hasRemoveIntrinsic() {
for (final CardTraitChanges ck : changedCardTraits.values()) {
if (ck.isRemoveIntrinsic()) {
removeIntrinsic = true;
break;
return true;
}
}
if (removeIntrinsic) {
return false;
}
public void updateSpellAbilities(List<SpellAbility> list, CardState state, Boolean mana) {
if (hasRemoveIntrinsic()) {
list.clear();
}
......@@ -4128,14 +4121,7 @@ public class Card extends GameEntity implements Comparable<Card> {
}
public void updateStaticAbilities(List<StaticAbility> list, CardState state) {
boolean removeIntrinsic = false;
for (final CardTraitChanges ck : changedCardTraits.values()) {
if (ck.isRemoveIntrinsic()) {
removeIntrinsic = true;
break;
}
}
if (removeIntrinsic) {
if (hasRemoveIntrinsic()) {
list.clear();
}
......@@ -5748,15 +5734,7 @@ public class Card extends GameEntity implements Comparable<Card> {
}
public void updateReplacementEffects(List<ReplacementEffect> list, CardState state) {
boolean removeIntrinsic = false;
for (final CardTraitChanges ck : changedCardTraits.values()) {
if (ck.isRemoveIntrinsic()) {
removeIntrinsic = true;
break;
}
}
if (removeIntrinsic) {
if (hasRemoveIntrinsic()) {
list.clear();
}
......
......@@ -260,14 +260,14 @@ public class StaticAbility extends CardTraitBase implements IIdentifiable, Clone
}
public final CardCollectionView applyContinuousAbilityBefore(final StaticAbilityLayer layer, final CardCollectionView preList) {
if (!shouldApplyContinuousAbility(layer)) {
if (!shouldApplyContinuousAbility(layer, false)) {
return null;
}
return StaticAbilityContinuous.applyContinuousAbility(this, layer, preList);
}
public final CardCollectionView applyContinuousAbility(final StaticAbilityLayer layer, final CardCollectionView affected) {
if (!shouldApplyContinuousAbility(layer)) {
if (!shouldApplyContinuousAbility(layer, true)) {
return null;
}
return StaticAbilityContinuous.applyContinuousAbility(this, affected, layer);
......@@ -287,8 +287,8 @@ public class StaticAbility extends CardTraitBase implements IIdentifiable, Clone
* affects the specified layer, it's not suppressed, and its
* conditions are fulfilled.
*/
private boolean shouldApplyContinuousAbility(final StaticAbilityLayer layer) {
return getParam("Mode").equals("Continuous") && layers.contains(layer) && !isSuppressed() && this.checkConditions();
private boolean shouldApplyContinuousAbility(final StaticAbilityLayer layer, final boolean previousRun) {
return getParam("Mode").equals("Continuous") && layers.contains(layer) && !isSuppressed() && checkConditions() && (previousRun || getHostCard().getStaticAbilities().contains(this));
}
// apply the ability if it has the right mode
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment