mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
Merge branch 'master' into 'master'
Improved AI card choice for Phylactery Lich. See merge request core-developers/forge!1131
This commit is contained in:
@@ -4,6 +4,7 @@ import java.util.Collections;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
|
import com.google.common.base.Predicates;
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
@@ -274,6 +275,22 @@ public class ChooseCardAi extends SpellAbilityAi {
|
|||||||
if (ai.equals(sa.getActivatingPlayer())) {
|
if (ai.equals(sa.getActivatingPlayer())) {
|
||||||
choice = ComputerUtilCard.getBestAI(options);
|
choice = ComputerUtilCard.getBestAI(options);
|
||||||
} // TODO: improve ai
|
} // TODO: improve ai
|
||||||
|
} else if (logic.equals("Phylactery")) {
|
||||||
|
CardCollection aiArtifacts = CardLists.filter(ai.getCardsIn(ZoneType.Battlefield), Presets.ARTIFACTS);
|
||||||
|
CardCollection indestructibles = CardLists.filter(aiArtifacts, CardPredicates.hasKeyword(Keyword.INDESTRUCTIBLE));
|
||||||
|
CardCollection nonCreatures = CardLists.filter(aiArtifacts, Predicates.not(Presets.CREATURES));
|
||||||
|
CardCollection creatures = CardLists.filter(aiArtifacts, Presets.CREATURES);
|
||||||
|
if (!indestructibles.isEmpty()) {
|
||||||
|
// Choose the worst (smallest) indestructible artifact so that the opponent would have to waste
|
||||||
|
// removal on something unpreferred
|
||||||
|
choice = ComputerUtilCard.getWorstAI(indestructibles);
|
||||||
|
} else if (!nonCreatures.isEmpty()) {
|
||||||
|
// The same as above, but for non-indestructible non-creature artifacts (they can't die in combat)
|
||||||
|
choice = ComputerUtilCard.getWorstAI(nonCreatures);
|
||||||
|
} else if (!creatures.isEmpty()) {
|
||||||
|
// Choose the best (hopefully the fattest, whatever) creature so that hopefully it won't die too easily
|
||||||
|
choice = ComputerUtilCard.getBestAI(creatures);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
choice = ComputerUtilCard.getBestAI(options);
|
choice = ComputerUtilCard.getBestAI(options);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ Types:Creature Zombie
|
|||||||
PT:5/5
|
PT:5/5
|
||||||
K:Indestructible
|
K:Indestructible
|
||||||
K:ETBReplacement:Other:TrigChooseArtifact
|
K:ETBReplacement:Other:TrigChooseArtifact
|
||||||
SVar:TrigChooseArtifact:DB$ ChooseCard | Choices$ Artifact.YouCtrl | RememberChosen$ True | SubAbility$ DBPutCounter | SpellDescription$ As CARDNAME enters the battlefield, put a phylactery counter on an artifact you control.
|
SVar:TrigChooseArtifact:DB$ ChooseCard | Choices$ Artifact.YouCtrl | RememberChosen$ True | SubAbility$ DBPutCounter | AILogic$ Phylactery | SpellDescription$ As CARDNAME enters the battlefield, put a phylactery counter on an artifact you control.
|
||||||
SVar:DBPutCounter:DB$ PutCounter | CounterType$ PHYLACTERY | CounterNum$ 1 | Defined$ Remembered | SubAbility$ DBCleanup
|
SVar:DBPutCounter:DB$ PutCounter | CounterType$ PHYLACTERY | CounterNum$ 1 | Defined$ Remembered | SubAbility$ DBCleanup
|
||||||
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
|
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
|
||||||
T:Mode$ Always | TriggerZones$ Battlefield | IsPresent$ Permanent.counters_GE1_PHYLACTERY+YouCtrl | PresentCompare$ EQ0 | Execute$ TrigSac | TriggerDescription$ When you control no permanents with phylactery counters on them, sacrifice CARDNAME.
|
T:Mode$ Always | TriggerZones$ Battlefield | IsPresent$ Permanent.counters_GE1_PHYLACTERY+YouCtrl | PresentCompare$ EQ0 | Execute$ TrigSac | TriggerDescription$ When you control no permanents with phylactery counters on them, sacrifice CARDNAME.
|
||||||
|
|||||||
Reference in New Issue
Block a user