*Changed the counters-property to "counters_<Comparator><Value>_<CounterType>" Where

<Comparator> = LT or LE or EQ or NE or GE or GT
     <Value> = Integer or SVarname
     <CounterType> = Any countertype
     Separating it like this removes the restrictions that only X or Y could be used for SVarNames or single digits for integers.
     Unfortunately it also makes for a massive commit.
*Changed all cards that use the counters-property to the new format.
*Converted Helix Pinnacle to script.
This commit is contained in:
Hellfish
2011-09-19 10:43:23 +00:00
parent 6bcd32193b
commit 58f4b5e7a8
81 changed files with 126 additions and 155 deletions

View File

@@ -14,6 +14,7 @@ import java.util.TreeMap;
import com.esotericsoftware.minlog.Log;
import forge.Constant.Zone;
import forge.card.abilityFactory.AbilityFactory;
import forge.card.cardFactory.CardFactoryUtil;
import forge.card.cost.Cost;
import forge.card.mana.ManaCost;
@@ -5108,17 +5109,20 @@ public class Card extends GameEntity implements Comparable<Card> {
// TODO: get a working regex out of this pattern so the amount of digits doesn't matter
int number = 0;
if (Property.substring(10, 11).equals("X"))
number = CardFactoryUtil.xCount(source, getSVar("X"));
else if (Property.substring(10, 11).equals("Y"))
number = CardFactoryUtil.xCount(source, getSVar("Y"));
else
number = Integer.parseInt(Property.substring(10, 11));
String type = Property.substring(11);
String comparator = Property.substring(8, 10); // comparator = EQ, LE, GE etc.
int actualnumber = getCounters(Counters.getType(type));
String[] splitProperty = Property.split("_");
String strNum = splitProperty[1].substring(2);
String comparator = splitProperty[1].substring(0,2);
String counterType = "";
try {
number = Integer.parseInt(strNum);
}
catch(NumberFormatException e) {
number = CardFactoryUtil.xCount(source, source.getSVar(strNum));
}
counterType = splitProperty[2];
int actualnumber = getCounters(Counters.getType(counterType));
if (!AllZoneUtil.compare(actualnumber, comparator, number))
return false;
} else if (Property.startsWith("attacking")) {

View File

@@ -117,7 +117,6 @@ public class Upkeep implements java.io.Serializable {
//Win / Lose
// Checks for can't win or can't lose happen in Player.altWinConditionMet()
upkeep_Helix_Pinnacle();
upkeep_Barren_Glory();
upkeep_Karma();
@@ -2318,37 +2317,6 @@ public class Upkeep implements java.io.Serializable {
} // for
} // upkeep_Power_Surge()
/**
* <p>upkeep_Helix_Pinnacle.</p>
*/
private static void upkeep_Helix_Pinnacle() {
final Player player = AllZone.getPhase().getPlayerTurn();
CardList list = player.getCardsIn(Zone.Battlefield, "Helix Pinnacle");
for (final Card c : list) {
if (c.getCounters(Counters.TOWER) < 100) {
continue;
}
Ability ability = new Ability(c, "0") {
@Override
public void resolve() {
if (c.getCounters(Counters.TOWER) >= 100) {
player.altWinBySpellEffect(c.getName());
}
}
}; // Ability
StringBuilder sb = new StringBuilder();
sb.append("Helix Pinnacle - ").append(player).append(" wins the game");
ability.setStackDescription(sb.toString());
AllZone.getStack().addSimultaneousStackEntry(ability);
} // if
} // upkeep_Helix_Pinnacle
/**
* <p>upkeep_Barren_Glory.</p>
*/