64 for (tmp = ob->
inv; tmp; tmp = tmp->
below)
74 for (tmp = ob->
inv; tmp; tmp = tmp->
below)
108 if (caster == op && spob->
skill)
110 else if (caster->
skill)
133 if (i == NUM_SKILLS) {
216 new_level = spell->
level
219 return MAX(new_level, 1);
238 int level = caster->
level;
311 return MAX(sp, grace);
317 LOG(
llevError,
"SP_level_spellpoint_cost: Unknown flags passed: %d\n", flags);
411 for (spop = op->
inv; spop; spop = spop->
below)
431 object *spob1 = NULL, *spob2 = NULL, *spob;
441 for (spob = op->
inv; spob; spob = spob->
below) {
442 if (spob->type ==
SPELL) {
443 if (!strncmp(spob->name, spname, strlen(spname))) {
444 if (strlen(spname) == strlen(spob->name))
449 }
else if (!strncmp(spob->name, spname, strlen(spob->name))) {
456 LOG(
llevError,
"Found multiple spells with overlapping base names: %s, %s\n", spob2->name, spob->name);
466 if (spob1 && nummatch == 1)
525 "Something is in the way. You cast it at your feet.", NULL);
675 "You can't cast the spell on top of a wall!", NULL);
821 for (inv = tmp->
inv; inv; inv = inv->
below) {
855 int owner_type = 0, mflags;
859 if (exclude && exclude->
head)
860 exclude = exclude->
head;
861 if (exclude && exclude->
type)
862 owner_type = exclude->
type;
864 for (i =
rndm(1, 8); i < max; i++) {
877 || (tmp == exclude || (tmp->
head && tmp->
head == exclude))))
902 object *tmp, *head = NULL, *prev = NULL;
973 for (i = 0; i < n; i++)
1026 const char *godname;
1030 godname =
"Your spirit";
1032 if (failure <= -20 && failure > -40) {
1034 "%s gives a sign to renew your faith.",
1035 "%s gives a sign to renew your faith.",
1040 }
else if (failure <= -40 && failure > -60) {
1042 "Your diety touches your mind!", NULL);
1044 }
else if (failure <= -60 && failure > -150) {
1046 "%s requires you to pray NOW. You comply, ignoring all else.",
1047 "%s requires you to pray NOW. You comply, ignoring all else.",
1051 }
else if (failure <= -150) {
1084 if (failure <= -20 && failure > -40) {
1086 "Your spell causes an unexpected effect.", NULL);
1090 }
else if (failure <= -40 && failure > -60) {
1092 "Your magic recoils on you, making you confused!", NULL);
1094 }
else if (failure <= -60 && failure > -80) {
1096 "Your magic stuns you!", NULL);
1098 }
else if (failure <= -80) {
1104 "The magic warps and you are turned inside out!", NULL);
1108 "You lose control of the mana! The uncontrolled magic blasts you!",
1160 object *first = NULL;
1164 for (item = op->
inv; item; item = item->
below) {
1175 count =
rndm(0, count-1);
1176 for (item = first; item; item = item->
below) {
1206 "Your %s turns to a flower!",
1207 "Your %s turns to a flower!",
1231 if (second >= first)
1236 "You suddenly feel really weird!",
1237 "You suddenly feel really weird!");
1262 switch (RANDOM()%2) {
1308 int cast_spell(
object *op,
object *caster,
int dir,
object *spell_ob,
char *stringarg) {
1310 const char *godname;
1311 int success = 0, mflags, cast_level = 0, old_shoottype;
1312 object *skill = NULL;
1313 int confusion_effect = 0;
1318 LOG(
llevError,
"cast_spell: null spell object passed\n");
1322 godname =
"A random spirit";
1326 LOG(
llevError,
"cast_spell: null caster object passed\n");
1334 if (
rndm(0, 5) < 4) {
1338 "In your confused state, you're not sure of what you cast!",
1339 "In your confused state, you're not sure of what you cast!");
1342 confusion_effect = 1;
1350 "That spell path is denied to you.", NULL);
1365 if (spell_ob->
skill) {
1370 "You need the skill %s to cast %s.",
1371 "You need the skill %s to cast %s.",
1377 "You lack enough skill to cast that spell.", NULL);
1388 "You don't have enough mana.", NULL);
1396 "%s grants your prayer, though you are unworthy.",
1397 "%s grants your prayer, though you are unworthy.",
1403 "%s ignores your prayer.",
1404 "%s ignores your prayer.",
1415 "You fumble the spell.", NULL);
1421 }
else if (spell_ob->
stats.
sp) {
1427 "You bungle the spell because you have too much heavy equipment in use.",
1456 if ((mflags&P_NO_CLERIC) && spell_ob->
stats.
grace)
1458 "This ground is unholy! %s ignores you.",
1459 "This ground is unholy! %s ignores you.",
1465 "Something blocks your spellcasting.", NULL);
1470 "Something blocks the magic of your item.", NULL);
1474 "Something blocks the magic of your scroll.", NULL);
1486 op->
spell = spell_ob;
1499 "You are casting!", NULL);
1503 spell_ob = op->
spell;
1543 if (op != caster && !skill && caster->
skill) {
1551 "You lack the skill %s to use the %s",
1552 "You lack the skill %s to use the %s",
1553 caster->
skill, name);
1570 if (confusion_effect) {
1574 "In your confused state, you can't control the magic!",
1575 "In your confused state, you can't control the magic!");
1591 success =
write_rune(op, caster, spell_ob, dir, stringarg);
1595 success =
write_mark(op, spell_ob, stringarg);
1599 success =
fire_bolt(op, caster, dir, spell_ob, skill);
1607 success =
cast_cone(op, caster, dir, spell_ob);
1648 success =
magic_wall(op, caster, dir, spell_ob);
1668 success =
probe(op, caster, spell_ob, dir);
1672 success =
cast_heal(op, caster, spell_ob, dir);
1688 success =
cast_bless(op, caster, spell_ob, dir);
1692 success =
cast_curse(op, caster, spell_ob, dir);
1696 success =
summon_object(op, caster, spell_ob, dir, stringarg);
1700 success =
recharge(op, caster, spell_ob);
1710 "The spell fizzles", NULL);
1718 success =
alchemy(op, caster, spell_ob);
1741 "You lack the proper attunement to cast %s",
1742 "You lack the proper attunement to cast %s",
1750 success =
fire_swarm(op, caster, spell_ob, dir);
1759 success =
dispel_rune(op, caster, spell_ob, skill, dir);
1776 success =
cast_light(op, caster, spell_ob, dir);
1836 snprintf(dur,
sizeof(dur),
"%d", i);
1840 snprintf(dur,
sizeof(dur),
"%d", i);
1861 if (spell->
duration == atoi(key)) {
1863 "The effects of your %s are draining out.", NULL, spell->
name);
1868 if (spell->
duration == atoi(key)) {
1870 "The effects of your %s are about to expire.", NULL, spell->
name);
#define MSG_TYPE_SKILL_MISSING
int get_map_flags(mapstruct *oldmap, mapstruct **newmap, sint16 x, sint16 y, sint16 *nx, sint16 *ny)
void drain_rod_charge(object *rod)
const char * determine_god(object *op)
archetype * find_archetype(const char *name)
object * lookup_spell_by_name(object *op, const char *spname)
#define INS_BELOW_ORIGINATOR
int change_skill(object *who, object *new_skill, int flag)
int fire_bolt(object *op, object *caster, int dir, object *spob, object *skill)
const char * get_ob_key_value(const object *op, const char *const key)
int cast_raise_dead_spell(object *op, object *caster, object *spell, int dir, const char *arg)
struct Statistics statistics
int probe(object *op, object *caster, object *spell_ob, int dir)
void set_owner(object *op, object *owner)
void spell_failure(object *op, int failure, int power, object *skill)
void esrv_send_item(object *pl, object *op)
sstring add_refcount(sstring str)
object * find_target_for_friendly_spell(object *op, int dir)
int cast_change_ability(object *op, object *caster, object *spell_ob, int dir, int silent)
uint64 spell_suppressions
#define SP_CHANGE_MAP_LIGHT
int reflwall(mapstruct *m, int x, int y, object *sp_op)
#define SP_CHANGE_ABILITY
int fire_bullet(object *op, object *caster, int dir, object *spob)
#define MSG_TYPE_SPELL_INFO
int cast_bless(object *op, object *caster, object *spell_ob, int dir)
sint8 get_attr_value(const living *stats, int attr)
int spell_find_dir(mapstruct *m, int x, int y, object *exclude)
#define SP_ANIMATE_WEAPON
#define MSG_TYPE_SPELL_FAILURE
int SP_level_duration_adjust(const object *caster, const object *spob)
int SP_level_range_adjust(const object *caster, const object *spob)
#define SET_ANIMATION(ob, newanim)
void esrv_update_item(int flags, object *pl, object *op)
#define MSG_TYPE_SKILL_FAILURE
struct treasureliststruct * randomitems
int cast_smite_spell(object *op, object *caster, int dir, object *spell)
short freearr_x[SIZEOFFREE]
void draw_ext_info(int flags, int pri, const object *pl, uint8 type, uint8 subtype, const char *message, const char *oldmessage)
int cast_word_of_recall(object *op, object *caster, object *spell_ob)
const char * skill_names[NUM_SKILLS]
#define MSG_TYPE_SPELL_ERROR
uint8 spellpoint_level_depend
#define PATH_TIME_MULT(op, spell)
method_ret ob_process(object *op)
#define OUT_OF_REAL_MAP(M, X, Y)
int manual_apply(object *op, object *tmp, int aflag)
void draw_magic_map(object *pl)
object * check_spell_known(object *op, const char *name)
int create_bomb(object *op, object *caster, int dir, object *spell)
#define SP_CREATE_MISSILE
void draw_ext_info_format(int flags, int pri, const object *pl, uint8 type, uint8 subtype, const char *new_format, const char *old_format,...)
struct archt * other_arch
int recharge(object *op, object *caster, object *spell_ob)
#define SP_WORD_OF_RECALL
int caster_level(const object *caster, const object *spell)
int cast_cone(object *op, object *caster, int dir, object *spell)
int cast_create_food(object *op, object *caster, object *spell_ob, int dir, const char *stringarg)
short freearr_y[SIZEOFFREE]
void create_treasure(treasurelist *t, object *op, int flag, int difficulty, int tries)
void paralyze_living(object *op, object *hitter, int dam)
int summon_hostile_monsters(object *op, int n, const char *monstername)
int rndm(int min, int max)
int change_abil(object *op, object *tmp)
void remove_ob(object *op)
int cast_item_curse_or_curse(object *op, object *caster, object *spell_ob)
int cast_curse(object *op, object *caster, object *spell_ob, int dir)
int fire_swarm(object *op, object *caster, object *spell, int dir)
static void swap_random_stats(object *op)
void confuse_living(object *op, object *hitter, int dam)
#define SP_ITEM_CURSE_BLESS
uint8 spell_failure_effects
object * create_archetype(const char *name)
void store_spell_expiry(object *spell)
int cast_create_town_portal(object *op, object *caster, object *spell, int dir)
object * get_player_container(object *op)
EXTERN Chaos_Attacks ATTACKS[22]
static void handle_spell_confusion(object *op)
void set_attr_value(living *stats, int attr, sint8 value)
static void transmute_item_to_flower(object *op)
int perceive_self(object *op)
void set_spell_skill(object *op, object *caster, object *spob, object *dest)
int find_first_free_spot(const object *ob, mapstruct *m, int x, int y)
int cast_light(object *op, object *caster, object *spell, int dir)
int cast_create_obj(object *op, object *new_op, int dir)
void drain_wand_charge(object *wand)
int write_mark(object *op, object *spell, const char *msg)
void regenerate_rod(object *rod)
#define OB_SPELL_TAG_MATCH(op, count)
object * get_owner(object *op)
const char *const spell_mapping[]
#define MSG_TYPE_ITEM_CHANGE
static int put_a_monster(object *op, const char *monstername)
object * find_random_spell_in_ob(object *ob, const char *skill)
int fire_arch_from_position(object *op, object *caster, sint16 x, sint16 y, int dir, object *spell)
const int cleric_chance[MAX_STAT+1]
#define OB_TYPE_MOVE_BLOCK(ob1, type)
#define GET_MAP_MOVE_BLOCK(M, X, Y)
void play_sound_map(sint8 sound_type, object *emitter, int dir, const char *action)
int op_on_battleground(object *op, int *x, int *y, archetype **trophy)
int cast_detection(object *op, object *caster, object *spell)
void cast_magic_storm(object *op, object *tmp, int lvl)
#define FREE_AND_CLEAR_STR(xyz)
int cast_wonder(object *op, object *caster, int dir, object *spell_ob)
#define QUERY_FLAG(xyz, p)
#define CLEAR_FLAG(xyz, p)
char * strdup_local(const char *str)
int cast_invisible(object *op, object *caster, object *spell_ob)
int write_rune(object *op, object *caster, object *spell, int dir, const char *runename)
object * insert_ob_in_ob(object *op, object *where)
void shuffle_attack(object *op, int change_face)
int cast_consecrate(object *op, object *caster, object *spell)
int cast_transfer(object *op, object *caster, object *spell, int dir)
object * insert_ob_in_map(object *op, mapstruct *m, object *originator, int flag)
int dimension_door(object *op, object *caster, object *spob, int dir)
void copy_owner(object *op, object *clone)
int cast_destruction(object *op, object *caster, object *spell_ob)
static const flag_definition flags[]
#define SP_DIMENSION_DOOR
int snprintf(char *dest, int max, const char *format,...)
int tailor_god_spell(object *spellop, object *caster)
sint16 SP_level_spellpoint_cost(object *caster, object *spell, int flags)
static int can_be_transmuted(object *op)
int cast_cause_disease(object *op, object *caster, object *spell, int dir)
int cast_heal(object *op, object *caster, object *spell, int dir)
int set_ob_key_value(object *op, const char *key, const char *value, int add_key)
int cast_create_missile(object *op, object *caster, object *spell, int dir, const char *stringarg)
int summon_object(object *op, object *caster, object *spell_ob, int dir, const char *stringarg)
int mood_change(object *op, object *caster, object *spell)
int remove_curse(object *op, object *caster, object *spell)
int cast_earth_to_dust(object *op, object *caster, object *spell_ob)
int summon_golem(object *op, object *caster, int dir, object *spob)
void query_short_name(const object *op, char *buf, size_t size)
#define MSG_TYPE_APPLY_ERROR
#define SP_SUMMON_MONSTER
void update_ob_speed(object *op)
int min_casting_level(const object *caster, const object *spell)
int alchemy(object *op, object *caster, object *spell_ob)
void play_sound_player_only(player *pl, sint8 sound_type, object *emitter, int dir, const char *action)
#define GET_MAP_OB(M, X, Y)
#define FORCE_TRANSFORMED_ITEM
int animate_weapon(object *op, object *caster, object *spell, int dir)
void apply_anim_suffix(object *who, sstring suffix)
void LOG(LogLevel logLevel, const char *format,...)
object * last_skill_ob[NUM_SKILLS]
void check_spell_expiry(object *spell)
int can_see_monsterP(mapstruct *m, int x, int y, int dir)
int cast_change_map_lightlevel(object *op, object *caster, object *spell)
void query_name(const object *op, char *buf, size_t size)
#define MSG_TYPE_VICTIM_SPELL
int cast_spell(object *op, object *caster, int dir, object *spell_ob, char *stringarg)
void free_object(object *ob)
int random_roll(int min, int max, const object *op, int goodbad)
static void prayer_failure(object *op, int failure, int power)
void spell_effect(object *spob, int x, int y, mapstruct *map, object *originator)
int SP_level_dam_adjust(const object *caster, const object *spob)
int ok_to_put_more(mapstruct *m, sint16 x, sint16 y, object *op, uint32 immune_stop)
void esrv_del_item(player *pl, int tag)
void fix_object(object *op)
EXTERN archetype * first_archetype
object * find_skill_by_name(object *who, const char *name)
object * arch_to_object(archetype *at)
int cast_identify(object *op, object *caster, object *spell)
int hit_player(object *op, int dam, object *hitter, uint32 type, int full_hit)
int dispel_rune(object *op, object *caster, object *spell, object *skill, int dir)
int create_aura(object *op, object *caster, object *spell)
int cast_polymorph(object *op, object *caster, object *spell_ob, int dir)
int magic_wall(object *op, object *caster, int dir, object *spell_ob)
#define PATH_SP_MULT(op, spell)