mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 10:18:01 +00:00
Merge branch 'master' of git.cardforge.org:core-developers/forge
This commit is contained in:
@@ -10,6 +10,7 @@ import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import forge.GameCommand;
|
||||
import forge.card.CardType;
|
||||
import forge.game.Game;
|
||||
import forge.game.GameObject;
|
||||
@@ -385,4 +386,83 @@ public abstract class SpellAbilityEffect {
|
||||
|
||||
return eff;
|
||||
}
|
||||
|
||||
protected static void replaceDying(final SpellAbility sa) {
|
||||
if (sa.hasParam("ReplaceDyingDefined") || sa.hasParam("ReplaceDyingValid")) {
|
||||
|
||||
if (sa.hasParam("ReplaceDyingCondition")) {
|
||||
// currently there is only one with Kicker
|
||||
final String condition = sa.getParam("ReplaceDyingCondition");
|
||||
if ("Kicked".equals(condition)) {
|
||||
if (!sa.isKicked()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final Card host = sa.getHostCard();
|
||||
final Player controller = sa.getActivatingPlayer();
|
||||
final Game game = host.getGame();
|
||||
String zone = sa.getParamOrDefault("ReplaceDyingZone", "Exile");
|
||||
|
||||
CardCollection cards = null;
|
||||
|
||||
if (sa.hasParam("ReplaceDyingDefined")) {
|
||||
cards = AbilityUtils.getDefinedCards(host, sa.getParam("ReplaceDyingDefined"), sa);
|
||||
// no cards, no need for Effect
|
||||
if (cards.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// build an Effect with that infomation
|
||||
String name = host.getName() + "'s Effect";
|
||||
|
||||
final Card eff = createEffect(host, controller, name, host.getImageKey());
|
||||
if (cards != null) {
|
||||
eff.addRemembered(cards);
|
||||
}
|
||||
|
||||
String valid = sa.getParamOrDefault("ReplaceDyingValid", "Card.IsRemembered");
|
||||
|
||||
String repeffstr = "Event$ Moved | ValidCard$ " + valid +
|
||||
"| Origin$ Battlefield | Destination$ Graveyard " +
|
||||
"| Description$ If the creature would die this turn, exile it instead.";
|
||||
String effect = "DB$ ChangeZone | Defined$ ReplacedCard | Origin$ Battlefield | Destination$ " + zone;
|
||||
|
||||
ReplacementEffect re = ReplacementHandler.parseReplacement(repeffstr, eff, true);
|
||||
re.setLayer(ReplacementLayer.Other);
|
||||
|
||||
re.setOverridingAbility(AbilityFactory.getAbility(effect, eff));
|
||||
eff.addReplacementEffect(re);
|
||||
|
||||
if (cards != null) {
|
||||
// Add forgot trigger
|
||||
addForgetOnMovedTrigger(eff, "Battlefield");
|
||||
}
|
||||
|
||||
// Copy text changes
|
||||
if (sa.isIntrinsic()) {
|
||||
eff.copyChangedTextFrom(host);
|
||||
}
|
||||
|
||||
final GameCommand endEffect = new GameCommand() {
|
||||
private static final long serialVersionUID = -5861759814760561373L;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
game.getAction().exile(eff, null);
|
||||
}
|
||||
};
|
||||
|
||||
game.getEndOfTurn().addUntil(endEffect);
|
||||
|
||||
eff.updateStateForView();
|
||||
|
||||
// TODO: Add targeting to the effect so it knows who it's dealing with
|
||||
game.getTriggerHandler().suppressMode(TriggerType.ChangesZone);
|
||||
game.getAction().moveTo(ZoneType.Command, eff, sa);
|
||||
game.getTriggerHandler().clearSuppression(TriggerType.ChangesZone);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,87 +1,7 @@
|
||||
package forge.game.ability.effects;
|
||||
|
||||
import forge.GameCommand;
|
||||
import forge.game.Game;
|
||||
import forge.game.ability.AbilityFactory;
|
||||
import forge.game.ability.AbilityUtils;
|
||||
import forge.game.ability.SpellAbilityEffect;
|
||||
import forge.game.card.Card;
|
||||
import forge.game.card.CardCollection;
|
||||
import forge.game.player.Player;
|
||||
import forge.game.replacement.ReplacementEffect;
|
||||
import forge.game.replacement.ReplacementHandler;
|
||||
import forge.game.replacement.ReplacementLayer;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
import forge.game.trigger.TriggerType;
|
||||
import forge.game.zone.ZoneType;
|
||||
|
||||
abstract public class DamageBaseEffect extends SpellAbilityEffect {
|
||||
|
||||
static void replaceDying(final SpellAbility sa) {
|
||||
if (sa.hasParam("ReplaceDyingDefined")) {
|
||||
|
||||
if (sa.hasParam("ReplaceDyingCondition")) {
|
||||
// currently there is only one with Kicker
|
||||
final String condition = sa.getParam("ReplaceDyingCondition");
|
||||
if ("Kicked".equals(condition)) {
|
||||
if (!sa.isKicked()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final Card host = sa.getHostCard();
|
||||
final Player controller = sa.getActivatingPlayer();
|
||||
final Game game = host.getGame();
|
||||
String zone = sa.getParamOrDefault("ReplaceDyingZone", "Exile");
|
||||
CardCollection cards = AbilityUtils.getDefinedCards(host, sa.getParam("ReplaceDyingDefined"), sa);
|
||||
// no cards, no need for Effect
|
||||
if (cards.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// build an Effect with that infomation
|
||||
String name = host.getName() + "'s Effect";
|
||||
|
||||
final Card eff = createEffect(host, controller, name, host.getImageKey());
|
||||
eff.addRemembered(cards);
|
||||
|
||||
String repeffstr = "Event$ Moved | ValidCard$ Card.IsRemembered " +
|
||||
"| Origin$ Battlefield | Destination$ Graveyard " +
|
||||
"| Description$ If the creature would die this turn, exile it instead.";
|
||||
String effect = "DB$ ChangeZone | Defined$ ReplacedCard | Origin$ Battlefield | Destination$ " + zone;
|
||||
|
||||
ReplacementEffect re = ReplacementHandler.parseReplacement(repeffstr, eff, true);
|
||||
re.setLayer(ReplacementLayer.Other);
|
||||
|
||||
re.setOverridingAbility(AbilityFactory.getAbility(effect, eff));
|
||||
eff.addReplacementEffect(re);
|
||||
|
||||
// Add forgot trigger
|
||||
addForgetOnMovedTrigger(eff, "Battlefield");
|
||||
|
||||
// Copy text changes
|
||||
if (sa.isIntrinsic()) {
|
||||
eff.copyChangedTextFrom(host);
|
||||
}
|
||||
|
||||
final GameCommand endEffect = new GameCommand() {
|
||||
private static final long serialVersionUID = -5861759814760561373L;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
game.getAction().exile(eff, null);
|
||||
}
|
||||
};
|
||||
|
||||
game.getEndOfTurn().addUntil(endEffect);
|
||||
|
||||
eff.updateStateForView();
|
||||
|
||||
// TODO: Add targeting to the effect so it knows who it's dealing with
|
||||
game.getTriggerHandler().suppressMode(TriggerType.ChangesZone);
|
||||
game.getAction().moveTo(ZoneType.Command, eff, sa);
|
||||
game.getTriggerHandler().clearSuppression(TriggerType.ChangesZone);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,6 +158,8 @@ public class PumpAllEffect extends SpellAbilityEffect {
|
||||
keywords = CardFactoryUtil.sharedKeywords(keywords, restrictions, zones, sa.getHostCard());
|
||||
}
|
||||
applyPumpAll(sa, list, a, d, keywords, affectedZones);
|
||||
|
||||
replaceDying(sa);
|
||||
} // pumpAllResolve()
|
||||
|
||||
}
|
||||
|
||||
@@ -383,5 +383,7 @@ public class PumpEffect extends SpellAbilityEffect {
|
||||
|
||||
applyPump(sa, p, keywords, timestamp);
|
||||
}
|
||||
|
||||
replaceDying(sa);
|
||||
} // pumpResolve()
|
||||
}
|
||||
|
||||
@@ -2,9 +2,6 @@ Name:Flaying Tendrils
|
||||
ManaCost:1 B B
|
||||
Types:Sorcery
|
||||
K:Devoid
|
||||
A:SP$ PumpAll | Cost$ 1 B B | ValidCards$ Creature | NumAtt$ -2 | NumDef$ -2 | IsCurse$ True | SubAbility$ DBEffect | SpellDescription$ All creatures get -2/-2 until end of turn. If a creature would die this turn, exile it instead.
|
||||
SVar:DBEffect:DB$ Effect | Name$ Flaying Tendrils Effect | ReplacementEffects$ Moved | SVars$ DBExile | SpellDescription$ If a creature would die this turn, exile it instead.
|
||||
SVar:Moved:Event$ Moved | ValidCard$ Creature | Destination$ Graveyard | ReplaceWith$ DBExile | Description$ If a creature dealt damage by CARDNAME this turn would die, exile it instead.
|
||||
SVar:DBExile:DB$ ChangeZone | Defined$ ReplacedCard | Origin$ Battlefield | Destination$ Exile
|
||||
A:SP$ PumpAll | Cost$ 1 B B | ValidCards$ Creature | NumAtt$ -2 | NumDef$ -2 | IsCurse$ True | ReplaceDyingValid$ Creature | SpellDescription$ All creatures get -2/-2 until end of turn. If a creature would die this turn, exile it instead.
|
||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/flaying_tendrils.jpg
|
||||
Oracle:Devoid (This card has no color.)\nAll creatures get -2/-2 until end of turn. If a creature would die this turn, exile it instead.
|
||||
|
||||
6
forge-gui/res/cardsfolder/upcoming/necrotic_wound.txt
Normal file
6
forge-gui/res/cardsfolder/upcoming/necrotic_wound.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
Name:Necrotic Wound
|
||||
ManaCost:B
|
||||
Types:Instant
|
||||
A:SP$ Pump | Cost$ B | ValidTgts$ Creature | TgtPrompt$ Select target creature | NumAtt$ -X | NumDef$ -X | References$ X | ReplaceDyingDefined$ Targeted | IsCurse$ True | SpellDescription$ Target creature gets -X/-X until end of turn, where X is the number of creature cards in your graveyard. If that creature would die this turn, exile it instead.
|
||||
SVar:X:Count$TypeInYourYard.Creature
|
||||
Oracle:Undergrowth — Target creature gets -X/-X until end of turn, where X is the number of creature cards in your graveyard. If that creature would die this turn, exile it instead.
|
||||
Reference in New Issue
Block a user