This commit is contained in:
aozhiwei 2021-06-01 15:00:53 +08:00
parent 4cb385969a
commit 3bae3519ff
2 changed files with 32 additions and 10 deletions

View File

@ -40,6 +40,7 @@ void Car::Initialize()
born_frameno_ = room->GetFrameNo(); born_frameno_ = room->GetFrameNo();
ability.hp = hero_meta_->i->health(); ability.hp = hero_meta_->i->health();
ability.max_hp = std::max(ability.hp, ability.max_hp); ability.max_hp = std::max(ability.hp, ability.max_hp);
TryAddBuff(this, meta->car_deactive_buff_id);
} }
void Car::FillMFObjectPart(Room* room, Human* hum, cs::MFObjectPart* part_data) void Car::FillMFObjectPart(Room* room, Human* hum, cs::MFObjectPart* part_data)

View File

@ -2133,16 +2133,36 @@ void Room::CreateLoots()
int thing_id = thing_tpl->RandThing(); int thing_id = thing_tpl->RandThing();
MetaData::Equip* equip_meta = MetaMgr::Instance()->GetEquip(thing_id); MetaData::Equip* equip_meta = MetaMgr::Instance()->GetEquip(thing_id);
if (equip_meta) { if (equip_meta) {
int loot_uniid = CreateLoot( if (equip_meta->i->equip_type() == EQUIP_TYPE_CAR) {
equip_meta->i->id(), int car_uniid = AllocUniid();
a8::Vec2 Car* c = CreateCar(nullptr,
( car_uniid,
thing_tpl->i->x(), equip_meta,
thing_tpl->i->y() a8::Vec2
), (
1, thing_tpl->i->x(),
1 thing_tpl->i->y()
); ),
0);
if (c) {
CarObject car;
car.car_id = equip_meta->i->id();
car.pos = c->GetPos();
car_hash_[c->GetEntityUniId()] = car;
}
} else {
int loot_uniid = CreateLoot(
equip_meta->i->id(),
a8::Vec2
(
thing_tpl->i->x(),
thing_tpl->i->y()
),
1,
1
);
}
#if 0
if (loot_uniid && equip_meta->i->equip_type() == EQUIP_TYPE_CAR) { if (loot_uniid && equip_meta->i->equip_type() == EQUIP_TYPE_CAR) {
Entity* loot_entity = GetEntityByUniId(loot_uniid); Entity* loot_entity = GetEntityByUniId(loot_uniid);
if (loot_entity && loot_entity->IsEntityType(ET_Loot)) { if (loot_entity && loot_entity->IsEntityType(ET_Loot)) {
@ -2155,6 +2175,7 @@ void Room::CreateLoots()
car_hash_[loot_entity->GetEntityUniId()] = car; car_hash_[loot_entity->GetEntityUniId()] = car;
} }
} }
#endif
} }
} }
} }