fixes + adjusted minimax AI

This commit is contained in:
BetaSteward 2010-12-07 05:03:35 +00:00
parent ba937e4771
commit 139faeb7a5
3 changed files with 7 additions and 7 deletions

View file

@ -67,17 +67,17 @@ public class GameStateEvaluator {
}
public static int evaluatePermanent(Permanent permanent, Game game) {
int value = permanent.isTapped()?1:2;
int value = permanent.isTapped()?4:5;
if (permanent.getCardType().contains(CardType.CREATURE)) {
value += evaluateCreature(permanent, game) * CREATURE_FACTOR;
}
value += permanent.getAbilities().getManaAbilities(Zone.BATTLEFIELD).size();
for (ActivatedAbility ability: permanent.getAbilities().getActivatedAbilities(Zone.BATTLEFIELD)) {
if (!(ability instanceof ManaAbility) && ability.canActivate(ability.getControllerId(), game))
value += ability.getEffects().getOutcomeTotal();
value += ability.getEffects().size();
}
value += permanent.getAbilities().getStaticAbilities(Zone.BATTLEFIELD).getOutcomeTotal();
value += permanent.getAbilities().getTriggeredAbilities(Zone.BATTLEFIELD).getOutcomeTotal();
value += permanent.getAbilities().getStaticAbilities(Zone.BATTLEFIELD).size();
value += permanent.getAbilities().getTriggeredAbilities(Zone.BATTLEFIELD).size();
value += permanent.getManaCost().convertedManaCost();
//TODO: add a difficulty to calculation to ManaCost - sort permanents by difficulty for casting when evaluating game states
return value;
@ -91,8 +91,8 @@ public class GameStateEvaluator {
// value += creature.getPower().getValue();
// if (!creature.isTapped())
// value += 2;
value += creature.getAbilities().getEvasionAbilities().getOutcomeTotal();
value += creature.getAbilities().getProtectionAbilities().getOutcomeTotal();
value += creature.getAbilities().getEvasionAbilities().size();
value += creature.getAbilities().getProtectionAbilities().size();
value += creature.getAbilities().containsKey(FirstStrikeAbility.getInstance().getId())?1:0;
value += creature.getAbilities().containsKey(DoubleStrikeAbility.getInstance().getId())?2:0;
value += creature.getAbilities().containsKey(TrampleAbility.getInstance().getId())?1:0;

View file

@ -99,7 +99,7 @@ class SearingBlazeWatcher extends WatcherImpl<SearingBlazeWatcher> {
public void watch(GameEvent event, Game game) {
if (event.getType() == EventType.ZONE_CHANGE && ((ZoneChangeEvent)event).getToZone() == Zone.BATTLEFIELD) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent.getCardType().contains(CardType.LAND) && permanent.getControllerId().equals(event.getPlayerId())) {
if (permanent.getCardType().contains(CardType.LAND) && permanent.getControllerId().equals(this.controllerId)) {
condition = true;
}
}