1
This commit is contained in:
parent
da64abb9e2
commit
435499dbdd
@ -847,12 +847,27 @@ Skill* Creature::GetSkill(int skill_id)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Creature::HasUseableSkill()
|
||||||
|
{
|
||||||
|
for (auto& pair : skill_hash_) {
|
||||||
|
if (InternalCanUseSkill(pair.second.get())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool Creature::CanUseSkill(int skill_id)
|
bool Creature::CanUseSkill(int skill_id)
|
||||||
{
|
{
|
||||||
Skill* skill = GetSkill(skill_id);
|
Skill* skill = GetSkill(skill_id);
|
||||||
if (!skill) {
|
if (!skill) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
return InternalCanUseSkill(skill);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Creature::InternalCanUseSkill(Skill* skill)
|
||||||
|
{
|
||||||
if (skill->GetCurrTimes() <= 0) {
|
if (skill->GetCurrTimes() <= 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -222,6 +222,7 @@ class Creature : public MoveableEntity
|
|||||||
const Position& target_pos,
|
const Position& target_pos,
|
||||||
std::set<Creature*>& target_list);
|
std::set<Creature*>& target_list);
|
||||||
virtual bool CanUseSkill(int skill_id);
|
virtual bool CanUseSkill(int skill_id);
|
||||||
|
bool HasUseableSkill();
|
||||||
void DoSkill(int skill_id,
|
void DoSkill(int skill_id,
|
||||||
int target_id,
|
int target_id,
|
||||||
const glm::vec3& skill_dir,
|
const glm::vec3& skill_dir,
|
||||||
@ -389,6 +390,7 @@ private:
|
|||||||
void CheckAbilityUsed();
|
void CheckAbilityUsed();
|
||||||
void AutoSwitchWeapon();
|
void AutoSwitchWeapon();
|
||||||
void CheckLoadingBullet();
|
void CheckLoadingBullet();
|
||||||
|
bool InternalCanUseSkill(Skill* skill);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool need_sync_active_player_ = false;
|
bool need_sync_active_player_ = false;
|
||||||
|
@ -24,7 +24,7 @@ int TargetAgent::GetUniId()
|
|||||||
|
|
||||||
bool TargetAgent::IsValid()
|
bool TargetAgent::IsValid()
|
||||||
{
|
{
|
||||||
return target_.Get() && !target_.Get()->dead && target_.Get()->team_id == owner_->team_id;
|
return target_.Get() && !target_.Get()->dead && target_.Get()->team_id != owner_->team_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TargetAgent::IsDead()
|
bool TargetAgent::IsDead()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user