[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:
Aeadoin
2023-02-06 22:30:33 -05:00
committed by GitHub
parent 158396937a
commit b0d1dc5f04
7 changed files with 15 additions and 9 deletions
+4 -2
View File
@@ -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);