GameObserver.cpp
Code: Select all
#include "Player.h"
Code: Select all
#include "Player.h"
ResetMullPen(); //Inserted right after game->startGame
if ((cardsinhand != 0) && ((game->turn < 2 && game->currentGamePhase == MTG_PHASE_FIRSTMAIN) || (game->turn < 2 && game->currentGamePhase == MTG_PHASE_UPKEEP)) && game->currentPlayer->game->inPlay->nb_cards == 0 && game->currentPlayer->game->graveyard->nb_cards == 0 && game->currentPlayer->game->exile->nb_cards == 0 && game->currentlyActing() == (Player*)game->currentPlayer) //Modified 1st Play Check
Code: Select all
int MullPen = 0;
void ResetMullPen()
{
for (int n = 7; n != 7 - MullPen; MullPen--); //Simple loop to bring MullPen back to 0
}
Changes to takeMulligan after Shuffle
for (int i = 0; i < (7 - MullPen); i++)
game->drawFromLibrary();
//Draw hand with less cards according to number of mulligans //almhum
MullPen++; //Increase Mulligan Penalty counter
Code: Select all
extern int MullPen;
void ResetMullPen();
I know that coding classes is better practice than global extern variables but I was going more for proof of concept than efficiency, having not coded for a decade. I've played through multiple games in a row taking various degrees of mulligans in each game and I haven't had an issue yet.
Ideally I'd like to change the mulligan process to a prompt before turn 1 regardless of who goes first, but my coding skills are rusty and I haven't figured out what functions you use for popups yet. I'll give the code another look tomorrow but I'm glad for what I accomplished today.