mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
- Converted Chains of Mephistopheles to script (it's a normal replacement effect, the original hardcoded script is not correct)
This commit is contained in:
@@ -1306,44 +1306,6 @@ public class Player extends GameEntity implements Comparable<Player> {
|
||||
return drawn;
|
||||
}
|
||||
|
||||
// ======== Chains of Mephistopheles hardcode. =========
|
||||
// This card requires player to either discard a card, and then he may proceed drawing, or mill 1 - then no draw will happen
|
||||
// It's oracle-worded as a replacement effect ("If a player would draw a card ... discards a card instead") (rule 419.1a)
|
||||
// Yet, gatherer's rulings read: The effect is cumulative. If there are two of these on the battlefield, each of them will modify each draw
|
||||
// That means player isn't supposed to choose one replacement effect out of two (generated by Chains Of Mephistopheles), but both happen.
|
||||
// So it's not a common replacement effect and has to be handled by special code.
|
||||
|
||||
// This is why the code is placed after any other replacement effects could affect the draw event.
|
||||
List<Card> chainsList = null;
|
||||
for(Card c : game.getCardsIn(ZoneType.Battlefield)) {
|
||||
if ( c.getName().equals("Chains of Mephistopheles") ) {
|
||||
if ( null == chainsList )
|
||||
chainsList = new ArrayList<Card>();
|
||||
chainsList.add(c);
|
||||
}
|
||||
}
|
||||
if (chainsList != null && (numDrawnThisDrawStep > 0 || !game.getPhaseHandler().is(PhaseType.DRAW))) {
|
||||
for(Card c : chainsList) {
|
||||
// I have to target this player - don't know how to do it.
|
||||
|
||||
|
||||
if (getCardsIn(ZoneType.Hand).isEmpty()) {
|
||||
SpellAbility saMill = AbilityFactory.getAbility(c.getSVar("MillOne"), c);
|
||||
saMill.setActivatingPlayer(c.getController());
|
||||
saMill.getTargets().add(this);
|
||||
AbilityUtils.resolve(saMill);
|
||||
|
||||
return drawn; // Draw is cancelled
|
||||
} else {
|
||||
SpellAbility saDiscard = AbilityFactory.getAbility(c.getSVar("DiscardOne"), c);
|
||||
saDiscard.setActivatingPlayer(c.getController());
|
||||
saDiscard.getTargets().add(this);
|
||||
AbilityUtils.resolve(saDiscard);
|
||||
}
|
||||
}
|
||||
}
|
||||
// End of = Chains of Mephistopheles hardcode. =========
|
||||
|
||||
if (!library.isEmpty()) {
|
||||
|
||||
Card c = library.get(0);
|
||||
|
||||
@@ -56,8 +56,8 @@ public class ReplaceDraw extends ReplacementEffect {
|
||||
if (this.getMapParams().containsKey("NotFirstCardInDrawStep")) {
|
||||
final Player p = (Player)runParams.get("Affected");
|
||||
if (p.numDrawnThisDrawStep() == 0
|
||||
&& this.getHostCard().getController().getGame().getPhaseHandler().is(PhaseType.DRAW)
|
||||
&& this.getHostCard().getController().getGame().getPhaseHandler().getPlayerTurn().equals(p)) {
|
||||
&& this.getHostCard().getGame().getPhaseHandler().is(PhaseType.DRAW)
|
||||
&& this.getHostCard().getGame().getPhaseHandler().isPlayerTurn(p)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
Name:Chains of Mephistopheles
|
||||
ManaCost:1 B
|
||||
Types:Enchantment
|
||||
Text:If a player would draw a card except the first one he or she draws in his or her draw step each turn, that player discards a card instead. If the player discards a card this way, he or she draws a card. If the player doesn't discard a card this way, he or she puts the top card of his or her library into his or her graveyard.
|
||||
SVar:MillOne:DB$ Mill | NumCards$ 1
|
||||
SVar:DiscardOne:DB$ Discard | Mandatory$ True | NumCards$ 1 | Mode$ TgtChoose
|
||||
R:Event$ Draw | ActiveZones$ Battlefield | ValidPlayer$ Player | ReplaceWith$ DiscardOne | NotFirstCardInDrawStep$ True | Description$ If a player would draw a card except the first one he or she draws in his or her draw step each turn, that player discards a card instead. If the player discards a card this way, he or she draws a card. If the player doesn't discard a card this way, he or she puts the top card of his or her library into his or her graveyard.
|
||||
SVar:DiscardOne:DB$ Discard | Defined$ ReplacedPlayer | Mandatory$ True | NumCards$ 1 | Mode$ TgtChoose | RememberDiscarded$ True | SubAbility$ DBDraw
|
||||
SVar:DBDraw:DB$ Draw | Defined$ ReplacedPlayer | ConditionDefined$ Remembered | ConditionPresent$ Card | ConditionCompare$ GE1 | NumCards$ 1 | SubAbility$ MillOne
|
||||
SVar:MillOne:DB$ Mill | NumCards$ 1 | Defined$ ReplacedPlayer | ConditionDefined$ Remembered | ConditionPresent$ Card | ConditionCompare$ EQ0 | SubAbility$ DBCleanup
|
||||
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
|
||||
SVar:RemRandomDeck:True
|
||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/chains_of_mephistopheles.jpg
|
||||
Oracle:If a player would draw a card except the first one he or she draws in his or her draw step each turn, that player discards a card instead. If the player discards a card this way, he or she draws a card. If the player doesn't discard a card this way, he or she puts the top card of his or her library into his or her graveyard.
|
||||
Reference in New Issue
Block a user