mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
- Little improvements in the AI part of AF Discard (triggers and drawbacks).
- Enabled the AI of AF ChooseColor for spells (strictly dependent on the subabilities).
This commit is contained in:
@@ -569,7 +569,13 @@ public final class AbilityFactory_Choose {
|
||||
*/
|
||||
private static boolean chooseColorCanPlayAI(final AbilityFactory af, final SpellAbility sa) {
|
||||
// Note: if (AILogic == MostProminentAttackers) return isDuringCombat();
|
||||
return AbilityFactory_Choose.chooseColorTriggerAI(af, sa, false);
|
||||
boolean chance = true;
|
||||
|
||||
Ability_Sub subAb = sa.getSubAbility();
|
||||
if (subAb != null) {
|
||||
chance &= subAb.chkAIDrawback();
|
||||
}
|
||||
return chance;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -588,18 +594,6 @@ public final class AbilityFactory_Choose {
|
||||
private static boolean chooseColorTriggerAI(final AbilityFactory af,
|
||||
final SpellAbility sa, final boolean mandatory) {
|
||||
return false;
|
||||
/*
|
||||
* if (!ComputerUtil.canPayCost(sa)) { return false; }
|
||||
*
|
||||
* Target tgt = sa.getTarget();
|
||||
*
|
||||
* if (sa.getTarget() != null) { tgt.resetTargets();
|
||||
* sa.getTarget().addTarget(AllZone.getComputerPlayer()); } else {
|
||||
* ArrayList<Player> tgtPlayers =
|
||||
* AbilityFactory.getDefinedPlayers(sa.getSourceCard(),
|
||||
* af.getMapParams().get("Defined"), sa); for (Player p : tgtPlayers) {
|
||||
* if (p.isHuman() && !mandatory) { return false; } } } return true;
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1355,9 +1355,6 @@ public class AbilityFactory_ZoneAffecting {
|
||||
boolean humanHasHand = AllZone.getHumanPlayer().getCardsIn(Constant.Zone.Hand).size() > 0;
|
||||
|
||||
if (tgt != null) {
|
||||
if (!humanHasHand) {
|
||||
return false;
|
||||
}
|
||||
discardTargetAI(af, sa);
|
||||
} else {
|
||||
// TODO: Add appropriate restrictions
|
||||
@@ -1442,6 +1439,8 @@ public class AbilityFactory_ZoneAffecting {
|
||||
*/
|
||||
private static boolean discardTargetAI(final AbilityFactory af, final SpellAbility sa) {
|
||||
Target tgt = af.getAbTgt();
|
||||
if(AllZone.getHumanPlayer().getCardsIn(Constant.Zone.Hand).size() < 1)
|
||||
return false;
|
||||
if (tgt != null) {
|
||||
if (AllZone.getHumanPlayer().canTarget(sa)) {
|
||||
tgt.addTarget(AllZone.getHumanPlayer());
|
||||
@@ -1499,7 +1498,7 @@ public class AbilityFactory_ZoneAffecting {
|
||||
// if parent draws cards, make sure cards in hand + cards drawn > 0
|
||||
Target tgt = af.getAbTgt();
|
||||
if (tgt != null) {
|
||||
discardTargetAI(af, subAb);
|
||||
return discardTargetAI(af, subAb);
|
||||
}
|
||||
// TODO: check for some extra things
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user