Allow base damage of 0 (ex slam) min damage done to 1

This commit is contained in:
Michael Cook (mackal)
2017-03-15 13:22:45 -04:00
parent 2d24237aac
commit d04d6750a2
5 changed files with 46 additions and 16 deletions
+10 -8
View File
@@ -866,11 +866,9 @@ void Mob::MeleeMitigation(Mob *attacker, DamageHitInfo &hit, ExtraAttackOptions
auto roll = RollD20(hit.offense, mitigation);
// +0.5 for rounding
hit.damage_done = static_cast<int>(roll * static_cast<double>(hit.base_damage) + 0.5);
// +0.5 for rounding, min to 1 dmg
hit.damage_done = std::max(static_cast<int>(roll * static_cast<double>(hit.base_damage) + 0.5), 1);
if (hit.damage_done < 0)
hit.damage_done = 0;
Log.Out(Logs::Detail, Logs::Attack, "mitigation %d vs offense %d. base %d rolled %f damage %d", mitigation, hit.offense, hit.base_damage, roll, hit.damage_done);
}
@@ -1207,7 +1205,7 @@ void Mob::DoAttack(Mob *other, DamageHitInfo &hit, ExtraAttackOptions *opts)
if (strike_through && zone->random.Roll(strike_through)) {
Message_StringID(MT_StrikeThrough,
STRIKETHROUGH_STRING); // You strike through your opponents defenses!
hit.damage_done = 0; // set to zero, we will check this to continue
hit.damage_done = 1; // set to one, we will check this to continue
}
// I'm pretty sure you can riposte a riposte
if (hit.damage_done == DMG_RIPOSTED) {
@@ -1218,7 +1216,7 @@ void Mob::DoAttack(Mob *other, DamageHitInfo &hit, ExtraAttackOptions *opts)
Log.Out(Logs::Detail, Logs::Combat, "Avoided/strikethrough damage with code %d", hit.damage_done);
}
if (hit.damage_done == 0) {
if (hit.damage_done >= 0) {
if (other->CheckHitChance(this, hit)) {
other->MeleeMitigation(this, hit, opts);
if (hit.damage_done > 0) {
@@ -1297,7 +1295,7 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b
Log.Out(Logs::Detail, Logs::Combat, "Attacking with %s in slot %d using skill %d", weapon?weapon->GetItem()->Name:"Fist", Hand, my_hit.skill);
// Now figure out damage
my_hit.damage_done = 0;
my_hit.damage_done = 1;
my_hit.min_damage = 0;
uint8 mylevel = GetLevel() ? GetLevel() : 1;
uint32 hate = 0;
@@ -1784,7 +1782,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool
DamageHitInfo my_hit;
my_hit.skill = EQEmu::skills::SkillHandtoHand;
my_hit.hand = Hand;
my_hit.damage_done = 0;
my_hit.damage_done = 1;
if (Hand == EQEmu::inventory::slotPrimary) {
my_hit.skill = static_cast<EQEmu::skills::SkillType>(GetPrimSkill());
OffHandAtk(false);
@@ -4465,6 +4463,10 @@ void Mob::ApplyDamageTable(DamageHitInfo &hit)
if (hit.offense < 115)
return;
// things that come out to 1 dmg seem to skip this (ex non-bash slam classes)
if (hit.damage_done < 2)
return;
auto &damage_table = GetDamageTable();
if (zone->random.Roll(damage_table.chance))