215 lines
4.6 KiB
Plaintext
215 lines
4.6 KiB
Plaintext
/*69_leadership
|
|
Leadership Library Functions
|
|
Created by: 69MEH69
|
|
Created on: Sep2004
|
|
*/
|
|
//void main(){}
|
|
|
|
//Level of PC when Leadership begins
|
|
const int LEADERSHIP_LEVEL = 1;
|
|
|
|
//Returns Loyalty modifier
|
|
int GetHenchLoyalty(object oHench, object oPC);
|
|
//Returns TRUE if PC has Leadership (must be level 6 or higher)
|
|
int GetHasLeadership(object oPC);
|
|
//Returns Leadership Score
|
|
int GetLeadershipScore(object oPC);
|
|
//Sets maximum number of henchmen based on Leadership
|
|
void SetMaxHenchmen69(object oPC);
|
|
//Returns maximum number of henchmen based on Leadership
|
|
int GetMaxHenchmen69(object oPC);
|
|
|
|
int GetHenchLoyalty(object oHench, object oPC)
|
|
{
|
|
int nCharisma = GetAbilityModifier(ABILITY_CHARISMA, oPC);
|
|
//Initial roll + charisma
|
|
int nLoyalty = d6(3) + nCharisma;
|
|
string sLoyalty;
|
|
//Test
|
|
//sLoyalty = IntToString(nLoyalty);
|
|
//SendMessageToPC(oPC, "nLoyalty = " + sLoyalty);
|
|
|
|
int nHenchAlign = GetAlignmentGoodEvil(oHench);
|
|
int nPCAlign = GetAlignmentGoodEvil(oPC);
|
|
int nHenchDeath = GetLocalInt(oPC, "Hench_Death");
|
|
//Adjustment for alignments
|
|
if(nHenchAlign == nPCAlign)
|
|
{
|
|
++nLoyalty;
|
|
}
|
|
else
|
|
{
|
|
--nLoyalty;
|
|
}
|
|
//Test
|
|
//sLoyalty = IntToString(nLoyalty);
|
|
//SendMessageToPC(oPC, "nLoyalty - Alignment = " + sLoyalty);
|
|
|
|
//Adjustment for number of dead henchmen
|
|
nLoyalty = nLoyalty - nHenchDeath;
|
|
//Test
|
|
sLoyalty = IntToString(nLoyalty);
|
|
//SendMessageToPC(oPC, "nLoyalty - nHenchDeath = " + sLoyalty);
|
|
SendMessageToPC(oPC, "Loyalty score = " + sLoyalty);
|
|
return nLoyalty;
|
|
}
|
|
|
|
int GetHasLeadership(object oPC)
|
|
{
|
|
int nLeadership = GetHitDice(oPC);
|
|
if(nLeadership >= LEADERSHIP_LEVEL)
|
|
{
|
|
//SendMessageToPC(oPC, "Leadership is True"); //Test
|
|
return TRUE;
|
|
}
|
|
else
|
|
{
|
|
//SendMessageToPC(oPC, "Leadership is False"); //Test
|
|
return FALSE;
|
|
}
|
|
}
|
|
|
|
int GetLeadershipScore(object oPC)
|
|
{
|
|
int nPCLevel = GetHitDice(oPC);
|
|
int nCharisma = GetAbilityModifier(ABILITY_CHARISMA, oPC);
|
|
int nPersuade = GetSkillRank(SKILL_PERSUADE, oPC);
|
|
int nLeadershipScore = nPCLevel + nCharisma;
|
|
//Test
|
|
//string sCharisma = IntToString(nCharisma);
|
|
//SendMessageToPC(oPC, "Charisma score = " + sCharisma);
|
|
//string sPersuade = IntToString(nPersuade);
|
|
//SendMessageToPC(oPC, "Persuade score = " + sPersuade);
|
|
string sLeadershipScore = IntToString(nLeadershipScore);
|
|
SendMessageToPC(oPC, "Leadership score = " + sLeadershipScore);
|
|
//End Test*/
|
|
return nLeadershipScore;
|
|
}
|
|
|
|
void SetMaxHenchmen69(object oPC)
|
|
{
|
|
int nLeadershipScore = GetLeadershipScore(oPC);
|
|
|
|
//Primary Code
|
|
if(GetHasLeadership(oPC) == FALSE)
|
|
{
|
|
SetLocalInt(oPC, "MaxHenchmen", 0);
|
|
}
|
|
else if(nLeadershipScore >= 25)
|
|
{
|
|
SetLocalInt(oPC, "MaxHenchmen", 10);
|
|
}
|
|
else if(nLeadershipScore >= 20)
|
|
{
|
|
SetLocalInt(oPC, "MaxHenchmen", 5);
|
|
}
|
|
else if(nLeadershipScore >= 15)
|
|
{
|
|
SetLocalInt(oPC, "MaxHenchmen", 4);
|
|
}
|
|
else if(nLeadershipScore >= 10)
|
|
{
|
|
SetLocalInt(oPC, "MaxHenchmen", 3);
|
|
}
|
|
else if(nLeadershipScore >= 8)
|
|
{
|
|
SetLocalInt(oPC, "MaxHenchmen", 2);
|
|
}
|
|
else if(nLeadershipScore >= 2)
|
|
{
|
|
SetLocalInt(oPC, "MaxHenchmen", 1);
|
|
}
|
|
else
|
|
{
|
|
SetLocalInt(oPC, "MaxHenchmen", 0);
|
|
}
|
|
//End Primary Code
|
|
|
|
//Secondary Code
|
|
//Uncomment following code to use this form
|
|
//Comment out the Primary Code
|
|
/*
|
|
if(GetHasLeadership(oPC) == FALSE)
|
|
{
|
|
SetLocalInt(oPC, "MaxHenchmen", 0);
|
|
return;
|
|
}
|
|
switch(nLeadershipScore)
|
|
{
|
|
case 0: case -1: case -2: case -3:
|
|
SetLocalInt(oPC, "MaxHenchmen", 0);
|
|
break;
|
|
|
|
case 1:
|
|
SetLocalInt(oPC, "MaxHenchmen", 1);
|
|
break;
|
|
|
|
case 2:
|
|
SetLocalInt(oPC, "MaxHenchmen", 1);
|
|
break;
|
|
|
|
case 3:
|
|
SetLocalInt(oPC, "MaxHenchmen", 1);
|
|
break;
|
|
|
|
case 4:
|
|
SetLocalInt(oPC, "MaxHenchmen", 2);
|
|
break;
|
|
|
|
case 5:
|
|
SetLocalInt(oPC, "MaxHenchmen", 2);
|
|
break;
|
|
|
|
case 6:
|
|
SetLocalInt(oPC, "MaxHenchmen", 2);
|
|
break;
|
|
|
|
case 7:
|
|
SetLocalInt(oPC, "MaxHenchmen", 3);
|
|
break;
|
|
|
|
case 8:
|
|
SetLocalInt(oPC, "MaxHenchmen", 3);
|
|
break;
|
|
|
|
case 9:
|
|
SetLocalInt(oPC, "MaxHenchmen", 3);
|
|
break;
|
|
|
|
case 10:
|
|
SetLocalInt(oPC, "MaxHenchmen", 4);
|
|
break;
|
|
|
|
case 11:
|
|
SetLocalInt(oPC, "MaxHenchmen", 4);
|
|
break;
|
|
|
|
case 12:
|
|
SetLocalInt(oPC, "MaxHenchmen", 4);
|
|
break;
|
|
|
|
case 13: case 14: case 15:
|
|
SetLocalInt(oPC, "MaxHenchmen", 5);
|
|
break;
|
|
|
|
case 16: case 17: case 18:
|
|
SetLocalInt(oPC, "MaxHenchmen", 6);
|
|
break;
|
|
|
|
default:
|
|
SetLocalInt(oPC, "MaxHenchmen", 7);
|
|
break;
|
|
}*/
|
|
//End Secondary Code
|
|
|
|
}
|
|
|
|
int GetMaxHenchmen69(object oPC)
|
|
{
|
|
int nMaxHenchmen = GetLocalInt(oPC, "MaxHenchmen");
|
|
//Test
|
|
string sMaxHenchmen = IntToString(nMaxHenchmen);
|
|
SendMessageToPC(oPC, "Maximum allowable henchmen = " + sMaxHenchmen);
|
|
return nMaxHenchmen;
|
|
}
|