- Added Hankyu

This commit is contained in:
swordshine
2013-06-11 08:02:49 +00:00
parent a758a60a57
commit f391259e5c
4 changed files with 56 additions and 20 deletions

1
.gitattributes vendored
View File

@@ -4818,6 +4818,7 @@ res/cardsfolder/h/hand_of_justice.txt svneol=native#text/plain
res/cardsfolder/h/hand_of_the_praetors.txt svneol=native#text/plain
res/cardsfolder/h/hand_to_hand.txt -text
res/cardsfolder/h/hands_of_binding.txt -text
res/cardsfolder/h/hankyu.txt -text
res/cardsfolder/h/hanna.txt -text
res/cardsfolder/h/hanna_ships_navigator.txt svneol=native#text/plain
res/cardsfolder/h/hannas_custody.txt svneol=native#text/plain

View File

@@ -0,0 +1,11 @@
Name:Hankyu
ManaCost:1
Types:Artifact Equipment
K:Equip 4
S:Mode$ Continuous | Affected$ Card.EquippedBy | AddAbility$ HankyuPutCounter & HankyuDmg | AddSVar$ HankyuX | Description$ Equipped creature has "Tap: Put an aim counter on CARDNAME" and "Tap, Remove all aim counters from CARDNAME: This creature deals damage to target creature or player equal to the number of aim counters removed this way."
SVar:HankyuPutCounter:AB$ PutCounter | Cost$ T | CounterType$ AIM | CounterNum$ 1 | Defined$ OriginalHost | SpellDescription$ Put an aim counter on Hankyu.
SVar:HankyuDmg:AB$ DealDamage | Cost$ T SubCounter<All/AIM/OriginalHost/Hankyu> | ValidTgts$ Creature,Player | TgtPrompt$ Select target creature or player | NumDmg$ HankyuX | References$ HankyuX | SpellDescription$ CARDNAME deals damage to target creature or player equal to the number of aim counters removed this way.
SVar:HankyuX:SVar$CostCountersRemoved
SVar:RemAIDeck:True
SVar:Picture:http://www.wizards.com/global/images/magic/general/hankyu.jpg
Oracle:Equipped creature has "{T}: Put an aim counter on Hankyu" and "{T}, Remove all aim counters from Hankyu: This creature deals damage to target creature or player equal to the number of aim counters removed this way."\nEquip {4} ({4}: Attach to target creature you control. Equip only as a sorcery.)

View File

