ElixirDoom.Combat (elixir_doom v0.1.0)

Copy Markdown View Source

Hurting and killing: damage with its knockback, armour and pain; death and what a monster drops; instant-hit shots and the aim that picks their target; missiles; and blasts that hurt everything in sight of them.

Summary

Functions

Aim from thing shooter_id along angle up to range: {slope, target_id} toward the first shootable thing whose middle the line can reach, or {0.0, nil}.

The slope and angle a player's shot takes along angle: the nearest target within a few degrees.

A BFG ball bursting at thing ball_id: forty rays fan out across a quarter turn from the player who fired it, each hurting the first thing it finds and leaving a flash on it.

Thing target_id takes damage from inflictor_id, caused by source_id.

Thing id dies, killed by source.

An instant-hit shot from shooter_id along angle at slope, range long: the first wall it meets gets a puff, the first thing in its path damage and blood.

A missile of type from source_id at dest_id.

A missile of type fired by player thing source_id, aimed up or down at whatever is ahead.

A puff of smoke where a shot struck.

A blast at thing spot_id hurting everything in sight of it within damage units.

Whether thing a can see thing b.

Functions

aim(world, shooter_id, angle, range)

@spec aim(ElixirDoom.World.t(), term(), number(), number()) :: {float(), term() | nil}

Aim from thing shooter_id along angle up to range: {slope, target_id} toward the first shootable thing whose middle the line can reach, or {0.0, nil}.

auto_aim(world, source_id, angle)

@spec auto_aim(ElixirDoom.World.t(), term(), number()) :: {float(), float()}

The slope and angle a player's shot takes along angle: the nearest target within a few degrees.

bfg_spray(world, ball_id)

@spec bfg_spray(ElixirDoom.World.t(), term()) :: ElixirDoom.World.t()

A BFG ball bursting at thing ball_id: forty rays fan out across a quarter turn from the player who fired it, each hurting the first thing it finds and leaving a flash on it.

damage(world, target_id, inflictor_id, source_id, damage)

@spec damage(ElixirDoom.World.t(), term(), term() | nil, term() | nil, number()) ::
  ElixirDoom.World.t()

Thing target_id takes damage from inflictor_id, caused by source_id.

kill(world, id, source)

@spec kill(ElixirDoom.World.t(), term(), map() | nil) :: ElixirDoom.World.t()

Thing id dies, killed by source.

line_attack(world, shooter_id, angle, range, slope, damage)

@spec line_attack(
  ElixirDoom.World.t(),
  term(),
  number(),
  number(),
  number(),
  number()
) ::
  ElixirDoom.World.t()

An instant-hit shot from shooter_id along angle at slope, range long: the first wall it meets gets a puff, the first thing in its path damage and blood.

missile(world, source_id, dest_id, type)

@spec missile(ElixirDoom.World.t(), term(), term(), atom()) :: ElixirDoom.World.t()

A missile of type from source_id at dest_id.

player_missile(world, source_id, type)

@spec player_missile(ElixirDoom.World.t(), term(), atom()) :: ElixirDoom.World.t()

A missile of type fired by player thing source_id, aimed up or down at whatever is ahead.

puff(world, arg)

@spec puff(ElixirDoom.World.t(), {number(), number(), number()}) ::
  ElixirDoom.World.t()

A puff of smoke where a shot struck.

radius_attack(world, spot_id, source_id, damage)

@spec radius_attack(ElixirDoom.World.t(), term(), term() | nil, number()) ::
  ElixirDoom.World.t()

A blast at thing spot_id hurting everything in sight of it within damage units.

sees?(world, a, b)

@spec sees?(ElixirDoom.World.t(), map(), map()) :: boolean()

Whether thing a can see thing b.