- Made some cards ready for multiplayer

- minor style cleanup
This commit is contained in:
moomarc
2013-04-05 08:42:48 +00:00
parent 67bff88772
commit 010c7672ba
5 changed files with 27 additions and 28 deletions

View File

@@ -2,7 +2,7 @@ Name:Havoc
ManaCost:1 R
Types:Enchantment
T:Mode$ SpellCast | ValidCard$ Card.White | ValidActivatingPlayer$ Opponent | TriggerZones$ Battlefield | Execute$ TrigLoseLife | TriggerDescription$ Whenever an opponent casts a white spell, he or she loses 2 life.
SVar:TrigLoseLife:AB$LoseLife | Cost$ 0 | Defined$ Opponent | LifeAmount$ 2
SVar:TrigLoseLife:AB$LoseLife | Cost$ 0 | Defined$ TriggeredActivator | LifeAmount$ 2
SVar:RemRandomDeck:True
SVar:Picture:http://www.wizards.com/global/images/magic/general/havoc.jpg
Oracle:Whenever an opponent casts a white spell, he or she loses 2 life.

View File

@@ -2,10 +2,9 @@ Name:Heartless Hidetsugu
ManaCost:3 R R
Types:Legendary Creature Ogre Shaman
PT:4/3
A:AB$ DealDamage | Cost$ T | Defined$ Opponent | NumDmg$ XOpp | SubAbility$ DBDealDamage | References$ XOpp | SpellDescription$ CARDNAME deals damage to each player equal to half that player's life total, rounded down.
SVar:DBDealDamage:DB$DealDamage | Cost$ 0 | Defined$ You | NumDmg$ XYou | References$ XYou
SVar:XOpp:Count$OppLifeTotal/HalfDown
SVar:XYou:Count$YourLifeTotal/HalfDown
A:AB$ RepeatEach | Cost$ T | RepeatPlayers$ Player | RepeatSubAbility$ DBDealDamage | SpellDescription$ CARDNAME deals damage to each player equal to half that player's life total, rounded down.
SVar:DBDealDamage:DB$ DealDamage | Defined$ Remembered | NumDmg$ HeartlessX | References$ HeartlessX
SVar:HeartlessX:PlayerCountRemembered$LifeTotal/HalfDown
SVar:RemRandomDeck:True
SVar:Picture:http://www.wizards.com/global/images/magic/general/heartless_hidetsugu.jpg
Oracle:{T}: Heartless Hidetsugu deals damage to each player equal to half that player's life total, rounded down.

View File

@@ -1,12 +1,9 @@
Name:Impatience
ManaCost:2 R
Types:Enchantment
T:Mode$ Phase | Phase$ End of Turn | ValidPlayer$ You | CheckSVar$ YouCast | SVarCompare$ EQ0 | Execute$ TrigDamageYou | TriggerZones$ Battlefield | TriggerDescription$ At the beginning of each player's end step, if that player didn't cast a spell this turn, CARDNAME deals 2 damage to him or her.
SVar:TrigDamageYou:AB$ DealDamage | Cost$ 0 | Defined$ You | NumDmg$ 2
T:Mode$ Phase | Phase$ End of Turn | ValidPlayer$ Opponent | CheckSVar$ OppCast | SVarCompare$ EQ0 | Execute$ TrigDamageOpp | TriggerZones$ Battlefield | Secondary$ True | TriggerDescription$ At the beginning of each player's end step, if that player didn't cast a spell this turn, CARDNAME deals 2 damage to him or her.
SVar:TrigDamageOpp:AB$ DealDamage | Cost$ 0 | Defined$ Opponent | NumDmg$ 2
SVar:YouCast:Count$ThisTurnCast_Card.YouCtrl
SVar:OppCast:Count$ThisTurnCast_Card.YouDontCtrl
T:Mode$ Phase | Phase$ End of Turn | CheckSVar$ TrigCast | SVarCompare$ EQ0 | Execute$ ImpatientDamage | TriggerZones$ Battlefield | TriggerDescription$ At the beginning of each player's end step, if that player didn't cast a spell this turn, CARDNAME deals 2 damage to him or her.
SVar:ImpatientDamage:AB$ DealDamage | Cost$ 0 | Defined$ TriggeredPlayer | NumDmg$ 2
SVar:TrigCast:Count$ThisTurnCast_Card.ActivePlayerCtrl
SVar:RemRandomDeck:True
SVar:Picture:http://www.wizards.com/global/images/magic/general/impatience.jpg
Oracle:At the beginning of each player's end step, if that player didn't cast a spell this turn, Impatience deals 2 damage to him or her.

