This commit is contained in:
aozhiwei 2019-07-09 14:36:54 +08:00
parent 7664e33714
commit 36984c1e30
5 changed files with 39 additions and 9 deletions

View File

@ -161,6 +161,20 @@ enum EntitySubType_e
EST_Android = 2,
};
enum SkillTarget_e
{
ST_All = 0,
ST_Self = 1,
ST_FriendlyIncludeSelf = 2,
ST_FriendlyExcludeSelf = 3,
ST_EnemySingle = 6,
ST_EnemyGroup = 7,
ST_EnemyAndObject = 8,
ST_EnemyAndSelf = 9
};
enum BuffTriggerType_e
{
BTT_UseSkill = 1, //技能释放时触发

View File

@ -641,8 +641,18 @@ bool Human::HasNoDownedTeammate()
void Human::DoSkill()
{
if (skill_meta && GetSkillLeftTime() <= 0) {
TriggerBuff(BTT_UseSkill);
Entity* entity = room->GetEntityByUniId(skill_target_id);
if (entity && entity->entity_type == ET_Player) {
Human* hum = (Human*)entity;
std::set<Entity*> target_list;
SelectSkillTargets(hum->pos, target_list);
TriggerBuff(target_list, BTT_UseSkill);
}
}
use_skill = false;
skill_target_id = 0;
skill_dir = a8::Vec2();
skill_param1 = 0.0f;
}
void Human::FindLocation()
@ -1287,7 +1297,7 @@ int Human::GetSkillCd()
return skill_meta ? skill_meta->i->skill_cd() * 1000 : 0;
}
void Human::TriggerBuff(BuffTriggerType_e trigger_type)
void Human::TriggerBuff(std::set<Entity*>& target_list, BuffTriggerType_e trigger_type)
{
}
@ -1379,3 +1389,8 @@ void Human::Revive()
room->OnHumanRevive(this);
SyncAroundPlayers();
}
void Human::SelectSkillTargets(const a8::Vec2& target_pos, std::set<Entity*>& target_list)
{
}

View File

@ -114,6 +114,12 @@ class Human : public Entity
std::map<int, int> weapon_configs;
std::map<int, int> skin_configs;
bool use_skill = false;
int curr_skill_phase = 0;
int skill_target_id = 0;
a8::Vec2 skill_dir;
float skill_param1 = 0;
Human();
virtual ~Human() override;
virtual void Initialize() override;
@ -192,7 +198,7 @@ class Human : public Entity
int SkinLv();
int GetSkillLeftTime();
int GetSkillCd();
void TriggerBuff(BuffTriggerType_e trigger_type);
void TriggerBuff(std::set<Entity*>& target_list, BuffTriggerType_e trigger_type);
protected:
void _UpdateMove(int speed);
@ -201,6 +207,7 @@ private:
void ClearFrameData();
void DeadDrop();
void Revive();
void SelectSkillTargets(const a8::Vec2& target_pos, std::set<Entity*>& target_list);
protected:
long long last_shot_frameno_ = 0;

View File

@ -242,7 +242,6 @@ void Player::UpdateEmote()
void Player::UpdateUseSkill()
{
DoSkill();
use_skill = false;
}
void Player::Shot()

View File

@ -52,11 +52,6 @@ class Player : public Human
bool emote = false;
int emote_id = 0;
bool use_skill = false;
int skill_target_id = 0;
a8::Vec2 skill_dir;
float skill_param1 = 0;
::google::protobuf::RepeatedField< ::google::protobuf::int32 > interaction_objids;
Player();