combined power and toughness property into single pt property, remove setPower and setToughness in MagicCardDefinition and replace with setPowerToughness

master
melvin 2011-09-21 14:46:00 +08:00
parent befc28ae65
commit 825b887e6f
5 changed files with 821 additions and 1637 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -78,16 +78,12 @@ public class CardDefinitions {
card.setManaSourceText(value); card.setManaSourceText(value);
} else if ("basic".equals(property)) { } else if ("basic".equals(property)) {
card.setBasicManaActivations(value); card.setBasicManaActivations(value);
} else if ("power".equals(property)) { } else if ("pt".equals(property)) {
if (!card.isCreature()) { if (!card.isCreature()) {
throw new RuntimeException(card.getFullName() + ": only creatures may have power"); throw new RuntimeException(card.getFullName() + ": only creatures may have power/toughness");
} }
card.setPower(Integer.parseInt(value)); final String[] pt = value.split("/");
} else if ("toughness".equals(property)) { card.setPowerToughness(Integer.parseInt(pt[0]),Integer.parseInt(pt[1]));
if (!card.isCreature()) {
throw new RuntimeException(card.getFullName() + ": only creatures may have toughness");
}
card.setToughness(Integer.parseInt(value));
} else if ("ability".equals(property)) { } else if ("ability".equals(property)) {
final String names[]=value.split(","); final String names[]=value.split(",");
for (final String name : names) { for (final String name : names) {

View File

@ -22,8 +22,7 @@ public class TokenCardDefinitions {
setCost(MagicManaCost.ZERO); setCost(MagicManaCost.ZERO);
setColor(MagicColor.Red); setColor(MagicColor.Red);
setColoredType(); setColoredType();
setPower(4); setPowerToughness(4,4);
setToughness(4);
setAbility(MagicAbility.Flying); setAbility(MagicAbility.Flying);
} }
}; };
@ -37,8 +36,7 @@ public class TokenCardDefinitions {
setCost(MagicManaCost.ZERO); setCost(MagicManaCost.ZERO);
setColor(MagicColor.Red); setColor(MagicColor.Red);
setColoredType(); setColoredType();
setPower(5); setPowerToughness(5,5);
setToughness(5);
setAbility(MagicAbility.Flying); setAbility(MagicAbility.Flying);
} }
}; };
@ -53,8 +51,7 @@ public class TokenCardDefinitions {
setColor(MagicColor.Black); setColor(MagicColor.Black);
setColor(MagicColor.Green); setColor(MagicColor.Green);
setColoredType(); setColoredType();
setPower(1); setPowerToughness(1,1);
setToughness(1);
} }
}; };
@ -67,8 +64,7 @@ public class TokenCardDefinitions {
setCost(MagicManaCost.ZERO); setCost(MagicManaCost.ZERO);
setColor(MagicColor.Green); setColor(MagicColor.Green);
setColoredType(); setColoredType();
setPower(1); setPowerToughness(1,1);
setToughness(1);
} }
}; };
@ -81,8 +77,7 @@ public class TokenCardDefinitions {
setCost(MagicManaCost.ZERO); setCost(MagicManaCost.ZERO);
setColor(MagicColor.Green); setColor(MagicColor.Green);
setColoredType(); setColoredType();
setPower(1); setPowerToughness(1,1);
setToughness(1);
} }
}; };
@ -95,8 +90,7 @@ public class TokenCardDefinitions {
setCost(MagicManaCost.ZERO); setCost(MagicManaCost.ZERO);
setColor(MagicColor.White); setColor(MagicColor.White);
setColoredType(); setColoredType();
setPower(1); setPowerToughness(1,1);
setToughness(1);
} }
}; };
@ -109,8 +103,7 @@ public class TokenCardDefinitions {
setCost(MagicManaCost.ZERO); setCost(MagicManaCost.ZERO);
setColor(MagicColor.Red); setColor(MagicColor.Red);
setColoredType(); setColoredType();
setPower(1); setPowerToughness(1,1);
setToughness(1);
} }
}; };
@ -123,8 +116,7 @@ public class TokenCardDefinitions {
setCost(MagicManaCost.ZERO); setCost(MagicManaCost.ZERO);
setColor(MagicColor.Red); setColor(MagicColor.Red);
setColoredType(); setColoredType();
setPower(2); setPowerToughness(2,1);
setToughness(1);
setAbility(MagicAbility.Haste); setAbility(MagicAbility.Haste);
} }
}; };
@ -139,8 +131,7 @@ public class TokenCardDefinitions {
setColor(MagicColor.Red); setColor(MagicColor.Red);
setColor(MagicColor.White); setColor(MagicColor.White);
setColoredType(); setColoredType();
setPower(1); setPowerToughness(1,1);
setToughness(1);
} }
}; };
@ -153,8 +144,7 @@ public class TokenCardDefinitions {
setCost(MagicManaCost.ZERO); setCost(MagicManaCost.ZERO);
setColor(MagicColor.Red); setColor(MagicColor.Red);
setColoredType(); setColoredType();
setPower(3); setPowerToughness(3,3);
setToughness(3);
} }
}; };
@ -166,8 +156,7 @@ public class TokenCardDefinitions {
setSubTypes(new String[]{"Spirit"}); setSubTypes(new String[]{"Spirit"});
setCost(MagicManaCost.ZERO); setCost(MagicManaCost.ZERO);
setColoredType(); setColoredType();
setPower(1); setPowerToughness(1,1);
setToughness(1);
} }
}; };
@ -180,8 +169,7 @@ public class TokenCardDefinitions {
setCost(MagicManaCost.ZERO); setCost(MagicManaCost.ZERO);
setColor(MagicColor.White); setColor(MagicColor.White);
setColoredType(); setColoredType();
setPower(1); setPowerToughness(1,1);
setToughness(1);
setAbility(MagicAbility.Flying); setAbility(MagicAbility.Flying);
} }
}; };
@ -195,8 +183,7 @@ public class TokenCardDefinitions {
setCost(MagicManaCost.ZERO); setCost(MagicManaCost.ZERO);
setColor(MagicColor.Black); setColor(MagicColor.Black);
setColoredType(); setColoredType();
setPower(1); setPowerToughness(1,1);
setToughness(1);
setAbility(MagicAbility.Flying); setAbility(MagicAbility.Flying);
} }
}; };
@ -210,8 +197,7 @@ public class TokenCardDefinitions {
setCost(MagicManaCost.ZERO); setCost(MagicManaCost.ZERO);
setColor(MagicColor.Black); setColor(MagicColor.Black);
setColoredType(); setColoredType();
setPower(1); setPowerToughness(1,1);
setToughness(1);
setAbility(MagicAbility.Flying); setAbility(MagicAbility.Flying);
} }
}; };
@ -225,8 +211,7 @@ public class TokenCardDefinitions {
setCost(MagicManaCost.ZERO); setCost(MagicManaCost.ZERO);
setColor(MagicColor.White); setColor(MagicColor.White);
setColoredType(); setColoredType();
setPower(2); setPowerToughness(2,2);
setToughness(2);
setAbility(MagicAbility.Flying); setAbility(MagicAbility.Flying);
} }
}; };
@ -240,8 +225,7 @@ public class TokenCardDefinitions {
setCost(MagicManaCost.ZERO); setCost(MagicManaCost.ZERO);
setColor(MagicColor.White); setColor(MagicColor.White);
setColoredType(); setColoredType();
setPower(3); setPowerToughness(3,3);
setToughness(3);
setAbility(MagicAbility.Flying); setAbility(MagicAbility.Flying);
} }
}; };
@ -255,8 +239,7 @@ public class TokenCardDefinitions {
setCost(MagicManaCost.ZERO); setCost(MagicManaCost.ZERO);
setColor(MagicColor.Blue); setColor(MagicColor.Blue);
setColoredType(); setColoredType();
setPower(1); setPowerToughness(1,1);
setToughness(1);
} }
}; };
@ -269,8 +252,7 @@ public class TokenCardDefinitions {
setCost(MagicManaCost.ZERO); setCost(MagicManaCost.ZERO);
setColor(MagicColor.Green); setColor(MagicColor.Green);
setColoredType(); setColoredType();
setPower(3); setPowerToughness(3,3);
setToughness(3);
} }
}; };
@ -283,8 +265,7 @@ public class TokenCardDefinitions {
setCost(MagicManaCost.ZERO); setCost(MagicManaCost.ZERO);
setColor(MagicColor.Green); setColor(MagicColor.Green);
setColoredType(); setColoredType();
setPower(3); setPowerToughness(3,3);
setToughness(3);
} }
}; };
@ -297,8 +278,7 @@ public class TokenCardDefinitions {
setCost(MagicManaCost.ZERO); setCost(MagicManaCost.ZERO);
setColor(MagicColor.Green); setColor(MagicColor.Green);
setColoredType(); setColoredType();
setPower(4); setPowerToughness(4,4);
setToughness(4);
} }
}; };
@ -313,8 +293,7 @@ public class TokenCardDefinitions {
setColor(MagicColor.Green); setColor(MagicColor.Green);
setColor(MagicColor.White); setColor(MagicColor.White);
setColoredType(); setColoredType();
setPower(8); setPowerToughness(8,8);
setToughness(8);
} }
}; };
@ -327,8 +306,7 @@ public class TokenCardDefinitions {
setCost(MagicManaCost.ZERO); setCost(MagicManaCost.ZERO);
setColor(MagicColor.Green); setColor(MagicColor.Green);
setColoredType(); setColoredType();
setPower(3); setPowerToughness(3,3);
setToughness(3);
} }
}; };
@ -341,8 +319,7 @@ public class TokenCardDefinitions {
setCost(MagicManaCost.ZERO); setCost(MagicManaCost.ZERO);
setColor(MagicColor.Black); setColor(MagicColor.Black);
setColoredType(); setColoredType();
setPower(0); setPowerToughness(0,0);
setToughness(0);
} }
}; };
@ -355,8 +332,7 @@ public class TokenCardDefinitions {
setCost(MagicManaCost.ZERO); setCost(MagicManaCost.ZERO);
setColor(MagicColor.Black); setColor(MagicColor.Black);
setColoredType(); setColoredType();
setPower(2); setPowerToughness(2,2);
setToughness(2);
} }
}; };
@ -369,8 +345,7 @@ public class TokenCardDefinitions {
setCost(MagicManaCost.ZERO); setCost(MagicManaCost.ZERO);
setColor(MagicColor.Black); setColor(MagicColor.Black);
setColoredType(); setColoredType();
setPower(5); setPowerToughness(5,5);
setToughness(5);
} }
}; };
@ -384,8 +359,7 @@ public class TokenCardDefinitions {
setCost(MagicManaCost.ZERO); setCost(MagicManaCost.ZERO);
setColor(MagicColor.Green); setColor(MagicColor.Green);
setColoredType(); setColoredType();
setPower(2); setPowerToughness(2,2);
setToughness(2);
} }
}; };
@ -400,8 +374,7 @@ public class TokenCardDefinitions {
setColor(MagicColor.Green); setColor(MagicColor.Green);
setColor(MagicColor.White); setColor(MagicColor.White);
setColoredType(); setColoredType();
setPower(2); setPowerToughness(2,2);
setToughness(2);
} }
}; };
@ -415,8 +388,7 @@ public class TokenCardDefinitions {
setSubTypes(new String[]{"Goblin","Golem"}); setSubTypes(new String[]{"Goblin","Golem"});
setCost(MagicManaCost.ZERO); setCost(MagicManaCost.ZERO);
setColoredType(); setColoredType();
setPower(5); setPowerToughness(5,5);
setToughness(5);
} }
}; };
@ -428,8 +400,7 @@ public class TokenCardDefinitions {
setSubTypes(new String[]{"Eldrazi","Spawn"}); setSubTypes(new String[]{"Eldrazi","Spawn"});
setCost(MagicManaCost.ZERO); setCost(MagicManaCost.ZERO);
setColoredType(); setColoredType();
setPower(0); setPowerToughness(0,1);
setToughness(1);
addManaActivation(new MagicSacrificeManaActivation(Arrays.asList(MagicManaType.Colorless))); addManaActivation(new MagicSacrificeManaActivation(Arrays.asList(MagicManaType.Colorless)));
setExcludeManaOrCombat(); setExcludeManaOrCombat();
} }
@ -444,8 +415,7 @@ public class TokenCardDefinitions {
setSubTypes(new String[]{"Wurm"}); setSubTypes(new String[]{"Wurm"});
setCost(MagicManaCost.ZERO); setCost(MagicManaCost.ZERO);
setColoredType(); setColoredType();
setPower(3); setPowerToughness(3,3);
setToughness(3);
setAbility(MagicAbility.Deathtouch); setAbility(MagicAbility.Deathtouch);
} }
}; };
@ -459,8 +429,7 @@ public class TokenCardDefinitions {
setSubTypes(new String[]{"Wurm"}); setSubTypes(new String[]{"Wurm"});
setCost(MagicManaCost.ZERO); setCost(MagicManaCost.ZERO);
setColoredType(); setColoredType();
setPower(3); setPowerToughness(3,3);
setToughness(3);
setAbility(MagicAbility.LifeLink); setAbility(MagicAbility.LifeLink);
} }
}; };

