- Changed a bunch of things in the checkDeclareBlockers code (for some reason it gets called multiple times).

This commit is contained in:
jendave
2011-08-06 03:42:20 +00:00
parent 8f01de4968
commit 936ee0bcde
7 changed files with 165 additions and 112 deletions

View File

@@ -1,3 +1,10 @@
Perimeter Captain
W
Creature Human Soldier
Whenever a creature you control with defender blocks, you may gain 2 life.
0/4
Defender
Sejiri Merfolk
1 U
Creature Merfolk Soldier

View File

@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<java version="1.6.0_16" class="java.beans.XMLDecoder">
<java version="1.6.0_18" class="java.beans.XMLDecoder">
<object id="MultiSplitLayout$Split0" class="org.jdesktop.swingx.MultiSplitLayout$Split">
<void property="bounds">
<object class="java.awt.Rectangle">
<int>0</int>
<int>0</int>
<int>1280</int>
<int>707</int>
<int>1440</int>
<int>827</int>
</object>
</void>
<void id="ArrayList0" property="children">
@@ -17,7 +17,7 @@
<int>0</int>
<int>0</int>
<int>276</int>
<int>707</int>
<int>827</int>
</object>
</void>
<void id="ArrayList1" property="children">
@@ -28,7 +28,7 @@
<int>0</int>
<int>0</int>
<int>276</int>
<int>135</int>
<int>151</int>
</object>
</void>
<void property="name">
@@ -47,7 +47,7 @@
<void property="bounds">
<object class="java.awt.Rectangle">
<int>0</int>
<int>135</int>
<int>151</int>
<int>276</int>
<int>10</int>
</object>
@@ -62,9 +62,9 @@
<void property="bounds">
<object class="java.awt.Rectangle">
<int>0</int>
<int>145</int>
<int>161</int>
<int>276</int>
<int>132</int>
<int>166</int>
</object>
</void>
<void property="name">
@@ -83,7 +83,7 @@
<void property="bounds">
<object class="java.awt.Rectangle">
<int>0</int>
<int>277</int>
<int>327</int>
<int>276</int>
<int>10</int>
</object>
@@ -98,9 +98,9 @@
<void property="bounds">
<object class="java.awt.Rectangle">
<int>0</int>
<int>287</int>
<int>337</int>
<int>276</int>
<int>107</int>
<int>125</int>
</object>
</void>
<void property="name">
@@ -119,7 +119,7 @@
<void property="bounds">
<object class="java.awt.Rectangle">
<int>0</int>
<int>394</int>
<int>462</int>
<int>276</int>
<int>10</int>
</object>
@@ -134,9 +134,9 @@
<void property="bounds">
<object class="java.awt.Rectangle">
<int>0</int>
<int>404</int>
<int>472</int>
<int>276</int>
<int>141</int>
<int>159</int>
</object>
</void>
<void property="name">
@@ -155,7 +155,7 @@
<void property="bounds">
<object class="java.awt.Rectangle">
<int>0</int>
<int>545</int>
<int>631</int>
<int>276</int>
<int>10</int>
</object>
@@ -170,9 +170,9 @@
<void property="bounds">
<object class="java.awt.Rectangle">
<int>0</int>
<int>555</int>
<int>641</int>
<int>276</int>
<int>152</int>
<int>186</int>
</object>
</void>
<void property="name">
@@ -205,7 +205,7 @@
<int>276</int>
<int>0</int>
<int>10</int>
<int>707</int>
<int>827</int>
</object>
</void>
<void property="parent">
@@ -219,8 +219,8 @@
<object class="java.awt.Rectangle">
<int>286</int>
<int>0</int>
<int>747</int>
<int>707</int>
<int>803</int>
<int>827</int>
</object>
</void>
<void id="ArrayList2" property="children">
@@ -230,8 +230,8 @@
<object class="java.awt.Rectangle">
<int>286</int>
<int>0</int>
<int>747</int>
<int>124</int>
<int>803</int>
<int>148</int>
</object>
</void>
<void property="name">
@@ -250,8 +250,8 @@
<void property="bounds">
<object class="java.awt.Rectangle">
<int>286</int>
<int>124</int>
<int>747</int>
<int>148</int>
<int>803</int>
<int>10</int>
</object>
</void>
@@ -265,9 +265,9 @@
<void property="bounds">
<object class="java.awt.Rectangle">
<int>286</int>
<int>134</int>
<int>747</int>
<int>121</int>
<int>158</int>
<int>803</int>
<int>145</int>
</object>
</void>
<void property="name">
@@ -286,8 +286,8 @@
<void property="bounds">
<object class="java.awt.Rectangle">
<int>286</int>
<int>255</int>
<int>747</int>
<int>303</int>
<int>803</int>
<int>10</int>
</object>
</void>
@@ -301,9 +301,9 @@
<void property="bounds">
<object class="java.awt.Rectangle">
<int>286</int>
<int>265</int>
<int>747</int>
<int>162</int>
<int>313</int>
<int>803</int>
<int>174</int>
</object>
</void>
<void property="name">
@@ -322,8 +322,8 @@
<void property="bounds">
<object class="java.awt.Rectangle">
<int>286</int>
<int>427</int>
<int>747</int>
<int>487</int>
<int>803</int>
<int>10</int>
</object>
</void>
@@ -337,9 +337,9 @@
<void property="bounds">
<object class="java.awt.Rectangle">
<int>286</int>
<int>437</int>
<int>747</int>
<int>122</int>
<int>497</int>
<int>803</int>
<int>158</int>
</object>
</void>
<void property="name">
@@ -358,8 +358,8 @@
<void property="bounds">
<object class="java.awt.Rectangle">
<int>286</int>
<int>559</int>
<int>747</int>
<int>655</int>
<int>803</int>
<int>10</int>
</object>
</void>
@@ -373,9 +373,9 @@
<void property="bounds">
<object class="java.awt.Rectangle">
<int>286</int>
<int>569</int>
<int>747</int>
<int>138</int>
<int>665</int>
<int>803</int>
<int>162</int>
</object>
</void>
<void property="name">
@@ -408,10 +408,10 @@
<object class="org.jdesktop.swingx.MultiSplitLayout$Divider">
<void property="bounds">
<object class="java.awt.Rectangle">
<int>1033</int>
<int>1089</int>
<int>0</int>
<int>10</int>
<int>707</int>
<int>827</int>
</object>
</void>
<void property="parent">
@@ -423,10 +423,10 @@
<object id="MultiSplitLayout$Split3" class="org.jdesktop.swingx.MultiSplitLayout$Split">
<void property="bounds">
<object class="java.awt.Rectangle">
<int>1043</int>
<int>1099</int>
<int>0</int>
<int>237</int>
<int>707</int>
<int>341</int>
<int>827</int>
</object>
</void>
<void id="ArrayList3" property="children">
@@ -434,10 +434,10 @@
<object class="org.jdesktop.swingx.MultiSplitLayout$Leaf">
<void property="bounds">
<object class="java.awt.Rectangle">
<int>1043</int>
<int>1099</int>
<int>0</int>
<int>237</int>
<int>368</int>
<int>341</int>
<int>360</int>
</object>
</void>
<void property="name">
@@ -455,9 +455,9 @@
<object class="org.jdesktop.swingx.MultiSplitLayout$Divider">
<void property="bounds">
<object class="java.awt.Rectangle">
<int>1043</int>
<int>368</int>
<int>237</int>
<int>1099</int>
<int>360</int>
<int>341</int>
<int>10</int>
</object>
</void>
@@ -470,10 +470,10 @@
<object class="org.jdesktop.swingx.MultiSplitLayout$Leaf">
<void property="bounds">
<object class="java.awt.Rectangle">
<int>1043</int>
<int>378</int>
<int>237</int>
<int>329</int>
<int>1099</int>
<int>370</int>
<int>341</int>
<int>457</int>
</object>
</void>
<void property="name">

