Jaysyn904 5e558169a0 Initial Commit
Initial Commit
2025-04-03 11:24:16 -04:00

242 lines
8.8 KiB
Plaintext

#include "spawner"
#include "x0_i0_petrify"
void RemoveBonuses(object oPC)
{
RemoveEffectOfType(oPC, EFFECT_TYPE_DAMAGE_INCREASE);
RemoveEffectOfType(oPC, EFFECT_TYPE_MOVEMENT_SPEED_INCREASE);
RemoveEffectOfType(oPC, EFFECT_TYPE_AC_INCREASE);
RemoveEffectOfType(oPC, EFFECT_TYPE_ATTACK_INCREASE);
}
void ApplyBonuses(object oPC)
{
if (GetLocalInt(GetModule(), "nordock")==1)return;
int oPw = GetLocalInt(oPC, "rank_speed");
int oAtt = GetLocalInt(oPC, "rank_attack");
int oAC = GetLocalInt(oPC, "rank_ac");
int oDm = GetLocalInt(oPC, "rank_damage");
effect eEffect4;
effect eEffect = SupernaturalEffect(EffectDamageIncrease(DAMAGE_BONUS_20,DAMAGE_TYPE_DIVINE));
// Apply Speed Bonus
if (oPw>0)
{
ApplyEffectToObject(DURATION_TYPE_PERMANENT,
SupernaturalEffect(EffectMovementSpeedIncrease(oPw)), oPC);
}
// Apply AC Bonus
if (oAC>0)
{
ApplyEffectToObject(DURATION_TYPE_PERMANENT,
SupernaturalEffect(EffectACIncrease(oAC, AC_DODGE_BONUS,
AC_VS_DAMAGE_TYPE_ALL)), oPC);
}
// Apply Attack Bonus
if (oAtt>0)
{
ApplyEffectToObject(DURATION_TYPE_PERMANENT,
SupernaturalEffect(EffectAttackIncrease(oAtt)), oPC);
}
// Apply Damage Bonus
if (oDm>0)
{
ApplyEffectToObject(DURATION_TYPE_PERMANENT,
SupernaturalEffect(EffectDamageIncrease(oDm, DAMAGE_TYPE_BLUDGEONING)),oPC);
ApplyEffectToObject(DURATION_TYPE_PERMANENT,
SupernaturalEffect(EffectDamageIncrease(oDm, DAMAGE_TYPE_PIERCING)),oPC);
ApplyEffectToObject(DURATION_TYPE_PERMANENT,
SupernaturalEffect(EffectDamageIncrease(oDm, DAMAGE_TYPE_SLASHING)),oPC);
}
// If you have recieved divine power, retain after death
if (GetItemPossessedBy(oPC, "divine_talisman")!= OBJECT_INVALID)
{
eEffect4 = SupernaturalEffect(EffectDamageIncrease
(DAMAGE_BONUS_20,DAMAGE_TYPE_DIVINE));
}
if (GetItemPossessedBy(oPC, "dark_talisman")!= OBJECT_INVALID)
{
eEffect4 = SupernaturalEffect(EffectDamageIncrease
(DAMAGE_BONUS_20,DAMAGE_TYPE_NEGATIVE));
}
DelayCommand(0.5, ApplyEffectToObject(DURATION_TYPE_PERMANENT, eEffect4, oPC));
}
void GetRank(object oPC)
{
if (GetLocalInt(GetModule(), "nordock")==1)return;
// Initialise
if (!GetIsPC(oPC)) {return;}
object oMod = GetModule();
int oGameMode = GetLocalInt(oMod, "gamemode");
int iDied = GetLocalInt (oPC,"iDied");
int iKilled = GetLocalInt (oPC,"iKilled");
int oRank;
int oStatus = GetLocalInt(oPC, "status");
int oScheck = oStatus;
int eEffect;
int eEffect2 = VFX_IMP_IMPROVE_ABILITY_SCORE;
int eEffect3 = VFX_IMP_REDUCE_ABILITY_SCORE;
int oRR;
int oPromo;
string oTitle = GetLocalString(oPC,"rank");
string oCheck = oTitle;
string oMsg;
// Determine Rank Rating Based on Kills / Deaths
oRank = iKilled-(iDied/2);
// Get Rank Bonus Effect Settings
int oPw = GetLocalInt(oPC, "rank_speed");
int oAtt = GetLocalInt(oPC, "rank_attack");
int oAC = GetLocalInt(oPC, "rank_ac");
int oDm = GetLocalInt(oPC, "rank_damage");
int oPw_check = oPw;
int oAtt_check = oAtt;
int oAC_check = oAC;
int oDm_check = oDm;
// Set Rank Name Based on Rank Rating and Alignment
if (oGameMode==1)
{
if (oRank<=4) { oTitle = "Scum";oRR = 1;}
if ((oRank>4)&&(oRank<=9)) { oTitle = "Lacky";oRR = 2;}
if ((oRank>9)&&(oRank<=14)) { oTitle = "Minion";oRR = 3;}
if ((oRank>14)&&(oRank<=19)) { oTitle = "Stalker";oRR = 4;}
if ((oRank>19)&&(oRank<=24)) { oTitle = "Assassin";oRR = 5;}
if ((oRank>24)&&(oRank<=29)) { oTitle = "Mercinary";oRR = 6;}
if ((oRank>29)&&(oRank<=34)) { oTitle = "Dark Leader";oRR = 7;}
if ((oRank>34)&&(oRank<=39)) { oTitle = "Death Bringer";oRR = 8;}
if ((oRank>39)&&(oRank<=44)) { oTitle = "Doom Lord";oRR = 1;oRR = 9;}
if ((oRank>44)&&(oRank<=49)) { oTitle = "Battlefiend";oRR = 10;}
if ((oRank>49)&&(oRank<=59)) { oTitle = "Slayer";oRR = 11;}
if ((oRank>59)&&(oRank<=69)) { oTitle = "Lord Slayer";oRR = 12;}
if ((oRank>69)&&(oRank<=79)) { oTitle = "Soul Reaver";oRR = 13;}
if ((oRank>79)&&(oRank<=89)) { oTitle = "Grand Darkmaster";oRR = 14;}
if ((oRank>89)&&(oRank<=99)) { oTitle = "Angel Slayer";oRR = 15;}
if ((oRank>99)&&(oRank<=109)) { oTitle = "Demon Champion";oRR = 16;}
if ((oRank>109)&&(oRank<=149)){ oTitle = "Demon Lord";oRR = 17;}
if ((oRank>149)&&(oRank<=199)){ oTitle = "Demon Prince";oRR = 18;}
if (oRank>199) { oTitle = "Chaos God";oRR = 19;}
eEffect = VFX_IMP_EVIL_HELP;
}
else
{
if (oRank<=4) { oTitle = "Fool";oRR = 1;}
if ((oRank>4)&&(oRank<=9)) { oTitle = "Grunt";oRR = 2;}
if ((oRank>9)&&(oRank<=14)) { oTitle = "Foot Soldier";oRR = 3;}
if ((oRank>14)&&(oRank<=19)) { oTitle = "Soldier";oRR = 4;}
if ((oRank>19)&&(oRank<=24)) { oTitle = "Gladiator";oRR = 5;}
if ((oRank>24)&&(oRank<=29)) { oTitle = "Captain";oRR = 6;}
if ((oRank>29)&&(oRank<=34)) { oTitle = "Man-at-arms";oRR = 7;}
if ((oRank>34)&&(oRank<=39)) { oTitle = "Knight";oRR = 8;}
if ((oRank>39)&&(oRank<=44)) { oTitle = "Champion";oRR = 9;}
if ((oRank>44)&&(oRank<=49)) { oTitle = "Defender";oRR = 10;}
if ((oRank>49)&&(oRank<=59)) { oTitle = "Battle Master";oRR = 11;}
if ((oRank>59)&&(oRank<=69)) { oTitle = "Warlord";oRR = 12;}
if ((oRank>69)&&(oRank<=79)) { oTitle = "Gand Master";oRR = 13;}
if ((oRank>79)&&(oRank<=89)) { oTitle = "Demon Slayer";oRR = 14;}
if ((oRank>89)&&(oRank<=99)) { oTitle = "Supreme Champion";oRR = 15;}
if ((oRank>99)&&(oRank<=109)) { oTitle = "Hero";oRR = 16;}
if ((oRank>109)&&(oRank<=149)){ oTitle = "Demi-god";oRR = 17;}
if ((oRank>149)&&(oRank<=199)){ oTitle = "Light Emperor";oRR = 18;}
if (oRank>199) { oTitle = "The Enlightened One";oRR = 19;}
eEffect = VFX_IMP_GOOD_HELP;
}
// Award Bonus Powers Based on Rank
if (oRank<=4) { oPw=0;oAtt=0;oAC=0;oDm=0;}
if ((oRank>4)&&(oRank<=9)) { oPw=80;oAtt=0;oAC=0;oDm=0;}
if ((oRank>9)&&(oRank<=14)) { oPw=80;oAtt=2;oAC=1;oDm=1;}
if ((oRank>14)&&(oRank<=19)) { oPw=80;oAtt=2;oAC=2;oDm=2;}
if ((oRank>19)&&(oRank<=24)) { oPw=150;oAtt=4;oAC=2;oDm=2;}
if ((oRank>24)&&(oRank<=29)) { oPw=150;oAtt=4;oAC=2;oDm=4;}
if ((oRank>29)&&(oRank<=34)) { oPw=150;oAtt=6;oAC=4;oDm=4;}
if ((oRank>34)&&(oRank<=39)) { oPw=150;oAtt=6;oAC=4;oDm=6;}
if ((oRank>39)&&(oRank<=44)) { oPw=150;oAtt=8;oAC=4;oDm=6;}
if ((oRank>44)&&(oRank<=49)) { oPw=150;oAtt=8;oAC=6;oDm=8;}
if ((oRank>49)&&(oRank<=59)) { oPw=300;oAtt=10;oAC=6;oDm=8;}
if ((oRank>59)&&(oRank<=69)) { oPw=300;oAtt=10;oAC=6;oDm=10;}
if ((oRank>69)&&(oRank<=79)) { oPw=350;oAtt=12;oAC=6;oDm=10;}
if ((oRank>79)&&(oRank<=89)) { oPw=380;oAtt=12;oAC=8;oDm=12;}
if ((oRank>89)&&(oRank<=99)) { oPw=400;oAtt=14;oAC=8;oDm=12;}
if ((oRank>99)&&(oRank<=109)) { oPw=450;oAtt=14;oAC=8;oDm=14;}
if ((oRank>109)&&(oRank<=149)){ oPw=500;oAtt=16;oAC=10;oDm=14;}
if ((oRank>149)&&(oRank<=199)){ oPw=600;oAtt=18;oAC=12;oDm=18;}
if (oRank>199) { oPw=800;oAtt=20;oAC=16;oDm=20;}
SetLocalInt(oPC, "rank_speed", oPw);
SetLocalInt(oPC, "rank_attack", oAtt);
SetLocalInt(oPC, "rank_ac", oAC);
SetLocalInt(oPC, "rank_damage", oDm);
SetLocalInt(oPC, "status", oRR);
// Send bonus award Message if Rank is gained or lost
if (oPw_check < oPw) {DelayCommand(4.0, SendMessageToPC(oPC, "Rank Bonus: Movement speed increased"));}
if (oAtt_check < oAtt) {DelayCommand(4.0, SendMessageToPC(oPC, "Rank Bonus: Attack increased +"+IntToString(oAtt)));}
if (oAC_check < oAC) {DelayCommand(4.0, SendMessageToPC(oPC, "Rank Bonus: AC increased +"+IntToString(oAC)));}
if (oDm_check < oDm) {DelayCommand(4.0, SendMessageToPC(oPC, "Rank Bonus: Physical damage increased +"+IntToString(oDm)));}
if (oPw_check > oPw) {DelayCommand(4.0, SendMessageToPC(oPC, "Rank Lost: Movement speed bonus decreased"));}
if (oAtt_check > oAtt) {DelayCommand(4.0, SendMessageToPC(oPC, "Rank Lost: Attack bonus decreased +"+IntToString(oAtt)));}
if (oAC_check > oAC) {DelayCommand(4.0, SendMessageToPC(oPC, "Rank Lost: AC bonus decreased +"+IntToString(oAC)));}
if (oDm_check > oDm) {DelayCommand(4.0, SendMessageToPC(oPC, "Rank Lost: Physical damage bonus decreased +"+IntToString(oDm)));}
DelayCommand(4.0, RemoveBonuses(oPC));
DelayCommand(4.2, ApplyBonuses(oPC));
SetLocalString(oPC,"rank", oTitle);
if (oCheck != oTitle)
{
if ((oTitle!="Scum")&&(oTitle!="Fool"))
{
if (oScheck<oRR)
{
oMsg = "You have been promoted to ";
oMsg+=oTitle;
DelayCommand(4.0, FloatingTextStringOnCreature(oMsg, oPC));
PCEffect(4.0, eEffect, oPC);
PCEffect(4.2, eEffect2, oPC);
}
else
{
oMsg = "You have been demoted to ";
oMsg+=oTitle;
DelayCommand(4.0, FloatingTextStringOnCreature(oMsg, oPC));
PCEffect(4.0, VFX_IMP_BREACH, oPC);
PCEffect(4.2, eEffect3, oPC);
}
}
}
}
//void main() {}