mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
- Added some AI for Animate Artifact.
This commit is contained in:
@@ -3,7 +3,7 @@ ManaCost:3 U
|
||||
Types:Enchantment Aura
|
||||
Text:no text
|
||||
K:Enchant artifact
|
||||
A:SP$ Attach | Cost$ 3 U | ValidTgts$ Artifact | AILogic$ Pump
|
||||
A:SP$ Attach | Cost$ 3 U | ValidTgts$ Artifact | AILogic$ Animate
|
||||
S:Mode$ Continuous | Affected$ Card.AttachedBy+nonCreature | SetPower$ AffectedX | SetToughness$ AffectedX | AddType$ Creature | Description$ As long as enchanted artifact isn't a creature, it's an artifact creature with power and toughness each equal to its converted mana cost.
|
||||
SVar:AffectedX:Count$CardManaCost
|
||||
SVar:Rarity:Uncommon
|
||||
|
||||
@@ -391,7 +391,10 @@ public class AbilityFactoryAttach {
|
||||
*/
|
||||
public static Card attachGeneralAI(final SpellAbility sa, final CardList list, final boolean mandatory,
|
||||
final Card attachSource, final String logic) {
|
||||
final Player prefPlayer = "Pump".equals(logic) ? AllZone.getComputerPlayer() : AllZone.getHumanPlayer();
|
||||
Player prefPlayer = AllZone.getHumanPlayer();
|
||||
if ("Pump".equals(logic) || "Animate".equals(logic) ) {
|
||||
prefPlayer = AllZone.getComputerPlayer();
|
||||
}
|
||||
// Some ChangeType cards are beneficial, and PrefPlayer should be
|
||||
// changed to represent that
|
||||
final CardList prefList = list.getController(prefPlayer);
|
||||
@@ -414,6 +417,8 @@ public class AbilityFactoryAttach {
|
||||
c = AbilityFactoryAttach.attachAIChangeTypePreference(sa, prefList, mandatory, attachSource);
|
||||
} else if ("KeepTapped".equals(logic)) {
|
||||
c = AbilityFactoryAttach.attachAIKeepTappedPreference(sa, prefList, mandatory, attachSource);
|
||||
} else if ("Animate".equals(logic)) {
|
||||
c = AbilityFactoryAttach.attachAIAnimatePreference(sa, prefList, mandatory, attachSource);
|
||||
}
|
||||
|
||||
return c;
|
||||
@@ -478,6 +483,43 @@ public class AbilityFactoryAttach {
|
||||
return c;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attach ai control preference.
|
||||
*
|
||||
* @param sa
|
||||
* the sa
|
||||
* @param list
|
||||
* the list
|
||||
* @param mandatory
|
||||
* the mandatory
|
||||
* @param attachSource
|
||||
* the attach source
|
||||
* @return the card
|
||||
*/
|
||||
public static Card attachAIAnimatePreference(final SpellAbility sa, final CardList list, final boolean mandatory,
|
||||
final Card attachSource) {
|
||||
// AI For choosing a Card to Animate.
|
||||
CardList betterList = list.getNotType("Creature");
|
||||
if (sa.getSourceCard().getName().equals("Animate Artifact")) {
|
||||
betterList = betterList.filter(new CardListFilter() {
|
||||
@Override
|
||||
public boolean addCard(final Card c) {
|
||||
return c.getCMC() > 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
final Card c = CardFactoryUtil.getMostExpensivePermanentAI(betterList);
|
||||
|
||||
// If Mandatory (brought directly into play without casting) gotta
|
||||
// choose something
|
||||
if (c == null && mandatory) {
|
||||
return AbilityFactoryAttach.chooseLessPreferred(mandatory, list);
|
||||
}
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
// Should generalize this code a bit since they all have similar structures
|
||||
/**
|
||||
* Attach ai control preference.
|
||||
|
||||
Reference in New Issue
Block a user