mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
- AI will no longer cast Bolster with no creatures on the BF
- Manifest Ability can't be activated if the original card isn't a creature
This commit is contained in:
@@ -6,10 +6,7 @@ import com.google.common.collect.Iterables;
|
|||||||
import forge.ai.*;
|
import forge.ai.*;
|
||||||
import forge.game.ability.AbilityFactory;
|
import forge.game.ability.AbilityFactory;
|
||||||
import forge.game.ability.AbilityUtils;
|
import forge.game.ability.AbilityUtils;
|
||||||
import forge.game.card.Card;
|
import forge.game.card.*;
|
||||||
import forge.game.card.CardCollection;
|
|
||||||
import forge.game.card.CardLists;
|
|
||||||
import forge.game.card.CounterType;
|
|
||||||
import forge.game.combat.CombatUtil;
|
import forge.game.combat.CombatUtil;
|
||||||
import forge.game.cost.Cost;
|
import forge.game.cost.Cost;
|
||||||
import forge.game.cost.CostPart;
|
import forge.game.cost.CostPart;
|
||||||
@@ -89,6 +86,15 @@ public class CountersPutAi extends SpellAbilityAi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sa.hasParam("Bolster")) {
|
||||||
|
CardCollection creatsYouCtrl = CardLists.filter(ai.getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.CREATURES);
|
||||||
|
CardCollection leastToughness = new CardCollection(Aggregates.listWithMin(creatsYouCtrl, CardPredicates.Accessors.fnGetDefense));
|
||||||
|
if (leastToughness.isEmpty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// TODO If Creature that would be Bolstered for some reason is useless, also return False
|
||||||
|
}
|
||||||
|
|
||||||
if (sa.hasParam("Monstrosity") && source.isMonstrous()) {
|
if (sa.hasParam("Monstrosity") && source.isMonstrous()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -416,6 +416,8 @@ public class Card extends GameEntity implements Comparable<Card> {
|
|||||||
// Turn Face Down (even if it's DFC).
|
// Turn Face Down (even if it's DFC).
|
||||||
ManaCost cost = this.getManaCost();
|
ManaCost cost = this.getManaCost();
|
||||||
|
|
||||||
|
boolean isCreature = this.isCreature();
|
||||||
|
|
||||||
// Sometimes cards are manifested while already being face down
|
// Sometimes cards are manifested while already being face down
|
||||||
if (!turnFaceDown(true) && currentStateName != CardStateName.FaceDown) {
|
if (!turnFaceDown(true) && currentStateName != CardStateName.FaceDown) {
|
||||||
return null;
|
return null;
|
||||||
@@ -430,7 +432,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
|||||||
c.setManifested(true);
|
c.setManifested(true);
|
||||||
|
|
||||||
// Add manifest demorph static ability for creatures?
|
// Add manifest demorph static ability for creatures?
|
||||||
c.addSpellAbility(CardFactoryUtil.abilityManifestFaceUp(c, cost));
|
c.addSpellAbility(CardFactoryUtil.abilityManifestFaceUp(c, cost, isCreature));
|
||||||
|
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ public class CardFactoryUtil {
|
|||||||
return morphUp;
|
return morphUp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AbilityStatic abilityManifestFaceUp(final Card sourceCard, final ManaCost manaCost) {
|
public static AbilityStatic abilityManifestFaceUp(final Card sourceCard, final ManaCost manaCost, final boolean canFlip) {
|
||||||
final Cost cost = new Cost(manaCost, false);
|
final Cost cost = new Cost(manaCost, false);
|
||||||
|
|
||||||
final AbilityStatic manifestUp = new AbilityStatic(sourceCard, cost, null) {
|
final AbilityStatic manifestUp = new AbilityStatic(sourceCard, cost, null) {
|
||||||
@@ -183,10 +183,10 @@ public class CardFactoryUtil {
|
|||||||
@Override
|
@Override
|
||||||
public boolean canPlay() {
|
public boolean canPlay() {
|
||||||
return sourceCard.getController().equals(this.getActivatingPlayer()) && sourceCard.isFaceDown()
|
return sourceCard.getController().equals(this.getActivatingPlayer()) && sourceCard.isFaceDown()
|
||||||
&& sourceCard.isInPlay() && sourceCard.isManifested();
|
&& sourceCard.isInPlay() && sourceCard.isManifested() && canFlip;
|
||||||
}
|
}
|
||||||
|
|
||||||
}; // morph_up
|
}; // manifest_up
|
||||||
|
|
||||||
String costDesc = cost.toString();
|
String costDesc = cost.toString();
|
||||||
// get rid of the ": " at the end
|
// get rid of the ": " at the end
|
||||||
|
|||||||
Reference in New Issue
Block a user