mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
Splice: do a total rewrite to make it better for the player and more rules conform
This commit is contained in:
@@ -84,7 +84,7 @@ import forge.util.collect.FCollection;
|
||||
* @version $Id$
|
||||
*/
|
||||
public class ComputerUtil {
|
||||
public static boolean handlePlayingSpellAbility(final Player ai, final SpellAbility sa, final Game game) {
|
||||
public static boolean handlePlayingSpellAbility(final Player ai, SpellAbility sa, final Game game) {
|
||||
game.getStack().freezeStack();
|
||||
final Card source = sa.getHostCard();
|
||||
|
||||
@@ -99,6 +99,10 @@ public class ComputerUtil {
|
||||
CharmEffect.makeChoices(sa);
|
||||
}
|
||||
|
||||
if (source.getType().hasStringType("Arcane") && !source.isCopiedSpell()) {
|
||||
sa = AbilityUtils.addSpliceEffects(sa);
|
||||
}
|
||||
|
||||
if (sa.hasParam("Bestow")) {
|
||||
sa.getHostCard().animateBestow();
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.google.common.base.Predicate;
|
||||
import com.google.common.base.Predicates;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.ListMultimap;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Multimap;
|
||||
|
||||
import forge.LobbyPlayer;
|
||||
@@ -898,4 +899,25 @@ public class PlayerControllerAi extends PlayerController {
|
||||
}
|
||||
return SpellApiToAi.Converter.get(api).chooseCardName(player, sa, faces);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Card> chooseCardsForSplice(SpellAbility sa, List<Card> cards) {
|
||||
// sort from best to worst
|
||||
CardLists.sortByCmcDesc(cards);
|
||||
|
||||
List<Card> result = Lists.newArrayList();
|
||||
|
||||
SpellAbility oldSA = sa;
|
||||
// TODO maybe add some more Logic into it
|
||||
for (final Card c : cards) {
|
||||
SpellAbility newSA = oldSA.copy();
|
||||
AbilityUtils.addSpliceEffect(newSA, c);
|
||||
// check if AI still wants or can play the card with spliced effect
|
||||
if (AiPlayDecision.WillPlay == getAi().canPlayFromEffectAI((Spell) newSA, false, false)) {
|
||||
oldSA = newSA;
|
||||
result.add(c);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user