- Basic Balan, Wandering Knight AI logic

This commit is contained in:
Michael Kamensky
2020-08-14 20:20:31 +03:00
parent 5fd74c53c9
commit 9630786fa6
2 changed files with 18 additions and 2 deletions

View File

@@ -1,13 +1,16 @@
package forge.ai.ability;
import com.google.common.base.Predicate;
import forge.ai.ComputerUtilCard;
import forge.ai.SpecialCardAi;
import forge.ai.SpellAbilityAi;
import forge.game.ability.AbilityUtils;
import forge.game.card.Card;
import forge.game.card.CardCollection;
import forge.game.card.CardLists;
import forge.game.card.CardPredicates.Presets;
import forge.game.card.CardUtil;
import forge.game.phase.PhaseType;
import forge.game.player.Player;
import forge.game.spellability.AbilitySub;
import forge.game.spellability.SpellAbility;
@@ -93,8 +96,21 @@ public class RepeatEachAi extends SpellAbilityAi {
}
}
}
// would not hit oppoent, don't do that
// would not hit opponent, don't do that
return hitOpp;
} else if ("EquipAll".equals(logic)) {
if (aiPlayer.getGame().getPhaseHandler().is(PhaseType.MAIN1, aiPlayer)) {
final CardCollection unequipped = CardLists.filter(aiPlayer.getCardsIn(ZoneType.Battlefield), new Predicate<Card>() {
@Override
public boolean apply(Card card) {
return card.isEquipment() && card.getAttachedTo() != sa.getHostCard();
}
});
return !unequipped.isEmpty();
}
return false;
}
// TODO Add some normal AI variability here

View File

@@ -4,7 +4,7 @@ Types:Legendary Creature Cat Knight
PT:3/3
K:First Strike
S:Mode$ Continuous | Affected$ Card.Self | AddKeyword$ Double Strike | CheckSVar$ X | SVarCompare$ GE2 | Description$ CARDNAME has double strike as long as two or more Equipment are attached to it.
A:AB$ RepeatEach | Cost$ 1 W | RepeatSubAbility$ DBAttach | RepeatCards$ Equipment.YouCtrl | SpellDescription$ Attach all Equipment you control to CARDNAME.
A:AB$ RepeatEach | Cost$ 1 W | RepeatSubAbility$ DBAttach | RepeatCards$ Equipment.YouCtrl | AILogic$ EquipAll | SpellDescription$ Attach all Equipment you control to CARDNAME.
SVar:DBAttach:DB$ Attach | Object$ Remembered | Defined$ Self
SVar:X:Count$Valid Equipment.Attached
SVar:EquipMe:Multiple