mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 20:58:03 +00:00
- Allowing abPump to work with Jitte's equipped creature pump ability
- Fixed abGainLife's canPlay() to check for additional costs. - Updated Umezawa's Jitte to be mostly keyworded.
This commit is contained in:
@@ -2,6 +2,9 @@ Name:Umezawa's Jitte
|
|||||||
ManaCost:2
|
ManaCost:2
|
||||||
Types:Legendary Artifact Equipment
|
Types:Legendary Artifact Equipment
|
||||||
Text:Whenever equipped creature deals combat damage, put two charge counters on Umezawa's Jitte.
|
Text:Whenever equipped creature deals combat damage, put two charge counters on Umezawa's Jitte.
|
||||||
|
K:abPumpEquipped SubCounter<1/CHARGE>:+2/+2
|
||||||
|
K:abPumpTgtC SubCounter<1/CHARGE>:-1/-1
|
||||||
|
K:abGainLife SubCounter<1/CHARGE>:2
|
||||||
SVar:Rarity:Rare
|
SVar:Rarity:Rare
|
||||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/umezawas_jitte.jpg
|
SVar:Picture:http://www.wizards.com/global/images/magic/general/umezawas_jitte.jpg
|
||||||
End
|
End
|
||||||
|
|||||||
@@ -1409,6 +1409,12 @@ public class Card extends MyObservable {
|
|||||||
return equipping;
|
return equipping;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Card getEquippingCard() {
|
||||||
|
if (equipping.size() == 0)
|
||||||
|
return null;
|
||||||
|
return equipping.get(0);
|
||||||
|
}
|
||||||
|
|
||||||
public void setEquipping(ArrayList<Card> list) {
|
public void setEquipping(ArrayList<Card> list) {
|
||||||
equipping = list;
|
equipping = list;
|
||||||
}
|
}
|
||||||
@@ -1475,6 +1481,12 @@ public class Card extends MyObservable {
|
|||||||
return enchanting;
|
return enchanting;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Card getEnchantingCard() {
|
||||||
|
if (enchanting.size() == 0)
|
||||||
|
return null;
|
||||||
|
return enchanting.get(0);
|
||||||
|
}
|
||||||
|
|
||||||
public void setEnchanting(ArrayList<Card> list) {
|
public void setEnchanting(ArrayList<Card> list) {
|
||||||
enchanting = list;
|
enchanting = list;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1575,6 +1575,8 @@ public class CardFactory implements NewConstants {
|
|||||||
|
|
||||||
String[] tmpCost = tmp.split(" ", 2);
|
String[] tmpCost = tmp.split(" ", 2);
|
||||||
|
|
||||||
|
final boolean bPumpEquipped = (tmpCost[0].equals("Equipped"));
|
||||||
|
|
||||||
final Target abTgt = new Target(tmpCost[0]);
|
final Target abTgt = new Target(tmpCost[0]);
|
||||||
final Ability_Cost abCost = new Ability_Cost(tmpCost[1], card.getName(), true);
|
final Ability_Cost abCost = new Ability_Cost(tmpCost[1], card.getName(), true);
|
||||||
|
|
||||||
@@ -1639,14 +1641,17 @@ public class CardFactory implements NewConstants {
|
|||||||
String d = "none";
|
String d = "none";
|
||||||
StringBuilder sbD = new StringBuilder();
|
StringBuilder sbD = new StringBuilder();
|
||||||
|
|
||||||
|
if(abTgt.doesTarget())
|
||||||
|
sbD.append("Target creature");
|
||||||
|
else if (bPumpEquipped)
|
||||||
|
sbD.append("Equipped creature");
|
||||||
|
else
|
||||||
|
sbD.append(cardName);
|
||||||
|
|
||||||
if((AttackX[0].equals("none") && !(NumAttack[0] == -1138))
|
if((AttackX[0].equals("none") && !(NumAttack[0] == -1138))
|
||||||
&& (DefenseX[0].equals("none") && !(NumDefense[0] == -1138)) && Keyword[0].equals("none")) {
|
&& (DefenseX[0].equals("none") && !(NumDefense[0] == -1138)) && Keyword[0].equals("none")) {
|
||||||
// pt boost
|
// pt boost
|
||||||
if(abTgt.doesTarget()) sbD.append("Target creature gets ");
|
|
||||||
else {
|
|
||||||
sbD.append(cardName);
|
|
||||||
sbD.append(" gets ");
|
sbD.append(" gets ");
|
||||||
}
|
|
||||||
|
|
||||||
if(NumAttack[0] > 0 || (NumAttack[0] == 0 && NumDefense[0] > 0)) // +0/+1
|
if(NumAttack[0] > 0 || (NumAttack[0] == 0 && NumDefense[0] > 0)) // +0/+1
|
||||||
sbD.append("+");
|
sbD.append("+");
|
||||||
@@ -1666,11 +1671,7 @@ public class CardFactory implements NewConstants {
|
|||||||
if((AttackX[0].equals("none") && NumAttack[0] == -1138)
|
if((AttackX[0].equals("none") && NumAttack[0] == -1138)
|
||||||
&& (DefenseX[0].equals("none") && NumDefense[0] == -1138) && !Keyword[0].equals("none")) {
|
&& (DefenseX[0].equals("none") && NumDefense[0] == -1138) && !Keyword[0].equals("none")) {
|
||||||
// k boost
|
// k boost
|
||||||
if(abTgt.doesTarget()) sbD.append("Target creature gains ");
|
|
||||||
else {
|
|
||||||
sbD.append(cardName);
|
|
||||||
sbD.append(" gains ");
|
sbD.append(" gains ");
|
||||||
}
|
|
||||||
|
|
||||||
sbD.append(dK);
|
sbD.append(dK);
|
||||||
sbD.append(" until end of turn.");
|
sbD.append(" until end of turn.");
|
||||||
@@ -1678,11 +1679,7 @@ public class CardFactory implements NewConstants {
|
|||||||
if((AttackX[0].equals("none") && !(NumAttack[0] == -1138))
|
if((AttackX[0].equals("none") && !(NumAttack[0] == -1138))
|
||||||
&& (DefenseX[0].equals("none") && !(NumDefense[0] == -1138)) && !Keyword[0].equals("none")) {
|
&& (DefenseX[0].equals("none") && !(NumDefense[0] == -1138)) && !Keyword[0].equals("none")) {
|
||||||
// ptk boost
|
// ptk boost
|
||||||
if(abTgt.doesTarget()) sbD.append("Target creature gets ");
|
|
||||||
else {
|
|
||||||
sbD.append(cardName);
|
|
||||||
sbD.append(" gets ");
|
sbD.append(" gets ");
|
||||||
}
|
|
||||||
|
|
||||||
if(NumAttack[0] > 0 || (NumAttack[0] == 0 && NumDefense[0] > 0)) // +0/+1
|
if(NumAttack[0] > 0 || (NumAttack[0] == 0 && NumDefense[0] > 0)) // +0/+1
|
||||||
sbD.append("+");
|
sbD.append("+");
|
||||||
@@ -1744,8 +1741,23 @@ public class CardFactory implements NewConstants {
|
|||||||
public boolean canPlayAI() {
|
public boolean canPlayAI() {
|
||||||
// temporarily disabled until AI is improved
|
// temporarily disabled until AI is improved
|
||||||
if (abCost.getSacCost()) return false;
|
if (abCost.getSacCost()) return false;
|
||||||
if (abCost.getSubCounter()) return false;
|
|
||||||
if (abCost.getLifeCost()) return false;
|
if (abCost.getLifeCost()) return false;
|
||||||
|
if (abCost.getSubCounter()){
|
||||||
|
// instead of never removing counters, we will have a random possibility of failure.
|
||||||
|
// all the other tests still need to pass if a counter will be removed
|
||||||
|
Counters count = abCost.getCounterType();
|
||||||
|
double chance = .66;
|
||||||
|
if (count.equals("P1P1")){ // 10% chance to remove +1/+1 to pump
|
||||||
|
chance = .1;
|
||||||
|
}
|
||||||
|
else if (count.equals("CHARGE")){ // 50% chance to remove +1/+1 to pump
|
||||||
|
chance = .5;
|
||||||
|
}
|
||||||
|
Random r = new Random();
|
||||||
|
if(r.nextFloat() > chance)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (bPumpEquipped && card.getEquippingCard() == null) return false;
|
||||||
|
|
||||||
if (!ComputerUtil.canPayCost(this))
|
if (!ComputerUtil.canPayCost(this))
|
||||||
return false;
|
return false;
|
||||||
@@ -1756,17 +1768,21 @@ public class CardFactory implements NewConstants {
|
|||||||
if(AllZone.Phase.getPhase().equals(Constant.Phase.Main2)) return false;
|
if(AllZone.Phase.getPhase().equals(Constant.Phase.Main2)) return false;
|
||||||
|
|
||||||
if(!abTgt.doesTarget()) {
|
if(!abTgt.doesTarget()) {
|
||||||
setTargetCard(card);
|
Card creature;
|
||||||
|
if (bPumpEquipped)
|
||||||
|
creature = card.getEquippingCard();
|
||||||
|
else
|
||||||
|
creature = card;
|
||||||
|
|
||||||
if((card.getNetDefense() + defense > 0) && (!card.getKeyword().contains(keyword))) {
|
if((creature.getNetDefense() + defense > 0) && (!creature.getKeyword().contains(keyword))) {
|
||||||
if(card.hasSickness() && keyword.contains("Haste"))
|
if(creature.hasSickness() && keyword.contains("Haste"))
|
||||||
return true;
|
return true;
|
||||||
else if (card.hasSickness() ^ keyword.contains("Haste"))
|
else if (creature.hasSickness() ^ keyword.contains("Haste"))
|
||||||
return false;
|
return false;
|
||||||
else {
|
else {
|
||||||
Random r = new Random();
|
Random r = new Random();
|
||||||
if(r.nextFloat() <= Math.pow(.6667, card.getAbilityUsed()))
|
if(r.nextFloat() <= Math.pow(.6667, card.getAbilityUsed()))
|
||||||
return CardFactoryUtil.AI_doesCreatureAttack(card);
|
return CardFactoryUtil.AI_doesCreatureAttack(creature);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1823,11 +1839,16 @@ public class CardFactory implements NewConstants {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void resolve() {
|
public void resolve() {
|
||||||
if(AllZone.GameAction.isCardInPlay(getTargetCard())
|
|
||||||
&& (CardFactoryUtil.canTarget(card, getTargetCard()) || !abTgt.doesTarget() )) {
|
|
||||||
final Card[] creature = new Card[1];
|
final Card[] creature = new Card[1];
|
||||||
if(abTgt.doesTarget()) creature[0] = getTargetCard();
|
if(abTgt.doesTarget())
|
||||||
else creature[0] = card;
|
creature[0] = getTargetCard();
|
||||||
|
else if (bPumpEquipped)
|
||||||
|
creature[0] = card.getEquippingCard();
|
||||||
|
else
|
||||||
|
creature[0] = card;
|
||||||
|
|
||||||
|
if(creature[0] != null && AllZone.GameAction.isCardInPlay(creature[0])
|
||||||
|
&& (!abTgt.doesTarget() || CardFactoryUtil.canTarget(card, getTargetCard()))) {
|
||||||
|
|
||||||
final int a = getNumAttack();
|
final int a = getNumAttack();
|
||||||
final int d = getNumDefense();
|
final int d = getNumDefense();
|
||||||
@@ -4608,6 +4629,11 @@ public class CardFactory implements NewConstants {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean canPlay(){
|
||||||
|
Cost_Payment pay = new Cost_Payment(abCost, this);
|
||||||
|
return (pay.canPayAdditionalCosts() && CardFactoryUtil.canUseAbility(card) && super.canPlay());
|
||||||
|
}
|
||||||
|
|
||||||
public boolean canPlayAI()
|
public boolean canPlayAI()
|
||||||
{
|
{
|
||||||
int life = AllZone.GameAction.getPlayerLife(Constant.Player.Computer).getLife();
|
int life = AllZone.GameAction.getPlayerLife(Constant.Player.Computer).getLife();
|
||||||
|
|||||||
@@ -218,8 +218,6 @@ class CardFactory_Equipment {
|
|||||||
card.addUnEquipCommand(onUnEquip);
|
card.addUnEquipCommand(onUnEquip);
|
||||||
} //*************** END ************ END **************************
|
} //*************** END ************ END **************************
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//*************** START *********** START **************************
|
//*************** START *********** START **************************
|
||||||
else if(cardName.equals("Umezawa's Jitte")) {
|
else if(cardName.equals("Umezawa's Jitte")) {
|
||||||
final Ability equip = new Ability(card, "2") {
|
final Ability equip = new Ability(card, "2") {
|
||||||
@@ -279,173 +277,9 @@ class CardFactory_Equipment {
|
|||||||
|
|
||||||
};//equip ability
|
};//equip ability
|
||||||
|
|
||||||
final Ability gainLife = new Ability(card, "0") {
|
|
||||||
@Override
|
|
||||||
public void resolve() {
|
|
||||||
card.subtractCounter(Counters.CHARGE, 1);
|
|
||||||
AllZone.GameAction.gainLife(card.getController(), 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
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") {
|
|
||||||
@Override
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
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;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void showMessage() {
|
|
||||||
AllZone.Display.showMessage("Select target creature for " + card.getName());
|
|
||||||
ButtonUtil.enableOnlyCancel();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void selectButtonCancel() {
|
|
||||||
stop();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
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") {
|
|
||||||
@Override
|
|
||||||
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])) {
|
|
||||||
target[0].addTempAttackBoost(2);
|
|
||||||
target[0].addTempDefenseBoost(2);
|
|
||||||
|
|
||||||
AllZone.EndOfTurn.addUntil(untilEOT);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
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(CardFactoryUtil.input_equipCreature(equip));
|
equip.setBeforePayMana(CardFactoryUtil.input_equipCreature(equip));
|
||||||
equip.setDescription("Equip: 2");
|
equip.setDescription("Equip: 2");
|
||||||
card.addSpellAbility(equip);
|
card.addSpellAbility(equip);
|
||||||
card.addSpellAbility(boost);
|
|
||||||
card.addSpellAbility(negBoost);
|
|
||||||
card.addSpellAbility(gainLife);
|
|
||||||
|
|
||||||
} //*************** END ************ END **************************
|
} //*************** END ************ END **************************
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user