mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
-Improved AI using Sarkhan, the Dragonspeaker.
This commit is contained in:
@@ -125,7 +125,7 @@ public class AnimateAi extends SpellAbilityAi {
|
|||||||
// don't use instant speed animate abilities outside humans
|
// don't use instant speed animate abilities outside humans
|
||||||
// Combat_Declare_Attackers_InstantAbility step
|
// Combat_Declare_Attackers_InstantAbility step
|
||||||
if (ph.getPlayerTurn().isOpponentOf(aiPlayer) &&
|
if (ph.getPlayerTurn().isOpponentOf(aiPlayer) &&
|
||||||
(!ph.is(PhaseType.COMBAT_DECLARE_ATTACKERS, opponent) || (game.getCombat() != null && game.getCombat().getAttackersOf(aiPlayer).isEmpty()))) {
|
(!ph.is(PhaseType.COMBAT_DECLARE_ATTACKERS, opponent) || game.getCombat() != null && game.getCombat().getAttackersOf(aiPlayer).isEmpty())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148,9 +148,12 @@ public class AnimateAi extends SpellAbilityAi {
|
|||||||
} if ("Never".equals(sa.getParam("AILogic"))) {
|
} if ("Never".equals(sa.getParam("AILogic"))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else for (final Card c : defined) {
|
} else {
|
||||||
|
boolean givesHaste = sa.hasParam("Keywords") && sa.getParam("Keywords").contains("Haste");
|
||||||
|
System.out.println("animateAI : haste = " + givesHaste);
|
||||||
|
for (final Card c : defined) {
|
||||||
bFlag |= !c.isCreature() && !c.isTapped()
|
bFlag |= !c.isCreature() && !c.isTapped()
|
||||||
&& !(c.getTurnInZone() == game.getPhaseHandler().getTurn())
|
&& (c.getTurnInZone() != game.getPhaseHandler().getTurn() || givesHaste)
|
||||||
&& !c.isEquipping();
|
&& !c.isEquipping();
|
||||||
|
|
||||||
// for creatures that could be improved (like Figure of Destiny)
|
// for creatures that could be improved (like Figure of Destiny)
|
||||||
@@ -179,6 +182,7 @@ public class AnimateAi extends SpellAbilityAi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!bFlag) { // All of the defined stuff is animated, not very
|
if (!bFlag) { // All of the defined stuff is animated, not very
|
||||||
// useful
|
// useful
|
||||||
@@ -224,9 +228,11 @@ public class AnimateAi extends SpellAbilityAi {
|
|||||||
CardCollectionView list = aiPlayer.getGame().getCardsIn(tgt.getZone());
|
CardCollectionView list = aiPlayer.getGame().getCardsIn(tgt.getZone());
|
||||||
list = CardLists.getValidCards(list, tgt.getValidTgts(), sa.getActivatingPlayer(), animateSource);
|
list = CardLists.getValidCards(list, tgt.getValidTgts(), sa.getActivatingPlayer(), animateSource);
|
||||||
CardCollection prefList = CardLists.getValidCards(list, sa.getParam("AITgts"), sa.getActivatingPlayer(), animateSource);
|
CardCollection prefList = CardLists.getValidCards(list, sa.getParam("AITgts"), sa.getActivatingPlayer(), animateSource);
|
||||||
|
if (!prefList.isEmpty()){
|
||||||
CardLists.shuffle(prefList);
|
CardLists.shuffle(prefList);
|
||||||
sa.getTargets().add(prefList.getFirst());
|
sa.getTargets().add(prefList.getFirst());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user