Fix classic h2h dmg/delay also support for revamp

The revamp was implemented during SoF
Set Combat:UseRevampHandToHand to true to enable
This commit is contained in:
Michael Cook (mackal) 2016-01-03 14:38:50 -05:00
parent 05de206ace
commit 5bcb9f0b35
8 changed files with 161 additions and 126 deletions

View File

@ -462,6 +462,7 @@ RULE_INT(Combat, MeleePushChance, 50) // (NPCs) chance the target will be pushed
RULE_BOOL(Combat, UseLiveCombatRounds, true) // turn this false if you don't want to worry about fixing up combat rounds for NPCs
RULE_INT(Combat, NPCAssistCap, 5) // Maxiumium number of NPCs that will assist another NPC at once
RULE_INT(Combat, NPCAssistCapTimer, 6000) // Time in milliseconds a NPC will take to clear assist aggro cap space
RULE_BOOL(Combat, UseRevampHandToHand, false) // use h2h revamped dmg/delays I believe this was implemented during SoF
RULE_CATEGORY_END()
RULE_CATEGORY(NPC)

View File

@ -846,7 +846,7 @@ int Mob::GetWeaponDamage(Mob *against, const Item_Struct *weapon_item) {
}
else{
if((GetClass() == MONK || GetClass() == BEASTLORD) && GetLevel() >= 30){
dmg = GetMonkHandToHandDamage();
dmg = GetHandToHandDamage();
}
else if(GetOwner() && GetLevel() >= RuleI(Combat, PetAttackMagicLevel)){
//pets wouldn't actually use this but...
@ -868,12 +868,7 @@ int Mob::GetWeaponDamage(Mob *against, const Item_Struct *weapon_item) {
dmg = dmg <= 0 ? 1 : dmg;
}
else{
if(GetClass() == MONK || GetClass() == BEASTLORD){
dmg = GetMonkHandToHandDamage();
}
else{
dmg = 1;
}
dmg = GetHandToHandDamage();
}
}
@ -1006,7 +1001,7 @@ int Mob::GetWeaponDamage(Mob *against, const ItemInst *weapon_item, uint32 *hate
if((GetClass() == MONK || GetClass() == BEASTLORD)) {
if(MagicGloves || GetLevel() >= 30){
dmg = GetMonkHandToHandDamage();
dmg = GetHandToHandDamage();
if (hate) *hate += dmg;
}
}
@ -1041,13 +1036,8 @@ int Mob::GetWeaponDamage(Mob *against, const ItemInst *weapon_item, uint32 *hate
}
}
else{
if(GetClass() == MONK || GetClass() == BEASTLORD){
dmg = GetMonkHandToHandDamage();
if (hate) *hate += dmg;
}
else{
dmg = 1;
}
dmg = GetHandToHandDamage();
if (hate) *hate += dmg;
}
}
@ -2738,69 +2728,105 @@ uint8 Mob::GetWeaponDamageBonus(const Item_Struct *weapon, bool offhand)
}
}
int Mob::GetMonkHandToHandDamage(void)
int Mob::GetHandToHandDamage(void)
{
// Kaiyodo - Determine a monk's fist damage. Table data from www.monkly-business.com
// saved as static array - this should speed this function up considerably
static int damage[66] = {
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
99, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7,
8, 8, 8, 8, 8, 9, 9, 9, 9, 9,10,10,10,10,10,11,11,11,11,11,
12,12,12,12,12,13,13,13,13,13,14,14,14,14,14,14,14,14,14,14,
14,14,15,15,15,15 };
// Have a look to see if we have epic fists on
if (IsClient() && CastToClient()->GetItemIDAt(12) == 10652)
return(9);
else
{
int Level = GetLevel();
if (Level > 65)
return(19);
else
return damage[Level];
if (RuleB(Combat, UseRevampHandToHand)) {
// everyone uses this in the revamp!
int skill = GetSkill(SkillHandtoHand);
int epic = 0;
if (IsClient() && CastToClient()->GetItemIDAt(12) == 10652 && GetLevel() > 46)
epic = 280;
if (epic > skill)
skill = epic;
return skill / 15 + 3;
}
static uint8 mnk_dmg[] = {99,
4, 4, 4, 4, 5, 5, 5, 5, 5, 6, // 1-10
6, 6, 6, 6, 7, 7, 7, 7, 7, 8, // 11-20
8, 8, 8, 8, 9, 9, 9, 9, 9, 10, // 21-30
10, 10, 10, 10, 11, 11, 11, 11, 11, 12, // 31-40
12, 12, 12, 12, 13, 13, 13, 13, 13, 14, // 41-50
14, 14, 14, 14, 14, 14, 14, 14, 14, 14, // 51-60
14, 14}; // 61-62
static uint8 bst_dmg[] = {99,
4, 4, 4, 4, 4, 5, 5, 5, 5, 5, // 1-10
5, 6, 6, 6, 6, 6, 6, 7, 7, 7, // 11-20
7, 7, 7, 8, 8, 8, 8, 8, 8, 9, // 21-30
9, 9, 9, 9, 9, 10, 10, 10, 10, 10, // 31-40
10, 11, 11, 11, 11, 11, 11, 12, 12}; // 41-49
if (GetClass() == MONK) {
if (IsClient() && CastToClient()->GetItemIDAt(12) == 10652 && GetLevel() > 50)
return 9;
if (level > 62)
return 15;
return mnk_dmg[level];
} else if (GetClass() == BEASTLORD) {
if (level > 49)
return 13;
return bst_dmg[level];
}
return 2;
}
int Mob::GetMonkHandToHandDelay(void)
int Mob::GetHandToHandDelay(void)
{
// Kaiyodo - Determine a monk's fist delay. Table data from www.monkly-business.com
// saved as static array - this should speed this function up considerably
static int delayshuman[66] = {
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
99,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,35,35,35,35,35,34,34,34,34,34,33,33,33,33,33,
32,32,32,32,32,31,31,31,31,31,30,30,30,29,29,29,28,28,28,27,
26,24,22,20,20,20 };
static int delaysiksar[66] = {
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
99,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,35,35,35,35,35,34,34,34,34,34,
33,33,33,33,33,32,32,32,32,32,31,31,31,30,30,30,29,29,29,28,
27,24,22,20,20,20 };
// Have a look to see if we have epic fists on
if (IsClient() && CastToClient()->GetItemIDAt(12) == 10652)
return(16);
else
{
int Level = GetLevel();
if (GetRace() == HUMAN)
{
if (Level > 65)
return(24);
else
return delayshuman[Level];
}
else //heko: iksar table
{
if (Level > 65)
return(25);
else
return delaysiksar[Level];
}
if (RuleB(Combat, UseRevampHandToHand)) {
// everyone uses this in the revamp!
int skill = GetSkill(SkillHandtoHand);
int epic = 0;
int iksar = 0;
if (IsClient() && CastToClient()->GetItemIDAt(12) == 10652 && GetLevel() > 46)
epic = 280;
else if (GetRace() == IKSAR)
iksar = 1;
if (epic > skill)
skill = epic;
return iksar - skill / 21 + 38;
}
int delay = 35;
static uint8 mnk_hum_delay[] = {99,
35, 35, 35, 35, 35, 35, 35, 35, 35, 35, // 1-10
35, 35, 35, 35, 35, 35, 35, 35, 35, 35, // 11-20
35, 35, 35, 35, 35, 35, 35, 34, 34, 34, // 21-30
34, 33, 33, 33, 33, 32, 32, 32, 32, 31, // 31-40
31, 31, 31, 30, 30, 30, 30, 29, 29, 29, // 41-50
29, 28, 28, 28, 28, 27, 27, 27, 27, 26, // 51-60
24, 22}; // 61-62
static uint8 mnk_iks_delay[] = {99,
35, 35, 35, 35, 35, 35, 35, 35, 35, 35, // 1-10
35, 35, 35, 35, 35, 35, 35, 35, 35, 35, // 11-20
35, 35, 35, 35, 35, 35, 35, 35, 35, 34, // 21-30
34, 34, 34, 34, 34, 33, 33, 33, 33, 33, // 31-40
33, 32, 32, 32, 32, 32, 32, 31, 31, 31, // 41-50
31, 31, 31, 30, 30, 30, 30, 30, 30, 29, // 51-60
25, 23}; // 61-62
static uint8 bst_delay[] = {99,
35, 35, 35, 35, 35, 35, 35, 35, 35, 35, // 1-10
35, 35, 35, 35, 35, 35, 35, 35, 35, 35, // 11-20
35, 35, 35, 35, 35, 35, 35, 35, 34, 34, // 21-30
34, 34, 34, 33, 33, 33, 33, 33, 32, 32, // 31-40
32, 32, 32, 31, 31, 31, 31, 31, 30, 30, // 41-50
30, 30, 30, 29, 29, 29, 29, 29, 28, 28, // 51-60
28, 28, 28, 27, 27, 27, 27, 27, 26, 26, // 61-70
26, 26, 26}; // 71-73
if (GetClass() == MONK) {
// Have a look to see if we have epic fists on
if (IsClient() && CastToClient()->GetItemIDAt(12) == 10652 && GetLevel() > 50)
return 16;
int level = GetLevel();
if (level > 62)
return GetRace() == IKSAR ? 21 : 20;
return GetRace() == IKSAR ? mnk_iks_delay[level] : mnk_hum_delay[level];
} else if (GetClass() == BEASTLORD) {
int level = GetLevel();
if (level > 73)
return 25;
return bst_delay[level];
}
return 35;
}
int32 Mob::ReduceDamage(int32 damage)
@ -4649,18 +4675,14 @@ void Client::SetAttackTimer()
int hhe = itembonuses.HundredHands + spellbonuses.HundredHands;
int speed = 0;
int delay = 3600;
int delay = 3500;
//if we have no weapon..
if (ItemToUse == nullptr) {
//above checks ensure ranged weapons do not fall into here
// Work out if we're a monk
if (GetClass() == MONK || GetClass() == BEASTLORD)
delay = 100 * GetMonkHandToHandDelay();
} else {
if (ItemToUse == nullptr)
delay = 100 * GetHandToHandDelay();
else
//we have a weapon, use its delay
delay = 100 * ItemToUse->Delay;
}
speed = delay / haste_mod;

View File

@ -6236,31 +6236,44 @@ float Bot::GetProcChances(float ProcBonus, uint16 hand) {
return ProcChance;
}
int Bot::GetMonkHandToHandDamage(void) {
static int damage[66] = {
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
99, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7,
8, 8, 8, 8, 8, 9, 9, 9, 9, 9,10,10,10,10,10,11,11,11,11,11,
12,12,12,12,12,13,13,13,13,13,14,14,14,14,14,14,14,14,14,14,
14,14,15,15,15,15 };
int Bot::GetHandToHandDamage(void) {
if (RuleB(Combat, UseRevampHandToHand)) {
// everyone uses this in the revamp!
int skill = GetSkill(SkillHandtoHand);
int epic = 0;
if (CastToNPC()->GetEquipment(MaterialHands) == 10652 && GetLevel() > 46)
epic = 280;
if (epic > skill)
skill = epic;
return skill / 15 + 3;
}
uint32 botWeaponId = INVALID_ID;
botWeaponId = CastToNPC()->GetEquipment(MaterialHands);
if(botWeaponId == 10652)
static uint8 mnk_dmg[] = {99,
4, 4, 4, 4, 5, 5, 5, 5, 5, 6, // 1-10
6, 6, 6, 6, 7, 7, 7, 7, 7, 8, // 11-20
8, 8, 8, 8, 9, 9, 9, 9, 9, 10, // 21-30
10, 10, 10, 10, 11, 11, 11, 11, 11, 12, // 31-40
12, 12, 12, 12, 13, 13, 13, 13, 13, 14, // 41-50
14, 14, 14, 14, 14, 14, 14, 14, 14, 14, // 51-60
14, 14}; // 61-62
static uint8 bst_dmg[] = {99,
4, 4, 4, 4, 4, 5, 5, 5, 5, 5, // 1-10
5, 6, 6, 6, 6, 6, 6, 7, 7, 7, // 11-20
7, 7, 7, 8, 8, 8, 8, 8, 8, 9, // 21-30
9, 9, 9, 9, 9, 10, 10, 10, 10, 10, // 31-40
10, 11, 11, 11, 11, 11, 11, 12, 12}; // 41-49
if (GetClass() == MONK) {
if (CastToNPC()->GetEquipment(MaterialHands) == 10652 && GetLevel() > 50)
return 9;
else {
int Level = GetLevel();
if(Level > 65)
return 19;
else
return damage[Level];
}
int Level = GetLevel();
if (Level > 65)
return 19;
else
return damage[Level];
if (level > 62)
return 15;
return mnk_dmg[level];
} else if (GetClass() == BEASTLORD) {
if (level > 49)
return 13;
return bst_dmg[level];
}
return 2;
}
bool Bot::TryFinishingBlow(Mob *defender, SkillUseTypes skillinuse) {
@ -7012,8 +7025,7 @@ void Bot::SetAttackTimer() {
int speed = 0;
int delay = 36;
if (ItemToUse == nullptr) {
if ((GetClass() == MONK) || (GetClass() == BEASTLORD))
delay = GetMonkHandToHandDelay();
delay = GetHandToHandDelay();
} else {
delay = ItemToUse->Delay;
}

View File

@ -171,7 +171,7 @@ public:
uint16 BotGetSpellType(int spellslot) { return AIspells[spellslot].type; }
uint16 BotGetSpellPriority(int spellslot) { return AIspells[spellslot].priority; }
virtual float GetProcChances(float ProcBonus, uint16 hand);
virtual int GetMonkHandToHandDamage(void);
virtual int GetHandToHandDamage(void);
virtual bool TryFinishingBlow(Mob *defender, SkillUseTypes skillinuse);
virtual void DoRiposte(Mob* defender);
inline virtual int32 GetATK() const { return ATK + itembonuses.ATK + spellbonuses.ATK + ((GetSTR() + GetSkill(SkillOffense)) * 9 / 10); }

View File

@ -1023,14 +1023,14 @@ int Lua_Mob::GetHaste() {
return self->GetHaste();
}
int Lua_Mob::GetMonkHandToHandDamage() {
int Lua_Mob::GetHandToHandDamage() {
Lua_Safe_Call_Int();
return self->GetMonkHandToHandDamage();
return self->GetHandToHandDamage();
}
int Lua_Mob::GetMonkHandToHandDelay() {
int Lua_Mob::GetHandToHandDelay() {
Lua_Safe_Call_Int();
return self->GetMonkHandToHandDelay();
return self->GetHandToHandDelay();
}
void Lua_Mob::Mesmerize() {
@ -2165,8 +2165,8 @@ luabind::scope lua_register_mob() {
.def("GetInvul", (bool(Lua_Mob::*)(void))&Lua_Mob::GetInvul)
.def("SetExtraHaste", (void(Lua_Mob::*)(int))&Lua_Mob::SetExtraHaste)
.def("GetHaste", (int(Lua_Mob::*)(void))&Lua_Mob::GetHaste)
.def("GetMonkHandToHandDamage", (int(Lua_Mob::*)(void))&Lua_Mob::GetMonkHandToHandDamage)
.def("GetMonkHandToHandDelay", (int(Lua_Mob::*)(void))&Lua_Mob::GetMonkHandToHandDelay)
.def("GetHandToHandDamage", (int(Lua_Mob::*)(void))&Lua_Mob::GetHandToHandDamage)
.def("GetHandToHandDelay", (int(Lua_Mob::*)(void))&Lua_Mob::GetHandToHandDelay)
.def("Mesmerize", (void(Lua_Mob::*)(void))&Lua_Mob::Mesmerize)
.def("IsMezzed", (bool(Lua_Mob::*)(void))&Lua_Mob::IsMezzed)
.def("IsEnraged", (bool(Lua_Mob::*)(void))&Lua_Mob::IsEnraged)

View File

@ -217,8 +217,8 @@ public:
bool GetInvul();
void SetExtraHaste(int haste);
int GetHaste();
int GetMonkHandToHandDamage();
int GetMonkHandToHandDelay();
int GetHandToHandDamage();
int GetHandToHandDelay();
void Mesmerize();
bool IsMezzed();
bool IsEnraged();

View File

@ -756,7 +756,7 @@ public:
uint8 GetWeaponDamageBonus(const Item_Struct* weapon, bool offhand = false);
uint16 GetDamageTable(SkillUseTypes skillinuse);
virtual int GetMonkHandToHandDamage(void);
virtual int GetHandToHandDamage(void);
bool CanThisClassDoubleAttack(void) const;
bool CanThisClassTripleAttack() const;
@ -766,7 +766,7 @@ public:
bool CanThisClassParry(void) const;
bool CanThisClassBlock(void) const;
int GetMonkHandToHandDelay(void);
int GetHandToHandDelay(void);
uint32 GetClassLevelFactor();
void Mesmerize();
inline bool IsMezzed() const { return mezzed; }

View File

@ -4721,12 +4721,12 @@ XS(XS_Mob_GetHaste)
XSRETURN(1);
}
XS(XS_Mob_GetMonkHandToHandDamage); /* prototype to pass -Wmissing-prototypes */
XS(XS_Mob_GetMonkHandToHandDamage)
XS(XS_Mob_GetHandToHandDamage); /* prototype to pass -Wmissing-prototypes */
XS(XS_Mob_GetHandToHandDamage)
{
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: Mob::GetMonkHandToHandDamage(THIS)");
Perl_croak(aTHX_ "Usage: Mob::GetHandToHandDamage(THIS)");
{
Mob * THIS;
int RETVAL;
@ -4741,7 +4741,7 @@ XS(XS_Mob_GetMonkHandToHandDamage)
if(THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetMonkHandToHandDamage();
RETVAL = THIS->GetHandToHandDamage();
XSprePUSH; PUSHi((IV)RETVAL);
}
XSRETURN(1);
@ -4877,12 +4877,12 @@ XS(XS_Mob_CanThisClassParry)
XSRETURN(1);
}
XS(XS_Mob_GetMonkHandToHandDelay); /* prototype to pass -Wmissing-prototypes */
XS(XS_Mob_GetMonkHandToHandDelay)
XS(XS_Mob_GetHandToHandDelay); /* prototype to pass -Wmissing-prototypes */
XS(XS_Mob_GetHandToHandDelay)
{
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: Mob::GetMonkHandToHandDelay(THIS)");
Perl_croak(aTHX_ "Usage: Mob::GetHandToHandDelay(THIS)");
{
Mob * THIS;
int RETVAL;
@ -4897,7 +4897,7 @@ XS(XS_Mob_GetMonkHandToHandDelay)
if(THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetMonkHandToHandDelay();
RETVAL = THIS->GetHandToHandDelay();
XSprePUSH; PUSHi((IV)RETVAL);
}
XSRETURN(1);
@ -9192,13 +9192,13 @@ XS(boot_Mob)
newXSproto(strcpy(buf, "GetInvul"), XS_Mob_GetInvul, file, "$");
newXSproto(strcpy(buf, "SetExtraHaste"), XS_Mob_SetExtraHaste, file, "$$");
newXSproto(strcpy(buf, "GetHaste"), XS_Mob_GetHaste, file, "$");
newXSproto(strcpy(buf, "GetMonkHandToHandDamage"), XS_Mob_GetMonkHandToHandDamage, file, "$");
newXSproto(strcpy(buf, "GetHandToHandDamage"), XS_Mob_GetHandToHandDamage, file, "$");
newXSproto(strcpy(buf, "CanThisClassDoubleAttack"), XS_Mob_CanThisClassDoubleAttack, file, "$");
newXSproto(strcpy(buf, "CanThisClassDualWield"), XS_Mob_CanThisClassDualWield, file, "$");
newXSproto(strcpy(buf, "CanThisClassRiposte"), XS_Mob_CanThisClassRiposte, file, "$");
newXSproto(strcpy(buf, "CanThisClassDodge"), XS_Mob_CanThisClassDodge, file, "$");
newXSproto(strcpy(buf, "CanThisClassParry"), XS_Mob_CanThisClassParry, file, "$");
newXSproto(strcpy(buf, "GetMonkHandToHandDelay"), XS_Mob_GetMonkHandToHandDelay, file, "$");
newXSproto(strcpy(buf, "GetHandToHandDelay"), XS_Mob_GetHandToHandDelay, file, "$");
newXSproto(strcpy(buf, "GetClassLevelFactor"), XS_Mob_GetClassLevelFactor, file, "$");
newXSproto(strcpy(buf, "Mesmerize"), XS_Mob_Mesmerize, file, "$");
newXSproto(strcpy(buf, "IsMezzed"), XS_Mob_IsMezzed, file, "$");