mirror of
https://github.com/correl/mage.git
synced 2025-04-14 09:09:38 -09:00
AI enhancements
This commit is contained in:
parent
931381606d
commit
c97d5e8a35
8 changed files with 29 additions and 4 deletions
Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai
Mage.Server/plugins
|
@ -55,6 +55,7 @@ import mage.game.stack.StackAbility;
|
|||
import mage.game.stack.StackObject;
|
||||
import mage.game.turn.*;
|
||||
import mage.player.ai.ma.optimizers.TreeOptimizer;
|
||||
import mage.player.ai.ma.optimizers.impl.DiscardCardOptimizer;
|
||||
import mage.player.ai.ma.optimizers.impl.EquipOptimizer;
|
||||
import mage.player.ai.ma.optimizers.impl.LevelUpOptimizer;
|
||||
import mage.player.ai.util.CombatInfo;
|
||||
|
@ -96,6 +97,7 @@ public class ComputerPlayer6 extends ComputerPlayer<ComputerPlayer6> implements
|
|||
static {
|
||||
optimizers.add(new LevelUpOptimizer());
|
||||
optimizers.add(new EquipOptimizer());
|
||||
optimizers.add(new DiscardCardOptimizer());
|
||||
}
|
||||
|
||||
public ComputerPlayer6(String name, RangeOfInfluence range, int skill) {
|
||||
|
|
|
@ -62,7 +62,7 @@ public class GameStateEvaluator2 {
|
|||
int permanentScore = 0;
|
||||
try {
|
||||
for (Permanent permanent: game.getBattlefield().getAllActivePermanents(playerId)) {
|
||||
permanentScore += 10 * evaluatePermanent(permanent, game);
|
||||
permanentScore += evaluatePermanent(permanent, game);
|
||||
}
|
||||
for (Permanent permanent: game.getBattlefield().getAllActivePermanents(opponent.getId())) {
|
||||
permanentScore -= evaluatePermanent(permanent, game);
|
||||
|
|
|
@ -101,7 +101,7 @@ public class SimulatedPlayer2 extends ComputerPlayer<SimulatedPlayer2> {
|
|||
}
|
||||
|
||||
for (Ability a : allActions) {
|
||||
System.out.println("ability=="+a);
|
||||
//System.out.println("ability=="+a);
|
||||
if (a.getTargets().size() > 0) {
|
||||
Player player = game.getPlayer(a.getFirstTarget());
|
||||
if (player != null) {
|
||||
|
|
|
@ -119,9 +119,9 @@ public class ArtificialScoringSystem {
|
|||
if (permanent.getCardType().contains(Constants.CardType.CREATURE)) {
|
||||
return -100;
|
||||
} else if (permanent.getCardType().contains(Constants.CardType.LAND)) {
|
||||
return -10;
|
||||
return -1;
|
||||
} else {
|
||||
return -50;
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
package mage.player.ai.ma.optimizers.impl;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.game.Game;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Removes abilities that require only discard a card for activation.
|
||||
*
|
||||
* @author magenoxx_at_gmail.com
|
||||
*/
|
||||
public class DiscardCardOptimizer extends BaseTreeOptimizer {
|
||||
|
||||
@Override
|
||||
public void filter(Game game, List<Ability> actions) {
|
||||
for (Ability ability : actions) {
|
||||
if (ability.toString().startsWith("Discard card")) {
|
||||
removeAbility(ability);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Add table
Reference in a new issue