mirror of
https://github.com/correl/mage.git
synced 2024-11-14 19:19:32 +00:00
* AI: planeswalkers gets more priority in targets selection;
This commit is contained in:
parent
7e08b3c3d5
commit
073b003b37
2 changed files with 11 additions and 11 deletions
|
@ -1,31 +1,32 @@
|
|||
|
||||
|
||||
package mage.player.ai;
|
||||
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class PermanentEvaluator {
|
||||
|
||||
//preserve calculations for efficiency
|
||||
private final Map<UUID, Integer> values = new HashMap<>();
|
||||
private final CombatEvaluator combat = new CombatEvaluator();
|
||||
|
||||
public int evaluate(Permanent permanent, Game game) {
|
||||
// more score -- more valueable/powerfull permanent
|
||||
if (!values.containsKey(permanent.getId())) {
|
||||
int value = 0;
|
||||
if (permanent.getCardType().contains(CardType.CREATURE)) {
|
||||
if (permanent.isCreature()) {
|
||||
value += combat.evaluate(permanent, game);
|
||||
}
|
||||
if (permanent.isPlaneswalker()) {
|
||||
value += 2 * permanent.getCounters(game).getCount(CounterType.LOYALTY); // planeswalker is more valuable
|
||||
}
|
||||
value += permanent.getAbilities().getActivatedManaAbilities(Zone.BATTLEFIELD).size();
|
||||
value += permanent.getAbilities().getActivatedAbilities(Zone.BATTLEFIELD).size();
|
||||
values.put(permanent.getId(), value);
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package mage.constants;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author North
|
||||
*/
|
||||
public enum Outcome {
|
||||
|
@ -41,7 +40,7 @@ public enum Outcome {
|
|||
Removal(false),
|
||||
AIDontUseIt(false),
|
||||
Vote(true);
|
||||
private final boolean good;
|
||||
private final boolean good; // good or bad for targets in current effect
|
||||
private boolean canTargetAll;
|
||||
|
||||
Outcome(boolean good) {
|
||||
|
|
Loading…
Reference in a new issue