demilich1 / metastone

Hearthstone simulator written in Java with full GUI support
GNU General Public License v2.0
132 stars 80 forks source link

Trouble with a custom spell #371

Open Watermelon86 opened 7 years ago

Watermelon86 commented 7 years ago

I've been working on implementing some custom cards that help make a control hunter archetype, but one of the spells is giving me issues.

image

I wanted it to work sort of like Stampede and Lock and Load as a trigger effect that lasts one turn, but instead of adding cards to your hand, it would turn your removal spells into mini board clears.

{ "name": "Scatter Shot", "baseManaCost": 2, "type": "SPELL", "heroClass": "HUNTER", "rarity": "EPIC", "description": "Whenever you cast a spell on a minion this turn, cast a copy of it on adjacent minions as well.", "targetSelection": "NONE", "spell": { "class": "AddSpellTriggerSpell", "target": "FRIENDLY_PLAYER", "trigger": { "eventTrigger": { "class": "SpellCastedTrigger", "sourcePlayer": "SELF", "targetEntityType": "MINION" }, "spell": { "class": "RecastSpell", "target": "ADJACENT_MINIONS", "card": "PENDING_CARD" }, "oneTurn": true } }, "collectible": true, "set": "CUSTOM", "fileFormatVersion": 1 }

Whenever I try to cast a targeted spell on a minion the turn I play this, the entire game crashes. I think the issue is that it's trying to cast copies of the copied spells in a never ending loop.

Any ideas on how to fix this are appreciated.

percy896 commented 7 years ago

Not sure if this is the issue, but shouldn't you use "metaspell" for multiple spells in one card?

guyde2011 commented 7 years ago

You could use a dummy modifier (my favorite is MANA_COST_MODIFIER, as it does not affect anything, it resets when a minion returns to your hand).

That allows you to use a workaround like this:

"class": "ConditionalEffectSpell",
"spell1": {
    "class": "NullSpell"
},
"spell2": {
    "class": "MetaSpell",
    "spells": [
    {
        "class": "ModifyAttributeSpell",
        "target": "ADJACENT_MINIONS",
        "attribute": "MANA_COST_MODIFIER",
        "value": 100
    },
    {
        "class": "RecastSpell",
        "target": "ADJACENT_MINIONS",
        "card": "PENDING_CARD"
    },
    {
        "class": "ModifyAttributeSpell",
        "target": "ADJACENT_MINIONS",
        "attribute": "MANA_COST_MODIFIER",
        "value": 0
    }
    ]
},
"condition": {
    "class": "AttributeCondition",
    "target": "SELF",
    "operation": "EQUAL",
    "attribute": "MANA_COST_MODIFIER",
    "value": 0
}