- Fixed the crash that happens when destroying tokens.

- Fixed the Hunted creatures (tokens will be given to the opponent).
- Academy Rector can now fetch Auras and attach them to creatures (or lands).
- Fixed Crib Swap and Pongify.
This commit is contained in:
jendave
2011-08-06 03:21:42 +00:00
parent b8dff6960c
commit 7e94d1050f
5 changed files with 91 additions and 12 deletions

View File

@@ -187,7 +187,7 @@ public class Card extends MyObservable
return !hasFirstStrike() || (hasFirstStrike() && hasDoubleStrike()); return !hasFirstStrike() || (hasFirstStrike() && hasDoubleStrike());
}; };
//for Planeswalker abilities and Effects (like Wither), Doubling Season gets ignored. //for Planeswalker abilities and Combat Damage (like Wither), Doubling Season gets ignored.
public void addCounterFromNonEffect(Counters counterName, int n) public void addCounterFromNonEffect(Counters counterName, int n)
{ {
if(counters.containsKey(counterName)) if(counters.containsKey(counterName))
@@ -684,7 +684,7 @@ public class Card extends MyObservable
public String getController(){return controller;} public String getController(){return controller;}
public void setName(String s) {name = s; this.updateObservers();} public void setName(String s) {name = s; this.updateObservers();}
public void setOwner(String player) {owner = player;} public void setOwner(String player) {owner = player; this.updateObservers();}
public void setController(String player){controller = player; this.updateObservers();} public void setController(String player){controller = player; this.updateObservers();}
public ArrayList<Card> getEquippedBy() public ArrayList<Card> getEquippedBy()

View File

@@ -4230,7 +4230,8 @@ public class CardFactory implements NewConstants {
{ {
if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card,getTargetCard()) ) if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card,getTargetCard()) )
{ {
CardFactoryUtil.makeToken("Ape", "G 3 3 Ape", card, "G", new String[] {"Creature", "Ape"}, 3, 3, new String[] {""} ); CardFactoryUtil.makeToken("Ape", "G 3 3 Ape", AllZone.GameAction.getOpponent(card.getController()), "G",
new String[] {"Creature", "Ape"}, 3, 3, new String[] {""} );
AllZone.GameAction.destroyNoRegeneration(getTargetCard()); AllZone.GameAction.destroyNoRegeneration(getTargetCard());
} }
}//resolve() }//resolve()
@@ -5593,7 +5594,8 @@ public class CardFactory implements NewConstants {
{ {
if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()) ) if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()) )
{ {
CardFactoryUtil.makeToken("Shapeshifter", "C 1 1 Shapeshifter", card, "", new String[] {"Creature", "Shapeshifter"}, 1, 1, new String[] {"Changeling"} ); CardFactoryUtil.makeToken("Shapeshifter", "C 1 1 Shapeshifter", AllZone.GameAction.getOpponent(card.getController()), "",
new String[] {"Creature", "Shapeshifter"}, 1, 1, new String[] {"Changeling"} );
//remove card from play //remove card from play
AllZone.GameAction.removeFromGame(getTargetCard()); AllZone.GameAction.removeFromGame(getTargetCard());
} }
@@ -17260,6 +17262,11 @@ return land.size() > 1 && CardFactoryUtil.AI_isMainPhase();
c.setText(sim.getSpellText()); c.setText(sim.getSpellText());
c.setManaCost(sim.getManaCost()); c.setManaCost(sim.getManaCost());
if (!sim.getOwner().equals(""))
c.setOwner(sim.getOwner());
if (!sim.getController().equals(""))
c.setController(sim.getController());
return c; return c;
}// copyStats() }// copyStats()

View File

