version 1.158 | | version 1.159 |
---|
| | |
/* | | /* |
* static char *rcsid_spell_effect_c = | | * static char *rcsid_spell_effect_c = |
* "$Id: spell_effect.c,v 1.158 2006/08/07 20:16:28 ryo_saeba Exp $"; | | * "$Id: spell_effect.c,v 1.159 2006/08/12 08:52:15 gros Exp $"; |
*/ | | */ |
| | |
| | |
| | |
* create nonnmagic arrows, or even -1, etc... | | * create nonnmagic arrows, or even -1, etc... |
*/ | | */ |
| | |
int cast_create_missile(object *op, object *caster,object *spell, int dir, const char *stringarg) | | int cast_create_missile(object *op, object *caster,object *spell, int dir, |
| | const char *stringarg) |
{ | | { |
int missile_plus=0, bonus_plus=0; | | int missile_plus=0, bonus_plus=0; |
const char *missile_name; | | const char *missile_name; |
| | |
missile_name = "arrow"; | | missile_name = "arrow"; |
| | |
for (tmp=op->inv; tmp != NULL; tmp=tmp->below) | | for (tmp=op->inv; tmp != NULL; tmp=tmp->below) |
if (tmp->type == BOW && QUERY_FLAG(tmp, FLAG_APPLIED)) { | | if (tmp->type == BOW && QUERY_FLAG(tmp, FLAG_APPLIED)) |
missile_name=tmp->race; | | missile_name=tmp->race; |
} | | |
| | |
missile_plus = spell->stats.dam + SP_level_dam_adjust(caster, spell); | | missile_plus = spell->stats.dam + SP_level_dam_adjust(caster, spell); |
| | |
| | if (!strcmp(missile_name, "arrows")) |
| | missile_name = "arrow"; |
| | else if (!strcmp(missile_name, "crossbow bolts")) |
| | missile_name = "bolt"; |
| | |
if (find_archetype(missile_name)==NULL) { | | if (find_archetype(missile_name)==NULL) { |
LOG(llevDebug, "Cast create_missile: could not find archetype %s\n", | | LOG(llevDebug, "Cast create_missile: could not find archetype %s\n", |
missile_name); | | missile_name); |
| | |
| | |
if (!al) { | | if (!al) { |
free_object(missile); | | free_object(missile); |
new_draw_info_format(NDI_UNIQUE, 0, op ,"No such object %ss of %s", missile_name, | | new_draw_info_format(NDI_UNIQUE, 0, op ,"No such object %ss of %s", |
stringarg); | | missile_name, stringarg); |
return 0; | | return 0; |
} | | } |
if (al->item->slaying) { | | if (al->item->slaying) { |
free_object(missile); | | free_object(missile); |
new_draw_info_format(NDI_UNIQUE, 0, op ,"You are not allowed to create %ss of %s", | | new_draw_info_format(NDI_UNIQUE, 0, op , |
missile_name, stringarg); | | "You are not allowed to create %ss of %s", missile_name, |
| | stringarg); |
return 0; | | return 0; |
} | | } |
give_artifact_abilities(missile, al->item); | | give_artifact_abilities(missile, al->item); |
/* These special arrows cost something extra. Don't have them also be magical - | | /* These special arrows cost something extra. Don't have them also be |
* otherwise, in most cases, not enough will be created. I don't want to get into | | * magical - otherwise, in most cases, not enough will be created. |
* the parsing of having to do both plus and type. | | * I don't want to get into the parsing of having to do both plus and |
| | * type. |
*/ | | */ |
bonus_plus = 1 + (al->item->value / 5); | | bonus_plus = 1 + (al->item->value / 5); |
missile_plus=0; | | missile_plus=0; |
} else | | } |
if (atoi(stringarg) < missile_plus) | | else if (atoi(stringarg) < missile_plus) |
missile_plus = atoi(stringarg); | | missile_plus = atoi(stringarg); |
} | | } |
if (missile_plus > 4) | | if (missile_plus > 4) |