Crossfire Server, Branch 1.12
R12190
|
This file contains all the spell attack code. More...
#include <global.h>
#include <object.h>
#include <living.h>
#include <sproto.h>
#include <spells.h>
#include <sounds.h>
Go to the source code of this file.
Functions | |
int | cast_cause_disease (object *op, object *caster, object *spell, int dir) |
Let's try to infect something. | |
int | cast_cone (object *op, object *caster, int dir, object *spell) |
Casts a cone spell. | |
int | cast_curse (object *op, object *caster, object *spell_ob, int dir) |
Curse an object, reducing its statistics. | |
int | cast_destruction (object *op, object *caster, object *spell_ob) |
Hit all monsters around the caster. | |
int | cast_light (object *op, object *caster, object *spell, int dir) |
Illuminates something on a map, or try to blind a living thing. | |
int | cast_smite_spell (object *op, object *caster, int dir, object *spell) |
The priest points to a creature and causes a 'godly curse' to descend. | |
void | check_bullet (object *op) |
Checks to see what op should do, given the space it is on (eg, explode, damage player, etc). | |
void | cone_drop (object *op) |
Drops an object based on what is in the cone's "other_arch". | |
int | create_bomb (object *op, object *caster, int dir, object *spell) |
Create a bomb. | |
void | explode_bullet (object *op) |
Causes an object to explode, eg, a firebullet, poison cloud ball, etc. | |
int | fire_bolt (object *op, object *caster, int dir, object *spob, object *skill) |
Cast a bolt-like spell. | |
int | fire_bullet (object *op, object *caster, int dir, object *spob) |
Casts a bullet-like spell. | |
int | fire_swarm (object *op, object *caster, object *spell, int dir) |
The following routine creates a swarm of objects. | |
static object * | get_pointed_target (object *op, int dir, int range, int type) |
Returns the pointer to the first monster in the direction which is pointed to by op. | |
static int | make_object_glow (object *op, int radius, int time) |
Makes living objects glow. | |
int | mood_change (object *op, object *caster, object *spell) |
This covers the various spells that change the moods of monsters - makes them angry, peacful, friendly, etc. |
This file contains all the spell attack code.
Grouping this code together should hopefully make it easier to find the relevent bits of code.
Definition in file spell_attack.c.
int cast_cause_disease | ( | object * | op, |
object * | caster, | ||
object * | spell, | ||
int | dir | ||
) |
Let's try to infect something.
op | who is casting. |
caster | what object is casting. |
spell | spell object to cast. |
dir | cast direction. |
0 | no one caught anything. |
1 | at least one living was affected. |
Definition at line 1310 of file spell_attack.c.
References arch_to_object(), caster_level(), create_archetype(), draw_ext_info(), draw_ext_info_format(), FLAG_MONSTER, free_object(), freearr_x, freearr_y, get_map_flags(), GET_MAP_MOVE_BLOCK, GET_MAP_OB, infect_object(), insert_ob_in_map(), MOVE_FLY_LOW, MSG_TYPE_SPELL, MSG_TYPE_SPELL_FAILURE, MSG_TYPE_SPELL_SUCCESS, NDI_UNIQUE, P_IS_ALIVE, P_OUT_OF_MAP, PLAYER, QUERY_FLAG, set_owner(), set_spell_skill(), SP_level_dam_adjust(), SP_level_duration_adjust(), and SP_level_range_adjust().
Referenced by cast_spell().
int cast_cone | ( | object * | op, |
object * | caster, | ||
int | dir, | ||
object * | spell | ||
) |
Casts a cone spell.
op | person firing the object. |
caster | object casting the spell. |
dir | direction to fire in. |
spell | spell that is being fired. It uses other_arch for the archetype to fire. |
0 | couldn't cast. |
1 | successful cast. |
Definition at line 403 of file spell_attack.c.
References arch_to_object(), AT_FEAR, AT_GODPOWER, AT_HOLYWORD, AT_TURN_UNDEAD, caster_level(), cone_drop(), draw_ext_info(), fear_bonus, FLAG_UNDEAD, freearr_x, freearr_y, get_map_flags(), GET_MAP_MOVE_BLOCK, insert_ob_in_map(), llevDebug, LOG(), MOVE_FLY_LOW, MSG_TYPE_SPELL, MSG_TYPE_SPELL_ERROR, NDI_UNIQUE, P_OUT_OF_MAP, PLAYER, QUERY_FLAG, RUNE, set_owner(), set_spell_skill(), SP_level_dam_adjust(), SP_level_duration_adjust(), SP_level_range_adjust(), tailor_god_spell(), and turn_bonus.
Referenced by cast_spell(), cast_wonder(), prayer_failure(), and spell_failure().
int cast_curse | ( | object * | op, |
object * | caster, | ||
object * | spell_ob, | ||
int | dir | ||
) |
Curse an object, reducing its statistics.
op | who is casting. |
caster | what object is casting. |
spell_ob | spell object to cast. |
dir | cast direction. |
0 | curse had no effect. |
1 | something was cursed. |
Definition at line 914 of file spell_attack.c.
References add_refcount(), change_abil(), create_archetype(), determine_god(), draw_ext_info(), draw_ext_info_format(), find_god(), fix_object(), FLAG_APPLIED, FORCE, FORCE_CHANGE_ABILITY, FORCE_NAME, free_string(), get_pointed_target(), insert_ob_in_ob(), MSG_TYPE_SPELL, MSG_TYPE_SPELL_FAILURE, MSG_TYPE_SPELL_SUCCESS, MSG_TYPE_VICTIM, MSG_TYPE_VICTIM_SPELL, NDI_UNIQUE, PLAYER, SET_FLAG, SP_level_duration_adjust(), and SPELL_GRACE.
Referenced by cast_spell().
int cast_destruction | ( | object * | op, |
object * | caster, | ||
object * | spell_ob | ||
) |
Hit all monsters around the caster.
op | who is casting. |
caster | what object is casting. |
spell_ob | spell object to cast. |
Definition at line 819 of file spell_attack.c.
References arch_to_object(), ATNR_MAGIC, change_skill(), find_skill_by_name(), FLAG_ALIVE, FLAG_FRIENDLY, get_map_flags(), GET_MAP_OB, hit_player(), insert_ob_in_map(), make_object_glow(), P_IS_ALIVE, P_OUT_OF_MAP, PLAYER, QUERY_FLAG, SP_DESTRUCTION, SP_FAERY_FIRE, SP_level_dam_adjust(), SP_level_duration_adjust(), and SP_level_range_adjust().
Referenced by cast_spell().
int cast_light | ( | object * | op, |
object * | caster, | ||
object * | spell, | ||
int | dir | ||
) |
Illuminates something on a map, or try to blind a living thing.
See the spells documentation file for why this is its own function.
op | who is casting. |
caster | what object is casting. |
spell | spell object to cast. |
dir | cast direction. |
0 | no effect. |
1 | lighting successful. |
Definition at line 1235 of file spell_attack.c.
References arch_to_object(), draw_ext_info(), FLAG_MONSTER, freearr_x, freearr_y, get_map_flags(), GET_MAP_MOVE_BLOCK, GET_MAP_OB, hit_player(), insert_ob_in_map(), llevError, LOG(), MAX_LIGHT_RADII, MSG_TYPE_SPELL, MSG_TYPE_SPELL_ERROR, MSG_TYPE_SPELL_FAILURE, NDI_UNIQUE, OB_TYPE_MOVE_BLOCK, P_IS_ALIVE, P_OUT_OF_MAP, QUERY_FLAG, SP_level_dam_adjust(), SP_level_duration_adjust(), and SP_level_range_adjust().
Referenced by cast_spell().
int cast_smite_spell | ( | object * | op, |
object * | caster, | ||
int | dir, | ||
object * | spell | ||
) |
The priest points to a creature and causes a 'godly curse' to descend.
op | who is casting. |
caster | what object is casting. |
dir | cast direction. |
spell | spell object to cast. |
0 | spell had no effect. |
1 | something was affected by the spell. |
Definition at line 655 of file spell_attack.c.
References arch_to_object(), AT_DEATH, AT_GODPOWER, AT_HOLYWORD, caster_level(), determine_god(), draw_ext_info(), draw_ext_info_format(), find_god(), FLAG_REFL_SPELL, FLAG_UNDEAD, free_object(), get_pointed_target(), HUGE_BUF, insert_ob_in_map(), MSG_TYPE_SPELL, MSG_TYPE_SPELL_FAILURE, MSG_TYPE_SPELL_SUCCESS, NDI_UNIQUE, PREFER_LOW, QUERY_FLAG, query_name(), random_roll(), set_owner(), set_spell_skill(), SP_EXPLOSION, SP_level_dam_adjust(), SP_level_range_adjust(), SPELL_EFFECT, SPELL_GRACE, SPELL_MANA, and tailor_god_spell().
Referenced by cast_spell().
void check_bullet | ( | object * | op | ) |
Checks to see what op should do, given the space it is on (eg, explode, damage player, etc).
op | object to check. |
Definition at line 242 of file spell_attack.c.
References explode_bullet(), FLAG_ALIVE, FLAG_REMOVED, free_object(), get_map_flags(), GET_MAP_MOVE_BLOCK, GET_MAP_OB, hit_player(), OB_TYPE_MOVE_BLOCK, P_IS_ALIVE, QUERY_FLAG, and remove_ob().
Referenced by fire_bullet(), and move_bullet().
void cone_drop | ( | object * | op | ) |
Drops an object based on what is in the cone's "other_arch".
op | what object should drop. |
Definition at line 369 of file spell_attack.c.
References add_refcount(), arch_to_object(), free_string(), insert_ob_in_map(), and set_owner().
Referenced by cast_cone(), and move_cone().
int create_bomb | ( | object * | op, |
object * | caster, | ||
int | dir, | ||
object * | spell | ||
) |
Create a bomb.
op | who is casting. |
caster | what object is casting. |
dir | cast direction. |
spell | spell object to cast. |
0 | no bomb was placed. |
1 | bomb was placed on map. |
Definition at line 552 of file spell_attack.c.
References arch_to_object(), draw_ext_info(), freearr_x, freearr_y, get_map_flags(), GET_MAP_MOVE_BLOCK, insert_ob_in_map(), MOVE_WALK, MSG_TYPE_SPELL, MSG_TYPE_SPELL_ERROR, NDI_UNIQUE, P_OUT_OF_MAP, set_owner(), set_spell_skill(), SP_level_dam_adjust(), SP_level_duration_adjust(), and SP_level_range_adjust().
Referenced by cast_spell().
void explode_bullet | ( | object * | op | ) |
Causes an object to explode, eg, a firebullet, poison cloud ball, etc.
op | the object to explode. |
Definition at line 144 of file spell_attack.c.
References add_refcount(), arch_to_object(), AT_GODPOWER, AT_HOLYWORD, AT_MAGIC, copy_owner(), FREE_AND_CLEAR_STR, free_object(), get_owner(), hit_map(), insert_ob_in_map(), llevError, LOG(), object_get_env_recursive(), out_of_map(), remove_ob(), SP_BOMB, SP_CONE, SPELL_EFFECT, and tailor_god_spell().
Referenced by animate_bomb(), check_bullet(), and move_bullet().
int fire_bolt | ( | object * | op, |
object * | caster, | ||
int | dir, | ||
object * | spob, | ||
object * | skill | ||
) |
Cast a bolt-like spell.
We remove the magic flag - that can be derived from spob->attacktype. This function sets up the appropriate owner and skill pointers.
op | who is casting the spell. |
caster | what object is casting the spell (rod, ...). |
dir | firing direction. |
spob | spell object for the bolt. |
skill | skill to credit kill experience to. |
0 | no bolt could be fired. |
1 | bolt was fired (but may have been destroyed already). |
Definition at line 78 of file spell_attack.c.
References absdir(), add_refcount(), arch_to_object(), DIRX, DIRY, FLAG_IS_TURNABLE, FLAG_REFLECTING, free_object(), get_map_flags(), GET_MAP_MOVE_BLOCK, insert_ob_in_map(), ob_process(), OB_TYPE_MOVE_BLOCK, P_OUT_OF_MAP, QUERY_FLAG, SET_ANIMATION, set_owner(), set_spell_skill(), SP_level_dam_adjust(), SP_level_duration_adjust(), and SP_level_range_adjust().
Referenced by cast_spell().
int fire_bullet | ( | object * | op, |
object * | caster, | ||
int | dir, | ||
object * | spob | ||
) |
Casts a bullet-like spell.
We remove the magic flag - that can be derived from spob->attacktype. This function sets up the appropriate owner and skill pointers.
op | who is casting. |
caster | what object is really casting. |
dir | casting direction. |
spob | spell object for the bullet. |
0 | no bullet could be fired. |
1 | bullet was fired (but may have been destroyed already). |
Definition at line 301 of file spell_attack.c.
References absdir(), add_refcount(), arch_to_object(), check_bullet(), FLAG_IS_TURNABLE, FLAG_REFLECTING, free_object(), freearr_x, freearr_y, get_map_flags(), GET_MAP_MOVE_BLOCK, insert_ob_in_map(), OB_TYPE_MOVE_BLOCK, P_OUT_OF_MAP, QUERY_FLAG, SET_ANIMATION, set_owner(), set_spell_skill(), SP_level_dam_adjust(), SP_level_duration_adjust(), and SP_level_range_adjust().
Referenced by cast_spell(), and move_swarm_spell().
int fire_swarm | ( | object * | op, |
object * | caster, | ||
object * | spell, | ||
int | dir | ||
) |
The following routine creates a swarm of objects.
It actually sets up a specific swarm object, which then fires off all the parts of the swarm.
op | who is casting. |
caster | what object is casting. |
spell | spell object to cast. |
dir | cast direction. |
0 | nothing happened. |
1 | swarm was placed on map. |
Definition at line 1185 of file spell_attack.c.
References arch_to_object(), AT_GODPOWER, AT_HOLYWORD, caster_level(), create_archetype(), die_roll(), insert_ob_in_map(), PREFER_HIGH, set_owner(), set_spell_skill(), SP_level_duration_adjust(), SWARM_SPELL, and tailor_god_spell().
Referenced by cast_spell().
static object* get_pointed_target | ( | object * | op, |
int | dir, | ||
int | range, | ||
int | type | ||
) | [static] |
Returns the pointer to the first monster in the direction which is pointed to by op.
This is used by finger of death and the 'smite' spells.
op | caster - really only used for the source location. |
dir | direction to look in. |
range | how far out to look. |
type | type of spell - either SPELL_MANA or SPELL_GRACE. This info is used for blocked magic/unholy spaces. |
Definition at line 603 of file spell_attack.c.
References FLAG_MONSTER, freearr_x, freearr_y, get_map_flags(), GET_MAP_MOVE_BLOCK, GET_MAP_OB, MOVE_FLY_LOW, P_IS_ALIVE, P_NO_CLERIC, P_NO_MAGIC, P_OUT_OF_MAP, QUERY_FLAG, SPELL_GRACE, and SPELL_MANA.
Referenced by cast_curse(), and cast_smite_spell().
static int make_object_glow | ( | object * | op, |
int | radius, | ||
int | time | ||
) | [static] |
Makes living objects glow.
We do this by creating a force and inserting it in the object.
Creatures denied the path of light are unaffected.
op | what to make glow. |
radius | glow radius. |
time | glow duration. If 0, the object glows permanently. |
0 | nothing happened. |
1 | op is now glowing. |
Definition at line 777 of file spell_attack.c.
References create_archetype(), FLAG_IS_USED_UP, FORCE_NAME, insert_ob_in_ob(), llevError, LOG(), MAX_LIGHT_RADII, MIN_ACTIVE_SPEED, PATH_LIGHT, and SET_FLAG.
Referenced by cast_destruction().
int mood_change | ( | object * | op, |
object * | caster, | ||
object * | spell | ||
) |
This covers the various spells that change the moods of monsters - makes them angry, peacful, friendly, etc.
op | who is casting. |
caster | what object is casting. |
spell | spell object to cast. |
Definition at line 1014 of file spell_attack.c.
References add_friendly_object(), arch_to_object(), caster_level(), CLEAR_FLAG, determine_god(), did_make_save(), find_god(), FLAG_BERSERK, FLAG_FRIENDLY, FLAG_GENERATOR, FLAG_MONSTER, FLAG_NO_ATTACK, FLAG_SLEEP, FLAG_UNAGGRESSIVE, FLAG_UNDEAD, get_map_flags(), GET_MAP_OB, insert_ob_in_map(), MIN, NROFATTACKS, P_IS_ALIVE, P_OUT_OF_MAP, PETMOVE, PLAYER, PREFER_LOW, QUERY_FLAG, random_roll(), remove_friendly_object(), SET_FLAG, set_owner(), set_spell_skill(), share_exp(), SK_EXP_ADD_SKILL, and SP_level_range_adjust().
Referenced by cast_spell().