From 911f8f6de69b9d01f7ef6f1bf26a9c29a4b53ccb Mon Sep 17 00:00:00 2001 From: Anthony Calosa Date: Tue, 28 Feb 2017 10:41:46 +0800 Subject: [PATCH 1/3] update scry then draw also moved "show token in editor" in general settings --- projects/mtg/bin/Res/sets/primitives/mtg.txt | 19 +++++++++++++------ projects/mtg/src/GameStateOptions.cpp | 2 +- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/projects/mtg/bin/Res/sets/primitives/mtg.txt b/projects/mtg/bin/Res/sets/primitives/mtg.txt index 2061ed379..dc409e6ce 100644 --- a/projects/mtg/bin/Res/sets/primitives/mtg.txt +++ b/projects/mtg/bin/Res/sets/primitives/mtg.txt @@ -42658,7 +42658,8 @@ toughness=2 [/card] [card] name=Foresee -auto=scry:4 scrycore draw:2 delayed dontshow scrycoreend scryend +aicode=activate draw:2 controller +auto=name(Scry) reveal:4 optionone name(Put On Top) target(*|reveal) moveto(mylibrary) optiononeend optiontwo name(put on bottom) target(<4>*|reveal) bottomoflibrary optiontwoend afterrevealed transforms((,newability[draw:2 controller])) oneshot afterrevealedend revealend text=Scry 4, then draw two cards. (To scry 4, look at the top four cards of your library, then put any number of them on the bottom of your library and the rest on top in any order.) mana={3}{U} type=Sorcery @@ -46757,7 +46758,9 @@ toughness=3 [/card] [card] name=Glimmer of Genius -auto=scry:2 scrycore delayed dontshow donothing scrycoreend scryend && ability$!choice alterenergy:2 controller!$ controller && ability$!choice draw:2 controller!$ controller +aicode=activate draw:2 controller +auto=name(Scry) reveal:2 optionone name(Put On Top) target(*|reveal) moveto(mylibrary) optiononeend optiontwo name(put on bottom) target(<2>*|reveal) bottomoflibrary optiontwoend afterrevealed transforms((,newability[draw:2 controller])) oneshot afterrevealedend revealend +auto=alterenergy:2 controller text=Scry 2, then draw two cards. You get {E}{E} (two energy counters). mana={3}{U} type=Instant @@ -59472,7 +59475,8 @@ subtype=Jace [card] name=Jace, Unraveler of Secrets auto=counter(0/0,5,loyalty) -auto={C(0/0,1,Loyalty)}:name(+1: Scry) scry:1 scrycore delayed draw:1 scrycoreend scryend +aicode=activate draw:1 controller +auto={C(0/0,1,Loyalty)}:name(+1: Scry) reveal:1 optionone name(Put On Top) target(*|reveal) moveto(mylibrary) optiononeend optiontwo name(put on bottom) target(<1>*|reveal) bottomoflibrary optiontwoend afterrevealed transforms((,newability[draw:1 controller])) oneshot afterrevealedend revealend auto={C(0/0,-2,Loyalty)}:name(-2: Bounce) moveto(ownerhand) target(creature) auto={C(0/0,-8,Loyalty)}:name(-8: Emblem) emblem transforms((,newability[@movedto(*|opponentstack) restriction{thisturn(*|opponentstack)~equalto~0}:choice fizzle all(*|opponentstack)])) forever dontremove text=+1: Scry 1, then draw a card. -- -2: Return target creature to its owner's hand. -- -8: You get an emblem with "Whenever an opponent casts his or her first spell each turn, counter that spell." @@ -87940,7 +87944,8 @@ type=Instant [/card] [card] name=Preordain -auto=scry:2 scrycore draw:1 delayed dontshow scrycoreend scryend +aicode=activate draw:1 +auto=name(Scry) reveal:2 optionone name(Put On Top) target(*|reveal) moveto(mylibrary) optiononeend optiontwo name(put on bottom) target(<2>*|reveal) bottomoflibrary optiontwoend afterrevealed transforms((,newability[draw:1 controller])) oneshot afterrevealedend revealend text=Scry 2, then draw a card. (To scry 2, look at the top two cards of your library, then put any number of them on the bottom of your library and the rest on top in any order.) mana={U} type=Sorcery @@ -92352,7 +92357,8 @@ subtype=Arcane [/card] [card] name=Read the Bones -auto=scry:2 scrycore dontshow delayed draw:2 && life:-2 scrycoreend scryend +aicode=activate transforms((,newability[draw:2 controller],newability[life:-2 controller])) oneshot +auto=name(Scry) reveal:2 optionone name(Put On Top) target(*|reveal) moveto(mylibrary) optiononeend optiontwo name(put on bottom) target(<2>*|reveal) bottomoflibrary optiontwoend afterrevealed transforms((,newability[draw:2 controller],newability[life:-2 controller])) oneshot afterrevealedend revealend text=Scry 2, then draw two cards. You lose 2 life. (To scry 2, look at the top two cards of your library, then put any number of them on the bottom of your library and the rest on top in any order.) mana={2}{B} type=Sorcery @@ -124835,7 +124841,8 @@ toughness=5 [/card] [card] name=Ugin's Insight -auto=reveal:convertedcost:highest:*:mybattlefield optionone name(Look) target(<1>*|reveal) doNothing optiononeend optiontwo target(<60>*|reveal) moveto(mylibrary) optiontwoend revealend +aicode=activate draw:3 controller +auto=name(Scry) reveal:convertedcost:highest:*:mybattlefield optionone name(Put On Top) target(*|reveal) moveto(mylibrary) optiononeend optiontwo name(put on bottom) target(*|reveal) bottomoflibrary optiontwoend afterrevealed transforms((,newability[draw:3 controller])) oneshot afterrevealedend revealend text=Scry X, where X is the highest converted mana cost among permanents you control, then draw three cards. mana={3}{U}{U} type=Sorcery diff --git a/projects/mtg/src/GameStateOptions.cpp b/projects/mtg/src/GameStateOptions.cpp index 08044077e..31f5ef591 100644 --- a/projects/mtg/src/GameStateOptions.cpp +++ b/projects/mtg/src/GameStateOptions.cpp @@ -51,13 +51,13 @@ void GameStateOptions::Start() // optionsList->Add(NEW OptionInteger(Options::INTERRUPTMYABILITIES, "Interrupt my abilities")); //this is a dev option, not meant for standard play. uncomment if you need to see abilities you own hitting the stack. optionsList->Add(NEW OptionInteger(Options::INTERRUPT_SECONDMAIN, "Interrupt opponent's end of turn")); + optionsList->Add(NEW OptionInteger(Options::SHOWTOKENS, "Show Tokens in Editor")); optionsTabs = NEW WGuiTabMenu(); optionsTabs->Add(optionsList); optionsList = NEW WGuiList("Game"); optionsList->Add(NEW WGuiHeader("Interface Options")); optionsList->Add(NEW OptionInteger(Options::BLKBORDER, "All Black Border")); - optionsList->Add(NEW OptionInteger(Options::SHOWTOKENS, "Show Tokens in Editor")); optionsList->Add(NEW WDecoEnum(NEW OptionInteger(Options::CLOSEDHAND, "Closed hand", 1, 1, 0))); optionsList->Add(NEW WDecoEnum(NEW OptionInteger(Options::HANDDIRECTION, "Hand direction", 1, 1, 0))); optionsList->Add(NEW WDecoEnum(NEW OptionInteger(Options::MANADISPLAY, "Mana display", 3, 1, 0))); From 5a3493c0c95a0980223ebbf250cf134d902b6bec Mon Sep 17 00:00:00 2001 From: Anthony Calosa Date: Tue, 28 Feb 2017 16:19:59 +0800 Subject: [PATCH 2/3] update spelltargettype --- projects/mtg/src/AllAbilities.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/projects/mtg/src/AllAbilities.cpp b/projects/mtg/src/AllAbilities.cpp index 3a73ba7d4..99236b420 100644 --- a/projects/mtg/src/AllAbilities.cpp +++ b/projects/mtg/src/AllAbilities.cpp @@ -8046,10 +8046,25 @@ void AACastCard::Update(float dt) toCheck = theNamedCard; if(toCheck && toCheck->spellTargetType.size()) { + string backupST = toCheck->spellTargetType; + if((toCheck->spellTargetType == "opponent") && (toCheck->owner != source->controller())) + toCheck->spellTargetType = "controller"; + else if((toCheck->spellTargetType.find("|opponent") != string::npos) && (toCheck->owner != source->controller())) + { + string replaceMe = backupST; + toCheck->spellTargetType = cReplaceString(replaceMe, "|opponent", "|my"); + } + //Since we control the card to cast, if the card should target an opponent, + //direct it to source ability controller->opponent + //example card is Bribery, if we cast it targeting from opponent's library, + //we should target the source ability controller->opponent + TargetChooserFactory tcf(game); TargetChooser * stc = tcf.createTargetChooser(toCheck->spellTargetType,toCheck); if (!stc->validTargetsExist()||toCheck->isToken) { + toCheck->spellTargetType = backupST; + processed = true; this->forceDestroy = 1; return; From 1430cfd6b462a6851ceac748c163183017d73431 Mon Sep 17 00:00:00 2001 From: Anthony Calosa Date: Tue, 28 Feb 2017 17:32:01 +0800 Subject: [PATCH 3/3] momir indicator (non PSP) green + can play a land, red + means you already played a land/ or cant play a land anymore. also some minor fix --- projects/mtg/bin/Res/sets/primitives/mtg.txt | 2 +- projects/mtg/src/CardGui.cpp | 27 ++++++++++++++++++-- projects/mtg/src/GameObserver.cpp | 2 ++ projects/mtg/src/GuiPlay.cpp | 5 +++- 4 files changed, 32 insertions(+), 4 deletions(-) diff --git a/projects/mtg/bin/Res/sets/primitives/mtg.txt b/projects/mtg/bin/Res/sets/primitives/mtg.txt index dc409e6ce..1509175c9 100644 --- a/projects/mtg/bin/Res/sets/primitives/mtg.txt +++ b/projects/mtg/bin/Res/sets/primitives/mtg.txt @@ -132620,7 +132620,7 @@ type=Instant [card] name=Welkin Guide abilities=flying -auto=target(creature) 2/2 ueot && flying ueot +auto=choice target(creature) 2/2 ueot && flying ueot text=Flying -- When Welkin Guide enters the battlefield, target creature gets +2/+2 and gains flying until end of turn. mana={4}{W} type=Creature diff --git a/projects/mtg/src/CardGui.cpp b/projects/mtg/src/CardGui.cpp index d4f84d6c7..a31981179 100644 --- a/projects/mtg/src/CardGui.cpp +++ b/projects/mtg/src/CardGui.cpp @@ -491,7 +491,7 @@ void CardGui::Render() renderer->DrawRect(actX - 10 * actZ, actY - (1 * actZ), 6.f,6.f,ARGB(180,10,10,10)); } } - if(!alternate && buff != "" && game->gameType() == GAME_TYPE_CLASSIC)//it seems that other game modes makes cards as tokens!!! hmmm... + if(!alternate && buff != "" && game && game->gameType() == GAME_TYPE_CLASSIC)//it seems that other game modes makes cards as tokens!!! hmmm... { mFont->SetScale(DEFAULT_MAIN_FONT_SCALE); char buffer[200]; @@ -501,7 +501,30 @@ void CardGui::Render() mFont->DrawString(buffer, actX - 10 * actZ, actY - (18.3f * actZ)); mFont->SetScale(1); } - +#if !defined (PSP) + if(game && game->gameType() == GAME_TYPE_MOMIR) + { + if(game->isInHand(card) && !card->controller()->isAI()) + { + if ((game->currentPlayer != card->controller()) || (card->controller()->game->playRestrictions->canPutIntoZone(card, card->controller()->game->inPlay) == PlayRestriction::CANT_PLAY)) + { + mFont->SetScale(0.4f); + mFont->SetColor(ARGB(static_cast(actA),255,0,0)); + mFont->SetScale(actZ); + mFont->DrawString("+", actX - 12 * actZ, actY - (18.8f * actZ)); + mFont->SetScale(1); + } + else + { + mFont->SetScale(0.4f); + mFont->SetColor(ARGB(static_cast(actA),0,255,0)); + mFont->SetScale(actZ); + mFont->DrawString("+", actX - 12 * actZ, actY - (18.8f * actZ)); + mFont->SetScale(1); + } + } + } +#endif if (card->counters->mCount > 0) { unsigned c = -1; diff --git a/projects/mtg/src/GameObserver.cpp b/projects/mtg/src/GameObserver.cpp index 7ba565a51..1d28642b5 100644 --- a/projects/mtg/src/GameObserver.cpp +++ b/projects/mtg/src/GameObserver.cpp @@ -712,6 +712,8 @@ void GameObserver::gameStateBasedEffects() for (int j = zone->nb_cards - 1; j >= 0; j--) { MTGCardInstance * card = zone->cards[j]; + //lastcontroller zone update + card->lastController = players[i]; card->entersBattlefield = 0; card->LKIpower = card->power; card->LKItoughness = card->toughness; diff --git a/projects/mtg/src/GuiPlay.cpp b/projects/mtg/src/GuiPlay.cpp index acc5cbb56..39015f586 100644 --- a/projects/mtg/src/GuiPlay.cpp +++ b/projects/mtg/src/GuiPlay.cpp @@ -338,7 +338,10 @@ void GuiPlay::Update(float dt) { battleField.Update(dt); for (iterator it = cards.begin(); it != cards.end(); ++it) - (*it)->Update(dt); + { + if((*it)) + (*it)->Update(dt); + } } int GuiPlay::receiveEventPlus(WEvent * e)