1
This commit is contained in:
parent
dae74c7f05
commit
cc02ded2c3
@ -487,11 +487,11 @@ void BattleDataContext::CalcBattleStat(struct PlayerStats* stats)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float BattleDataContext::CalcDmg(Creature* target, Bullet* bullet)
|
float BattleDataContext::CalcDmg(Creature* target, IBullet* bullet)
|
||||||
{
|
{
|
||||||
float total_atk = GetTotalAtk(bullet);
|
float total_atk = GetTotalAtk(bullet);
|
||||||
float normal_dmg = total_atk * (1 - target->GetBattleContext()->GetDef() / 1000);
|
float normal_dmg = total_atk * (1 - target->GetBattleContext()->GetDef() / 1000);
|
||||||
if (bullet->strengthen_wall) {
|
if (bullet->GetStrengthenWall()) {
|
||||||
normal_dmg *= 1.2f;
|
normal_dmg *= 1.2f;
|
||||||
}
|
}
|
||||||
float crit = IsCrit(bullet) ? GetCritRate(bullet) : 0;
|
float crit = IsCrit(bullet) ? GetCritRate(bullet) : 0;
|
||||||
@ -500,7 +500,7 @@ float BattleDataContext::CalcDmg(Creature* target, Bullet* bullet)
|
|||||||
finaly_dmg *= (1 + target->GetAbility()->GetDmgAddition());
|
finaly_dmg *= (1 + target->GetAbility()->GetDmgAddition());
|
||||||
finaly_dmg *= (1 - target->GetAbility()->GetDmgRuduce());
|
finaly_dmg *= (1 - target->GetAbility()->GetDmgRuduce());
|
||||||
#if 1
|
#if 1
|
||||||
finaly_dmg *= (1 + bullet->strengthen_wall);
|
finaly_dmg *= (1 + bullet->GetStrengthenWall());
|
||||||
#endif
|
#endif
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (owner_.Get()->IsPlayer()) {
|
if (owner_.Get()->IsPlayer()) {
|
||||||
@ -521,7 +521,7 @@ float BattleDataContext::CalcDmg(Creature* target, Bullet* bullet)
|
|||||||
return finaly_dmg;
|
return finaly_dmg;
|
||||||
}
|
}
|
||||||
|
|
||||||
float BattleDataContext::CalcDmg(Obstacle* target, Bullet* bullet)
|
float BattleDataContext::CalcDmg(Obstacle* target, IBullet* bullet)
|
||||||
{
|
{
|
||||||
float total_atk = GetTotalAtk(bullet);
|
float total_atk = GetTotalAtk(bullet);
|
||||||
float normal_dmg = total_atk * (1 - 0 / 1000);
|
float normal_dmg = total_atk * (1 - 0 / 1000);
|
||||||
@ -563,7 +563,7 @@ float BattleDataContext::CalcDmg(Explosion* e)
|
|||||||
return finaly_dmg;
|
return finaly_dmg;
|
||||||
}
|
}
|
||||||
|
|
||||||
float BattleDataContext::GetTotalAtk(Bullet* bullet)
|
float BattleDataContext::GetTotalAtk(IBullet* bullet)
|
||||||
{
|
{
|
||||||
float total_atk = (GetHeroTotalAtk() / 100 + 1) * GetWeaponAtk(bullet);
|
float total_atk = (GetHeroTotalAtk() / 100 + 1) * GetWeaponAtk(bullet);
|
||||||
return total_atk;
|
return total_atk;
|
||||||
@ -589,18 +589,18 @@ float BattleDataContext::GetHeroTotalAtk()
|
|||||||
return hero_ability_->GetAtk();
|
return hero_ability_->GetAtk();
|
||||||
}
|
}
|
||||||
|
|
||||||
float BattleDataContext::GetWeaponAtk(Bullet* bullet)
|
float BattleDataContext::GetWeaponAtk(IBullet* bullet)
|
||||||
{
|
{
|
||||||
auto weapon = GetWeaponByUniId(bullet->weapon_uniid);
|
auto weapon = GetWeaponByUniId(bullet->GetWeaponUniId());
|
||||||
if (weapon) {
|
if (weapon) {
|
||||||
return weapon->GetAtk();
|
return weapon->GetAtk();
|
||||||
}
|
}
|
||||||
if (bullet->skill_meta && bullet->skill_meta->number_meta) {
|
if (bullet->GetSkillMeta() && bullet->GetSkillMeta()->number_meta) {
|
||||||
switch (bullet->skill_meta->GetMagicId()) {
|
switch (bullet->GetSkillMeta()->GetMagicId()) {
|
||||||
case MAGIC_HLYZ:
|
case MAGIC_HLYZ:
|
||||||
case MAGIC_HJHX:
|
case MAGIC_HJHX:
|
||||||
{
|
{
|
||||||
return bullet->skill_meta->number_meta->float_ratio;
|
return bullet->GetSkillMeta()->number_meta->float_ratio;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -609,28 +609,28 @@ float BattleDataContext::GetWeaponAtk(Bullet* bullet)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return bullet->gun_meta->i->atk();
|
return bullet->GetGunMeta()->i->atk();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BattleDataContext::IsCrit(Bullet* bullet)
|
bool BattleDataContext::IsCrit(IBullet* bullet)
|
||||||
{
|
{
|
||||||
int rnd = a8::RandEx(0, 1000 - 1);
|
int rnd = a8::RandEx(0, 1000 - 1);
|
||||||
return GetCrit(bullet) > rnd;;
|
return GetCrit(bullet) > rnd;;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BattleDataContext::IsDodge(Bullet* bullet)
|
bool BattleDataContext::IsDodge(IBullet* bullet)
|
||||||
{
|
{
|
||||||
int rnd = a8::RandEx(0, 1000 - 1);
|
int rnd = a8::RandEx(0, 1000 - 1);
|
||||||
return GetDodge(bullet) > rnd;;
|
return GetDodge(bullet) > rnd;;
|
||||||
}
|
}
|
||||||
|
|
||||||
float BattleDataContext::GetCritRate(Bullet* bullet)
|
float BattleDataContext::GetCritRate(IBullet* bullet)
|
||||||
{
|
{
|
||||||
auto weapon = GetWeaponByUniId(bullet ? bullet->weapon_uniid : 0);
|
auto weapon = GetWeaponByUniId(bullet ? bullet->GetWeaponUniId() : 0);
|
||||||
return hero_ability_->GetCritAtkRatio() + (weapon ? weapon->GetCritAtkRatio() : 0);
|
return hero_ability_->GetCritAtkRatio() + (weapon ? weapon->GetCritAtkRatio() : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
float BattleDataContext::GetDodgeRuduce(Bullet* bullet)
|
float BattleDataContext::GetDodgeRuduce(IBullet* bullet)
|
||||||
{
|
{
|
||||||
return hero_ability_->GetDodgeDamageRuduce();
|
return hero_ability_->GetDodgeDamageRuduce();
|
||||||
}
|
}
|
||||||
@ -712,13 +712,13 @@ void BattleDataContext::GetSkillList(std::vector<int>& skill_list)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float BattleDataContext::GetCrit(Bullet* bullet)
|
float BattleDataContext::GetCrit(IBullet* bullet)
|
||||||
{
|
{
|
||||||
auto weapon = GetWeaponByUniId(bullet ? bullet->weapon_uniid : 0);
|
auto weapon = GetWeaponByUniId(bullet ? bullet->GetWeaponUniId() : 0);
|
||||||
return hero_ability_->GetCritAtk() + (weapon ? weapon->GetCritAtk() : 0);
|
return hero_ability_->GetCritAtk() + (weapon ? weapon->GetCritAtk() : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
float BattleDataContext::GetDodge(Bullet* bullet)
|
float BattleDataContext::GetDodge(IBullet* bullet)
|
||||||
{
|
{
|
||||||
return hero_ability_->GetDodge();
|
return hero_ability_->GetDodge();
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,6 @@ namespace MetaData
|
|||||||
}
|
}
|
||||||
|
|
||||||
class Creature;
|
class Creature;
|
||||||
class Bullet;
|
|
||||||
class Obstacle;
|
class Obstacle;
|
||||||
class Explosion;
|
class Explosion;
|
||||||
class Weapon;
|
class Weapon;
|
||||||
@ -50,8 +49,8 @@ struct BattleDataContext
|
|||||||
|
|
||||||
void CalcBattleStat(struct PlayerStats* stats);
|
void CalcBattleStat(struct PlayerStats* stats);
|
||||||
|
|
||||||
float CalcDmg(Creature* target, Bullet* bullet);
|
float CalcDmg(Creature* target, IBullet* bullet);
|
||||||
float CalcDmg(Obstacle* target, Bullet* bullet);
|
float CalcDmg(Obstacle* target, IBullet* bullet);
|
||||||
float CalcDmg(Explosion* e);
|
float CalcDmg(Explosion* e);
|
||||||
|
|
||||||
float GetHP();
|
float GetHP();
|
||||||
@ -74,14 +73,14 @@ struct BattleDataContext
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void Clear();
|
void Clear();
|
||||||
float GetTotalAtk(Bullet* bullet);
|
float GetTotalAtk(IBullet* bullet);
|
||||||
float GetWeaponAtk(Bullet* bullet);
|
float GetWeaponAtk(IBullet* bullet);
|
||||||
bool IsCrit(Bullet* bullet);
|
bool IsCrit(IBullet* bullet);
|
||||||
float GetCrit(Bullet* bullet);
|
float GetCrit(IBullet* bullet);
|
||||||
float GetCritRate(Bullet* bullet);
|
float GetCritRate(IBullet* bullet);
|
||||||
bool IsDodge(Bullet* bullet);
|
bool IsDodge(IBullet* bullet);
|
||||||
float GetDodge(Bullet* bullet);
|
float GetDodge(IBullet* bullet);
|
||||||
float GetDodgeRuduce(Bullet* bullet);
|
float GetDodgeRuduce(IBullet* bullet);
|
||||||
std::shared_ptr<WeaponAbility> GetWeaponByUniId(long long weapon_uniid);
|
std::shared_ptr<WeaponAbility> GetWeaponByUniId(long long weapon_uniid);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -17,7 +17,7 @@ class CircleCollider;
|
|||||||
class MovementComponent;
|
class MovementComponent;
|
||||||
class Car;
|
class Car;
|
||||||
class Ability;
|
class Ability;
|
||||||
class Bullet : public MoveableEntity
|
class Bullet : public MoveableEntity, public IBullet
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
long long weapon_uniid = 0;
|
long long weapon_uniid = 0;
|
||||||
@ -55,6 +55,11 @@ class Bullet : public MoveableEntity
|
|||||||
protected:
|
protected:
|
||||||
Bullet();
|
Bullet();
|
||||||
|
|
||||||
|
virtual float GetStrengthenWall() override { return strengthen_wall; };
|
||||||
|
virtual long long GetWeaponUniId() override { return weapon_uniid; };
|
||||||
|
virtual MetaData::Skill* GetSkillMeta() override {return skill_meta; };
|
||||||
|
virtual MetaData::Equip* GetGunMeta() override { return gun_meta; };
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void ProcBomb();
|
void ProcBomb();
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
namespace MetaData
|
namespace MetaData
|
||||||
{
|
{
|
||||||
struct Equip;
|
struct Equip;
|
||||||
|
struct Skill;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace cs
|
namespace cs
|
||||||
@ -19,3 +20,12 @@ struct AddItemDTO
|
|||||||
MetaData::Equip* item_meta = nullptr;
|
MetaData::Equip* item_meta = nullptr;
|
||||||
bool handled = false;
|
bool handled = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class IBullet
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual float GetStrengthenWall() = 0;
|
||||||
|
virtual long long GetWeaponUniId() = 0;
|
||||||
|
virtual MetaData::Skill* GetSkillMeta() = 0;
|
||||||
|
virtual MetaData::Equip* GetGunMeta() = 0;
|
||||||
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user