- Small tweaks to tapXType cost

- Added Hand of Justice
This commit is contained in:
jendave
2011-08-06 07:23:17 +00:00
parent 65db669592
commit 6dbff19b5d
6 changed files with 99 additions and 64 deletions

1
.gitattributes vendored
View File

@@ -1579,6 +1579,7 @@ res/cardsfolder/hammerheim_deadeye.txt -text svneol=native#text/plain
res/cardsfolder/hand_of_cruelty.txt -text svneol=native#text/plain
res/cardsfolder/hand_of_death.txt -text svneol=native#text/plain
res/cardsfolder/hand_of_honor.txt -text svneol=native#text/plain
res/cardsfolder/hand_of_justice.txt -text svneol=native#text/plain
res/cardsfolder/hanna_ships_navigator.txt -text svneol=native#text/plain
res/cardsfolder/hannas_custody.txt -text svneol=native#text/plain
res/cardsfolder/harabaz_druid.txt -text svneol=native#text/plain

View File

@@ -0,0 +1,9 @@
Name:Hand of Justice
ManaCost:5 W
Types:Creature Avatar
Text:no text
PT:2/6
K:abDestroyTgtV T tapXType<3/Creature.White>:Creature:Destroy target creature.
K:SVar:Rarity:Rare
K:SVar:Picture:http://www.wizards.com/global/images/magic/general/hand_of_justice.jpg
End

View File

