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)
|
||||
{
|
||||
Skill* skill = GetSkill(skill_id);
|
||||
if (!skill) {
|
||||
return false;
|
||||
}
|
||||
return InternalCanUseSkill(skill);
|
||||
}
|
||||
|
||||
bool Creature::InternalCanUseSkill(Skill* skill)
|
||||
{
|
||||
if (skill->GetCurrTimes() <= 0) {
|
||||
return false;
|
||||
}
|
||||
|
@ -222,6 +222,7 @@ class Creature : public MoveableEntity
|
||||
const Position& target_pos,
|
||||
std::set<Creature*>& target_list);
|
||||
virtual bool CanUseSkill(int skill_id);
|
||||
bool HasUseableSkill();
|
||||
void DoSkill(int skill_id,
|
||||
int target_id,
|
||||
const glm::vec3& skill_dir,
|
||||
@ -389,6 +390,7 @@ private:
|
||||
void CheckAbilityUsed();
|
||||
void AutoSwitchWeapon();
|
||||
void CheckLoadingBullet();
|
||||
bool InternalCanUseSkill(Skill* skill);
|
||||
|
||||
protected:
|
||||
bool need_sync_active_player_ = false;
|
||||
|
@ -24,7 +24,7 @@ int TargetAgent::GetUniId()
|
||||
|
||||
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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user