Jaysyn904 09d0100931 Update for PRC8 function updates
Update for PRC8 function updates.  Full compile.  Updated release archive.
2025-02-13 12:36:58 -05:00

294 lines
6.1 KiB
Plaintext

#include "prc_inc_racial"
// returns TRUE if the PC qualifies for a multiclass penalty, FALSE if not
int Multipen(object oPC);
// Returns a float which can be more than 1 if the mob is higher level than the party, and less than
// 1 if it is lower level than the party. nDifference should be the difference between party level
// and mob CR
float getmodifier (int nDifference);
// Returns TRUE if the PC already has enough xp to take them to a level higher than they currently are
int PCHasExpToLevel(object oObject);
int Multipen(object oPC)
{
int nClass1=GetClassByPosition(1,oPC);
int nClass2=GetClassByPosition(2,oPC);
int nClass3=GetClassByPosition(3,oPC);
int nClass4=GetClassByPosition(4,oPC);
int nClass5=GetClassByPosition(5,oPC);
int nClass6=GetClassByPosition(6,oPC);
int nClass7=GetClassByPosition(7,oPC);
int nClass8=GetClassByPosition(8,oPC);
//::: Yeah, not doing this bullshit -Jaysyn
/* if ((nClass1==CLASS_TYPE_ARCANE_ARCHER)||(nClass1==CLASS_TYPE_ASSASSIN)|| (nClass1==CLASS_TYPE_BLACKGUARD)||(nClass1==CLASS_TYPE_HARPER)||(nClass1==CLASS_TYPE_SHADOWDANCER)||(nClass1==CLASS_TYPE_ANIMAL)||(nClass1==CLASS_TYPE_DIVINECHAMPION)||(nClass1==CLASS_TYPE_DRAGONDISCIPLE)||(nClass1==CLASS_TYPE_DWARVENDEFENDER)||(nClass1==CLASS_TYPE_PALEMASTER)||(nClass1==CLASS_TYPE_SHIFTER)||(nClass1==CLASS_TYPE_WEAPON_MASTER))
{
nClass1=CLASS_TYPE_INVALID;
}
if ((nClass2==CLASS_TYPE_ARCANE_ARCHER)||(nClass2==CLASS_TYPE_ASSASSIN)|| (nClass2==CLASS_TYPE_BLACKGUARD)||(nClass2==CLASS_TYPE_HARPER)||(nClass2==CLASS_TYPE_SHADOWDANCER)||(nClass2==CLASS_TYPE_ANIMAL)||(nClass2==CLASS_TYPE_DIVINECHAMPION)||(nClass2==CLASS_TYPE_DRAGONDISCIPLE)||(nClass2==CLASS_TYPE_DWARVENDEFENDER)||(nClass2==CLASS_TYPE_PALEMASTER)||(nClass2==CLASS_TYPE_SHIFTER)||(nClass2==CLASS_TYPE_WEAPON_MASTER))
{
nClass2=CLASS_TYPE_INVALID;
}
if ((nClass3==CLASS_TYPE_ARCANE_ARCHER)||(nClass3==CLASS_TYPE_ASSASSIN)|| (nClass3==CLASS_TYPE_BLACKGUARD)||(nClass3==CLASS_TYPE_HARPER)||(nClass3==CLASS_TYPE_SHADOWDANCER)||(nClass3==CLASS_TYPE_ANIMAL)||(nClass3==CLASS_TYPE_DIVINECHAMPION)||(nClass3==CLASS_TYPE_DRAGONDISCIPLE)||(nClass3==CLASS_TYPE_DWARVENDEFENDER)||(nClass3==CLASS_TYPE_PALEMASTER)||(nClass3==CLASS_TYPE_SHIFTER)||(nClass3==CLASS_TYPE_WEAPON_MASTER))
{
nClass3=CLASS_TYPE_INVALID;
}
*/
int nLevel1=GetLevelByClass(nClass1,oPC);
int nLevel2=GetLevelByClass(nClass2,oPC);
int nLevel3=GetLevelByClass(nClass3,oPC);
int nLevel4=GetLevelByClass(nClass4,oPC);
int nLevel5=GetLevelByClass(nClass5,oPC);
int nLevel6=GetLevelByClass(nClass6,oPC);
int nLevel7=GetLevelByClass(nClass7,oPC);
int nLevel8=GetLevelByClass(nClass8,oPC);
int nRace = GetRacialType(oPC);
int nFavoured;
// favoured == 99 means any
int nProblem1 = 0;
int nProblem2 = 0;
int nProblem3 = 0;
int nPenalty = 0;
if (nRace==RACIAL_TYPE_DWARF) //RACIAL_TYPE_DWARF
{nFavoured=CLASS_TYPE_FIGHTER;}
if (nRace==RACIAL_TYPE_ELF) //RACIAL_TYPE_elf
{nFavoured=CLASS_TYPE_WIZARD;}
if (nRace== RACIAL_TYPE_GNOME) //RACIAL_TYPE_gnome
{nFavoured=CLASS_TYPE_WIZARD;}
if (nRace==RACIAL_TYPE_HALFLING) //RACIAL_TYPE_halfling
{nFavoured=CLASS_TYPE_ROGUE;}
if (nRace== RACIAL_TYPE_HALFELF) //RACIAL_TYPE_halfelf
{nFavoured=99;}
if (nRace== RACIAL_TYPE_HALFORC) //RACIAL_TYPE_halforc
{nFavoured=CLASS_TYPE_BARBARIAN;}
if (nRace== RACIAL_TYPE_HUMAN) //RACIAL_TYPE_human
{nFavoured=99;}
if (nRace== RACIAL_TYPE_ANIMAL) //RACIAL_TYPE_animal
{nFavoured=99;}
/// 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 ((nClass1!=CLASS_TYPE_INVALID)&&(nClass2!=CLASS_TYPE_INVALID))
{
if ((nLevel1-nLevel2>1)||(nLevel2-nLevel1>1)) //the difference between class 1 and 2 is more than 1
{
nEqual=1;
nProblem1=1;
}
}
if ((nClass1!=CLASS_TYPE_INVALID)&&(nClass3!=CLASS_TYPE_INVALID))
{
if ((nLevel1-nLevel3>1)||(nLevel3-nLevel1>1)) //the difference between class 1 and 3 is more than 1
{
nEqual=1;
nProblem2=1;
}
}
if ((nClass2!=CLASS_TYPE_INVALID)&&(nClass3!=CLASS_TYPE_INVALID))
{
if ((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?
// do humans and half elves first
if (nFavoured==99)
{
if ((nProblem1==1)&&(nProblem2==1)&&(nProblem3==1))
{
return 1;
}
else
{
return 0;
}
}
// now do everyone else
if (nProblem1==1)
{
if ((nClass1!=nFavoured)&&(nClass2!=nFavoured))
{
nPenalty=1;
}
}
if (nProblem2==1)
{
if ((nClass1!=nFavoured)&&(nClass3!=nFavoured))
{
nPenalty=1;
}
}
if (nProblem3==1)
{
if ((nClass2!=nFavoured)&&(nClass3!=nFavoured))
{
nPenalty=1;
}
}
return nPenalty;
}
float getmodifier (int nDifference)
{
// works out the modified for xp, based on the difference between the player or average party level and
// the cr of the mob.
float fModifier;
if (nDifference <= -7)
{
fModifier=1.9;
}
if (nDifference == -6)
{
fModifier=1.6;
}
if (nDifference == -5)
{
fModifier=1.5;
}
if (nDifference == -4)
{
fModifier=1.4;
}
if (nDifference == -3)
{
fModifier=1.3;
}
if (nDifference == -2)
{
fModifier=1.2;
}
if (nDifference == -1)
{
fModifier=1.1;
}
if (nDifference == 0)
{
fModifier=1.0;
}
if (nDifference == 1)
{
fModifier=1.0;
}
if (nDifference == 2)
{
fModifier=0.9;
}
if (nDifference == 3)
{
fModifier=0.7;
}
if (nDifference == 4)
{
fModifier=0.4;
}
if (nDifference == 5)
{
fModifier=0.2;
}
if (nDifference == 6)
{
fModifier=0.1;
}
if (nDifference == 7)
{
fModifier=0.05;
}
if (nDifference == 8)
{
fModifier=0.03;
}
if (nDifference == 9)
{
fModifier=0.02;
}
if (nDifference >= 10)
{
fModifier=0.01;
}
return fModifier;
}
int PCHasExpToLevel(object oObject)
{
int nHD = GetHitDice(oObject)+1;
//xp needed to be level nHD
int nXPNeeded = ((nHD * (nHD - 1)) / 2) * 1000;
if (GetXP(oObject)>=nXPNeeded)
{
return TRUE;
}
return FALSE;
}