mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38:01 +00:00
- "AddReplacementEffects" in static ability (experimental)
- Added Pulmonic Sliver
This commit is contained in:
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -8365,6 +8365,7 @@ res/cardsfolder/p/puffer_extract.txt svneol=native#text/plain
|
|||||||
res/cardsfolder/p/pull_from_eternity.txt -text
|
res/cardsfolder/p/pull_from_eternity.txt -text
|
||||||
res/cardsfolder/p/pull_under.txt svneol=native#text/plain
|
res/cardsfolder/p/pull_under.txt svneol=native#text/plain
|
||||||
res/cardsfolder/p/pulling_teeth.txt svneol=native#text/plain
|
res/cardsfolder/p/pulling_teeth.txt svneol=native#text/plain
|
||||||
|
res/cardsfolder/p/pulmonic_sliver.txt -text
|
||||||
res/cardsfolder/p/pulsating_illusion.txt svneol=native#text/plain
|
res/cardsfolder/p/pulsating_illusion.txt svneol=native#text/plain
|
||||||
res/cardsfolder/p/pulse_of_the_dross.txt -text
|
res/cardsfolder/p/pulse_of_the_dross.txt -text
|
||||||
res/cardsfolder/p/pulse_of_the_fields.txt svneol=native#text/plain
|
res/cardsfolder/p/pulse_of_the_fields.txt svneol=native#text/plain
|
||||||
|
|||||||
11
res/cardsfolder/p/pulmonic_sliver.txt
Normal file
11
res/cardsfolder/p/pulmonic_sliver.txt
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
Name:Pulmonic Sliver
|
||||||
|
ManaCost:3 W W
|
||||||
|
Types:Creature Sliver
|
||||||
|
PT:3/3
|
||||||
|
S:Mode$ Continuous | Affected$ Creature.Sliver | AddKeyword$ Flying | Description$ All Sliver creatures have flying.
|
||||||
|
S:Mode$ Continuous | Affected$ Card.Sliver | AddReplacementEffects$ PulmonicMoveToLibrary | AddSVar$ PulmonicSliverRep | Description$ All Slivers have "If this permanent would be put into a graveyard, you may put it on top of its owner's library instead."
|
||||||
|
SVar:PulmonicMoveToLibrary:Event$ Moved | Origin$ Battlefield | Destination$ Graveyard | ValidCard$ Card.Self | ReplaceWith$ PulmonicSliverRep | Optional$ True | Description$ If CARDNAME would die, you may put it on the top of its owner's library instead.
|
||||||
|
SVar:PulmonicSliverRep:DB$ ChangeZone | Hidden$ True | Origin$ All | Destination$ Library | LibraryPosition$ 0 | Defined$ ReplacedCard
|
||||||
|
SVar:PlayMain1:TRUE
|
||||||
|
SVar:Picture:http://www.wizards.com/global/images/magic/general/pulmonic_sliver.jpg
|
||||||
|
Oracle:All Sliver creatures have flying.\nAll Slivers have "If this permanent would be put into a graveyard, you may put it on top of its owner's library instead."
|
||||||
@@ -8203,10 +8203,11 @@ public class Card extends GameEntity implements Comparable<Card> {
|
|||||||
* @param replacementEffect
|
* @param replacementEffect
|
||||||
* the rE
|
* the rE
|
||||||
*/
|
*/
|
||||||
public void addReplacementEffect(final ReplacementEffect replacementEffect) {
|
public ReplacementEffect addReplacementEffect(final ReplacementEffect replacementEffect) {
|
||||||
final ReplacementEffect replacementEffectCopy = replacementEffect.getCopy(); // doubtful - every caller provides a newly parsed instance, why copy?
|
final ReplacementEffect replacementEffectCopy = replacementEffect.getCopy(); // doubtful - every caller provides a newly parsed instance, why copy?
|
||||||
replacementEffectCopy.setHostCard(this);
|
replacementEffectCopy.setHostCard(this);
|
||||||
this.getCharacteristics().getReplacementEffects().add(replacementEffectCopy);
|
this.getCharacteristics().getReplacementEffects().add(replacementEffectCopy);
|
||||||
|
return replacementEffectCopy;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -247,4 +247,27 @@ public abstract class ReplacementEffect extends TriggerReplacementBase {
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** The temporary. */
|
||||||
|
private boolean temporary = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the temporary.
|
||||||
|
*
|
||||||
|
* @param temp
|
||||||
|
* the new temporary
|
||||||
|
*/
|
||||||
|
public final void setTemporary(final boolean temp) {
|
||||||
|
this.temporary = temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if is temporary.
|
||||||
|
*
|
||||||
|
* @return true, if is temporary
|
||||||
|
*/
|
||||||
|
public final boolean isTemporary() {
|
||||||
|
return this.temporary;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,6 +43,14 @@ import forge.util.FileSection;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class ReplacementHandler {
|
public class ReplacementHandler {
|
||||||
|
private final Game game;
|
||||||
|
/**
|
||||||
|
* ReplacementHandler.
|
||||||
|
* @param gameState
|
||||||
|
*/
|
||||||
|
public ReplacementHandler(Game gameState) {
|
||||||
|
game = gameState;
|
||||||
|
}
|
||||||
|
|
||||||
//private final List<ReplacementEffect> tmpEffects = new ArrayList<ReplacementEffect>();
|
//private final List<ReplacementEffect> tmpEffects = new ArrayList<ReplacementEffect>();
|
||||||
|
|
||||||
@@ -281,4 +289,24 @@ public class ReplacementHandler {
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO: Write javadoc for this method.
|
||||||
|
*/
|
||||||
|
public void cleanUpTemporaryReplacements() {
|
||||||
|
final List<Card> absolutelyAllCards = game.getCardsInGame();
|
||||||
|
for (final Card c : absolutelyAllCards) {
|
||||||
|
for (int i = 0; i < c.getReplacementEffects().size(); i++) {
|
||||||
|
if (c.getReplacementEffects().get(i).isTemporary()) {
|
||||||
|
c.getReplacementEffects().remove(i);
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (final Card c : absolutelyAllCards) {
|
||||||
|
for (int i = 0; i < c.getReplacementEffects().size(); i++) {
|
||||||
|
c.getReplacementEffects().get(i).setTemporarilySuppressed(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ public class StaticAbility {
|
|||||||
|
|
||||||
if (this.params.containsKey("AddKeyword") || this.params.containsKey("AddAbility")
|
if (this.params.containsKey("AddKeyword") || this.params.containsKey("AddAbility")
|
||||||
|| this.params.containsKey("AddTrigger") || this.params.containsKey("RemoveTriggers")
|
|| this.params.containsKey("AddTrigger") || this.params.containsKey("RemoveTriggers")
|
||||||
|| this.params.containsKey("RemoveKeyword")) {
|
|| this.params.containsKey("RemoveKeyword") || this.params.containsKey("AddReplacementEffects")) {
|
||||||
return 7; // Layer 6 (dependent)
|
return 7; // Layer 6 (dependent)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,8 @@ import forge.card.TriggerReplacementBase;
|
|||||||
import forge.card.ability.AbilityFactory;
|
import forge.card.ability.AbilityFactory;
|
||||||
import forge.card.ability.AbilityUtils;
|
import forge.card.ability.AbilityUtils;
|
||||||
import forge.card.cardfactory.CardFactoryUtil;
|
import forge.card.cardfactory.CardFactoryUtil;
|
||||||
|
import forge.card.replacement.ReplacementEffect;
|
||||||
|
import forge.card.replacement.ReplacementHandler;
|
||||||
import forge.card.spellability.AbilityActivated;
|
import forge.card.spellability.AbilityActivated;
|
||||||
import forge.card.spellability.SpellAbility;
|
import forge.card.spellability.SpellAbility;
|
||||||
import forge.card.trigger.Trigger;
|
import forge.card.trigger.Trigger;
|
||||||
@@ -86,6 +88,7 @@ public class StaticAbilityContinuous {
|
|||||||
String[] addHiddenKeywords = null;
|
String[] addHiddenKeywords = null;
|
||||||
String[] removeKeywords = null;
|
String[] removeKeywords = null;
|
||||||
String[] addAbilities = null;
|
String[] addAbilities = null;
|
||||||
|
String[] addReplacements = null;
|
||||||
String[] addSVars = null;
|
String[] addSVars = null;
|
||||||
String[] addTypes = null;
|
String[] addTypes = null;
|
||||||
String[] removeTypes = null;
|
String[] removeTypes = null;
|
||||||
@@ -186,6 +189,14 @@ public class StaticAbilityContinuous {
|
|||||||
addAbilities = sVars;
|
addAbilities = sVars;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (params.containsKey("AddReplacementEffects")) {
|
||||||
|
final String[] sVars = params.get("AddReplacementEffects").split(" & ");
|
||||||
|
for (int i = 0; i < sVars.length; i++) {
|
||||||
|
sVars[i] = hostCard.getSVar(sVars[i]);
|
||||||
|
}
|
||||||
|
addReplacements = sVars;
|
||||||
|
}
|
||||||
|
|
||||||
if (params.containsKey("AddSVar")) {
|
if (params.containsKey("AddSVar")) {
|
||||||
addSVars = params.get("AddSVar").split(" & ");
|
addSVars = params.get("AddSVar").split(" & ");
|
||||||
}
|
}
|
||||||
@@ -417,6 +428,14 @@ public class StaticAbilityContinuous {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// add Replacement effects
|
||||||
|
if (addReplacements != null) {
|
||||||
|
for (String rep : addReplacements) {
|
||||||
|
final ReplacementEffect actualRep = ReplacementHandler.parseReplacement(rep, affectedCard);
|
||||||
|
affectedCard.addReplacementEffect(actualRep).setTemporary(true);;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// add Types
|
// add Types
|
||||||
if ((addTypes != null) || (removeTypes != null)) {
|
if ((addTypes != null) || (removeTypes != null)) {
|
||||||
affectedCard.addChangedCardTypes(addTypes, removeTypes, removeSuperTypes, removeCardTypes,
|
affectedCard.addChangedCardTypes(addTypes, removeTypes, removeSuperTypes, removeCardTypes,
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ public class Game {
|
|||||||
public final MagicStack stack;
|
public final MagicStack stack;
|
||||||
private final StaticEffects staticEffects = new StaticEffects();
|
private final StaticEffects staticEffects = new StaticEffects();
|
||||||
private final TriggerHandler triggerHandler = new TriggerHandler(this);
|
private final TriggerHandler triggerHandler = new TriggerHandler(this);
|
||||||
private final ReplacementHandler replacementHandler = new ReplacementHandler();
|
private final ReplacementHandler replacementHandler = new ReplacementHandler(this);
|
||||||
private Combat combat = new Combat();
|
private Combat combat = new Combat();
|
||||||
private final EventBus events = new EventBus();
|
private final EventBus events = new EventBus();
|
||||||
private final GameLog gameLog = new GameLog();
|
private final GameLog gameLog = new GameLog();
|
||||||
|
|||||||
@@ -797,6 +797,7 @@ public class GameAction {
|
|||||||
// remove old effects
|
// remove old effects
|
||||||
game.getStaticEffects().clearStaticEffects();
|
game.getStaticEffects().clearStaticEffects();
|
||||||
game.getTriggerHandler().cleanUpTemporaryTriggers();
|
game.getTriggerHandler().cleanUpTemporaryTriggers();
|
||||||
|
game.getReplacementHandler().cleanUpTemporaryReplacements();
|
||||||
|
|
||||||
// search for cards with static abilities
|
// search for cards with static abilities
|
||||||
final List<Card> allCards = game.getCardsInGame();
|
final List<Card> allCards = game.getCardsInGame();
|
||||||
|
|||||||
@@ -32,13 +32,10 @@ import javax.swing.JOptionPane;
|
|||||||
import org.apache.commons.lang.ArrayUtils;
|
import org.apache.commons.lang.ArrayUtils;
|
||||||
|
|
||||||
import com.google.common.base.Supplier;
|
import com.google.common.base.Supplier;
|
||||||
import com.google.common.collect.Iterables;
|
|
||||||
|
|
||||||
import forge.Card;
|
import forge.Card;
|
||||||
import forge.Constant.Preferences;
|
import forge.Constant.Preferences;
|
||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
import forge.card.CardBlock;
|
import forge.card.CardBlock;
|
||||||
import forge.card.CardDb;
|
|
||||||
import forge.card.CardEdition;
|
import forge.card.CardEdition;
|
||||||
import forge.card.IUnOpenedProduct;
|
import forge.card.IUnOpenedProduct;
|
||||||
import forge.card.SealedProductTemplate;
|
import forge.card.SealedProductTemplate;
|
||||||
@@ -50,7 +47,6 @@ import forge.item.IPaperCard;
|
|||||||
import forge.item.ItemPool;
|
import forge.item.ItemPool;
|
||||||
import forge.item.ItemPoolView;
|
import forge.item.ItemPoolView;
|
||||||
import forge.properties.NewConstants;
|
import forge.properties.NewConstants;
|
||||||
import forge.util.Aggregates;
|
|
||||||
import forge.util.FileUtil;
|
import forge.util.FileUtil;
|
||||||
import forge.util.HttpUtil;
|
import forge.util.HttpUtil;
|
||||||
import forge.util.storage.IStorageView;
|
import forge.util.storage.IStorageView;
|
||||||
|
|||||||
Reference in New Issue
Block a user