修复宝石掉落问题
This commit is contained in:
parent
54662c4ec2
commit
693c707bb3
@ -376,6 +376,7 @@ private:
|
||||
|
||||
protected:
|
||||
bool need_sync_active_player_ = false;
|
||||
std::list<std::any> on_dead_remove_objects_;
|
||||
|
||||
ActionType_e action_type = AT_None;
|
||||
int action_duration = 0;
|
||||
|
@ -1239,7 +1239,7 @@ void Human::DeadDrop()
|
||||
}
|
||||
}
|
||||
{
|
||||
if (GetInventory(IS_GEMSTONE) > 0) {
|
||||
if (GetInventory(IS_GEMSTONE) > 0 && gemstone > 0) {
|
||||
room->frame_event.AddPropChg
|
||||
(
|
||||
GetWeakPtrRef(),
|
||||
@ -1248,15 +1248,21 @@ void Human::DeadDrop()
|
||||
0,
|
||||
false);
|
||||
|
||||
#if 0
|
||||
SetMaxHP(GetMaxHP() + dto.item_meta->_max_hp * GetBattleContext()->GetMaxHP());
|
||||
#endif
|
||||
const mt::Equip* gem_stone_meta = mt::Equip::GetGemStone();
|
||||
if (gem_stone_meta) {
|
||||
Position drop_pos = GetPos();
|
||||
room->DropItem(drop_pos.ToGlmVec3(), gem_stone_meta->id(), gemstone, 1);
|
||||
}
|
||||
|
||||
SetMaxHP(GetBattleContext()->GetMaxHP());
|
||||
gemstone = 0;
|
||||
DecInventory(IS_GEMSTONE, GetInventory(IS_GEMSTONE));
|
||||
SyncVolume(IS_GEMSTONE);
|
||||
}
|
||||
}
|
||||
{
|
||||
on_dead_remove_objects_.clear();
|
||||
}
|
||||
MarkSyncActivePlayer(__FILE__, __LINE__, __func__);
|
||||
}
|
||||
|
||||
@ -3218,7 +3224,26 @@ void Human::ProcGemStoneItem(AddItemDTO& dto)
|
||||
0,
|
||||
gemstone,
|
||||
false);
|
||||
GetAbility()->AddAttrRate(kHAT_Atk, dto.item_meta->_atk);
|
||||
|
||||
auto context = A8_MAKE_SMART_ANON_STRUCT_SHARED
|
||||
(
|
||||
CreatureWeakPtr owner;
|
||||
AttrRateHandle handle;
|
||||
);
|
||||
context->owner = GetWeakPtrRef();
|
||||
context->_destory_cb =
|
||||
[context = context.get()] ()
|
||||
{
|
||||
if (context->owner.Get() &&
|
||||
context->owner.Get()->room->IsDestorying() &&
|
||||
!context->handle.expired()
|
||||
) {
|
||||
context->owner.Get()->GetAbility()->RemoveAttrRate(context->handle);
|
||||
}
|
||||
};
|
||||
context->handle = GetAbility()->AddAttrRate(kHAT_Atk, dto.item_meta->_atk);
|
||||
on_dead_remove_objects_.push_back(context);
|
||||
|
||||
SetMaxHP(GetMaxHP() + dto.item_meta->_max_hp * GetBattleContext()->GetMaxHP());
|
||||
SetHP(GetHP() + dto.item_meta->_max_hp * GetBattleContext()->GetMaxHP());
|
||||
room->frame_event.AddPropChg
|
||||
|
@ -510,7 +510,11 @@ void Room::DropItem(const glm::vec3& pos, int item_id, int item_count, int item_
|
||||
void Room::DropItemEx(const glm::vec3& born_pos, const glm::vec3& pos, int item_id, int item_count, int item_lv, bool show_anim)
|
||||
{
|
||||
const mt::Equip* equip_meta = mt::Equip::GetById(item_id);
|
||||
if (equip_meta && equip_meta->group_num() > 0 && item_count > 0) {
|
||||
int group_num = equip_meta->group_num();
|
||||
if (item_id == mt::Equip::GEMSTONE_ID && group_num <= 0) {
|
||||
group_num = 1;
|
||||
}
|
||||
if (equip_meta && group_num > 0 && item_count > 0) {
|
||||
#if 1
|
||||
if (equip_meta->equip_type() == EQUIP_TYPE_BULLET) {
|
||||
return;
|
||||
@ -518,7 +522,7 @@ void Room::DropItemEx(const glm::vec3& born_pos, const glm::vec3& pos, int item_
|
||||
#endif
|
||||
int total_count = item_count;
|
||||
while (total_count > 0) {
|
||||
int drop_num = std::min(total_count, equip_meta->group_num());
|
||||
int drop_num = std::min(total_count, group_num);
|
||||
if (drop_num < 1) {
|
||||
drop_num = 1;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user