mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
- Added rudimentary AI logic for Timetwister and promoted it to AI playable.
- This completes the project to get the basic AI logic for the remaining Power Nine cards.
This commit is contained in:
@@ -233,6 +233,31 @@ public class SpecialCardAi {
|
|||||||
return false; // haven't found anything to play with the excess generated mana
|
return false; // haven't found anything to play with the excess generated mana
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Timetwister
|
||||||
|
public static class Timetwister {
|
||||||
|
public static boolean consider(Player ai, SpellAbility sa) {
|
||||||
|
final int aiHandSize = ai.getCardsIn(ZoneType.Hand).size();
|
||||||
|
int maxOppHandSize = 0;
|
||||||
|
|
||||||
|
final int HAND_SIZE_THRESHOLD = 3;
|
||||||
|
|
||||||
|
for (Player p : ai.getOpponents()) {
|
||||||
|
int handSize = p.getCardsIn(ZoneType.Hand).size();
|
||||||
|
if (handSize > maxOppHandSize) {
|
||||||
|
maxOppHandSize = handSize;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (aiHandSize < HAND_SIZE_THRESHOLD || maxOppHandSize - aiHandSize > HAND_SIZE_THRESHOLD) {
|
||||||
|
// use in case we're getting low on cards or if we're significantly behind our opponent in cards in hand
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Yawgmoth's Bargain
|
// Yawgmoth's Bargain
|
||||||
public static class YawgmothsBargain {
|
public static class YawgmothsBargain {
|
||||||
public static boolean consider(Player ai, SpellAbility sa) {
|
public static boolean consider(Player ai, SpellAbility sa) {
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import forge.ai.ComputerUtil;
|
|||||||
import forge.ai.ComputerUtilCard;
|
import forge.ai.ComputerUtilCard;
|
||||||
import forge.ai.ComputerUtilCombat;
|
import forge.ai.ComputerUtilCombat;
|
||||||
import forge.ai.ComputerUtilCost;
|
import forge.ai.ComputerUtilCost;
|
||||||
|
import forge.ai.SpecialCardAi;
|
||||||
import forge.ai.SpellAbilityAi;
|
import forge.ai.SpellAbilityAi;
|
||||||
import forge.game.Game;
|
import forge.game.Game;
|
||||||
import forge.game.ability.AbilityUtils;
|
import forge.game.ability.AbilityUtils;
|
||||||
@@ -70,6 +71,10 @@ public class ChangeZoneAllAi extends SpellAbilityAi {
|
|||||||
CardCollectionView computerType = ai.getCardsIn(origin);
|
CardCollectionView computerType = ai.getCardsIn(origin);
|
||||||
computerType = AbilityUtils.filterListByType(computerType, sa.getParam("ChangeType"), sa);
|
computerType = AbilityUtils.filterListByType(computerType, sa.getParam("ChangeType"), sa);
|
||||||
|
|
||||||
|
if (source.getName().equals("Timetwister")) {
|
||||||
|
return SpecialCardAi.Timetwister.consider(ai, sa);
|
||||||
|
}
|
||||||
|
|
||||||
// Ugin AI: always try to sweep before considering +1
|
// Ugin AI: always try to sweep before considering +1
|
||||||
if (source.getName().equals("Ugin, the Spirit Dragon")) {
|
if (source.getName().equals("Ugin, the Spirit Dragon")) {
|
||||||
final int loyalty = source.getCounters(CounterType.LOYALTY);
|
final int loyalty = source.getCounters(CounterType.LOYALTY);
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
Name:Timetwister
|
Name:Timetwister
|
||||||
ManaCost:2 U
|
ManaCost:2 U
|
||||||
Types:Sorcery
|
Types:Sorcery
|
||||||
A:SP$ ChangeZoneAll | Cost$ 2 U | ChangeType$ Card | Origin$ Hand,Graveyard | Destination$ Library | Shuffle$ True | Random$ True | SubAbility$ DBDraw | UseAllOriginZones$ True | SpellDescription$ Each player shuffles his or her graveyard and hand into his or her library, then draws seven cards.
|
A:SP$ ChangeZoneAll | Cost$ 2 U | ChangeType$ Card | Origin$ Hand,Graveyard | Destination$ Library | Shuffle$ True | Random$ True | SubAbility$ DBDraw | UseAllOriginZones$ True | AILogic$ TimeTwister | SpellDescription$ Each player shuffles his or her graveyard and hand into his or her library, then draws seven cards.
|
||||||
SVar:DBDraw:DB$ Draw | NumCards$ 7 | Defined$ Player
|
SVar:DBDraw:DB$ Draw | NumCards$ 7 | Defined$ Player
|
||||||
SVar:RemAIDeck:True
|
|
||||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/timetwister.jpg
|
SVar:Picture:http://www.wizards.com/global/images/magic/general/timetwister.jpg
|
||||||
Oracle:Each player shuffles his or her hand and graveyard into his or her library, then draws seven cards. (Then put Timetwister into its owner's graveyard.)
|
Oracle:Each player shuffles his or her hand and graveyard into his or her library, then draws seven cards. (Then put Timetwister into its owner's graveyard.)
|
||||||
|
|||||||
Reference in New Issue
Block a user