diff --git a/.gitattributes b/.gitattributes index 1665dded146..d50598f187b 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2077,6 +2077,7 @@ res/cardsfolder/longbow_archer.txt -text svneol=native#text/plain res/cardsfolder/looming_shade.txt -text svneol=native#text/plain res/cardsfolder/lord_of_atlantis.txt -text svneol=native#text/plain res/cardsfolder/lord_of_extinction.txt -text svneol=native#text/plain +res/cardsfolder/lord_of_the_pit.txt -text svneol=native#text/plain res/cardsfolder/lord_of_the_undead.txt -text svneol=native#text/plain res/cardsfolder/lorescale_coatl.txt -text svneol=native#text/plain res/cardsfolder/lorthos_the_tidemaker.txt -text svneol=native#text/plain diff --git a/res/cardsfolder/lord_of_the_pit.txt b/res/cardsfolder/lord_of_the_pit.txt new file mode 100644 index 00000000000..16010b9fa2d --- /dev/null +++ b/res/cardsfolder/lord_of_the_pit.txt @@ -0,0 +1,10 @@ +Name:Lord of the Pit +ManaCost:4 B B B +Types:Creature Demon +Text:At the beginning of your upkeep, sacrifice a creature other than Lord of the Pit. If you can't, Lord of the Pit deals 7 damage to you. +PT:7/7 +K:Flying +K:Trample +K:SVar:Rarity:Rare +K:SVar:Picture:http://www.wizards.com/global/images/magic/general/lord_of_the_pit.jpg +End diff --git a/src/forge/GameActionUtil.java b/src/forge/GameActionUtil.java index ea892cb52fa..5f573a31876 100644 --- a/src/forge/GameActionUtil.java +++ b/src/forge/GameActionUtil.java @@ -23,6 +23,7 @@ public class GameActionUtil { AllZone.GameAction.CheckWheneverKeyword(AllZone.CardFactory.HumanNullCard, "BeginningOfUpkeep", null); + upkeep_Lord_of_the_Pit(); upkeep_Drop_of_Honey(); upkeep_Genesis(); upkeep_Phyrexian_Arena(); @@ -3529,6 +3530,54 @@ public class GameActionUtil { } }//damageUpkeepCost + private static void upkeep_Lord_of_the_Pit() { + /* + * At the beginning of your upkeep, sacrifice a creature other than + * Lord of the Pit. If you can't, Lord of the Pit deals 7 damage to you. + */ + final String player = AllZone.Phase.getActivePlayer(); + final CardList cards = AllZoneUtil.getPlayerCardsInPlay(player, "Lord of the Pit"); + + for(int i = 0; i < cards.size(); i++) { + final Card c = cards.get(i); + + final Ability sacrificeCreature = new Ability(c, "") { + @Override + public void resolve() { + //TODO: this should handle the case where you sacrifice 2 LOTPs to each other + CardList creatures = AllZoneUtil.getCreaturesInPlay(player); + creatures.remove(c); + if(player.equals(Constant.Player.Human)) { + AllZone.InputControl.setInput(CardFactoryUtil.input_sacrificePermanent(creatures, c.getName()+" - Select a creature to sacrifice.")); + } + else { //computer + Card target = CardFactoryUtil.AI_getWorstCreature(creatures); + AllZone.GameAction.sacrifice(target); + } + }//resolve + }; + + final Ability sevenDamage = new Ability(c, "") { + @Override + public void resolve() { + AllZone.GameAction.addDamage(player, c, 7); + } + }; + + CardList creatures = AllZoneUtil.getCreaturesInPlay(player); + creatures.remove(c); + if(creatures.size() == 0) { + //there are no creatures to sacrifice, so we must do the 7 damage + sevenDamage.setStackDescription(c.getName()+" - deals 7 damage to controller"); + AllZone.Stack.add(sevenDamage); + } + else { + sacrificeCreature.setStackDescription(c.getName()+" - sacrifice a creature."); + AllZone.Stack.add(sacrificeCreature); + } + }//end for + } + private static void upkeep_Drop_of_Honey() { /* * At the beginning of your upkeep, destroy the creature with the