Improved Cursed Scroll and Magus of the Scroll, fixed Android downloader.

This commit is contained in:
Vittorio Alfieri
2021-07-25 21:54:39 +02:00
parent 9bdf0e0690
commit f499a1e52f
3 changed files with 7 additions and 23 deletions

View File

@@ -1013,27 +1013,9 @@ void WParsedInt::init(string s, Spell * spell, MTGCardInstance * card)
intValue = list[i];
}
}
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)...
else if ((s == "cursedscrollresult" || s == "magusofscrollresult") && (card->controller()->game->hand->nb_cards > 0))//return 1 if the choosen card has to give damage (e.g. Cursed Scroll, Magus od the Scroll).
{
intValue = 0;
if(card->controller()->game->hand->nb_cards){
list<string> 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<string>::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();
}
intValue = (card->controller()->game->hand->cards[std::rand() % card->controller()->game->hand->nb_cards]->name == card->name)?1:0;
}
else if (s == "mypos" || s == "bushidopoints")//hand,exile,grave & library only (library zpos is inverted so the recent one is always the top) -- bushido point
{