- Added Call to Arms

This commit is contained in:
swordshine
2013-12-01 05:34:21 +00:00
parent 3d063d8188
commit 53e6671143
3 changed files with 49 additions and 0 deletions

View File

@@ -1117,6 +1117,13 @@ public class CardFactoryUtil {
return doXMath(getMostProminentCreatureTypeSize(list), m, c);
}
if (l[0].startsWith("SecondMostProminentColor")) {
String restriction = l[0].split(" ")[1];
List<Card> list = CardLists.getValidCards(game.getCardsIn(ZoneType.Battlefield), restriction, cc, c);
int[] colorSize = SortColorsFromList(list);
return doXMath(colorSize[colorSize.length - 2], m, c);
}
if (l[0].startsWith("RolledThisTurn")) {
return game.getPhaseHandler().getPlanarDiceRolledthisTurn();
}
@@ -1822,6 +1829,33 @@ public class CardFactoryUtil {
return mask;
}
/**
* <p>
* SortColorsFromList.
* </p>
*
* @param list
* a {@link forge.CardList} object.
* @return a List.
*/
public static int[] SortColorsFromList(final List<Card> list) {
int cntColors = MagicColor.WUBRG.length;
final int[] map = new int[cntColors];
for(int i = 0; i < cntColors; i++) {
map[i] = 0;
}
for (final Card crd : list) {
ColorSet color = CardUtil.getColors(crd);
for(int i = 0; i < cntColors; i++) {
if( color.hasAnyColor(MagicColor.WUBRG[i]))
map[i]++;
}
} // for
Arrays.sort(map);
return map;
}
/**
* <p>
* getMostProminentColorsFromList.