Skip to content

Commit

Permalink
Give OrgaShooter normal damage
Browse files Browse the repository at this point in the history
  • Loading branch information
hexagonrecursion committed Aug 20, 2024
1 parent b2a0dea commit cb032e2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
4 changes: 2 additions & 2 deletions colobot-base/src/graphics/engine/particle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1243,7 +1243,7 @@ void CParticle::FrameParticle(float rTime)

if (object->Implements(ObjectInterfaceType::Damageable))
{
dynamic_cast<CDamageableObject&>(*object).DamageObject(DamageType::Organic, 0.1f, m_particle[i].objFather); // starts explosion
dynamic_cast<CDamageableObject&>(*object).DamageObject(DamageType::AlienAnt, 0.1f, m_particle[i].objFather); // starts explosion
}
}
}
Expand Down Expand Up @@ -1344,7 +1344,7 @@ void CParticle::FrameParticle(float rTime)
{
if (object->Implements(ObjectInterfaceType::Damageable))
{
dynamic_cast<CDamageableObject&>(*object).DamageObject(DamageType::Organic, 0.001f, m_particle[i].objFather);
dynamic_cast<CDamageableObject&>(*object).DamageObject(DamageType::OrgaShooter, 0.001f, m_particle[i].objFather);
}

m_exploGunCounter ++;
Expand Down
3 changes: 2 additions & 1 deletion colobot-base/src/object/interface/damageable_object.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,15 @@ class CObject;
enum class DamageType
{
Fire = 1, //!< fire damage (AlienSpider or Shooter), burns on destruction
Organic = 2, //!< organical damage (AlienAnt or OrgaShooter), explodes on destruction
AlienAnt = 2, //!< organical damage (AlienAnt), explodes on destruction
Phazer = 3, //!< damage from PhazerShooter, explodes on destruction
Tower = 4, //!< damage from DefenseTower, explodes on destruction
FallingObject = 5, //!< damaged by an falling object (OrgaMatter dropped by an AlienWasp), explodes on destruction
Explosive = 6, //!< destroyed by an explosive, explodes on destruction
Collision = 7, //!< damage after one object hits another, explodes on destruction
Lightning = 8, //!< struck by lightning, explodes on destruction
Fall = 9, //!< fall damage, explodes on destruction
OrgaShooter = 10, //!< damage from OrgaShooter, explodes on destruction
};

/**
Expand Down
10 changes: 6 additions & 4 deletions colobot-base/src/object/old_object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -376,8 +376,9 @@ bool COldObject::DamageObject(DamageType type, float force, CObject* killer)
m_type == OBJECT_RUINsupport ||
m_type == OBJECT_RUINradar ||
m_type == OBJECT_RUINconvert ) && type != DamageType::Explosive ) return false; // Mines and ruins can't be destroyed by shooting
if ( m_type == OBJECT_URANIUM && (type == DamageType::Fire || type == DamageType::Organic) ) return false; // UraniumOre is not destroyable by shooting or aliens (see #777)
if ( m_type == OBJECT_STONE && (type == DamageType::Fire || type == DamageType::Organic) ) return false; // TitaniumOre is not destroyable either
bool isShot = type == DamageType::Fire || type == DamageType::AlienAnt || type == DamageType::OrgaShooter;
if ( m_type == OBJECT_URANIUM && isShot ) return false; // UraniumOre is not destroyable by shooting or aliens (see #777)
if ( m_type == OBJECT_STONE && isShot ) return false; // TitaniumOre is not destroyable either
// PowerCell, NuclearCell and Titanium are destroyable by shooting, but not by collisions!
if ( m_type == OBJECT_METAL && type == DamageType::Collision ) return false;
if ( m_type == OBJECT_POWER && type == DamageType::Collision ) return false;
Expand All @@ -391,9 +392,10 @@ bool COldObject::DamageObject(DamageType type, float force, CObject* killer)

if ( type != DamageType::Phazer && m_type == OBJECT_MOTHER ) return false; // AlienQueen can be destroyed only by PhazerShooter

if ( type == DamageType::Organic )
if ( type == DamageType::AlienAnt )
{
// TODO: I don't understand, why does it apply damage only once every 0.5 second?
// Balancing: bots and buildings hit by alien ants get 0.5 second invulnerability from the ants.
// This is necessary because PARTIGUN2 do not despawn when they hit and do 0.1 damage per hit compared to e.g. 0.001 per hit that shooters deal.
if ( m_shotTime < 0.5f ) return false;
m_shotTime = 0.0f;
}
Expand Down

0 comments on commit cb032e2

Please sign in to comment.