diff --git a/.gitattributes b/.gitattributes index 3f2b4740afe..ee206c8625f 100644 --- a/.gitattributes +++ b/.gitattributes @@ -11308,6 +11308,7 @@ res/cardsfolder/v/veinfire_borderpost.txt svneol=native#text/plain res/cardsfolder/v/vela_the_night_clad.txt -text res/cardsfolder/v/veldrane_of_sengir.txt svneol=native#text/plain res/cardsfolder/v/veldt.txt svneol=native#text/plain +res/cardsfolder/v/velis_vel.txt -text res/cardsfolder/v/venarian_glimmer.txt -text res/cardsfolder/v/venarian_gold.txt svneol=native#text/plain res/cardsfolder/v/vendetta.txt svneol=native#text/plain diff --git a/res/cardsfolder/c/coat_of_arms.txt b/res/cardsfolder/c/coat_of_arms.txt index f669ba9a779..bce0e11246e 100644 --- a/res/cardsfolder/c/coat_of_arms.txt +++ b/res/cardsfolder/c/coat_of_arms.txt @@ -1,7 +1,9 @@ Name:Coat of Arms ManaCost:5 Types:Artifact -Text:Each creature gets +1/+1 for each other creature on the battlefield that shares at least one creature type with it. (For example, if two Goblin Warriors and a Goblin Shaman are on the battlefield, each gets +2/+2.) +Text:no text +S:Mode$ Continuous | Affected$ Creature | AddPower$ AffectedX | AddToughness$ AffectedX | EffectZone$ Battlefield | Description$ Each creature gets +1/+1 for each other creature on the battlefield that shares at least one creature type with it. (For example, if two Goblin Warriors and a Goblin Shaman are on the battlefield, each gets +2/+2.) +SVar:AffectedX:Count$Valid Creature.sharesCreatureTypeWith+Other SVar:PlayMain1:TRUE SVar:Rarity:Rare SVar:Picture:http://www.wizards.com/global/images/magic/general/coat_of_arms.jpg diff --git a/res/cardsfolder/t/the_hippodrome.txt b/res/cardsfolder/t/the_hippodrome.txt index f8179023c88..7f2903d0a14 100644 --- a/res/cardsfolder/t/the_hippodrome.txt +++ b/res/cardsfolder/t/the_hippodrome.txt @@ -4,7 +4,7 @@ Types:Plane Segovia Text:no text S:Mode$ Continuous | EffectZone$ Command | Affected$ Creature | AddPower$ -5 | Description$ All Creatures get -5/-0. T:Mode$ PlanarDice | Result$ Chaos | OptionalDecider$ You | TriggerZones$ Command | Execute$ RolledChaos | TriggerDescription$ Whenever you roll Chaos, you may destroy target creature if it's power is 0 or less. -SVar:RolledChaos:AB$ Destroy | Cost$ 0 | ValidCards$ Creature | ConditionCheckSVar$ TgtPow | ConditionCompareSVar$ LE0 +SVar:RolledChaos:AB$ Destroy | Cost$ 0 | ValidTgts$ Creature | ConditionCheckSVar$ TgtPow | ConditionCompareSVar$ LE0 | AITgts$ Creature.OpponentCtrl+powerLE0 SVar:TgtPow:Targeted$CardPower T:Mode$ PlanarDice | Result$ Planeswalk | TriggerZones$ Command | Execute$ RolledWalk | Secondary$ True | TriggerDescription$ Whenever you roll Planeswalk, put this card on the bottom of its owner's planar deck face down, then move the top card of your planar deck off that planar deck and turn it face up. SVar:RolledWalk:AB$ Planeswalk | Cost$ 0 diff --git a/res/cardsfolder/v/velis_vel.txt b/res/cardsfolder/v/velis_vel.txt new file mode 100644 index 00000000000..f13d8a0546d --- /dev/null +++ b/res/cardsfolder/v/velis_vel.txt @@ -0,0 +1,16 @@ +Name:Velis Vel +ManaCost:no cost +Types:Plane Lorwyn +Text:no text +S:Mode$ Continuous | Affected$ Creature | AddPower$ AffectedX | AddToughness$ AffectedX | EffectZone$ Command | Description$ Each creature gets +1/+1 for each other creature on the battlefield that shares at least one creature type with it. (For example, if two Elemental Shamans and an Elemental Spirit are on the battlefield, each gets +2/+2.) +SVar:AffectedX:Count$Valid Creature.sharesCreatureTypeWith+Other +T:Mode$ PlanarDice | Result$ Chaos | TriggerZones$ Command | Execute$ RolledChaos | TriggerDescription$ Whenever you roll Chaos, target creature gains all creature types until end of turn. +SVar:RolledChaos:AB$ Animate | Cost$ 0 | ValidTgts$ Creature | TgtPrompt$ Select target creature | Types$ AllCreatureTypes +T:Mode$ PlanarDice | Result$ Planeswalk | TriggerZones$ Command | Execute$ RolledWalk | Secondary$ True | TriggerDescription$ Whenever you roll Planeswalk, put this card on the bottom of its owner's planar deck face down, then move the top card of your planar deck off that planar deck and turn it face up +SVar:RolledWalk:AB$ Planeswalk | Cost$ 0 +A:AB$ RollPlanarDice | Cost$ X | SorcerySpeed$ True | ActivationZone$ Command | SpellDescription$ Roll the planar dice. +SVar:X:Count$RolledThisTurn +SVar:Picture:http://www.wizards.com/global/images/magic/general/velis_vel.jpg +SetInfo:HOP|Common|http://magiccards.info/extras/plane/planechase/velis-vel.jpg +Oracle:Each creature gets +1/+1 for each other creature on the battlefield that shares at least one creature type with it. (For example, if two Elemental Shamans and an Elemental Spirit are on the battlefield, each gets +2/+2.)\nWhenever you roll {C}, target creature gains all creature types until end of turn. +End \ No newline at end of file diff --git a/src/main/java/forge/Card.java b/src/main/java/forge/Card.java index c4394c4c2a5..95665ac5bfa 100644 --- a/src/main/java/forge/Card.java +++ b/src/main/java/forge/Card.java @@ -6747,6 +6747,10 @@ public class Card extends GameEntity implements Comparable { if (!this.sharesTypeWith(source)) { return false; } + } else if (property.startsWith("sharesCreatureTypeWith")) { + if (!this.sharesCreatureTypeWith(source)) { + return false; + } } else if (property.startsWith("withFlashback")) { boolean fb = false; if (this.hasStartOfUnHiddenKeyword("Flashback")) { diff --git a/src/main/java/forge/GameActionUtil.java b/src/main/java/forge/GameActionUtil.java index 736dc494281..79306b2e689 100644 --- a/src/main/java/forge/GameActionUtil.java +++ b/src/main/java/forge/GameActionUtil.java @@ -956,39 +956,6 @@ public final class GameActionUtil { } } - /** Constant coatOfArms. */ - private static Command coatOfArms = new Command() { - private static final long serialVersionUID = 583505612126735693L; - - private final List gloriousAnthemList = new ArrayList(); - - @Override - public void execute() { - final List list = this.gloriousAnthemList; - // reset all cards in list - aka "old" cards - for (int i2 = 0; i2 < list.size(); i2++) { - list.get(i2).addSemiPermanentAttackBoost(-1); - list.get(i2).addSemiPermanentDefenseBoost(-1); - } - // add +1/+1 to cards - list.clear(); - final int num = CardLists.filter(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield), CardPredicates.nameEquals("Coat of Arms")).size(); - final List creatures = CardLists.filter(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.CREATURES); - - for (Card c : creatures) { - for (Card c2 : creatures) { - if (!c.equals(c2) && c.sharesCreatureTypeWith(c2)) { - for (int j = 0; j < num; j++) { - c.addSemiPermanentAttackBoost(1); - c.addSemiPermanentDefenseBoost(1); - this.gloriousAnthemList.add(c); - } - } - } - } // for outer - } // execute - }; // coatOfArms - private static Command alphaStatus = new Command() { private static final long serialVersionUID = -3213793711304934358L; @@ -1244,7 +1211,6 @@ public final class GameActionUtil { GameActionUtil.getCommands().put("Ajani_Avatar_Token", GameActionUtil.ajaniAvatarToken); GameActionUtil.getCommands().put("Alpha_Status", GameActionUtil.alphaStatus); - GameActionUtil.getCommands().put("Coat_of_Arms", GameActionUtil.coatOfArms); GameActionUtil.getCommands().put("Liu_Bei", GameActionUtil.liuBei); GameActionUtil.getCommands().put("Old_Man_of_the_Sea", GameActionUtil.oldManOfTheSea); diff --git a/src/main/java/forge/StaticEffect.java b/src/main/java/forge/StaticEffect.java index 4a18fe8e58c..60c9c2ae642 100644 --- a/src/main/java/forge/StaticEffect.java +++ b/src/main/java/forge/StaticEffect.java @@ -40,6 +40,7 @@ public class StaticEffect { private int xValue = 0; private int yValue = 0; private long timestamp = -1; + private HashMap xValueMap = new HashMap(); private String chosenType; private HashMap mapParams = new HashMap(); @@ -821,6 +822,29 @@ public class StaticEffect { return this.yValue; } + /** + * Store xValue relative to a specific card. + * @param affectedCard the card affected + * @param xValue the xValue + */ + public final void addXMapValue(final Card affectedCard, final Integer xValue) { + if (this.xValueMap.containsKey(affectedCard)) { + if (!this.xValueMap.get(affectedCard).equals(xValue)) { + this.xValueMap.remove(affectedCard); + } + } + this.xValueMap.put(affectedCard, xValue); + } + + /** + * Get the xValue for specific card. + * @param affectedCard the affected card + * @return an int. + */ + public int getXMapValue(Card affectedCard) { + return this.xValueMap.get(affectedCard); + } + /** * setParams. TODO Write javadoc for this method. * diff --git a/src/main/java/forge/StaticEffects.java b/src/main/java/forge/StaticEffects.java index 1a88e365898..61cdb3c0fe5 100644 --- a/src/main/java/forge/StaticEffects.java +++ b/src/main/java/forge/StaticEffects.java @@ -25,6 +25,8 @@ import java.util.List; import com.esotericsoftware.minlog.Log; +import forge.card.abilityfactory.AbilityFactory; +import forge.card.cardfactory.CardFactoryUtil; import forge.card.replacement.ReplacementEffect; import forge.card.spellability.SpellAbility; import forge.card.staticability.StaticAbility; @@ -103,7 +105,9 @@ public class StaticEffects { final HashMap params = se.getParams(); int powerBonus = 0; + String addP = ""; int toughnessBonus = 0; + String addT = ""; int keywordMultiplier = 1; boolean setPT = false; String[] addKeywords = null; @@ -115,22 +119,24 @@ public class StaticEffects { } if (params.containsKey("AddPower")) { - if (params.get("AddPower").equals("X")) { - powerBonus = se.getXValue(); - } else if (params.get("AddPower").equals("Y")) { - powerBonus = se.getYValue(); + addP = params.get("AddPower"); + if (addP.matches("[0-9][0-9]?")) { + powerBonus = Integer.valueOf(addP); + } else if (addP.equals("AffectedX")) { + // gets calculated at runtime } else { - powerBonus = Integer.valueOf(params.get("AddPower")); + powerBonus = se.getXValue(); } } if (params.containsKey("AddToughness")) { - if (params.get("AddToughness").equals("X")) { - toughnessBonus = se.getXValue(); - } else if (params.get("AddToughness").equals("Y")) { - toughnessBonus = se.getYValue(); + addT = params.get("AddToughness"); + if (addT.matches("[0-9][0-9]?")) { + toughnessBonus = Integer.valueOf(addT); + } else if (addT.equals("AffectedX")) { + // gets calculated at runtime } else { - toughnessBonus = Integer.valueOf(params.get("AddToughness")); + toughnessBonus = se.getXValue(); } } @@ -186,6 +192,12 @@ public class StaticEffects { } // remove P/T bonus + if (addP.startsWith("AffectedX")) { + powerBonus = se.getXMapValue(affectedCard); + } + if (addT.startsWith("AffectedX")) { + toughnessBonus = se.getXMapValue(affectedCard); + } affectedCard.addSemiPermanentAttackBoost(powerBonus * -1); affectedCard.addSemiPermanentDefenseBoost(toughnessBonus * -1); @@ -278,7 +290,6 @@ public class StaticEffects { StaticEffects.cardToEffectsList.put("Avatar", new String[] { "Ajani_Avatar_Token" }); StaticEffects.cardToEffectsList.put("Alpha Status", new String[] { "Alpha_Status" }); - StaticEffects.cardToEffectsList.put("Coat of Arms", new String[] { "Coat_of_Arms" }); StaticEffects.cardToEffectsList.put("Liu Bei, Lord of Shu", new String[] { "Liu_Bei" }); StaticEffects.cardToEffectsList.put("Old Man of the Sea", new String[] { "Old_Man_of_the_Sea" });