1
This commit is contained in:
parent
53cbbf5dc0
commit
befd2915ba
@ -233,7 +233,7 @@ void AndroidAI::DoAttackOldAI()
|
||||
shot_dir.Rotate((rand() % 10) / 180.0f);
|
||||
sender->SetAttackDir(shot_dir);
|
||||
bool shot_ok = false;
|
||||
sender->Shot(shot_dir, shot_ok, DEFAULT_FLY_DISTANCE);
|
||||
sender->Shot(shot_dir, shot_ok, DEFAULT_FLY_DISTANCE, 0);
|
||||
}
|
||||
old_ai_data_->last_target.Attach(enemy);
|
||||
}
|
||||
@ -646,7 +646,7 @@ void AndroidAI::DoShotNewAI()
|
||||
}
|
||||
a8::Vec2 old_attack_dir = myself->GetAttackDir();
|
||||
myself->SetAttackDir(shot_dir);
|
||||
myself->Shot(shot_dir, shot_ok, DEFAULT_FLY_DISTANCE);
|
||||
myself->Shot(shot_dir, shot_ok, DEFAULT_FLY_DISTANCE, 0);
|
||||
myself->SetAttackDir(old_attack_dir);
|
||||
if (shot_ok) {
|
||||
if (node_->shot_times <= 0) {
|
||||
|
@ -147,7 +147,8 @@ void InternalShot(Creature* c,
|
||||
MetaData::Equip* bullet_meta,
|
||||
MetaData::Skill* skill_meta,
|
||||
float fly_distance,
|
||||
long long weapon_uniid)
|
||||
long long weapon_uniid,
|
||||
int trace_target_uniid)
|
||||
{
|
||||
if (weapon_meta->i->_inventory_slot() == IS_TRAP ||
|
||||
weapon_meta->i->_inventory_slot() == IS_MINE) {
|
||||
@ -361,6 +362,7 @@ void InternalShot(Creature* c,
|
||||
bullet_info.delay_time = std::get<3>(tuple);
|
||||
bullet_info.recoil_force = std::get<4>(tuple);
|
||||
bullet_info.invincible_buff_uniid = invincible_buff_uniid;
|
||||
bullet_info.trace_target_uniid = trace_target_uniid;
|
||||
if (skill_meta &&
|
||||
(skill_meta->GetMagicId() == MAGIC_AXXF ||
|
||||
skill_meta->GetMagicId() == MAGIC_HJHX)) {
|
||||
@ -974,6 +976,20 @@ void Creature::TriggerBuff(Skill* skill, std::set<Creature*>& target_list, BuffT
|
||||
for (Creature* entity : target_list) {
|
||||
TriggerOneObjectBuff(skill, entity, trigger_type);
|
||||
}
|
||||
if (trigger_type == kBTT_UseSkill && !dead) {
|
||||
auto itr = skill->meta->trigger_type_buffs.find(trigger_type);
|
||||
if (itr != skill->meta->trigger_type_buffs.end()) {
|
||||
for (MetaData::Buff* buff_meta : itr->second) {
|
||||
switch (buff_meta->i->buff_target()) {
|
||||
case kBuffTargetSelf: //自己
|
||||
{
|
||||
AddBuff(this, buff_meta, skill->meta);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Creature::TriggerOneObjectBuff(Skill* skill, Creature* target, BuffTriggerType_e trigger_type)
|
||||
@ -987,13 +1003,9 @@ void Creature::TriggerOneObjectBuff(Skill* skill, Creature* target, BuffTriggerT
|
||||
switch (buff_meta->i->buff_target()) {
|
||||
case kBuffTargetSelf: //自己
|
||||
{
|
||||
#if 1
|
||||
AddBuff(this, buff_meta, skill->meta);
|
||||
#else
|
||||
if (target == this) {
|
||||
if (target == this && trigger_type != kBTT_UseSkill) {
|
||||
target->AddBuff(this, buff_meta, skill->meta);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case kBuffTargetFriendly: //友军
|
||||
@ -1266,6 +1278,7 @@ void Creature::ProcSkillPhase(MetaData::SkillPhase* phase)
|
||||
bullet_meta,
|
||||
CurrentSkill() ? CurrentSkill()->meta : nullptr,
|
||||
target_distance,
|
||||
0,
|
||||
0);
|
||||
SetAttackDir(old_attack_dir);
|
||||
}
|
||||
@ -1286,6 +1299,7 @@ void Creature::ProcSkillPhase(MetaData::SkillPhase* phase)
|
||||
bullet_meta,
|
||||
CurrentSkill() ? CurrentSkill()->meta : nullptr,
|
||||
target_distance,
|
||||
0,
|
||||
0);
|
||||
SetAttackDir(old_attack_dir);
|
||||
}
|
||||
@ -1954,7 +1968,7 @@ void Creature::UpdatePoisoning()
|
||||
}
|
||||
}
|
||||
|
||||
void Creature::Shot(a8::Vec2& target_dir, bool& shot_ok, float fly_distance)
|
||||
void Creature::Shot(a8::Vec2& target_dir, bool& shot_ok, float fly_distance, int trace_target_uniid)
|
||||
{
|
||||
shot_ok = false;
|
||||
if (!GetCurrWeapon()->meta) {
|
||||
@ -2011,7 +2025,8 @@ void Creature::Shot(a8::Vec2& target_dir, bool& shot_ok, float fly_distance)
|
||||
GetCurrWeapon()->bullet_meta,
|
||||
nullptr,
|
||||
fly_distance,
|
||||
GetCurrWeapon()->weapon_uniid);
|
||||
GetCurrWeapon()->weapon_uniid,
|
||||
trace_target_uniid);
|
||||
} else if (power_idx < GetCurrWeapon()->meta->power_charge.size()) {
|
||||
MetaData::Equip* weapon_meta = MetaMgr::Instance()->GetEquip
|
||||
(std::get<1>(GetCurrWeapon()->meta->power_charge[power_idx]));
|
||||
@ -2032,7 +2047,8 @@ void Creature::Shot(a8::Vec2& target_dir, bool& shot_ok, float fly_distance)
|
||||
bullet_meta,
|
||||
nullptr,
|
||||
fly_distance,
|
||||
0);
|
||||
0,
|
||||
trace_target_uniid);
|
||||
} else {
|
||||
A8_ABORT();
|
||||
}
|
||||
|
@ -201,7 +201,7 @@ class Creature : public MoveableEntity
|
||||
void TraverseProperTargetsNoTeammate(std::function<void (Creature*, bool&)> func);
|
||||
CreatureWeakPtrChunk* GetWeakPtrChunk() { return &weak_ptr_chunk_; };
|
||||
|
||||
void Shot(a8::Vec2& target_dir, bool& shot_ok, float fly_distance);
|
||||
void Shot(a8::Vec2& target_dir, bool& shot_ok, float fly_distance, int trace_target_uniid);
|
||||
|
||||
void AutoLoadingBullet(bool manual = false);
|
||||
int GetInventory(int slot_id);
|
||||
@ -370,4 +370,5 @@ void InternalShot(Creature* sender,
|
||||
MetaData::Equip* bullet_meta,
|
||||
MetaData::Skill* skill_meta,
|
||||
float fly_distance,
|
||||
long long weapon_uniid);
|
||||
long long weapon_uniid,
|
||||
int trace_target_uniid);
|
||||
|
@ -510,7 +510,7 @@ void HeroAI::DoShotAI()
|
||||
}
|
||||
a8::Vec2 old_attack_dir = myself->GetAttackDir();
|
||||
myself->SetAttackDir(shot_dir);
|
||||
myself->Shot(shot_dir, shot_ok, DEFAULT_FLY_DISTANCE);
|
||||
myself->Shot(shot_dir, shot_ok, DEFAULT_FLY_DISTANCE, 0);
|
||||
myself->SetAttackDir(old_attack_dir);
|
||||
if (shot_ok) {
|
||||
if (node_->shot_times <= 0) {
|
||||
|
@ -803,6 +803,7 @@ void Human::CarShot(const a8::Vec2& target_dir)
|
||||
second_weapon.bullet_meta,
|
||||
nullptr,
|
||||
5,
|
||||
0,
|
||||
0);
|
||||
|
||||
--second_weapon.ammo;
|
||||
|
@ -309,7 +309,7 @@ void Player::UpdateShot()
|
||||
GetCar()->shot_hole = GetSeat();
|
||||
GetCar()->shot_passenger = this;
|
||||
GetCar()->SetAttackDir(GetAttackDir());
|
||||
GetCar()->Shot(target_dir, shot_ok, fly_distance);
|
||||
GetCar()->Shot(target_dir, shot_ok, fly_distance, 0);
|
||||
if (!moving && GetCar()->IsDriver(this)) {
|
||||
GetCar()->SetMoveDir(GetAttackDir());
|
||||
}
|
||||
@ -538,7 +538,18 @@ void Player::Shot()
|
||||
|
||||
bool shot_ok = false;
|
||||
a8::Vec2 target_dir = GetAttackDir();
|
||||
Creature::Shot(target_dir, shot_ok, fly_distance);
|
||||
int target_uniid = 0;
|
||||
if (trace_target_uniid && GetCurrWeapon()->meta->i->auto_trace()) {
|
||||
Entity* target = room->GetEntityByUniId(trace_target_uniid);
|
||||
if (target &&
|
||||
target->IsCreature(room) &&
|
||||
((Creature*)target)->team_id != team_id &&
|
||||
GetPos().Distance(target->GetPos()) < GetCurrWeapon()->meta->i->trace_range()
|
||||
) {
|
||||
target_uniid = trace_target_uniid;
|
||||
}
|
||||
}
|
||||
Creature::Shot(target_dir, shot_ok, fly_distance, target_uniid);
|
||||
}
|
||||
|
||||
void Player::ProcInteraction()
|
||||
@ -876,6 +887,7 @@ void Player::_CMMove(f8::MsgHdr& hdr, const cs::CMMove& msg)
|
||||
use_skill = false;
|
||||
}
|
||||
last_cmmove_frameno = room->GetFrameNo();
|
||||
trace_target_uniid = msg.trace_target_uniid();
|
||||
#ifdef DEBUG1
|
||||
if (msg.has_drop_weapon()) {
|
||||
SendDebugMsg(a8::Format("zzzzzzzz frameno:%d drop_weapon:%d", {room->GetFrameNo(), msg.drop_weapon()}));
|
||||
|
@ -72,6 +72,8 @@ class Player : public Human
|
||||
int follow = -1;
|
||||
int dive = 0;
|
||||
|
||||
int trace_target_uniid = 0;
|
||||
|
||||
::google::protobuf::RepeatedField< ::google::protobuf::int32 > interaction_objids;
|
||||
|
||||
virtual ~Player() override;
|
||||
|
@ -199,7 +199,7 @@ message Equip
|
||||
optional string hit_buff = 75;
|
||||
|
||||
optional int32 auto_trace = 76;
|
||||
optional int32 trace_ragne = 77;
|
||||
optional int32 trace_range = 77;
|
||||
}
|
||||
|
||||
message EquipUpgrade
|
||||
|
Loading…
x
Reference in New Issue
Block a user