Crossfire Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
CF: spell level fixes III
- To: crossfire (at) ifi.uio.no
- Subject: CF: spell level fixes III
- From: Jan Echternach <>
- Date: Thu, 13 Apr 2000 13:31:11 +0200
- Mail-Followup-To:
- Reply-To: Jan Echternach <>
- Sender:
Several cosmetic fixes to server/spell_util.c.
Removed fixed_level argument from fire_arch_from_position() because a
swarm spell object is properly initialized to get the level with
casting_level().
--
Jan
diff -rc orig/crossfire-0.95.5-patch6/include/sproto.h crossfire-0.95.5/include/sproto.h
*** orig/crossfire-0.95.5-patch6/include/sproto.h Thu Apr 13 12:59:29 2000
--- crossfire-0.95.5/include/sproto.h Thu Apr 13 13:16:50 2000
***************
*** 563,569 ****
extern int cast_create_obj ( object *op, object *caster, object *new_op, int dir );
extern int summon_monster ( object *op, object *caster, int dir, archetype *at, int spellnum );
extern int fire_bolt ( object *op, object *caster, int dir, int type, int magic );
! extern int fire_arch_from_position ( object *op, object *caster, sint16 x, sint16 y, int dir, archetype *at, int type, int magic, int fixed_level );
extern int fire_arch ( object *op, object *caster, int dir, archetype *at, int type, int magic );
extern int cast_cone ( object *op, object *caster, int dir, int strength, int spell_type, archetype *spell_arch, int magic );
extern void move_cone ( object *op );
--- 563,569 ----
extern int cast_create_obj ( object *op, object *caster, object *new_op, int dir );
extern int summon_monster ( object *op, object *caster, int dir, archetype *at, int spellnum );
extern int fire_bolt ( object *op, object *caster, int dir, int type, int magic );
! extern int fire_arch_from_position ( object *op, object *caster, sint16 x, sint16 y, int dir, archetype *at, int type, int magic );
extern int fire_arch ( object *op, object *caster, int dir, archetype *at, int type, int magic );
extern int cast_cone ( object *op, object *caster, int dir, int strength, int spell_type, archetype *spell_arch, int magic );
extern void move_cone ( object *op );
diff -rc orig/crossfire-0.95.5-patch6/server/spell_util.c crossfire-0.95.5/server/spell_util.c
*** orig/crossfire-0.95.5-patch6/server/spell_util.c Thu Apr 13 12:59:30 2000
--- crossfire-0.95.5/server/spell_util.c Thu Apr 13 13:24:18 2000
***************
*** 109,141 ****
* base_level: level before considering attuned/repelled paths
* Returns modified level.
*/
! int path_level_mod (object *op, int base_level, int sp)
{
! spell *s = find_spell(sp);
int new_level;
! if (op->path_denied & s->path)
{
LOG (llevError, "BUG: path_level_mod (arch %s, name %s): casting denied "
! "spell\n", op->arch->name, op->name);
return 1;
}
new_level = base_level
! + ((op->path_repelled & s->path) ? -5 : 0)
! + ((op->path_attuned & s->path) ? 5 : 0);
return (new_level < 1) ? 1 : new_level;
}
! int casting_level (object *op, int sp)
{
! return path_level_mod (op, SK_level (op), sp);
}
! int check_spell_known(object *op,int sp) {
int i;
for(i=0; i < (int)op->contr->nrofknownspells; i++)
! if(op->contr->known_spells[i]==sp)
return 1;
return 0;
}
--- 109,142 ----
* base_level: level before considering attuned/repelled paths
* Returns modified level.
*/
! int path_level_mod (object *caster, int base_level, int spell_type)
{
! spell *s = find_spell(spell_type);
int new_level;
! if (caster->path_denied & s->path)
{
LOG (llevError, "BUG: path_level_mod (arch %s, name %s): casting denied "
! "spell\n", caster->arch->name, caster->name);
return 1;
}
new_level = base_level
! + ((caster->path_repelled & s->path) ? -5 : 0)
! + ((caster->path_attuned & s->path) ? 5 : 0);
return (new_level < 1) ? 1 : new_level;
}
! int casting_level (object *caster, int spell_type)
{
! return path_level_mod (caster, SK_level (caster), spell_type);
}
! int check_spell_known (object *op, int spell_type)
! {
int i;
for(i=0; i < (int)op->contr->nrofknownspells; i++)
! if(op->contr->known_spells[i]==spell_type)
return 1;
return 0;
}
***************
*** 983,997 ****
int magic)
{
return fire_arch_from_position (op, caster, op->x, op->y, dir, at,
! type, magic, 0);
}
- /*
- * fixed_level: use this level if not zero instead of calculating the
- * casting level from caster's level and attuned/repelled paths.
- */
int fire_arch_from_position (object *op, object *caster, sint16 x, sint16 y,
! int dir, archetype *at, int type, int magic, int fixed_level)
{
object *tmp, *env;
--- 984,994 ----
int magic)
{
return fire_arch_from_position (op, caster, op->x, op->y, dir, at,
! type, magic);
}
int fire_arch_from_position (object *op, object *caster, sint16 x, sint16 y,
! int dir, archetype *at, int type, int magic)
{
object *tmp, *env;
***************
*** 1009,1015 ****
tmp->x=x, tmp->y=y;
tmp->direction=dir;
set_owner(tmp,op);
! tmp->level = fixed_level ? fixed_level : casting_level (caster, type);
#ifdef MULTIPLE_GODS /* needed for AT_HOLYWORD,AT_GODPOWER stuff */
if(tmp->attacktype&AT_HOLYWORD||tmp->attacktype&AT_GODPOWER) {
if(!tailor_god_spell(tmp,op)) return 0;
--- 1006,1012 ----
tmp->x=x, tmp->y=y;
tmp->direction=dir;
set_owner(tmp,op);
! tmp->level = casting_level (caster, type);
#ifdef MULTIPLE_GODS /* needed for AT_HOLYWORD,AT_GODPOWER stuff */
if(tmp->attacktype&AT_HOLYWORD||tmp->attacktype&AT_GODPOWER) {
if(!tailor_god_spell(tmp,op)) return 0;
***************
*** 1798,1804 ****
/* that's stored in op->stats.sp by fire_swarm */
if ( ! wall (op->map, x, y))
fire_arch_from_position (owner, op, x, y, op->direction, op->other_arch,
! op->stats.sp, op->magic, op->level);
}
--- 1795,1801 ----
/* that's stored in op->stats.sp by fire_swarm */
if ( ! wall (op->map, x, y))
fire_arch_from_position (owner, op, x, y, op->direction, op->other_arch,
! op->stats.sp, op->magic);
}
***************
*** 1822,1828 ****
int spell_type, int n, int magic)
{
object *tmp;
! tmp=arch_to_object(find_archetype("swarm_spell"));
tmp->x=op->x;
tmp->y=op->y;
set_owner(tmp,op); /* needed so that if swarm elements kill, caster gets xp.*/
--- 1819,1825 ----
int spell_type, int n, int magic)
{
object *tmp;
! tmp=get_archetype("swarm_spell");
tmp->x=op->x;
tmp->y=op->y;
set_owner(tmp,op); /* needed so that if swarm elements kill, caster gets xp.*/