@@ -22,6 +22,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.google.common.collect.Lists;
import forge.Card;
import forge.CardLists;
import forge.CounterType;
@@ -51,11 +53,11 @@ public class CostRemoveCounter extends CostPartWithList {
*/
public static final class InputSelectCardToRemoveCounter extends InputSelectCards {
private static final long serialVersionUID = 2685832214519141903L;
private final Map<Card,Integer> cardsChosen;
private final CounterType counterType;
private final List<Card> validChoices;
public InputSelectCardToRemoveCounter(int cntCounters, CounterType cType, List<Card> validCards) {
super(cntCounters, cntCounters);
this.validChoices = validCards;
@@ -74,22 +76,22 @@ public class CostRemoveCounter extends CostPartWithList {
selected.add(c);
else
cardsChosen.put(c, tc+1);
onSelectStateChanged(c, true);
return true;
}
@Override
protected boolean hasEnoughTargets() {
return hasAllTargets();
}
@Override
protected boolean hasAllTargets() {
int sum = getDistibutedCounters();
return sum >= max;
}
protected String getMessage() {
return max == Integer.MAX_VALUE
? String.format(message, getDistibutedCounters())
@@ -119,7 +121,9 @@ public class CostRemoveCounter extends CostPartWithList {
final String amount = this.getAmount();
final Card source = ability.getSourceCard();
Integer c = this.convertAmount();
final String type = this.getType();
final Player activator = ability.getActivatingPlayer();
String sVarAmount = ability.getSVar(amount);
cntRemoved = 1;
if (c != null)
@@ -142,10 +146,20 @@ public class CostRemoveCounter extends CostPartWithList {
source.setSVar("CostCountersRemoved", Integer.toString(cntRemoved));
executePayment(ability, source);
return true;
} else if (type.equals("OriginalHost")) {
int maxCounters = ability.getOriginalHost().getCounters(this.counter);
if (amount.equals("All")) {
cntRemoved = maxCounters;
}
if (maxCounters < cntRemoved)
return false;
cntRemoved = cntRemoved >= 0 ? cntRemoved : maxCounters;
source.setSVar("CostCountersRemoved", Integer.toString(cntRemoved));
executePayment(ability, ability.getOriginalHost());
return true;
}
List<Card> validCards = CardLists.getValidCards(ability.getActivatingPlayer().getCardsIn(getZone()), getType().split(";"), ability.getActivatingPlayer(), source);
List<Card> validCards = CardLists.getValidCards(activator.getCardsIn(getZone()), type.split(";"), activator, source);
if (this.getZone().equals(ZoneType.Battlefield)) {
final InputSelectCardToRemoveCounter inp = new InputSelectCardToRemoveCounter(cntRemoved, getCounter(), validCards);
inp.setMessage("Remove %d " + getCounter().getName() + " counters from " + getDescriptiveType());
@@ -170,7 +184,7 @@ public class CostRemoveCounter extends CostPartWithList {
return executePayment(ability, inp.getSelected());
}
// Rift Elemental only - always removes 1 counter, so there will be no code for N counters.
List<Card> suspended = new ArrayList<Card>();
for(Card crd : validCards)
@@ -291,6 +305,7 @@ public class CostRemoveCounter extends CostPartWithList {
final CounterType cntrs = this.getCounter();
final Player activator = ability.getActivatingPlayer();
final Card source = ability.getSourceCard();
final String type = this.getType();
final Integer amount = this.convertAmount();
if (this.payCostFromSource()) {
@@ -299,7 +314,12 @@ public class CostRemoveCounter extends CostPartWithList {
}
}
else {
final List<Card> typeList = CardLists.getValidCards(activator.getCardsIn(this.getZone()), this.getType().split(";"), activator, source);
List<Card> typeList;
if (type.equals("OriginalHost")) {
typeList = Lists.newArrayList(ability.getOriginalHost());
} else {
typeList = CardLists.getValidCards(activator.getCardsIn(this.getZone()), type.split(";"), activator, source);
}
if (amount != null) {
for (Card c : typeList) {
if (c.getCounters(cntrs) - amount >= 0) {
@@ -343,7 +363,7 @@ public class CostRemoveCounter extends CostPartWithList {
protected void doPayment(SpellAbility ability, Card targetCard){
targetCard.subtractCounter(this.getCounter(), cntRemoved);
}
/* (non-Javadoc)
* @see forge.card.cost.CostPartWithList#getHashForList()
*/
@@ -359,8 +379,8 @@ public class CostRemoveCounter extends CostPartWithList {
public PaymentDecision decideAIPayment(Player ai, SpellAbility ability, Card source) {
final String amount = this.getAmount();
Integer c = this.convertAmount();
final String type = this.getType();
if (c == null) {
final String sVar = ability.getSVar(amount);
if (sVar.equals("XChoice")) {
@@ -372,18 +392,22 @@ public class CostRemoveCounter extends CostPartWithList {
c = AbilityUtils.calculateAmount(source, amount, ability);
}
}
if (!this.payCostFromSource()) {
final List<Card> typeList =
CardLists.getValidCards(ai.getCardsIn(this.getZone()), this.getType().split(";"), ai, source);
List<Card> typeList;
if (type.equals("OriginalHost")) {
typeList = Lists.newArrayList(ability.getOriginalHost());
} else {
typeList = CardLists.getValidCards(ai.getCardsIn(this.getZone()), type.split(";"), ai, source);
}
for (Card card : typeList) {
if (card.getCounters(this.getCounter()) >= c) {
return new PaymentDecision(card);
}
}
return null;
}
}
if (c > source.getCounters(this.getCounter())) {
System.out.println("Not enough " + this.counter + " on " + source.getName());
return null;

View File

@@ -384,7 +384,7 @@ public class StaticAbilityContinuous {
for (final String sVar : addSVars) {
String actualSVar = hostCard.getSVar(sVar);
String name = sVar;
if (actualSVar.startsWith("SVar")) {
if (actualSVar.startsWith("SVar:")) {
actualSVar = actualSVar.split("SVar:")[1];
name = actualSVar.split(":")[0];
actualSVar = actualSVar.split(":")[1];