diff --git a/aatf.cpp b/aatf.cpp index 75b3c57..aa3eb69 100644 --- a/aatf.cpp +++ b/aatf.cpp @@ -3,7 +3,7 @@ #include "editor.h" #include "resource.h" #include "aatf.h" -#ifndef UNICODE +#ifndef UNICODE typedef std::string tstring; typedef std::stringstream tstringstream; #else @@ -39,88 +39,18 @@ struct skillCheck CF 12 0 */ int regPosToPlayPosMap[13] = { 12, 9, 10, 11, 5, 6, 7, 8, 4, 2, 3, 1, 0 }; -//============================ -//AATF Settings -int manletBonus = 5; -int silverManletBonus = 0; -int goldManletBonus = 0; -int silverGiantPen = 0; -int goldGiantPen = 0; - -int goldRate = 99; //Player skill ratings -int silverRate = 88; -int regRate = 77; -int gkRate = 74; - -int reqNumGold = 2; //Numbers of medals -int reqNumSilver = 3; - -int goldForm = 8; //possible range 1-8 -int silverForm = 8; -int regForm = 4; - -int goldIR = 3; //Injury resistence (possible range 1-3) -int silverIR = 3; -int regIR = 1; - -int goldWeakFootUse = 2; //Gold medal weak foot usage limit -int silverWeakFootUse = 2; -int regWeakFootUse = 2; - -int goldWeakFootAcc = 4; //Gold medal weak foot accuracy limit -int silverWeakFootAcc = 4; -int regWeakFootAcc = 2; - -int manletCardBonus = 1; //Manlets get 1 extra card -int manletWeakFootUse = 4; //Manlets get 4/4 weak foot usage/accuracy -int manletWeakFootAcc = 4; -int manletPosBonus = 1; //Manlets get 1 extra double A position - -int gkSkillCards = 2; //Skill cards -int regSkillCards = 3; -int silverSkillCards = 4; -int goldSkillCards = 5; - -int gkTrickCards = 0; //Trick cards -int regTrickCards = 2; -int silverTrickCards = 3; -int goldTrickCards = 3; - -int regCOM = 0; //COM playing styles -int silverCOM = 1; -int goldCOM = 2; - -int greenGiga = 0; //Green height bracket -int greenGiant = 5; -int greenTall = 6; -int greenMid = 6; -int greenManlet = 6; - -int redGiga = 0; //Red height bracket -int redGiant = 0; -int redTall = 10; -int redMid = 7; -int redManlet = 6; - -int heightGiga = 199; //Player heights in each category -int heightGiant = 194; -int heightTall = 185; -int heightTallGK = 189; -int heightMid = 180; -int heightManlet = 175; - - -void aatf_single(HWND hAatfbox, int pesVersion, int teamSel, player_entry* gplayers, team_entry* gteams, int gnum_players) +void aatf_single(HWND hAatfbox, int pesVersion, int teamSel, player_entry* gplayers, team_entry* gteams, int gnum_players, bool useSuggestions) { player_entry player; tstring msgOut; - msgOut+=_T("Team: "); - msgOut+=gteams[teamSel].name; - msgOut+=_T("\r\n"); + msgOut += _T("Team: "); + msgOut += gteams[teamSel].name; + msgOut += _T("\r\n"); //============================ bool hasCaptain = false; + bool captainHasCaptaincy = false; int numGK = 0; //Count of player ratings int numReg = 0; @@ -133,7 +63,6 @@ void aatf_single(HWND hAatfbox, int pesVersion, int teamSel, player_entry* gplay int numMid = 0; int numManlet = 0; bool usingRed = true; - bool eCheck = false; //Run through all players once to determine height system for (int ii = 0; ii < gteams[teamSel].num_on_team; ii++) @@ -154,65 +83,103 @@ void aatf_single(HWND hAatfbox, int pesVersion, int teamSel, player_entry* gplay break; } } - + //Now check each player for errors - int errorTot = 0; - for(int ii=0; ii 15) { rating = max(player.clearing, rating); rating = max(player.reflex, rating); rating = max(player.cover, rating); } - rating = max(player.body_ctrl, rating); - if (pesVersion > 16) rating = max(player.phys_cont, rating); //Not in 16 - rating = max(player.kick_pwr, rating); - rating = max(player.exp_pwr, rating); - rating = max(player.ball_ctrl, rating); - rating = max(player.ball_win, rating); - rating = max(player.jump, rating); - rating = max(player.place_kick, rating); - rating = max(player.stamina, rating); - rating = max(player.speed, rating); + rating = max(player.body_ctrl, rating); + if (pesVersion > 16) rating = max(player.phys_cont, rating); //Not in 16 + rating = max(player.kick_pwr, rating); + rating = max(player.exp_pwr, rating); + rating = max(player.ball_ctrl, rating); + rating = max(player.ball_win, rating); + rating = max(player.jump, rating); + rating = max(player.place_kick, rating); + rating = max(player.stamina, rating); + rating = max(player.speed, rating); if (pesVersion > 19) rating = max(player.aggres, rating); /*if(player.injury+1 > 3) { errorTot++; - errorMsg << _T("Injury resist is ") << player.injury+1 << _T(", cannot exceed 3; "); + errorMsg << _T("Injury resist is ") << player.injury+1 << _T(", cannot exceed 3; "); }*/ //Check if this player is the captain @@ -220,96 +187,53 @@ void aatf_single(HWND hAatfbox, int pesVersion, int teamSel, player_entry* gplay //Check if registered pos has playable set to A int requiredAPos = regPosToPlayPosMap[player.reg_pos]; - if(player.play_pos[requiredAPos] != 2) + if (player.play_pos[requiredAPos] != 2) { errorTot++; - errorMsg << _T("Doesn't have A in registered position; "); + errorMsg << _T("\tDoesn't have A in registered position;\r\n"); } - - //Count number of registered GKs - if(player.reg_pos == 0) numGK++; //Count A positions - int countA = 0; + int countA = 0; int countB = 0; - for(int jj=0;jj<13;jj++) - { - if(player.play_pos[jj] == 2) + for (int jj = 0; jj < 13; jj++) + { + if (player.play_pos[jj] == 2) countA++; else if (player.play_pos[jj] == 1) countB++; - } + } //No B positions allowed: - if(countB > 0) + if (countB > 0) { errorTot++; - errorMsg << _T("Has B position; "); + errorMsg << _T("\tHas B position;\r\n"); } - - //If more than 1 A, 1 card less for each - if(countA > 1) - { - if(player.play_pos[12] == 2) //Can't have GK as second A - { - errorTot++; - errorMsg << _T("Has GK as second A position; "); - } - cardMod -= (countA - 1); - } - - //Count cards - int numTrick = 0; - int numCom = 0; - int numSkill; - if(pesVersion==19) numSkill=39; - else if(pesVersion>19) numSkill=41; - else numSkill=28; - for(int jj=0;jj50) + if (player.age < 15 || player.age>50) { errorTot++; - errorMsg << _T("Age out of range (15,50); "); + errorMsg << _T("\tAge out of range (15,50);\r\n"); } - if(player.weight(player.height-81)) + if (player.weight(player.height - 81)) { errorTot++; - errorMsg << _T("Weight out of range (") << max(30,player.height-129) << _T(",") << player.height-81 << _T("); "); + errorMsg << _T("\tWeight out of range (") << max(30, player.height - 129) << _T(",") << player.height - 81 << _T(");\r\n"); } //Check playing style and registered position are in valid range per PES version - if (player.reg_pos > 12) + if (player.reg_pos > 12) { errorTot++; - errorMsg << _T("Registered position out of range (0-12); "); + errorMsg << _T("\tRegistered position out of range (0-12);\r\n"); } if (pesVersion <= 16) @@ -317,378 +241,401 @@ void aatf_single(HWND hAatfbox, int pesVersion, int teamSel, player_entry* gplay if (player.play_style > 18 || player.play_style == 16) { errorTot++; - errorMsg << _T("Playing style out of range (0-18, excluding 16); "); + errorMsg << _T("\tPlaying style out of range (0-18, excluding 16);\r\n"); } } else if (pesVersion > 16 && pesVersion < 19) { - if (player.play_style > 17) + if (player.play_style > 17) { errorTot++; - errorMsg << _T("Playing style out of range (0-17); "); + errorMsg << _T("\tPlaying style out of range (0-17);\r\n"); } } else { - if (player.play_style > 21) + if (player.play_style > 21) { errorTot++; - errorMsg << _T("Playing style out of range (0-21); "); + errorMsg << _T("\tPlaying style out of range (0-21);\r\n"); } } - + /* GOALKEEPER */ + if (player.reg_pos == 0) //Goalkeeper player, counts towards regular + { + numGK++; + numReg++; + using namespace goalkeeper; + + allowGreen = allow_green; + manletBuff = manlet_buff; + heightNerf = height_nerf; + + reqAPos = a_pos; + reqForm = form; + reqInjResist = injury_resistance; + weakFootUse = weak_foot_usage; + weakFootAcc = weak_foot_accuracy; + + reqSkill = skills; + reqTrick = tricks; + reqCom = coms; + + targetRate = base_stat; + targetDrib = dribbling; + targetGk = gk_awareness; + targetFinish = finishing; + targetLowPass = low_pass; + targetLoftPass = lofted_pass; + targetHeader = header; + targetSwerve = curl; + targetCatching = catching; + targetClearing = clearing; + targetReflex = reflexes; + targetBodyCtrl = balance; + targetPhysCont = physical_contact; + targetKickPwr = kicking_power; + targetExpPwr = acceleration; + targetBallCtrl = ball_control; + targetBallWin = ball_winning; + targetJump = jump; + targetCover = gk_reach; + targetPlcKick = place_kicking; + targetStamina = stamina; + targetSpeed = speed; + targetAtkProw = offensive_awareness; + targetDefProw = defensive_awareness; + targetTightPos = tight_possession; + targetAggres = aggression; + } /* REGULAR */ - if(rating < silverRate-silverGiantPen) //Regular player - { - numReg++; - targetRate = regRate; - targetRate2 = regRate; - targetRate3 = regRate; - if(player.reg_pos == 0) //GK target rate is 77 - { - targetRate = gkRate; - targetRate2 = gkRate; - targetRate3 = gkRate; - } - - weakFootUse = regWeakFootUse; - weakFootAcc = regWeakFootAcc; - - /*if(countA > 3) - { - errorTot++; - errorMsg << _T("Regular player with > 3 A positions; "); - }*/ - - /*//SPECIAL Summer 24: Malicia (21) is now mandatory on all non-medal players - if (!player.play_skill[21]) + else if (rating < (silver::base_stat - silver::height_nerf)) //Regular player + { + numReg++; + using namespace regular; + + allowGreen = allow_green; + manletBuff = manlet_buff; + heightNerf = height_nerf; + + reqAPos = a_pos; + reqForm = form; + reqInjResist = injury_resistance; + weakFootUse = weak_foot_usage; + weakFootAcc = weak_foot_accuracy; + + reqSkill = skills; + reqTrick = tricks; + reqCom = coms; + + targetRate = base_stat; + targetDrib = dribbling; + targetGk = gk_awareness; + targetFinish = finishing; + targetLowPass = low_pass; + targetLoftPass = lofted_pass; + targetHeader = header; + targetSwerve = curl; + targetCatching = catching; + targetClearing = clearing; + targetReflex = reflexes; + targetBodyCtrl = balance; + targetPhysCont = physical_contact; + targetKickPwr = kicking_power; + targetExpPwr = acceleration; + targetBallCtrl = ball_control; + targetBallWin = ball_winning; + targetJump = jump; + targetCover = gk_reach; + targetPlcKick = place_kicking; + targetStamina = stamina; + targetSpeed = speed; + targetAtkProw = offensive_awareness; + targetDefProw = defensive_awareness; + targetTightPos = tight_possession; + targetAggres = aggression; + } + /* SILVER */ + else if (rating < (gold::base_stat - gold::height_nerf)) //Silver player + { + numSilver++; + using namespace silver; + + allowGreen = allow_green; + manletBuff = manlet_buff; + heightNerf = height_nerf; + + reqAPos = a_pos; + reqForm = form; + reqInjResist = injury_resistance; + weakFootUse = weak_foot_usage; + weakFootAcc = weak_foot_accuracy; + + reqSkill = skills; + reqTrick = tricks; + reqCom = coms; + + targetRate = base_stat; + targetDrib = dribbling; + targetGk = gk_awareness; + targetFinish = finishing; + targetLowPass = low_pass; + targetLoftPass = lofted_pass; + targetHeader = header; + targetSwerve = curl; + targetCatching = catching; + targetClearing = clearing; + targetReflex = reflexes; + targetBodyCtrl = balance; + targetPhysCont = physical_contact; + targetKickPwr = kicking_power; + targetExpPwr = acceleration; + targetBallCtrl = ball_control; + targetBallWin = ball_winning; + targetJump = jump; + targetCover = gk_reach; + targetPlcKick = place_kicking; + targetStamina = stamina; + targetSpeed = speed; + targetAtkProw = offensive_awareness; + targetDefProw = defensive_awareness; + targetTightPos = tight_possession; + targetAggres = aggression; + + if (player.reg_pos == 0) //Medals can't be GK { errorTot++; - errorMsg << _T("Malicia card is mandatory for all non-medal players; "); - }*/ - - if(player.form+1 != regForm) - { - errorTot++; - errorMsg << _T("Form is ") << player.form+1 << _T(", should be ") << regForm << _T("; "); + errorMsg << _T("\tMedals cannot play as GK;\r\n"); } - - if(player.reg_pos == 0) //GK gets 2 cards - { - cardMod += min(gkTrickCards, numTrick); //1 free tricks - cardLimit = gkSkillCards + cardMod; - - if(player.height > heightMid && player.height < heightTallGK) - { - errorTot++; - errorMsg << _T("GKs in this bracket must be ") << heightTallGK << _T("cm; "); - } - //SPECIAL Autumn 24 - GK and medals can'ts be in giant height bracket - if (player.height >= heightGiant) - { - errorMsg << _T("GK heights cannot be ") << heightGiant << _T("cm; "); - } - } - else - { - cardMod += min(regCOM, numCom); //0 free COM styles - cardMod += min(regTrickCards, numTrick); //2 free tricks - //cardMod += min(1, (countA - 1)); //1 free A-position - cardLimit = regSkillCards + cardMod; //3 skill cards - } - - if(player.injury+1 > regIR) + } + /* GOLD */ + else if (rating == gold::base_stat || rating == (gold::base_stat - gold::height_nerf)) //Gold player + { + numGold++; + using namespace gold; + + allowGreen = allow_green; + manletBuff = manlet_buff; + heightNerf = height_nerf; + + reqAPos = a_pos; + reqForm = form; + reqInjResist = injury_resistance; + weakFootUse = weak_foot_usage; + weakFootAcc = weak_foot_accuracy; + + reqSkill = skills; + reqTrick = tricks; + reqCom = coms; + + targetRate = base_stat; + targetDrib = dribbling; + targetGk = gk_awareness; + targetFinish = finishing; + targetLowPass = low_pass; + targetLoftPass = lofted_pass; + targetHeader = header; + targetSwerve = curl; + targetCatching = catching; + targetClearing = clearing; + targetReflex = reflexes; + targetBodyCtrl = balance; + targetPhysCont = physical_contact; + targetKickPwr = kicking_power; + targetExpPwr = acceleration; + targetBallCtrl = ball_control; + targetBallWin = ball_winning; + targetJump = jump; + targetCover = gk_reach; + targetPlcKick = place_kicking; + targetStamina = stamina; + targetSpeed = speed; + targetAtkProw = offensive_awareness; + targetDefProw = defensive_awareness; + targetTightPos = tight_possession; + targetAggres = aggression; + + if (player.reg_pos == 0) //Medals can't be GK { errorTot++; - errorMsg << _T("Injury resist is ") << player.injury+1 << _T(", should be ") << regIR << _T("; "); - } - - if (player.height <= heightManlet && usingRed) - { - targetRate += manletBonus; - targetRate2 += manletBonus; - targetRate3 += manletBonus; + errorMsg << _T("\tMedals cannot play as GK;\r\n"); } + } + else + { + errorTot++; + errorMsg << _T("\tIllegal Ability scores;\r\n"); + //spit out whatever errors were already found, but target scores can't be set, so quit out of this player to avoid useless error outputs + msgOut += errorMsg.str(); + continue; + } - /*//SPECIAL Spring 24: non-medals that are registered in a blue position (CB, LB, RB) get +5 defensive prowess - if (player.reg_pos >= 1 && player.reg_pos <= 3) - { - targetRate2 += 5; - }*/ - - /*//SPECIAL Spring 24: red heights non-medals registered in a red position (CF/SS/LWF/RWF) receive a +5 boost to all stats and can stack with the boost from being 175cm however these players cannot be given a 2nd A position - if (player.reg_pos >= 9 && player.reg_pos <= 12 && usingRed) + //Count cards + int numSkill = 0; + int numTrick = 0; + int numCom = 0; + int cardCount; + if (pesVersion > 19) cardCount = 41; + else if (pesVersion == 19) cardCount = 39; + else cardCount = 28; + for (int jj = 0; jj < cardCount; jj++) + { + if (player.play_skill[jj]) { - targetRate += 5; - targetRate2 += 5; - //SPECIAL Summer 24: Red Position non-medal manlet players (CF/SS/LWF/RWF) have stamina stat = 77 - if (player.height <= heightManlet && usingRed) - targetRate3 = regRate; - else - targetRate3 += 5; - if (countA > 1) + //SPECIAL Winter/Spring 24: Malicia (21) is a free card + if (jj == 21) { - errorTot++; - errorMsg << _T("Illegal 2nd A position on red heights non-medal forward; "); + numSkill++; + reqSkill++; } - }*/ - - /*//SPECIAL Summer 24: green heights non-medals registered in a red position (CF/SS/LWF/RWF) get an additional 5cm of height except for 199cm players - if (player.reg_pos >= 9 && player.reg_pos <= 12 && !usingRed && player.height <= heightGiant) - { - heightMod = 5; - }*/ - - if (eCheck) - { - if (player.reg_pos == 0) + //Captain gets free captaincy card + else if (jj == 25 && player.id == gteams[teamSel].players[gteams[teamSel].captain_ind]) { - if (numTrick < gkTrickCards) errorMsg << _T("WARN: Has ") << numTrick << _T(" trick cards, allowed ") << gkTrickCards << _T("; "); - if (numCom < regCOM) errorMsg << _T("WARN: Has ") << numCom << _T(" COM cards, allowed ") << regCOM << _T("; "); + captainHasCaptaincy = true; + numSkill++; + reqSkill++; } - else + //Trick cards may be free, count number + else if ((jj < 6 || jj == 16 || jj == 28 || jj == 29 || jj == 30 || jj == 34) && numTrick < reqTrick) { - if (numTrick < regTrickCards) errorMsg << _T("WARN: Has ") << numTrick << _T(" trick cards, allowed ") << regTrickCards << _T("; "); - if (numCom < regCOM) errorMsg << _T("WARN: Has ") << numCom << _T(" COM cards, allowed ") << regCOM << _T("; "); + hasTrick = true; + numTrick++; } - if (player.injury + 1 < regIR) errorMsg << _T("WARN: Has inj resist") << player.injury + 1 << _T(", allowed ") << regIR << _T("; "); + else numSkill++; } } - /* SILVER */ - else if(rating < goldRate-goldGiantPen) //Silver player - { - numSilver++; - targetRate = silverRate; - targetRate2 = silverRate; - targetRate3 = silverRate; - - weakFootUse = silverWeakFootUse; - weakFootAcc = silverWeakFootAcc; - - if(numSilver > reqNumSilver) - { - errorTot++; - errorMsg << _T("Too many Silver medals; "); - } - if(player.form+1 != silverForm) - { - errorTot++; - errorMsg << _T("Form is ") << player.form+1 << _T(", should be ") << silverForm << _T("; "); - } - if(player.reg_pos == 0) //Medals can't be GK - { - errorTot++; - errorMsg << _T("Medals cannot play as GK; "); - } - if(player.height >= heightGiant) //HA get penalty - { - targetRate -= silverGiantPen; - targetRate2 -= silverGiantPen; - targetRate3 -= silverGiantPen; - } - else if(player.height <= heightManlet && usingRed) - { - targetRate += silverManletBonus; - targetRate2 += silverManletBonus; - targetRate3 += silverManletBonus; - } - cardMod += min(silverTrickCards, numTrick); //3 free tricks - cardMod += min(silverCOM, numCom); //1 free COM - //cardMod += min(1, (countA - 1)); //1 free A-position - cardLimit = silverSkillCards + cardMod; //4 skill cards - - if(player.injury+1 > silverIR) - { - errorTot++; - errorMsg << _T("Injury resist is ") << player.injury+1 << _T(", should be ") << silverIR << _T("; "); - } - - if (eCheck) - { - if (numTrick < silverTrickCards) errorMsg << _T("WARN: Has ") << numTrick << _T(" trick cards, allowed ") << silverTrickCards << _T("; "); - if (numCom < silverCOM) errorMsg << _T("WARN: Has ") << numCom << _T(" COM cards, allowed ") << silverCOM << _T("; "); - if (player.injury + 1 < silverIR) errorMsg << _T("WARN: Has inj resist") << player.injury + 1 << _T(", allowed ") << silverIR << _T("; "); - } - - //SPECIAL FAG13: Medals can trade a card for 4/4 footedness - /*if (player.weak_use + 1 > weakFootUse) - { - weakFootUse = 4; - cardLimit--; - }*/ - } - /* GOLD */ - else //rating == 99 //Gold player - { - numGold++; - targetRate = goldRate; - targetRate2 = goldRate; - targetRate3 = goldRate; - weakFootUse = goldWeakFootUse; - weakFootAcc = goldWeakFootAcc; - - if(numGold > reqNumGold) - { - errorTot++; - errorMsg << _T("Too many Gold medals; "); - } - if(player.form+1 != goldForm) - { - errorTot++; - errorMsg << _T("Form is ") << player.form+1 << _T(", should be ") << goldForm << _T("; "); - } - if(player.reg_pos == 0) //Medals can't be GK - { - errorTot++; - errorMsg << _T("Medals cannot play as GK; "); - } - if(player.height >= heightGiant) //Medal HA penalty - { - targetRate -= goldGiantPen; - targetRate2 -= goldGiantPen; - targetRate3 -= goldGiantPen; - } - else if(player.height <= heightManlet && usingRed) - { - targetRate += goldManletBonus; - targetRate2 += goldManletBonus; - targetRate3 += goldManletBonus; - } - - if (player.height > heightGiant) - { - errorMsg << _T("Gold heights cannot exceed ") << heightGiant << _T("cm; "); - } - - cardMod += min(goldTrickCards, numTrick); //4 free tricks - cardMod += min(goldCOM, numCom); //2 free COMs - cardLimit = goldSkillCards + cardMod; //5 skill cards - - if(player.injury+1 > goldIR) - { - errorTot++; - errorMsg << _T("Injury resist is ") << player.injury+1 << _T(", should be ") << goldIR << _T("; "); - } - - if (eCheck) + for (int jj = 0; jj < 7; jj++) + { + if (player.com_style[jj]) { - if (cardCount < 10) + if (numCom < reqCom) numCom++; + else { - if (numTrick < goldTrickCards) errorMsg << _T("WARN: Has ") << numTrick << _T(" trick cards, allowed ") << goldTrickCards << _T("; "); - if (numCom < goldCOM) errorMsg << _T("WARN: Has ") << numCom << _T(" COM cards, allowed ") << goldCOM << _T("; "); + numSkill++; + extraCom++; } - if (player.injury + 1 < goldIR) errorMsg << _T("WARN: Has inj resist") << player.injury + 1 << _T(", allowed ") << goldIR << _T("; "); } - - //SPECIAL Spring 25 - GK and gold medals can't be in giant height bracket - if (player.height >= heightGiant) - { - errorMsg << _T("Gold medal heights cannot be ") << heightGiant << _T("cm; "); - } - - //SPECIAL FAG13: Medals can trade a card for 4/4 footedness - /*if (player.weak_use + 1 > weakFootUse) - { - weakFootUse = 4; - cardLimit--; - }*/ } //Check player height - if ( ((player.height - heightMod) <= heightManlet) ) + if (((player.height - heightMod) <= heightManlet)) { numManlet++; - cardLimit += manletCardBonus; //Manlets get a bonus card - if (countA > 1) cardLimit += manletPosBonus; //Manlets get a bonus double A position + reqSkill += manletCardBonus; //Manlets get a bonus card + reqAPos++; //Manlets get a bonus double A position weakFootUse = manletWeakFootUse; //Manlets get weak foot acc/use 4/4 weakFootAcc = manletWeakFootAcc; } - else if ((player.height - heightMod) <= heightMid) + else if ((player.height - heightMod) <= heightMid) numMid++; + else if ((player.height - heightMod) == heightTall) numTall++; + else if ((player.height - heightMod) == heightTallGK && player.reg_pos == 0) numTall++; //GK + else if ((player.height - heightMod) == heightGiant) numGiant++; + else if ((player.height - heightMod) == heightGiga) numGiga++; + else { - numMid++; + errorTot++; + errorMsg << _T("\tIllegal height (") << player.height << _T(" cm);\r\n"); } - else if ((player.height - heightMod) == heightTall) - numTall++; - else if ((player.height - heightMod) == heightTallGK && player.reg_pos == 0) //GK - numTall++; - else if ((player.height - heightMod) == heightGiant) - numGiant++; - else if ((player.height - heightMod) == heightGiga) - numGiga++; - else + + if (player.height >= heightGiant) //HA get penalty + { + if (!allowGreen) + { + errorTot++; + errorMsg << _T("\tThis player cannot be ") << heightGiant << _T("cm tall;\r\n"); + } + else { + targetRate -= heightNerf; + statMod -= heightNerf; + } + } + else if (player.height <= heightManlet && usingRed) + { + targetRate += manletBuff; + statMod += manletBuff; + } + + if (player.form + 1 != reqForm) { errorTot++; - errorMsg << _T("Illegal height (") << player.height << _T(" cm); "); + errorMsg << _T("\tForm is ") << player.form + 1 << _T(", should be ") << reqForm << _T(";\r\n"); + } + + //Check injury resistance + if (player.injury + 1 > reqInjResist) + { + errorTot++; + errorMsg << _T("\tInjury resist is ") << player.injury + 1 << _T(", should be ") << reqInjResist << _T(";\r\n"); } //Check weak foot ratings if (player.weak_use + 1 > weakFootUse) { errorTot++; - errorMsg << _T("Weak foot usage > ") << weakFootUse << _T("; "); + errorMsg << _T("\tWeak foot usage > ") << weakFootUse << _T(";\r\n"); } if (player.weak_acc + 1 > weakFootAcc) { errorTot++; - errorMsg << _T("Weak foot accuracy > ") << weakFootAcc << _T("; "); + errorMsg << _T("\tWeak foot accuracy > ") << weakFootAcc << _T(";\r\n"); } + //If more than allowed A positions, 1 card less for each + if (countA > reqAPos) reqSkill -= (countA - reqAPos); + //Check player card count - if (cardCount > cardLimit) + if (numSkill > reqSkill) { errorTot++; - errorMsg << _T("Has ") << cardCount << _T(" cards, only allowed ") << cardLimit << _T("; "); + errorMsg << _T("\tHas ") << numSkill << _T(" skill cards, only allowed ") << reqSkill << _T(";\r\n"); } //Check PES skill card limit of 10 - if(cardCount-numCom > 10) - { - errorTot++; - errorMsg << _T("Has ") << cardCount-numCom << _T(" skill cards, PES limit is 10, please swap to COM cards or trade for additional A positions; "); - } - - if (eCheck) + if ((numSkill - extraCom) + numTrick > 10) { - if (cardCount < min(cardLimit,10)) errorMsg << _T("WARN: Has ") << cardCount << _T(" cards, allowed ") << cardLimit << _T("; "); - if (player.weak_use + 1 < weakFootUse) errorMsg << _T("WARN: Has weak usage ") << player.weak_use + 1 << _T(", allowed ") << weakFootUse << _T("; "); - if (player.weak_acc + 1 < weakFootAcc) errorMsg << _T("WARN: Has weak accuracy ") << player.weak_acc + 1 << _T(", allowed ") << weakFootAcc << _T("; "); + errorTot++; + errorMsg << _T("\tHas ") << numSkill + numTrick << _T(" cards, PES limit is 10, please swap to COM cards or trade for additional A positions;\r\n"); } - //Check player overall rating - if (rating != targetRate) + if (useSuggestions) { - errorTot++; - errorMsg << _T("Illegal Ability scores; "); + if (numSkill < reqSkill && numSkill + numTrick < 10) errorMsg << _T("\tWARN: Has ") << numSkill << _T(" skill cards, allowed ") << reqSkill << _T(";\r\n"); + if (numTrick < reqTrick && numSkill + numTrick < 10) errorMsg << _T("\tWARN: Has ") << numTrick << _T(" trick cards, allowed ") << reqTrick << _T(";\r\n"); + if (numCom < reqCom) errorMsg << _T("\tWARN: Has ") << numCom << _T(" COM cards, allowed ") << reqCom << _T(";\r\n"); + if (countA < reqAPos) errorMsg << _T("\tWARN; Has ") << countA << _T(" A positions, allowed ") << reqAPos << _T(";\r\n"); + if (player.injury + 1 < reqInjResist) errorMsg << _T("\tWARN: Has inj resist") << player.injury + 1 << _T(", allowed ") << reqInjResist << _T(";\r\n"); + if (player.weak_use + 1 < weakFootUse) errorMsg << _T("\tWARN: Has weak usage ") << player.weak_use + 1 << _T(", allowed ") << weakFootUse << _T(";\r\n"); + if (player.weak_acc + 1 < weakFootAcc) errorMsg << _T("\tWARN: Has weak accuracy ") << player.weak_acc + 1 << _T(", allowed ") << weakFootAcc << _T(";\r\n"); } //Check individual skill ratings // c_skillRate s_skillName n_minPesVersion n_targetRate - skillCheck skillChecks[25] = { {player.drib, _T("Dribbling"), 0, targetRate }, - {player.gk, _T("Goalkeeping"), 0, targetRate }, - {player.finish, _T("Finishing"), 0, targetRate }, - {player.lowpass, _T("Low Pass"), 0, targetRate }, - {player.loftpass, _T("Lofted Pass"), 0, targetRate }, - {player.header, _T("Header"), 0, targetRate }, - {player.swerve, _T("Swerve"), 0, targetRate }, - {player.catching, _T("Catching"), 0, targetRate }, - {player.clearing, _T("Clearing"), 16, targetRate }, - {player.reflex, _T("Reflexes"), 16, targetRate }, - {player.body_ctrl, _T("Body Control"), 0, targetRate }, - {player.phys_cont, _T("Physical Contact"), 17, targetRate }, - {player.kick_pwr, _T("Kicking Power"), 0, targetRate }, - {player.exp_pwr, _T("Explosive Power"), 0, targetRate }, - {player.ball_ctrl, _T("Ball Control"), 0, targetRate }, - {player.ball_win, _T("Ball Winning"), 0, targetRate }, - {player.jump, _T("Jump"), 0, targetRate }, - {player.cover, _T("Coverage"), 16, targetRate }, - {player.place_kick, _T("Place Kicking"), 0, targetRate }, - {player.stamina, _T("Stamina"), 0, targetRate3 }, - {player.speed, _T("Speed"), 0, targetRate }, - {player.atk, _T("Attacking Prowess"), 0, targetRate }, - {player.def, _T("Defensive Prowess"), 0, targetRate2 }, - {player.tight_pos, _T("Tight Possession"), 20, targetRate }, - {player.aggres, _T("Aggression"), 20, targetRate } }; + skillCheck skillChecks[25] = { {player.drib, _T("Dribbling"), 0, (targetDrib == 0) ? targetRate : (targetDrib + statMod) }, + {player.gk, _T("Goalkeeping"), 0, (targetGk == 0) ? targetRate : (targetGk + statMod) }, + {player.finish, _T("Finishing"), 0, (targetFinish == 0) ? targetRate : (targetFinish + statMod) }, + {player.lowpass, _T("Low Pass"), 0, (targetLowPass == 0) ? targetRate : (targetLowPass + statMod) }, + {player.loftpass, _T("Lofted Pass"), 0, (targetLoftPass == 0) ? targetRate : (targetLoftPass + statMod) }, + {player.header, _T("Header"), 0, (targetHeader == 0) ? targetRate : (targetHeader + statMod) }, + {player.swerve, _T("Swerve"), 0, (targetSwerve == 0) ? targetRate : (targetSwerve + statMod) }, + {player.catching, _T("Catching"), 0, (targetCatching == 0) ? targetRate : (targetCatching + statMod) }, + {player.clearing, _T("Clearing"), 16, (targetClearing == 0) ? targetRate : (targetClearing + statMod) }, + {player.reflex, _T("Reflexes"), 16, (targetReflex == 0) ? targetRate : (targetReflex + statMod) }, + {player.body_ctrl, _T("Body Control"), 0, (targetBodyCtrl == 0) ? targetRate : (targetBodyCtrl + statMod) }, + {player.phys_cont, _T("Physical Contact"), 17, (targetPhysCont == 0) ? targetRate : (targetPhysCont + statMod) }, + {player.kick_pwr, _T("Kicking Power"), 0, (targetKickPwr == 0) ? targetRate : (targetKickPwr + statMod) }, + {player.exp_pwr, _T("Explosive Power"), 0, (targetExpPwr == 0) ? targetRate : (targetExpPwr + statMod) }, + {player.ball_ctrl, _T("Ball Control"), 0, (targetBallCtrl == 0) ? targetRate : (targetBallCtrl + statMod) }, + {player.ball_win, _T("Ball Winning"), 0, (targetBallWin == 0) ? targetRate : (targetBallWin + statMod) }, + {player.jump, _T("Jump"), 0, (targetJump == 0) ? targetRate : (targetJump + statMod) }, + {player.cover, _T("Coverage"), 16, (targetCover == 0) ? targetRate : (targetCover + statMod) }, + {player.place_kick, _T("Place Kicking"), 0, (targetPlcKick == 0) ? targetRate : (targetPlcKick + statMod) }, + {player.stamina, _T("Stamina"), 0, (targetStamina == 0) ? targetRate : (targetStamina + statMod) }, + {player.speed, _T("Speed"), 0, (targetSpeed == 0) ? targetRate : (targetSpeed + statMod) }, + {player.atk, _T("Attacking Prowess"), 0, (targetAtkProw == 0) ? targetRate : (targetAtkProw + statMod) }, + {player.def, _T("Defensive Prowess"), 0, (targetDefProw == 0) ? targetRate : (targetDefProw + statMod) }, + {player.tight_pos, _T("Tight Possession"), 20, (targetTightPos == 0) ? targetRate : (targetTightPos + statMod) }, + {player.aggres, _T("Aggression"), 20, (targetAggres == 0) ? targetRate : (targetAggres + statMod) } }; for (int ii = 0; ii < 25; ii++) { @@ -698,23 +645,18 @@ void aatf_single(HWND hAatfbox, int pesVersion, int teamSel, player_entry* gplay if (skillChecks[ii].n_minPesVersion <= pesVersion && skillChecks[ii].c_skillRate > skillChecks[ii].n_targetRate) { errorTot++; - errorMsg << skillChecks[ii].s_skillName << _T(" is ") << skillChecks[ii].c_skillRate << _T(", should be <= ") << skillChecks[ii].n_targetRate << _T("; "); + errorMsg << _T("\t") << skillChecks[ii].s_skillName << _T(" is ") << skillChecks[ii].c_skillRate << _T(", should be <= ") << skillChecks[ii].n_targetRate << _T(";\r\n"); } } - else if (skillChecks[ii].n_minPesVersion <= pesVersion && - skillChecks[ii].c_skillRate != skillChecks[ii].n_targetRate) + else if (skillChecks[ii].n_minPesVersion <= pesVersion && + skillChecks[ii].c_skillRate != skillChecks[ii].n_targetRate) { errorTot++; - errorMsg << skillChecks[ii].s_skillName << _T(" is ") << skillChecks[ii].c_skillRate << _T(", should be ") << skillChecks[ii].n_targetRate << _T("; "); + errorMsg << _T("\t") << skillChecks[ii].s_skillName << _T(" is ") << skillChecks[ii].c_skillRate << _T(", should be ") << skillChecks[ii].n_targetRate << _T(";\r\n"); } } - if(errorMsg.rdbuf()->in_avail()) - { - errorMsg << _T("\r\n"); - msgOut+=_T("\t"); - msgOut+=errorMsg.str(); - } + if (errorMsg.rdbuf()->in_avail()) msgOut += errorMsg.str(); } //Team level errors int diff; @@ -723,163 +665,114 @@ void aatf_single(HWND hAatfbox, int pesVersion, int teamSel, player_entry* gplay if (!hasCaptain) { errorTot++; - errorMsg << _T("Team must have an assigned Captain; "); + errorMsg << _T("\tTeam must have an assigned Captain;\r\n"); } + if (!captainHasCaptaincy && useSuggestions) errorMsg << _T("\tWARN: Captain does not have the free Captaincy card;\r\n"); + //Must have at least 1 GK if (numGK < 1) { errorTot++; - errorMsg << _T("Team must have a registered GK; "); + errorMsg << _T("\tTeam must have a registered GK;\r\n"); } - //Check heights - if(!usingRed) //Using Green height system - { - msgOut+=_T("Using Green height system\r\n"); + //Check heights + if (!usingRed) //Using Green height system + { + msgOut += _T("Using Green height system\r\n"); if (diff = greenGiga - numGiga) { - if (diff > 0) - { - errorTot += diff; - } - else - { - errorTot -= diff; - } - errorMsg << _T("Has ") << numGiga << _T("/") << greenGiga << _T(" ") << heightGiga << _T("cm players; "); - } - if(diff = greenGiant - numGiant) - { - if(diff>0) - { - errorTot += diff; - } - else - { - errorTot -= diff; - } - errorMsg << _T("Has ") << numGiant << _T("/") << greenGiant << _T(" ") << heightGiant << _T("cm players; "); - } - if(diff = greenTall - numTall) - { - if(diff>0) - { - errorTot += diff; - } - else - { - errorTot -= diff; - } - errorMsg << _T("Has ") << numTall << _T("/") << greenTall << _T(" ") << heightTall << _T("/") << heightTallGK << _T("cm players; "); - } - if(diff = greenMid - numMid) - { - if(diff>0) - { - errorTot += diff; - } - else - { - errorTot -= diff; - } - errorMsg << _T("Has ") << numMid << _T("/") << greenMid << _T(" ") << heightMid << _T("cm players; "); - } - if(diff = greenManlet - numManlet) - { - if(diff>0) - { - errorTot += diff; - } - else - { - errorTot -= diff; - } - errorMsg << _T("Has ") << numManlet << _T("/") << greenManlet << _T(" ") << heightManlet << _T("cm players; "); - } - } - else //Using Red height system - { - msgOut+=_T("Using Red height system\r\n"); + if (diff > 0) errorTot += diff; + else errorTot -= diff; + errorMsg << _T("\tHas ") << numGiga << _T("/") << greenGiga << _T(" ") << heightGiga << _T("cm players;\r\n"); + } + if (diff = greenGiant - numGiant) + { + if (diff > 0) errorTot += diff; + else errorTot -= diff; + errorMsg << _T("\tHas ") << numGiant << _T("/") << greenGiant << _T(" ") << heightGiant << _T("cm players;\r\n"); + } + if (diff = greenTall - numTall) + { + if (diff > 0) errorTot += diff; + else errorTot -= diff; + errorMsg << _T("\tHas ") << numTall << _T("/") << greenTall << _T(" ") << heightTall << _T("/") << heightTallGK << _T("cm players;\r\n"); + } + if (diff = greenMid - numMid) + { + if (diff > 0) errorTot += diff; + else errorTot -= diff; + errorMsg << _T("\tHas ") << numMid << _T("/") << greenMid << _T(" ") << heightMid << _T("cm players;\r\n"); + } + if (diff = greenManlet - numManlet) + { + if (diff > 0) errorTot += diff; + else errorTot -= diff; + errorMsg << _T("\tHas ") << numManlet << _T("/") << greenManlet << _T(" ") << heightManlet << _T("cm players;\r\n"); + } + } + else //Using Red height system + { + msgOut += _T("Using Red height system\r\n"); if (diff = numGiga) { errorTot += diff; - errorMsg << _T("Has ") << numGiga << _T("/") << redGiga << _T(" ") << heightGiga << _T("cm players; "); - } - if(diff = numGiant) - { - errorTot += diff; - errorMsg << _T("Has ") << numGiant << _T("/") << redGiant << _T(" ") << heightGiant << _T("cm players; "); - } - if(diff = redTall - numTall) - { - if(diff>0) - { - errorTot += diff; - } - else - { - errorTot -= diff; - } - errorMsg << _T("Has ") << numTall << _T("/") << redTall << _T(" ") << heightTall << _T("/") << heightTallGK << _T("cm players; "); - } - if(diff = redMid - numMid) - { - if(diff>0) - { - errorTot += diff; - } - else - { - errorTot -= diff; - } - errorMsg << _T("Has ") << numMid << _T("/") << redMid << _T(" ") << heightMid << _T("cm players; "); - } - if(diff = redManlet - numManlet) - { - if(diff>0) - { - errorTot += diff; - } - else - { - errorTot -= diff; - } - errorMsg << _T("Has ") << numManlet << _T("/") << redManlet << _T(" ") << heightManlet << _T("cm players; "); - } - } - if(errorMsg.rdbuf()->in_avail()) + errorMsg << _T("\tHas ") << numGiga << _T("/") << redGiga << _T(" ") << heightGiga << _T("cm players;\r\n"); + } + if (diff = numGiant) + { + errorTot += diff; + errorMsg << _T("\tHas ") << numGiant << _T("/") << redGiant << _T(" ") << heightGiant << _T("cm players;\r\n"); + } + if (diff = redTall - numTall) + { + if (diff > 0) errorTot += diff; + else errorTot -= diff; + errorMsg << _T("\tHas ") << numTall << _T("/") << redTall << _T(" ") << heightTall << _T("/") << heightTallGK << _T("cm players;\r\n"); + } + if (diff = redMid - numMid) + { + if (diff > 0) errorTot += diff; + else errorTot -= diff; + errorMsg << _T("\tHas ") << numMid << _T("/") << redMid << _T(" ") << heightMid << _T("cm players;\r\n"); + } + if (diff = redManlet - numManlet) + { + if (diff > 0) errorTot += diff; + else errorTot -= diff; + errorMsg << _T("\tHas ") << numManlet << _T("/") << redManlet << _T(" ") << heightManlet << _T("cm players;\r\n"); + } + } + if (errorMsg.rdbuf()->in_avail()) { errorMsg << _T("\r\n"); - msgOut+=errorMsg.str(); + msgOut += errorMsg.str(); errorMsg.clear(); errorMsg.str(tstring()); } - - //Check ability stats - if(numReg != (23-reqNumSilver-reqNumGold)) - { - errorTot++; - errorMsg << _T("Number of Regular players is ") << numReg << _T(", should be ") << 23-reqNumSilver-reqNumGold << _T("; "); - } - if(numSilver != reqNumSilver) - { - errorTot++; - errorMsg << _T("Number of Silver medals is ") << numSilver << _T(", should be ") << reqNumSilver << _T("; "); - } - if(numGold != reqNumGold) - { - errorTot++; - errorMsg << _T("Number of Gold medals is ") << numGold << _T(", should be ") << reqNumGold << _T("; "); - } - if(errorMsg.rdbuf()->in_avail()) - errorMsg << _T("\r\n"); + + //Check ability stats + if (numReg != regular::count) + { + errorTot++; + errorMsg << _T("\tNumber of Regular players is ") << numReg << _T(", should be ") << regular::count << _T(";\r\n"); + } + if (numSilver != silver::count) + { + errorTot++; + errorMsg << _T("\tNumber of Silver medals is ") << numSilver << _T(", should be ") << silver::count << _T(";\r\n"); + } + if (numGold != gold::count) + { + errorTot++; + errorMsg << _T("\tNumber of Gold medals is ") << numGold << _T(", should be ") << gold::count << _T(";\r\n"); + } + if (errorMsg.rdbuf()->in_avail()) errorMsg << _T("\r\n"); errorMsg << _T("\r\nErrors: ") << errorTot << _T("\r\n"); - msgOut+=errorMsg.str(); + msgOut += errorMsg.str(); SetWindowText(GetDlgItem(hAatfbox, IDT_AATFOUT), msgOut.c_str()); - if(errorTot) - SendDlgItemMessage(hAatfbox, IDB_AATFOK, WM_SETTEXT, 0, (LPARAM) _T("Alright, get their clothes")); - else - SendDlgItemMessage(hAatfbox, IDB_AATFOK, WM_SETTEXT, 0, (LPARAM) _T("GO TEAM EXPORT!")); + if(errorTot) SendDlgItemMessage(hAatfbox, IDB_AATFOK, WM_SETTEXT, 0, (LPARAM) _T("Alright, get their clothes")); + else SendDlgItemMessage(hAatfbox, IDB_AATFOK, WM_SETTEXT, 0, (LPARAM) _T("GO TEAM EXPORT!")); } diff --git a/aatf.h b/aatf.h index 95521c9..0431fad 100755 --- a/aatf.h +++ b/aatf.h @@ -1,65 +1,254 @@ #pragma once -//============================ -//Settings -extern int manletBonus; -extern int silverManletBonus; -extern int goldManletBonus; -extern int silverGiantPen; -extern int goldGiantPen; +//this file is meant to make updating the editor for stat changes exceedingly simple. +//stats use pes21 names +//stats that are listed as 0 will be replaced with the base_stat value in the editor. -extern int goldRate; -extern int silverRate; -extern int regRate; -extern int gkRate; -extern int reqNumGold; -extern int reqNumSilver; +//AATF Settings +const int manletCardBonus = 1; //Manlets get 1 extra card +const int manletWeakFootUse = 4; //Manlets get 4/4 weak foot usage/accuracy +const int manletWeakFootAcc = 4; +const int manletPosBonus = 1; //Manlets get 1 extra double A position -extern int goldForm; -extern int silverForm; -extern int regForm; +const int greenGiga = 0; //Green height bracket +const int greenGiant = 5; +const int greenTall = 6; +const int greenMid = 6; +const int greenManlet = 6; -extern int goldIR; //Injury resistence -extern int silverIR; -extern int regIR; +const int redGiga = 0; //Red height bracket +const int redGiant = 0; +const int redTall = 10; +const int redMid = 7; +const int redManlet = 6; -extern int goldWeakFootUse; -extern int silverWeakFootUse; -extern int regWeakFootUse; +const int heightGiga = 199; //Player heights in each category +const int heightGiant = 194; +const int heightTall = 185; +const int heightTallGK = 189; +const int heightMid = 180; +const int heightManlet = 175; -extern int goldWeakFootAcc; -extern int silverWeakFootAcc; -extern int regWeakFootAcc; +namespace gold { //gold stats + const int count = 2; //number of this type of player allowed + const int form = 8; + const int injury_resistance = 3; + const int weak_foot_usage = 2; + const int weak_foot_accuracy = 4; + const int skills = 5; //max number of non free skills allowed + const int tricks = 3; //max number of trick cards allowed + const int coms = 2; //free coms allowed + const int a_pos = 1; //free a positions allowed, note this includes the A position that a registered position gives -extern int gkSkillCards; -extern int regSkillCards; -extern int silverSkillCards; -extern int goldSkillCards; + const int base_stat = 99; //base stat value used if no changes. if a stat below is set at 0, this value will be used. + const int manlet_buff = 0; //if running red bracket, buff by this amount + const bool allow_green = false; //if it can use height abuse + const int height_nerf = 0; //if running green bracket, nerf by this amount + const int offensive_awareness = 0; + const int ball_control = 0; + const int dribbling = 0; + const int low_pass = 0; + const int lofted_pass = 0; + const int finishing = 0; + const int place_kicking = 0; + const int curl = 0; + const int header = 0; + const int defensive_awareness = 0; + const int ball_winning = 0; + const int kicking_power = 0; + const int speed = 0; + const int acceleration = 0; + const int balance = 0; + const int physical_contact = 0; + const int jump = 0; + const int stamina = 0; + const int gk_awareness = 0; + const int catching = 0; + const int clearing = 0; + const int reflexes = 0; + const int gk_reach = 0; + const int tight_possession = 0; + const int aggression = 0; + const int stat_array[] = { offensive_awareness, ball_control, dribbling, low_pass, lofted_pass, finishing, place_kicking, curl, header, defensive_awareness, + ball_winning, kicking_power, speed, acceleration, balance, physical_contact, jump, stamina, gk_awareness, catching, clearing, reflexes, gk_reach, + tight_possession, aggression }; -extern int gkTrickCards; -extern int regTrickCards; -extern int silverTrickCards; -extern int goldTrickCards; +} +namespace silver { //silver stats + const int count = 3; //number of this type of player allowed + const int form = 8; + const int injury_resistance = 3; + const int weak_foot_usage = 2; + const int weak_foot_accuracy = 4; + const int skills = 4; //max number of non free skills allowed + const int tricks = 3; //max number of trick cards allowed + const int coms = 1; //free coms allowed + const int a_pos = 1; //free a positions allowed, note this includes the A position that a registered position gives -extern int regCOM; -extern int silverCOM; -extern int goldCOM; + const int base_stat = 88; //base stat value used if no changes. if a stat below is set at 0, this value will be used. + const int manlet_buff = 0; //if running red bracket, buff by this amount + const bool allow_green = true; //if it can use height abuse + const int height_nerf = 0; //if running green bracket, nerf by this amount + const int offensive_awareness = 0; + const int ball_control = 0; + const int dribbling = 0; + const int low_pass = 0; + const int lofted_pass = 0; + const int finishing = 0; + const int place_kicking = 0; + const int curl = 0; + const int header = 0; + const int defensive_awareness = 0; + const int ball_winning = 0; + const int kicking_power = 0; + const int speed = 0; + const int acceleration = 0; + const int balance = 0; + const int physical_contact = 0; + const int jump = 0; + const int stamina = 0; + const int gk_awareness = 0; + const int catching = 0; + const int clearing = 0; + const int reflexes = 0; + const int gk_reach = 0; + const int tight_possession = 0; + const int aggression = 0; + const int stat_array[] = { offensive_awareness, ball_control, dribbling, low_pass, lofted_pass, finishing, place_kicking, curl, header, defensive_awareness, + ball_winning, kicking_power, speed, acceleration, balance, physical_contact, jump, stamina, gk_awareness, catching, clearing, reflexes, gk_reach, + tight_possession, aggression }; +} +namespace regular { //regular player stats + const int count = 18; //number of this type of player allowed + const int form = 4; + const int injury_resistance = 1; + const int weak_foot_usage = 2; + const int weak_foot_accuracy = 4; + const int skills = 3; //max number of non free skills allowed + const int tricks = 2; //max number of trick cards allowed + const int coms = 0; //free coms allowed + const int a_pos = 1; //free a positions allowed, note this includes the A position that a registered position gives -extern int greenGiga; -extern int greenGiant; -extern int greenTall; -extern int greenMid; -extern int greenManlet; + const int base_stat = 77; //base stat value used if no changes. if a stat below is set at 0, this value will be used. + const int manlet_buff = 5; //if running red bracket, buff by this amount + const bool allow_green = true; //if it can use height abuse + const int height_nerf = 0; //if running green bracket, nerf by this amount + const int offensive_awareness = 0; + const int ball_control = 0; + const int dribbling = 0; + const int low_pass = 0; + const int lofted_pass = 0; + const int finishing = 0; + const int place_kicking = 0; + const int curl = 0; + const int header = 0; + const int defensive_awareness = 0; + const int ball_winning = 0; + const int kicking_power = 0; + const int speed = 0; + const int acceleration = 0; + const int balance = 0; + const int physical_contact = 0; + const int jump = 0; + const int stamina = 0; + const int gk_awareness = 0; + const int catching = 0; + const int clearing = 0; + const int reflexes = 0; + const int gk_reach = 0; + const int tight_possession = 0; + const int aggression = 0; + const int stat_array[] = { offensive_awareness, ball_control, dribbling, low_pass, lofted_pass, finishing, place_kicking, curl, header, defensive_awareness, + ball_winning, kicking_power, speed, acceleration, balance, physical_contact, jump, stamina, gk_awareness, catching, clearing, reflexes, gk_reach, + tight_possession, aggression }; +} +namespace goalkeeper { + const int count = 1; //it counts against regulars, it doesn't matter + const int form = 4; + const int injury_resistance = 1; + const int weak_foot_usage = 2; + const int weak_foot_accuracy = 4; + const int skills = 2; //max number of non free skills allowed + const int tricks = 0; //max number of trick cards allowed + const int coms = 0; //free coms allowed + const int a_pos = 1; //free a positions allowed, note this includes the A position that a registered position gives -extern int redGiga; -extern int redGiant; -extern int redTall; -extern int redMid; -extern int redManlet; + const int base_stat = 74; //base stat value used if no changes. if a stat below is set at 0, this value will be used. + const int manlet_buff = 5; //if running red bracket, buff by this amount + const bool allow_green = false; //if it can use height abuse + const int height_nerf = 0; //if running green bracket, nerf by this amount + const int offensive_awareness = 0; + const int ball_control = 0; + const int dribbling = 0; + const int low_pass = 0; + const int lofted_pass = 0; + const int finishing = 0; + const int place_kicking = 0; + const int curl = 0; + const int header = 0; + const int defensive_awareness = 0; + const int ball_winning = 0; + const int kicking_power = 0; + const int speed = 0; + const int acceleration = 0; + const int balance = 0; + const int physical_contact = 0; + const int jump = 0; + const int stamina = 0; + const int gk_awareness = 0; + const int catching = 0; + const int clearing = 0; + const int reflexes = 0; + const int gk_reach = 0; + const int tight_possession = 0; + const int aggression = 0; + const int stat_array[] = { offensive_awareness, ball_control, dribbling, low_pass, lofted_pass, finishing, place_kicking, curl, header, defensive_awareness, + ball_winning, kicking_power, speed, acceleration, balance, physical_contact, jump, stamina, gk_awareness, catching, clearing, reflexes, gk_reach, + tight_possession, aggression }; -extern int heightGiga; -extern int heightGiant; -extern int heightTall; -extern int heightTallGK; -extern int heightMid; -extern int heightManlet; +} +/* +namespace blank_example { //has all stats 0'd out for easier removal of stat changes + const int count = 0; //number of this type of player allowed + const int form = 0; + const int injury_resistance = 0; + const int weak_foot_usage = 0; + const int weak_foot_accuracy = 0; + const int skills = 0; //max number of non free skills allowed + const int tricks = 0; //max number of trick cards allowed + const int coms = 0; //free coms allowed + const int a_pos = 0; //free a positions allowed, note this includes the A position that a registered position gives + const int base_stat = 0; //base stat value used if no changes. if a stat below is set at 0, this value will be used. + const int manlet_buff = 5; //if running red bracket, buff by this amount + const bool allow_green = true; //if it can use height abuse + const int height_nerf = 0; //if running green bracket, nerf by this amount + const int offensive_awareness = 0; + const int ball_control = 0; + const int dribbling = 0; + const int low_pass = 0; + const int lofted_pass = 0; + const int finishing = 0; + const int place_kicking = 0; + const int curl = 0; + const int header = 0; + const int defensive_awareness = 0; + const int ball_winning = 0; + const int kicking_power = 0; + const int speed = 0; + const int acceleration = 0; + const int balance = 0; + const int physical_contact = 0; + const int jump = 0; + const int stamina = 0; + const int gk_awareness = 0; + const int catching = 0; + const int clearing = 0; + const int reflexes = 0; + const int gk_reach = 0; + const int tight_possession = 0; + const int aggression = 0; + const int stat_array[] = { offensive_awareness, ball_control, dribbling, low_pass, lofted_pass, finishing, place_kicking, curl, header, defensive_awareness, + ball_winning, kicking_power, speed, acceleration, balance, physical_contact, jump, stamina, gk_awareness, catching, clearing, reflexes, gk_reach, + tight_possession, aggression }; +} +*/ \ No newline at end of file diff --git a/editor.h b/editor.h index 2121287..578960a 100644 --- a/editor.h +++ b/editor.h @@ -737,7 +737,7 @@ void extract_team_info21(team_entry, int&, void*); void extract_teamplayer_info20(team_entry, int &, void*); void extract_team_tactics20(team_entry, int &, void*); -void aatf_single(HWND, int, int, player_entry*, team_entry*, int); +void aatf_single(HWND, int, int, player_entry*, team_entry*, int, bool); void save_comparator(HWND, int, player_entry*, int, team_entry*, int, TCHAR*, void*); diff --git a/main.cpp b/main.cpp index 889681e..6871296 100644 --- a/main.cpp +++ b/main.cpp @@ -103,6 +103,7 @@ int gnum_players, gnum_teams, gn_listsel=-1, gn_teamsel=-1, gn_forceupdate=-1; bool gb_forceupdate = false; bool gb_firstsave = true; bool gb_importStats = true, gb_importAes = true; //Squad import options +bool useSuggestions = false; int gn_oldysize = 642; int g_prevx=0; int giPesVersion = 0; @@ -889,21 +890,23 @@ LRESULT CALLBACK wnd_proc(HWND H, UINT M, WPARAM W, LPARAM L) { if(HIWORD(W)==BN_CLICKED) { - _itow_s(goldRate, buffer, 3, 10); - for(int ii=IDT_ABIL_ATKP;ii= heightGiant) statmod = height_nerf; - _itow_s(goldIR, buffer, 3, 10); - SendDlgItemMessage(ghw_tab1, IDT_ABIL_INJU, WM_SETTEXT, 0, (LPARAM)buffer); - - _itow_s(goldWeakFootUse, buffer, 3, 10); - SendDlgItemMessage(ghw_tab1, IDT_ABIL_WKUS, WM_SETTEXT, 0, (LPARAM)buffer); + for (ii = IDT_ABIL_ATKP; ii < gi_lastAbility; ii += 2) + { + if (stat_array[(ii - IDT_ABIL_ATKP) / 2] == 0) //stat is not changed from base stat value + SendDlgItemMessage(ghw_tab1, ii, WM_SETTEXT, 0, (LPARAM)std::to_wstring(base_stat - statmod).c_str()); + else //stat is changed + SendDlgItemMessage(ghw_tab1, ii, WM_SETTEXT, 0, (LPARAM)std::to_wstring(stat_array[(ii - IDT_ABIL_ATKP) / 2] - statmod).c_str()); + } - _itow_s(goldWeakFootAcc, buffer, 3, 10); - SendDlgItemMessage(ghw_tab1, IDT_ABIL_WKAC, WM_SETTEXT, 0, (LPARAM)buffer); + SendDlgItemMessage(ghw_tab1, IDT_ABIL_FORM, WM_SETTEXT, 0, (LPARAM)std::to_wstring(form).c_str()); + SendDlgItemMessage(ghw_tab1, IDT_ABIL_INJU, WM_SETTEXT, 0, (LPARAM)std::to_wstring(injury_resistance).c_str()); + SendDlgItemMessage(ghw_tab1, IDT_ABIL_WKUS, WM_SETTEXT, 0, (LPARAM)std::to_wstring(weak_foot_usage).c_str()); + SendDlgItemMessage(ghw_tab1, IDT_ABIL_WKAC, WM_SETTEXT, 0, (LPARAM)std::to_wstring(weak_foot_accuracy).c_str()); } } break; @@ -911,21 +914,45 @@ LRESULT CALLBACK wnd_proc(HWND H, UINT M, WPARAM W, LPARAM L) { if(HIWORD(W)==BN_CLICKED) { - _itow_s(silverRate, buffer, 3, 10); - for (int ii = IDT_ABIL_ATKP; ii < gi_lastAbility; ii += 2) - SendDlgItemMessage(ghw_tab1, ii, WM_SETTEXT, 0, (LPARAM)buffer); + using namespace silver; //use silver stats only + int ii; + int statmod = 0; + if (gplayers[gn_playind[gn_listsel]].height >= heightGiant) statmod = height_nerf; - _itow_s(silverForm, buffer, 3, 10); - SendDlgItemMessage(ghw_tab1, IDT_ABIL_FORM, WM_SETTEXT, 0, (LPARAM)buffer); + for (ii = IDT_ABIL_ATKP; ii < gi_lastAbility; ii += 2) + { + if (stat_array[(ii - IDT_ABIL_ATKP) / 2] == 0) //stat is not changed from base stat value + SendDlgItemMessage(ghw_tab1, ii, WM_SETTEXT, 0, (LPARAM)std::to_wstring(base_stat - statmod).c_str()); + else //stat is changed + SendDlgItemMessage(ghw_tab1, ii, WM_SETTEXT, 0, (LPARAM)std::to_wstring(stat_array[(ii - IDT_ABIL_ATKP) / 2] - statmod).c_str()); + } - _itow_s(silverIR, buffer, 3, 10); - SendDlgItemMessage(ghw_tab1, IDT_ABIL_INJU, WM_SETTEXT, 0, (LPARAM)buffer); + SendDlgItemMessage(ghw_tab1, IDT_ABIL_FORM, WM_SETTEXT, 0, (LPARAM)std::to_wstring(form).c_str()); + SendDlgItemMessage(ghw_tab1, IDT_ABIL_INJU, WM_SETTEXT, 0, (LPARAM)std::to_wstring(injury_resistance).c_str()); + SendDlgItemMessage(ghw_tab1, IDT_ABIL_WKUS, WM_SETTEXT, 0, (LPARAM)std::to_wstring(weak_foot_usage).c_str()); + SendDlgItemMessage(ghw_tab1, IDT_ABIL_WKAC, WM_SETTEXT, 0, (LPARAM)std::to_wstring(weak_foot_accuracy).c_str()); + } + } + break; + case IDB_MAKE_BUFF: + { + if (HIWORD(W) == BN_CLICKED) + { + using namespace regular; //use regular stats only + int ii; - _itow_s(silverWeakFootUse, buffer, 3, 10); - SendDlgItemMessage(ghw_tab1, IDT_ABIL_WKUS, WM_SETTEXT, 0, (LPARAM)buffer); + for (ii = IDT_ABIL_ATKP; ii < gi_lastAbility; ii += 2) + { + if (stat_array[(ii - IDT_ABIL_ATKP) / 2] == 0) //stat is not changed from base stat value + SendDlgItemMessage(ghw_tab1, ii, WM_SETTEXT, 0, (LPARAM)std::to_wstring(base_stat + manlet_buff).c_str()); + else //stat is changed + SendDlgItemMessage(ghw_tab1, ii, WM_SETTEXT, 0, (LPARAM)std::to_wstring(stat_array[(ii - IDT_ABIL_ATKP) / 2] + manlet_buff).c_str()); + } - _itow_s(silverWeakFootAcc, buffer, 3, 10); - SendDlgItemMessage(ghw_tab1, IDT_ABIL_WKAC, WM_SETTEXT, 0, (LPARAM)buffer); + SendDlgItemMessage(ghw_tab1, IDT_ABIL_FORM, WM_SETTEXT, 0, (LPARAM)std::to_wstring(form).c_str()); + SendDlgItemMessage(ghw_tab1, IDT_ABIL_INJU, WM_SETTEXT, 0, (LPARAM)std::to_wstring(injury_resistance).c_str()); + SendDlgItemMessage(ghw_tab1, IDT_ABIL_WKUS, WM_SETTEXT, 0, (LPARAM)std::to_wstring(manletWeakFootUse).c_str()); + SendDlgItemMessage(ghw_tab1, IDT_ABIL_WKAC, WM_SETTEXT, 0, (LPARAM)std::to_wstring(manletWeakFootAcc).c_str()); } } break; @@ -933,24 +960,23 @@ LRESULT CALLBACK wnd_proc(HWND H, UINT M, WPARAM W, LPARAM L) { if(HIWORD(W)==BN_CLICKED) { - //if(ii==IDT_ABIL_DEFP || ii==IDT_ABIL_BWIN || ii==IDT_ABIL_EXPL) //Nerf Defensive Prowess, Ball winning and Explosive power to 72 - // SendDlgItemMessage(ghw_tab1, ii, WM_SETTEXT, 0, (LPARAM)_T("77")); - - _itow_s(regRate, buffer, 3, 10); - for (int ii = IDT_ABIL_ATKP; ii < gi_lastAbility; ii += 2) - SendDlgItemMessage(ghw_tab1, ii, WM_SETTEXT, 0, (LPARAM)buffer); - - _itow_s(regForm, buffer, 3, 10); - SendDlgItemMessage(ghw_tab1, IDT_ABIL_FORM, WM_SETTEXT, 0, (LPARAM)buffer); - - _itow_s(regIR, buffer, 3, 10); - SendDlgItemMessage(ghw_tab1, IDT_ABIL_INJU, WM_SETTEXT, 0, (LPARAM)buffer); + using namespace regular; //use regular stats only + int ii; + int statmod = 0; + if (gplayers[gn_playind[gn_listsel]].height >= heightGiant) statmod = height_nerf; - _itow_s(regWeakFootUse, buffer, 3, 10); - SendDlgItemMessage(ghw_tab1, IDT_ABIL_WKUS, WM_SETTEXT, 0, (LPARAM)buffer); + for (ii = IDT_ABIL_ATKP; ii < gi_lastAbility; ii += 2) + { + if (stat_array[(ii - IDT_ABIL_ATKP) / 2] == 0) //stat is not changed from base stat value + SendDlgItemMessage(ghw_tab1, ii, WM_SETTEXT, 0, (LPARAM)std::to_wstring(base_stat - statmod).c_str()); + else //stat is changed + SendDlgItemMessage(ghw_tab1, ii, WM_SETTEXT, 0, (LPARAM)std::to_wstring(stat_array[(ii - IDT_ABIL_ATKP) / 2] - statmod).c_str()); + } - _itow_s(regWeakFootAcc, buffer, 3, 10); - SendDlgItemMessage(ghw_tab1, IDT_ABIL_WKAC, WM_SETTEXT, 0, (LPARAM)buffer); + SendDlgItemMessage(ghw_tab1, IDT_ABIL_FORM, WM_SETTEXT, 0, (LPARAM)std::to_wstring(form).c_str()); + SendDlgItemMessage(ghw_tab1, IDT_ABIL_INJU, WM_SETTEXT, 0, (LPARAM)std::to_wstring(injury_resistance).c_str()); + SendDlgItemMessage(ghw_tab1, IDT_ABIL_WKUS, WM_SETTEXT, 0, (LPARAM)std::to_wstring(weak_foot_usage).c_str()); + SendDlgItemMessage(ghw_tab1, IDT_ABIL_WKAC, WM_SETTEXT, 0, (LPARAM)std::to_wstring(weak_foot_accuracy).c_str()); } } break; @@ -972,17 +998,41 @@ LRESULT CALLBACK wnd_proc(HWND H, UINT M, WPARAM W, LPARAM L) { if(gn_teamsel > -1) { + useSuggestions = false; update_tables(); ShowWindow(ghAatfbox, SW_SHOW); - aatf_single(ghAatfbox, giPesVersion, gn_teamsel, gplayers, gteams, gnum_players); + aatf_single(ghAatfbox, giPesVersion, gn_teamsel, gplayers, gteams, gnum_players, useSuggestions); } else MessageBox(H,_T("Please select a team to check."),NULL,MB_ICONWARNING); } break; + case IDM_DATA_AATFC_SUG: //Run AATF on currently-selected team and show results in a dialog box + { + if (gn_teamsel > -1) + { + useSuggestions = true; + update_tables(); + ShowWindow(ghAatfbox, SW_SHOW); + aatf_single(ghAatfbox, giPesVersion, gn_teamsel, gplayers, gteams, gnum_players, useSuggestions); + } + else MessageBox(H, _T("Please select a team to check."), NULL, MB_ICONWARNING); + } + break; case IDM_DATA_AATFS: //Run AATF on teams selected from a list { if(ghdescriptor) { + useSuggestions = false; + update_tables(); + DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_AATF_SEL), H, aatf_sel_dlg_proc); + } + } + break; + case IDM_DATA_AATFS_SUG: //Run AATF on teams selected from a list + { + if (ghdescriptor) + { + useSuggestions = true; update_tables(); DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_AATF_SEL), H, aatf_sel_dlg_proc); } @@ -5679,7 +5729,7 @@ BOOL CALLBACK aatf_mult_dlg_proc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM { case WM_INITDIALOG: { - aatf_single(hwnd, giPesVersion, lParam, gplayers, gteams, gnum_players); + aatf_single(hwnd, giPesVersion, lParam, gplayers, gteams, gnum_players, useSuggestions); SetFocus(GetDlgItem(hwnd,IDB_AATFOK)); } break; diff --git a/resource.h b/resource.h index 2683633..025fc05 100644 --- a/resource.h +++ b/resource.h @@ -53,8 +53,9 @@ #define IDC_TEAM_LIST 1104 #define IDB_MAKE_GOLD 1105 #define IDB_MAKE_SILV 1106 -#define IDB_MAKE_REGU 1107 -#define IDC_STATIC_G1 1108 +#define IDB_MAKE_BUFF 1107 +#define IDB_MAKE_REGU 1108 +#define IDC_STATIC_G1 1109 #define IDD_BASIC 1110 #define IDC_STATIC_B1 1111 @@ -426,9 +427,11 @@ #define IDD_AATF 2000 #define IDT_AATFOUT 2001 #define IDM_DATA_AATFC 2002 -#define IDM_DATA_AATFS 2003 -#define IDB_AATFOK 2004 -#define IDM_DATA_COMPE 2005 +#define IDM_DATA_AATFC_SUG 2003 +#define IDM_DATA_AATFS 2004 +#define IDM_DATA_AATFS_SUG 2005 +#define IDB_AATFOK 2006 +#define IDM_DATA_COMPE 2007 #define IDD_AATF_SEL 2100 #define IDC_AATF_SEL 2101 diff --git a/resource.rc b/resource.rc index ddcb46e..0e397a6 100644 --- a/resource.rc +++ b/resource.rc @@ -60,7 +60,9 @@ BEGIN POPUP "&AATF" BEGIN MENUITEM "&Current Team", IDM_DATA_AATFC - MENUITEM "&Select Teams", IDM_DATA_AATFS //, GRAYED + MENUITEM "&Current Team w/ suggestions", IDM_DATA_AATFC_SUG + MENUITEM "&Select Teams", IDM_DATA_AATFS + MENUITEM "&Select Teams w/ suggestions", IDM_DATA_AATFS_SUG MENUITEM "Compare &EDITs", IDM_DATA_COMPE END MENUITEM "&Output rosters to TSV", IDM_DATA_OUTPUT diff --git a/window.cpp b/window.cpp index f63207d..9ba3db2 100644 --- a/window.cpp +++ b/window.cpp @@ -48,14 +48,19 @@ void setup_main(HWND H) 20, 552, 250, 26, H, (HMENU)IDB_MAKE_SILV, GetModuleHandle(NULL), NULL); setup_control(hw_new, ghFont, scale_cntl_proc); - hw_new = CreateWindowEx(0, _T("Button"), _T("Make Regular"), + hw_new = CreateWindowEx(0, _T("Button"), _T("Make Buff"), + BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, + 20, 584, 65, 26, H, (HMENU)IDB_MAKE_BUFF, GetModuleHandle(NULL), NULL); + setup_control(hw_new, ghFont, scale_cntl_proc); + + hw_new = CreateWindowEx(0, _T("Button"), _T("Make Reg"), BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, - 20, 584, 110, 26, H, (HMENU)IDB_MAKE_REGU, GetModuleHandle(NULL), NULL); + 95, 584, 65, 26, H, (HMENU)IDB_MAKE_REGU, GetModuleHandle(NULL), NULL); setup_control(hw_new, ghFont, scale_cntl_proc); - hw_new = CreateWindowEx(0, _T("Button"), _T("Set Stats to:"), + hw_new = CreateWindowEx(0, _T("Button"), _T("Set Stats"), BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, - 140, 584, 80, 26, H, (HMENU)IDB_SET_STATS, GetModuleHandle(NULL), NULL); + 170, 584, 50, 26, H, (HMENU)IDB_SET_STATS, GetModuleHandle(NULL), NULL); setup_control(hw_new, ghFont, scale_cntl_proc); hw_new = CreateWindowEx(WS_EX_CLIENTEDGE, _T("EDIT"), _T(""),