优化 attack_type
This commit is contained in:
parent
d34c6d0800
commit
a8df40d694
@ -77,7 +77,7 @@ void Bullet::OnHit(std::set<Entity*>& objects)
|
||||
case ET_Obstacle:
|
||||
{
|
||||
Obstacle* obstacle = (Obstacle*)target;
|
||||
if (!obstacle->IsDead(room) && obstacle->meta->i->attack_type() == 1) {
|
||||
if (!obstacle->IsDead(room) && obstacle->Attackable()) {
|
||||
float dmg = GetAtk() * (1 + player->GetBuffAttrRate(kHAT_Atk)) +
|
||||
player->GetBuffAttrAbs(kHAT_Atk);
|
||||
float def = 0;
|
||||
|
@ -495,7 +495,7 @@ bool Human::IsCollisionInMapService()
|
||||
#endif
|
||||
if (last_collision_door_ != collider->owner) {
|
||||
if (!obstacle->IsDead(room) &&
|
||||
obstacle->meta->i->attack_type() == 1 &&
|
||||
obstacle->Attackable() &&
|
||||
obstacle->meta->i->drop() != 0 &&
|
||||
room->GetGasData().gas_mode != GasInactive
|
||||
) {
|
||||
|
@ -62,7 +62,7 @@ void Obstacle::RecalcSelfCollider()
|
||||
}
|
||||
SetPos(old_pos);
|
||||
}
|
||||
} else if (meta->i->attack_type() != 2){
|
||||
} else if (!Throughable()){
|
||||
switch (meta->i->type()) {
|
||||
case 1:
|
||||
{
|
||||
@ -284,7 +284,7 @@ void Obstacle::Explosion(Bullet* bullet)
|
||||
case ET_Obstacle:
|
||||
{
|
||||
Obstacle* obstacle = (Obstacle*)target;
|
||||
if (!obstacle->IsDead(room) && obstacle->meta->i->attack_type() == 1) {
|
||||
if (!obstacle->IsDead(room) && obstacle->Attackable()) {
|
||||
float dmg = meta->i->damage();
|
||||
float def = 0;
|
||||
float finaly_dmg = dmg * (1 - def/MetaMgr::Instance()->K);
|
||||
@ -424,3 +424,13 @@ bool Obstacle::IsPermanent()
|
||||
}
|
||||
return is_permanent;
|
||||
}
|
||||
|
||||
bool Obstacle::Attackable()
|
||||
{
|
||||
return meta->i->attack_type() == 1;
|
||||
}
|
||||
|
||||
bool Obstacle::Throughable()
|
||||
{
|
||||
return meta->i->attack_type() == 2;
|
||||
}
|
||||
|
@ -50,6 +50,8 @@ class Obstacle : public Entity
|
||||
void SetHealth(Room* room, float value);
|
||||
void Die(Room* room);
|
||||
bool IsPermanent();
|
||||
bool Attackable();
|
||||
bool Throughable();
|
||||
|
||||
protected:
|
||||
Obstacle();
|
||||
|
@ -39,7 +39,7 @@ void RoomObstacle::Initialize()
|
||||
|
||||
void RoomObstacle::RecalcSelfCollider()
|
||||
{
|
||||
if (meta->i->attack_type() != 2){
|
||||
if (!Throughable()){
|
||||
switch (meta->i->type()) {
|
||||
case 1:
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user