no changes, just fixing some very odd indentation in Eclipse.

This commit is contained in:
jendave
2011-08-06 14:01:33 +00:00
parent edc5ec90ff
commit 0fef87c97c

View File

@@ -1,24 +1,24 @@
package forge; package forge;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Random; import java.util.Random;
public class AbilityFactory_DealDamage { public class AbilityFactory_DealDamage {
private AbilityFactory AF = null; private AbilityFactory AF = null;
private String damage;
public AbilityFactory_DealDamage(AbilityFactory newAF)
{
AF = newAF;
damage = AF.getMapParams().get("NumDmg"); private String damage;
public AbilityFactory_DealDamage(AbilityFactory newAF)
{
AF = newAF;
damage = AF.getMapParams().get("NumDmg");
// Note: TgtOpp should not be used, Please use ValidTgts$ Opponent instead
}
// Note: TgtOpp should not be used, Please use ValidTgts$ Opponent instead
}
public SpellAbility getAbility() { public SpellAbility getAbility() {
final SpellAbility abDamage = new Ability_Activated(AF.getHostCard(), AF.getAbCost(), AF.getAbTgt()) { final SpellAbility abDamage = new Ability_Activated(AF.getHostCard(), AF.getAbCost(), AF.getAbTgt()) {
private static final long serialVersionUID = -7560349014757367722L; private static final long serialVersionUID = -7560349014757367722L;
@@ -49,34 +49,34 @@ import java.util.Random;
return abDamage; return abDamage;
} }
public SpellAbility getAbilityDamageAll(){ public SpellAbility getAbilityDamageAll(){
final SpellAbility abDamageAll = new Ability_Activated(AF.getHostCard(), AF.getAbCost(), AF.getAbTgt()){ final SpellAbility abDamageAll = new Ability_Activated(AF.getHostCard(), AF.getAbCost(), AF.getAbTgt()){
private static final long serialVersionUID = -1831356710492849854L; private static final long serialVersionUID = -1831356710492849854L;
final AbilityFactory af = AF; final AbilityFactory af = AF;
@Override @Override
public String getStackDescription(){ public String getStackDescription(){
return damageAllStackDescription(af, this); return damageAllStackDescription(af, this);
} }
@Override @Override
public boolean canPlay(){ public boolean canPlay(){
// super takes care of AdditionalCosts // super takes care of AdditionalCosts
return super.canPlay(); return super.canPlay();
} }
@Override @Override
public boolean canPlayAI() { public boolean canPlayAI() {
return damageAllCanPlayAI(af, this); return damageAllCanPlayAI(af, this);
} }
@Override @Override
public void resolve() { public void resolve() {
damageAllResolve(af, this); damageAllResolve(af, this);
} }
}; };
return abDamageAll; return abDamageAll;
} }
@@ -111,13 +111,13 @@ import java.util.Random;
return spDealDamage; return spDealDamage;
} }
public SpellAbility getSpellDamageAll(){ public SpellAbility getSpellDamageAll(){
final SpellAbility spDamageAll = new Spell(AF.getHostCard(), AF.getAbCost(), AF.getAbTgt()){ final SpellAbility spDamageAll = new Spell(AF.getHostCard(), AF.getAbCost(), AF.getAbTgt()){
private static final long serialVersionUID = 8004957182752984818L; private static final long serialVersionUID = 8004957182752984818L;
final AbilityFactory af = AF; final AbilityFactory af = AF;
final HashMap<String,String> params = af.getMapParams(); final HashMap<String,String> params = af.getMapParams();
@Override @Override
public String getStackDescription(){ public String getStackDescription(){
if(params.containsKey("SpellDescription")) if(params.containsKey("SpellDescription"))
@@ -125,22 +125,22 @@ import java.util.Random;
else else
return damageAllStackDescription(af, this); return damageAllStackDescription(af, this);
} }
public boolean canPlay(){ public boolean canPlay(){
// super takes care of AdditionalCosts // super takes care of AdditionalCosts
return super.canPlay(); return super.canPlay();
} }
public boolean canPlayAI() public boolean canPlayAI()
{ {
return damageAllCanPlayAI(af, this); return damageAllCanPlayAI(af, this);
} }
@Override @Override
public void resolve() { public void resolve() {
damageAllResolve(af, this); damageAllResolve(af, this);
} }
}; };
return spDamageAll; return spDamageAll;
} }
@@ -169,17 +169,17 @@ import java.util.Random;
return dbDealDamage; return dbDealDamage;
} }
public SpellAbility getDrawbackDamageAll(){ public SpellAbility getDrawbackDamageAll(){
final SpellAbility dbDamageAll = new Ability_Sub(AF.getHostCard(), AF.getAbTgt()){ final SpellAbility dbDamageAll = new Ability_Sub(AF.getHostCard(), AF.getAbTgt()){
private static final long serialVersionUID = -6169562107675964474L; private static final long serialVersionUID = -6169562107675964474L;
final AbilityFactory af = AF; final AbilityFactory af = AF;
@Override @Override
public String getStackDescription(){ public String getStackDescription(){
return damageAllStackDescription(af, this); return damageAllStackDescription(af, this);
} }
@Override @Override
public void resolve() { public void resolve() {
damageAllResolve(af, this); damageAllResolve(af, this);
@@ -190,117 +190,117 @@ import java.util.Random;
//check AI life before playing this drawback? //check AI life before playing this drawback?
return true; return true;
} }
}; };
return dbDamageAll; return dbDamageAll;
} }
private int getNumDamage(SpellAbility saMe) { private int getNumDamage(SpellAbility saMe) {
return AbilityFactory.calculateAmount(saMe.getSourceCard(), damage, saMe); return AbilityFactory.calculateAmount(saMe.getSourceCard(), damage, saMe);
} }
private boolean shouldTgtP(int d, final boolean noPrevention) {
int restDamage = d;
if (!noPrevention)
restDamage = AllZone.HumanPlayer.staticDamagePrevention(restDamage, AF.getHostCard(), false);
if (restDamage == 0) return false;
PlayerZone compHand = AllZone.getZone(Constant.Zone.Hand, AllZone.ComputerPlayer);
CardList hand = new CardList(compHand.getCards());
if(AF.isSpell() && hand.size() > 7) // anti-discard-at-EOT
return true;
if(AllZone.HumanPlayer.getLife() - restDamage < 10) // if damage from this spell would drop the human to less than 10 life
return true;
return false;
}
private Card chooseTgtC(final int d, final boolean noPrevention) {
CardList hPlay = AllZoneUtil.getPlayerCardsInPlay(AllZone.HumanPlayer);
hPlay = hPlay.getValidCards(AF.getAbTgt().getValidTgts(), AllZone.ComputerPlayer, AF.getHostCard());
hPlay = hPlay.filter(new CardListFilter() { private boolean shouldTgtP(int d, final boolean noPrevention) {
public boolean addCard(Card c) { int restDamage = d;
int restDamage = d;
if (!noPrevention)
restDamage = c.staticDamagePrevention(d,AF.getHostCard(),false);
// will include creatures already dealt damage
return c.getKillDamage() <= restDamage && CardFactoryUtil.canTarget(AF.getHostCard(), c)
&& !c.getKeyword().contains("Indestructible") && !(c.getSVar("SacMe").length() > 0);
}
});
if(hPlay.size() > 0) {
Card best = CardFactoryUtil.AI_getBestCreature(hPlay);
return best;
}
return null;
}
private boolean doCanPlayAI(SpellAbility saMe) if (!noPrevention)
{ restDamage = AllZone.HumanPlayer.staticDamagePrevention(restDamage, AF.getHostCard(), false);
int dmg = getNumDamage(saMe);
boolean rr = AF.isSpell(); if (restDamage == 0) return false;
// temporarily disabled until better AI PlayerZone compHand = AllZone.getZone(Constant.Zone.Hand, AllZone.ComputerPlayer);
if (AF.getAbCost().getSacCost()) { CardList hand = new CardList(compHand.getCards());
if(AllZone.HumanPlayer.getLife() - dmg > 0) // only if damage from this ability would kill the human
return false; if(AF.isSpell() && hand.size() > 7) // anti-discard-at-EOT
} return true;
if (AF.getAbCost().getSubCounter()) {
// +1/+1 counters only if damage from this ability would kill the human, otherwise ok if(AllZone.HumanPlayer.getLife() - restDamage < 10) // if damage from this spell would drop the human to less than 10 life
if(AllZone.HumanPlayer.getLife() - dmg > 0 && AF.getAbCost().getCounterType().equals(Counters.P1P1)) return true;
return false;
} return false;
if (AF.getAbCost().getLifeCost()) { }
if(AllZone.HumanPlayer.getLife() - dmg > 0) // only if damage from this ability would kill the human
return false; private Card chooseTgtC(final int d, final boolean noPrevention) {
} CardList hPlay = AllZoneUtil.getPlayerCardsInPlay(AllZone.HumanPlayer);
hPlay = hPlay.getValidCards(AF.getAbTgt().getValidTgts(), AllZone.ComputerPlayer, AF.getHostCard());
if (!ComputerUtil.canPayCost(saMe))
return false; hPlay = hPlay.filter(new CardListFilter() {
public boolean addCard(Card c) {
int restDamage = d;
if (!noPrevention)
restDamage = c.staticDamagePrevention(d,AF.getHostCard(),false);
// will include creatures already dealt damage
return c.getKillDamage() <= restDamage && CardFactoryUtil.canTarget(AF.getHostCard(), c)
&& !c.getKeyword().contains("Indestructible") && !(c.getSVar("SacMe").length() > 0);
}
});
if(hPlay.size() > 0) {
Card best = CardFactoryUtil.AI_getBestCreature(hPlay);
return best;
}
return null;
}
private boolean doCanPlayAI(SpellAbility saMe)
{
int dmg = getNumDamage(saMe);
boolean rr = AF.isSpell();
// temporarily disabled until better AI
if (AF.getAbCost().getSacCost()) {
if(AllZone.HumanPlayer.getLife() - dmg > 0) // only if damage from this ability would kill the human
return false;
}
if (AF.getAbCost().getSubCounter()) {
// +1/+1 counters only if damage from this ability would kill the human, otherwise ok
if(AllZone.HumanPlayer.getLife() - dmg > 0 && AF.getAbCost().getCounterType().equals(Counters.P1P1))
return false;
}
if (AF.getAbCost().getLifeCost()) {
if(AllZone.HumanPlayer.getLife() - dmg > 0) // only if damage from this ability would kill the human
return false;
}
if (!ComputerUtil.canPayCost(saMe))
return false;
// TODO handle proper calculation of X values based on Cost
// todo: this should only happen during Players EOT or if Stuffy is going to die
if(AF.getHostCard().equals("Stuffy Doll")) {
return true;
}
if (AF.isAbility())
{
Random r = new Random(); // prevent run-away activations
if(r.nextFloat() <= Math.pow(.6667, AF.getHostCard().getAbilityUsed()))
rr = true;
}
boolean bFlag = damageTargetAI(saMe);
if (!bFlag)
return false;
Ability_Sub subAb = saMe.getSubAbility();
if (subAb != null)
rr &= subAb.chkAI_Drawback();
return rr;
}
// TODO handle proper calculation of X values based on Cost
// todo: this should only happen during Players EOT or if Stuffy is going to die
if(AF.getHostCard().equals("Stuffy Doll")) {
return true;
}
if (AF.isAbility())
{
Random r = new Random(); // prevent run-away activations
if(r.nextFloat() <= Math.pow(.6667, AF.getHostCard().getAbilityUsed()))
rr = true;
}
boolean bFlag = damageTargetAI(saMe);
if (!bFlag)
return false;
Ability_Sub subAb = saMe.getSubAbility();
if (subAb != null)
rr &= subAb.chkAI_Drawback();
return rr;
}
private boolean damageTargetAI(SpellAbility saMe) { private boolean damageTargetAI(SpellAbility saMe) {
int dmg = getNumDamage(saMe); int dmg = getNumDamage(saMe);
Target tgt = AF.getAbTgt(); Target tgt = AF.getAbTgt();
HashMap<String,String> params = AF.getMapParams(); HashMap<String,String> params = AF.getMapParams();
boolean noPrevention = params.containsKey("NoPrevention"); boolean noPrevention = params.containsKey("NoPrevention");
if (tgt == null){ if (tgt == null){
// todo: Improve circumstances where the Defined Damage is unwanted // todo: Improve circumstances where the Defined Damage is unwanted
ArrayList<Object> objects = AbilityFactory.getDefinedObjects(saMe.getSourceCard(), params.get("Defined"), saMe); ArrayList<Object> objects = AbilityFactory.getDefinedObjects(saMe.getSourceCard(), params.get("Defined"), saMe);
for(Object o : objects){ for(Object o : objects){
if (o instanceof Card){ if (o instanceof Card){
//Card c = (Card)o; //Card c = (Card)o;
@@ -311,10 +311,10 @@ import java.util.Random;
return false; return false;
} }
} }
return true; return true;
} }
tgt.resetTargets(); tgt.resetTargets();
// target loop // target loop
@@ -358,188 +358,188 @@ import java.util.Random;
} }
return true; return true;
} }
private String damageStackDescription(AbilityFactory af, SpellAbility sa){
// when damageStackDescription is called, just build exactly what is happening
StringBuilder sb = new StringBuilder();
String name = af.getHostCard().toString();
int dmg = getNumDamage(sa);
ArrayList<Object> tgts; private String damageStackDescription(AbilityFactory af, SpellAbility sa){
if(sa.getTarget() == null) // when damageStackDescription is called, just build exactly what is happening
tgts = AbilityFactory.getDefinedObjects(sa.getSourceCard(), af.getMapParams().get("Defined"), sa); StringBuilder sb = new StringBuilder();
else String name = af.getHostCard().toString();
tgts = sa.getTarget().getTargets(); int dmg = getNumDamage(sa);
if (!(sa instanceof Ability_Sub))
sb.append(name).append(" - ");
sb.append("Deals ").append(dmg).append(" damage to ");
for(int i = 0; i < tgts.size(); i++){
if (i != 0)
sb.append(" ");
Object o = tgts.get(0); ArrayList<Object> tgts;
if (o instanceof Card || o instanceof Player) if(sa.getTarget() == null)
sb.append(o.toString()); tgts = AbilityFactory.getDefinedObjects(sa.getSourceCard(), af.getMapParams().get("Defined"), sa);
} else
tgts = sa.getTarget().getTargets();
sb.append(". "); if (!(sa instanceof Ability_Sub))
sb.append(name).append(" - ");
if (sa.getSubAbility() != null){
sb.append(sa.getSubAbility().getStackDescription());
}
return sb.toString(); sb.append("Deals ").append(dmg).append(" damage to ");
}
private void doResolve(SpellAbility saMe)
{
int dmg = getNumDamage(saMe);
HashMap<String,String> params = AF.getMapParams();
boolean noPrevention = params.containsKey("NoPrevention");
ArrayList<Object> tgts; for(int i = 0; i < tgts.size(); i++){
if(saMe.getTarget() == null) if (i != 0)
tgts = AbilityFactory.getDefinedObjects(saMe.getSourceCard(), params.get("Defined"), saMe); sb.append(" ");
else
tgts = saMe.getTarget().getTargets();
boolean targeted = (AF.getAbTgt() != null);
for(Object o : tgts){ Object o = tgts.get(0);
if (o instanceof Card){ if (o instanceof Card || o instanceof Player)
Card c = (Card)o; sb.append(o.toString());
if(AllZone.GameAction.isCardInPlay(c) && (!targeted || CardFactoryUtil.canTarget(AF.getHostCard(), c))) { }
if (noPrevention)
c.addDamageWithoutPrevention(dmg, AF.getHostCard());
else
c.addDamage(dmg, AF.getHostCard());
}
} sb.append(". ");
else if (o instanceof Player){
Player p = (Player) o;
if (!targeted || p.canTarget(AF.getHostCard())) {
if (noPrevention)
p.addDamageWithoutPrevention(dmg, AF.getHostCard());
else
p.addDamage(dmg, AF.getHostCard());
}
}
}
if (AF.hasSubAbility()){
Ability_Sub abSub = saMe.getSubAbility();
if (abSub != null){
abSub.resolve();
}
else{
Object obj = tgts.get(0);
Player pl = null;
Card c = null;
if (obj instanceof Card){
c = (Card)obj;
pl = c.getController();
}
else{
pl = (Player)obj;
}
CardFactoryUtil.doDrawBack(params.get("SubAbility"), dmg, AF.getHostCard().getController(),
AF.getHostCard().getController().getOpponent(), pl, AF.getHostCard(), c, saMe);
}
}
}
private void damageAllResolve(final AbilityFactory af, final SpellAbility sa){
HashMap<String,String> params = af.getMapParams();
String DrawBack = params.get("SubAbility");
Card card = sa.getSourceCard();
int dmg = getNumDamage(sa);
String valid = "";
String players = "";
if(params.containsKey("ValidCards"))
valid = params.get("ValidCards");
if(params.containsKey("ValidPlayers"))
players = params.get("ValidPlayers");
CardList list = AllZoneUtil.getCardsInPlay();
list = list.getValidCards(valid.split(","), card.getController(), card);
for(Card c:list) c.addDamage(dmg, card); if (sa.getSubAbility() != null){
sb.append(sa.getSubAbility().getStackDescription());
if(players.equals("All")) { }
for(Player p:AllZoneUtil.getPlayersInGame()) {
p.addDamage(dmg, card);
}
}
else if(players.equals("EachOpponent")) {
for(Player p:AllZoneUtil.getOpponents(card.getController())) p.addDamage(dmg, card);
}
else if(players.equals("Self"))
card.getController().addDamage(dmg, card);
else {
//anything else to go here?
}
if (af.hasSubAbility()){
Ability_Sub abSub = sa.getSubAbility();
if (abSub != null){
abSub.resolve();
}
else
CardFactoryUtil.doDrawBack(DrawBack, 0, card.getController(), card.getController().getOpponent(), card.getController(), card, null, sa);
}
}
private String damageAllStackDescription(final AbilityFactory af, SpellAbility sa){
StringBuilder sb = new StringBuilder();
String name = af.getHostCard().getName();
HashMap<String,String> params = af.getMapParams();
String desc = "";
if(params.containsKey("ValidDescription"))
desc = params.get("ValidDescription");
int dmg = getNumDamage(sa);
sb.append(name).append(" - Deals "+dmg+" to "+desc); return sb.toString();
}
Ability_Sub abSub = sa.getSubAbility(); private void doResolve(SpellAbility saMe)
if (abSub != null) { {
sb.append(abSub.getStackDescription()); int dmg = getNumDamage(saMe);
} HashMap<String,String> params = AF.getMapParams();
return sb.toString(); boolean noPrevention = params.containsKey("NoPrevention");
}
ArrayList<Object> tgts;
private boolean damageAllCanPlayAI(final AbilityFactory af, final SpellAbility sa){ if(saMe.getTarget() == null)
return false; tgts = AbilityFactory.getDefinedObjects(saMe.getSourceCard(), params.get("Defined"), saMe);
/* else
tgts = saMe.getTarget().getTargets();
boolean targeted = (AF.getAbTgt() != null);
for(Object o : tgts){
if (o instanceof Card){
Card c = (Card)o;
if(AllZone.GameAction.isCardInPlay(c) && (!targeted || CardFactoryUtil.canTarget(AF.getHostCard(), c))) {
if (noPrevention)
c.addDamageWithoutPrevention(dmg, AF.getHostCard());
else
c.addDamage(dmg, AF.getHostCard());
}
}
else if (o instanceof Player){
Player p = (Player) o;
if (!targeted || p.canTarget(AF.getHostCard())) {
if (noPrevention)
p.addDamageWithoutPrevention(dmg, AF.getHostCard());
else
p.addDamage(dmg, AF.getHostCard());
}
}
}
if (AF.hasSubAbility()){
Ability_Sub abSub = saMe.getSubAbility();
if (abSub != null){
abSub.resolve();
}
else{
Object obj = tgts.get(0);
Player pl = null;
Card c = null;
if (obj instanceof Card){
c = (Card)obj;
pl = c.getController();
}
else{
pl = (Player)obj;
}
CardFactoryUtil.doDrawBack(params.get("SubAbility"), dmg, AF.getHostCard().getController(),
AF.getHostCard().getController().getOpponent(), pl, AF.getHostCard(), c, saMe);
}
}
}
private void damageAllResolve(final AbilityFactory af, final SpellAbility sa){
HashMap<String,String> params = af.getMapParams();
String DrawBack = params.get("SubAbility");
Card card = sa.getSourceCard();
int dmg = getNumDamage(sa);
String valid = "";
String players = "";
if(params.containsKey("ValidCards"))
valid = params.get("ValidCards");
if(params.containsKey("ValidPlayers"))
players = params.get("ValidPlayers");
CardList list = AllZoneUtil.getCardsInPlay();
list = list.getValidCards(valid.split(","), card.getController(), card);
for(Card c:list) c.addDamage(dmg, card);
if(players.equals("All")) {
for(Player p:AllZoneUtil.getPlayersInGame()) {
p.addDamage(dmg, card);
}
}
else if(players.equals("EachOpponent")) {
for(Player p:AllZoneUtil.getOpponents(card.getController())) p.addDamage(dmg, card);
}
else if(players.equals("Self"))
card.getController().addDamage(dmg, card);
else {
//anything else to go here?
}
if (af.hasSubAbility()){
Ability_Sub abSub = sa.getSubAbility();
if (abSub != null){
abSub.resolve();
}
else
CardFactoryUtil.doDrawBack(DrawBack, 0, card.getController(), card.getController().getOpponent(), card.getController(), card, null, sa);
}
}
private String damageAllStackDescription(final AbilityFactory af, SpellAbility sa){
StringBuilder sb = new StringBuilder();
String name = af.getHostCard().getName();
HashMap<String,String> params = af.getMapParams();
String desc = "";
if(params.containsKey("ValidDescription"))
desc = params.get("ValidDescription");
int dmg = getNumDamage(sa);
sb.append(name).append(" - Deals "+dmg+" to "+desc);
Ability_Sub abSub = sa.getSubAbility();
if (abSub != null) {
sb.append(abSub.getStackDescription());
}
return sb.toString();
}
private boolean damageAllCanPlayAI(final AbilityFactory af, final SpellAbility sa){
return false;
/*
// AI needs to be expanded, since this function can be pretty complex based on what the expected targets could be // AI needs to be expanded, since this function can be pretty complex based on what the expected targets could be
Random r = new Random(); Random r = new Random();
Ability_Cost abCost = sa.getPayCosts(); Ability_Cost abCost = sa.getPayCosts();
final Card source = sa.getSourceCard(); final Card source = sa.getSourceCard();
final HashMap<String,String> params = af.getMapParams(); final HashMap<String,String> params = af.getMapParams();
String Valid = ""; String Valid = "";
if(params.containsKey("ValidCards")) if(params.containsKey("ValidCards"))
Valid = params.get("ValidCards"); Valid = params.get("ValidCards");
CardList humanlist = new CardList(AllZone.getZone(Constant.Zone.Battlefield, AllZone.HumanPlayer).getCards()); CardList humanlist = new CardList(AllZone.getZone(Constant.Zone.Battlefield, AllZone.HumanPlayer).getCards());
CardList computerlist = new CardList(AllZone.getZone(Constant.Zone.Battlefield, AllZone.ComputerPlayer).getCards()); CardList computerlist = new CardList(AllZone.getZone(Constant.Zone.Battlefield, AllZone.ComputerPlayer).getCards());
humanlist = humanlist.getValidCards(Valid.split(","), source.getController(), source); humanlist = humanlist.getValidCards(Valid.split(","), source.getController(), source);
computerlist = computerlist.getValidCards(Valid.split(","), source.getController(), source); computerlist = computerlist.getValidCards(Valid.split(","), source.getController(), source);
humanlist = humanlist.getNotKeyword("Indestructible"); humanlist = humanlist.getNotKeyword("Indestructible");
computerlist = computerlist.getNotKeyword("Indestructible"); computerlist = computerlist.getNotKeyword("Indestructible");
if (abCost != null){ if (abCost != null){
// AI currently disabled for some costs // AI currently disabled for some costs
if (abCost.getSacCost()){ if (abCost.getSacCost()){
@@ -550,18 +550,18 @@ import java.util.Random;
return false; return false;
} }
if (abCost.getDiscardCost()) //OK if (abCost.getDiscardCost()) //OK
if (abCost.getSubCounter()){ if (abCost.getSubCounter()){
// OK // OK
} }
} }
if (!ComputerUtil.canPayCost(sa)) if (!ComputerUtil.canPayCost(sa))
return false; return false;
// prevent run-away activations - first time will always return true // prevent run-away activations - first time will always return true
boolean chance = r.nextFloat() <= Math.pow(.6667, source.getAbilityUsed()); boolean chance = r.nextFloat() <= Math.pow(.6667, source.getAbilityUsed());
// if only creatures are affected evaluate both lists and pass only if human creatures are more valuable // if only creatures are affected evaluate both lists and pass only if human creatures are more valuable
if (humanlist.getNotType("Creature").size() == 0 && computerlist.getNotType("Creature").size() == 0) { if (humanlist.getNotType("Creature").size() == 0 && computerlist.getNotType("Creature").size() == 0) {
if(CardFactoryUtil.evaluateCreatureList(computerlist) + 200 >= CardFactoryUtil.evaluateCreatureList(humanlist)) if(CardFactoryUtil.evaluateCreatureList(computerlist) + 200 >= CardFactoryUtil.evaluateCreatureList(humanlist))
@@ -569,12 +569,12 @@ import java.util.Random;
} // otherwise evaluate both lists by CMC and pass only if human permanents are more valuable } // otherwise evaluate both lists by CMC and pass only if human permanents are more valuable
else if(CardFactoryUtil.evaluatePermanentList(computerlist) + 3 >= CardFactoryUtil.evaluateCreatureList(humanlist)) else if(CardFactoryUtil.evaluatePermanentList(computerlist) + 3 >= CardFactoryUtil.evaluateCreatureList(humanlist))
return false; return false;
Ability_Sub subAb = sa.getSubAbility(); Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) if (subAb != null)
chance &= subAb.chkAI_Drawback(); chance &= subAb.chkAI_Drawback();
return ((r.nextFloat() < .6667) && chance); return ((r.nextFloat() < .6667) && chance);
*/ */
} }
} }