View File

@@ -39,4 +39,20 @@ snow_covered_swamp1.jpg http://[server]/CS/Snow-Covered%20Swamp.full.jpg
snow_covered_swamp2.jpg http://[server]/IA/Snow-Covered%20Swamp.full.jpg
snow_covered_swamp3.jpg http://[server]/IA/Snow-Covered%20Swamp.full.jpg
_____.jpg http://[server]/UNH/_____.full.jpg
snow_covered_forest1.jpg http://[server]/CS/Snow-Covered%20Forest.full.jpg
snow_covered_forest2.jpg http://[server]/CS/Snow-Covered%20Forest.full.jpg
snow_covered_forest3.jpg http://[server]/CS/Snow-Covered%20Forest.full.jpg
snow_covered_island1.jpg http://[server]/CS/Snow-Covered%20Island.full.jpg
snow_covered_island2.jpg http://[server]/CS/Snow-Covered%20Island.full.jpg
snow_covered_island3.jpg http://[server]/CS/Snow-Covered%20Island.full.jpg
snow_covered_mountain1.jpg http://[server]/CS/Snow-Covered%20Mountain.full.jpg
snow_covered_mountain2.jpg http://[server]/CS/Snow-Covered%20Mountain.full.jpg
snow_covered_mountain3.jpg http://[server]/CS/Snow-Covered%20Mountain.full.jpg
snow_covered_plains1.jpg http://[server]/CS/Snow-Covered%20Plains.full.jpg
snow_covered_plains2.jpg http://[server]/CS/Snow-Covered%20Plains.full.jpg
snow_covered_plains3.jpg http://[server]/CS/Snow-Covered%20Plains.full.jpg
snow_covered_swamp1.jpg http://[server]/CS/Snow-Covered%20Swamp.full.jpg
snow_covered_swamp2.jpg http://[server]/CS/Snow-Covered%20Swamp.full.jpg
snow_covered_swamp3.jpg http://[server]/CS/Snow-Covered%20Swamp.full.jpg
snow_devil.jpg http://[server]/IA/Snow%20Devil.full.jpg
1996_world_champion.jpg http://[server]/PR/1996%20World%20Champion.full.jpg

