完成技能
This commit is contained in:
parent
e13331b253
commit
47beb71ba8
@ -747,6 +747,20 @@ void Human::DoSkill()
|
||||
{
|
||||
recover_hp_frameno_ = room->frame_no;
|
||||
a8::SetBitFlag(status, HS_RecoverHP);
|
||||
room->xtimer.AddRepeatTimerAndAttach(SERVER_FRAME_RATE,
|
||||
a8::XParams()
|
||||
.SetSender(this)
|
||||
.SetParam1(skill_meta->i->value1()),
|
||||
[] (const a8::XParams& param)
|
||||
{
|
||||
Human* hum = (Human*)param.sender.GetUserData();
|
||||
if (a8::HasBitFlag(hum->status, HS_RecoverHP)) {
|
||||
hum->RecoverHp(param.param1);
|
||||
hum->need_sync_active_player = true;
|
||||
}
|
||||
},
|
||||
&skill_xtimer_attacher_.timer_list_
|
||||
);
|
||||
room->xtimer.AddDeadLineTimerAndAttach(skill_meta->i->last_time() * SERVER_FRAME_RATE,
|
||||
a8::XParams()
|
||||
.SetSender(this),
|
||||
@ -1091,3 +1105,11 @@ int Human::GetVolume(int slot_id)
|
||||
}
|
||||
return volume_[slot_id];
|
||||
}
|
||||
|
||||
void Human::RecoverHp(int inc_hp)
|
||||
{
|
||||
if (!dead) {
|
||||
health += inc_hp;
|
||||
health = std::max(health, GetMaxHP());
|
||||
}
|
||||
}
|
||||
|
@ -148,6 +148,7 @@ class Human : public Entity
|
||||
void AddInventory(int slot_id, int num);
|
||||
void DecInventory(int slot_id, int num);
|
||||
int GetVolume(int slot_id);
|
||||
void RecoverHp(int inc_hp);
|
||||
|
||||
protected:
|
||||
long long last_shot_frameno_ = 0;
|
||||
|
@ -637,6 +637,12 @@ void Player::LootInteraction(Loot* entity)
|
||||
room->DropItem(pos, skin, 1);
|
||||
}
|
||||
skin = entity->item_id;
|
||||
skin_meta = MetaMgr::Instance()->GetDress(skin);
|
||||
if (skin_meta) {
|
||||
skill_meta = MetaMgr::Instance()->GetSkill(skin_meta->i->skill_id());
|
||||
} else {
|
||||
skill_meta = nullptr;
|
||||
}
|
||||
SyncAroundPlayers();
|
||||
}
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user