添加技能阶段时间处理

This commit is contained in:
aozhiwei 2021-04-15 15:22:11 +08:00
parent 0d49fb2337
commit b188d479a1
5 changed files with 22 additions and 5 deletions

View File

@ -429,6 +429,9 @@ void AndroidNewAI::UpdateNewAI()
abort();
}
}
if (hum->playing_skill) {
hum->UpdateSkill();
}
++node_.exec_frame_num;
hum->shot_hold = false;
switch (node_.main_state) {

View File

@ -482,6 +482,12 @@ bool Creature::CanUseSkill(int skill_id)
if (!skill) {
return false;
}
if (dead) {
return false;
}
if (playing_skill) {
return false;
}
return skill->GetCurrTimes() > 0;
}
@ -562,7 +568,7 @@ void Creature::ResetSkill()
void Creature::UpdateSkill()
{
if (CurrentSkill()) {
if (CurrentSkill() && !dead) {
if (curr_skill_phase < CurrentSkill()->meta->phases.size()) {
MetaData::SkillPhase* phase = &CurrentSkill()->meta->phases[curr_skill_phase];
if (phase->time_offset >= CurrentSkill()->GetPassedTime()) {
@ -572,6 +578,8 @@ void Creature::UpdateSkill()
} else {
playing_skill = false;
}
} else {
playing_skill = false;
}
}

View File

@ -45,6 +45,7 @@ class Creature : public MoveableEntity
std::function<bool ()> on_move_collision;
bool poisoning = false;
long long poisoning_time = 0;
bool playing_skill = false;
Weapon car_weapon;
a8::Vec2 buff_vec2_param1;
@ -140,6 +141,7 @@ class Creature : public MoveableEntity
Weapon* GetCurrWeapon() { return curr_weapon_; };
void SetCurrWeapon(Weapon* weapon);
void ResetAllSkillCd();
void UpdateSkill();
private:
@ -148,7 +150,6 @@ private:
virtual void DoSkillPreProc(int skill_id, int target_id, const a8::Vec2& target_pos);
virtual void DoSkillPostProc(bool used, int skill_id, int target_id, const a8::Vec2& target_pos);
void UpdateSkill();
void ProcSkillPhase(MetaData::SkillPhase* phase);
void ProcBuffEffect(Creature* caster, Buff* buff);
void TriggerOneObjectBuff(Skill* skill, Creature* target, BuffTriggerType_e trigger_type);
@ -177,7 +178,6 @@ private:
a8::Vec2 skill_dir_;
float skill_param1 = 0;
bool playing_skill = false;
size_t curr_skill_phase = 0;
Skill* curr_skill_ = nullptr;
int skill_target_id_ = 0;

View File

@ -129,7 +129,10 @@ void Player::InternalUpdate(int delta_time)
if (has_use_item_id) {
UpdateUseItemId();
}
}
if (playing_skill) {
UpdateSkill();
}
}
}
void Player::UpdateMove()
@ -624,7 +627,7 @@ void Player::LootInteraction(Loot* entity)
case IS_15XSCOPE:
{
if (item_meta->i->_inventory_slot() - IS_1XSCOPE > curr_scope_idx) {
curr_scope_idx = item_meta->i->_inventory_slot() - IS_1XSCOPE;
curr_scope_idx = item_meta->i->_inventory_slot() - IS_1XSCOPE;
}
}
break;

View File

@ -93,6 +93,9 @@ void ZombieModeAI::UpdateAI()
abort();
}
}
if (hum->playing_skill) {
hum->UpdateSkill();
}
++node_->exec_frame_num;
hum->shot_hold = false;
switch (node_->main_state) {