Jazz2::Actors::Weapons::ShotBase class

Base class of a shot from a player's weapon.

Common base for the weapon projectiles fired by the player, providing shared damage, ownership, lifetime, movement and ricochet handling.

Base classes

class Jazz2::Actors::ActorBase
Base class of an object.

Derived classes

class BlasterShot
Blaster (shot).
class BouncerShot
Bouncer (shot).
class ElectroShot
Electro (shot).
class FreezerShot
Freezer (shot).
class PepperShot
Pepper (shot).
class RFShot
RF (shot).
class SeekerShot
Seeker (shot).
class ShieldFireShot
Fire shield (shot).
class ShieldLightningShot
Lightning shield (shot).
class ShieldWaterShot
Water shield (shot).
class Thunderbolt
Thunderbolt (shot).
class ToasterShot
Toaster (shot).

Constructors, destructors, conversion operators

ShotBase()
Creates a new instance.

Public functions

auto OnHandleCollision(ActorBase* other) -> bool override
Called when the object collides with another object.
auto GetStrength() -> std::int32_t
Returns strength (damage).
auto GetOwner() -> Player*
Returns owner of the shot.
auto GetWeaponType() -> WeaponType virtual
Returns weapon type.
void TriggerRicochet(ActorBase* other)
Triggers shot ricochet.

Protected functions

auto OnActivatedAsync(const ActorActivationDetails& details) -> Task<bool> override
Called when the object is created and activated.
void OnUpdate(float timeMult) override
Called every frame to update the object state.
void OnRicochet() virtual
Called on shot ricochet.
void TryMovement(float timeMult, Tiles::TileCollisionParams& params)
auto GetMovementSubstepCount(float timeMult) const -> std::int32_t
Returns how many sub-steps a shot's movement should be split into.

Function documentation

std::int32_t Jazz2::Actors::Weapons::ShotBase::GetMovementSubstepCount(float timeMult) const protected

Returns how many sub-steps a shot's movement should be split into.

TryMovement() only tests the destination of a move, so no single step may be long enough to pass through thin geometry. The count therefore comes from the distance the shot actually covers this frame, bounded against MaxMovementStep exactly as ActorBase::TryStandardMovement() bounds it, which makes it independent of both the frame rate and the shot's speed.