- Improve AI for Brothers Yamazaki.

This commit is contained in:
Agetian
2018-11-28 15:31:16 +03:00
parent e219d142c7
commit 0a1f2f6670
2 changed files with 19 additions and 2 deletions

View File

@@ -61,8 +61,23 @@ public class PermanentAi extends SpellAbilityAi {
if (card.getType().isLegendary()
&& !game.getStaticEffects().getGlobalRuleChange(GlobalRuleChange.noLegendRule)) {
if (ai.isCardInPlay(card.getName())) {
// AiPlayDecision.WouldDestroyLegend
return false;
if (!card.hasSVar("AILegendaryException")) {
// AiPlayDecision.WouldDestroyLegend
return false;
} else {
String specialRule = card.getSVar("AILegendaryException");
if ("TwoCopiesAllowed".equals(specialRule)) {
// One extra copy allowed on the battlefield, e.g. Brothers Yamazaki
if (CardLists.filter(ai.getCardsIn(ZoneType.Battlefield), CardPredicates.nameEquals(card.getName())).size() > 1) {
return false;
}
} else if ("AlwaysAllowed".equals(specialRule)) {
// Nothing to do here, check for Legendary is disabled
} else {
// Unknown hint, assume two copies not allowed
return false;
}
}
}
}

View File

@@ -7,5 +7,7 @@ S:Mode$ Continuous | Affected$ Permanent.namedBrothers Yamazaki | CheckSVar$ X |
SVar:X:Count$Valid Permanent.namedBrothers Yamazaki
S:Mode$ Continuous | Affected$ Creature.Other+namedBrothers Yamazaki | AddPower$ 2 | AddToughness$ 2 | AddKeyword$ Haste | Description$ Each other creature named CARDNAME gets +2/+2 and has haste.
DeckHints:Name$Brothers Yamazaki
SVar:AILegendaryException:TwoCopiesAllowed
SVar:PlayMain1:TRUE
SVar:Picture:http://www.wizards.com/global/images/magic/general/brothers_yamazaki.jpg
Oracle:Bushido 1 (Whenever this creature blocks or becomes blocked, it gets +1/+1 until end of turn.)\nIf there are exactly two permanents named Brothers Yamazaki on the battlefield, the "legend rule" doesn't apply to them.\nEach other creature named Brothers Yamazaki gets +2/+2 and has haste.