AI fixes:

* Gain control abilities - fixed wrong target chooses by AI (selects weakest permanent instead most powerful);
* Target of an opponent’s choice abilities - fixed that AI was able to cancel card cast, fixed wrong target chooses (Evangelize, Echo Chamber, Arena, Preacher, etc);
This commit is contained in:
Oleg Agafonov 2020-01-04 22:37:16 +04:00
parent bcb37992cc
commit bb59cedbd9
12 changed files with 137 additions and 93 deletions

View file

@ -17,7 +17,7 @@ public enum Outcome {
PutCreatureInPlay(true),
PutCardInPlay(true),
PutLandInPlay(true),
GainControl(false),
GainControl(true),
DrawCard(true),
Discard(false),
Sacrifice(false),
@ -40,7 +40,7 @@ public enum Outcome {
Removal(false),
AIDontUseIt(false),
Vote(true);
private final boolean good; // good or bad for targets in current effect
private final boolean good; // good or bad effect for targeting player (for AI usage)
private boolean canTargetAll;
Outcome(boolean good) {
@ -59,4 +59,13 @@ public enum Outcome {
public boolean isCanTargetAll() {
return canTargetAll;
}
public static Outcome inverse(Outcome outcome) {
// inverse bad/good effect (as example, after controlling player change)
if (outcome.isGood()) {
return Outcome.Detriment;
} else {
return Outcome.Benefit;
}
}
}