- Converted Tarmogoyf

This commit is contained in:
swordshine
2013-05-13 00:50:21 +00:00
parent 77fa660693
commit 529ec27359
4 changed files with 68 additions and 80 deletions

View File

@@ -296,7 +296,6 @@ public class StaticEffects {
StaticEffects.cardToEffectsList.put("Liu Bei, Lord of Shu", new String[] { "Liu_Bei" });
StaticEffects.cardToEffectsList.put("Old Man of the Sea", new String[] { "Old_Man_of_the_Sea" });
StaticEffects.cardToEffectsList.put("Tarmogoyf", new String[] { "Tarmogoyf" });
StaticEffects.cardToEffectsList.put("Umbra Stalker", new String[] { "Umbra_Stalker" });
}

View File

@@ -1435,7 +1435,8 @@ public class CardFactoryUtil {
}
return doXMath(cCount, m, c);
}
if (sq[0].contains("CardTypes")) return doXMath(getCardTypesFromList(game.getCardsIn(ZoneType.smartValueOf(sq[1]))), m, c);
if (sq[0].contains("BushidoPoint")) return doXMath(c.getKeywordMagnitude("Bushido"), m, c);
if (sq[0].contains("TimesKicked")) return doXMath(c.getKickerMagnitude(), m, c);
@@ -1967,6 +1968,68 @@ public class CardFactoryUtil {
return filteredkw;
}
/**
* <p>
* getCardTypesFromList.
* </p>
*
* @param list
* a {@link forge.CardList} object.
* @return a int.
*/
public static int getCardTypesFromList(final List<Card> list) {
int count = 0;
for (Card c1 : list) {
if (c1.isCreature()) {
count++;
break;
}
}
for (Card c1 : list) {
if (c1.isSorcery()) {
count++;
break;
}
}
for (Card c1 : list) {
if (c1.isInstant()) {
count++;
break;
}
}
for (Card c1 : list) {
if (c1.isArtifact()) {
count++;
break;
}
}
for (Card c1 : list) {
if (c1.isEnchantment()) {
count++;
break;
}
}
for (Card c1 : list) {
if (c1.isLand()) {
count++;
break;
}
}
for (Card c1 : list) {
if (c1.isPlaneswalker()) {
count++;
break;
}
}
for (Card c1 : list) {
if (c1.isTribal()) {
count++;
break;
}
}
return count;
}
/**
* <p>
* getBushidoEffects.

View File

@@ -999,81 +999,6 @@ public final class GameActionUtil {
}; // Liu_Bei
/** Constant <code>Tarmogoyf</code>. */
private static Function<GameState, ?> tarmogoyf = new Function<GameState, Object>() {
@Override
public Object apply(GameState game) {
// get all creatures
final List<Card> list = CardLists.filter(game.getCardsIn(ZoneType.Battlefield), CardPredicates.nameEquals("Tarmogoyf"));
for (int i = 0; i < list.size(); i++) {
final Card c = list.get(i);
c.setBaseAttack(this.countDiffTypes(game));
c.setBaseDefense(c.getBaseAttack() + 1);
}
return null;
} // execute()
private int countDiffTypes(GameState game) {
final List<Card> list = game.getCardsIn(ZoneType.Graveyard);
int count = 0;
for (Card c : list) {
if (c.isCreature()) {
count++;
break;
}
}
for (Card c : list) {
if (c.isSorcery()) {
count++;
break;
}
}
for (Card c : list) {
if (c.isInstant()) {
count++;
break;
}
}
for (Card c : list) {
if (c.isArtifact()) {
count++;
break;
}
}
for (Card c : list) {
if (c.isEnchantment()) {
count++;
break;
}
}
for (Card c : list) {
if (c.isLand()) {
count++;
break;
}
}
for (Card c : list) {
if (c.isPlaneswalker()) {
count++;
break;
}
}
for (Card c : list) {
if (c.isTribal()) {
count++;
break;
}
}
return count;
}
};
/** Constant <code>commands</code>. */
private final static HashMap<String, Function<GameState, ?>> commands = new HashMap<String, Function<GameState, ?>>();
@@ -1082,7 +1007,6 @@ public final class GameActionUtil {
GameActionUtil.getCommands().put("Liu_Bei", GameActionUtil.liuBei);
GameActionUtil.getCommands().put("Old_Man_of_the_Sea", GameActionUtil.oldManOfTheSea);
GameActionUtil.getCommands().put("Tarmogoyf", GameActionUtil.tarmogoyf);
GameActionUtil.getCommands().put("Umbra_Stalker", GameActionUtil.umbraStalker);
// The commands above are in alphabetical order by cardname.