mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 04:08:01 +00:00
- Continuous static abilities with "RemoveAllAbilities" will now also remove static abilities.
- Improved the layering of continuous static effects.
This commit is contained in:
@@ -670,8 +670,10 @@ public class GameAction {
|
||||
}
|
||||
}
|
||||
|
||||
cardsWithStAbs.reverse(); //roughly timestamp order
|
||||
|
||||
//apply continuous effects
|
||||
for (int layer = 4; layer < 9; layer++) {
|
||||
for (int layer = 4; layer < 10; layer++) {
|
||||
for (Card card : cardsWithStAbs) {
|
||||
ArrayList<StaticAbility> staticAbilities = card.getStaticAbilities();
|
||||
for (StaticAbility stAb : staticAbilities) {
|
||||
|
||||
@@ -3,6 +3,7 @@ package forge;
|
||||
import com.esotericsoftware.minlog.Log;
|
||||
import forge.card.cardFactory.CardFactoryUtil;
|
||||
import forge.card.spellability.SpellAbility;
|
||||
import forge.card.staticAbility.StaticAbility;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -145,6 +146,10 @@ public class StaticEffects {
|
||||
for (SpellAbility s : spellAbility) {
|
||||
s.setTemporarilySuppressed(false);
|
||||
}
|
||||
ArrayList<StaticAbility> staticAbilities = affectedCard.getStaticAbilities();
|
||||
for (StaticAbility stA : staticAbilities) {
|
||||
stA.setTemporarilySuppressed(false);
|
||||
}
|
||||
}
|
||||
|
||||
//remove Types
|
||||
|
||||
@@ -9,8 +9,12 @@ import java.util.Map;
|
||||
public class StaticAbility {
|
||||
|
||||
private Card hostCard = null;
|
||||
|
||||
private HashMap<String, String> mapParams = new HashMap<String, String>();
|
||||
|
||||
protected boolean temporarilySuppressed = false;
|
||||
protected boolean suppressed = false;
|
||||
|
||||
/**
|
||||
* <p>getHostCard.</p>
|
||||
*
|
||||
@@ -74,6 +78,10 @@ public class StaticAbility {
|
||||
// In which layer should the ability be applied (for continuous effects only)
|
||||
public int getLayer() {
|
||||
|
||||
if(!mapParams.get("Mode").equals("Continuous")) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(mapParams.containsKey("AddType") || mapParams.containsKey("RemoveType") || mapParams.containsKey("RemoveCardType")
|
||||
|| mapParams.containsKey("RemoveSubType") || mapParams.containsKey("RemoveSuperType"))
|
||||
return 4;
|
||||
@@ -81,17 +89,19 @@ public class StaticAbility {
|
||||
if(mapParams.containsKey("AddColor") || mapParams.containsKey("RemoveColor") || mapParams.containsKey("SetColor"))
|
||||
return 5;
|
||||
|
||||
if(mapParams.containsKey("RemoveAllAbilities"))
|
||||
return 6; //Layer 6
|
||||
|
||||
if(mapParams.containsKey("AddKeyword") || mapParams.containsKey("AddAbility")
|
||||
|| mapParams.containsKey("AddTrigger") || mapParams.containsKey("RemoveTriggers")
|
||||
|| mapParams.containsKey("RemoveAllAbilities"))
|
||||
return 6;
|
||||
|| mapParams.containsKey("AddTrigger") || mapParams.containsKey("RemoveTriggers"))
|
||||
return 7; //Layer 6 (dependent)
|
||||
|
||||
if(mapParams.containsKey("CharacteristicDefining"))
|
||||
return 7;
|
||||
return 8; //Layer 7a
|
||||
|
||||
if(mapParams.containsKey("AddPower") || mapParams.containsKey("AddToughness")
|
||||
|| mapParams.containsKey("SetPower") || mapParams.containsKey("SetToughness"))
|
||||
return 8; // This is the collection of 7b and 7c
|
||||
return 9; // This is the collection of 7b and 7c
|
||||
|
||||
// Layer 1, 2 & 3 are not supported
|
||||
|
||||
@@ -104,7 +114,7 @@ public class StaticAbility {
|
||||
* @return a {@link java.lang.String} object.
|
||||
*/
|
||||
public String toString() {
|
||||
if (mapParams.containsKey("Description")) {
|
||||
if (mapParams.containsKey("Description") && !isSuppressed()) {
|
||||
return mapParams.get("Description").replace("CARDNAME", hostCard.getName());
|
||||
} else return "";
|
||||
}
|
||||
@@ -130,7 +140,7 @@ public class StaticAbility {
|
||||
if (!mapParams.get("Mode").equals(mode))
|
||||
return;
|
||||
|
||||
if (!checkConditions())
|
||||
if (isSuppressed() || !checkConditions())
|
||||
return;
|
||||
|
||||
if (mode.equals("Continuous"))
|
||||
@@ -194,5 +204,12 @@ public class StaticAbility {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setTemporarilySuppressed(boolean supp) {
|
||||
temporarilySuppressed = supp;
|
||||
}
|
||||
|
||||
public boolean isSuppressed() {
|
||||
return (suppressed || temporarilySuppressed);
|
||||
}
|
||||
|
||||
}//end class StaticEffectFactory
|
||||
|
||||
@@ -250,14 +250,17 @@ public class StaticAbility_Continuous {
|
||||
}
|
||||
}
|
||||
|
||||
// remove activated abilities
|
||||
// remove activated and static abilities
|
||||
if (params.containsKey("RemoveAllAbilities")) {
|
||||
ArrayList<SpellAbility> abilities = affectedCard.getSpellAbilities();
|
||||
for (SpellAbility ab : abilities) {
|
||||
ab.setTemporarilySuppressed(true);
|
||||
}
|
||||
ArrayList<StaticAbility> staticAbilities = affectedCard.getStaticAbilities();
|
||||
for (StaticAbility stA : staticAbilities) {
|
||||
stA.setTemporarilySuppressed(true);
|
||||
}
|
||||
}
|
||||
//affectedCard.updateObservers();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user