AOC_PRC8/_module/nss/score_calc.nss
Jaysyn904 5e558169a0 Initial Commit
Initial Commit
2025-04-03 11:24:16 -04:00

126 lines
3.4 KiB
Plaintext

#include "in_g_cutscene"
void RatingGet(object oPC)
{
int iAv;
float fPerc;
int iPerc;
int tScore;
int iSwing;
int iHit;
int iDam;
int iScore;
int iKilled;
int iDied;
int iRankNo;
string sRank;
string sTookOut;
string sDeaths;
int iDice;
int iAlign;
float fAvDeath;
int iAvDeath;
int iFs;
int iAlignment = GetAlignmentGoodEvil(oPC);
if (iAlignment == ALIGNMENT_EVIL){iAlign = 2;}
else {iAlign = 1;}
iDied = GetLocalInt (oPC,"iDied");
iKilled = GetLocalInt (oPC,"iKilled");
iDam = GetLocalInt(oPC, "player_dd");
iHit = GetLocalInt(oPC, "pc_hit");
iSwing = GetLocalInt(oPC, "pc_swing");
iScore = GetLocalInt(oPC, "a_score");
sRank = GetLocalString(oPC, "rank");
iRankNo = GetLocalInt(oPC, "status");
string sTitle;
if (GetGender(oPC)==GENDER_MALE){sTitle="Sir";}else{sTitle="Lady";}
// calculate final stats and score
if (iHit!=0){iAv = iDam / iHit; }
else {iAv = 0;}
if (iSwing!=0){fPerc = (IntToFloat(iHit) / IntToFloat(iSwing))*100;}
else {fPerc = 0.0;}
iPerc = FloatToInt(fPerc);
tScore = (iPerc * iAv);
if (tScore!=0){iScore+=tScore;}
else {iScore += 0;}
SetLocalInt(oPC, "a_score", iScore);
if (iPerc==0) { iFs=0;}
if ((iPerc>0)&&(iPerc<=10)) { iFs=1;}
if ((iPerc>10)&&(iPerc<=20)) { iFs=2;}
if ((iPerc>20)&&(iPerc<=30)) { iFs=3;}
if ((iPerc>30)&&(iPerc<=40)) { iFs=4;}
if ((iPerc>40)&&(iPerc<=65)) { iFs=5;}
if ((iPerc>65)&&(iPerc<=70)) { iFs=6;}
if ((iPerc>70)&&(iPerc<=75)) { iFs=7;}
if ((iPerc>75)&&(iPerc<=80)) { iFs=8;}
if ((iPerc>80)&&(iPerc<=85)) { iFs=9;}
if (iPerc>=85) { iFs=10;}
SetLocalInt(oPC, "final_attack", iFs);
int iFatt = iFs;
if (iDied==0) { iFs=10;}
if ((iDied>0)&&(iDied<=3)) { iFs=9;}
if ((iDied>3)&&(iDied<=5)) { iFs=8;}
if ((iDied>5)&&(iDied<=8)) { iFs=7;}
if ((iDied>8)&&(iDied<=12)) { iFs=6;}
if ((iDied>12)&&(iDied<=15)) { iFs=5;}
if ((iDied>15)&&(iDied<=18)) { iFs=4;}
if ((iDied>18)&&(iDied<=21)) { iFs=3;}
if ((iDied>21)&&(iDied<=25)) { iFs=2;}
if ((iDied>25)&&(iDied<=35)) { iFs=1;}
if (iDied>35) { iFs=0;}
SetLocalInt(oPC, "final_defense", iFs);
int iFdef = iFs;
if (iAv==0) { iFs=0;}
if ((iAv>20)&&(iAv<=40)) { iFs=1;}
if ((iAv>40)&&(iAv<=50)) { iFs=2;}
if ((iAv>50)&&(iAv<=60)) { iFs=3;}
if ((iAv>60)&&(iAv<=70)) { iFs=4;}
if ((iAv>70)&&(iAv<=80)) { iFs=5;}
if ((iAv>80)&&(iAv<=90)) { iFs=6;}
if ((iAv>90)&&(iAv<=100)) { iFs=7;}
if ((iAv>100)&&(iAv<=150)) { iFs=8;}
if ((iAv>150)&&(iAv<=200)) { iFs=9;}
if (iAv>200) { iFs=10;}
SetLocalInt(oPC, "final_damage", iFs);
int iFdam = iFs;
if (iScore<=2999) { iFs=0;}
if ((iScore>3000)&&(iScore<=5999)) { iFs=1;}
if ((iScore>6000)&&(iScore<=8999)) { iFs=2;}
if ((iScore>9000)&&(iScore<=11999)) { iFs=3;}
if ((iScore>12000)&&(iScore<=14999)) { iFs=4;}
if ((iScore>15000)&&(iScore<=17999)) { iFs=5;}
if ((iScore>18000)&&(iScore<=20999)) { iFs=6;}
if ((iScore>21000)&&(iScore<=23999)) { iFs=7;}
if ((iScore>24000)&&(iScore<=26999)) { iFs=8;}
if ((iScore>27000)&&(iScore<=34999)) { iFs=9;}
if (iScore>35000) { iFs=10;}
int iFcalc = iFdam+iFatt+iFdef;
int iFscore = (iFcalc*3)+iFs;
SetLocalInt(oPC, "aoc_rating", iFscore);
}
//void main() {}