View File

@@ -4,7 +4,7 @@ Types:Creature Merfolk Wizard
PT:2/1
T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ You | Execute$ TrigKinship | TriggerZones$ Battlefield | OptionalDecider$ You | TriggerDescription$ Kinship - At the beginning of your upkeep, you may look at the top card of your library. If it shares a creature type with CARDNAME, you may reveal it. If you do, each opponent puts the top three cards of his or her library into his or her graveyard.
SVar:TrigKinship:DB$ PeekAndReveal | PeekAmount$ 1 | RevealValid$ Card.sharesCreatureTypeWith | RevealOptional$ True | RememberRevealed$ True | SubAbility$ DBMill
SVar:DBMill:DB$ Mill | NumCards$ 3 | Defined$ Opponent | ConditionDefined$ Remembered | ConditionPresent$ Card | ConditionCompare$ EQ1 | SubAbility$ DBCleanup
SVar:DBMill:DB$ Mill | NumCards$ 3 | Defined$ Player.Opponent | ConditionDefined$ Remembered | ConditionPresent$ Card | ConditionCompare$ EQ1 | SubAbility$ DBCleanup
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
SVar:Picture:http://www.wizards.com/global/images/magic/general/ink_dissolver.jpg
Oracle:Kinship - At the beginning of your upkeep, you may look at the top card of your library. If it shares a creature type with Ink Dissolver, you may reveal it. If you do, each opponent puts the top three cards of his or her library into his or her graveyard.

View File

@@ -291,18 +291,17 @@ public class AbilityUtils {
*/
public static int calculateAmount(final Card card, String amount, final SpellAbility ability) {
// return empty strings and constants
if (StringUtils.isBlank(amount)) return 0;
if (StringUtils.isBlank(amount)) { return 0; }
final boolean startsWithPlus = amount.charAt(0) == '+';
if(startsWithPlus) amount = amount.substring(1);
if (startsWithPlus) { amount = amount.substring(1); }
// Strip and save sign for calculations
boolean startsWithMinus = amount.charAt(0) == '-';
int multiplier = startsWithMinus ? -1 : 1;
if(startsWithMinus)
amount = amount.substring(1);
if (startsWithMinus) { amount = amount.substring(1); }
// return result soon for plain numbers
if (StringUtils.isNumeric(amount)) return Integer.parseInt(amount) * multiplier;
if (StringUtils.isNumeric(amount)) { return Integer.parseInt(amount) * multiplier; }
// These are some special cases - who is implementing them?
if (amount.equals("ChosenX") || amount.equals("ChosenY")) {
@@ -320,7 +319,7 @@ public class AbilityUtils {
svarval = ability.getSVar(amount);
}
if (StringUtils.isBlank(svarval)) {
if( ability != null) {
if (ability != null) {
System.err.printf("SVar '%s' not found in ability, fallback to Card (%s). Ability is (%s)%n", amount, card.getName(), ability);
}
svarval = card.getSVar(amount);
@@ -333,21 +332,25 @@ public class AbilityUtils {
}
// Handle numeric constant coming in svar value
if( StringUtils.isNumeric(svarval) )
if (StringUtils.isNumeric(svarval)) {
return multiplier * Integer.parseInt(svarval);
}
// Parse Object$Property string
final String[] calcX = svarval.split("\\$");
// Incorrect parses mean zero.
if ((calcX.length == 1) || calcX[1].equals("none"))
if ((calcX.length == 1) || calcX[1].equals("none")) {
return 0;
}
if (calcX[0].startsWith("Count"))
if (calcX[0].startsWith("Count")) {
return AbilityUtils.xCount(card, calcX[1], ability) * multiplier;
}
if (calcX[0].startsWith("Number"))
if (calcX[0].startsWith("Number")) {
return CardFactoryUtil.xCount(card, svarval) * multiplier;
}
if (calcX[0].startsWith("SVar")) {
final String[] l = calcX[1].split("/");