remove card specific code in favor or reusable code.

This commit is contained in:
jendave
2011-08-06 09:38:39 +00:00
parent 723a9ac1b1
commit 7cef6ebd4e
3 changed files with 7 additions and 33 deletions

View File

@@ -2622,7 +2622,7 @@ public class CombatUtil {
Player phasingPlayer = c.getController();
// Finest Hour untaps the creature on the first combat phase
if ((GameActionUtil.countFinestHours(phasingPlayer)>0) &&
if ((AllZoneUtil.getPlayerCardsInPlay(phasingPlayer, "Finest Hour").size() > 0) &&
AllZone.Phase.isFirstCombat()) {
// Untap the attacking creature
Ability fhUntap = new Ability(c, "0") {
@@ -2634,7 +2634,7 @@ public class CombatUtil {
AllZone.Stack.add(fhUntap);
// If any Finest Hours, queue up a new combat phase
for (int ix = 0; ix < GameActionUtil.countFinestHours(phasingPlayer); ix++) {
for (int ix = 0; ix < AllZoneUtil.getPlayerCardsInPlay(phasingPlayer, "Finest Hour").size(); ix++) {
Ability fhAddCombat = new Ability(c, "0") {
public void resolve() {
AllZone.Phase.addExtraCombat(crd.getController());
@@ -2644,7 +2644,7 @@ public class CombatUtil {
AllZone.Stack.add(fhAddCombat);
}
}
if(GameActionUtil.isRafiqInPlay(phasingPlayer)) {
if(AllZoneUtil.isCardInPlay("Rafiq of the Many", phasingPlayer)) {
Ability ability2 = new Ability(c, "0") {
@Override
public void resolve() {

View File

@@ -102,7 +102,7 @@ import java.util.*;
// it won't be surprised by Exalted
int humanExaltedBonus = countExaltedBonus(AllZone.HumanPlayer);
if (humanExaltedBonus > 0) {
int nFinestHours = GameActionUtil.countFinestHours(AllZone.HumanPlayer);
int nFinestHours = AllZoneUtil.getPlayerCardsInPlay(AllZone.HumanPlayer, "Finest Hour").size();
if ( (blockersNeeded == 0 || nFinestHours > 0) && humanList.size() > 0) {
//
@@ -112,7 +112,7 @@ import java.util.*;
// For Finest Hour, one creature could attack and get the bonus TWICE
humanBaseAttack = humanBaseAttack + humanExaltedBonus;
}
int totalExaltedAttack = GameActionUtil.isRafiqInPlay(AllZone.HumanPlayer) ?
int totalExaltedAttack = AllZoneUtil.isCardInPlay("Rafiq of the Many", AllZone.HumanPlayer) ?
2 * humanBaseAttack: humanBaseAttack;
if ((AllZone.ComputerPlayer.getLife() - 3) <= totalExaltedAttack) {
// We will lose if there is an Exalted attack -- keep one blocker
@@ -180,9 +180,9 @@ import java.util.*;
}
if (combat.getAttackers().length == 0 && (countExaltedBonus(AllZone.ComputerPlayer) >= 3 ||
GameActionUtil.isRafiqInPlay(AllZone.ComputerPlayer) ||
AllZoneUtil.isCardInPlay("Rafiq of the Many", AllZone.ComputerPlayer) ||
AllZoneUtil.getPlayerCardsInPlay(AllZone.ComputerPlayer, "Battlegrace Angel").size() >= 2 ||
(GameActionUtil.countFinestHours(AllZone.ComputerPlayer)>=1) && AllZone.Phase.isFirstCombat())
(AllZoneUtil.getPlayerCardsInPlay(AllZone.ComputerPlayer, "Finest Hour").size()>=1) && AllZone.Phase.isFirstCombat())
&& !doAssault())
{
int biggest = 0;

View File

@@ -3919,32 +3919,6 @@ public class GameActionUtil {
AllZone.GameInfo.setResolvedFirstStrikeDamageThisCombat(false);
}
public static boolean isRafiqInPlay(Player player) {
PlayerZone playerZone = AllZone.getZone(Constant.Zone.Play, player);
CardList cards = new CardList();
cards.addAll(playerZone.getCards());
cards = cards.getName("Rafiq of the Many");
if(cards.size() >= 1) // should only be 1, since Rafiq is Legendary
return true;
else return false;
}
public static int countFinestHours(Player controller) {
PlayerZone playerZone = AllZone.getZone(Constant.Zone.Play, controller);
CardList cards = new CardList();
cards.addAll(playerZone.getCards());
cards = cards.getName("Finest Hour");
return cards.size();
}
public static void executeAllyEffects(Card c) {
if(c.getName().equals("Kazandu Blademaster") || c.getName().equals("Makindi Shieldmate")
|| c.getName().equals("Nimana Sell-Sword") || c.getName().equals("Oran-Rief Survivalist")