This commit is contained in:
jendave
2011-08-07 00:46:28 +00:00
parent a03c2a2669
commit e100ec7b67
8 changed files with 35 additions and 18 deletions

View File

@@ -2016,7 +2016,7 @@ public class Card extends MyObservable {
} }
public int getNetAttack() { public int getNetAttack() {
if(this.getAmountOfKeyword("CARDNAME's power and toughness are switched") % 2 == 1 ) return getUnswitchedDefense(); if(this.getAmountOfKeyword("CARDNAME's power and toughness are switched") % 2 != 0 ) return getUnswitchedDefense();
else return getUnswitchedAttack(); else return getUnswitchedAttack();
} }
@@ -2032,7 +2032,7 @@ public class Card extends MyObservable {
} }
public int getNetDefense() { public int getNetDefense() {
if(this.getAmountOfKeyword("CARDNAME's power and toughness are switched") % 2 == 1 ) return getUnswitchedAttack(); if(this.getAmountOfKeyword("CARDNAME's power and toughness are switched") % 2 != 0 ) return getUnswitchedAttack();
else return getUnswitchedDefense(); else return getUnswitchedDefense();
} }

View File

@@ -7322,8 +7322,8 @@ public class GameActionUtil {
if(!k[4].equalsIgnoreCase("no colors")) { if(!k[4].equalsIgnoreCase("no colors")) {
colors = k[4]; colors = k[4];
if(colors.contains(",Overwrite") || colors.contains("Overwrite")) { if(colors.contains(",Overwrite") || colors.contains("Overwrite")) {
colors.replace(",Overwrite",""); colors = colors.replace(",Overwrite","");
colors.replace("Overwrite",""); colors = colors.replace("Overwrite","");
se.setOverwriteColors(true); se.setOverwriteColors(true);
} }
colors = CardUtil.getShortColorsString(new ArrayList<String>(Arrays.asList(k[4].split(",")))); colors = CardUtil.getShortColorsString(new ArrayList<String>(Arrays.asList(k[4].split(","))));

View File

@@ -1053,7 +1053,7 @@ public class AbilityFactory {
else if (defined.endsWith("Owner")){ else if (defined.endsWith("Owner")){
String triggeringType = defined.substring(9); String triggeringType = defined.substring(9);
triggeringType = triggeringType.substring(0,triggeringType.length()-5); triggeringType = triggeringType.substring(0,triggeringType.length()-5);
Object c = (Card)sa.getSourceCard().getTriggeringObject(triggeringType); Object c = sa.getSourceCard().getTriggeringObject(triggeringType);
if(c instanceof Card) if(c instanceof Card)
{ {
o = ((Card)c).getOwner(); o = ((Card)c).getOwner();

View File

@@ -600,9 +600,9 @@ public class AbilityFactory_ChangeZone {
c = basicManaFixing(fetchList, type); c = basicManaFixing(fetchList, type);
else if (fetchList.getNotType("Creature").size() == 0) else if (fetchList.getNotType("Creature").size() == 0)
c = CardFactoryUtil.AI_getBestCreature(fetchList); //if only creatures take the best c = CardFactoryUtil.AI_getBestCreature(fetchList); //if only creatures take the best
else if (destination.equals("Battlefield") || destination.equals("Graveyard")) else if ("Battlefield".equals(destination) || "Graveyard".equals(destination))
c = CardFactoryUtil.AI_getMostExpensivePermanent(fetchList, af.getHostCard(), false); c = CardFactoryUtil.AI_getMostExpensivePermanent(fetchList, af.getHostCard(), false);
else if (destination.equals("Exile")){ else if ("Exile".equals(destination)){
// Exiling your own stuff, if Exiling opponents stuff choose best // Exiling your own stuff, if Exiling opponents stuff choose best
if (destZone.getPlayer().isHuman()) if (destZone.getPlayer().isHuman())
c = CardFactoryUtil.AI_getMostExpensivePermanent(fetchList, af.getHostCard(), false); c = CardFactoryUtil.AI_getMostExpensivePermanent(fetchList, af.getHostCard(), false);
@@ -627,11 +627,11 @@ public class AbilityFactory_ChangeZone {
player.shuffle(); player.shuffle();
for(Card c : fetched){ for(Card c : fetched){
if (destination.equals("Library")){ if ("Library".equals(destination)){
int libraryPos = params.containsKey("LibraryPosition") ? Integer.parseInt(params.get("LibraryPosition")) : 0; int libraryPos = params.containsKey("LibraryPosition") ? Integer.parseInt(params.get("LibraryPosition")) : 0;
AllZone.GameAction.moveToLibrary(c, libraryPos); AllZone.GameAction.moveToLibrary(c, libraryPos);
} }
else if (destination.equals("Battlefield")){ else if ("Battlefield".equals(destination)){
if (params.containsKey("Tapped")) if (params.containsKey("Tapped"))
c.tap(); c.tap();
if (params.containsKey("GainControl")) if (params.containsKey("GainControl"))
@@ -646,7 +646,7 @@ public class AbilityFactory_ChangeZone {
if(params.containsKey("Imprint")) card.addImprinted(c); if(params.containsKey("Imprint")) card.addImprinted(c);
} }
if (!destination.equals("Battlefield") && !type.equals("Card")){ if (!"Battlefield".equals(destination) && !"Card".equals(type)){
String picked = af.getHostCard().getName() + " - Computer picked:"; String picked = af.getHostCard().getName() + " - Computer picked:";
if (fetched.size() > 0) if (fetched.size() > 0)
GuiUtils.getChoice(picked, fetched.toArray()); GuiUtils.getChoice(picked, fetched.toArray());
@@ -688,7 +688,7 @@ public class AbilityFactory_ChangeZone {
return new CardList(); return new CardList();
source = rem.get(0); source = rem.get(0);
type.replace("Remembered", "Card"); type = type.replace("Remembered", "Card");
} }
return list.getValidCards(type.split(","), sa.getActivatingPlayer(), source); return list.getValidCards(type.split(","), sa.getActivatingPlayer(), source);

View File

@@ -549,7 +549,7 @@ public class AbilityFactory_Destroy {
// Set PayX here to maximum value. // Set PayX here to maximum value.
int xPay = ComputerUtil.determineLeftoverMana(sa); int xPay = ComputerUtil.determineLeftoverMana(sa);
source.setSVar("PayX", Integer.toString(xPay)); source.setSVar("PayX", Integer.toString(xPay));
Valid.replace("X", Integer.toString(xPay)); Valid = Valid.replace("X", Integer.toString(xPay));
} }
CardList humanlist = AllZoneUtil.getPlayerCardsInPlay(AllZone.HumanPlayer); CardList humanlist = AllZoneUtil.getPlayerCardsInPlay(AllZone.HumanPlayer);

View File

@@ -190,6 +190,8 @@ abstract public class Ability_Mana extends Ability_Activated implements java.io.
public boolean equals(Object o) public boolean equals(Object o)
{ {
//Mana abilities with same Descriptions are "equal" //Mana abilities with same Descriptions are "equal"
if(o == null)
return false;
return o.toString().equals(this.toString()); return o.toString().equals(this.toString());
} }

View File

@@ -2,6 +2,7 @@ package forge.card.trigger;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map;
import forge.AllZone; import forge.AllZone;
import forge.AllZoneUtil; import forge.AllZoneUtil;
@@ -77,9 +78,9 @@ public abstract class Trigger {
{ {
name = n; name = n;
mapParams = new HashMap<String,String>(); mapParams = new HashMap<String,String>();
for(String key : params.keySet()) for(Map.Entry<String,String> entry : params.entrySet())
{ {
mapParams.put(key,params.get(key)); mapParams.put(entry.getKey(),entry.getValue());
} }
hostCard = host; hostCard = host;
} }
@@ -87,9 +88,9 @@ public abstract class Trigger {
public Trigger(HashMap<String,String> params, Card host) public Trigger(HashMap<String,String> params, Card host)
{ {
mapParams = new HashMap<String,String>(); mapParams = new HashMap<String,String>();
for(String key : params.keySet()) for(Map.Entry<String,String> entry : params.entrySet())
{ {
mapParams.put(key,params.get(key)); mapParams.put(entry.getKey(),entry.getValue());
} }
hostCard = host; hostCard = host;
} }

View File

@@ -3,10 +3,16 @@ package forge.deck;
import forge.Card; import forge.Card;
import forge.Constant; import forge.Constant;
import java.io.Serializable;
import java.util.*; import java.util.*;
public class Deck implements Comparable<Deck>{ public class Deck implements Comparable<Deck>, Serializable{
//gameType is from Constant.GameType, like Constant.GameType.Regular /**
*
*/
private static final long serialVersionUID = -7478025567887481994L;
//gameType is from Constant.GameType, like Constant.GameType.Regular
private Map<String, String> metadata = new HashMap<String, String>(); private Map<String, String> metadata = new HashMap<String, String>();
@@ -165,6 +171,14 @@ public class Deck implements Comparable<Deck>{
return getName().compareTo(d.getName()); return getName().compareTo(d.getName());
} }
public boolean equals(Object o) {
if(o instanceof Deck){
Deck d = (Deck)o;
return getName().equals(d.getName());
}
return false;
}
public Set<Map.Entry<String,String>> getMetadata() { public Set<Map.Entry<String,String>> getMetadata() {
return metadata.entrySet(); return metadata.entrySet();
} }