diff --git a/.gitattributes b/.gitattributes index 08038be05d7..3ae7892348f 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2969,6 +2969,7 @@ res/cardsfolder/liquify.txt -text svneol=native#text/plain res/cardsfolder/lithatog.txt -text svneol=native#text/plain res/cardsfolder/liu_bei_lord_of_shu.txt -text svneol=native#text/plain res/cardsfolder/living_airship.txt -text svneol=native#text/plain +res/cardsfolder/living_artifact.txt -text svneol=native#text/plain res/cardsfolder/living_death.txt -text svneol=native#text/plain res/cardsfolder/living_wall.txt -text svneol=native#text/plain res/cardsfolder/livonya_silone.txt -text svneol=native#text/plain diff --git a/res/cardsfolder/living_artifact.txt b/res/cardsfolder/living_artifact.txt new file mode 100644 index 00000000000..01c11ca0e23 --- /dev/null +++ b/res/cardsfolder/living_artifact.txt @@ -0,0 +1,9 @@ +Name:Living Artifact +ManaCost:G +Types:Enchantment Aura +Text:Whenever you're dealt damage, put that many vitality counters on CARDNAME.\r\n\r\nAt the beginning of your upkeep, you may remove a vitality counter from CARDNAME. If you do, you gain 1 life. +K:Enchant Artifact +SVar:RemAIDeck:True +SVar:Rarity:Rare +SVar:Picture:http://www.wizards.com/global/images/magic/general/living_artifact.jpg +End \ No newline at end of file diff --git a/src/forge/Counters.java b/src/forge/Counters.java index dface321eb3..b31c95b5edc 100644 --- a/src/forge/Counters.java +++ b/src/forge/Counters.java @@ -71,6 +71,7 @@ public enum Counters { TOWER("tower"), TREASURE(), VERSE(), + VITALITY(), WIND(), WISH(); diff --git a/src/forge/GameActionUtil.java b/src/forge/GameActionUtil.java index d04141798df..51bbf9bee52 100644 --- a/src/forge/GameActionUtil.java +++ b/src/forge/GameActionUtil.java @@ -50,6 +50,7 @@ public class GameActionUtil { upkeep_Dega_Sanctuary(); upkeep_Sheltered_Valley(); upkeep_Land_Tax(); + upkeep_Living_Artifact(); upkeep_Tangle_Wire(); upkeep_Mana_Vault(); upkeep_Dance_of_the_Dead(); @@ -3174,6 +3175,35 @@ public class GameActionUtil { } } + private static void upkeep_Living_Artifact(){ + final Player player = AllZone.Phase.getPlayerTurn(); + CardList las = AllZoneUtil.getPlayerCardsInPlay(player, "Living Artifact"); + + for(final Card la:las) { + if(la.getCounters(Counters.VITALITY) > 0) { + final StringBuilder sb = new StringBuilder(); + sb.append(la.getName()+" - Remove a vitality counter and gain 1 life?"); + final Ability upkeepAbility = new Ability(la, "0") { + @Override + public void resolve() { + if( player.isComputer() ){ + la.subtractCounter(Counters.VITALITY, 1); + player.gainLife(1, la); + } + else { + if (GameActionUtil.showYesNoDialog(la, sb.toString())){ + la.subtractCounter(Counters.VITALITY, 1); + player.gainLife(1, la); + } + } + } + }; + upkeepAbility.setStackDescription(sb.toString()); + AllZone.Stack.add(upkeepAbility); + } + } + }//upkeep_Living_Artifact + public static void upkeep_TabernacleUpkeepCost() { CardList list = AllZoneUtil.getPlayerCardsInPlay(AllZone.Phase.getPlayerTurn()); @@ -5982,11 +6012,25 @@ public class GameActionUtil { else if(c.getName().equals("Warren Instigator")) playerCombatDamage_Warren_Instigator(c); else if(c.getName().equals("Whirling Dervish") || c.getName().equals("Dunerider Outlaw")) playerCombatDamage_Whirling_Dervish(c); + else if(AllZoneUtil.isCardInPlay("Living Artifact", player)) execute_Living_Artifact(player, damage); if (player.isPlayer(AllZone.HumanPlayer)) c.setDealtDmgToHumanThisTurn(true); if (player.isPlayer(AllZone.ComputerPlayer)) c.setDealtDmgToComputerThisTurn(true); } + private static void execute_Living_Artifact(final Player p, final int num) { + CardList las = AllZoneUtil.getPlayerCardsInPlay(p, "Living Artifact"); + for(final Card la:las) { + Ability addCounter = new Ability(la, "0") { + public void resolve() { + la.addCounter(Counters.VITALITY, num); + } + }; + addCounter.setStackDescription(la.getName()+" - Put "+num+" vitality counters on "+la); + AllZone.Stack.add(addCounter); + } + } + //restricted to combat damage, restricted to players public static void executeCombatDamageToPlayerEffects(final Player player, Card c, final int damage) {