diff --git a/zone/attack.cpp b/zone/attack.cpp index f57a54cfb..5abd3efb6 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -317,8 +317,9 @@ bool Mob::CheckHitChance(Mob* other, DamageHitInfo &hit) Mob *defender = this; Log(Logs::Detail, Logs::Attack, "CheckHitChance(%s) attacked by %s", defender->GetName(), attacker->GetName()); - if (defender->IsClient() && defender->CastToClient()->IsSitting()) + if ((defender->IsClient() || defender->IsBot() || defender->IsMerc()) && defender->IsSitting()) { return true; + } auto avoidance = defender->GetTotalDefense(); if (avoidance == -1) // some sort of auto avoid disc @@ -1001,8 +1002,9 @@ double Mob::RollD20(int offense, int mitigation) 1.6, 1.7, 1.8, 1.9, 2.0 }; - if (IsClient() && CastToClient()->IsSitting()) + if ((IsClient() || IsBot() || IsMerc()) && IsSitting()) { return mods[19]; + } auto atk_roll = zone->random.Roll0(offense + 5); auto def_roll = zone->random.Roll0(mitigation + 5); diff --git a/zone/bot.cpp b/zone/bot.cpp index 7a0bf77b0..e0bd69dea 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -571,7 +571,7 @@ void Bot::Stand() { SetAppearance(eaStanding); } -bool Bot::IsSitting() { +bool Bot::IsSitting() const { bool result = false; if(GetAppearance() == eaSitting && !IsMoving()) result = true; diff --git a/zone/bot.h b/zone/bot.h index fb3b84abc..39c505417 100644 --- a/zone/bot.h +++ b/zone/bot.h @@ -219,7 +219,7 @@ public: void ChangeBotArcherWeapons(bool isArcher); void Sit(); void Stand(); - bool IsSitting(); + bool IsSitting() const override; bool IsStanding(); int GetWalkspeed() const override { return (int)((float)_GetWalkSpeed() * 1.785714285f); } // 1.25 / 0.7 = 1.7857142857142857142857142857143 int GetRunspeed() const override { return (int)((float)_GetRunSpeed() * 1.785714285f); } diff --git a/zone/client.h b/zone/client.h index 6e7de9d6f..f6b384117 100644 --- a/zone/client.h +++ b/zone/client.h @@ -841,9 +841,9 @@ public: void Fling(float value, float target_x, float target_y, float target_z, bool ignore_los = false, bool clip_through_walls = false, bool calculate_speed = false); - inline bool IsStanding() const {return (playeraction == 0);} - inline bool IsSitting() const {return (playeraction == 1);} - inline bool IsCrouching() const {return (playeraction == 2);} + inline bool IsStanding() const { return (playeraction == 0); } + inline bool IsSitting() const override { return (playeraction == 1); } + inline bool IsCrouching() const { return (playeraction == 2); } inline bool IsBecomeNPC() const { return npcflag; } inline uint8 GetBecomeNPCLevel() const { return npclevel; } inline void SetBecomeNPC(bool flag) { npcflag = flag; } diff --git a/zone/merc.cpp b/zone/merc.cpp index 203bb33a4..750c104c1 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -4292,7 +4292,7 @@ void Merc::Stand() { SetAppearance(eaStanding); } -bool Merc::IsSitting() { +bool Merc::IsSitting() const { bool result = false; if(GetAppearance() == eaSitting && !IsMoving()) diff --git a/zone/merc.h b/zone/merc.h index 9a6c73973..9c6a7b4ae 100644 --- a/zone/merc.h +++ b/zone/merc.h @@ -257,7 +257,7 @@ public: void Sit(); void Stand(); - bool IsSitting(); + bool IsSitting() const override; bool IsStanding(); // Merc-specific functions diff --git a/zone/mob.h b/zone/mob.h index 66a6ac225..6feb58f43 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -657,7 +657,11 @@ public: inline int32 GetHeroicStrikethrough() const { return heroic_strikethrough; } inline const bool GetKeepsSoldItems() const { return keeps_sold_items; } inline void SetKeepsSoldItems(bool in_keeps_sold_items) { keeps_sold_items = in_keeps_sold_items; } + + virtual bool IsSitting() const { return false; } + int CalcRecommendedLevelBonus(uint8 level, uint8 reclevel, int basestat); + void CopyHateList(Mob* to); //Group