mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 04:08:01 +00:00
- Move Planeswalker abilities from a file by itself into CardFactory
This commit is contained in:
@@ -27,6 +27,8 @@ import forge.CardCharacteristicName;
|
||||
import forge.CardColor;
|
||||
import forge.CardUtil;
|
||||
import forge.Color;
|
||||
import forge.Command;
|
||||
import forge.CounterType;
|
||||
import forge.ImageCache;
|
||||
import forge.card.CardCharacteristics;
|
||||
import forge.card.CardRules;
|
||||
@@ -298,7 +300,7 @@ public class CardFactory {
|
||||
if (card.isCreature()) {
|
||||
CardFactoryCreatures.buildCard(card, cardName);
|
||||
} else if (card.isPlaneswalker()) {
|
||||
CardFactoryPlaneswalkers.buildCard(card);
|
||||
buildPlaneswalkerAbilities(card);
|
||||
} else if (card.isLand()) {
|
||||
CardFactoryLands.buildCard(card, cardName);
|
||||
} else if (card.isSorcery()) {
|
||||
@@ -332,6 +334,22 @@ public class CardFactory {
|
||||
card.addSpellAbility(planarRoll);
|
||||
}
|
||||
|
||||
private static void buildPlaneswalkerAbilities(Card card) {
|
||||
if (card.getBaseLoyalty() > 0) {
|
||||
Command cmd = CardFactoryUtil.entersBattleFieldWithCounters(card, CounterType.LOYALTY, card.getBaseLoyalty());
|
||||
card.addComesIntoPlayCommand(cmd);
|
||||
}
|
||||
|
||||
//Planeswalker damage redirection
|
||||
card.addReplacementEffect(ReplacementHandler.parseReplacement("Event$ DamageDone | ActiveZones$ Battlefield | IsCombat$ False | ValidSource$ Card.YouDontCtrl"
|
||||
+ " | ValidTarget$ You | Optional$ True | OptionalDecider$ Opponent | ReplaceWith$ DamagePW | Secondary$ True"
|
||||
+ " | AICheckSVar$ DamagePWAI | AISVarCompare$ GT4 | Description$ Redirect damage to " + card.toString(), card));
|
||||
card.setSVar("DamagePW", "AB$DealDamage | Cost$ 0 | Defined$ Self | NumDmg$ DamagePWX | DamageSource$ ReplacedSource | References$ DamagePWX,DamagePWAI");
|
||||
card.setSVar("DamagePWX", "ReplaceCount$DamageAmount");
|
||||
card.setSVar("DamagePWAI", "ReplaceCount$DamageAmount/NMinus.DamagePWY");
|
||||
card.setSVar("DamagePWY", "Count$YourLifeTotal");
|
||||
}
|
||||
|
||||
private static Card readCard(final CardRules rules) {
|
||||
|
||||
final Card card = new Card();
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
/*
|
||||
* Forge: Play Magic: the Gathering.
|
||||
* Copyright (C) 2011 Forge Team
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package forge.card.cardfactory;
|
||||
|
||||
import forge.Card;
|
||||
import forge.Command;
|
||||
import forge.CounterType;
|
||||
import forge.card.replacement.ReplacementHandler;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* CardFactory_Planeswalkers class.
|
||||
* </p>
|
||||
*
|
||||
* @author Forge
|
||||
* @version $Id$
|
||||
*/
|
||||
public class CardFactoryPlaneswalkers {
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* getCard.
|
||||
* </p>
|
||||
*
|
||||
* @param card
|
||||
* a {@link forge.Card} object.
|
||||
* @return a {@link forge.Card} object.
|
||||
*/
|
||||
public static void buildCard(final Card card) {
|
||||
// All Planeswalkers set their loyality in the beginning
|
||||
if (card.getBaseLoyalty() > 0) {
|
||||
Command cmd = CardFactoryUtil.entersBattleFieldWithCounters(card, CounterType.LOYALTY, card.getBaseLoyalty());
|
||||
card.addComesIntoPlayCommand(cmd);
|
||||
}
|
||||
|
||||
//Planeswalker damage redirection
|
||||
card.addReplacementEffect(ReplacementHandler.parseReplacement("Event$ DamageDone | ActiveZones$ Battlefield | IsCombat$ False | ValidSource$ Card.YouDontCtrl"
|
||||
+ " | ValidTarget$ You | Optional$ True | OptionalDecider$ Opponent | ReplaceWith$ DamagePW | Secondary$ True"
|
||||
+ " | AICheckSVar$ DamagePWAI | AISVarCompare$ GT4 | Description$ Redirect damage to " + card.toString(), card));
|
||||
card.setSVar("DamagePW", "AB$DealDamage | Cost$ 0 | Defined$ Self | NumDmg$ DamagePWX | DamageSource$ ReplacedSource | References$ DamagePWX,DamagePWAI");
|
||||
card.setSVar("DamagePWX", "ReplaceCount$DamageAmount");
|
||||
card.setSVar("DamagePWAI", "ReplaceCount$DamageAmount/NMinus.DamagePWY");
|
||||
card.setSVar("DamagePWY", "Count$YourLifeTotal");
|
||||
}
|
||||
|
||||
} // end class CardFactoryPlaneswalkers
|
||||
Reference in New Issue
Block a user