mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 10:48:00 +00:00
Removed the commented, original Pump code.
This commit is contained in:
@@ -306,560 +306,6 @@ public class CardFactory implements NewConstants {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* //Creatures with simple, self-targeted mana-activated keyword adding abilities
|
|
||||||
//-1 means not found
|
|
||||||
while(hasKeyword(card, "KPump") != -1)
|
|
||||||
{
|
|
||||||
int n = hasKeyword(card, "KPump");
|
|
||||||
if(n != -1)
|
|
||||||
{
|
|
||||||
String parse = card.getKeyword().get(n).toString();
|
|
||||||
card.removeIntrinsicKeyword(parse);
|
|
||||||
|
|
||||||
String k[] = parse.split(":");
|
|
||||||
|
|
||||||
final String manaCost = k[0].substring(6);
|
|
||||||
final String keyword = k[1];
|
|
||||||
|
|
||||||
final Command untilEOT = new Command()
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = -2904643243256352517L;
|
|
||||||
|
|
||||||
public void execute()
|
|
||||||
{
|
|
||||||
if(AllZone.GameAction.isCardInPlay(card))
|
|
||||||
{
|
|
||||||
card.removeIntrinsicKeyword(keyword);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
SpellAbility ability = new Ability_Activated(card, manaCost)
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = -630655617339584299L;
|
|
||||||
|
|
||||||
public boolean canPlayAI()
|
|
||||||
{
|
|
||||||
//in case if a lifelink pump, allow multiple pumps
|
|
||||||
if (CardFactoryUtil.AI_doesCreatureAttack(card) &&
|
|
||||||
!card.getKeyword().contains(keyword))
|
|
||||||
{
|
|
||||||
Random r = new Random();
|
|
||||||
if (r.nextFloat() <= Math.pow(.6667, card.getAbilityUsed()))
|
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
public boolean canPlay()
|
|
||||||
{
|
|
||||||
if (CardFactoryUtil.canUseAbility(card) && AllZone.GameAction.isCardInPlay(card))
|
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
public void resolve()
|
|
||||||
{
|
|
||||||
if(AllZone.GameAction.isCardInPlay(card))
|
|
||||||
{
|
|
||||||
card.addIntrinsicKeyword(keyword);
|
|
||||||
|
|
||||||
card.setAbilityUsed(card.getAbilityUsed()+1);
|
|
||||||
|
|
||||||
AllZone.EndOfTurn.addUntil(untilEOT);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
String Desc = new String();
|
|
||||||
Desc = cardName + " gains " + keyword + " until end of turn.";
|
|
||||||
|
|
||||||
ability.setDescription(manaCost + ": " + Desc);
|
|
||||||
ability.setStackDescription(Desc);
|
|
||||||
|
|
||||||
card.addSpellAbility(ability);
|
|
||||||
}//if (should pump card)
|
|
||||||
}//while - card has more pump keywords - Blistering Dieflyn has two pump keywords
|
|
||||||
|
|
||||||
|
|
||||||
//Creatures with simple, self-targeted mana-activated power and/or toughness
|
|
||||||
//pumping abilities
|
|
||||||
//is the card "self pumper" like Furnace Whelp - this card gets +1/+1 until end of turn?
|
|
||||||
//-1 means not found
|
|
||||||
while (hasKeyword(card, "PTPump") != -1)
|
|
||||||
{
|
|
||||||
int n = hasKeyword(card, "PTPump");
|
|
||||||
if(n != -1)
|
|
||||||
{
|
|
||||||
String parse = card.getKeyword().get(n).toString();
|
|
||||||
card.removeIntrinsicKeyword(parse);
|
|
||||||
|
|
||||||
final int attack[] = new int[1];
|
|
||||||
final int defense[] = new int[1];
|
|
||||||
|
|
||||||
String k[] = parse.split(":");
|
|
||||||
String pt[] = k[1].split("/");
|
|
||||||
|
|
||||||
final String manaCost = k[0].substring(7);
|
|
||||||
|
|
||||||
|
|
||||||
Integer na = card.getNetAttack();
|
|
||||||
Integer nd = card.getNetDefense();
|
|
||||||
|
|
||||||
pt[0].replace("p", na.toString());
|
|
||||||
pt[0].replace("t", nd.toString());
|
|
||||||
|
|
||||||
pt[1].replace("p", na.toString());
|
|
||||||
pt[1].replace("t", nd.toString());
|
|
||||||
|
|
||||||
attack[0] = Integer.parseInt(pt[0].replace("+", ""));
|
|
||||||
defense[0] = Integer.parseInt(pt[1].replace("+", ""));
|
|
||||||
|
|
||||||
|
|
||||||
final Command untilEOT = new Command()
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = -4518618729662470596L;
|
|
||||||
public void execute()
|
|
||||||
{
|
|
||||||
if(AllZone.GameAction.isCardInPlay(card))
|
|
||||||
{
|
|
||||||
card.addTempAttackBoost(-attack[0]);
|
|
||||||
card.addTempDefenseBoost(-defense[0]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
SpellAbility ability = new Ability_Activated(card, manaCost)
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = -5718931378326228534L;
|
|
||||||
|
|
||||||
public boolean canPlayAI()
|
|
||||||
{
|
|
||||||
if (card.getNetDefense() + defense[0] < 1) // no point if it would kill the creature outright
|
|
||||||
return false;
|
|
||||||
return CardFactoryUtil.AI_doesCreatureAttack(card);
|
|
||||||
}
|
|
||||||
public boolean canPlay()
|
|
||||||
{
|
|
||||||
if (CardFactoryUtil.canUseAbility(card) && AllZone.GameAction.isCardInPlay(card) &&
|
|
||||||
!card.isFaceDown())
|
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
public void resolve()
|
|
||||||
{
|
|
||||||
if(AllZone.GameAction.isCardInPlay(card))
|
|
||||||
{
|
|
||||||
card.addTempAttackBoost(attack[0]);
|
|
||||||
card.addTempDefenseBoost(defense[0]);
|
|
||||||
|
|
||||||
card.setAbilityUsed(card.getAbilityUsed()+1);
|
|
||||||
|
|
||||||
AllZone.EndOfTurn.addUntil(untilEOT);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
String Desc = new String();
|
|
||||||
Desc = cardName + " gets ";
|
|
||||||
if (attack[0] > 0)
|
|
||||||
Desc = Desc + "+" + attack[0];
|
|
||||||
else
|
|
||||||
Desc = Desc + attack[0];
|
|
||||||
Desc = Desc + "/";
|
|
||||||
if (defense[0] > 0)
|
|
||||||
Desc = Desc + "+" + defense[0];
|
|
||||||
else
|
|
||||||
Desc = Desc + defense[0];
|
|
||||||
Desc = Desc + " until end of turn.";
|
|
||||||
|
|
||||||
ability.setDescription(manaCost + ": " + Desc);
|
|
||||||
ability.setStackDescription(Desc);
|
|
||||||
|
|
||||||
card.addSpellAbility(ability);
|
|
||||||
}//if (should pump card)
|
|
||||||
}//while - card has more pump keywords - Blistering Dieflyn has two pump keywords
|
|
||||||
|
|
||||||
//Creatures with simple, self-targeted mana-activated power and/or toughness
|
|
||||||
//pumping plus keyword adding abilities
|
|
||||||
//is the card "self pumper" like Furnance Whelp - this card gets +1/+1 until end of turn?
|
|
||||||
//-1 means not found
|
|
||||||
while(hasKeyword(card, "PTKPump") != -1)
|
|
||||||
{
|
|
||||||
int n = hasKeyword(card, "PTKPump");
|
|
||||||
if(n != -1)
|
|
||||||
{
|
|
||||||
String parse = card.getKeyword().get(n).toString();
|
|
||||||
card.removeIntrinsicKeyword(parse);
|
|
||||||
|
|
||||||
final int attack[] = new int[1];
|
|
||||||
final int defense[] = new int[1];
|
|
||||||
|
|
||||||
String k[] = parse.split(":");
|
|
||||||
String ptk[] = k[1].split("/");
|
|
||||||
|
|
||||||
final String manaCost = k[0].substring(8);
|
|
||||||
|
|
||||||
attack[0] = Integer.parseInt(ptk[0].replace("+", ""));
|
|
||||||
defense[0] = Integer.parseInt(ptk[1].replace("+", ""));
|
|
||||||
final String keyword = ptk[2];
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
final Command untilEOT = new Command()
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = -3554196069508466753L;
|
|
||||||
|
|
||||||
public void execute()
|
|
||||||
{
|
|
||||||
if(AllZone.GameAction.isCardInPlay(card))
|
|
||||||
{
|
|
||||||
card.removeIntrinsicKeyword(keyword);
|
|
||||||
card.addTempAttackBoost(-attack[0]);
|
|
||||||
card.addTempDefenseBoost(-defense[0]);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
SpellAbility ability = new Ability_Activated(card, manaCost)
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 4196412133232530875L;
|
|
||||||
|
|
||||||
public boolean canPlayAI()
|
|
||||||
{
|
|
||||||
if (card.getNetDefense() + defense[0] < 1) // no point if it would kill the creature outright
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (card.getKeyword().contains(keyword))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return CardFactoryUtil.AI_doesCreatureAttack(card);
|
|
||||||
}
|
|
||||||
public boolean canPlay()
|
|
||||||
{
|
|
||||||
if (CardFactoryUtil.canUseAbility(card) && AllZone.GameAction.isCardInPlay(card) &&
|
|
||||||
!card.isFaceDown())
|
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
public void resolve()
|
|
||||||
{
|
|
||||||
if(AllZone.GameAction.isCardInPlay(card))
|
|
||||||
{
|
|
||||||
card.addIntrinsicKeyword(keyword);
|
|
||||||
card.addTempAttackBoost(attack[0]);
|
|
||||||
card.addTempDefenseBoost(defense[0]);
|
|
||||||
|
|
||||||
card.setAbilityUsed(card.getAbilityUsed()+1);
|
|
||||||
|
|
||||||
AllZone.EndOfTurn.addUntil(untilEOT);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
String Desc = new String();
|
|
||||||
Desc = cardName + " gets ";
|
|
||||||
if (attack[0] > 0)
|
|
||||||
Desc = Desc + "+" + attack[0];
|
|
||||||
else
|
|
||||||
Desc = Desc + attack[0];
|
|
||||||
Desc = Desc + "/";
|
|
||||||
if (defense[0] > 0)
|
|
||||||
Desc = Desc + "+" + defense[0];
|
|
||||||
else
|
|
||||||
Desc = Desc + defense[0];
|
|
||||||
Desc = Desc + " and gains " + keyword + " until end of turn.";
|
|
||||||
|
|
||||||
ability.setDescription(manaCost + ": " + Desc);
|
|
||||||
ability.setStackDescription(Desc);
|
|
||||||
|
|
||||||
card.addSpellAbility(ability);
|
|
||||||
}//if (should pump card)
|
|
||||||
}//while - card has more pump keywords - Blistering Dieflyn has two pump keywords
|
|
||||||
|
|
||||||
//Creatures with simple, targeted keyword adding abilities
|
|
||||||
// costs may include "T" to indicate a tap cost
|
|
||||||
//-1 means not found
|
|
||||||
while(hasKeyword(card, "TgtKPump") != -1)
|
|
||||||
{
|
|
||||||
int n = hasKeyword(card, "TgtKPump");
|
|
||||||
if(n != -1)
|
|
||||||
{
|
|
||||||
String parse = card.getKeyword().get(n).toString();
|
|
||||||
card.removeIntrinsicKeyword(parse);
|
|
||||||
|
|
||||||
String k[] = parse.split(":");
|
|
||||||
|
|
||||||
String tmpCost = k[0].substring(9);
|
|
||||||
final String keyword = k[1];
|
|
||||||
|
|
||||||
boolean tapCost = false;
|
|
||||||
boolean tapOnlyCost = false;
|
|
||||||
|
|
||||||
if (tmpCost.contains("T"))
|
|
||||||
{
|
|
||||||
tapCost = true;
|
|
||||||
tmpCost = tmpCost.replace("T", "");
|
|
||||||
tmpCost = tmpCost.trim();
|
|
||||||
if (tmpCost.length() == 0)
|
|
||||||
tapOnlyCost = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
final String manaCost = tmpCost;
|
|
||||||
|
|
||||||
String tempDesc = new String();
|
|
||||||
tempDesc = "Target creature gains " + keyword + " until end of turn.";
|
|
||||||
final String Desc = tempDesc;
|
|
||||||
|
|
||||||
if (! tapCost)
|
|
||||||
{
|
|
||||||
final SpellAbility ability = new Ability_Activated(card, manaCost)
|
|
||||||
{
|
|
||||||
|
|
||||||
private static final long serialVersionUID = -1118592153328758083L;
|
|
||||||
|
|
||||||
public boolean canPlayAI()
|
|
||||||
{
|
|
||||||
//if(CardFactoryUtil.AI_doesCreatureAttack(card))
|
|
||||||
// return false;
|
|
||||||
CardList list = getCreature();
|
|
||||||
if (list.isEmpty())
|
|
||||||
return false;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Random r = new Random();
|
|
||||||
if (r.nextFloat() <= Math.pow(.6667, card.getAbilityUsed()))
|
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public boolean canPlay()
|
|
||||||
{
|
|
||||||
|
|
||||||
if (CardFactoryUtil.canUseAbility(card) && AllZone.GameAction.isCardInPlay(card)&&
|
|
||||||
!card.isFaceDown())
|
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
public void chooseTargetAI()
|
|
||||||
{
|
|
||||||
Card target = CardFactoryUtil.AI_getBestCreature(getCreature());
|
|
||||||
setTargetCard(target);
|
|
||||||
}
|
|
||||||
CardList getCreature()
|
|
||||||
{
|
|
||||||
CardList list = new CardList(AllZone.Computer_Play.getCards());
|
|
||||||
list = list.filter(new CardListFilter()
|
|
||||||
{
|
|
||||||
public boolean addCard(Card c)
|
|
||||||
{
|
|
||||||
return c.isCreature() &&
|
|
||||||
(!CardFactoryUtil.AI_doesCreatureAttack(c)) && CardFactoryUtil.canTarget(card, c) &&
|
|
||||||
(! c.getKeyword().contains(keyword)) &&
|
|
||||||
(! c.getKeyword().contains("Defender")) &&
|
|
||||||
(! c.hasSickness() && keyword.equals("Haste"));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
// list.remove(card); // if mana-only cost, allow self-target
|
|
||||||
return list;
|
|
||||||
}//getCreature()
|
|
||||||
public void resolve()
|
|
||||||
{
|
|
||||||
if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()) )
|
|
||||||
{
|
|
||||||
final Card[] creature = new Card[1];
|
|
||||||
final Command EOT = new Command()
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = -8840812331316327448L;
|
|
||||||
|
|
||||||
public void execute()
|
|
||||||
{
|
|
||||||
if(AllZone.GameAction.isCardInPlay(creature[0]))
|
|
||||||
creature[0].removeExtrinsicKeyword(keyword);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
creature[0] = getTargetCard();
|
|
||||||
creature[0].addExtrinsicKeyword(keyword);
|
|
||||||
card.setAbilityUsed(card.getAbilityUsed()+1);
|
|
||||||
AllZone.EndOfTurn.addUntil(EOT);
|
|
||||||
}//if (card is in play)
|
|
||||||
}//resolve()
|
|
||||||
};//SpellAbility
|
|
||||||
|
|
||||||
ability.setDescription(manaCost + ": " + Desc);
|
|
||||||
ability.setStackDescription(Desc);
|
|
||||||
|
|
||||||
ability.setBeforePayMana(CardFactoryUtil.input_targetCreature(ability));
|
|
||||||
card.addSpellAbility(ability);
|
|
||||||
}
|
|
||||||
if (tapOnlyCost)
|
|
||||||
{
|
|
||||||
final SpellAbility ability = new Ability_Tap(card)
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 5252594757468128739L;
|
|
||||||
|
|
||||||
public boolean canPlayAI()
|
|
||||||
{
|
|
||||||
if(CardFactoryUtil.AI_doesCreatureAttack(card))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return getCreature().size() != 0;
|
|
||||||
}
|
|
||||||
public boolean canPlay()
|
|
||||||
{
|
|
||||||
boolean sick = true;
|
|
||||||
|
|
||||||
if (!card.hasSickness() || !card.isCreature())
|
|
||||||
sick = false;
|
|
||||||
|
|
||||||
if (card.isUntapped() && CardFactoryUtil.canUseAbility(card) && AllZone.GameAction.isCardInPlay(card)
|
|
||||||
&& !sick && !card.isFaceDown())
|
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
public void chooseTargetAI()
|
|
||||||
{
|
|
||||||
card.tap();
|
|
||||||
Card target = CardFactoryUtil.AI_getBestCreature(getCreature());
|
|
||||||
setTargetCard(target);
|
|
||||||
}
|
|
||||||
CardList getCreature()
|
|
||||||
{
|
|
||||||
CardList list = new CardList(AllZone.Computer_Play.getCards());
|
|
||||||
list = list.filter(new CardListFilter()
|
|
||||||
{
|
|
||||||
public boolean addCard(Card c)
|
|
||||||
{
|
|
||||||
return c.isCreature() &&
|
|
||||||
(!CardFactoryUtil.AI_doesCreatureAttack(c)) &&
|
|
||||||
(! c.getKeyword().contains(keyword)) &&
|
|
||||||
(! c.getKeyword().contains("Defender")) &&
|
|
||||||
(! c.hasSickness() && keyword.equals("Haste"));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
list.remove(card);
|
|
||||||
return list;
|
|
||||||
}//getCreature()
|
|
||||||
public void resolve()
|
|
||||||
{
|
|
||||||
if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()))
|
|
||||||
{
|
|
||||||
final Card[] creature = new Card[1];
|
|
||||||
final Command EOT = new Command()
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 2134353417588894452L;
|
|
||||||
|
|
||||||
public void execute()
|
|
||||||
{
|
|
||||||
if(AllZone.GameAction.isCardInPlay(creature[0]))
|
|
||||||
creature[0].removeExtrinsicKeyword(keyword);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
creature[0] = getTargetCard();
|
|
||||||
creature[0].addExtrinsicKeyword(keyword);
|
|
||||||
AllZone.EndOfTurn.addUntil(EOT);
|
|
||||||
}//if (card is in play)
|
|
||||||
}//resolve()
|
|
||||||
};//SpellAbility
|
|
||||||
|
|
||||||
ability.setDescription("tap: " + Desc);
|
|
||||||
ability.setStackDescription(Desc);
|
|
||||||
|
|
||||||
ability.setBeforePayMana(CardFactoryUtil.input_targetCreature(ability));
|
|
||||||
card.addSpellAbility(ability);
|
|
||||||
}
|
|
||||||
if (! tapOnlyCost && tapCost)
|
|
||||||
{
|
|
||||||
final SpellAbility ability = new Ability_Tap(card, manaCost)
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 7593387152288440603L;
|
|
||||||
|
|
||||||
public boolean canPlayAI()
|
|
||||||
{
|
|
||||||
if(CardFactoryUtil.AI_doesCreatureAttack(card))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return getCreature().size() != 0;
|
|
||||||
}
|
|
||||||
public boolean canPlay()
|
|
||||||
{
|
|
||||||
boolean sick = true;
|
|
||||||
|
|
||||||
if (!card.hasSickness() || !card.isCreature())
|
|
||||||
sick = false;
|
|
||||||
|
|
||||||
if (card.isUntapped() && CardFactoryUtil.canUseAbility(card) && AllZone.GameAction.isCardInPlay(card) &&
|
|
||||||
!sick && !card.isFaceDown())
|
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
public void chooseTargetAI()
|
|
||||||
{
|
|
||||||
card.tap();
|
|
||||||
Card target = CardFactoryUtil.AI_getBestCreature(getCreature());
|
|
||||||
setTargetCard(target);
|
|
||||||
}
|
|
||||||
CardList getCreature()
|
|
||||||
{
|
|
||||||
CardList list = new CardList(AllZone.Computer_Play.getCards());
|
|
||||||
list = list.filter(new CardListFilter()
|
|
||||||
{
|
|
||||||
public boolean addCard(Card c)
|
|
||||||
{
|
|
||||||
return c.isCreature() &&
|
|
||||||
(!CardFactoryUtil.AI_doesCreatureAttack(c)) &&
|
|
||||||
(! c.getKeyword().contains(keyword)) &&
|
|
||||||
(! c.getKeyword().contains("Defender")) &&
|
|
||||||
(! c.hasSickness() && keyword.equals("Haste"));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
list.remove(card);
|
|
||||||
return list;
|
|
||||||
}//getCreature()
|
|
||||||
public void resolve()
|
|
||||||
{
|
|
||||||
if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card ,getTargetCard()))
|
|
||||||
{
|
|
||||||
final Card[] creature = new Card[1];
|
|
||||||
final Command EOT = new Command()
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 3532917180149273560L;
|
|
||||||
|
|
||||||
public void execute()
|
|
||||||
{
|
|
||||||
if(AllZone.GameAction.isCardInPlay(creature[0]))
|
|
||||||
creature[0].removeExtrinsicKeyword(keyword);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
creature[0] = getTargetCard();
|
|
||||||
creature[0].addExtrinsicKeyword(keyword);
|
|
||||||
AllZone.EndOfTurn.addUntil(EOT);
|
|
||||||
}//if (card is in play)
|
|
||||||
}//resolve()
|
|
||||||
};//SpellAbility
|
|
||||||
|
|
||||||
ability.setDescription(manaCost + ", tap: " + Desc);
|
|
||||||
ability.setStackDescription(Desc);
|
|
||||||
|
|
||||||
ability.setBeforePayMana(CardFactoryUtil.input_targetCreature(ability));
|
|
||||||
card.addSpellAbility(ability);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}//while
|
|
||||||
*/
|
|
||||||
|
|
||||||
//Creatures with self-regenerate abilities
|
//Creatures with self-regenerate abilities
|
||||||
//-1 means keyword "RegenerateMe" not found
|
//-1 means keyword "RegenerateMe" not found
|
||||||
while(hasKeyword(card, "RegenerateMe") != -1) {
|
while(hasKeyword(card, "RegenerateMe") != -1) {
|
||||||
@@ -1603,44 +1049,6 @@ public class CardFactory implements NewConstants {
|
|||||||
}// spDamageTgt
|
}// spDamageTgt
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
//Spell damage cards CP means Computer and Player (like shock, Lightning Bolt)
|
|
||||||
if (hasKeyword(card, "spDamageCP") != -1)
|
|
||||||
{
|
|
||||||
int n = hasKeyword(card, "spDamageCP");
|
|
||||||
if (n != -1)
|
|
||||||
{
|
|
||||||
String parse = card.getKeyword().get(n).toString();
|
|
||||||
//System.out.println("parse: " + parse);
|
|
||||||
card.removeIntrinsicKeyword(parse);
|
|
||||||
|
|
||||||
card.clearSpellAbility();
|
|
||||||
|
|
||||||
String k[] = parse.split(":");
|
|
||||||
final String dmg = k[1];
|
|
||||||
|
|
||||||
card.addSpellAbility(CardFactoryUtil.spellability_spDamageCP(card, dmg));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hasKeyword(card, "spDamageP") != -1)
|
|
||||||
{
|
|
||||||
int n = hasKeyword(card, "spDamageP");
|
|
||||||
if (n != -1)
|
|
||||||
{
|
|
||||||
String parse = card.getKeyword().get(n).toString();
|
|
||||||
card.removePrevIntrinsicKeyword(parse);
|
|
||||||
|
|
||||||
card.clearSpellAbility();
|
|
||||||
|
|
||||||
String k[] = parse.split(":");
|
|
||||||
final String dmg = k[1];
|
|
||||||
|
|
||||||
card.addSpellAbility(CardFactoryUtil.spellability_spDamageP(card, dmg));
|
|
||||||
}
|
|
||||||
}//SpDamageP
|
|
||||||
*/
|
|
||||||
|
|
||||||
while(hasKeyword(card, "abDamageTgt") != -1) {
|
while(hasKeyword(card, "abDamageTgt") != -1) {
|
||||||
int n = hasKeyword(card, "abDamageTgt");
|
int n = hasKeyword(card, "abDamageTgt");
|
||||||
if(n != -1) {
|
if(n != -1) {
|
||||||
@@ -2185,270 +1593,6 @@ public class CardFactory implements NewConstants {
|
|||||||
}//AbDamageCP
|
}//AbDamageCP
|
||||||
|
|
||||||
|
|
||||||
/* while (hasKeyword(card, "abTgtPTPump") != -1)
|
|
||||||
{
|
|
||||||
int n = hasKeyword(card, "abTgtPTPump");
|
|
||||||
if (n != -1)
|
|
||||||
{
|
|
||||||
String parse = card.getKeyword().get(n).toString();
|
|
||||||
card.removeIntrinsicKeyword(parse);
|
|
||||||
|
|
||||||
String k[] = parse.split(":");
|
|
||||||
String pt[] = k[1].split("/");
|
|
||||||
|
|
||||||
final int attack[] = new int[1];
|
|
||||||
final int defense[] = new int[1];
|
|
||||||
|
|
||||||
attack[0] = Integer.parseInt(pt[0].replace("+", ""));
|
|
||||||
defense[0] = Integer.parseInt(pt[1].replace("+", ""));
|
|
||||||
|
|
||||||
String tmpCost = k[0].substring(11);
|
|
||||||
boolean tapCost = false;
|
|
||||||
boolean tapOnlyCost = false;
|
|
||||||
|
|
||||||
if (tmpCost.contains("T"))
|
|
||||||
{
|
|
||||||
tapCost = true;
|
|
||||||
tmpCost = tmpCost.replace("T", "");
|
|
||||||
tmpCost = tmpCost.trim();
|
|
||||||
if (tmpCost.length() == 0)
|
|
||||||
tapOnlyCost = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
final String manaCost = tmpCost;
|
|
||||||
//System.out.println("manaCost is " + manaCost + " for " + card.getName());
|
|
||||||
|
|
||||||
String tmpDesc = "";
|
|
||||||
tmpDesc = "Target creature gets ";
|
|
||||||
if (attack[0] > 0)
|
|
||||||
tmpDesc = tmpDesc + "+" + attack[0];
|
|
||||||
else
|
|
||||||
tmpDesc = tmpDesc + attack[0];
|
|
||||||
tmpDesc = tmpDesc + "/";
|
|
||||||
if (defense[0] > 0)
|
|
||||||
tmpDesc = tmpDesc + "+" + defense[0];
|
|
||||||
else
|
|
||||||
tmpDesc = tmpDesc + defense[0];
|
|
||||||
tmpDesc = tmpDesc + " until end of turn.";
|
|
||||||
final String Desc = tmpDesc;
|
|
||||||
|
|
||||||
if (!tapCost)
|
|
||||||
{
|
|
||||||
final SpellAbility ability = new Ability_Activated(card, manaCost)
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = -845173064437485113L;
|
|
||||||
|
|
||||||
public boolean canPlay()
|
|
||||||
{
|
|
||||||
if (CardFactoryUtil.canUseAbility(card) && AllZone.GameAction.isCardInPlay(card) &&
|
|
||||||
!card.isFaceDown())
|
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
public boolean canPlayAI()
|
|
||||||
{
|
|
||||||
CardList list = getAttackers();
|
|
||||||
if (list.isEmpty())
|
|
||||||
return false;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (list.get(0).getNetDefense() + defense[0] < 1)
|
|
||||||
return false;
|
|
||||||
Random r = new Random();
|
|
||||||
if (r.nextFloat() <= Math.pow(.6667, card.getAbilityUsed()))
|
|
||||||
{
|
|
||||||
setTargetCard(list.get(0));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}//canPlayAI
|
|
||||||
public CardList getAttackers()
|
|
||||||
{
|
|
||||||
Card[] c = ComputerUtil.getAttackers().getAttackers();
|
|
||||||
CardList list = new CardList(c);
|
|
||||||
|
|
||||||
return list;
|
|
||||||
}//getAttacker
|
|
||||||
public void resolve()
|
|
||||||
{
|
|
||||||
if (AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()))
|
|
||||||
{
|
|
||||||
final Card[] creature = new Card[1];
|
|
||||||
|
|
||||||
creature[0] = getTargetCard();
|
|
||||||
creature[0].addTempAttackBoost(attack[0]);
|
|
||||||
creature[0].addTempDefenseBoost(defense[0]);
|
|
||||||
|
|
||||||
card.setAbilityUsed(card.getAbilityUsed()+1);
|
|
||||||
|
|
||||||
final Command EOT = new Command()
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 122944434978198700L;
|
|
||||||
|
|
||||||
public void execute()
|
|
||||||
{
|
|
||||||
if (AllZone.GameAction.isCardInPlay(creature[0]))
|
|
||||||
{
|
|
||||||
creature[0].addTempAttackBoost(-attack[0]);
|
|
||||||
creature[0].addTempDefenseBoost(-defense[0]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};//EOT
|
|
||||||
AllZone.EndOfTurn.addUntil(EOT);
|
|
||||||
}
|
|
||||||
}//resolve
|
|
||||||
};//ability
|
|
||||||
ability.setDescription(manaCost+": "+Desc);
|
|
||||||
ability.setStackDescription(Desc);
|
|
||||||
ability.setBeforePayMana(CardFactoryUtil.input_targetCreature(ability));
|
|
||||||
card.addSpellAbility(ability);
|
|
||||||
}//!tapCost
|
|
||||||
|
|
||||||
if (tapOnlyCost)
|
|
||||||
{
|
|
||||||
final SpellAbility ability = new Ability_Tap(card)
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 6723777240105966031L;
|
|
||||||
|
|
||||||
public boolean canPlay()
|
|
||||||
{
|
|
||||||
boolean sick = true;
|
|
||||||
if (!card.hasSickness() || !card.isCreature())
|
|
||||||
sick = false;
|
|
||||||
if (card.isUntapped() && CardFactoryUtil.canUseAbility(card) &&
|
|
||||||
AllZone.GameAction.isCardInPlay(card) && !sick && !card.isFaceDown())
|
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}//canPlay
|
|
||||||
public boolean canPlayAI()
|
|
||||||
{
|
|
||||||
CardList list = getAttackers();
|
|
||||||
if (list.isEmpty())
|
|
||||||
return false;
|
|
||||||
else
|
|
||||||
if (list.get(0).getNetDefense() + defense[0] < 1)
|
|
||||||
return false;
|
|
||||||
if (CardFactoryUtil.AI_doesCreatureAttack(card))
|
|
||||||
return false;
|
|
||||||
setTargetCard(list.get(0));
|
|
||||||
return true;
|
|
||||||
}//canPlayAI
|
|
||||||
public CardList getAttackers()
|
|
||||||
{
|
|
||||||
Card[] c = ComputerUtil.getAttackers().getAttackers();
|
|
||||||
CardList list = new CardList(c);
|
|
||||||
list.remove(card);
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
public void resolve()
|
|
||||||
{
|
|
||||||
if (AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()))
|
|
||||||
{
|
|
||||||
final Card[] creature = new Card[1];
|
|
||||||
|
|
||||||
creature[0] = getTargetCard();
|
|
||||||
creature[0].addTempAttackBoost(attack[0]);
|
|
||||||
creature[0].addTempDefenseBoost(defense[0]);
|
|
||||||
|
|
||||||
final Command EOT = new Command()
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = -852905560563053752L;
|
|
||||||
|
|
||||||
public void execute()
|
|
||||||
{
|
|
||||||
if (AllZone.GameAction.isCardInPlay(creature[0]))
|
|
||||||
{
|
|
||||||
creature[0].addTempAttackBoost(-attack[0]);
|
|
||||||
creature[0].addTempDefenseBoost(-defense[0]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};//EOT
|
|
||||||
AllZone.EndOfTurn.addUntil(EOT);
|
|
||||||
}
|
|
||||||
}//resolve
|
|
||||||
};//ability
|
|
||||||
ability.setDescription("tap: "+Desc);
|
|
||||||
ability.setStackDescription(Desc);
|
|
||||||
ability.setBeforePayMana(CardFactoryUtil.input_targetCreature_NoCost_TapAbility((Ability_Tap)ability));
|
|
||||||
card.addSpellAbility(ability);
|
|
||||||
}//tapOnlyCost
|
|
||||||
|
|
||||||
if (!tapOnlyCost && tapCost)
|
|
||||||
{
|
|
||||||
final SpellAbility ability = new Ability_Tap(card, manaCost)
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 2749576299299014851L;
|
|
||||||
|
|
||||||
public boolean canPlay()
|
|
||||||
{
|
|
||||||
boolean sick = true;
|
|
||||||
if (!card.hasSickness() || !card.isCreature())
|
|
||||||
sick = false;
|
|
||||||
if (card.isUntapped() && CardFactoryUtil.canUseAbility(card) &&
|
|
||||||
AllZone.GameAction.isCardInPlay(card) && !sick && !card.isFaceDown())
|
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}//canPlay
|
|
||||||
public boolean canPlayAI()
|
|
||||||
{
|
|
||||||
CardList list = getAttackers();
|
|
||||||
if (list.isEmpty())
|
|
||||||
return false;
|
|
||||||
else
|
|
||||||
if (list.get(0).getNetDefense() + defense[0] < 1)
|
|
||||||
return false;
|
|
||||||
if (CardFactoryUtil.AI_doesCreatureAttack(card))
|
|
||||||
return false;
|
|
||||||
setTargetCard(list.get(0));
|
|
||||||
return true;
|
|
||||||
}//canPlayAI
|
|
||||||
public CardList getAttackers()
|
|
||||||
{
|
|
||||||
Card[] c = ComputerUtil.getAttackers().getAttackers();
|
|
||||||
CardList list = new CardList(c);
|
|
||||||
list.remove(card);
|
|
||||||
return list;
|
|
||||||
}//getAttackers
|
|
||||||
public void resolve()
|
|
||||||
{
|
|
||||||
if (AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()))
|
|
||||||
{
|
|
||||||
final Card[] creature = new Card[1];
|
|
||||||
|
|
||||||
creature[0] = getTargetCard();
|
|
||||||
creature[0].addTempAttackBoost(attack[0]);
|
|
||||||
creature[0].addTempDefenseBoost(defense[0]);
|
|
||||||
|
|
||||||
final Command EOT = new Command()
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 8179097336678296338L;
|
|
||||||
|
|
||||||
public void execute()
|
|
||||||
{
|
|
||||||
if (AllZone.GameAction.isCardInPlay(creature[0]))
|
|
||||||
{
|
|
||||||
creature[0].addTempAttackBoost(-attack[0]);
|
|
||||||
creature[0].addTempDefenseBoost(-defense[0]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};//EOT
|
|
||||||
AllZone.EndOfTurn.addUntil(EOT);
|
|
||||||
}
|
|
||||||
}//resolve
|
|
||||||
};//ability
|
|
||||||
ability.setDescription(manaCost+ ", tap: "+Desc);
|
|
||||||
ability.setStackDescription(Desc);
|
|
||||||
ability.setBeforePayMana(CardFactoryUtil.input_targetCreature(ability));
|
|
||||||
card.addSpellAbility(ability);
|
|
||||||
}//!tapCost
|
|
||||||
}
|
|
||||||
}//while
|
|
||||||
*/
|
|
||||||
// Generic destroy target card
|
// Generic destroy target card
|
||||||
if(hasKeyword(card, "spDestroyTgt") != -1) {
|
if(hasKeyword(card, "spDestroyTgt") != -1) {
|
||||||
int n = hasKeyword(card, "spDestroyTgt");
|
int n = hasKeyword(card, "spDestroyTgt");
|
||||||
|
|||||||
Reference in New Issue
Block a user