- Added Caller of the Hunt

This commit is contained in:
swordshine
2013-12-02 12:24:43 +00:00
parent 1cf9a005d9
commit 503a8da70f
4 changed files with 139 additions and 0 deletions

2
.gitattributes vendored
View File

@@ -1667,6 +1667,7 @@ forge-gui/res/cardsfolder/c/call_to_the_kindred.txt -text
forge-gui/res/cardsfolder/c/call_to_the_netherworld.txt svneol=native#text/plain
forge-gui/res/cardsfolder/c/caller_of_gales.txt svneol=native#text/plain
forge-gui/res/cardsfolder/c/caller_of_the_claw.txt svneol=native#text/plain
forge-gui/res/cardsfolder/c/caller_of_the_hunt.txt -text
forge-gui/res/cardsfolder/c/callous_deceiver.txt svneol=native#text/plain
forge-gui/res/cardsfolder/c/callous_giant.txt svneol=native#text/plain
forge-gui/res/cardsfolder/c/callous_oppressor.txt -text
@@ -14983,6 +14984,7 @@ forge-gui/src/main/java/forge/game/combat/CombatLki.java -text
forge-gui/src/main/java/forge/game/combat/CombatUtil.java svneol=native#text/plain
forge-gui/src/main/java/forge/game/cost/Cost.java svneol=native#text/plain
forge-gui/src/main/java/forge/game/cost/CostAddMana.java -text
forge-gui/src/main/java/forge/game/cost/CostChooseCreatureType.java -text
forge-gui/src/main/java/forge/game/cost/CostDamage.java -text
forge-gui/src/main/java/forge/game/cost/CostDiscard.java -text
forge-gui/src/main/java/forge/game/cost/CostDraw.java -text

View File

@@ -0,0 +1,10 @@
Name:Caller of the Hunt
ManaCost:2 G
Types:Creature Human
PT:*/*
Text:As an additional cost to cast CARDNAME, choose a creature type.
S:Mode$ Continuous | EffectZone$ All | CharacteristicDefining$ True | SetPower$ X | SetToughness$ X | Description$ CARDNAME's power and toughness are each equal to the number of creatures of the chosen type on the battlefield.
SVar:X:Count$Valid Creature.ChosenType
A:SP$ PermanentCreature | Cost$ 2 G ChooseCreatureType<1> | AILogic$ MostProminentOnBattlefield
SVar:Picture:http://www.wizards.com/global/images/magic/general/caller_of_the_hunt.jpg
Oracle:As an additional cost to cast Caller of the Hunt, choose a creature type.\nCaller of the Hunt's power and toughness are each equal to the number of creatures of the chosen type on the battlefield.

View File

@@ -243,6 +243,11 @@ public class Cost {
return new CostUnattach(splitStr[0], description);
}
if (parse.startsWith("ChooseCreatureType<")) {
final String[] splitStr = abCostParse(parse, 1);
return new CostChooseCreatureType(splitStr[0]);
}
if (parse.startsWith("DamageYou<")) {
// Damage<NumDmg>
final String[] splitStr = abCostParse(parse, 1);

View File

@@ -0,0 +1,122 @@
/*
* Forge: Play Magic: the Gathering.
* Copyright (C) 2011 Forge Team
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package forge.game.cost;
import java.util.ArrayList;
import forge.card.CardType;
import forge.game.Game;
import forge.game.ability.AbilityUtils;
import forge.game.card.Card;
import forge.game.player.Player;
import forge.game.spellability.SpellAbility;
import forge.gui.GuiDialog;
/**
* The Class CostChooseCreatureType.
*/
public class CostChooseCreatureType extends CostPart {
/**
* Instantiates a new cost mill.
*
* @param amount
* the amount
*/
public CostChooseCreatureType(final String amount) {
this.setAmount(amount);
}
/*
* (non-Javadoc)
*
* @see
* forge.card.cost.CostPart#canPay(forge.card.spellability.SpellAbility,
* forge.Card, forge.Player, forge.card.cost.Cost)
*/
@Override
public final boolean canPay(final SpellAbility ability) {
return true;
}
/*
* (non-Javadoc)
*
* @see
* forge.card.cost.CostPart#payHuman(forge.card.spellability.SpellAbility,
* forge.Card, forge.card.cost.Cost_Payment)
*/
@Override
public final boolean payHuman(final SpellAbility ability, final Game game) {
final Player activator = ability.getActivatingPlayer();
final Card source = ability.getSourceCard();
final StringBuilder sb = new StringBuilder();
sb.append(source.getName()).append(" - Choose a creature type?");
if (GuiDialog.confirm(source, sb.toString())) {
String choice = activator.getController().chooseSomeType("Creature", ability, new ArrayList<String>(CardType.getCreatureTypes()), new ArrayList<String>());
source.setChosenType(choice);
} else {
return false;
}
return true;
}
/*
* (non-Javadoc)
*
* @see forge.card.cost.CostPart#toString()
*/
@Override
public final String toString() {
final StringBuilder sb = new StringBuilder();
final Integer i = this.convertAmount();
sb.append("Choose ");
sb.append(Cost.convertAmountTypeToWords(i, this.getAmount(), "creature type"));
return sb.toString();
}
/* (non-Javadoc)
* @see forge.card.cost.CostPart#decideAIPayment(forge.game.player.AIPlayer, forge.card.spellability.SpellAbility, forge.Card)
*/
@Override
public PaymentDecision decideAIPayment(Player ai, SpellAbility ability, Card source) {
Integer c = this.convertAmount();
if (c == null) {
final String sVar = ability.getSVar(this.getAmount());
// Generalize this
if (sVar.equals("XChoice")) {
return null; // cannot pay
} else {
c = AbilityUtils.calculateAmount(source, this.getAmount(), ability);
}
}
return new PaymentDecision(c);
}
@Override
public boolean payAI(PaymentDecision decision, Player ai,
SpellAbility ability, Card source) {
String choice = ai.getController().chooseSomeType("Creature", ability, new ArrayList<String>(CardType.getCreatureTypes()), new ArrayList<String>());
source.setChosenType(choice);
return true;
}
}