This commit is contained in:
aozhiwei 2021-07-07 10:11:27 +00:00
parent 6ec74e015e
commit 45c5164a23
4 changed files with 25 additions and 7 deletions

View File

@ -583,12 +583,19 @@ bool Creature::CanUseSkill(int skill_id)
if (!skill) {
return false;
}
if (skill->force_use_times > 0) {
--skill->force_use_times;
return true;
}
if (dead) {
return false;
}
if (playing_skill) {
return false;
}
if (IsHuman() && AsHuman()->downed) {
return false;
}
return skill->GetCurrTimes() > 0;
}
@ -1055,6 +1062,22 @@ void Creature::ProcBuffEffect(Creature* caster, Buff* buff)
}
}
break;
case kBET_UseSkill:
{
Skill* skill = GetSkill(buff->meta->int_param1);
if (skill) {
++skill->force_use_times;
a8::Vec2 target_pos = GetPos();
DoSkill(
skill->meta->i->skill_id(),
GetUniId(),
GetAttackDir(),
0,
target_pos
);
}
}
break;
default:
{
}

View File

@ -758,6 +758,7 @@ void Human::BeKill(int killer_id, const std::string& killer_name, int weapon_id)
stats.killer_id = killer_id;
stats.killer_name = killer_name;
stats.weapon_id = weapon_id;
GetTrigger()->Die();
if (room->GetRoomMode() == kZombieMode) {
dead = true;
downed = false;
@ -1052,11 +1053,6 @@ int Human::GetNearbyTeammateNum(float range)
return num;
}
bool Human::CanUseSkill(int skill_id)
{
return !downed && Creature::CanUseSkill(skill_id);
}
void Human::DoJump()
{
if (HasBuffEffect(kBET_Fly)) {
@ -2451,7 +2447,6 @@ void Human::OnDie()
}
}
DeadDrop();
GetTrigger()->Die();
}
void Human::FreeDownedTimer()

View File

@ -163,7 +163,6 @@ class Human : public Creature
bool HasNoDownedTeammate();
int GetNearbyTeammateNum(float range);
void DoJump();
virtual bool CanUseSkill(int skill_id) override;
virtual Skill* SelectSkill();
void DoGetOn(int obj_uniid);
void DoGetDown();

View File

@ -25,6 +25,7 @@ class Skill
MetaData::Skill* meta = nullptr;
long long last_use_frameno = 0;
a8::XTimerAttacher xtimer_attacher;
int force_use_times = 0;
void Initialzie();
int GetCd();