From fa0196b9875f765ffc3a7b3c17d48159ae70cc92 Mon Sep 17 00:00:00 2001 From: Tabasco Date: Mon, 27 May 2013 15:32:59 -0500 Subject: [PATCH] Fixed some mod function bugs and stat caps. --- zone/client.cpp | 2 +- zone/client.h | 1 + zone/client_mods.cpp | 30 ++++++++++++++++-------------- zone/mod_functions.cpp | 42 ++++++++++++++++++++++++++++++++---------- zone/perl_npc.cpp | 4 ++-- 5 files changed, 52 insertions(+), 27 deletions(-) diff --git a/zone/client.cpp b/zone/client.cpp index 8f16956aa..2e501602c 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -2343,7 +2343,7 @@ bool Client::CheckIncreaseSkill(SkillType skillid, Mob *against_who, int chancem GetLevelCon(against_who->GetLevel()) == CON_GREEN) { //false by default - return mod_can_increase_skill(skillid, against_who); + if( !mod_can_increase_skill(skillid, against_who) ) { return(false); } } } diff --git a/zone/client.h b/zone/client.h index 46ee8f4fd..fc6d668ea 100644 --- a/zone/client.h +++ b/zone/client.h @@ -1131,6 +1131,7 @@ public: void mod_client_death_env(); int32 mod_client_xp(int32 in_exp, NPC *npc); uint32 mod_client_xp_for_level(uint32 xp, uint16 check_level); + int mod_client_haste_cap(int cap); protected: friend class Mob; diff --git a/zone/client_mods.cpp b/zone/client_mods.cpp index 1e81c563e..3ecd7a1f9 100644 --- a/zone/client_mods.cpp +++ b/zone/client_mods.cpp @@ -1228,8 +1228,8 @@ int16 Client::CalcSTR() { int16 mod = aabonuses.STR; - if(val>255 && GetLevel() <= 60) - val = 255; +// if(val>255 && GetLevel() <= 60) +// val = 255; STR = val + mod; if(STR < 1) @@ -1247,8 +1247,8 @@ int16 Client::CalcSTA() { int16 mod = aabonuses.STA; - if(val>255 && GetLevel() <= 60) - val = 255; +// if(val>255 && GetLevel() <= 60) +// val = 255; STA = val + mod; if(STA < 1) @@ -1265,8 +1265,8 @@ int16 Client::CalcAGI() { int16 val = m_pp.AGI + itembonuses.AGI + spellbonuses.AGI - CalcAlcoholPhysicalEffect();; int16 mod = aabonuses.AGI; - if(val>255 && GetLevel() <= 60) - val = 255; +// if(val>255 && GetLevel() <= 60) +// val = 255; int16 str = GetSTR(); @@ -1294,8 +1294,8 @@ int16 Client::CalcDEX() { int16 mod = aabonuses.DEX; - if(val>255 && GetLevel() <= 60) - val = 255; +// if(val>255 && GetLevel() <= 60) +// val = 255; DEX = val + mod; if(DEX < 1) @@ -1313,8 +1313,8 @@ int16 Client::CalcINT() { int16 mod = aabonuses.INT; - if(val>255 && GetLevel() <= 60) - val = 255; +// if(val>255 && GetLevel() <= 60) +// val = 255; INT = val + mod; if(m_pp.intoxication) @@ -1342,8 +1342,8 @@ int16 Client::CalcWIS() { int16 mod = aabonuses.WIS; - if(val>255 && GetLevel() <= 60) - val = 255; +// if(val>255 && GetLevel() <= 60) +// val = 255; WIS = val + mod; if(m_pp.intoxication) @@ -1371,8 +1371,8 @@ int16 Client::CalcCHA() { int16 mod = aabonuses.CHA; - if(val>255 && GetLevel() <= 60) - val = 255; +// if(val>255 && GetLevel() <= 60) +// val = 255; CHA = val + mod; if(CHA < 1) @@ -1410,6 +1410,8 @@ int Client::CalcHaste() { cap = RuleI(Character, HasteCap); } + cap = mod_client_haste_cap(cap); + if(h > cap) h = cap; h += spellbonuses.hastetype3; diff --git a/zone/mod_functions.cpp b/zone/mod_functions.cpp index 4a6b32117..8a1cc96c2 100644 --- a/zone/mod_functions.cpp +++ b/zone/mod_functions.cpp @@ -134,6 +134,9 @@ int Client::mod_client_damage(int damage, SkillType skillinuse, int hand, const float cagi = (float)GetActAGI() - DW_STATBASE; float csta = (float)GetActSTA() - DW_STATBASE; + //if(Admin() > 80) { Message(315, "Dex: %f, Str: %f, Agi: %f, Sta: %f", cdex, cstr, cagi, csta); } + //if(Admin() > 80) { Message(315, "Str: %f, %d, %d", cstr, GetMaxSTR(), GetSTR()); } + float cmax = ((float)GetLevel() * 2) + 150; if(GetLevel() > 49) { cmax = 10000; } @@ -145,12 +148,12 @@ int Client::mod_client_damage(int damage, SkillType skillinuse, int hand, const switch(skillinuse) { case ARCHERY: - dmult += cdex / 600; - dmult += csta / 600; + dmult += cdex / 900; + dmult += csta / 900; if(GetClass() == RANGER) { - dmult += cdex / 1000; + dmult += cdex / 1200; } break; @@ -332,7 +335,7 @@ int16 Client::mod_increase_skill_chance(int16 chance, Mob* against_who) { float bonus = (cint + (cwis / 2)) / 10; - if(bonus < 0) { bonus = 0; } + if(bonus < 0.8) { bonus = 0.8; } return( (int)((float)chance * bonus) ); } @@ -397,6 +400,12 @@ int Client::mod_client_haste(int h) { return(h); } +//Haste cap override +int Client::mod_client_haste_cap(int cap) +{ + return( RuleI(Character, HasteCap) ); +} + //This is called when a client cons a mob void Client::mod_consider(Mob* tmob, Consider_Struct* con) { if(tmob->GetLastName()[0] == '[') @@ -519,24 +528,27 @@ int Mob::mod_effect_value(int effect_value, uint16 spell_id, int effect_type, Mo float spadd = 0.0f; int adval = caster->CastToClient()->Admin(); -// adval = 0; + adval = 0; if(caster->GetCasterClass() == 'W') { spbonus = (float)(caster->CastToClient()->GetActWIS() - DW_STATBASE) / 400; spbonus += (float)(caster->CastToClient()->GetActSTA() - DW_STATBASE) / 400; + if(adval > 80) { caster->Message(315, "WIS FORMULA"); } } else if(caster->GetCasterClass() == 'I') { if(caster->GetClass() == BARD) { - spbonus = (float)(caster->CastToClient()->GetActCHA() - DW_STATBASE) / 150; - spbonus += (float)(caster->CastToClient()->GetActINT() - DW_STATBASE) / 150; + spbonus = (float)(caster->CastToClient()->GetActCHA() - DW_STATBASE) / 400; + spbonus += (float)(caster->CastToClient()->GetActINT() - DW_STATBASE) / 400; + if(adval > 80) { caster->Message(315, "CHA FORMULA"); } } else { spbonus = (float)(caster->CastToClient()->GetActINT() - DW_STATBASE) / 400; spbonus += (float)(caster->CastToClient()->GetActDEX() - DW_STATBASE) / 400; + if(adval > 80) { caster->Message(315, "INT FORMULA"); } } } else @@ -658,14 +670,16 @@ int Mob::mod_effect_value(int effect_value, uint16 spell_id, int effect_type, Mo mult = 1.0f; } + int base_effect = effect_value; + if(effect_value > 0) { effect_value += (int)ceil(spadd); } else { effect_value -= (int)ceil(spadd); } - effect_value *= mult; + effect_value = (int)( ceil((float)effect_value * mult) ); - if(adval > 80) { caster->Message(315, "Spell Bonus: %d, %d, %d", effect_value, spadd, effect_type); } + if(adval > 80) { caster->Message(315, "Spell Bonus: Base: %d, New: %d, Add: %d", base_effect, effect_value, spadd); } - return( (int)(ceil(effect_value)) ); + return( effect_value ); } //chancetohit - 0 to 100 percent - set over 1000 for a guaranteed hit @@ -858,7 +872,15 @@ int32 Mob::mod_bash_damage(int32 dmg) { int32 Mob::mod_frenzy_damage(int32 dmg) { if(!IsClient()) { return(dmg); } + float hprmult = 1 + (1 - (GetHP()/GetMaxHP())); + dmg = CastToClient()->mod_client_damage(dmg, FRENZY, 0, nullptr, nullptr); + + if(GetClass() == BERSERKER) + { + dmg = (int)( (float)dmg * hprmult ); + } + return(dmg); } diff --git a/zone/perl_npc.cpp b/zone/perl_npc.cpp index c89445bd2..0ac61e3cc 100644 --- a/zone/perl_npc.cpp +++ b/zone/perl_npc.cpp @@ -129,8 +129,8 @@ XS(XS_NPC_AddLootTable); /* prototype to pass -Wmissing-prototypes */ XS(XS_NPC_AddLootTable) { dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: NPC::AddLootTable(THIS)"); + if (items < 1) + Perl_croak(aTHX_ "Usage: NPC::AddLootTable(THIS, [loottable_id])"); { NPC * THIS;