From ede42d710aec0ae82af65973d51ed51dba0b74b7 Mon Sep 17 00:00:00 2001 From: Sol Date: Sat, 9 Mar 2013 03:41:30 +0000 Subject: [PATCH] - Added Natural Balance --- .gitattributes | 1 + res/cardsfolder/n/natural_balance.txt | 12 ++++++++++++ .../java/forge/card/ability/ai/RepeatEachAi.java | 11 +++++++++++ 3 files changed, 24 insertions(+) create mode 100644 res/cardsfolder/n/natural_balance.txt diff --git a/.gitattributes b/.gitattributes index 7654882796d..c65e1045e79 100644 --- a/.gitattributes +++ b/.gitattributes @@ -7038,6 +7038,7 @@ res/cardsfolder/n/nath_of_the_gilt_leaf.txt svneol=native#text/plain res/cardsfolder/n/naths_buffoon.txt svneol=native#text/plain res/cardsfolder/n/naths_elite.txt svneol=native#text/plain res/cardsfolder/n/natural_affinity.txt svneol=native#text/plain +res/cardsfolder/n/natural_balance.txt -text res/cardsfolder/n/natural_emergence.txt -text svneol=unset#text/plain res/cardsfolder/n/natural_end.txt -text res/cardsfolder/n/natural_order.txt svneol=native#text/plain diff --git a/res/cardsfolder/n/natural_balance.txt b/res/cardsfolder/n/natural_balance.txt new file mode 100644 index 00000000000..42c0bd771bf --- /dev/null +++ b/res/cardsfolder/n/natural_balance.txt @@ -0,0 +1,12 @@ +Name:Natural Balance +ManaCost:2 G G +Types:Sorcery +A:SP$ RepeatEach | Cost$ 2 G G | RepeatPlayers$ Player | RepeatSubAbility$ BalanceLands | AILogic$ BalanceLands | SpellDescription$ Each player who controls six or more lands chooses five lands he or she controls and sacrifices the rest. Each player who controls four or fewer lands may search his or her library for up to X basic land cards and put them onto the battlefield, where X is five minus the number of lands he or she controls. Then each player who searched his or her library this way shuffles it. +SVar:BalanceLands:DB$ Sacrifice | SacValid$ Land | Amount$ SacX | Defined$ Remembered | ConditionCheckSVar$ SacX | ConditionSVarCompare$ GT0 | SubAbility$ FetchLands +SVar:FetchLands:DB$ ChangeZone | Origin$ Library | Destination$ Battlefield | ChangeType$ Land.Basic | ChangeNum$ FetchX | DefinedPlayer$ Remembered | ConditionCheckSVar$ FetchX | ConditionSVarCompare$ GT0 +SVar:LandsControlled:Count$Valid Land.RememberedPlayerCtrl +SVar:SacX:SVar$LandsControlled/Minus.5 +SVar:FetchX:Number$5/Minus.LandsControlled +SVar:Picture:http://www.wizards.com/global/images/magic/general/natural_balance.jpg +SetInfo:MIR Rare +Oracle:Each player who controls six or more lands chooses five lands he or she controls and sacrifices the rest. Each player who controls four or fewer lands may search his or her library for up to X basic land cards and put them onto the battlefield, where X is five minus the number of lands he or she controls. Then each player who searched his or her library this way shuffles it. diff --git a/src/main/java/forge/card/ability/ai/RepeatEachAi.java b/src/main/java/forge/card/ability/ai/RepeatEachAi.java index 66184930fa2..aad1ce01446 100644 --- a/src/main/java/forge/card/ability/ai/RepeatEachAi.java +++ b/src/main/java/forge/card/ability/ai/RepeatEachAi.java @@ -86,6 +86,17 @@ public class RepeatEachAi extends SpellAbilityAi { } tgt.addTarget(list.get(0)); + } else if ("BalanceLands".equals(logic)) { + if (CardLists.filter(aiPlayer.getCardsIn(ZoneType.Battlefield), Presets.LANDS).size() >= 5) { + return false; + } + + List opponents = aiPlayer.getOpponents(); + for(Player opp : opponents) { + if (CardLists.filter(opp.getCardsIn(ZoneType.Battlefield), Presets.LANDS).size() < 4) { + return false; + } + } } // TODO Add some normal AI variability here