Binary file not shown.

View File

@@ -3122,6 +3122,8 @@ public class CardFactoryUtil {
c.unEquipAllCards();
}
*/
//may return null
static public Card getRandomCard(CardList list) {
if(list.size() == 0) return null;

View File

@@ -1449,9 +1449,39 @@ public class CombatUtil {
}
static void checkDeclareBlockers(Card c) {
static void checkDeclareBlockers(CardList cl) {
if(AllZone.Phase.getPhase().equals(Constant.Phase.Combat_After_Declare_Blockers)) {
for (Card c:cl)
{
if (c.getKeyword().contains("Defender") && !c.getCreatureBlockedThisTurn())
{
final Card crd = c;
CardList pcs = CardFactoryUtil.getCards("Perimeter Captain", c.getController());
for (int i = 0; i < pcs.size();i++)
{
Ability ability = new Ability(pcs.get(i), "0")
{
public void resolve()
{
AllZone.GameAction.addLife(crd.getController(), 2);
}
};
ability.setStackDescription(pcs.get(i) + " - " + c.getController() + " gains 2 life.");
if (c.getController().equals(Constant.Player.Human)) {
String[] choices = {"Yes", "No"};
Object q = null;
q = AllZone.Display.getChoiceOptional("Gain 2 life from Perimeter Captain?", choices);
if (q != null)
if (q.equals("Yes"))
AllZone.Stack.add(ability);
}
else
AllZone.Stack.add(ability);
}
}
if(c.getName().equals("Jedit Ojanen of Efrava") && !c.getCreatureBlockedThisTurn()) {
Card card = new Card();
@@ -1475,18 +1505,11 @@ public class CombatUtil {
//(anger) :
GameActionUtil.executeCardStateEffects();
c.setCreatureBlockedThisTurn(true);
}//Jedit
else if(c.getName().equals("Shield Sphere") && !c.getCreatureBlockedThisTurn()) {
//int toughness = c.getNetDefense();
//c.setDefense(toughness-1);
c.addCounter(Counters.P0M1, 1);
c.setCreatureBlockedThisTurn(true);
//ability2.setStackDescription(c.getName() + " blocks and gets a 0/-1 counter.");
//AllZone.Stack.add(ability2);
@@ -1496,17 +1519,17 @@ public class CombatUtil {
PlayerLife oppLife = AllZone.GameAction.getPlayerLife(AllZone.GameAction.getOpponent(c.getController()));
oppLife.subtractLife(c.getNetAttack());
c.setCreatureBlockedThisTurn(true);
//ability2.setStackDescription(c.getName() + " blocks and deals damage equal to its power to attacking player.");
//AllZone.Stack.add(ability2);
}//Shield Sphere
c.setCreatureBlockedThisTurn(true);
}//for
}//if Phase == declare blockers
}//if Phase == after declare blockers
}//checkDeclareBlockers
public static void checkBlockedAttackers(Card a, Card b) {
//System.out.println(a.getName() + " got blocked by " + b.getName());

View File

@@ -291,6 +291,12 @@ public class ComputerAI_General implements Computer {
CardList list = new CardList();
list.addAll(AllZone.Combat.getAllBlockers().toArray());
list.addAll(AllZone.pwCombat.getAllBlockers().toArray());
list = list.filter(new CardListFilter(){
public boolean addCard(Card c)
{
return !c.getCreatureBlockedThisTurn();
}
});
CardList attList = new CardList();
attList.addAll(AllZone.Combat.getAttackers());
@@ -298,8 +304,7 @@ public class ComputerAI_General implements Computer {
CardList pwAttList = new CardList();
pwAttList.addAll(AllZone.pwCombat.getAttackers());
for(Card c:list)
CombatUtil.checkDeclareBlockers(c);
CombatUtil.checkDeclareBlockers(list);
for (Card a:attList){
CardList blockList = AllZone.Combat.getBlockers(a);