1
This commit is contained in:
parent
2a12f430f8
commit
94ee6ef129
@ -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;
|
||||
}
|
||||
|
@ -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_;
|
||||
};
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user