@@ -3185,8 +3185,8 @@ public class CardFactoryUtil
c.setName(name); c.setName(name);
c.setImageName(imageName); c.setImageName(imageName);
c.setOwner(source.getController());
c.setController(source.getController()); c.setController(source.getController());
c.setOwner(source.getOwner());
c.setManaCost(manaCost); c.setManaCost(manaCost);
c.setToken(true); c.setToken(true);
@@ -3217,6 +3217,45 @@ public class CardFactoryUtil
} }
public static CardList makeToken(String name, String imageName, String controller, String manaCost, String[] types, int baseAttack, int baseDefense,
String[] intrinsicKeywords)
{
CardList list = new CardList();
Card c = new Card();
c.setName(name);
c.setImageName(imageName);
c.setController(controller);
c.setOwner(controller);
c.setManaCost(manaCost);
c.setToken(true);
for (String t : types)
c.addType(t);
c.setBaseAttack(baseAttack);
c.setBaseDefense(baseDefense);
for (String kw : intrinsicKeywords)
c.addIntrinsicKeyword(kw);
PlayerZone play = AllZone.getZone(Constant.Zone.Play, controller);
int multiplier = 1;
int doublingSeasons = CardFactoryUtil.getCards("Doubling Season", controller).size();
if (doublingSeasons > 0)
multiplier = (int) Math.pow(2, doublingSeasons);
for (int i=0;i<multiplier;i++) {
Card temp = CardFactory.copyStats(c);
temp.setToken(true);
play.add(temp);
list.add(temp);
}
return list;
}
//may return null //may return null
static public Card getRandomCard(CardList list) static public Card getRandomCard(CardList list)
{ {

View File

@@ -1343,8 +1343,9 @@ public class CardFactory_Creatures {
{ {
public void resolve() public void resolve()
{ {
String opp = AllZone.GameAction.getOpponent(card.getController());
for(int i = 0; i < 5; i++) for(int i = 0; i < 5; i++)
CardFactoryUtil.makeToken("Goblin", "R 1 1 Goblin", card, "R", new String[]{"Creature", "Goblin"}, 1, 1, new String[] {""}); CardFactoryUtil.makeToken("Goblin", "R 1 1 Goblin", opp, "R", new String[]{"Creature", "Goblin"}, 1, 1, new String[] {""});
} }
};//SpellAbility };//SpellAbility
@@ -1369,8 +1370,9 @@ public class CardFactory_Creatures {
{ {
public void resolve() public void resolve()
{ {
String opp = AllZone.GameAction.getOpponent(card.getController());
for(int i = 0; i < 2; i++) for(int i = 0; i < 2; i++)
CardFactoryUtil.makeToken("Centaur", "G 3 3 Centaur", card, "G", new String[]{"Creature", "Centaur"}, 3, 3, CardFactoryUtil.makeToken("Centaur", "G 3 3 Centaur", opp, "G", new String[]{"Creature", "Centaur"}, 3, 3,
new String[] {"Protection from black"}); new String[] {"Protection from black"});
} }
};//SpellAbility };//SpellAbility
@@ -1393,9 +1395,11 @@ public class CardFactory_Creatures {
{ {
final SpellAbility ability = new Ability(card, "0") final SpellAbility ability = new Ability(card, "0")
{ {
public void resolve() public void resolve()
{ {
CardFactoryUtil.makeToken("Horror", "B 4 4 Horror", card, "B", new String[]{"Creature", "Horror"}, 4, 4, new String[] {""}); String opp = AllZone.GameAction.getOpponent(card.getController());
CardFactoryUtil.makeToken("Horror", "B 4 4 Horror", opp, "B", new String[]{"Creature", "Horror"}, 4, 4, new String[] {""});
} }
};//SpellAbility };//SpellAbility
@@ -1420,8 +1424,9 @@ public class CardFactory_Creatures {
{ {
public void resolve() public void resolve()
{ {
String opp = AllZone.GameAction.getOpponent(card.getController());
for(int i = 0; i < 3; i++) for(int i = 0; i < 3; i++)
CardFactoryUtil.makeToken("Knight", "W 2 2 Knight", card, "W", new String[]{"Creature", "Knight"}, 2, 2, new String[] {"First Strike"}); CardFactoryUtil.makeToken("Knight", "W 2 2 Knight", opp, "W", new String[]{"Creature", "Knight"}, 2, 2, new String[] {"First Strike"});
} }
};//SpellAbility };//SpellAbility
@@ -1446,8 +1451,9 @@ public class CardFactory_Creatures {
{ {
public void resolve() public void resolve()
{ {
String opp = AllZone.GameAction.getOpponent(card.getController());
for(int i = 0; i < 4; i++) for(int i = 0; i < 4; i++)
CardFactoryUtil.makeToken("Faerie", "U 1 1 Faerie", card, "U", new String[]{"Creature", "Faerie"}, 1, 1, new String[] {"Flying"}); CardFactoryUtil.makeToken("Faerie", "U 1 1 Faerie", opp, "U", new String[]{"Creature", "Faerie"}, 1, 1, new String[] {"Flying"});
} }
};//SpellAbility };//SpellAbility
@@ -16238,9 +16244,37 @@ public class CardFactory_Creatures {
if (o != null) if (o != null)
{ {
PlayerZone play = AllZone.getZone(Constant.Zone.Play, Constant.Player.Human); PlayerZone play = AllZone.getZone(Constant.Zone.Play, Constant.Player.Human);
PlayerZone oppPlay = AllZone.getZone(Constant.Zone.Play, Constant.Player.Computer);
Card c = (Card)o; Card c = (Card)o;
lib.remove(c); lib.remove(c);
play.add(c); play.add(c);
if (c.isAura())
{
Object obj = null;
if (c.getKeyword().contains("Enchant creature"))
{
CardList creats = new CardList(play.getCards());
creats.addAll(oppPlay.getCards());
creats = creats.getType("Creature");
obj = AllZone.Display.getChoiceOptional("Pick a creature to attach "+c.getName() + " to",creats.toArray() );
}
else if (c.getKeyword().contains("Enchant land") || c.getKeyword().contains("Enchant land you control"))
{
CardList lands = new CardList(play.getCards());
//lands.addAll(oppPlay.getCards());
lands = lands.getType("Land");
if (lands.size() > 0)
obj = AllZone.Display.getChoiceOptional("Pick a land to attach "+c.getName() + " to",lands.toArray() );
}
if (obj != null)
{
Card target = (Card)obj;
if(AllZone.GameAction.isCardInPlay(target)) {
c.enchantCard(target);
}
}
}
} }
} }
AllZone.GameAction.removeFromGame(card); AllZone.GameAction.removeFromGame(card);

View File

@@ -1146,7 +1146,6 @@ public class CombatUtil
crd.enchantCard(target); crd.enchantCard(target);
} }
} }
} }
AllZone.GameAction.shuffle(c.getController()); AllZone.GameAction.shuffle(c.getController());
//we have to have cards like glorious anthem take effect immediately: //we have to have cards like glorious anthem take effect immediately: