mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
- Improve AI logic for Bound by Moonsilver.
This commit is contained in:
@@ -35,6 +35,7 @@ public enum AiProps { /** */
|
||||
MOVE_EQUIPMENT_TO_BETTER_CREATURES ("from_useless_only"),
|
||||
MOVE_EQUIPMENT_CREATURE_EVAL_THRESHOLD ("60"),
|
||||
PRIORITIZE_MOVE_EQUIPMENT_IF_USELESS ("true"),
|
||||
SAC_TO_REATTACH_TARGET_EVAL_THRESHOLD ("400"),
|
||||
PREDICT_SPELLS_FOR_MAIN2 ("true"), /** */
|
||||
RESERVE_MANA_FOR_MAIN2_CHANCE ("0"), /** */
|
||||
PLAY_AGGRO ("false"),
|
||||
|
||||
@@ -838,7 +838,7 @@ public class AttachAi extends SpellAbilityAi {
|
||||
* @return the card
|
||||
*/
|
||||
private static Card attachAICursePreference(final SpellAbility sa, final List<Card> list, final boolean mandatory,
|
||||
final Card attachSource) {
|
||||
final Card attachSource, final Player ai) {
|
||||
// AI For choosing a Card to Curse of.
|
||||
|
||||
// TODO Figure out some way to combine The "gathering of data" from
|
||||
@@ -930,6 +930,24 @@ public class AttachAi extends SpellAbilityAi {
|
||||
);
|
||||
}
|
||||
|
||||
// If this is already attached and there's a sac cost, make sure we attach to something that's
|
||||
// seriously better than whatever the attachment is currently attached to (e.g. Bound by Moonsilver)
|
||||
if (sa.getHostCard().getAttachedTo() != null && sa.getHostCard().getAttachedTo().isCreature()
|
||||
&& sa.getPayCosts() != null && sa.getPayCosts().hasSpecificCostType(CostSacrifice.class)) {
|
||||
final int oldEvalRating = ComputerUtilCard.evaluateCreature(sa.getHostCard().getAttachedTo());
|
||||
final int threshold = ai.isAI() ? ((PlayerControllerAi)ai.getController()).getAi().getIntProperty(AiProps.SAC_TO_REATTACH_TARGET_EVAL_THRESHOLD) : Integer.MAX_VALUE;
|
||||
prefList = CardLists.filter(prefList, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(Card card) {
|
||||
if (!card.isCreature()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return ComputerUtilCard.evaluateCreature(card) >= oldEvalRating + threshold;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
c = ComputerUtilCard.getBestAI(prefList);
|
||||
|
||||
if (c == null) {
|
||||
@@ -1455,7 +1473,7 @@ public class AttachAi extends SpellAbilityAi {
|
||||
if ("GainControl".equals(logic)) {
|
||||
c = attachAIControlPreference(sa, prefList, mandatory, attachSource);
|
||||
} else if ("Curse".equals(logic)) {
|
||||
c = attachAICursePreference(sa, prefList, mandatory, attachSource);
|
||||
c = attachAICursePreference(sa, prefList, mandatory, attachSource, ai);
|
||||
} else if ("Pump".equals(logic)) {
|
||||
c = attachAIPumpPreference(ai, sa, prefList, mandatory, attachSource);
|
||||
} else if ("Curiosity".equals(logic)) {
|
||||
|
||||
Reference in New Issue
Block a user