mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 01:11:29 +00:00
[Bots/Mercs] Add 100% Hit chance if sitting while attacked. (#2839)
* [BOT] Add 100% Hit chance if sitting while attacked. * [BOT] Add 100% Hit chance if sitting while attacked. * Add Mercs correctly * Missed usage of IsSitting() in Mob::RollD20
This commit is contained in:
parent
158396937a
commit
b0d1dc5f04
@ -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);
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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); }
|
||||
|
||||
@ -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; }
|
||||
|
||||
@ -4292,7 +4292,7 @@ void Merc::Stand() {
|
||||
SetAppearance(eaStanding);
|
||||
}
|
||||
|
||||
bool Merc::IsSitting() {
|
||||
bool Merc::IsSitting() const {
|
||||
bool result = false;
|
||||
|
||||
if(GetAppearance() == eaSitting && !IsMoving())
|
||||
|
||||
@ -257,7 +257,7 @@ public:
|
||||
|
||||
void Sit();
|
||||
void Stand();
|
||||
bool IsSitting();
|
||||
bool IsSitting() const override;
|
||||
bool IsStanding();
|
||||
|
||||
// Merc-specific functions
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user