View File

@ -44,8 +44,7 @@ public class MagicCardDefinition {
addType(MagicType.Creature); addType(MagicType.Creature);
setConvertedCost(8); setConvertedCost(8);
setCost(MagicManaCost.EIGHT); setCost(MagicManaCost.EIGHT);
setPower(1); setPowerToughness(1,1);
setToughness(1);
setAbility(MagicAbility.Defender); setAbility(MagicAbility.Defender);
setAbility(MagicAbility.CannotBeCountered); setAbility(MagicAbility.CannotBeCountered);
setAbility(MagicAbility.Shroud); setAbility(MagicAbility.Shroud);
@ -543,22 +542,20 @@ public class MagicCardDefinition {
addManaActivation(new MagicTapManaActivation(manaTypes,0)); addManaActivation(new MagicTapManaActivation(manaTypes,0));
} }
public void setPower(final int power) {
this.power = power; public void setPowerToughness(final int aPower, final int aToughness) {
power = aPower;
toughness = aToughness;
} }
public int getCardPower() { public int getCardPower() {
return power; return power;
} }
public int getPower(final MagicGame game, final MagicPlayer player) { public int getPower(final MagicGame game, final MagicPlayer player) {
return genPowerToughness(game,player).power(); return genPowerToughness(game,player).power();
} }
public void setToughness(final int toughness) {
this.toughness = toughness;
}
public int getCardToughness() { public int getCardToughness() {
return toughness; return toughness;
} }