Fixed some mod function bugs and stat caps.

This commit is contained in:
Tabasco 2013-05-27 15:32:59 -05:00
parent 510ce16f0e
commit fa0196b987
5 changed files with 52 additions and 27 deletions

View File

@ -2343,7 +2343,7 @@ bool Client::CheckIncreaseSkill(SkillType skillid, Mob *against_who, int chancem
GetLevelCon(against_who->GetLevel()) == CON_GREEN) GetLevelCon(against_who->GetLevel()) == CON_GREEN)
{ {
//false by default //false by default
return mod_can_increase_skill(skillid, against_who); if( !mod_can_increase_skill(skillid, against_who) ) { return(false); }
} }
} }

View File

@ -1131,6 +1131,7 @@ public:
void mod_client_death_env(); void mod_client_death_env();
int32 mod_client_xp(int32 in_exp, NPC *npc); int32 mod_client_xp(int32 in_exp, NPC *npc);
uint32 mod_client_xp_for_level(uint32 xp, uint16 check_level); uint32 mod_client_xp_for_level(uint32 xp, uint16 check_level);
int mod_client_haste_cap(int cap);
protected: protected:
friend class Mob; friend class Mob;

View File

@ -1228,8 +1228,8 @@ int16 Client::CalcSTR() {
int16 mod = aabonuses.STR; int16 mod = aabonuses.STR;
if(val>255 && GetLevel() <= 60) // if(val>255 && GetLevel() <= 60)
val = 255; // val = 255;
STR = val + mod; STR = val + mod;
if(STR < 1) if(STR < 1)
@ -1247,8 +1247,8 @@ int16 Client::CalcSTA() {
int16 mod = aabonuses.STA; int16 mod = aabonuses.STA;
if(val>255 && GetLevel() <= 60) // if(val>255 && GetLevel() <= 60)
val = 255; // val = 255;
STA = val + mod; STA = val + mod;
if(STA < 1) if(STA < 1)
@ -1265,8 +1265,8 @@ int16 Client::CalcAGI() {
int16 val = m_pp.AGI + itembonuses.AGI + spellbonuses.AGI - CalcAlcoholPhysicalEffect();; int16 val = m_pp.AGI + itembonuses.AGI + spellbonuses.AGI - CalcAlcoholPhysicalEffect();;
int16 mod = aabonuses.AGI; int16 mod = aabonuses.AGI;
if(val>255 && GetLevel() <= 60) // if(val>255 && GetLevel() <= 60)
val = 255; // val = 255;
int16 str = GetSTR(); int16 str = GetSTR();
@ -1294,8 +1294,8 @@ int16 Client::CalcDEX() {
int16 mod = aabonuses.DEX; int16 mod = aabonuses.DEX;
if(val>255 && GetLevel() <= 60) // if(val>255 && GetLevel() <= 60)
val = 255; // val = 255;
DEX = val + mod; DEX = val + mod;
if(DEX < 1) if(DEX < 1)
@ -1313,8 +1313,8 @@ int16 Client::CalcINT() {
int16 mod = aabonuses.INT; int16 mod = aabonuses.INT;
if(val>255 && GetLevel() <= 60) // if(val>255 && GetLevel() <= 60)
val = 255; // val = 255;
INT = val + mod; INT = val + mod;
if(m_pp.intoxication) if(m_pp.intoxication)
@ -1342,8 +1342,8 @@ int16 Client::CalcWIS() {
int16 mod = aabonuses.WIS; int16 mod = aabonuses.WIS;
if(val>255 && GetLevel() <= 60) // if(val>255 && GetLevel() <= 60)
val = 255; // val = 255;
WIS = val + mod; WIS = val + mod;
if(m_pp.intoxication) if(m_pp.intoxication)
@ -1371,8 +1371,8 @@ int16 Client::CalcCHA() {
int16 mod = aabonuses.CHA; int16 mod = aabonuses.CHA;
if(val>255 && GetLevel() <= 60) // if(val>255 && GetLevel() <= 60)
val = 255; // val = 255;
CHA = val + mod; CHA = val + mod;
if(CHA < 1) if(CHA < 1)
@ -1410,6 +1410,8 @@ int Client::CalcHaste() {
cap = RuleI(Character, HasteCap); cap = RuleI(Character, HasteCap);
} }
cap = mod_client_haste_cap(cap);
if(h > cap) h = cap; if(h > cap) h = cap;
h += spellbonuses.hastetype3; h += spellbonuses.hastetype3;

View File

@ -134,6 +134,9 @@ int Client::mod_client_damage(int damage, SkillType skillinuse, int hand, const
float cagi = (float)GetActAGI() - DW_STATBASE; float cagi = (float)GetActAGI() - DW_STATBASE;
float csta = (float)GetActSTA() - 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; float cmax = ((float)GetLevel() * 2) + 150;
if(GetLevel() > 49) { cmax = 10000; } if(GetLevel() > 49) { cmax = 10000; }
@ -145,12 +148,12 @@ int Client::mod_client_damage(int damage, SkillType skillinuse, int hand, const
switch(skillinuse) switch(skillinuse)
{ {
case ARCHERY: case ARCHERY:
dmult += cdex / 600; dmult += cdex / 900;
dmult += csta / 600; dmult += csta / 900;
if(GetClass() == RANGER) if(GetClass() == RANGER)
{ {
dmult += cdex / 1000; dmult += cdex / 1200;
} }
break; break;
@ -332,7 +335,7 @@ int16 Client::mod_increase_skill_chance(int16 chance, Mob* against_who) {
float bonus = (cint + (cwis / 2)) / 10; float bonus = (cint + (cwis / 2)) / 10;
if(bonus < 0) { bonus = 0; } if(bonus < 0.8) { bonus = 0.8; }
return( (int)((float)chance * bonus) ); return( (int)((float)chance * bonus) );
} }
@ -397,6 +400,12 @@ int Client::mod_client_haste(int h) {
return(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 //This is called when a client cons a mob
void Client::mod_consider(Mob* tmob, Consider_Struct* con) { void Client::mod_consider(Mob* tmob, Consider_Struct* con) {
if(tmob->GetLastName()[0] == '[') 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; float spadd = 0.0f;
int adval = caster->CastToClient()->Admin(); int adval = caster->CastToClient()->Admin();
// adval = 0; adval = 0;
if(caster->GetCasterClass() == 'W') if(caster->GetCasterClass() == 'W')
{ {
spbonus = (float)(caster->CastToClient()->GetActWIS() - DW_STATBASE) / 400; spbonus = (float)(caster->CastToClient()->GetActWIS() - DW_STATBASE) / 400;
spbonus += (float)(caster->CastToClient()->GetActSTA() - DW_STATBASE) / 400; spbonus += (float)(caster->CastToClient()->GetActSTA() - DW_STATBASE) / 400;
if(adval > 80) { caster->Message(315, "WIS FORMULA"); }
} }
else if(caster->GetCasterClass() == 'I') else if(caster->GetCasterClass() == 'I')
{ {
if(caster->GetClass() == BARD) if(caster->GetClass() == BARD)
{ {
spbonus = (float)(caster->CastToClient()->GetActCHA() - DW_STATBASE) / 150; spbonus = (float)(caster->CastToClient()->GetActCHA() - DW_STATBASE) / 400;
spbonus += (float)(caster->CastToClient()->GetActINT() - DW_STATBASE) / 150; spbonus += (float)(caster->CastToClient()->GetActINT() - DW_STATBASE) / 400;
if(adval > 80) { caster->Message(315, "CHA FORMULA"); }
} }
else else
{ {
spbonus = (float)(caster->CastToClient()->GetActINT() - DW_STATBASE) / 400; spbonus = (float)(caster->CastToClient()->GetActINT() - DW_STATBASE) / 400;
spbonus += (float)(caster->CastToClient()->GetActDEX() - DW_STATBASE) / 400; spbonus += (float)(caster->CastToClient()->GetActDEX() - DW_STATBASE) / 400;
if(adval > 80) { caster->Message(315, "INT FORMULA"); }
} }
} }
else else
@ -658,14 +670,16 @@ int Mob::mod_effect_value(int effect_value, uint16 spell_id, int effect_type, Mo
mult = 1.0f; mult = 1.0f;
} }
int base_effect = effect_value;
if(effect_value > 0) { effect_value += (int)ceil(spadd); } if(effect_value > 0) { effect_value += (int)ceil(spadd); }
else { 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 //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) { int32 Mob::mod_frenzy_damage(int32 dmg) {
if(!IsClient()) { return(dmg); } if(!IsClient()) { return(dmg); }
float hprmult = 1 + (1 - (GetHP()/GetMaxHP()));
dmg = CastToClient()->mod_client_damage(dmg, FRENZY, 0, nullptr, nullptr); dmg = CastToClient()->mod_client_damage(dmg, FRENZY, 0, nullptr, nullptr);
if(GetClass() == BERSERKER)
{
dmg = (int)( (float)dmg * hprmult );
}
return(dmg); return(dmg);
} }

View File

@ -129,8 +129,8 @@ XS(XS_NPC_AddLootTable); /* prototype to pass -Wmissing-prototypes */
XS(XS_NPC_AddLootTable) XS(XS_NPC_AddLootTable)
{ {
dXSARGS; dXSARGS;
if (items != 1) if (items < 1)
Perl_croak(aTHX_ "Usage: NPC::AddLootTable(THIS)"); Perl_croak(aTHX_ "Usage: NPC::AddLootTable(THIS, [loottable_id])");
{ {
NPC * THIS; NPC * THIS;