version 1.119 | | version 1.120 |
---|
| | |
/* | | /* |
* static char *rcsid_spell_effect_c = | | * static char *rcsid_spell_effect_c = |
* "$Id: spell_effect.c,v 1.119 2004/05/16 06:05:09 mwedel Exp $"; | | * "$Id: spell_effect.c,v 1.120 2004/06/01 07:21:11 mwedel Exp $"; |
*/ | | */ |
| | |
| | |
| | |
| | |
int cast_create_missile(object *op, object *caster,object *spell, int dir, char *stringarg) | | int cast_create_missile(object *op, object *caster,object *spell, int dir, char *stringarg) |
{ | | { |
int missile_plus=0; | | int missile_plus=0, bonus_plus=0; |
char *missile_name; | | char *missile_name; |
object *tmp, *missile; | | object *tmp, *missile; |
tag_t tag; | | tag_t tag; |
| | |
| | |
missile_plus = spell->stats.dam + SP_level_dam_adjust(caster, spell); | | missile_plus = spell->stats.dam + SP_level_dam_adjust(caster, spell); |
| | |
| | if (find_archetype(missile_name)==NULL) { |
| | LOG(llevDebug, "Cast create_missile: could not find archtype %s\n", |
| | missile_name); |
| | return 0; |
| | } |
| | missile = get_archetype(missile_name); |
| | |
if (stringarg) { | | if (stringarg) { |
| | /* If it starts with a letter, presume it is a description */ |
| | if (isalpha(*stringarg)) { |
| | artifact *al = find_artifactlist(missile->type)->items; |
| | |
| | for ( ; al != NULL; al=al->next) |
| | if (!strcasecmp(al->item->name, stringarg)) break; |
| | |
| | if (!al) { |
| | free_object(missile); |
| | new_draw_info_format(NDI_UNIQUE, 0, op ,"No such object %ss of %s", stringarg); |
| | return 0; |
| | } |
| | if (al->item->slaying) { |
| | free_object(missile); |
| | new_draw_info_format(NDI_UNIQUE, 0, op ,"You are not allowed to create %ss of %s", |
| | missile_name, stringarg); |
| | return 0; |
| | } |
| | give_artifact_abilities(missile, al->item); |
| | /* These special arrows cost something extra. Don't have them also be magical - |
| | * otherwise, in most cases, not enough will be created. I don't want to get into |
| | * the parsing of having to do both plus and type. |
| | */ |
| | bonus_plus = 1 + (al->item->value / 5); |
| | missile_plus=0; |
| | } else |
if (atoi(stringarg) < missile_plus) | | if (atoi(stringarg) < missile_plus) |
missile_plus = atoi(stringarg); | | missile_plus = atoi(stringarg); |
} | | } |
| | |
else if (missile_plus < -4) | | else if (missile_plus < -4) |
missile_plus = -4; | | missile_plus = -4; |
| | |
if (find_archetype(missile_name)==NULL) { | | |
LOG(llevDebug, "Cast create_missile: could not find archtype %s\n", | | |
missile_name); | | |
return 0; | | |
} | | |
missile = get_archetype(missile_name); | | |
missile->nrof = spell->duration + SP_level_duration_adjust(caster, spell); | | missile->nrof = spell->duration + SP_level_duration_adjust(caster, spell); |
missile->nrof -= 3 * missile_plus; | | missile->nrof -= 3 * (missile_plus + bonus_plus); |
if (missile->nrof < 1) | | if (missile->nrof < 1) |
missile->nrof=1; | | missile->nrof=1; |
| | |