This commit is contained in:
aozhiwei 2022-09-05 14:54:38 +08:00
parent 2a12f430f8
commit 94ee6ef129
3 changed files with 56 additions and 0 deletions

View File

@ -1,3 +1,35 @@
#include "precompile.h"
#include "attr.h"
float Attr::CalcDmg(Creature* target, int weapon_uniid)
{
float total_atk = (GetTotalAtk() / 100 + 1) * GetWeaponAtk();
float normal_dmg = total_atk * (1 - target->attr->GetDef() / 1000);
}
float Attr::GetDef()
{
return 0;
}
float Attr::GetHeroTotalAtk()
{
return 0;
}
float Attr::GetWeaponAtk()
{
return 0;
}
bool Attr::IsCrit()
{
return true;
}
bool Attr::IsDodge()
{
return true;
}

View File

@ -2,8 +2,30 @@
#include "weakptr.h"
/*
1
2
3(),()
4
=*1-
=*
*/
class Attr
{
public:
float CalcDmg(Creature* target, int weapon_uniid);
float GetDef();
private:
float GetHeroTotalAtk();
float GetWeaponAtk();
bool IsCrit();
bool IsDodge();
private:
CreatureWeakPtr owner_;
};

View File

@ -5,6 +5,7 @@
#include "trigger.h"
#include "ability.h"
#include "weapon.h"
#include "attr.h"
#include "cs_proto.pb.h"
@ -90,6 +91,7 @@ class Creature : public MoveableEntity
bool playing_skill = false;
int power_idx = -1;
int hold_shield_hp = 0;
Attr* attr = nullptr;
Weapon second_weapon;
a8::Vec2 context_pos;