mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 03:08:02 +00:00
- Implemented AI for Feat of Resistance
This commit is contained in:
@@ -606,7 +606,7 @@ public class PlayerControllerAi extends PlayerController {
|
|||||||
if (game.stack.size() > 1) {
|
if (game.stack.size() > 1) {
|
||||||
for (SpellAbilityStackInstance si : game.getStack()) {
|
for (SpellAbilityStackInstance si : game.getStack()) {
|
||||||
SpellAbility spell = si.getSpellAbility(true);
|
SpellAbility spell = si.getSpellAbility(true);
|
||||||
if (sa != spell) {
|
if (sa != spell && sa.getHostCard() != spell.getHostCard()) {
|
||||||
String s = ProtectAi.toProtectFrom(spell.getHostCard(), sa);
|
String s = ProtectAi.toProtectFrom(spell.getHostCard(), sa);
|
||||||
if (s != null) {
|
if (s != null) {
|
||||||
return s;
|
return s;
|
||||||
|
|||||||
@@ -86,6 +86,14 @@ public class CountersPutAi extends SpellAbilityAi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (source.getName().equals("Feat of Resistance")) { // sub-ability should take precedence
|
||||||
|
CardCollection prot = ProtectAi.getProtectCreatures(ai, sa.getSubAbility());
|
||||||
|
if (!prot.isEmpty()) {
|
||||||
|
sa.getTargets().add(prot.get(0));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (sa.hasParam("Bolster")) {
|
if (sa.hasParam("Bolster")) {
|
||||||
CardCollection creatsYouCtrl = CardLists.filter(ai.getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.CREATURES);
|
CardCollection creatsYouCtrl = CardLists.filter(ai.getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.CREATURES);
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ public class ProtectAi extends SpellAbilityAi {
|
|||||||
* a {@link forge.game.ability.AbilityFactory} object.
|
* a {@link forge.game.ability.AbilityFactory} object.
|
||||||
* @return a {@link forge.CardList} object.
|
* @return a {@link forge.CardList} object.
|
||||||
*/
|
*/
|
||||||
private static CardCollection getProtectCreatures(final Player ai, final SpellAbility sa) {
|
public static CardCollection getProtectCreatures(final Player ai, final SpellAbility sa) {
|
||||||
final List<String> gains = ProtectEffect.getProtectionList(sa);
|
final List<String> gains = ProtectEffect.getProtectionList(sa);
|
||||||
final Game game = ai.getGame();
|
final Game game = ai.getGame();
|
||||||
final Combat combat = game.getCombat();
|
final Combat combat = game.getCombat();
|
||||||
|
|||||||
Reference in New Issue
Block a user