mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
Merge branch 'abandoned_sarcophagus' into 'master'
Cycling: add Flag if card is discarded for cost with cycling See merge request core-developers/forge!3770
This commit is contained in:
@@ -45,6 +45,7 @@ public enum AbilityKey {
|
||||
CumulativeUpkeepPaid("CumulativeUpkeepPaid"),
|
||||
CurrentCastSpells("CurrentCastSpells"),
|
||||
CurrentStormCount("CurrentStormCount"),
|
||||
Cycling("Cycling"),
|
||||
DamageAmount("DamageAmount"),
|
||||
DamageMap("DamageMap"),
|
||||
DamageSource("DamageSource"),
|
||||
|
||||
@@ -192,7 +192,12 @@ public class CostDiscard extends CostPartWithList {
|
||||
*/
|
||||
@Override
|
||||
protected Card doPayment(SpellAbility ability, Card targetCard) {
|
||||
return targetCard.getController().discard(targetCard, null, null);
|
||||
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
|
||||
if (ability.isCycling() && targetCard.equals(ability.getHostCard())) {
|
||||
// discard itself for cycling cost
|
||||
runParams.put(AbilityKey.Cycling, true);
|
||||
}
|
||||
return targetCard.getController().discard(targetCard, null, null, runParams);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
||||
@@ -1583,6 +1583,9 @@ public class Player extends GameEntity implements Comparable<Player> {
|
||||
}
|
||||
|
||||
public final Card discard(final Card c, final SpellAbility sa, CardZoneTable table) {
|
||||
return discard(c, sa , table, null);
|
||||
}
|
||||
public final Card discard(final Card c, final SpellAbility sa, CardZoneTable table, Map<AbilityKey, Object> params) {
|
||||
if (!c.canBeDiscardedBy(sa)) {
|
||||
return null;
|
||||
}
|
||||
@@ -1604,6 +1607,9 @@ public class Player extends GameEntity implements Comparable<Player> {
|
||||
final Map<AbilityKey, Object> repRunParams = AbilityKey.mapFromCard(c);
|
||||
repRunParams.put(AbilityKey.Source, source);
|
||||
repRunParams.put(AbilityKey.Affected, this);
|
||||
if (params != null) {
|
||||
repRunParams.putAll(params);
|
||||
}
|
||||
|
||||
if (game.getReplacementHandler().run(ReplacementType.Discard, repRunParams) != ReplacementResult.NotReplaced) {
|
||||
return null;
|
||||
@@ -1614,16 +1620,16 @@ public class Player extends GameEntity implements Comparable<Player> {
|
||||
sb.append(this).append(" discards ").append(c);
|
||||
final Card newCard;
|
||||
if (discardToTopOfLibrary) {
|
||||
newCard = game.getAction().moveToLibrary(c, 0, sa);
|
||||
newCard = game.getAction().moveToLibrary(c, 0, sa, params);
|
||||
sb.append(" to the library");
|
||||
// Play the Discard sound
|
||||
}
|
||||
else if (discardMadness) {
|
||||
newCard = game.getAction().exile(c, sa);
|
||||
newCard = game.getAction().exile(c, sa, params);
|
||||
sb.append(" with Madness");
|
||||
}
|
||||
else {
|
||||
newCard = game.getAction().moveToGraveyard(c, sa);
|
||||
newCard = game.getAction().moveToGraveyard(c, sa, params);
|
||||
// Play the Discard sound
|
||||
}
|
||||
if (table != null) {
|
||||
@@ -1648,6 +1654,9 @@ public class Player extends GameEntity implements Comparable<Player> {
|
||||
runParams.put(AbilityKey.Card, c);
|
||||
runParams.put(AbilityKey.Cause, cause);
|
||||
runParams.put(AbilityKey.IsMadness, discardMadness);
|
||||
if (params != null) {
|
||||
runParams.putAll(params);
|
||||
}
|
||||
game.getTriggerHandler().runTrigger(TriggerType.Discarded, runParams, false);
|
||||
game.getGameLog().add(GameLogEntryType.DISCARD, sb.toString());
|
||||
return newCard;
|
||||
|
||||
@@ -59,6 +59,11 @@ public class ReplaceDiscard extends ReplacementEffect {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (hasParam("Cycling")) {
|
||||
if (getParam("Cycling").equalsIgnoreCase("True") != runParams.containsKey(AbilityKey.Cycling)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (hasParam("DiscardFromEffect")) {
|
||||
if (null == runParams.get(AbilityKey.Source)) {
|
||||
return false;
|
||||
|
||||
@@ -92,6 +92,12 @@ public class ReplaceMoved extends ReplacementEffect {
|
||||
}
|
||||
}
|
||||
|
||||
if (hasParam("Cycling")) { // Cycling is by cost, not by effect so cause is null
|
||||
if (getParam("Cycling").equalsIgnoreCase("True") != runParams.containsKey(AbilityKey.Cycling)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (hasParam("FoundSearchingLibrary")) {
|
||||
if (!runParams.containsKey(AbilityKey.FoundSearchingLibrary)) {
|
||||
return false;
|
||||
|
||||
@@ -2,7 +2,7 @@ Name:Abandoned Sarcophagus
|
||||
ManaCost:3
|
||||
Types:Artifact
|
||||
S:Mode$ Continuous | Affected$ Card.nonLand+YouOwn+withCycling,Card.nonLand+YouOwn+withTypeCycling | MayPlay$ True | AffectedZone$ Graveyard | Description$ You may cast nonland cards with cycling from your graveyard.
|
||||
R:Event$ Moved | ValidCard$ Card.YouOwn+withCycling,Card.YouOwn+withTypeCycling | Destination$ Graveyard | NotCause$ Activated.Cycling | ReplaceWith$ Exile | ActiveZones$ Battlefield | Description$ If a card with cycling would be put into your graveyard from anywhere and it wasn't cycled, exile it instead.
|
||||
R:Event$ Moved | ValidCard$ Card.YouOwn+withCycling,Card.YouOwn+withTypeCycling | Destination$ Graveyard | Cycling$ False | ReplaceWith$ Exile | ActiveZones$ Battlefield | Description$ If a card with cycling would be put into your graveyard from anywhere and it wasn't cycled, exile it instead.
|
||||
SVar:Exile:DB$ ChangeZone | Hidden$ True | Origin$ All | Destination$ Exile | Defined$ ReplacedCard
|
||||
#TODO: Add Ability$Cycling to Cycling cards for the purpose of this and other similar cards for deck hints
|
||||
AI:RemoveDeck:Random
|
||||
|
||||
Reference in New Issue
Block a user