version 1.21 | | version 1.22 |
---|
| | |
/* | | /* |
* static char *rcsid_spell_effect_c = | | * static char *rcsid_spell_effect_c = |
* "$Id: spell_effect.c,v 1.21 2000/06/09 00:17:22 cvs Exp $"; | | * "$Id: spell_effect.c,v 1.22 2000/06/09 12:01:47 jec Exp $"; |
*/ | | */ |
| | |
| | |
| | |
op->contr->golem=tmp; | | op->contr->golem=tmp; |
op->contr->shoottype=range_scroll; | | op->contr->shoottype=range_scroll; |
} else { | | } else { |
/* if uncursed and animated by a pet(???), make the golem a pet */ | | /* If spell is cast by a pet, and the weapon is not cursed, make the animated |
| | * weapon a pet. */ |
if(QUERY_FLAG(op, FLAG_FRIENDLY) | | if(QUERY_FLAG(op, FLAG_FRIENDLY) |
&& !QUERY_FLAG(weapon,FLAG_CURSED) | | && !QUERY_FLAG(weapon,FLAG_CURSED) |
&& !QUERY_FLAG(weapon,FLAG_DAMNED)){ | | && !QUERY_FLAG(weapon,FLAG_DAMNED)){ |
| | |
} | | } |
| | |
/* ok, tailor the golem's characteristics based on the weapon */ | | /* ok, tailor the golem's characteristics based on the weapon */ |
tmp->stats.Str += weapon->stats.Str; | | if (spellnum == SP_STAFF_TO_SNAKE || spellnum == SP_ANIMATE_WEAPON) { |
tmp->stats.Dex += weapon->stats.Dex; | | if (apply_special (op, weapon, |
tmp->stats.Con += weapon->stats.Con; | | AP_UNAPPLY | AP_IGNORE_CURSE | AP_NO_MERGE)) |
tmp->stats.Int += weapon->stats.Int; | | { |
tmp->stats.Wis += weapon->stats.Wis; | | LOG (llevError, "BUG: animate_weapon(): can't unapply weapon\n"); |
tmp->stats.Pow += weapon->stats.Pow; | | return 0; |
tmp->stats.Cha += weapon->stats.Cha; | | } |
LOG(llevDebug, "animate_weapon: Str:%d Dex:%d Con:%d Int:%d Wis:%d Pow:%d Cha:%d.\n", | | remove_ob (weapon); |
tmp->stats.Str, tmp->stats.Dex, tmp->stats.Con, tmp->stats.Int, tmp->stats.Wis, tmp->stats.Pow, tmp->stats.Cha); | | insert_ob_in_ob (weapon, tmp); |
| | if (op->type == PLAYER) |
| | esrv_send_item(op, weapon); |
| | SET_FLAG (tmp, FLAG_USE_WEAPON); |
| | if (apply_special (tmp, weapon, AP_APPLY)) |
| | LOG (llevError, "BUG: animate_weapon(): golem can't apply weapon\n"); |
| | } |
| | |
/* modify weapon's animated wc */ | | /* modify weapon's animated wc */ |
tmp->stats.wc = tmp->stats.wc | | tmp->stats.wc = tmp->stats.wc |
- weapon->stats.wc | | |
- SP_level_dam_adjust(op,caster,spellnum) | | - SP_level_dam_adjust(op,caster,spellnum) |
- 5 * weapon->stats.Dex | | - 5 * weapon->stats.Dex |
- 2 * weapon->stats.Str | | - 2 * weapon->stats.Str |
| | |
if(tmp->stats.dam<0) tmp->stats.dam=127; | | if(tmp->stats.dam<0) tmp->stats.dam=127; |
LOG(llevDebug,"animate_weapon: wc:%d hp:%d dam:%d.\n", tmp->stats.wc, tmp->stats.hp, tmp->stats.dam); | | LOG(llevDebug,"animate_weapon: wc:%d hp:%d dam:%d.\n", tmp->stats.wc, tmp->stats.hp, tmp->stats.dam); |
/* attacktype */ | | /* attacktype */ |
if (weapon->attacktype) { | | if ( ! tmp->attacktype) |
tmp->attacktype = weapon->attacktype; | | |
} else { | | |
tmp->attacktype = AT_PHYSICAL; | | tmp->attacktype = AT_PHYSICAL; |
} | | |
/* Set weapon's protection according to material and protected attribute */ | | |
tmp->protected = weapon->protected; | | |
/* Set vulnerability according to weapon's material and vulnerability attribute */ | | |
tmp->vulnerable = weapon->vulnerable; | | |
for(i=0; i<NROFMATERIALS; i++) | | for(i=0; i<NROFMATERIALS; i++) |
for(j=0; j<NROFATTACKS; j++) | | for(j=0; j<NROFATTACKS; j++) |
if(weapon->material & (1<<i)) { | | if(weapon->material & (1<<i)) { |
| | |
} | | } |
} | | } |
tmp->armour = 100 - (int)((100.0-(float)tmp->armour)/(30.0-2.0*(a>14?14.0:(float)a))); | | tmp->armour = 100 - (int)((100.0-(float)tmp->armour)/(30.0-2.0*(a>14?14.0:(float)a))); |
/* If the weapon has a Slaying list, so does the golem */ | | LOG (llevDebug, "animate_weapon: slaying %s\n", |
if (tmp->slaying) { | | tmp->slaying ? tmp->slaying : "nothing"); |
free_string (tmp->slaying); | | |
tmp->slaying = NULL; | | |
} | | |
if(weapon->slaying) tmp->slaying = add_string(weapon->slaying); | | |
| | |
/* Determine golem's speed */ | | /* Determine golem's speed */ |
tmp->speed = ((weapon->last_sp>0.1)?weapon->last_sp:0.1) - | | tmp->speed = ((weapon->last_sp>0.1)?weapon->last_sp:0.1) - |
| | |
switch(spellnum) { | | switch(spellnum) { |
| | |
case SP_STAFF_TO_SNAKE: | | case SP_STAFF_TO_SNAKE: |
/* now, remove object from op inv, insert into golem */ | | |
remove_ob(weapon); | | |
/* apply_special(op, weapon, AP_UNAPPLY);*/ | | |
insert_ob_in_ob(weapon,tmp); | | |
fix_player(op); | | |
esrv_send_item(op, weapon); | | |
new_draw_info(NDI_UNIQUE, 0,op,"Your staff becomes a serpent and leaps to the ground!"); | | new_draw_info(NDI_UNIQUE, 0,op,"Your staff becomes a serpent and leaps to the ground!"); |
break; | | break; |
| | |
case SP_ANIMATE_WEAPON: | | case SP_ANIMATE_WEAPON: |
/* now, remove object from op inv, insert into golem */ | | |
remove_ob(weapon); | | |
/* apply_special(op, weapon, AP_UNAPPLY);*/ | | |
insert_ob_in_ob(weapon,tmp); | | |
fix_player(op); | | |
esrv_send_item(op, weapon); | | |
| | |
new_draw_info_format(NDI_UNIQUE, 0,op,"Your %s flies from your hand and hovers in mid-air!", weapon->name); | | new_draw_info_format(NDI_UNIQUE, 0,op,"Your %s flies from your hand and hovers in mid-air!", weapon->name); |
if(tmp->name) free_string(tmp->name); | | |
sprintf(buf, "animated %s", weapon->name); | | sprintf(buf, "animated %s", weapon->name); |
| | if(tmp->name) free_string(tmp->name); |
tmp->name = add_string(buf); | | tmp->name = add_string(buf); |
| | |
tmp->face = weapon->face; | | tmp->face = weapon->face; |
| | |
CLEAR_FLAG(tmp,FLAG_ANIMATE); | | CLEAR_FLAG(tmp,FLAG_ANIMATE); |
} | | } |
update_ob_speed(tmp); | | update_ob_speed(tmp); |
SET_FLAG(weapon,FLAG_APPLIED); /* so it can take acid damage */ | | |
break; | | break; |
| | |
case SP_DANCING_SWORD: | | case SP_DANCING_SWORD: |