mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
- Added AI support for Wash Out.
This commit is contained in:
@@ -8,13 +8,13 @@ import com.google.common.collect.Iterables;
|
|||||||
import forge.card.CardType;
|
import forge.card.CardType;
|
||||||
import forge.card.ColorSet;
|
import forge.card.ColorSet;
|
||||||
import forge.card.MagicColor;
|
import forge.card.MagicColor;
|
||||||
|
import forge.card.MagicColor.Constant;
|
||||||
import forge.deck.CardPool;
|
import forge.deck.CardPool;
|
||||||
import forge.deck.Deck;
|
import forge.deck.Deck;
|
||||||
import forge.deck.DeckSection;
|
import forge.deck.DeckSection;
|
||||||
import forge.game.Game;
|
import forge.game.Game;
|
||||||
import forge.game.ability.AbilityUtils;
|
import forge.game.ability.AbilityUtils;
|
||||||
import forge.game.card.*;
|
import forge.game.card.*;
|
||||||
import forge.game.card.CardCollectionView;
|
|
||||||
import forge.game.combat.Combat;
|
import forge.game.combat.Combat;
|
||||||
import forge.game.combat.CombatUtil;
|
import forge.game.combat.CombatUtil;
|
||||||
import forge.game.phase.PhaseHandler;
|
import forge.game.phase.PhaseHandler;
|
||||||
@@ -905,6 +905,24 @@ public class ComputerUtilCard {
|
|||||||
chosen.add(prominence.get(0));
|
chosen.add(prominence.get(0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (logic.equals("MostExcessOpponentControls")) {
|
||||||
|
int maxExcess = 0;
|
||||||
|
String bestColor = Constant.GREEN;
|
||||||
|
for (byte color : MagicColor.WUBRG) {
|
||||||
|
CardCollectionView ailist = ai.getCardsIn(ZoneType.Battlefield);
|
||||||
|
CardCollectionView opplist = ai.getOpponent().getCardsIn(ZoneType.Battlefield);
|
||||||
|
|
||||||
|
ailist = CardLists.filter(ailist, CardPredicates.isColor(color));
|
||||||
|
opplist = CardLists.filter(opplist, CardPredicates.isColor(color));
|
||||||
|
|
||||||
|
int excess = evaluatePermanentList(opplist) - evaluatePermanentList(ailist);
|
||||||
|
if (excess > maxExcess) {
|
||||||
|
maxExcess = excess;
|
||||||
|
bestColor = MagicColor.toLongString(color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
chosen.add(bestColor);
|
||||||
|
}
|
||||||
else if (logic.equals("MostProminentKeywordInComputerDeck")) {
|
else if (logic.equals("MostProminentKeywordInComputerDeck")) {
|
||||||
CardCollectionView list = ai.getAllCards();
|
CardCollectionView list = ai.getAllCards();
|
||||||
int m1 = 0;
|
int m1 = 0;
|
||||||
|
|||||||
@@ -1,10 +1,16 @@
|
|||||||
package forge.ai.ability;
|
package forge.ai.ability;
|
||||||
|
|
||||||
import forge.ai.ComputerUtil;
|
import forge.ai.ComputerUtil;
|
||||||
|
import forge.ai.ComputerUtilCard;
|
||||||
import forge.ai.ComputerUtilMana;
|
import forge.ai.ComputerUtilMana;
|
||||||
import forge.ai.SpellAbilityAi;
|
import forge.ai.SpellAbilityAi;
|
||||||
|
import forge.card.MagicColor;
|
||||||
|
import forge.card.MagicColor.Constant;
|
||||||
import forge.game.Game;
|
import forge.game.Game;
|
||||||
import forge.game.card.Card;
|
import forge.game.card.Card;
|
||||||
|
import forge.game.card.CardCollectionView;
|
||||||
|
import forge.game.card.CardLists;
|
||||||
|
import forge.game.card.CardPredicates;
|
||||||
import forge.game.phase.PhaseHandler;
|
import forge.game.phase.PhaseHandler;
|
||||||
import forge.game.phase.PhaseType;
|
import forge.game.phase.PhaseType;
|
||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
@@ -22,6 +28,7 @@ public class ChooseColorAi extends SpellAbilityAi {
|
|||||||
if (!sa.hasParam("AILogic")) {
|
if (!sa.hasParam("AILogic")) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
final String logic = sa.getParam("AILogic");
|
||||||
|
|
||||||
if (ComputerUtil.preventRunAwayActivations(sa)) {
|
if (ComputerUtil.preventRunAwayActivations(sa)) {
|
||||||
return false;
|
return false;
|
||||||
@@ -45,6 +52,22 @@ public class ChooseColorAi extends SpellAbilityAi {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (logic.equals("MostExcessOpponentControls")) {
|
||||||
|
for (byte color : MagicColor.WUBRG) {
|
||||||
|
CardCollectionView ailist = ai.getCardsIn(ZoneType.Battlefield);
|
||||||
|
CardCollectionView opplist = ai.getOpponent().getCardsIn(ZoneType.Battlefield);
|
||||||
|
|
||||||
|
ailist = CardLists.filter(ailist, CardPredicates.isColor(color));
|
||||||
|
opplist = CardLists.filter(opplist, CardPredicates.isColor(color));
|
||||||
|
|
||||||
|
int excess = ComputerUtilCard.evaluatePermanentList(opplist) - ComputerUtilCard.evaluatePermanentList(ailist);
|
||||||
|
if (excess > 4) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
boolean chance = MyRandom.getRandom().nextFloat() <= Math.pow(.6667, sa.getActivationsThisTurn());
|
boolean chance = MyRandom.getRandom().nextFloat() <= Math.pow(.6667, sa.getActivationsThisTurn());
|
||||||
return chance;
|
return chance;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
Name:Wash Out
|
Name:Wash Out
|
||||||
ManaCost:3 U
|
ManaCost:3 U
|
||||||
Types:Sorcery
|
Types:Sorcery
|
||||||
A:SP$ ChooseColor | Cost$ 3 U | Defined$ You | AILogic$ MostProminentHumanCreatures | SubAbility$ DBWash | SpellDescription$ Return all permanents of the color of your choice to their owners' hands.
|
A:SP$ ChooseColor | Cost$ 3 U | Defined$ You | AILogic$ MostProminentHumanCreatures | SubAbility$ DBWash | AILogic$ MostExcessOpponentControls | SpellDescription$ Return all permanents of the color of your choice to their owners' hands.
|
||||||
SVar:DBWash:DB$ ChangeZoneAll | ChangeType$ Permanent.ChosenColor | Origin$ Battlefield | Destination$ Hand
|
SVar:DBWash:DB$ ChangeZoneAll | ChangeType$ Permanent.ChosenColor | Origin$ Battlefield | Destination$ Hand
|
||||||
SVar:RemAIDeck:True
|
|
||||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/wash_out.jpg
|
SVar:Picture:http://www.wizards.com/global/images/magic/general/wash_out.jpg
|
||||||
Oracle:Return all permanents of the color of your choice to their owners' hands.
|
Oracle:Return all permanents of the color of your choice to their owners' hands.
|
||||||
|
|||||||
Reference in New Issue
Block a user