Narset Tramscendent: add Logic for the Rebound Ability, only aktivate it if it can play a spell without rebound this turn

This commit is contained in:
Hanmac
2016-05-10 15:02:27 +00:00
parent 8cc98a7d89
commit 0d797f2365
2 changed files with 23 additions and 3 deletions

View File

@@ -3,6 +3,7 @@ package forge.ai.ability;
import com.google.common.base.Predicate;
import com.google.common.collect.Iterables;
import forge.ai.ComputerUtil;
import forge.ai.ComputerUtilCard;
import forge.ai.ComputerUtilCombat;
import forge.ai.SpellAbilityAi;
@@ -27,7 +28,7 @@ import java.util.Random;
public class EffectAi extends SpellAbilityAi {
@Override
protected boolean canPlayAI(Player ai, SpellAbility sa) {
protected boolean canPlayAI(final Player ai, SpellAbility sa) {
final Game game = ai.getGame();
final Random r = MyRandom.getRandom();
boolean randomReturn = r.nextFloat() <= .6667;
@@ -89,6 +90,26 @@ public class EffectAi extends SpellAbilityAi {
|| CardLists.getType(ai.getCardsIn(ZoneType.Battlefield), "Planeswalker").isEmpty()) {
return false;
}
randomReturn = true;
} else if (logic.equals("NarsetRebound")) {
// should be done in Main2, but it might broke for other cards
//if (phase.getPhase().isBefore(PhaseType.MAIN2)) {
// return false;
//}
// fetch Instant or Sorcery without Rebound and AI has reason to play this turn
// only need count, not the list
final int count = CardLists.count(ai.getCardsIn(ZoneType.Hand), new Predicate<Card>() {
@Override
public boolean apply(final Card c) {
return (c.isInstant() || c.isSorcery()) && !c.hasKeyword("Rebound") && ComputerUtil.hasReasonToPlayCardThisTurn(ai, c);
}
});
if(count == 0) {
return false;
}
randomReturn = true;
} else if (logic.equals("Always")) {
randomReturn = true;

View File

@@ -5,12 +5,11 @@ Loyalty:6
A:AB$ PeekAndReveal | Cost$ AddCounter<1/LOYALTY> | Planeswalker$ True | AILogic$ Main2 | PeekAmount$ 1 | RevealValid$ Card.nonCreature+nonLand | RevealOptional$ True | RememberRevealed$ True | SubAbility$ DBChangeZone | SpellDescription$ Look at the top card of your library. If it's a noncreature, nonland card, you may reveal it and put it into your hand.
SVar:DBChangeZone:DB$ ChangeZone | Defined$ TopOfLibrary | Origin$ Library | Destination$ Hand | ConditionDefined$ Remembered | ConditionPresent$ Card.nonCreature+nonLand | ConditionCompare$ EQ1 | SubAbility$ DBCleanupOne
SVar:DBCleanupOne:DB$ Cleanup | ClearRemembered$ True
A:AB$Effect | Cost$ SubCounter<2/LOYALTY> | Planeswalker$ True | Name$ Narset Transcendent effect. | Triggers$ AddRebound | SVars$ AddReboundMain,DBCleanupTwo | SpellDescription$ When you cast your next instant or sorcery spell from your hand this turn, it gains rebound.
A:AB$Effect | Cost$ SubCounter<2/LOYALTY> | Planeswalker$ True | AILogic$ NarsetRebound | Stackable$ False | Name$ Narset Transcendent effect. | Triggers$ AddRebound | SVars$ AddReboundMain,DBCleanupTwo | SpellDescription$ When you cast your next instant or sorcery spell from your hand this turn, it gains rebound.
SVar:AddRebound:Mode$ SpellCast | ValidCard$ Instant.wasCastFromHand,Sorcery.wasCastFromHand | ValidActivatingPlayer$ You | OneOff$ True | Execute$ AddReboundMain | TriggerZones$ Command | TriggerDescription$ When you cast your next instant or sorcery spell from your hand this turn, it gains rebound.
SVar:AddReboundMain:AB$ Pump | Cost$ 0 | Defined$ TriggeredCard| KW$ Rebound | PumpZone$ Stack | SubAbility$ DBCleanupTwo
SVar:DBCleanupTwo:DB$ ChangeZone | Defined$ Self | Origin$ Command | Destination$ Exile
A:AB$ Effect | Cost$ SubCounter<9/LOYALTY> | Name$ Narset Transcendent emblem | StaticAbilities$ STNarset | Planeswalker$ True | Ultimate$ True | Stackable$ False | Duration$ Permanent | AILogic$ Always | SpellDescription$ You get an emblem with "Your opponents can't cast noncreature spells."
SVar:STNarset:Mode$ CantBeCast | ValidCard$ Card.nonCreature | Caster$ Opponent | EffectZone$ Command | Description$ Your opponents can't cast noncreature spells.
SVar:Picture:http://www.wizards.com/global/images/magic/general/narset_transcendent.jpg
SVar:RemAIDeck:True
Oracle:[+1] Look at the top card of your library. If it's a noncreature, nonland card, you may reveal it and put it into your hand.\n[-2] When you cast your next instant or sorcery spell from your hand this turn, it gains rebound.\n[-9] You get an emblem with "Your opponents can't cast noncreature spells."