- Added Vendillion Clique, Umezawa's Jitte.

- Duress, Ostracize, Distress and Thoughtseize will now first reveal the entire hand, then reveal the narrowed down options to discard.
This commit is contained in:
jendave
2011-08-06 02:50:05 +00:00
parent 3a455649c6
commit b0d660a6bb
9 changed files with 619 additions and 9 deletions

View File

@@ -7619,8 +7619,12 @@ public class CardFactory implements NewConstants {
//check for no cards in hand on resolve
PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, getTargetPlayer());
CardList fullHand = new CardList(hand.getCards());
Card[] handChoices = removeLand(hand.getCards());
if (fullHand.size() > 0 && card.getController().equals(Constant.Player.Human))
AllZone.Display.getChoice("Revealing hand", fullHand.toArray());
if(handChoices.length == 0)
return;
@@ -12951,6 +12955,7 @@ public class CardFactory implements NewConstants {
//human chooses
if(card.getController().equals(Constant.Player.Human))
{
AllZone.Display.getChoice("Revealing hand", cards.toArray());
choice = (Card) AllZone.Display.getChoice("Choose", nonCreatureCards.toArray());
}
else//computer chooses
@@ -13012,7 +13017,7 @@ public class CardFactory implements NewConstants {
{
if(cards.get(i).getType().contains("Creature"))
{
System.out.println("ostracize: " + cards.get(i).getType());
//System.out.println("ostracize: " + cards.get(i).getType());
creatureCards.add(cards.get(i));
}
@@ -13024,6 +13029,7 @@ public class CardFactory implements NewConstants {
//human chooses
if(card.getController().equals(Constant.Player.Human))
{
AllZone.Display.getChoice("Revealing hand", cards.toArray());
choice = (Card) AllZone.Display.getChoice("Choose", creatureCards.toArray());
}
else//computer chooses

View File

@@ -1880,6 +1880,26 @@ public class CardFactoryUtil
return list.size();
}
//returns the number of equipments named "e" card c is equipped by
public static int hasNumberEquipments(Card c, String e)
{
if (!c.isEquipped())
return 0;
final String equipmentName = e;
CardList list = new CardList(c.getEquippedBy().toArray());
list = list.filter(new CardListFilter()
{
public boolean addCard(Card c) {
return c.getName().equals(equipmentName);
}
});
return list.size();
}
/*public static CardList getValuableCreatures()
{

View File

@@ -16075,9 +16075,267 @@ public class CardFactory_Creatures {
};
card.addDestroyCommand(destroy);
}
}//*************** END ************ END **************************
//*************** START *********** START **************************
else if(cardName.equals("Boggart Harbinger"))
{
final SpellAbility ability = new Ability(card, "0")
{
public void resolve()
{
PlayerZone lib = AllZone.getZone(Constant.Zone.Library, card.getController());
if(AllZone.GameAction.isCardInZone(getTargetCard(), lib))
{
Card c = getTargetCard();
AllZone.GameAction.shuffle(card.getController());
lib.remove(c);
lib.add(c, 0);
}
}//resolve()
};
Command intoPlay = new Command()
{
private static final long serialVersionUID = 4022442363194287539L;
public void execute()
{
PlayerZone lib = AllZone.getZone(Constant.Zone.Library, card.getController());
CardList cards = new CardList(lib.getCards());
CardList goblins = new CardList();
for (int i=0;i<cards.size();i++)
{
if(cards.get(i).getType().contains("Goblin") || cards.get(i).getKeyword().contains("Changeling"))
{
goblins.add(cards.get(i));
}
}
String controller = card.getController();
if(goblins.size() == 0)
return;
if(controller.equals(Constant.Player.Human))
{
Object o = AllZone.Display.getChoiceOptional("Select target card", goblins.toArray());
if(o != null)
{
ability.setTargetCard((Card)o);
AllZone.Stack.add(ability);
}
}
else //computer
{
goblins.shuffle();
ability.setTargetCard(goblins.get(0));
AllZone.Stack.add(ability);
}
}//execute()
};//Command
card.addComesIntoPlayCommand(intoPlay);
}//*************** END ************ END **************************
//*************** START *********** START **************************
else if(cardName.equals("Merfolk Harbinger"))
{
final SpellAbility ability = new Ability(card, "0")
{
public void resolve()
{
PlayerZone lib = AllZone.getZone(Constant.Zone.Library, card.getController());
if(AllZone.GameAction.isCardInZone(getTargetCard(), lib))
{
Card c = getTargetCard();
AllZone.GameAction.shuffle(card.getController());
lib.remove(c);
lib.add(c, 0);
}
}//resolve()
};
Command intoPlay = new Command()
{
private static final long serialVersionUID = 4022442363194287539L;
public void execute()
{
PlayerZone lib = AllZone.getZone(Constant.Zone.Library, card.getController());
CardList cards = new CardList(lib.getCards());
CardList merfolk = new CardList();
for (int i=0;i<cards.size();i++)
{
if(cards.get(i).getType().contains("Merfolk") || cards.get(i).getKeyword().contains("Changeling"))
{
merfolk.add(cards.get(i));
}
}
String controller = card.getController();
if(merfolk.size() == 0)
return;
if(controller.equals(Constant.Player.Human))
{
Object o = AllZone.Display.getChoiceOptional("Select target card", merfolk.toArray());
if(o != null)
{
ability.setTargetCard((Card)o);
AllZone.Stack.add(ability);
}
}
else //computer
{
merfolk.shuffle();
ability.setTargetCard(merfolk.get(0));
AllZone.Stack.add(ability);
}
}//execute()
};//Command
card.addComesIntoPlayCommand(intoPlay);
}//*************** END ************ END **************************
//*************** START *********** START **************************
else if(cardName.equals("Elvish Harbinger"))
{
final SpellAbility ability = new Ability(card, "0")
{
public void resolve()
{
PlayerZone lib = AllZone.getZone(Constant.Zone.Library, card.getController());
if(AllZone.GameAction.isCardInZone(getTargetCard(), lib))
{
Card c = getTargetCard();
AllZone.GameAction.shuffle(card.getController());
lib.remove(c);
lib.add(c, 0);
}
}//resolve()
};
Command intoPlay = new Command()
{
private static final long serialVersionUID = 4022442363194287539L;
public void execute()
{
PlayerZone lib = AllZone.getZone(Constant.Zone.Library, card.getController());
CardList cards = new CardList(lib.getCards());
CardList elves = new CardList();
for (int i=0;i<cards.size();i++)
{
if(cards.get(i).getType().contains("Elf") || cards.get(i).getKeyword().contains("Changeling"))
{
elves.add(cards.get(i));
}
}
String controller = card.getController();
if(elves.size() == 0)
return;
if(controller.equals(Constant.Player.Human))
{
Object o = AllZone.Display.getChoiceOptional("Select target card", elves.toArray());
if(o != null)
{
ability.setTargetCard((Card)o);
AllZone.Stack.add(ability);
}
}
else //computer
{
elves.shuffle();
ability.setTargetCard(elves.get(0));
AllZone.Stack.add(ability);
}
}//execute()
};//Command
card.addComesIntoPlayCommand(intoPlay);
}//*************** END ************ END **************************
//*************** START *********** START **************************
else if(cardName.equals("Vendillion Clique"))
{
final SpellAbility ability = new Ability(card, "0")
{
public void resolve()
{
String player = getTargetPlayer();
PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, player);
PlayerZone lib = AllZone.getZone(Constant.Zone.Library, player);
CardList list = new CardList(hand.getCards());
CardList nonLandList = list.filter(new CardListFilter()
{
public boolean addCard(Card c) {
return !c.isLand();
}
});
if (list.size() > 0)
{
if (card.getController().equals(Constant.Player.Human))
{
AllZone.Display.getChoiceOptional("Revealing hand", list.toArray() );
if (nonLandList.size() > 0) {
Object o = AllZone.Display.getChoiceOptional("Select target non-land card", nonLandList.toArray());
if (o!=null)
{
Card c = (Card)o;
hand.remove(c);
lib.add(c); //put on bottom
AllZone.GameAction.drawCard(player);
}
}
}
else //comp
{
if (AllZone.Phase.getTurn() > 12 && nonLandList.size() > 0)
{
Card c = CardFactoryUtil.AI_getMostExpensivePermanent(nonLandList, card, false);
hand.remove(c);
lib.add(c);
AllZone.GameAction.drawCard(Constant.Player.Human);
}
}
}//handsize > 0
}
};
Command intoPlay = new Command()
{
private static final long serialVersionUID = -5052568979553782714L;
public void execute()
{
if(card.getController().equals(Constant.Player.Human)) {
AllZone.InputControl.setInput(CardFactoryUtil.input_targetPlayer(ability));
ButtonUtil.disableAll();
}
else if (card.getController().equals(Constant.Player.Computer)) {
ability.setTargetPlayer(Constant.Player.Human);
AllZone.Stack.add(ability);
}
}//execute()
};//Command
card.addComesIntoPlayCommand(intoPlay);
}//*************** END ************ END **************************
// Cards with Cycling abilities
// -1 means keyword "Cycling" not found
if (shouldCycle(card) != -1)

View File

@@ -1347,14 +1347,15 @@ class CardFactory_Equipment {
Command onEquip = new Command()
{
private static final long serialVersionUID = 1L;
public void execute()
private static final long serialVersionUID = -4784079305541955698L;
public void execute()
{
if (card.isEquipping())
{
Card crd=card.getEquipping().get(0);
untapboost.setDescription("3, Untap:"+crd+" gets +2/+2 until end of turn");
untapboost.setDescription("3, Untap: " +crd+" gets +2/+2 until end of turn");
untapboost.setStackDescription(crd+ " - +2/+2 until EOT");
crd.addSpellAbility(untapboost);
@@ -1622,6 +1623,265 @@ class CardFactory_Equipment {
card.addEquipCommand(onEquip);
card.addUnEquipCommand(onUnEquip);
} //*************** END ************ END **************************
//*************** START *********** START **************************
else if (cardName.equals("Umezawa's Jitte"))
{
final Ability equip = new Ability(card, "2")
{
public void resolve()
{
if (AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()) )
{
if (card.isEquipping())
{
Card crd = card.getEquipping().get(0);
if (crd.equals(getTargetCard()) )
return;
card.unEquipCard(crd);
}
card.equipCard(getTargetCard());
}
}
public boolean canPlay()
{
return AllZone.getZone(card).is(Constant.Zone.Play) &&
AllZone.Phase.getActivePlayer().equals(card.getController()) &&
(AllZone.Phase.getPhase().equals("Main1") || AllZone.Phase.getPhase().equals("Main2") );
}
public boolean canPlayAI()
{
return getCreature().size() != 0 && !card.isEquipping();
}
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("Defender"));
}
});
// list.remove(card); // if mana-only cost, allow self-target
return list;
}//getCreature()
};//equip ability
Input runtime = new Input()
{
private static final long serialVersionUID = 3087795844819115833L;
public void showMessage()
{
//get all creatures you control
CardList list = new CardList();
list.addAll(AllZone.Human_Play.getCards());
list = list.getType("Creature");
stopSetNext(CardFactoryUtil.input_targetSpecific(equip, list, "Select target creature to equip", true));
}
};//Input
final Ability gainLife = new Ability(card, "0")
{
public void resolve() {
card.subtractCounter(Counters.CHARGE, 1);
String player = card.getController();
PlayerLife life = AllZone.GameAction.getPlayerLife(player);
life.addLife(2);
}
public boolean canPlay()
{
SpellAbility sa;
for (int i=0; i<AllZone.Stack.size(); i++)
{
sa = AllZone.Stack.peek(i);
if (sa.getSourceCard().equals(card))
return false;
}
return card.getCounters(Counters.CHARGE) > 0;
}
public boolean canPlayAI()
{
return AllZone.GameAction.getPlayerLife(Constant.Player.Computer).getLife() <= 4;
}
};
gainLife.setDescription("Remove a charge counter from Umezawa's Jitte: You gain 2 life.");
gainLife.setStackDescription(cardName + " - You gain 2 life.");
final Ability negBoost = new Ability(card, "0")
{
public void resolve() {
card.subtractCounter(Counters.CHARGE, 1);
final Card[] target = new Card[1];
final Command untilEOT = new Command()
{
private static final long serialVersionUID = -1615047325868708734L;
public void execute()
{
if(AllZone.GameAction.isCardInPlay(target[0]) )
{
target[0].addTempAttackBoost(1);
target[0].addTempDefenseBoost(1);
}
}
};
target[0] = getTargetCard();
if(AllZone.GameAction.isCardInPlay(target[0]) && CardFactoryUtil.canTarget(card, target[0]))
{
target[0].addTempAttackBoost(-1);
target[0].addTempDefenseBoost(-1);
AllZone.EndOfTurn.addUntil(untilEOT);
}
}
public boolean canPlay()
{
SpellAbility sa;
for (int i=0; i<AllZone.Stack.size(); i++)
{
sa = AllZone.Stack.peek(i);
if (sa.getSourceCard().equals(card))
return false;
}
return card.getCounters(Counters.CHARGE) > 0;
}
public boolean canPlayAI()
{
if (gainLife.canPlayAI())
return false;
CardList c = CardFactoryUtil.AI_getHumanCreature(1, card, true);
CardListUtil.sortAttack(c);
CardListUtil.sortFlying(c);
if(c.isEmpty())
return false;
else
{
setTargetCard(c.get(0));
return true;
}
}//canPlayAI()
};
Input target = new Input()
{
private static final long serialVersionUID = -5404464532726469761L;
public void showMessage()
{
AllZone.Display.showMessage("Select target creature for " +card.getName());
ButtonUtil.enableOnlyCancel();
}
public void selectButtonCancel() {stop();}
public void selectCard(Card card, PlayerZone zone)
{
if(!CardFactoryUtil.canTarget(negBoost, card)){
AllZone.Display.showMessage("Cannot target this card (Shroud? Protection?).");
}
else if(card.isCreature() && zone.is(Constant.Zone.Play))
{
negBoost.setTargetCard(card);
AllZone.Stack.add(negBoost);
stop();
}
}
};//Input
negBoost.setDescription("Remove a charge counter from Umezawa's Jitte: Target creature gets -1/-1 until end of turn");
negBoost.setBeforePayMana(target);
final Ability boost = new Ability(card, "0")
{
public void resolve() {
card.subtractCounter(Counters.CHARGE, 1);
final Card[] target = new Card[1];
final Command untilEOT = new Command()
{
private static final long serialVersionUID = 2751279830522020186L;
public void execute()
{
if(AllZone.GameAction.isCardInPlay(target[0]))
{
target[0].addTempAttackBoost(-2);
target[0].addTempDefenseBoost(-2);
}
}
};
target[0] = card.getEquipping().get(0);
if(AllZone.GameAction.isCardInPlay(target[0]) && CardFactoryUtil.canTarget(card, target[0]))
{
target[0].addTempAttackBoost(2);
target[0].addTempDefenseBoost(2);
AllZone.EndOfTurn.addUntil(untilEOT);
}
}
public boolean canPlay()
{
SpellAbility sa;
for (int i=0; i<AllZone.Stack.size(); i++)
{
sa = AllZone.Stack.peek(i);
if (sa.getSourceCard().equals(card))
return false;
}
return card.isEquipping() && card.getCounters(Counters.CHARGE) > 0;
}
public boolean canPlayAI()
{
if (gainLife.canPlayAI() || negBoost.canPlayAI())
return false;
if (card.isEquipping()) {
Card c = card.getEquipping().get(0);
if (CardFactoryUtil.AI_doesCreatureAttack(c))
return true;
}
return false;
}
};
boost.setDescription("Remove a charge counter from Umezawa's Jitte: Equipped creature gets +2/+2 until end of turn.");
boost.setStackDescription(cardName + " - Equipped creature gets +2/+2 untin end of turn.");
equip.setBeforePayMana(runtime);
equip.setDescription("Equip: 2");
card.addSpellAbility(equip);
card.addSpellAbility(boost);
card.addSpellAbility(negBoost);
card.addSpellAbility(gainLife);
} //*************** END ************ END **************************

View File

@@ -1799,7 +1799,15 @@ public class GameActionUtil
playerCombatDamage_Rootwater_Thief(c);
else if (c.getName().equals("Treva, the Renewer"))
playerCombatDamage_Treva(c);
/*
if(CardFactoryUtil.hasNumberEquipments(c, "Umezawa's Jitte") == 1)
{
PlayerZone play = AllZone.getZone(c);
CardList list = new CardList(play.getCards());
list = list.getName("Umezawa's Jitte");
Card jitte = list.get(0);
}
*/
if (c.getNetAttack() > 0)
c.setDealtCombatDmgToOppThisTurn(true);

View File

@@ -119,6 +119,15 @@ private void playerDamage(PlayerLife p)
for(int j=0; j < CardFactoryUtil.hasNumberEnchantments(attackers.getCard(i), "Guilty Conscience"); j++)
GameActionUtil.executeGuiltyConscienceEffects(attackers.getCard(i));
if(CardFactoryUtil.hasNumberEquipments(attackers.getCard(i), "Umezawa's Jitte") == 1 && attackers.get(i).getNetAttack() > 0)
{
PlayerZone play = AllZone.getZone(attackers.getCard(i));
CardList clist = new CardList(play.getCards());
clist = clist.getName("Umezawa's Jitte");
Card jitte = clist.get(0);
jitte.addCounter(Counters.CHARGE, 2);
}
}
//not sure if this will work correctly with multiple blockers?

View File

@@ -98,6 +98,17 @@ private void playerDamage(PlayerLife p)
for(int j=0; j < CardFactoryUtil.hasNumberEnchantments(attackers.getCard(i), "Guilty Conscience"); j++)
GameActionUtil.executeGuiltyConscienceEffects(attackers.getCard(i));
if(CardFactoryUtil.hasNumberEquipments(attackers.getCard(i), "Umezawa's Jitte") == 1 && attackers.get(i).getNetAttack() > 0)
{
PlayerZone play = AllZone.getZone(attackers.getCard(i));
CardList clist = new CardList(play.getCards());
clist = clist.getName("Umezawa's Jitte");
Card jitte = clist.get(0);
jitte.addCounter(Counters.CHARGE, 2);
}
/*
//old stuff: gain life for each instance of lifelink