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