- Extended OblivionRing logic for Suspension Field

- Implemented rudimentary logic for Outlast
- Fixed mana cost for Dazzling Ramparts
This commit is contained in:
excessum
2014-09-20 10:24:43 +00:00
parent 072a0941e1
commit c8b57e90ed
3 changed files with 34 additions and 9 deletions

View File

@@ -730,7 +730,18 @@ public class AiController {
final ZoneType origin = ZoneType.listValueOf(effectExile.getParam("Origin")).get(0);
final TargetRestrictions tgt = effectExile.getTargetRestrictions();
final List<Card> list = CardLists.getValidCards(game.getCardsIn(origin), tgt.getValidTgts(), player, card);
if (CardLists.getTargetableCards(list, sa).isEmpty()) {
List<Card> targets = CardLists.getTargetableCards(list, sa);
if (sa.getHostCard().getName().equals("Suspension Field")) {
//existing "exile until leaves" enchantments only target opponent's permanents
final Player ai = sa.getActivatingPlayer();
targets = CardLists.filter(targets, new Predicate<Card>() {
@Override
public boolean apply(final Card c) {
return !c.getController().equals(ai);
}
});
}
if (targets.isEmpty()) {
return AiPlayDecision.AnotherTime;
}
}

View File

@@ -11,6 +11,7 @@ import forge.game.card.CardLists;
import forge.game.card.CounterType;
import forge.game.combat.CombatUtil;
import forge.game.cost.Cost;
import forge.game.phase.PhaseHandler;
import forge.game.phase.PhaseType;
import forge.game.player.Player;
import forge.game.player.PlayerActionConfirmMode;
@@ -163,6 +164,19 @@ public class CountersPutAi extends SpellAbilityAi {
}
}
PhaseHandler ph = ai.getGame().getPhaseHandler();
if (sa.isOutlast()) {
if (ph.is(PhaseType.MAIN2, ai)) { //applicable to non-attackers only
float chance = 0.8f;
if (!ai.getOpponent().getCreaturesInPlay().isEmpty()) {
chance /= 2; //needs a better way to check if target is required as a blocker
}
return chance > r.nextFloat();
} else {
return false;
}
}
// don't use it if no counters to add
if (amount <= 0) {
return false;

View File

@@ -1,5 +1,5 @@
Name:Dazzling Ramparts
ManaCost:1 W
ManaCost:4 W
Types:Creature Wall
PT:0/7
K:Defender