Atrinik Server  4.0
Functions
projectile.c File Reference
#include <global.h>
#include <arch.h>
#include <object_methods.h>

Go to the source code of this file.

Functions

static objectprojectile_stick (object *op, object *victim)
 
void common_object_projectile_process (object *op)
 
objectcommon_object_projectile_move (object *op)
 
objectcommon_object_projectile_stop_missile (object *op, int reason)
 
objectcommon_object_projectile_stop_spell (object *op, int reason)
 
objectcommon_object_projectile_fire_missile (object *op, object *shooter, int dir)
 
int common_object_projectile_hit (object *op, object *victim)
 
int common_object_projectile_move_on (object *op, object *victim, object *originator, int state)
 

Detailed Description

Common projectile object (arrow, bolt, bullet, etc) related functions.

Definition in file projectile.c.

Function Documentation

object* common_object_projectile_fire_missile ( object op,
object shooter,
int  dir 
)

Function to handle firing a projectile, eg, an arrow being fired from a bow, or a potion being thrown.

Parameters
opWhat is being fired.
shooterWho is doing the firing.
dirDirection to fire into.
Returns
The fired object on success, NULL on failure.

Definition at line 301 of file projectile.c.

int common_object_projectile_hit ( object op,
object victim 
)

Called when a fired object finds an alive object on the square it just moved to.

Parameters
opThe fired object.
victimThe found alive object. Note that this just means that the object is on the LAYER_LIVING layer, which may or may not imply that the object is actually alive.
Return values
OBJECT_METHOD_OKSuccessfully processed and should stop the fired arch.
OBJECT_METHOD_UNHANDLEDDid not handle the event, should continue trying to look for another alive object.
OBJECT_METHOD_ERROR'op' was destroyed.

Definition at line 344 of file projectile.c.

object* common_object_projectile_move ( object op)

Function to handle a fired object moving, eg, arrow moving to the next square along its path.

Parameters
opThe fired object.
Returns
The fired object, NULL if it was destroyed for some reason.

Definition at line 152 of file projectile.c.

int common_object_projectile_move_on ( object op,
object victim,
object originator,
int  state 
)

Triggered when an object moves moves off a square and when object moves onto a square.

Parameters
opThe object that wants to catch this event.
victimThe object moving.
originatorThe object that is the cause of the move.
state1 if the object is moving onto a square, 0 if moving off a square.

Definition at line 376 of file projectile.c.

void common_object_projectile_process ( object op)

Processes an object, giving it the opportunity to move or react.

Parameters
opThe object to process.

Definition at line 68 of file projectile.c.

object* common_object_projectile_stop_missile ( object op,
int  reason 
)

Called to stop a fired object.

Parameters
opThe fired object.
reasonReason for stopping, one of Projectile stop reasons.
Returns
The fired object if it still exists, NULL otherwise.

Definition at line 182 of file projectile.c.

object* common_object_projectile_stop_spell ( object op,
int  reason 
)

Called to stop a fired object.

Parameters
opThe fired object.
reasonReason for stopping, one of Projectile stop reasons.
Returns
The fired object if it still exists, NULL otherwise.

Definition at line 284 of file projectile.c.

static object* projectile_stick ( object op,
object victim 
)
static

Attempts to stick a projectile such as an arrow into the victim.

Parameters
opProjectile.
victimVictim.
Returns
Pointer to the projectile, which may or may not have merged.

Definition at line 44 of file projectile.c.