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

View File

@ -148,6 +148,33 @@ int32 EQEmu::skills::GetBaseDamage(SkillType skill)
}
}
bool EQEmu::skills::IsMeleeDmg(SkillType skill)
{
switch (skill) {
case Skill1HBlunt:
case Skill1HSlashing:
case Skill2HBlunt:
case Skill2HSlashing:
case SkillBackstab:
case SkillBash:
case SkillDragonPunch:
case SkillEagleStrike:
case SkillFlyingKick:
case SkillHandtoHand:
case SkillKick:
case Skill1HPiercing:
case SkillRiposte:
case SkillRoundKick:
case SkillThrowing:
case SkillTigerClaw:
case SkillFrenzy:
case Skill2HPiercing:
return true;
default:
return false;
}
}
const std::map<EQEmu::skills::SkillType, std::string>& EQEmu::skills::GetSkillTypeMap()
{
/* VS2013 code

View File

@ -167,6 +167,7 @@ namespace EQEmu
bool IsBardInstrumentSkill(SkillType skill);
bool IsCastingSkill(SkillType skill);
int32 GetBaseDamage(SkillType skill);
bool IsMeleeDmg(SkillType skill);
extern const std::map<SkillType, std::string>& GetSkillTypeMap();

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))

View File

@ -3919,9 +3919,9 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b
DamageHitInfo my_hit;
AttackAnimation(my_hit.skill, Hand, weapon);
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;
@ -5046,7 +5046,7 @@ void Bot::DoSpecialAttackDamage(Mob *who, EQEmu::skills::SkillType skill, int32
DamageHitInfo my_hit;
my_hit.base_damage = max_damage;
my_hit.min_damage = min_damage;
my_hit.damage_done = 0;
my_hit.damage_done = 1;
my_hit.skill = skill;
my_hit.offense = offense(my_hit.skill);

View File

@ -142,7 +142,7 @@ void Mob::DoSpecialAttackDamage(Mob *who, EQEmu::skills::SkillType skill, int32
return;
DamageHitInfo my_hit;
my_hit.damage_done = 0;
my_hit.damage_done = 1; // min 1 dmg
my_hit.base_damage = base_damage;
my_hit.min_damage = min_damage;
my_hit.skill = skill;
@ -847,7 +847,7 @@ void Mob::DoArcheryAttackDmg(Mob *other, const EQEmu::ItemInstance *RangeWeapon,
DamageHitInfo my_hit;
my_hit.base_damage = MaxDmg;
my_hit.min_damage = 0;
my_hit.damage_done = 0;
my_hit.damage_done = 1;
my_hit.skill = EQEmu::skills::SkillArchery;
my_hit.offense = offense(my_hit.skill);
@ -1179,7 +1179,7 @@ void NPC::DoRangedAttackDmg(Mob* other, bool Launch, int16 damage_mod, int16 cha
DamageHitInfo my_hit;
my_hit.base_damage = MaxDmg;
my_hit.min_damage = MinDmg;
my_hit.damage_done = 0;
my_hit.damage_done = 1;
my_hit.skill = skill;
my_hit.offense = offense(my_hit.skill);
@ -1360,7 +1360,7 @@ void Mob::DoThrowingAttackDmg(Mob *other, const EQEmu::ItemInstance *RangeWeapon
DamageHitInfo my_hit;
my_hit.base_damage = WDmg;
my_hit.min_damage = 0;
my_hit.damage_done = 0;
my_hit.damage_done = 1;
my_hit.skill = EQEmu::skills::SkillThrowing;
my_hit.offense = offense(my_hit.skill);
@ -2117,7 +2117,7 @@ void Mob::DoMeleeSkillAttackDmg(Mob *other, uint16 weapon_damage, EQEmu::skills:
DamageHitInfo my_hit;
my_hit.base_damage = weapon_damage;
my_hit.min_damage = 0;
my_hit.damage_done = 0;
my_hit.damage_done = 1;
my_hit.skill = skillinuse;
my_hit.offense = offense(my_hit.skill);