Battledale_PRC8/_module/nss/jw_multiclass_te.nss
Jaysyn904 7b9e44ebbb Initial upload
Initial upload.  PRC8 has been added.  Module compiles, PRC's default AI & treasure scripts have been integrated.  Started work on top hak for SLA / Ability / Scripting modifications.
2024-03-11 23:44:08 -04:00

139 lines
2.6 KiB
Plaintext

int Multipen(object oPC)
{
int class1=GetClassByPosition(1,oPC);
int class2=GetClassByPosition(2,oPC);
int class3=GetClassByPosition(3,oPC);
int nLevel1=GetLevelByClass(class1,oPC);
int nLevel2=GetLevelByClass(class2,oPC);
int nLevel3=GetLevelByClass(class3,oPC);
int nRace=GetRacialType(oPC);
int nFavoured;
// favoured == 99 means any
int nProblem1=0;
int nProblem2=0;
int nProblem3=0;
int nHighest=1;
if (nLevel1>=Level2&&nLevel1>=nLevel3)
{
nHighest=1;
}
if (nLevel2>=nLevel1&&nLevel2>=nLevel3)
{
nHighest=2;
}
if (nLevel3>=nLevel1&&nLevel3>=nLevel2)
{
nHighest=3;
}
int nPenalty=0;
switch (nRace)
{
case 0: //RACIAL_TYPE_DWARF
nFavoured=CLASS_TYPE_FIGHTER;
break;
case 1: //RACIAL_TYPE_elf
nFavoured=CLASS_TYPE_WIZARD;
break;
case 2: //RACIAL_TYPE_gnome
nFavoured=CLASS_TYPE_WIZARD;
break;
case 3: //RACIAL_TYPE_halfling
nFavoured=CLASS_TYPE_ROGUE;
break;
case 4: //RACIAL_TYPE_halfelf
nFavoured=99;
break;
case 5: //RACIAL_TYPE_halforc
nFavoured=CLASS_TYPE_BARBARIAN;
break;
case 6: //RACIAL_TYPE_human
nFavoured=99;
break;
}
// for humans and half elves, make the favoured class the highest class
if (nFavoured==99)
{
switch (nHighest)
{
case 1:
nFavoured=nClass1;
break;
case 2:
nFavoured=nClass2;
break;
case 3:
nFavoured=nClass3;
break;
}
}
/// first of all, check to see if the classes are roughly equal
int nEqual=0;
// as long as nEqual==0, they are roughly level.
if ((nLevel1!=0&&nLevel2!=0) // has levels in both class 1 and 2
&& ((nLevel1-nLevel2>1)||(nLevel2-nLevel1>1)) //the difference between class 1 and 2 is more than 1
)
{
nEqual=1;
nproblem1=1;
}
if ((nLevel1!=0&&nLevel3!=0) // has levels in both class 1 and 3
&& ((nLevel1-nLevel3>1)||(nLevel3-nLevel1>1)) //the difference between class 1 and 3 is more than 1
)
{
nEqual=1;
nProblem2=1;
}
if ((nLevel2!=0&&nLevel3!=0) // has levels in both class 2 and 3
&& ((nLevel2-nLevel3>1)||(nLevel3-nLevel2>1)) //the difference between class 1 and 2 is more than 1
)
{
nEqual=1;
nProblem3=1;
}
// if there is no problem here, return zero
if (nEqual==0)
{
return nPenalty;
}
// classes are unequal but are any of the unequal classes favoured?
if (nProblem1=1&&((nClass1!=nFavoured)||(nClass2!=nFavoured)))
{
nPenalty=1;
}
if (nProblem2=1&&((nClass1!=nFavoured)||(nClass3!=nFavoured)))
{
nPenalty=1;
}
if (nProblem3=1&&((nClass2!=nFavoured)||(nClass3!=nFavoured)))
{
nPenalty=1;
}
return nPenalty;
}