diff --git a/res/card-pictures.txt b/res/card-pictures.txt index 3b80deada9e..0fdc3b23ae6 100644 --- a/res/card-pictures.txt +++ b/res/card-pictures.txt @@ -38,6 +38,7 @@ snow_covered_mountain.jpg http://www.wizards.com/global/images/magic/gene snow_covered_mountain1.jpg http://www.wizards.com/global/images/magic/general/snow_covered_mountain.jpg snow_covered_mountain2.jpg http://www.magickartenmarkt.de/img/cards/Ice_Age/snow_covered_mountain.jpg snow_covered_mountain3.jpg http://www.magickartenmarkt.de/img/cards/Ice_Age/snow_covered_mountain.jpg +curiosity.jpg http://www.wizards.com/global/images/magic/general/curiosity.jpg pyretic_ritual.jpg http://www.wizards.com/global/images/magic/general/pyretic_ritual.jpg angelic_chorus.jpg http://www.wizards.com/global/images/magic/general/angelic_chorus.jpg ajanis_pridemate.jpg http://www.wizards.com/global/images/magic/general/ajanis_pridemate.jpg diff --git a/res/cards.txt b/res/cards.txt index b03a469751f..66c8ea94556 100644 --- a/res/cards.txt +++ b/res/cards.txt @@ -1,3 +1,11 @@ +Curiosity +U +Enchantment Aura +no text +Enchant creature +enPump:+0/+0 +WheneverKeyword:DealsDamage/Opponent:Enchanted_Creature:Play:DrawCards/1:ControllingPlayer_Self:ASAP:Yes_No:No Special Condition:Whenever enchanted creature deals damage to an opponent, you may draw a card. + Pyretic Ritual 1 R Instant diff --git a/src/forge/CardFactory.java b/src/forge/CardFactory.java index 9c6ab8ea277..618cbd7147c 100644 --- a/src/forge/CardFactory.java +++ b/src/forge/CardFactory.java @@ -1523,7 +1523,7 @@ public class CardFactory implements NewConstants { tgtP = c.getController(); } } else { - AllZone.GameAction.addDamage(getTargetPlayer(), damage); + AllZone.GameAction.addDamage(getTargetPlayer(), damage,card); tgtP = getTargetPlayer(); } @@ -2001,7 +2001,7 @@ public class CardFactory implements NewConstants { } } } else { - AllZone.GameAction.getPlayerLife(getTargetPlayer()).subtractLife(dmg[0]); + AllZone.GameAction.getPlayerLife(getTargetPlayer()).subtractLife(dmg[0],card); if(card.getKeyword().contains("Lifelink")) GameActionUtil.executeLifeLinkEffects( card, dmg[0]); @@ -2049,7 +2049,7 @@ public class CardFactory implements NewConstants { } } else { - AllZone.GameAction.getPlayerLife(getTargetPlayer()).subtractLife(dmg[0]); + AllZone.GameAction.getPlayerLife(getTargetPlayer()).subtractLife(dmg[0],card); if(card.getKeyword().contains("Lifelink")) GameActionUtil.executeLifeLinkEffects( card, dmg[0]); @@ -2099,7 +2099,7 @@ public class CardFactory implements NewConstants { } } } else { - AllZone.GameAction.getPlayerLife(getTargetPlayer()).subtractLife(dmg[0]); + AllZone.GameAction.getPlayerLife(getTargetPlayer()).subtractLife(dmg[0],card); if(card.getKeyword().contains("Lifelink")) GameActionUtil.executeLifeLinkEffects( card, dmg[0]); @@ -2665,7 +2665,7 @@ public class CardFactory implements NewConstants { else TgtPlayer = card.getController(); - AllZone.GameAction.subLife(TgtPlayer, nlife); + AllZone.GameAction.getPlayerLife(TgtPlayer).subtractLife(nlife,card); if (!DrawBack[0].equals("none")) CardFactoryUtil.doDrawBack(DrawBack[0], nlife, card.getController(), AllZone.GameAction.getOpponent(card.getController()), TgtPlayer, card, null); @@ -2832,7 +2832,7 @@ public class CardFactory implements NewConstants { else TgtPlayer = card.getController(); - AllZone.GameAction.subLife(TgtPlayer, nlife); + AllZone.GameAction.getPlayerLife(TgtPlayer).subtractLife(nlife,card); if (!DrawBack[0].equals("none")) CardFactoryUtil.doDrawBack(DrawBack[0], nlife, card.getController(), AllZone.GameAction.getOpponent(card.getController()), TgtPlayer, card, null); @@ -2893,7 +2893,7 @@ public class CardFactory implements NewConstants { else TgtPlayer = card.getController(); - AllZone.GameAction.subLife(TgtPlayer, nlife); + AllZone.GameAction.getPlayerLife(TgtPlayer).subtractLife(nlife,card); if (!DrawBack[0].equals("none")) CardFactoryUtil.doDrawBack(DrawBack[0], nlife, card.getController(), AllZone.GameAction.getOpponent(card.getController()), TgtPlayer, card, null); @@ -3022,7 +3022,7 @@ public class CardFactory implements NewConstants { else TgtPlayer = card.getController(); - AllZone.GameAction.addLife(TgtPlayer, nlife); + AllZone.GameAction.getPlayerLife(TgtPlayer).addLife(nlife); if (!DrawBack[0].equals("none")) CardFactoryUtil.doDrawBack(DrawBack[0], nlife, card.getController(), AllZone.GameAction.getOpponent(card.getController()), TgtPlayer, card, null); @@ -3181,8 +3181,7 @@ public class CardFactory implements NewConstants { else TgtPlayer = card.getController(); - AllZone.GameAction.addLife(TgtPlayer, nlife); - + AllZone.GameAction.getPlayerLife(TgtPlayer).addLife(nlife); if (!DrawBack[0].equals("none")) CardFactoryUtil.doDrawBack(DrawBack[0], nlife, card.getController(), AllZone.GameAction.getOpponent(card.getController()), TgtPlayer, card, null); }//resolve() @@ -3240,7 +3239,7 @@ public class CardFactory implements NewConstants { else TgtPlayer = card.getController(); - AllZone.GameAction.addLife(TgtPlayer, nlife); + AllZone.GameAction.getPlayerLife(TgtPlayer).addLife(nlife); if (!DrawBack[0].equals("none")) CardFactoryUtil.doDrawBack(DrawBack[0], nlife, card.getController(), AllZone.GameAction.getOpponent(card.getController()), TgtPlayer, card, null); @@ -3994,7 +3993,7 @@ public class CardFactory implements NewConstants { @Override public void resolve() { - AllZone.GameAction.getPlayerLife(getController()).subtractLife(amountHurt); + AllZone.GameAction.getPlayerLife(getController()).subtractLife(amountHurt,card); super.resolve(); } @@ -4494,8 +4493,8 @@ public class CardFactory implements NewConstants { if(CardFactoryUtil.canDamage(card, list.get(i))) list.get(i).addDamage(1, card); } - AllZone.Human_Life.subtractLife(1); - AllZone.Computer_Life.subtractLife(1); + AllZone.Human_Life.subtractLife(1,card); + AllZone.Computer_Life.subtractLife(1,card); }//resolve() };//SpellAbility ability.setDescription("R: Pyrohemia deals 1 damage to each creature and each player."); @@ -4550,8 +4549,8 @@ public class CardFactory implements NewConstants { if(CardFactoryUtil.canDamage(card, list.get(i))) list.get(i).addDamage(1, card); } - AllZone.Human_Life.subtractLife(1); - AllZone.Computer_Life.subtractLife(1); + AllZone.Human_Life.subtractLife(1,card); + AllZone.Computer_Life.subtractLife(1,card); }//resolve() };//SpellAbility ability.setDescription("B: Pestilence deals 1 damage to each creature and each player."); @@ -5047,7 +5046,7 @@ public class CardFactory implements NewConstants { if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard())) { PlayerLife life = AllZone.GameAction.getPlayerLife(card.getController()); - life.subtractLife(getTargetCard().getNetDefense()); + life.subtractLife(getTargetCard().getNetDefense(),card); AllZone.GameAction.destroyNoRegeneration(getTargetCard()); } }//resolve() @@ -5462,7 +5461,7 @@ public class CardFactory implements NewConstants { Card c = getTargetCard(); if(AllZone.GameAction.isCardInPlay(c) && CardFactoryUtil.canTarget(card, c)) { if(!c.getType().contains("Basic")) AllZone.GameAction.getPlayerLife(c.getController()).subtractLife( - 2); + 2,card); AllZone.GameAction.destroy(c); } @@ -5975,7 +5974,7 @@ public class CardFactory implements NewConstants { } PlayerLife life = AllZone.GameAction.getPlayerLife(card.getController()); - life.subtractLife(5); + life.subtractLife(5,card); }//resolve() };//SpellAbility @@ -6504,7 +6503,7 @@ public class CardFactory implements NewConstants { if(cardName.equals("Grim Tutor")) { String player = Constant.Player.Human; PlayerLife life = AllZone.GameAction.getPlayerLife(player); - life.subtractLife(3); + life.subtractLife(3,card); } } @@ -6523,7 +6522,7 @@ public class CardFactory implements NewConstants { if(cardName.equals("Grim Tutor")) { String player = Constant.Player.Computer; PlayerLife life = AllZone.GameAction.getPlayerLife(player); - life.subtractLife(3); + life.subtractLife(3,card); } } @@ -6677,7 +6676,7 @@ public class CardFactory implements NewConstants { done(); } else AllZone.GameAction.moveToGraveyard(card); } else { - AllZone.GameAction.getPlayerLife(getTargetPlayer()).subtractLife(5); + AllZone.GameAction.getPlayerLife(getTargetPlayer()).subtractLife(5,card); done(); } }//resolve() @@ -7828,8 +7827,8 @@ public class CardFactory implements NewConstants { if(getTargetCard() != null) { if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard())) getTargetCard().addDamage(1,card); - } else AllZone.GameAction.getPlayerLife(getTargetPlayer()).subtractLife(1); - } else AllZone.GameAction.getPlayerLife(AllZone.GameAction.getOpponent(card.getController())).subtractLife(1); + } else AllZone.GameAction.getPlayerLife(getTargetPlayer()).subtractLife(1,card); + } else AllZone.GameAction.getPlayerLife(AllZone.GameAction.getOpponent(card.getController())).subtractLife(1,card); }; }; card.clearSpellAbility(); @@ -7883,7 +7882,7 @@ public class CardFactory implements NewConstants { } AllZone.Display.getChoice("Random card", handChoices); AllZone.GameAction.getPlayerLife(opponent).subtractLife( - CardUtil.getConvertedManaCost(choice.getManaCost())); + CardUtil.getConvertedManaCost(choice.getManaCost()),card); } }//resolve() }; @@ -8218,7 +8217,7 @@ public class CardFactory implements NewConstants { // Opponent Loses 5 Life PlayerLife target = AllZone.GameAction.getPlayerLife(opponent); - target.subtractLife(5); + target.subtractLife(5,card); // Player Returns Creature Card from Graveyard to Hand if(player == "Human") { @@ -8299,7 +8298,7 @@ public class CardFactory implements NewConstants { PlayerLife player = AllZone.GameAction.getPlayerLife(card.getController()); String opponent = AllZone.GameAction.getOpponent(card.getController()); PlayerLife target = AllZone.GameAction.getPlayerLife(opponent); - target.subtractLife(2); + target.subtractLife(2,card); player.addLife(2); } @@ -8324,7 +8323,7 @@ public class CardFactory implements NewConstants { AllZone.GameAction.destroy(getTargetCard()); CardList Grave = new CardList(AllZone.getZone(Constant.Zone.Graveyard, getTargetCard().getController()).getCards()); int Damage = (Grave.getType("Land")).size(); - AllZone.GameAction.getPlayerLife(getTargetCard().getController()).subtractLife(Damage); + AllZone.GameAction.getPlayerLife(getTargetCard().getController()).subtractLife(Damage,card); } } @Override @@ -8664,7 +8663,7 @@ public class CardFactory implements NewConstants { //lose half life String player = Constant.Player.Human; PlayerLife life = AllZone.GameAction.getPlayerLife(player); - life.subtractLife(life.getLife() / 2); + life.subtractLife(life.getLife() / 2,card); } @Override @@ -9259,10 +9258,10 @@ public class CardFactory implements NewConstants { } PlayerLife compLife = AllZone.GameAction.getPlayerLife(Constant.Player.Computer); - compLife.subtractLife(2); + compLife.subtractLife(2,card); PlayerLife humLife = AllZone.GameAction.getPlayerLife(Constant.Player.Human); - humLife.subtractLife(2); + humLife.subtractLife(2,card); } @@ -9333,8 +9332,8 @@ public class CardFactory implements NewConstants { } } - AllZone.Human_Life.subtractLife(3); - AllZone.Computer_Life.subtractLife(3); + AllZone.Human_Life.subtractLife(3,card); + AllZone.Computer_Life.subtractLife(3,card); } }; card.clearSpellAbility(); @@ -9421,7 +9420,7 @@ public class CardFactory implements NewConstants { @Override public void resolve() { PlayerLife life = AllZone.GameAction.getPlayerLife(card.getController()); - life.subtractLife(1); + life.subtractLife(1,card); } }; ability2.setStackDescription(card.getController() + " looses 1 life"); @@ -9716,7 +9715,7 @@ public class CardFactory implements NewConstants { @Override public void resolve() { if(cardName.equals("Thoughtseize")) AllZone.GameAction.getPlayerLife(card.getController()).subtractLife( - 2); + 2,card); Card choice = null; @@ -10091,7 +10090,7 @@ public class CardFactory implements NewConstants { Card c = getTargetCard(); c.addDamage(damage, card); } - } else AllZone.GameAction.getPlayerLife(getTargetPlayer()).subtractLife(damage); + } else AllZone.GameAction.getPlayerLife(getTargetPlayer()).subtractLife(damage,card); } };//SpellAbility @@ -10154,7 +10153,7 @@ public class CardFactory implements NewConstants { Card c = getTargetCard(); c.addDamage(damage, card); } - } else AllZone.GameAction.getPlayerLife(getTargetPlayer()).subtractLife(damage); + } else AllZone.GameAction.getPlayerLife(getTargetPlayer()).subtractLife(damage,card); grave.remove(card); removed.add(card); @@ -10234,7 +10233,7 @@ public class CardFactory implements NewConstants { } else { javax.swing.JOptionPane.showMessageDialog(null, "Erratic Explosion causes " + damage + " to " + getTargetPlayer()); - AllZone.GameAction.getPlayerLife(getTargetPlayer()).subtractLife(damage); + AllZone.GameAction.getPlayerLife(getTargetPlayer()).subtractLife(damage,card); } } @@ -10272,7 +10271,7 @@ public class CardFactory implements NewConstants { @Override public void resolve() { PlayerLife life = AllZone.GameAction.getPlayerLife(getTargetPlayer()); - if(life.getLife() == 10) life.subtractLife(10); + if(life.getLife() == 10) life.subtractLife(10,card); } /* @@ -10638,7 +10637,7 @@ public class CardFactory implements NewConstants { for(int i = 0; i 2) { diff --git a/src/forge/CardFactory_Creatures.java b/src/forge/CardFactory_Creatures.java index aa81d78fcda..c880c3c2517 100644 --- a/src/forge/CardFactory_Creatures.java +++ b/src/forge/CardFactory_Creatures.java @@ -73,7 +73,7 @@ public class CardFactory_Creatures { SpellAbility ability = new Ability(card, "0") { @Override public void resolve() { - AllZone.GameAction.getPlayerLife(getController()).subtractLife(n); + AllZone.GameAction.getPlayerLife(getController()).subtractLife(n,card); } }; ability.setStackDescription("Filthy Cur - causes " + n + " damage to " + getController()); @@ -352,7 +352,7 @@ public class CardFactory_Creatures { @Override public void resolve() { - AllZone.GameAction.getPlayerLife(card.getController()).subtractLife(2); + AllZone.GameAction.getPlayerLife(card.getController()).subtractLife(2,card); AllZone.GameAction.discard(card); AllZone.GameAction.drawCard(card.getController()); card.cycle(); @@ -375,7 +375,7 @@ public class CardFactory_Creatures { SpellAbility ability = new Ability(card, "0") { @Override public void resolve() { - AllZone.GameAction.getPlayerLife(getController()).subtractLife(n); + AllZone.GameAction.getPlayerLife(getController()).subtractLife(n,card); } }; ability.setStackDescription("Shinka Gatekeeper - causes " + n + " damage to " @@ -411,7 +411,7 @@ public class CardFactory_Creatures { SpellAbility ability = new Ability(card, "0") { @Override public void resolve() { - AllZone.GameAction.getPlayerLife(getController()).subtractLife(n); + AllZone.GameAction.getPlayerLife(getController()).subtractLife(n,card); } }; ability.setStackDescription("Jackal Pup - causes " + n + " damage to " + getController()); @@ -449,7 +449,7 @@ public class CardFactory_Creatures { SpellAbility ability = new Ability(card, "0") { @Override public void resolve() { - AllZone.GameAction.getPlayerLife(opponent).subtractLife(n); + AllZone.GameAction.getPlayerLife(opponent).subtractLife(n,card); if(c.getKeyword().contains("Lifelink")) GameActionUtil.executeLifeLinkEffects(c, n); @@ -1879,7 +1879,7 @@ public class CardFactory_Creatures { public void resolve() { if(getTargetCard() != null && CardFactoryUtil.canDamage(card, getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard())) getTargetCard().addDamage(3, card); - else AllZone.GameAction.getPlayerLife(getTargetPlayer()).subtractLife(3); + else AllZone.GameAction.getPlayerLife(getTargetPlayer()).subtractLife(3,card); } }; Command leavesPlay = new Command() { @@ -2178,7 +2178,7 @@ public class CardFactory_Creatures { @Override public void resolve() { PlayerLife life = AllZone.GameAction.getPlayerLife(card.getController()); - life.subtractLife(2); + life.subtractLife(2,card); AllZone.GameAction.drawCard(card.getController()); AllZone.GameAction.drawCard(card.getController()); @@ -2202,7 +2202,7 @@ public class CardFactory_Creatures { @Override public void resolve() { PlayerLife life = AllZone.GameAction.getPlayerLife(card.getController()); - life.subtractLife(1); + life.subtractLife(1,card); AllZone.GameAction.drawCard(card.getController()); }//resolve() @@ -2369,7 +2369,7 @@ public class CardFactory_Creatures { @Override public void resolve() { PlayerLife life = AllZone.GameAction.getPlayerLife(card.getController()); - life.subtractLife(3); + life.subtractLife(3,card); }//resolve() };//SpellAbility Command intoPlay = new Command() { @@ -2594,7 +2594,7 @@ public class CardFactory_Creatures { PlayerLife opp = AllZone.GameAction.getPlayerLife(opponent); PlayerLife my = AllZone.GameAction.getPlayerLife(card.getController()); - opp.subtractLife(5); + opp.subtractLife(5,card); my.addLife(5); } }; @@ -2714,7 +2714,7 @@ public class CardFactory_Creatures { AllZone.GameInfo.addHumanCanPlayNumberOfLands(-1); if(AllZone.GameInfo.humanPlayedFirstLandThisTurn() == true) { for(int i = 0; i < Fastbond.size(); i++) - AllZone.GameAction.addDamage(card.getController(), 1); + AllZone.GameAction.addDamage(card.getController(), 1,Fastbond.get(0)); } AllZone.GameInfo.setHumanPlayedFirstLandThisTurn(true); } @@ -2722,7 +2722,7 @@ public class CardFactory_Creatures { AllZone.GameInfo.addComputerCanPlayNumberOfLands(-1); if(AllZone.GameInfo.computerPlayedFirstLandThisTurn() == true) { for(int i = 0; i < Fastbond.size(); i++) - AllZone.GameAction.addDamage(card.getController(), 1); + AllZone.GameAction.addDamage(card.getController(), 1,Fastbond.get(0)); } AllZone.GameInfo.setComputerPlayedFirstLandThisTurn(true); } @@ -2753,7 +2753,7 @@ public class CardFactory_Creatures { @Override public void resolve() { String opponent = AllZone.GameAction.getOpponent(card.getController()); - AllZone.GameAction.getPlayerLife(opponent).subtractLife(2); + AllZone.GameAction.getPlayerLife(opponent).subtractLife(2,card); AllZone.GameAction.getPlayerLife(card.getController()).addLife(2); } @@ -2788,7 +2788,7 @@ public class CardFactory_Creatures { @Override public void resolve() { - AllZone.GameAction.getPlayerLife(card.getController()).subtractLife(3); + AllZone.GameAction.getPlayerLife(card.getController()).subtractLife(3,card); } }; Command intoPlay = new Command() { @@ -2807,7 +2807,7 @@ public class CardFactory_Creatures { final SpellAbility ability = new Ability(card, "0") { @Override public void resolve() { - AllZone.GameAction.getPlayerLife(card.getController()).subtractLife(5); + AllZone.GameAction.getPlayerLife(card.getController()).subtractLife(5,card); } @Override @@ -2843,7 +2843,7 @@ public class CardFactory_Creatures { final SpellAbility ability = new Ability(card, "0") { @Override public void resolve() { - AllZone.GameAction.getPlayerLife(card.getController()).subtractLife(2); + AllZone.GameAction.getPlayerLife(card.getController()).subtractLife(2,card); } @Override @@ -2973,7 +2973,7 @@ public class CardFactory_Creatures { @Override public void resolve() { String opponent = AllZone.GameAction.getOpponent(card.getController()); - AllZone.GameAction.getPlayerLife(opponent).subtractLife(4); + AllZone.GameAction.getPlayerLife(opponent).subtractLife(4,card); } }; Command intoPlay = new Command() { @@ -5393,7 +5393,7 @@ public class CardFactory_Creatures { Card c = getTargetCard(); c.addDamage(damage, card); } - } else AllZone.GameAction.getPlayerLife(getTargetPlayer()).subtractLife(damage); + } else AllZone.GameAction.getPlayerLife(getTargetPlayer()).subtractLife(damage,card); } }//resolve() };//SpellAbility @@ -5427,7 +5427,7 @@ public class CardFactory_Creatures { @Override public void selectPlayer(String player) { int damage = ((Integer) countZubera.execute()).intValue(); - AllZone.GameAction.getPlayerLife(player).subtractLife(damage); + AllZone.GameAction.getPlayerLife(player).subtractLife(damage,card); stop(); }//selectPlayer() };//Input @@ -8782,7 +8782,7 @@ public class CardFactory_Creatures { if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard())) getTargetCard().addDamage(1, card); - } else AllZone.GameAction.getPlayerLife(getTargetPlayer()).subtractLife(1); + } else AllZone.GameAction.getPlayerLife(getTargetPlayer()).subtractLife(1,card); }//resolve() };//SpellAbility @@ -9313,8 +9313,8 @@ public class CardFactory_Creatures { for(int i = 0; i < list.size(); i++) list.get(i).addDamage(4, card); - AllZone.Human_Life.subtractLife(4); - AllZone.Computer_Life.subtractLife(4); + AllZone.Human_Life.subtractLife(4,card); + AllZone.Computer_Life.subtractLife(4,card); }//resolve() };//SpellAbility card.addSpellAbility(ability); @@ -9332,7 +9332,7 @@ public class CardFactory_Creatures { @Override public void resolve() { String opponent = AllZone.GameAction.getOpponent(card.getController()); - AllZone.GameAction.getPlayerLife(opponent).subtractLife(2); + AllZone.GameAction.getPlayerLife(opponent).subtractLife(2,card); AllZone.GameAction.getPlayerLife(card.getController()).addLife(2); @@ -10990,7 +10990,7 @@ public class CardFactory_Creatures { //c.addDamage(damage); AllZone.GameAction.addDamage(crd, card, 2); } - } else AllZone.GameAction.getPlayerLife(getTargetPlayer()).subtractLife(2); + } else AllZone.GameAction.getPlayerLife(getTargetPlayer()).subtractLife(2,card); } } @@ -11070,7 +11070,7 @@ public class CardFactory_Creatures { String opponent = AllZone.GameAction.getOpponent(player); PlayerLife life = AllZone.GameAction.getPlayerLife(opponent); - life.subtractLife(power); + life.subtractLife(power,card); GameActionUtil.executeLifeLinkEffects(card, power); @@ -12884,8 +12884,8 @@ public class CardFactory_Creatures { Card c = card; PlayerLife life = AllZone.GameAction.getPlayerLife(c.getController()); PlayerLife oppLife = AllZone.GameAction.getPlayerLife(AllZone.GameAction.getOpponent(c.getController())); - life.subtractLife(1); - oppLife.subtractLife(1); + life.subtractLife(1,card); + oppLife.subtractLife(1,card); } }; Command intoPlay = new Command() { @@ -12907,8 +12907,8 @@ public class CardFactory_Creatures { Card c = card; PlayerLife life = AllZone.GameAction.getPlayerLife(c.getController()); PlayerLife oppLife = AllZone.GameAction.getPlayerLife(AllZone.GameAction.getOpponent(c.getController())); - life.subtractLife(3); - oppLife.subtractLife(3); + life.subtractLife(3,card); + oppLife.subtractLife(3,card); } }; Command intoPlay = new Command() { @@ -13245,7 +13245,7 @@ public class CardFactory_Creatures { @Override public void resolve() { PlayerLife life = AllZone.GameAction.getPlayerLife(card.getController()); - life.subtractLife(1); + life.subtractLife(1,card); PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getOwner()); if(card.isToken()) AllZone.getZone(card).remove(card); @@ -14530,7 +14530,7 @@ public class CardFactory_Creatures { @Override public void resolve() { PlayerLife life = AllZone.GameAction.getPlayerLife(card.getController()); - life.subtractLife(1); + life.subtractLife(1,card); PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getOwner()); /* AllZone.getZone(card).remove(card); @@ -15313,7 +15313,7 @@ public class CardFactory_Creatures { @Override public void resolve() { String opponent = AllZone.GameAction.getOpponent(card.getController()); - AllZone.GameAction.getPlayerLife(opponent).subtractLife(1); + AllZone.GameAction.getPlayerLife(opponent).subtractLife(1,card); } @Override @@ -15373,7 +15373,7 @@ public class CardFactory_Creatures { lib.remove(0); grave.add(c); - AllZone.GameAction.getPlayerLife(getTargetPlayer()).subtractLife(1); + AllZone.GameAction.getPlayerLife(getTargetPlayer()).subtractLife(1,card); } } } @@ -15709,8 +15709,8 @@ public class CardFactory_Creatures { @Override public void resolve() { - AllZone.Human_Life.subtractLife(countSwamps("Human")); - AllZone.Computer_Life.subtractLife(countSwamps("Computer")); + AllZone.Human_Life.subtractLife(countSwamps("Human"),card); + AllZone.Computer_Life.subtractLife(countSwamps("Computer"),card); } int countSwamps(String player) { @@ -15908,7 +15908,7 @@ public class CardFactory_Creatures { @Override public void resolve() { PlayerLife target = AllZone.GameAction.getPlayerLife(getTargetPlayer()); - target.subtractLife(card.getCounters(Counters.P1P1)); + target.subtractLife(card.getCounters(Counters.P1P1),card); }//resolve() }; @@ -15986,7 +15986,7 @@ public class CardFactory_Creatures { if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard())) getTargetCard().addDamage(1, card); - } else AllZone.GameAction.getPlayerLife(getTargetPlayer()).subtractLife(1); + } else AllZone.GameAction.getPlayerLife(getTargetPlayer()).subtractLife(1,card); }//resolve() };//SpellAbility @@ -17288,7 +17288,7 @@ public class CardFactory_Creatures { if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard())) getTargetCard().addDamage(1, card); - } else AllZone.GameAction.getPlayerLife(getTargetPlayer()).subtractLife(1); + } else AllZone.GameAction.getPlayerLife(getTargetPlayer()).subtractLife(1,card); }//resolve() };//SpellAbility @@ -17373,7 +17373,7 @@ public class CardFactory_Creatures { final SpellAbility abilityComes = new Ability(card, "0") { @Override public void resolve() { - AllZone.GameAction.getPlayerLife(getTargetPlayer()).subtractLife(6); + AllZone.GameAction.getPlayerLife(getTargetPlayer()).subtractLife(6,card); }//resolve() }; @@ -17438,7 +17438,7 @@ public class CardFactory_Creatures { }); int drain = list.size(); AllZone.GameAction.getPlayerLife(AllZone.GameAction.getOpponent(card.getController())).subtractLife( - drain); + drain,card); AllZone.GameAction.getPlayerLife(card.getController()).addLife(drain); }//resolve() @@ -17952,7 +17952,7 @@ public class CardFactory_Creatures { final Ability ability = new Ability(card, "B B B") { @Override public void resolve() { - AllZone.GameAction.getPlayerLife(card.getController()).subtractLife(3); + AllZone.GameAction.getPlayerLife(card.getController()).subtractLife(3,card); PlayerZone hGrave = AllZone.getZone(Constant.Zone.Graveyard, Constant.Player.Human); PlayerZone cGrave = AllZone.getZone(Constant.Zone.Graveyard, Constant.Player.Computer); @@ -18129,7 +18129,7 @@ public class CardFactory_Creatures { public void resolve() { String opponent = AllZone.GameAction.getOpponent(card.getController()); PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, opponent); - AllZone.GameAction.getPlayerLife(opponent).subtractLife(1); + AllZone.GameAction.getPlayerLife(opponent).subtractLife(1,card); Card[] handLook = hand.getCards(); if(opponent.equals(Constant.Player.Computer)) { AllZone.Display.getChoice("Look", handLook); @@ -18170,7 +18170,7 @@ public class CardFactory_Creatures { } AllZone.Display.getChoice("Random card", handChoices); AllZone.GameAction.getPlayerLife(opponent).subtractLife( - CardUtil.getConvertedManaCost(choice.getManaCost())); + CardUtil.getConvertedManaCost(choice.getManaCost()),card); } }//resolve() }; @@ -18824,7 +18824,7 @@ public class CardFactory_Creatures { public void resolve() { //TODO: make this part of the cost - AllZone.GameAction.getPlayerLife(card.getController()).subtractLife(2); + AllZone.GameAction.getPlayerLife(card.getController()).subtractLife(2,card); final Command EOT = new Command() { private static final long serialVersionUID = -8840812331316327448L; @@ -19309,7 +19309,7 @@ public class CardFactory_Creatures { AllZone.GameAction.sacrifice(card); - targetLife.subtractLife(1); + targetLife.subtractLife(1,card); playerLife.addLife(1); } }; @@ -20348,8 +20348,8 @@ public class CardFactory_Creatures { if(CardFactoryUtil.canDamage(card, list.get(i))) list.get(i).addDamage(1, card); } - AllZone.Human_Life.subtractLife(1); - AllZone.Computer_Life.subtractLife(1); + AllZone.Human_Life.subtractLife(1,card); + AllZone.Computer_Life.subtractLife(1,card); }//resolve() };//SpellAbility ability.setDescription("B: Pestilence Demon deals 1 damage to each creature and each player."); diff --git a/src/forge/CardFactory_Lands.java b/src/forge/CardFactory_Lands.java index 74dccae6c44..cec83379a75 100644 --- a/src/forge/CardFactory_Lands.java +++ b/src/forge/CardFactory_Lands.java @@ -108,7 +108,7 @@ class CardFactory_Lands { if(AllZone.Computer_Life.getLife() > 9) pay = MyRandom.random.nextBoolean(); - if(pay) AllZone.Computer_Life.subtractLife(2); + if(pay) AllZone.Computer_Life.subtractLife(2,card); else card.tap(); } @@ -117,7 +117,7 @@ class CardFactory_Lands { if(2 < life.getLife()) { String[] choices = {"Yes", "No"}; Object o = AllZone.Display.getChoice("Pay 2 life?", choices); - if(o.equals("Yes")) life.subtractLife(2); + if(o.equals("Yes")) life.subtractLife(2,card); else tapCard(); }//if else tapCard(); @@ -1323,7 +1323,7 @@ class CardFactory_Lands { if(once) { once = false; String player = card.getController(); - AllZone.GameAction.getPlayerLife(player).subtractLife(1); + AllZone.GameAction.getPlayerLife(player).subtractLife(1,card); AllZone.GameAction.sacrifice(card); ability.setStackDescription(card.getController() + " - Search your library for a " @@ -3350,7 +3350,7 @@ class CardFactory_Lands { if(c != null) { if(CardFactoryUtil.canTarget(card, c) && c.isCreature() ) { - AllZone.GameAction.addLife(c.getController(),c.getNetDefense()); + AllZone.GameAction.getPlayerLife(c.getController()).addLife(c.getNetDefense()); AllZone.GameAction.sacrifice(c); } } diff --git a/src/forge/CardFactory_Planeswalkers.java b/src/forge/CardFactory_Planeswalkers.java index 093687ae3bb..f173c08f84c 100644 --- a/src/forge/CardFactory_Planeswalkers.java +++ b/src/forge/CardFactory_Planeswalkers.java @@ -520,7 +520,7 @@ class CardFactory_Planeswalkers { CardList oppPerms = new CardList(play.getCards()); PlayerLife life = AllZone.GameAction.getPlayerLife(opponent); - life.subtractLife(7); + life.subtractLife(7,card2); for(int j = 0; j < 7; j++) { //will not actually let human choose which cards to discard @@ -1304,7 +1304,7 @@ class CardFactory_Planeswalkers { else { PlayerLife life = AllZone.GameAction.getPlayerLife(getTargetPlayer()); - life.subtractLife(1); + life.subtractLife(1,card2); } } @@ -1464,7 +1464,7 @@ class CardFactory_Planeswalkers { turn[0] = AllZone.Phase.getTurn(); PlayerLife life = AllZone.GameAction.getPlayerLife(getTargetPlayer()); - life.subtractLife(10); + life.subtractLife(10,card2); PlayerZone play = AllZone.getZone(Constant.Zone.Play, getTargetPlayer()); CardList list = new CardList(play.getCards()); @@ -2060,7 +2060,7 @@ class CardFactory_Planeswalkers { Card c = getTargetCard(); c.addDamage(damage, card2); } - } else AllZone.GameAction.getPlayerLife(getTargetPlayer()).subtractLife(damage); + } else AllZone.GameAction.getPlayerLife(getTargetPlayer()).subtractLife(damage,card2); AllZone.GameAction.getPlayerLife(card2.getController()).addLife(3); } diff --git a/src/forge/CombatUtil.java b/src/forge/CombatUtil.java index 2914ec32bfc..6f650639c93 100644 --- a/src/forge/CombatUtil.java +++ b/src/forge/CombatUtil.java @@ -1776,7 +1776,7 @@ public class CombatUtil { Card top = lib.get(0); if(top.getType().contains("Creature")) { AllZone.GameAction.getPlayerLife(player).addLife(top.getBaseDefense()); - AllZone.GameAction.getPlayerLife(player).subtractLife(top.getBaseAttack()); + AllZone.GameAction.getPlayerLife(player).subtractLife(top.getBaseAttack(),c); hand.add(top); lib.remove(top); }; @@ -1809,11 +1809,11 @@ public class CombatUtil { else if(c.getName().equals("Pulse Tracker") && !c.getCreatureAttackedThisCombat()) { final String opp = AllZone.GameAction.getOpponent(c.getController()); - + final Card F_card = c; Ability ability = new Ability(c, "0") { @Override public void resolve() { - AllZone.GameAction.getPlayerLife(opp).subtractLife(1); + AllZone.GameAction.getPlayerLife(opp).subtractLife(1,F_card); } }; ability.setStackDescription("Pulse Tracker - Whenever Pulse Tracker attacks, each opponent loses 1 life."); @@ -1865,7 +1865,7 @@ public class CombatUtil { if(c.getName().equals("Guiltfeeder")) { final String player = c.getController(); final String opponent = AllZone.GameAction.getOpponent(player); - + final Card F_card = c; Ability ability2 = new Ability(c, "0") { @Override public void resolve() { @@ -1874,7 +1874,7 @@ public class CombatUtil { CardList cardsInGrave = new CardList(graveyard.getCards()); PlayerLife life = AllZone.GameAction.getPlayerLife(opponent); - life.subtractLife(cardsInGrave.size()); + life.subtractLife(cardsInGrave.size(),F_card); } };// ability2 @@ -1918,7 +1918,7 @@ public class CombatUtil { { public void resolve() { - AllZone.GameAction.addLife(crd.getController(), 2); + AllZone.GameAction.getPlayerLife(crd.getController()).addLife(2); } }; ability.setStackDescription(pcs.get(i) + " - " + c.getController() + " gains 2 life."); @@ -1971,7 +1971,7 @@ public class CombatUtil { else if(c.getName().equals("Meglonoth") && !c.getCreatureBlockedThisCombat()) { PlayerLife oppLife = AllZone.GameAction.getPlayerLife(AllZone.GameAction.getOpponent(c.getController())); - oppLife.subtractLife(c.getNetAttack()); + oppLife.subtractLife(c.getNetAttack(),c); //ability2.setStackDescription(c.getName() + " blocks and deals damage equal to its power to attacking player."); //AllZone.Stack.add(ability2); @@ -2123,7 +2123,7 @@ public class CombatUtil { } else if (a.getName().equals("Sacred Prey") && !a.getCreatureBlockedThisCombat()) { AllZone.GameAction.getPlayerLife(a.getController()).addLife(1); } else if (a.getName().equals("Vedalken Ghoul") && !a.getCreatureBlockedThisCombat()) { - AllZone.GameAction.subLife(b.getController(), 4); + AllZone.GameAction.getPlayerLife(b.getController()).subtractLife(4,a); } if(b.getName().equals("Frostweb Spider") && (a.getKeyword().contains("Flying"))) { diff --git a/src/forge/ComputerUtil.java b/src/forge/ComputerUtil.java index 9ebee5e7d48..97ad8a11b79 100644 --- a/src/forge/ComputerUtil.java +++ b/src/forge/ComputerUtil.java @@ -390,7 +390,7 @@ public class ComputerUtil else { if (CardFactoryUtil.getFastbonds(Constant.Player.Computer).size() > 0) - AllZone.GameAction.getPlayerLife(Constant.Player.Computer).subtractLife(1); + AllZone.GameAction.getPlayerLife(Constant.Player.Computer).subtractLife(1,CardFactoryUtil.getFastbonds(Constant.Player.Computer).get(0)); } AllZone.GameAction.checkStateEffects(); diff --git a/src/forge/GameAction.java b/src/forge/GameAction.java index 4204a69a62e..d6bc7c651d2 100644 --- a/src/forge/GameAction.java +++ b/src/forge/GameAction.java @@ -696,8 +696,16 @@ public class GameAction { } } } + static boolean MultiTarget_Cancelled = false; public void RunWheneverKeyword(Card c, String Event, Object[] Custom_Parameters) { + /** + * Bugs: Combat Damage is recorded, probably due to quick fixes. + * Custom_Parameters Info: + * For GainLife : Custom_Parameters[0] = Amount of Life Gained + * For DealsDamage : Custom_Parameters[0] = Player Target + * : Custom_Parameters[2] = Damage Source + */ final Card F_TriggeringCard = c; CardList Cards_In_Play = new CardList(); Cards_In_Play.addAll(AllZone.getZone(Constant.Zone.Play, Constant.Player.Human).getCards()); @@ -727,11 +735,24 @@ public class GameAction { || (k[1].equals("BeginningOfEndStep")) && Event.equals("BeginningOfEndStep") || (k[1].equals("Attacks")) && Event.equals("Attacks") || (k[1].equals("EntersBattleField")) && Event.equals("EntersBattleField") + || (k[1].contains("DealsDamage")) && Event.contains("DealsDamage") || (k[1].equals("GainLife")) && Event.equals("GainLife") && c.getController().equals(card.getController())) { + if(k[1].contains("DealsDamage")) { + boolean Nullified = true; + String DamageTakerParse = k[1]; + String DamageTaker[] = DamageTakerParse.split("/"); + for(int z = 0; z < DamageTaker.length - 1; z++) { + if(DamageTaker[z + 1].equals("Opponent") && ((String)Custom_Parameters[0]).equals(getOpponent(card.getController()))) Nullified = false; + } + if(Nullified == true) k[4] = "Null"; + } if(k[2].contains("Self")) { if(!card.equals(c)) k[4] = "Null"; } + if(k[2].contains("Enchanted_Creature")) { + if(((Card)Custom_Parameters[2]).isEnchantedBy(card.getName()) == false) k[4] = "Null"; + } if(k[2].contains("Type")) { String TypeParse = k[2]; String Type[] = TypeParse.split("/"); @@ -830,7 +851,7 @@ public class GameAction { if(Go == true) if(AllZone.GameAction.isCardInPlay(F_card)) { PlayerLife life = AllZone.GameAction.getPlayerLife(F_TargetPlayer); if(F_Amount > -1) life.addLife(F_Amount); - else life.subtractLife(F_Amount * -1); + else life.subtractLife(F_Amount * -1,F_card); } } } @@ -845,6 +866,50 @@ public class GameAction { } } + + // Draw Cards + if(k[4].contains("DrawCards")) { + String AmountParse = k[4]; + String S_Amount = AmountParse.split("/")[1]; + int I_Amount = 0; + if(S_Amount.equals("Toughness")) I_Amount = F_TriggeringCard.getNetDefense(); // LOL wut + else I_Amount = Integer.valueOf(S_Amount); + final int F_Amount = I_Amount; + Ability ability = new Ability(card, "0") { + @Override + public void resolve() { + boolean Go = true; + if(F_k[3].equals("Play")) { + PlayerZone Required_Zone = AllZone.getZone(Constant.Zone.Play, F_TargetPlayer); + if(AllZone.GameAction.isCardInZone(F_card,Required_Zone)) { + if(F_k[7].equals("Yes_No")) { + if(F_TargetPlayer.equals("Human")) { + Object[] possibleValues = {"Yes", "No"}; + Object q = JOptionPane.showOptionDialog(null, "Activate - " + F_card.getName(),F_card.getName() + " Ability", + JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, + null, possibleValues, possibleValues[0]); + if(q.equals(1)) { + Go = false; + } + } + } + if(Go == true) if(AllZone.GameAction.isCardInPlay(F_card)) { + AllZone.GameAction.drawCard(F_TargetPlayer); + } + } + } + } + }; + ability.setStackDescription(F_card + " - " + F_card.getController() + " draws " + F_Amount + " card(s)."); + if(k[3].equals("Play")) { + PlayerZone Required_Zone = AllZone.getZone(Constant.Zone.Play, F_TargetPlayer); + if(AllZone.GameAction.isCardInZone(F_card,Required_Zone)) { + if(k[6].equals("ASAP")) AllZone.Stack.add(ability); + } + } + + } + // Deal Damage if(k[4].contains("Damage")) { String AmountParse = k[4]; @@ -890,11 +955,11 @@ public class GameAction { AllZone.GameAction.addDamage(c, F_card, F_Amount); } } else { - AllZone.GameAction.addDamage( (String) Targets[z], F_Amount); + AllZone.GameAction.addDamage( (String) Targets[z], F_Amount,F_card); } } } - if(F_card.getController().equals(Constant.Player.Computer)) AllZone.GameAction.addDamage(Constant.Player.Human, F_Amount*F_Multiple_Targets); + if(F_card.getController().equals(Constant.Player.Computer)) AllZone.GameAction.addDamage(Constant.Player.Human, F_Amount*F_Multiple_Targets,F_card); } } } @@ -2449,19 +2514,18 @@ public class GameAction { AllZone.GameAction.moveToGraveyard(sa.getSourceCard()); } */ - +/** public void addLife(String player, int life) { // place holder for future life gain modification rules getPlayerLife(player).addLife(life); } - public void subLife(String player, int life) { // place holder for future life loss modification rules getPlayerLife(player).subtractLife(life); } - + **/ public void addDamage(String player, int damage, Card source) { // place holder for future damage modification rules (prevention?) @@ -2471,17 +2535,17 @@ public class GameAction { for(Card c:cl) { GameActionUtil.executeGuiltyConscienceEffects(source, c, damage); } - getPlayerLife(player).subtractLife(damage); + getPlayerLife(player).subtractLife(damage,source); } - + /** public void addDamage(String player, int damage) { // place holder for future damage modification rules (prevention?) getPlayerLife(player).subtractLife(damage); } - + **/ public void addDamage(String player, Card source, int damage) { - getPlayerLife(player).subtractLife(damage); + getPlayerLife(player).subtractLife(damage,source); if(source.getKeyword().contains("Lifelink")) GameActionUtil.executeLifeLinkEffects(source, damage); diff --git a/src/forge/GameActionUtil.java b/src/forge/GameActionUtil.java index 109ea2e117d..7939131a21c 100644 --- a/src/forge/GameActionUtil.java +++ b/src/forge/GameActionUtil.java @@ -175,7 +175,7 @@ public class GameActionUtil { @Override public void resolve() { //Lifeblood controller (opponent in this case) gains 1 life - AllZone.GameAction.addLife(opponent, 1); + AllZone.GameAction.getPlayerLife(opponent).addLife(1); } };//Ability ability.setStackDescription(lifeblood.getName()+" - Mountain was tapped, "+opponent+" gains 1 life."); @@ -191,7 +191,7 @@ public class GameActionUtil { @Override public void resolve() { //Lifetap controller (opponent in this case) gains 1 life - AllZone.GameAction.addLife(opponent, 1); + AllZone.GameAction.getPlayerLife(opponent).addLife(1); } };//Ability ability.setStackDescription(lifetap.getName()+" - Forest was tapped, "+opponent+" gains 1 life."); @@ -1611,7 +1611,7 @@ public class GameActionUtil { }// if choice yes else target = "Human"; // check for target of spell/abilities should be here } else target = "Human"; // check for target of spell/abilities should be here - AllZone.GameAction.getPlayerLife(target).subtractLife(1); + AllZone.GameAction.getPlayerLife(target).subtractLife(1,card); PlayerLife life = AllZone.GameAction.getPlayerLife(card.getController()); life.addLife(1); @@ -2968,7 +2968,7 @@ public class GameActionUtil { if(cl.contains(card.getChosenColor())) { Ability ability = new Ability(card, "0") { public void resolve() { - AllZone.GameAction.getPlayerLife(c.getController()).subtractLife(1); + AllZone.GameAction.getPlayerLife(c.getController()).subtractLife(1,card); } //resolve };//ability ability.setStackDescription(card.getName() + " - " + c.getController() + @@ -2995,11 +2995,12 @@ public class GameActionUtil { for(int i = 0; i < list.size(); i++) { Card c = list.get(i); + final Card F_card = c; final Ability ability = new Ability(c, "0") { @Override public void resolve() { - AllZone.GameAction.getPlayerLife(player_d).subtractLife(1); + AllZone.GameAction.getPlayerLife(player_d).subtractLife(1,F_card); } }; ability.setStackDescription(list.get(i) + " - Deals 1 damage to him or her"); @@ -3051,7 +3052,7 @@ public class GameActionUtil { Object q = AllZone.Display.getChoiceOptional("Select computer as target?", choices); if(q != null && q.equals("Yes")) AllZone.GameAction.getPlayerLife(Constant.Player.Computer).subtractLife( - 1); + 1,crd); else { CardList cards = new CardList(oppPlay.getCards()); CardList oppCreatures = new CardList(); @@ -3077,7 +3078,7 @@ public class GameActionUtil { if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(crd, getTargetCard())) getTargetCard().addDamage( 1, crd); - } else AllZone.GameAction.getPlayerLife(getTargetPlayer()).subtractLife(1); + } else AllZone.GameAction.getPlayerLife(getTargetPlayer()).subtractLife(1,crd); } }//resolve() };//SpellAbility @@ -3463,7 +3464,7 @@ public class GameActionUtil { if(c.getName().equals("Cosmic Horror")) { String player = c.getController(); PlayerLife life = AllZone.GameAction.getPlayerLife(player); - life.subtractLife(7); + life.subtractLife(7,c); } AllZone.GameAction.destroy(c); } @@ -3536,7 +3537,7 @@ public class GameActionUtil { //AllZone.GameAction.sacrifice(c); String player = c.getController(); PlayerLife life = AllZone.GameAction.getPlayerLife(player); - life.subtractLife(c.getUpkeepDamage()); + life.subtractLife(c.getUpkeepDamage(),c); } }; @@ -4233,7 +4234,7 @@ public class GameActionUtil { public void resolve() { String player = crd.getController(); PlayerLife life = AllZone.GameAction.getPlayerLife(player); - life.subtractLife(2); + life.subtractLife(2,crd); } }; ability.setStackDescription("Dingus Staff - Deals 2 damage to " + destroyed.getController() + "."); @@ -4353,7 +4354,7 @@ public class GameActionUtil { public void resolve() { String player = crd.getController(); PlayerLife life = AllZone.GameAction.getPlayerLife(player); - life.subtractLife(2); + life.subtractLife(2,crd); } }; ability.setStackDescription("Dingus Egg - Deals 2 damage to " + destroyed.getController() + "."); @@ -4540,7 +4541,7 @@ public class GameActionUtil { if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(valakutCard, getTargetCard())) getTargetCard().addDamage(3, valakutCard); - } else AllZone.GameAction.getPlayerLife(getTargetPlayer()).subtractLife(3); + } else AllZone.GameAction.getPlayerLife(getTargetPlayer()).subtractLife(3,valakutCard); }//resolve() }; @@ -4648,7 +4649,7 @@ public class GameActionUtil { @Override public void resolve() { PlayerLife life = AllZone.GameAction.getPlayerLife(AllZone.GameAction.getOpponent(crd.getController())); - life.subtractLife(3); + life.subtractLife(3,crd); crd.addCounter(Counters.P1P1, 3); } }; @@ -4927,7 +4928,7 @@ public class GameActionUtil { if(target != null) target.addDamage(2, src); else - AllZone.GameAction.getPlayerLife(getTargetPlayer()).subtractLife(2); + AllZone.GameAction.getPlayerLife(getTargetPlayer()).subtractLife(2,src); AllZone.GameAction.drawCard(src.getController()); } @@ -5023,7 +5024,12 @@ public class GameActionUtil { } public static void executePlayerCombatDamageEffects(Card c) { - + // Whenever Keyword + Object[] DealsDamage_Whenever_Parameters = new Object[3]; + DealsDamage_Whenever_Parameters[0] = AllZone.GameAction.getOpponent(c.getController()); + DealsDamage_Whenever_Parameters[2] = c; + AllZone.GameAction.CheckWheneverKeyword(c, "DealsDamage/Opponent", DealsDamage_Whenever_Parameters); + if(c.getKeyword().contains("Whenever this creature deals damage to a player, that player gets a poison counter.")) playerCombatDamage_PoisonCounter(c, 1); @@ -5365,7 +5371,7 @@ public class GameActionUtil { private static void playerCombatDamage_lose_halflife_up(Card c) { final String player = c.getController(); final String opponent = AllZone.GameAction.getOpponent(player); - + final Card F_card = c; if(c.getNetAttack() > 0) { Ability ability2 = new Ability(c, "0") { @Override @@ -5385,7 +5391,7 @@ public class GameActionUtil { x = (AllZone.Human_Life.getLife() / 2) + y; } - AllZone.GameAction.getPlayerLife(opponent).subtractLife(x); + AllZone.GameAction.getPlayerLife(opponent).subtractLife(x,F_card); } };// ability2 @@ -6639,7 +6645,7 @@ public class GameActionUtil { // System.out.println("top of deck: " + library.get(i).getName()); String creatureType = library.get(0).getType().toString(); String cardName = library.get(0).getName(); - + final Card F_card = list.get(i); ability = new Ability(list.get(i), "0") { @Override public void resolve() { @@ -6650,7 +6656,7 @@ public class GameActionUtil { if(creatureType.contains("Faerie") || creatureType.contains("Wizard") || library.get(0).getKeyword().contains("Changeling")) { - AllZone.GameAction.getPlayerLife(opponent).subtractLife(2); + AllZone.GameAction.getPlayerLife(opponent).subtractLife(2,F_card); } }// resolve() @@ -6834,13 +6840,13 @@ public class GameActionUtil { // System.out.println("top of deck: " + library.get(i).getName()); final int convertedManaCost = CardUtil.getConvertedManaCost(library.get(i).getManaCost()); String cardName = library.get(i).getName(); - + final Card F_card = list.get(i); ability = new Ability(list.get(i), "0") { @Override public void resolve() { PlayerZone library = AllZone.getZone(Constant.Zone.Library, player); PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, player); - AllZone.GameAction.getPlayerLife(player).subtractLife(convertedManaCost); + AllZone.GameAction.getPlayerLife(player).subtractLife(convertedManaCost,F_card); // AllZone.GameAction.drawCard(player); // !!!can't just draw card, since it won't work with jpb's @@ -7722,10 +7728,11 @@ public class GameActionUtil { Ability ability; for(int i = 0; i < list.size(); i++) { + final Card F_card = list.get(i); ability = new Ability(list.get(i), "0") { @Override public void resolve() { - AllZone.GameAction.getPlayerLife(player).subtractLife(1); + AllZone.GameAction.getPlayerLife(player).subtractLife(1,F_card); } };// Ability ability.setStackDescription("Copper Tablet - deals 1 damage to " + player); @@ -7961,10 +7968,11 @@ public class GameActionUtil { Ability ability; for(int i = 0; i < list.size(); i++) { + final Card F_card = list.get(i); ability = new Ability(list.get(i), "0") { @Override public void resolve() { - AllZone.GameAction.getPlayerLife(player).subtractLife(2); + AllZone.GameAction.getPlayerLife(player).subtractLife(2,F_card); } }; @@ -7992,6 +8000,7 @@ public class GameActionUtil { Ability ability; for(int i = 0; i < list.size(); i++) { enchants = list.get(i).getEnchantedBy(); + final Card F_card = list.get(i); for(Card enchant:enchants) { if(enchant.getName().equals("Cursed Land")) { //final Card c = enchant; @@ -8000,7 +8009,7 @@ public class GameActionUtil { @Override public void resolve() { //if (c.getController().equals(player)) - AllZone.GameAction.getPlayerLife(player).subtractLife(1); + AllZone.GameAction.getPlayerLife(player).subtractLife(1,F_card); } }; @@ -8033,6 +8042,7 @@ public class GameActionUtil { ArrayList enchants; Ability ability; for(int i = 0; i < list.size(); i++) { + final Card F_card = list.get(i); enchants = list.get(i).getEnchantedBy(); for(Card enchant:enchants) { if(enchant.getName().equals("Pillory of the Sleepless")) { @@ -8041,7 +8051,7 @@ public class GameActionUtil { @Override public void resolve() { //if (c.getController().equals(player)) - AllZone.GameAction.getPlayerLife(player).subtractLife(1); + AllZone.GameAction.getPlayerLife(player).subtractLife(1,F_card); } }; ability.setStackDescription("Pillory of the Sleepless deals one damage to enchanted creature's controller."); @@ -8112,7 +8122,7 @@ public class GameActionUtil { ability = new Ability(list.get(i), "0") { @Override public void resolve() { - AllZone.GameAction.getPlayerLife(player).subtractLife(1); + AllZone.GameAction.getPlayerLife(player).subtractLife(1,crd); CardFactoryUtil.makeToken("Faerie Rogue", "B 1 1 Faerie Rogue", crd, "B", new String[] { "Creature", "Faerie", "Rogue"}, 1, 1, new String[] {"Flying"}); }// resolve() @@ -8310,10 +8320,11 @@ public class GameActionUtil { if(blaze.size() > 0) { final int lands = blaze.size(); + final Card F_card = blaze.get(0); // Quick Fix, will improve later Ability ability = new Ability(blaze.get(0), "0") { @Override public void resolve() { - AllZone.GameAction.getPlayerLife(player).subtractLife(lands); + AllZone.GameAction.getPlayerLife(player).subtractLife(lands,F_card); } }; ability.setStackDescription("Obsidian Fireheart - " + player + " gets dealt " + lands + " damage."); @@ -8781,13 +8792,13 @@ public class GameActionUtil { Card c = list.get(i); String[] choices = {"Yes", "No"}; Object choice = AllZone.Display.getChoice("Pay Carnophage's upkeep?", choices); - if(choice.equals("Yes")) AllZone.GameAction.getPlayerLife(player).subtractLife(1); + if(choice.equals("Yes")) AllZone.GameAction.getPlayerLife(player).subtractLife(1,c); else c.tap(); } } if(player == "Computer") for(int i = 0; i < list.size(); i++) { Card c = list.get(i); - if(AllZone.Computer_Life.getLife() > 1) AllZone.GameAction.getPlayerLife(player).subtractLife(1); + if(AllZone.Computer_Life.getLife() > 1) AllZone.GameAction.getPlayerLife(player).subtractLife(1,c); else c.tap(); } }// upkeep_Carnophage @@ -8805,13 +8816,13 @@ public class GameActionUtil { Card c = list.get(i); String[] choices = {"Yes", "No"}; Object choice = AllZone.Display.getChoice("Pay Sangrophage's upkeep?", choices); - if(choice.equals("Yes")) AllZone.GameAction.getPlayerLife(player).subtractLife(2); + if(choice.equals("Yes")) AllZone.GameAction.getPlayerLife(player).subtractLife(2,c); else c.tap(); } } if(player == "Computer") for(int i = 0; i < list.size(); i++) { Card c = list.get(i); - if(AllZone.Computer_Life.getLife() > 2) AllZone.GameAction.getPlayerLife(player).subtractLife(2); + if(AllZone.Computer_Life.getLife() > 2) AllZone.GameAction.getPlayerLife(player).subtractLife(2,c); else c.tap(); } }// upkeep_Carnophage @@ -8826,8 +8837,9 @@ public class GameActionUtil { list = list.getName("Phyrexian Arena"); for(int i = 0; i < list.size(); i++) { + final Card F_card = list.get(i); AllZone.GameAction.drawCard(player); - AllZone.GameAction.getPlayerLife(player).subtractLife(1); + AllZone.GameAction.getPlayerLife(player).subtractLife(1,F_card); AllZone.GameAction.checkStateEffects(); } @@ -8973,7 +8985,7 @@ public class GameActionUtil { Object q = AllZone.Display.getChoiceOptional("Select computer as target?", choices); if(q != null && q.equals("Yes")) AllZone.GameAction.getPlayerLife(Constant.Player.Computer).subtractLife( - hondlist.size()); + hondlist.size(),card); else { CardList cards = new CardList(oppPlay.getCards()); CardList oppCreatures = new CardList(); @@ -9007,7 +9019,7 @@ public class GameActionUtil { if(targetc != null) { if(AllZone.GameAction.isCardInPlay(targetc)) targetc.addDamage(hondlist.size(), card); } else AllZone.GameAction.getPlayerLife(Constant.Player.Human).subtractLife( - hondlist.size()); + hondlist.size(),card); } }//resolve() };//SpellAbility @@ -9064,11 +9076,11 @@ public class GameActionUtil { list = list.getName("Seizan, Perverter of Truth"); if(list.size() == 0) return; - + final Card F_card = list.get(0); Ability ability = new Ability(list.get(0), "0") { @Override public void resolve() { - AllZone.GameAction.getPlayerLife(player).subtractLife(2); + AllZone.GameAction.getPlayerLife(player).subtractLife(2,F_card); } }; ability.setStackDescription("Seizan, Perverter of Truth - " + player + " loses 2 life and draws 2 cards"); @@ -9090,7 +9102,8 @@ public class GameActionUtil { list = list.getName("Moroii"); for(int i = 0; i < list.size(); i++) { - AllZone.GameAction.getPlayerLife(player).subtractLife(1); + final Card F_card = list.get(i); + AllZone.GameAction.getPlayerLife(player).subtractLife(1,F_card); } }// upkeep_Moroii @@ -9104,11 +9117,12 @@ public class GameActionUtil { list = list.getName("Vampire Lacerator"); for(int i = 0; i < list.size(); i++) { + final Card F_card = list.get(i); if(player == "Human" && AllZone.Computer_Life.getLife() > 10) { - AllZone.GameAction.getPlayerLife(player).subtractLife(1); + AllZone.GameAction.getPlayerLife(player).subtractLife(1,F_card); } else { if(player == "Computer" && AllZone.Human_Life.getLife() > 10) { - AllZone.GameAction.getPlayerLife(player).subtractLife(1); + AllZone.GameAction.getPlayerLife(player).subtractLife(1,F_card); } } } @@ -9124,10 +9138,11 @@ public class GameActionUtil { Ability ability; for(int i = 0; i < list.size(); i++) { if(!list.get(i).isFaceDown()) { + final Card F_card = list.get(i); ability = new Ability(list.get(i), "0") { @Override public void resolve() { - AllZone.GameAction.getPlayerLife(player).subtractLife(2); + AllZone.GameAction.getPlayerLife(player).subtractLife(2,F_card); } };// Ability ability.setStackDescription("Grinning Demon - " + player + " loses 2 life"); diff --git a/src/forge/Input_CombatDamage.java b/src/forge/Input_CombatDamage.java index 5bea23a48c2..cc51e4d62a5 100644 --- a/src/forge/Input_CombatDamage.java +++ b/src/forge/Input_CombatDamage.java @@ -44,7 +44,7 @@ public class Input_CombatDamage extends Input { public void selectCard(Card card, PlayerZone zone) { InputUtil.playInstantAbility(card, zone); }//selectCard() - + /** @SuppressWarnings("unused") // playerDamage private void playerDamage(PlayerLife p) { @@ -52,7 +52,7 @@ public class Input_CombatDamage extends Input { p.setAssignedDamage(0); p.subtractLife(n); } - + **/ //moves assigned damage to damage for all creatures //deals damage to player if needed public void damageCreatureAndPlayer() { @@ -61,7 +61,8 @@ public class Input_CombatDamage extends Input { player = Constant.Player.Computer; PlayerLife life = AllZone.GameAction.getPlayerLife(player); - life.subtractLife(AllZone.Combat.getTotalDefendingDamage()); + life.subtractLife(AllZone.Combat.getTotalDefendingDamage(),AllZone.CardFactory.HumanNullCard); + // Quick Fix, should work for Whenever keyword because of GameActionUtil.ExecutePlayerCombatEffects //why??? diff --git a/src/forge/Input_FirstStrikeDamage.java b/src/forge/Input_FirstStrikeDamage.java index 8342039509f..8aceeaa8540 100644 --- a/src/forge/Input_FirstStrikeDamage.java +++ b/src/forge/Input_FirstStrikeDamage.java @@ -49,7 +49,7 @@ public class Input_FirstStrikeDamage extends Input { public void selectCard(Card card, PlayerZone zone) { InputUtil.playInstantAbility(card, zone); }//selectCard() - + /** @SuppressWarnings("unused") // playerDamage private void playerDamage(PlayerLife p) { @@ -57,7 +57,7 @@ public class Input_FirstStrikeDamage extends Input { p.setAssignedDamage(0); p.subtractLife(n); } - + **/ //moves assigned damage to damage for all creatures //deals damage to player if needed private void damageCreatureAndPlayer() { @@ -67,7 +67,8 @@ public class Input_FirstStrikeDamage extends Input { if(player.equals("")) //this is a really bad hack, to allow raging goblin to attack on turn 1 player = Constant.Player.Computer; PlayerLife life = AllZone.GameAction.getPlayerLife(player); - life.subtractLife(AllZone.Combat.getTotalFirstStrikeDefendingDamage()); + life.subtractLife(AllZone.Combat.getTotalFirstStrikeDefendingDamage(),AllZone.CardFactory.HumanNullCard); + // Quick Fix, should work for Whenever keyword because of GameActionUtil.ExecutePlayerCombatEffects System.out.println("getTotalFirstStrikeDefendingDamage: " + AllZone.Combat.getTotalFirstStrikeDefendingDamage()); diff --git a/src/forge/Input_Main.java b/src/forge/Input_Main.java index ea0e5af0717..4272d29db7f 100644 --- a/src/forge/Input_Main.java +++ b/src/forge/Input_Main.java @@ -33,7 +33,7 @@ public class Input_Main extends Input { CardList fastbonds = CardFactoryUtil.getFastbonds(Constant.Player.Human); if(fastbonds.size() > 0) { if(AllZone.GameInfo.humanPlayedFirstLandThisTurn()) { - AllZone.GameAction.getPlayerLife(Constant.Player.Human).subtractLife(1); + AllZone.GameAction.getPlayerLife(Constant.Player.Human).subtractLife(1,fastbonds.get(0)); } } InputUtil.playAnyCard(card, zone); diff --git a/src/forge/PlayerLife.java b/src/forge/PlayerLife.java index 619252c0687..eb51bfb6e49 100644 --- a/src/forge/PlayerLife.java +++ b/src/forge/PlayerLife.java @@ -35,9 +35,22 @@ public class PlayerLife extends MyObservable implements java.io.Serializable AllZone.GameAction.CheckWheneverKeyword(WhoGainedLife, "GainLife", Life_Whenever_Parameters); this.updateObservers(); } - public void subtractLife(int life2) + public void subtractLife(int life2, Card SourceCard) { + Card WhoGainedLife = new Card(); + if(AllZone.Human_Life.getLife() != AllZone.Computer_Life.getLife()) { + if(AllZone.Human_Life.getLife() == life) WhoGainedLife = AllZone.CardFactory.HumanNullCard; + else WhoGainedLife = AllZone.CardFactory.ComputerNullCard; + } life -= life2; + if(WhoGainedLife != AllZone.CardFactory.HumanNullCard && WhoGainedLife != AllZone.CardFactory.ComputerNullCard) { + if(AllZone.Human_Life.getLife() == life) WhoGainedLife = AllZone.CardFactory.HumanNullCard; + else WhoGainedLife = AllZone.CardFactory.ComputerNullCard; + } + Object[] DealsDamage_Whenever_Parameters = new Object[3]; + DealsDamage_Whenever_Parameters[0] = WhoGainedLife.getController(); + DealsDamage_Whenever_Parameters[2] = SourceCard; + AllZone.GameAction.CheckWheneverKeyword(WhoGainedLife, "DealsDamage/Opponent", DealsDamage_Whenever_Parameters); this.updateObservers(); } } \ No newline at end of file