This commit is contained in:
aozhiwei 2022-09-06 10:48:58 +08:00
parent 0d4335cd4e
commit 35ad701382
2 changed files with 23 additions and 0 deletions

View File

@ -2,10 +2,19 @@
#include "attr.h" #include "attr.h"
#include "creature.h"
float Attr::CalcDmg(Creature* target, int weapon_uniid) float Attr::CalcDmg(Creature* target, int weapon_uniid)
{ {
float total_atk = (GetTotalAtk() / 100 + 1) * GetWeaponAtk(); float total_atk = (GetTotalAtk() / 100 + 1) * GetWeaponAtk();
float normal_dmg = total_atk * (1 - target->attr->GetDef() / 1000); float normal_dmg = total_atk * (1 - target->attr->GetDef() / 1000);
float crit = IsCrit() ? 1 + GetCritRate() : 1;
float dodge = IsDodge() ? 1 + GetDodgeRate() : 1;
}
float Attr::GetTotalAtk()
{
return 0;
} }
float Attr::GetDef() float Attr::GetDef()
@ -33,3 +42,14 @@ bool Attr::IsDodge()
{ {
return true; return true;
} }
float Attr::GetCritRate()
{
return 0;
}
float Attr::GetDodgeRate()
{
return 0;
}

View File

@ -21,10 +21,13 @@ class Attr
float GetDef(); float GetDef();
private: private:
float GetTotalAtk();
float GetHeroTotalAtk(); float GetHeroTotalAtk();
float GetWeaponAtk(); float GetWeaponAtk();
bool IsCrit(); bool IsCrit();
float GetCritRate();
bool IsDodge(); bool IsDodge();
float GetDodgeRate();
private: private:
CreatureWeakPtr owner_; CreatureWeakPtr owner_;