From a52cd305b7cb68b797924dc2ab4a9d865fb363e4 Mon Sep 17 00:00:00 2001 From: valfieri Date: Wed, 21 Oct 2020 18:53:44 +0200 Subject: [PATCH] Added Cursed Scroll primitive. --- .../bin/Res/sets/primitives/borderline.txt | 7 ++++++ .../bin/Res/sets/primitives/unsupported.txt | 6 ----- projects/mtg/include/AllAbilities.h | 22 +++++++++++++++++++ 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/projects/mtg/bin/Res/sets/primitives/borderline.txt b/projects/mtg/bin/Res/sets/primitives/borderline.txt index 5e929d4e2..162620468 100644 --- a/projects/mtg/bin/Res/sets/primitives/borderline.txt +++ b/projects/mtg/bin/Res/sets/primitives/borderline.txt @@ -9152,6 +9152,13 @@ mana={1}{R} type=Sorcery [/card] [card] +name=Cursed Scroll +auto={3}{T}:name(Name a card from your hand) choice target(*|myhand) donothing && name(Game chooses a random card) if compare(cursedscrollresult)~equalto~1 then ability$!name(The random card macthes with the named card) name(The random card macthes with the named card) choice name(Damage creature) damage:2 target(creature) _ choice name(Damage player) damage:2 target(player) _ choice name(Damage planeswalker) damage:2 target(planeswalker)!$ controller +text={3}, {T}: Choose a card name, then reveal a card at random from your hand. If that card has the chosen name, Cursed Scroll deals 2 damage to any target. +mana={1} +type=Artifact +[/card] +[card] name=Cyclopean Giant auto=@movedTo(this|graveyard) from(battlefield):all(trigger[to]) moveto(exile) and!( transforms((swamp)) target(land) )! text=When Cyclopean Giant dies, target land becomes a Swamp. Exile Cyclopean Giant. diff --git a/projects/mtg/bin/Res/sets/primitives/unsupported.txt b/projects/mtg/bin/Res/sets/primitives/unsupported.txt index 3ce1bd078..740710e38 100644 --- a/projects/mtg/bin/Res/sets/primitives/unsupported.txt +++ b/projects/mtg/bin/Res/sets/primitives/unsupported.txt @@ -2857,12 +2857,6 @@ type=Enchantment subtype=Aura Curse [/card] [card] -name=Cursed Scroll -text={3}, {T}: Name a card. Reveal a card at random from your hand. If it's the named card, Cursed Scroll deals 2 damage to target creature or player. -mana={1} -type=Artifact -[/card] -[card] name=Curtain of Light text=Cast Curtain of Light only during combat after blockers are declared. -- Target unblocked attacking creature becomes blocked. (This spell works on unblockable creatures.) -- Draw a card. mana={1}{W} diff --git a/projects/mtg/include/AllAbilities.h b/projects/mtg/include/AllAbilities.h index 21962ec52..e198c4adc 100644 --- a/projects/mtg/include/AllAbilities.h +++ b/projects/mtg/include/AllAbilities.h @@ -1063,6 +1063,28 @@ private: } } } + else if (s == "cursedscrollresult")//Return 1 if the cursed scroll has to give damage (calculated randomly basing on the number of unique cards in the player hand)... + { + intValue = 0; + if(card->controller()->game->hand->nb_cards){ + list unique_cards; + for (int j = 0; j < card->controller()->game->hand->nb_cards; j++){ + bool found = false; + for (unsigned int k = 0; k < unique_cards.size() && !found; k++){ + list::iterator it; + for (it = unique_cards.begin(); it != unique_cards.end(); it++){ + if(card->controller()->game->hand->cards[j]->name == *it) + found = true; + } + } + if(!found) + unique_cards.push_back(card->controller()->game->hand->cards[j]->name); + } + if(!(std::rand() % unique_cards.size())) + intValue = 1; + unique_cards.clear(); + } + } else if (s == "mypos") {//hand,exile,grave & library only (library zpos is inverted so the recent one is always the top) intValue = card->zpos;