mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
- Convert Kaervek's Spite to script (we should probably add code in LoseLife to handle this card if we expect the AI to use it)
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
Name:Kaervek's Spite
|
||||
ManaCost:B B B
|
||||
Types:Instant
|
||||
Text:As an additional cost to cast Kaervek's Spite, sacrifice all permanents you control and discard your hand. Target player loses 5 life.
|
||||
Text:no text
|
||||
A:SP$LoseLife | Cost$ B B B Sac<All/Permanent.YouCtrl> Discard<0/Hand> | ValidTgts$ Player | LifeAmount$ 5 | SpellDescription$ As an additional cost to cast Kaervek's Spite, sacrifice all permanents you control and discard your hand. Target player loses 5 life.
|
||||
SVar:RemRandomDeck:True
|
||||
SVar:Rarity:Rare
|
||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/kaerveks_spite.jpg
|
||||
|
||||
@@ -1723,47 +1723,6 @@ public class CardFactory implements NewConstants {
|
||||
}//*************** END ************ END **************************
|
||||
|
||||
|
||||
//*************** START *********** START **************************
|
||||
else if(cardName.equals("Kaervek's Spite")) {
|
||||
final SpellAbility spell = new Spell(card) {
|
||||
private static final long serialVersionUID = -6259614160639535500L;
|
||||
|
||||
@Override
|
||||
public boolean canPlayAI() {
|
||||
if(AllZone.HumanPlayer.getLife() <= 5) return true;
|
||||
|
||||
CardList playList = AllZoneUtil.getPlayerCardsInPlay(AllZone.ComputerPlayer);
|
||||
CardList libList = AllZoneUtil.getPlayerCardsInLibrary(AllZone.ComputerPlayer);
|
||||
|
||||
playList = playList.getName("Academy Rector");
|
||||
libList = libList.getName("Barren Glory");
|
||||
|
||||
return (AllZone.HumanPlayer.getLife() <= 5) || (playList.size() == 1 && libList.size() >= 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resolve() {
|
||||
CardList play = AllZoneUtil.getPlayerCardsInPlay(card.getController());
|
||||
|
||||
for(Card c:play) {
|
||||
AllZone.GameAction.sacrifice(c);
|
||||
}
|
||||
card.getController().discardHand(this);
|
||||
|
||||
getTargetPlayer().loseLife(5, card);
|
||||
}
|
||||
};
|
||||
|
||||
spell.setChooseTargetAI(CardFactoryUtil.AI_targetHuman());
|
||||
|
||||
// Do not remove SpellAbilities created by AbilityFactory or Keywords.
|
||||
card.clearFirstSpellAbility();
|
||||
card.addSpellAbility(spell);
|
||||
|
||||
spell.setBeforePayMana(CardFactoryUtil.input_targetPlayer(spell));
|
||||
}//*************** END ************ END **************************
|
||||
|
||||
|
||||
//*************** START *********** START **************************
|
||||
else if(cardName.equals("Goblin Charbelcher")) {
|
||||
Cost abCost = new Cost("3 T", cardName, true);
|
||||
|
||||
@@ -932,7 +932,8 @@ class CardFactory_Auras {
|
||||
|
||||
prevController[0] = c.getController();
|
||||
AllZone.GameAction.moveToPlay(card);
|
||||
c.attachCard(card);
|
||||
card.enchantCard(c);
|
||||
//c.attachCard(card);
|
||||
AllZone.GameAction.changeController(new CardList(c), c.getController(), card.getController());
|
||||
if(cardName.equals("Volition Reins")) {
|
||||
if(c.isTapped()) c.untap();
|
||||
|
||||
@@ -1249,92 +1249,6 @@ public class CardFactory_Instants {
|
||||
card.addSpellAbility(spell);
|
||||
}//*************** END ************ END **************************
|
||||
|
||||
/*
|
||||
//*************** START ********** START *************************
|
||||
else if(cardName.equals("Mana Drain"))//NOTE: The AI can't cast this spell due to inability to use a manapool, but provisions are still made for it for if/when we get to that point.
|
||||
{
|
||||
SpellAbility spell = new Spell(card) {
|
||||
private static final long serialVersionUID = 6139754377230333678L;
|
||||
|
||||
@Override
|
||||
public void resolve() {
|
||||
SpellAbility sa = AllZone.Stack.pop();
|
||||
|
||||
if(card.getController().isHuman())
|
||||
{
|
||||
Phase.getManaDrain_BonusMana_Human().add(CardUtil.getConvertedManaCost(sa.getSourceCard()));
|
||||
Phase.getManaDrain_Source_Human().add(card);
|
||||
}
|
||||
else if(card.getController().isComputer())
|
||||
{
|
||||
Phase.getManaDrain_BonusMana_AI().add(CardUtil.getConvertedManaCost(sa.getSourceCard()));
|
||||
Phase.getManaDrain_Source_AI().add(card);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlayAI()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlay() {
|
||||
if(AllZone.Stack.size() != 0)
|
||||
{
|
||||
return AllZone.Stack.peek().isSpell();
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Do not remove SpellAbilities created by AbilityFactory or Keywords.
|
||||
card.clearFirstSpellAbility();
|
||||
card.addSpellAbility(spell);
|
||||
}//*************** END ************ END **************************
|
||||
*/
|
||||
|
||||
//*************** START *********** START **************************
|
||||
else if(cardName.equals("Kaervek's Spite")) {
|
||||
final SpellAbility spell = new Spell(card) {
|
||||
private static final long serialVersionUID = -6259614160639535500L;
|
||||
|
||||
@Override
|
||||
public boolean canPlayAI() {
|
||||
if(AllZone.HumanPlayer.getLife() <= 5) return true;
|
||||
|
||||
CardList playList = AllZoneUtil.getPlayerCardsInPlay(AllZone.ComputerPlayer);
|
||||
CardList libList = AllZoneUtil.getPlayerCardsInLibrary(AllZone.ComputerPlayer);
|
||||
|
||||
playList = playList.getName("Academy Rector");
|
||||
libList = libList.getName("Barren Glory");
|
||||
|
||||
return playList.size() == 1 && libList.size() >= 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resolve() {
|
||||
CardList list = AllZoneUtil.getPlayerCardsInPlay(card.getController());
|
||||
for(Card c:list) {
|
||||
AllZone.GameAction.sacrifice(c);
|
||||
}
|
||||
card.getController().discardHand(this);
|
||||
|
||||
getTargetPlayer().loseLife(5, card);
|
||||
}
|
||||
};
|
||||
|
||||
spell.setChooseTargetAI(CardFactoryUtil.AI_targetHuman());
|
||||
|
||||
// Do not remove SpellAbilities created by AbilityFactory or Keywords.
|
||||
card.clearFirstSpellAbility();
|
||||
card.addSpellAbility(spell);
|
||||
spell.setBeforePayMana(CardFactoryUtil.input_targetPlayer(spell));
|
||||
}//*************** END ************ END **************************
|
||||
|
||||
|
||||
//*************** START *********** START **************************
|
||||
else if( cardName.equals("Siren's Call") ) {
|
||||
@@ -1489,7 +1403,6 @@ public class CardFactory_Instants {
|
||||
|
||||
String phase = AllZone.Phase.buildActivateString(Constant.Phase.Upkeep, Constant.Phase.Combat_Declare_Blockers_InstantAbility);
|
||||
spell.getRestrictions().setActivatePhases(phase);
|
||||
spell.setBeforePayMana(CardFactoryUtil.input_targetCreature(spell));
|
||||
}//*************** END ************ END **************************
|
||||
|
||||
|
||||
|
||||
@@ -20,6 +20,8 @@ public class Cost {
|
||||
public int getSacAmount() { return sacAmount; }
|
||||
private boolean sacX = false;
|
||||
public boolean isSacX() { return sacX; }
|
||||
private boolean sacAll = false;
|
||||
public boolean isSacAll() { return sacAll; }
|
||||
|
||||
private boolean exileCost = false;
|
||||
public boolean getExileCost() { return exileCost; }
|
||||
@@ -206,6 +208,7 @@ public class Cost {
|
||||
parse = abUpdateParse(parse, sacStr);
|
||||
|
||||
if(splitStr[0].equals("X")) sacX = true;
|
||||
else if(splitStr[0].equals("All")) sacAll = true;
|
||||
else sacAmount = Integer.parseInt(splitStr[0]);
|
||||
sacType = splitStr[1];
|
||||
sacThis = (sacType.equals("CARDNAME"));
|
||||
|
||||
@@ -165,7 +165,10 @@ public class Cost_Payment {
|
||||
CardList typeList = new CardList(play.getCards());
|
||||
|
||||
typeList = typeList.getValidCards(cost.getSacType().split(";"),ability.getActivatingPlayer() ,ability.getSourceCard());
|
||||
if (typeList.size() < cost.getSacAmount())
|
||||
|
||||
int amount = cost.isSacAll() ? typeList.size() : cost.getSacAmount();
|
||||
|
||||
if (typeList.size() < amount)
|
||||
return false;
|
||||
}
|
||||
else if (!AllZoneUtil.isCardInPlay(card))
|
||||
@@ -375,7 +378,10 @@ public class Cost_Payment {
|
||||
if (!paySac && cost.getSacCost()){ // sacrifice stuff here
|
||||
if (cost.getSacThis())
|
||||
setInput(sacrificeThis(ability, this));
|
||||
else if(cost.isSacX()) setInput(sacrificeXType(ability, cost.getSacType(), this));
|
||||
else if (cost.isSacAll())
|
||||
sacrificeAllType(ability, cost.getSacType(), this);
|
||||
else if (cost.isSacX())
|
||||
setInput(sacrificeXType(ability, cost.getSacType(), this));
|
||||
else
|
||||
setInput(sacrificeType(ability, cost.getSacType(), this));
|
||||
return false;
|
||||
@@ -499,13 +505,19 @@ public class Cost_Payment {
|
||||
|
||||
// double check if something can be sacrificed here. Real check is in ComputerUtil.canPayAdditionalCosts()
|
||||
if (cost.getSacCost()){
|
||||
int amount = cost.getSacAmount();
|
||||
if (cost.getSacThis())
|
||||
sacCard.add(card);
|
||||
else if (cost.isSacAll()){
|
||||
CardList typeList = AllZoneUtil.getPlayerCardsInPlay(AllZone.ComputerPlayer);
|
||||
typeList = typeList.getValidCards(cost.getSacType().split(","), card.getController(), card);
|
||||
sacCard.add(typeList);
|
||||
amount = sacCard.size();
|
||||
}
|
||||
else
|
||||
sacCard = ComputerUtil.chooseSacrificeType(cost.getSacType(), card, ability.getTargetCard(), cost.getSacAmount());
|
||||
|
||||
|
||||
if (sacCard.size() != cost.getSacAmount()){
|
||||
if (sacCard.size() != amount){
|
||||
System.out.println("Couldn't find a valid card to sacrifice for: "+card.getName());
|
||||
return;
|
||||
}
|
||||
@@ -1023,6 +1035,22 @@ public class Cost_Payment {
|
||||
return target;
|
||||
}//sacrificeType()
|
||||
|
||||
public static void sacrificeAllType(final SpellAbility sa, final String type, final Cost_Payment payment){
|
||||
// TODO Ask First
|
||||
|
||||
CardList typeList;
|
||||
typeList = AllZoneUtil.getPlayerCardsInPlay(sa.getActivatingPlayer());
|
||||
typeList = typeList.getValidCards(type.split(";"), sa.getActivatingPlayer(), sa.getSourceCard());
|
||||
|
||||
for(Card card : typeList){
|
||||
payment.getAbility().addSacrificedCost(card);
|
||||
AllZone.GameAction.sacrifice(card);
|
||||
}
|
||||
|
||||
payment.setPaySac(true);
|
||||
payment.payCost();
|
||||
}
|
||||
|
||||
public static Input sacrificeXType(final SpellAbility sa, final String type, final Cost_Payment payment){
|
||||
Input target = new Input() {
|
||||
private static final long serialVersionUID = -4496270321029213839L;
|
||||
|
||||
Reference in New Issue
Block a user