- 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;
@@ -119,6 +121,8 @@ 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;
@@ -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());
@@ -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) {
@@ -359,7 +379,7 @@ 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);
@@ -374,8 +394,12 @@ public class CostRemoveCounter extends CostPartWithList {
}
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);

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];