From e275a599b7422a296b01d97f8a4951e6e2b2b99a Mon Sep 17 00:00:00 2001 From: "omegablast2002@yahoo.com" Date: Tue, 10 May 2011 17:08:08 +0000 Subject: [PATCH] ok this may, or may not get me yelled at...but i can explain why i do it in rules...so don't kill me :( added "offerinterruptonphase=blah" to the parsing of the rules.txt files...the reason i want to handle it inside the rules.txt.... originally i was going to use the options variable for this, then i realized that if i use that variable, it would apply it to every game mode and peoples custom games...so instead i added the parsing in the actual rules.txt files, this way, if we want to offer interrupt on phase blah to MTG, but NOT have this interrupt offered in a mod or different mode, or if the different mod or mode should offer you a chance to interrupt ai in a different phase ...you can set each rule to interrupt in the phase you want... now for the reason i added it in the first place...previously we were allowed an interrupt when the opponent drew a card in the draw step, this gave us a chance to do stuff on opponents turn.... recently wololo i beleave made draw actions not use the stack anymore(which was a good change, since as per MTG rules the actions of drawing is not a stack action)...but as a side-effect, we lose our chance to interrupt ai and do stuff on ais turn.... also, changed the ingame bonus thing, to start recording stuff towards bonuses on turn 2+...this solves reported issues with story mode "setting up" causing massive bonuses to be gained for doing nothing..... --- projects/mtg/include/Player.h | 1 + projects/mtg/include/Rules.h | 1 + projects/mtg/src/GameObserver.cpp | 1 + projects/mtg/src/MTGRules.cpp | 2 ++ projects/mtg/src/Rules.cpp | 14 ++++++++++++++ 5 files changed, 19 insertions(+) diff --git a/projects/mtg/include/Player.h b/projects/mtg/include/Player.h index 4fa974570..38b99bdbe 100644 --- a/projects/mtg/include/Player.h +++ b/projects/mtg/include/Player.h @@ -35,6 +35,7 @@ public: string deckFileSmall; string deckName; string phaseRing; + int offerInterruptOnPhase; Player(string deckFile, string deckFileSmall, MTGDeck * deck = NULL); virtual ~Player(); diff --git a/projects/mtg/include/Rules.h b/projects/mtg/include/Rules.h index f463182ee..f2bd214cf 100644 --- a/projects/mtg/include/Rules.h +++ b/projects/mtg/include/Rules.h @@ -27,6 +27,7 @@ class RulesPlayerData public: vector extraRules; string phaseRing; + int offerInterruptOnPhase; int life; int poisonCount; int damageCount; diff --git a/projects/mtg/src/GameObserver.cpp b/projects/mtg/src/GameObserver.cpp index 5dc14398c..3e24d6017 100644 --- a/projects/mtg/src/GameObserver.cpp +++ b/projects/mtg/src/GameObserver.cpp @@ -208,6 +208,7 @@ void GameObserver::userRequestNextGamePhase() || (cPhaseOld->id == Constants::MTG_PHASE_COMBATDAMAGE) || opponent()->isAI() || options[Options::optionInterrupt(currentGamePhase)].number + || currentPlayer->offerInterruptOnPhase - 1 == currentGamePhase ) { mLayers->stackLayer()->AddNextGamePhase(); diff --git a/projects/mtg/src/MTGRules.cpp b/projects/mtg/src/MTGRules.cpp index 8dc2a4bec..de5859570 100644 --- a/projects/mtg/src/MTGRules.cpp +++ b/projects/mtg/src/MTGRules.cpp @@ -53,6 +53,8 @@ int MTGEventBonus::receiveEvent(WEvent * event) //bonus for chain chain casting without tapping for mana or being interupted; //note gaining mana from other sources is still possible. //only spells going to the stack are counted. + if(game->turn <2)//this shouldnt trigger on first turn, chances are they are cheating. + return 0; if (WEventCardTappedForMana* e = dynamic_cast(event)) { if(e) diff --git a/projects/mtg/src/Rules.cpp b/projects/mtg/src/Rules.cpp index 9a57e4dea..5815c1e00 100644 --- a/projects/mtg/src/Rules.cpp +++ b/projects/mtg/src/Rules.cpp @@ -189,6 +189,19 @@ void RulesState::parsePlayerState(int playerId, string s) playerData[playerId].phaseRing = s.substr(limiter + 1); return; } + else if (areaS.compare("offerinterruptonphase") == 0) + { + for (int i = 0; i < Constants::NB_MTG_PHASES; i++) + { + string phaseStr = Constants::MTGPhaseCodeNames[i]; + if (s.find(phaseStr) != string::npos) + { + playerData[playerId].offerInterruptOnPhase = PhaseRing::phaseStrToInt(phaseStr); + break; + } + + } + } else if (areaS.compare("auto") == 0) { playerData[playerId].extraRules.push_back(s.substr(limiter + 1)); @@ -394,6 +407,7 @@ Player * Rules::initPlayer(int playerId) } } p->phaseRing = initState.playerData[playerId].phaseRing; + p->offerInterruptOnPhase = initState.playerData[playerId].offerInterruptOnPhase; return p; }