@@ -61,6 +61,17 @@ public class Ability_Cost {
// when adding new costs for cost string, place them here
name = cardName;
String tapXStr = "tapXType<";
if (parse.contains(tapXStr))
{
tapXTypeCost = true;
String[] splitStr = abCostParse(parse, tapXStr, 2);
parse = abUpdateParse(parse, tapXStr);
tapXTypeAmount = Integer.parseInt(splitStr[0]);
tapXType = splitStr[1];
}
String subStr = "SubCounter<";
if(parse.contains(subStr)) {
// SubCounter<NumCounters/CounterType>
@@ -106,17 +117,6 @@ public class Ability_Cost {
sacThis = (sacType.equals("CARDNAME"));
}
String tapXStr = "tapXType<";
if (parse.contains(tapXStr))
{
tapXTypeCost = true;
String[] splitStr = abCostParse(parse, tapXStr, 2);
parse = abUpdateParse(parse, tapXStr);
tapXTypeAmount = Integer.parseInt(splitStr[0]);
tapXType = splitStr[1];
}
if (parse.contains("Untap")){
untapCost = true;
parse = parse.replace("Untap", "").trim();
@@ -239,9 +239,22 @@ public class Ability_Cost {
if (untapCost){
if (first)
cost.append("Untap");
cost.append("Untap ");
else
cost.append(", untap");
cost.append(", untap ");
first = false;
}
if (tapXTypeCost){
if (first)
cost.append("Tap ");
else
cost.append(", tap ");
cost.append(tapXTypeAmount);
cost.append(" untapped ");
cost.append(tapXType); // needs IsValid String converter
if (tapXTypeAmount > 1)
cost.append("s");
first = false;
}

View File

@@ -14901,7 +14901,7 @@ public class CardFactory_Creatures {
//*************** START *********** START **************************
else if(cardName.equals("Tradewind Rider")) {
final SpellAbility a1 = new Ability(card, "0") {
final SpellAbility a1 = new Ability_Activated(card, "0") {
private static final long serialVersionUID = 3438865371487994984L;
@Override

View File

@@ -232,6 +232,24 @@ public class ComputerUtil
if (cost.getUntap() && (card.isUntapped() || card.isSick()))
return false;
if (cost.getTapXTypeCost())
{
PlayerZone play = AllZone.getZone(Constant.Zone.Play, Constant.Player.Computer);
CardList typeList = new CardList(play.getCards());
typeList = typeList.getValidCards(cost.getTapXType().split(","));
if (cost.getTap())
typeList.remove(sa.getSourceCard());
typeList = typeList.filter( new CardListFilter() {
public boolean addCard(Card c) {
return c.isUntapped();
}
});
if (cost.getTapXTypeAmount() > typeList.size())
return false;
}
if (cost.getSubCounter()){
Counters c = cost.getCounterType();
if (card.getCounters(c) - cost.getCounterNum() < 0 || !AllZone.GameAction.isCardInPlay(card)){
@@ -273,23 +291,14 @@ public class ComputerUtil
Card target = sa.getTargetCard();
if (target != null && target.getController().equals(Constant.Player.Computer)) // don't sacrifice the card we're pumping
typeList.remove(target);
return typeList.size() >= cost.getSacAmount();
if (cost.getSacAmount() > typeList.size())
return false;
}
else if (cost.getSacThis() && !AllZone.GameAction.isCardInPlay(card))
return false;
}
if (cost.getTapXTypeCost())
{
PlayerZone play = AllZone.getZone(Constant.Zone.Play, Constant.Player.Computer);
CardList typeList = new CardList(play.getCards());
typeList = typeList.getValidCards(cost.getTapXType().split(","));
if (cost.getTap())
typeList.remove(sa.getSourceCard());
return typeList.size() >= cost.getTapXTypeAmount();
}
return true;
}

View File

@@ -58,6 +58,25 @@ public class Cost_Payment {
if (cost.getUntap() && (card.isUntapped() || card.isSick()))
return false;
if (cost.getTapXTypeCost()){
PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController());
CardList typeList = new CardList(play.getCards());
typeList = typeList.getValidCards(cost.getTapXType().split(","));
if (cost.getTap()) {
typeList = typeList.filter(new CardListFilter()
{
public boolean addCard(Card c)
{
return !c.equals(card) && c.isUntapped();
}
});
}
if (typeList.size() == 0)
return false;
}
int countersLeft = 0;
if (cost.getSubCounter()){
Counters c = cost.getCounterType();
@@ -106,27 +125,6 @@ public class Cost_Payment {
return false;
}
if (cost.getTapXTypeCost())
{
PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController());
CardList typeList = new CardList(play.getCards());
typeList = typeList.getValidCards(cost.getTapXType().split(","));
if (cost.getTap()) {
typeList = typeList.filter(new CardListFilter()
{
public boolean addCard(Card c)
{
return !c.equals(card);
}
});
}
if (typeList.size() == 0)
return false;
}
return true;
}
@@ -158,6 +156,16 @@ public class Cost_Payment {
changeInput.stopSetNext(new Input_PayCostMana(this));
return false;
}
if (!payTapXType && cost.getTapXTypeCost()){
PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController());
CardList typeList = new CardList(play.getCards());
typeList = typeList.getValidCards(cost.getTapXType().split(","));
changeInput.stopSetNext(input_tapXCost(cost.getTapXTypeAmount(),cost.getTapXType(), typeList, ability, this));
return false;
}
if (!paySubCounter && cost.getSubCounter()){ // pay counters here.
Counters c = cost.getCounterType();
int countersLeft = card.getCounters(c) - cost.getCounterNum();
@@ -226,16 +234,6 @@ public class Cost_Payment {
return false;
}
if (!payTapXType && cost.getTapXTypeCost())
{
PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController());
CardList typeList = new CardList(play.getCards());
typeList = typeList.getValidCards(cost.getTapXType().split(","));
changeInput.stopSetNext(input_tapXCost(cost.getTapXTypeAmount(),cost.getTapXType(), typeList, ability, this));
return false;
}
req.finishPaying();
return true;
}
@@ -257,6 +255,11 @@ public class Cost_Payment {
// refund mana
AllZone.ManaPool.unpaid();
if (cost.getTapXTypeCost() && payTapXType){
// todo: it would be great if a user cancels payment that the tapped creatures will untap
}
// refund counters
if (cost.getSubCounter() && paySubCounter){
Counters c = cost.getCounterType();
@@ -328,6 +331,11 @@ public class Cost_Payment {
if (!cost.hasNoManaCost())
ComputerUtil.payManaCost(ability);
if (cost.getTapXTypeCost()){
for (Card c : tapXCard)
c.tap();
}
if (cost.getSubCounter())
card.setCounter(cost.getCounterType(), countersLeft);
@@ -361,12 +369,6 @@ public class Cost_Payment {
AllZone.GameAction.sacrifice(c);
}
if (cost.getTapXTypeCost())
{
for (Card c : tapXCard)
c.tap();
}
AllZone.Stack.add(ability);
}
@@ -529,7 +531,7 @@ public class Cost_Payment {
public void showMessage() {
if (cardList.size() == 0) stop();
AllZone.Display.showMessage("Select a "+ cardType + " card to tap");
AllZone.Display.showMessage("Select a "+ cardType + " to tap");
ButtonUtil.enableOnlyCancel();
}
@@ -543,6 +545,7 @@ public class Cost_Payment {
if(zone.is(Constant.Zone.Play) && cardList.contains(card) && card.isUntapped() ) {
// send in CardList for Typing
card.tap();
cardList.remove(card);
nTapped++;
if(nTapped == nCards)