mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
AiAttackController no longer has reproducable attack thoughts.
I don't see why we would want this to be seeded with the same number. I think it's incorrect thinking so I'm removing it. (cherry picked from commit 2881effd577abe9500b8fa3a5699067b0c3541f3)
This commit is contained in:
@@ -42,7 +42,6 @@ import forge.util.collect.FCollectionView;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
|
|
||||||
//doesHumanAttackAndWin() uses the global variable AllZone.getComputerPlayer()
|
//doesHumanAttackAndWin() uses the global variable AllZone.getComputerPlayer()
|
||||||
@@ -60,9 +59,6 @@ public class AiAttackController {
|
|||||||
private final List<Card> attackers;
|
private final List<Card> attackers;
|
||||||
private final List<Card> blockers;
|
private final List<Card> blockers;
|
||||||
|
|
||||||
private final static Random random = new Random();
|
|
||||||
private final static int randomInt = random.nextInt();
|
|
||||||
|
|
||||||
private List<Card> oppList; // holds human player creatures
|
private List<Card> oppList; // holds human player creatures
|
||||||
private List<Card> myList; // holds computer creatures
|
private List<Card> myList; // holds computer creatures
|
||||||
|
|
||||||
@@ -105,7 +101,7 @@ public class AiAttackController {
|
|||||||
} // overloaded constructor to evaluate single specified attacker
|
} // overloaded constructor to evaluate single specified attacker
|
||||||
|
|
||||||
public static List<Card> getOpponentCreatures(final Player defender) {
|
public static List<Card> getOpponentCreatures(final Player defender) {
|
||||||
List<Card> defenders = Lists.newArrayList();
|
List<Card> defenders = new ArrayList<Card>();
|
||||||
defenders.addAll(defender.getCreaturesInPlay());
|
defenders.addAll(defender.getCreaturesInPlay());
|
||||||
Predicate<Card> canAnimate = new Predicate<Card>() {
|
Predicate<Card> canAnimate = new Predicate<Card>() {
|
||||||
@Override
|
@Override
|
||||||
@@ -586,13 +582,6 @@ public class AiAttackController {
|
|||||||
* @return a {@link forge.game.combat.Combat} object.
|
* @return a {@link forge.game.combat.Combat} object.
|
||||||
*/
|
*/
|
||||||
public final void declareAttackers(final Combat combat) {
|
public final void declareAttackers(final Combat combat) {
|
||||||
// if this method is called multiple times during a turn,
|
|
||||||
// it will always return the same value
|
|
||||||
// randomInt is used so that the computer doesn't always
|
|
||||||
// do the same thing on turn 3 if he had the same creatures in play
|
|
||||||
// I know this is a little confusing
|
|
||||||
|
|
||||||
random.setSeed(ai.getGame().getPhaseHandler().getTurn() + AiAttackController.randomInt);
|
|
||||||
|
|
||||||
if (this.attackers.isEmpty()) {
|
if (this.attackers.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
@@ -1334,7 +1323,7 @@ public class AiAttackController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!shouldExert && random.nextBoolean()) {
|
if (!shouldExert && MyRandom.getRandom().nextBoolean()) {
|
||||||
// TODO Improve when the AI wants to use Exert powers
|
// TODO Improve when the AI wants to use Exert powers
|
||||||
shouldExert = true;
|
shouldExert = true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user