1
This commit is contained in:
parent
876fb6e6fa
commit
e5f590b9d1
@ -1,5 +1,8 @@
|
|||||||
#include "precompile.h"
|
#include "precompile.h"
|
||||||
|
|
||||||
|
#include <glm/glm.hpp>
|
||||||
|
#include <glm/gtc/matrix_transform.hpp>
|
||||||
|
|
||||||
#include "android_agent.h"
|
#include "android_agent.h"
|
||||||
#include "android.h"
|
#include "android.h"
|
||||||
#include "room.h"
|
#include "room.h"
|
||||||
@ -7,6 +10,8 @@
|
|||||||
#include "trigger.h"
|
#include "trigger.h"
|
||||||
#include "glmhelper.h"
|
#include "glmhelper.h"
|
||||||
|
|
||||||
|
#include "mt/Robot.h"
|
||||||
|
|
||||||
AndroidAgent::AndroidAgent():BaseAgent()
|
AndroidAgent::AndroidAgent():BaseAgent()
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -108,7 +113,7 @@ behaviac::EBTStatus AndroidAgent::DoRandomShot()
|
|||||||
GetOwner()->SetAttackDir(dir);
|
GetOwner()->SetAttackDir(dir);
|
||||||
bool shot_ok = false;
|
bool shot_ok = false;
|
||||||
glm::vec3 shot_dir = dir;
|
glm::vec3 shot_dir = dir;
|
||||||
GetOwner()->Shot(shot_dir, shot_ok, 0, 0);
|
GetOwner()->Shot(AdjustShotDir(shot_dir), shot_ok, 0, 0);
|
||||||
|
|
||||||
auto context = A8_MAKE_SMART_ANON_STRUCT_SHARED
|
auto context = A8_MAKE_SMART_ANON_STRUCT_SHARED
|
||||||
(
|
(
|
||||||
@ -153,7 +158,7 @@ behaviac::EBTStatus AndroidAgent::DoRandomShot()
|
|||||||
bool shot_ok = false;
|
bool shot_ok = false;
|
||||||
glm::vec3 shot_dir = GetOwner()->GetAttackDir();
|
glm::vec3 shot_dir = GetOwner()->GetAttackDir();
|
||||||
GetOwner()->shot_hold = true;
|
GetOwner()->shot_hold = true;
|
||||||
GetOwner()->Shot(shot_dir, shot_ok, 0, 0);
|
GetOwner()->Shot(AdjustShotDir(shot_dir), shot_ok, 0, 0);
|
||||||
|
|
||||||
return behaviac::BT_RUNNING;
|
return behaviac::BT_RUNNING;
|
||||||
}
|
}
|
||||||
@ -188,7 +193,7 @@ behaviac::EBTStatus AndroidAgent::DoAttack()
|
|||||||
GetOwner()->SetAttackDir(dir);
|
GetOwner()->SetAttackDir(dir);
|
||||||
bool shot_ok = false;
|
bool shot_ok = false;
|
||||||
glm::vec3 shot_dir = dir;
|
glm::vec3 shot_dir = dir;
|
||||||
GetOwner()->Shot(shot_dir, shot_ok, 0, 0);
|
GetOwner()->Shot(AdjustShotDir(shot_dir), shot_ok, 0, 0);
|
||||||
|
|
||||||
|
|
||||||
auto context = A8_MAKE_SMART_ANON_STRUCT_SHARED
|
auto context = A8_MAKE_SMART_ANON_STRUCT_SHARED
|
||||||
@ -212,7 +217,7 @@ behaviac::EBTStatus AndroidAgent::DoAttack()
|
|||||||
bool shot_ok = false;
|
bool shot_ok = false;
|
||||||
glm::vec3 shot_dir = GetOwner()->GetAttackDir();
|
glm::vec3 shot_dir = GetOwner()->GetAttackDir();
|
||||||
GetOwner()->shot_hold = true;
|
GetOwner()->shot_hold = true;
|
||||||
GetOwner()->Shot(shot_dir, shot_ok, 0, 0);
|
GetOwner()->Shot(AdjustShotDir(shot_dir), shot_ok, 0, 0);
|
||||||
|
|
||||||
return behaviac::BT_RUNNING;
|
return behaviac::BT_RUNNING;
|
||||||
}
|
}
|
||||||
@ -313,8 +318,8 @@ behaviac::EBTStatus AndroidAgent::DoPursuit()
|
|||||||
bool shot_ok = false;
|
bool shot_ok = false;
|
||||||
glm::vec3 shot_dir = dir;
|
glm::vec3 shot_dir = dir;
|
||||||
GetOwner()->shot_hold = true;
|
GetOwner()->shot_hold = true;
|
||||||
GetOwner()->SetAttackDir(dir);
|
GetOwner()->SetAttackDir(shot_dir);
|
||||||
GetOwner()->Shot(shot_dir, shot_ok, 0, 0);
|
GetOwner()->Shot(AdjustShotDir(shot_dir), shot_ok, 0, 0);
|
||||||
} else {
|
} else {
|
||||||
GetOwner()->shot_hold = false;
|
GetOwner()->shot_hold = false;
|
||||||
}
|
}
|
||||||
@ -329,3 +334,13 @@ behaviac::EBTStatus AndroidAgent::DoPursuit()
|
|||||||
};
|
};
|
||||||
return StartCoroutine(co);
|
return StartCoroutine(co);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
glm::vec3& AndroidAgent::AdjustShotDir(glm::vec3& shot_dir)
|
||||||
|
{
|
||||||
|
if (GetOwner()->IsAndroid()) {
|
||||||
|
float angle_offset = GetOwner()->AsAndroid()->robot_meta->RandBulletAngleOfsset();
|
||||||
|
GlmHelper::RotateY(shot_dir, glm::radians(angle_offset));
|
||||||
|
GetOwner()->SetAttackDir(shot_dir);
|
||||||
|
}
|
||||||
|
return shot_dir;
|
||||||
|
}
|
||||||
|
@ -19,6 +19,9 @@ public:
|
|||||||
behaviac::EBTStatus DoAttack();
|
behaviac::EBTStatus DoAttack();
|
||||||
behaviac::EBTStatus DoPursuit();
|
behaviac::EBTStatus DoPursuit();
|
||||||
|
|
||||||
|
private:
|
||||||
|
glm::vec3& AdjustShotDir(glm::vec3& shot_dir);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Android* owner_ = nullptr;
|
Android* owner_ = nullptr;
|
||||||
};
|
};
|
||||||
|
@ -64,6 +64,7 @@ class DelayAddBuffHandle;
|
|||||||
class Movement;
|
class Movement;
|
||||||
class Player;
|
class Player;
|
||||||
class GunGrasp;
|
class GunGrasp;
|
||||||
|
class Android;
|
||||||
class Creature : public MoveableEntity
|
class Creature : public MoveableEntity
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -228,6 +229,7 @@ class Creature : public MoveableEntity
|
|||||||
bool IsCar() const;
|
bool IsCar() const;
|
||||||
bool IsHero() const { return IsEntityType(ET_Hero); };
|
bool IsHero() const { return IsEntityType(ET_Hero); };
|
||||||
Human* AsHuman() { return IsHuman() ? (Human*)this : nullptr; };
|
Human* AsHuman() { return IsHuman() ? (Human*)this : nullptr; };
|
||||||
|
Android* AsAndroid() { return IsAndroid() ? (Android*)this : nullptr; };
|
||||||
Player* AsPlayer() { return IsPlayer() ? (Player*)this : nullptr; };
|
Player* AsPlayer() { return IsPlayer() ? (Player*)this : nullptr; };
|
||||||
Car* AsCar() { return IsCar() ? (Car*)this : nullptr; };
|
Car* AsCar() { return IsCar() ? (Car*)this : nullptr; };
|
||||||
Hero* AsHero() { return IsHero() ? (Hero*)this : nullptr; };
|
Hero* AsHero() { return IsHero() ? (Hero*)this : nullptr; };
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
#include "roommgr.h"
|
#include "roommgr.h"
|
||||||
#include "ability.h"
|
#include "ability.h"
|
||||||
#include "stats.h"
|
#include "stats.h"
|
||||||
|
#include "android.h"
|
||||||
|
|
||||||
#include "buff/distance_dmg_addition.h"
|
#include "buff/distance_dmg_addition.h"
|
||||||
|
|
||||||
@ -29,6 +30,7 @@
|
|||||||
#include "mt/Skill.h"
|
#include "mt/Skill.h"
|
||||||
#include "mt/SkillNumber.h"
|
#include "mt/SkillNumber.h"
|
||||||
#include "mt/FormulaPvp.h"
|
#include "mt/FormulaPvp.h"
|
||||||
|
#include "mt/Robot.h"
|
||||||
|
|
||||||
#include "attrhelper.h"
|
#include "attrhelper.h"
|
||||||
|
|
||||||
@ -657,6 +659,12 @@ float BattleDataContext::CalcDmg(Creature* target, IBullet* bullet)
|
|||||||
finaly_dmg *= (1 + dmg_addition); //连加
|
finaly_dmg *= (1 + dmg_addition); //连加
|
||||||
finaly_dmg *= (1 - target->GetAbility()->GetAttrRuduce(kHVAT_Dmg)); //(1-减免) 连乘
|
finaly_dmg *= (1 - target->GetAbility()->GetAttrRuduce(kHVAT_Dmg)); //(1-减免) 连乘
|
||||||
|
|
||||||
|
#if 1
|
||||||
|
if (owner_.Get()->IsAndroid() && owner_.Get()->AsAndroid()->robot_meta->dmg_ratio() > 0.0001f) {
|
||||||
|
finaly_dmg *= owner_.Get()->AsAndroid()->robot_meta->dmg_ratio();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
finaly_dmg = std::max(1.0f, finaly_dmg);
|
finaly_dmg = std::max(1.0f, finaly_dmg);
|
||||||
if (g_calc_dmg_context.is_crit) {
|
if (g_calc_dmg_context.is_crit) {
|
||||||
g_calc_dmg_context.crit_dmg = finaly_dmg;
|
g_calc_dmg_context.crit_dmg = finaly_dmg;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user