mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
Another rev of the enPump keyword code. Will now allow auras to use flash and/or Cycling.
This commit is contained in:
@@ -1388,10 +1388,22 @@ public class CardFactoryUtil {
|
||||
return onUnEquip;
|
||||
}//eqPump_unEquip ( was vanila_unequip() )
|
||||
|
||||
public static SpellAbility enPump_Enchant(final Card sourceCard, final int Power, final int Tough, final String[] extrinsicKeywords) {
|
||||
public static SpellAbility enPump_Enchant(final Card sourceCard, final int Power, final int Tough, final String[] extrinsicKeywords,
|
||||
final String[] spellDescription, final String[] stackDescription) {
|
||||
|
||||
final SpellAbility enchant = new Spell(sourceCard) {
|
||||
private static final long serialVersionUID = -8259560434384053776L;
|
||||
|
||||
@Override
|
||||
public boolean canPlay() {
|
||||
return (sourceCard.getKeyword().contains("Flash") && (AllZone.GameAction.isCardInZone(sourceCard, AllZone.Human_Hand) ||
|
||||
AllZone.GameAction.isCardInZone(sourceCard, AllZone.Computer_Hand)) // for flash, which is not working through the keyword for some reason
|
||||
||
|
||||
(! sourceCard.getKeyword().contains("Flash") && // if not flash then limit to main 1 and 2 on controller's turn
|
||||
(sourceCard.getController().equals(AllZone.Phase.getActivePlayer()) &&
|
||||
(AllZone.Phase.getPhase().equals(Constant.Phase.Main1) || AllZone.Phase.getPhase().equals(Constant.Phase.Main2)))));
|
||||
}
|
||||
|
||||
public boolean canPlayAI() {
|
||||
CardList list = new CardList(AllZone.Computer_Play.getCards());
|
||||
list = list.getType("Creature");
|
||||
@@ -1424,12 +1436,14 @@ public class CardFactoryUtil {
|
||||
}//resolve()
|
||||
};//enchant ability
|
||||
enchant.setBeforePayMana(CardFactoryUtil.input_targetCreature(enchant));
|
||||
enchant.setDescription("This is a test of a setDescription");
|
||||
enchant.setDescription(spellDescription[0]);
|
||||
enchant.setStackDescription(stackDescription[0]);
|
||||
|
||||
return enchant;
|
||||
}//enPump_Enchant()
|
||||
|
||||
public static Command enPump_onEnchant(final Card sourceCard, final int Power, final int Tough, final String[] extrinsicKeywords) {
|
||||
public static Command enPump_onEnchant(final Card sourceCard, final int Power, final int Tough, final String[] extrinsicKeywords,
|
||||
final String[] spellDescription, final String[] stackDescription) {
|
||||
|
||||
Command onEnchant = new Command() {
|
||||
|
||||
@@ -1453,7 +1467,8 @@ public class CardFactoryUtil {
|
||||
return onEnchant;
|
||||
}//enPump_onEnchant
|
||||
|
||||
public static Command enPump_unEnchant(final Card sourceCard, final int Power, final int Tough, final String[] extrinsicKeywords) {
|
||||
public static Command enPump_unEnchant(final Card sourceCard, final int Power, final int Tough, final String[] extrinsicKeywords,
|
||||
final String[] spellDescription, final String[] stackDescription) {
|
||||
|
||||
Command onUnEnchant = new Command() {
|
||||
|
||||
@@ -1476,7 +1491,8 @@ public class CardFactoryUtil {
|
||||
return onUnEnchant;
|
||||
}//enPump_unEnchant
|
||||
|
||||
public static Command enPump_LeavesPlay(final Card sourceCard, final int Power, final int Tough, final String[] extrinsicKeywords) {
|
||||
public static Command enPump_LeavesPlay(final Card sourceCard, final int Power, final int Tough, final String[] extrinsicKeywords,
|
||||
final String[] spellDescription, final String[] stackDescription) {
|
||||
|
||||
Command onLeavesPlay = new Command() {
|
||||
|
||||
|
||||
@@ -5262,9 +5262,17 @@ class CardFactory_Auras {
|
||||
String keywordsUnsplit = "";
|
||||
String extrinsicKeywords[] = {"none"}; // for equips with no keywords to add
|
||||
|
||||
final String spDesc[] = {"none"};
|
||||
final String stDesc[] = {"none"};
|
||||
StringBuilder sbD = new StringBuilder();
|
||||
StringBuilder sbSD = new StringBuilder();
|
||||
|
||||
int Power = 0;
|
||||
int Tough = 0;
|
||||
|
||||
sbD.append("Enchanted creature ");
|
||||
|
||||
|
||||
String ptk[] = k[1].split("/");
|
||||
|
||||
if (ptk.length == 1) // keywords in first cell
|
||||
@@ -5274,6 +5282,11 @@ class CardFactory_Auras {
|
||||
|
||||
else // parse the power/toughness boosts in first two cells
|
||||
{
|
||||
sbD.append("gets ");
|
||||
sbD.append(ptk[0].trim());
|
||||
sbD.append("/");
|
||||
sbD.append(ptk[1].trim());
|
||||
|
||||
for (int i = 0; i < 2; i ++)
|
||||
{
|
||||
if (ptk[i].matches("[\\+\\-][0-9]")) ptk[i] =ptk[i].replace("+", "");
|
||||
@@ -5282,25 +5295,44 @@ class CardFactory_Auras {
|
||||
Tough = Integer.parseInt(ptk[1].trim());
|
||||
|
||||
if (ptk.length > 2) // keywords in third cell
|
||||
{
|
||||
keywordsUnsplit = ptk[2];
|
||||
sbD.append(" and ");
|
||||
}
|
||||
}
|
||||
|
||||
if (keywordsUnsplit.length() > 0) // then there is at least one extrinsic keyword to assign
|
||||
{
|
||||
sbD.append("has ");
|
||||
|
||||
String tempKwds[] = keywordsUnsplit.split("&");
|
||||
extrinsicKeywords = new String[tempKwds.length];
|
||||
|
||||
for (int i = 0; i < tempKwds.length; i ++)
|
||||
{
|
||||
extrinsicKeywords[i] = tempKwds[i].trim();
|
||||
}
|
||||
}
|
||||
card.clearSpellAbility();
|
||||
card.addSpellAbility(CardFactoryUtil.enPump_Enchant(card, Power, Tough, extrinsicKeywords));
|
||||
|
||||
card.addEnchantCommand(CardFactoryUtil.enPump_onEnchant(card, Power, Tough, extrinsicKeywords));
|
||||
card.addUnEnchantCommand(CardFactoryUtil.enPump_unEnchant(card, Power, Tough, extrinsicKeywords));
|
||||
card.addLeavesPlayCommand(CardFactoryUtil.enPump_LeavesPlay(card, Power, Tough, extrinsicKeywords));
|
||||
sbD.append(extrinsicKeywords[i].toLowerCase());
|
||||
if (i < tempKwds.length - 2) { sbD.append(", "); }
|
||||
if (i == tempKwds.length - 2) { sbD.append(" and "); }
|
||||
}
|
||||
}
|
||||
sbD.append(".");
|
||||
spDesc[0] = sbD.toString();
|
||||
|
||||
sbSD.append(cardName);
|
||||
sbSD.append(" - ");
|
||||
sbSD.append("enchants target creature.");
|
||||
stDesc[0] = sbSD.toString();
|
||||
|
||||
if (k.length > 2) { spDesc[0] = k[2].trim(); } // Use the spell and stack descriptions included
|
||||
if (k.length > 3) { stDesc[0] = k[3].trim(); } // with the keyword if they are present.
|
||||
|
||||
card.clearSpellAbility();
|
||||
card.addSpellAbility(CardFactoryUtil.enPump_Enchant(card, Power, Tough, extrinsicKeywords, spDesc, stDesc));
|
||||
card.addEnchantCommand(CardFactoryUtil.enPump_onEnchant(card, Power, Tough, extrinsicKeywords, spDesc, stDesc));
|
||||
card.addUnEnchantCommand(CardFactoryUtil.enPump_unEnchant(card, Power, Tough, extrinsicKeywords, spDesc, stDesc));
|
||||
card.addLeavesPlayCommand(CardFactoryUtil.enPump_LeavesPlay(card, Power, Tough, extrinsicKeywords, spDesc, stDesc));
|
||||
}
|
||||
}// enPump
|
||||
|
||||
|
||||
Reference in New Issue
Block a user