1
This commit is contained in:
parent
4022545a6e
commit
e44c3efac4
@ -10,6 +10,8 @@
|
|||||||
#include "typeconvert.h"
|
#include "typeconvert.h"
|
||||||
#include "bullet.h"
|
#include "bullet.h"
|
||||||
#include "perfmonitor.h"
|
#include "perfmonitor.h"
|
||||||
|
#include "roomobstacle.h"
|
||||||
|
#include "loot.h"
|
||||||
|
|
||||||
enum ObstacleDataFlags_e
|
enum ObstacleDataFlags_e
|
||||||
{
|
{
|
||||||
@ -570,6 +572,18 @@ void Obstacle::OnBulletHit(Bullet* bullet)
|
|||||||
((bullet->gun_meta->special_damage_type & meta->receive_special_damage_type) == 0)) {
|
((bullet->gun_meta->special_damage_type & meta->receive_special_damage_type) == 0)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (meta->i->thing_type() == kObstacleOilBucket) {
|
||||||
|
Entity* real_object = AsRoomObstacle()->GetRealObject(bullet->room);
|
||||||
|
if (real_object->IsEntityType(ET_Loot)) {
|
||||||
|
Loot* loot = (Loot*)real_object;
|
||||||
|
if (loot->pickuped) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
loot->pickuped = true;
|
||||||
|
bullet->room->RemoveObjectLater(loot);
|
||||||
|
bullet->room->RemoveObjectLater(AsRoomObstacle());
|
||||||
|
}
|
||||||
|
}
|
||||||
float dmg = bullet->GetAtk() * (1 + bullet->sender.Get()->GetAttrRate(kHAT_Atk)) +
|
float dmg = bullet->GetAtk() * (1 + bullet->sender.Get()->GetAttrRate(kHAT_Atk)) +
|
||||||
bullet->sender.Get()->GetAttrAbs(kHAT_Atk);
|
bullet->sender.Get()->GetAttrAbs(kHAT_Atk);
|
||||||
float def = 0;
|
float def = 0;
|
||||||
@ -761,3 +775,13 @@ bool Obstacle::IsOpenInteraction()
|
|||||||
{
|
{
|
||||||
return meta->i->interaction_mode() == 2;
|
return meta->i->interaction_mode() == 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Obstacle::IsRoomObstacle()
|
||||||
|
{
|
||||||
|
return !IsPermanent();
|
||||||
|
}
|
||||||
|
|
||||||
|
RoomObstacle* Obstacle::AsRoomObstacle()
|
||||||
|
{
|
||||||
|
return (RoomObstacle*)this;
|
||||||
|
}
|
||||||
|
@ -20,6 +20,7 @@ class Building;
|
|||||||
class CircleCollider;
|
class CircleCollider;
|
||||||
class AabbCollider;
|
class AabbCollider;
|
||||||
class Bullet;
|
class Bullet;
|
||||||
|
class RoomObstacle;
|
||||||
class Obstacle : public Entity
|
class Obstacle : public Entity
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -69,6 +70,8 @@ class Obstacle : public Entity
|
|||||||
bool Throughable();
|
bool Throughable();
|
||||||
bool IsTouchInteraction();
|
bool IsTouchInteraction();
|
||||||
bool IsOpenInteraction();
|
bool IsOpenInteraction();
|
||||||
|
bool IsRoomObstacle();
|
||||||
|
RoomObstacle* AsRoomObstacle();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Obstacle();
|
Obstacle();
|
||||||
@ -97,3 +100,4 @@ protected:
|
|||||||
|
|
||||||
friend class EntityFactory;
|
friend class EntityFactory;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -752,6 +752,19 @@ void Player::LootInteraction(Loot* entity)
|
|||||||
}
|
}
|
||||||
entity->pickuped = true;
|
entity->pickuped = true;
|
||||||
room->RemoveObjectLater(entity);
|
room->RemoveObjectLater(entity);
|
||||||
|
if (entity->dummy_thing_uniid != 0) {
|
||||||
|
Entity* dummy_obj = room->GetEntityByUniId(entity->dummy_thing_uniid);
|
||||||
|
if (dummy_obj && dummy_obj->GetEntityType() == ET_Obstacle) {
|
||||||
|
Obstacle* obstacle = (Obstacle*)dummy_obj;
|
||||||
|
if (!obstacle->IsPermanent()) {
|
||||||
|
if (!obstacle->IsDead(room)) {
|
||||||
|
obstacle->Die(room);
|
||||||
|
obstacle->BroadcastFullState(room);
|
||||||
|
}
|
||||||
|
room->RemoveObjectLater((RoomObstacle*)obstacle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::HumanInteraction(Human* hum)
|
void Player::HumanInteraction(Human* hum)
|
||||||
|
@ -558,6 +558,7 @@ int Room::CreateLootEx(int equip_id, a8::Vec2 born_pos, a8::Vec2 pos, int count,
|
|||||||
}
|
}
|
||||||
RoomObstacle* dummy_obj = CreateObstacle(equip_meta->int_param1, pos.x, pos.y);
|
RoomObstacle* dummy_obj = CreateObstacle(equip_meta->int_param1, pos.x, pos.y);
|
||||||
entity->dummy_thing_uniid = dummy_obj->GetUniId();
|
entity->dummy_thing_uniid = dummy_obj->GetUniId();
|
||||||
|
dummy_obj->real_object_uniid = entity->GetUniId();
|
||||||
}
|
}
|
||||||
return entity->GetUniId();
|
return entity->GetUniId();
|
||||||
} else {
|
} else {
|
||||||
|
@ -582,3 +582,8 @@ void RoomObstacle::SummonAirDropBox(int box_id)
|
|||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Entity* RoomObstacle::GetRealObject(Room* room)
|
||||||
|
{
|
||||||
|
return room->GetEntityByUniId(real_object_uniid);
|
||||||
|
}
|
||||||
|
@ -12,6 +12,7 @@ class RoomObstacle : public Obstacle
|
|||||||
bool is_treasure_box = false;
|
bool is_treasure_box = false;
|
||||||
bool is_terminator_airdrop_box = false;
|
bool is_terminator_airdrop_box = false;
|
||||||
CreatureWeakPtr master;
|
CreatureWeakPtr master;
|
||||||
|
int real_object_uniid = 0;
|
||||||
|
|
||||||
virtual ~RoomObstacle() override;
|
virtual ~RoomObstacle() override;
|
||||||
virtual void Initialize() override;
|
virtual void Initialize() override;
|
||||||
@ -25,6 +26,7 @@ class RoomObstacle : public Obstacle
|
|||||||
void DetachFromMaster();
|
void DetachFromMaster();
|
||||||
virtual void Die(Room* room) override;
|
virtual void Die(Room* room) override;
|
||||||
virtual void Explosion() override;
|
virtual void Explosion() override;
|
||||||
|
Entity* GetRealObject(Room* room);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void SpecExplosion();
|
void SpecExplosion();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user