version 1.156 | | version 1.157 |
---|
| | |
/* | | /* |
* static char *rcsid_spell_effect_c = | | * static char *rcsid_spell_effect_c = |
* "$Id: spell_effect.c,v 1.156 2006/07/14 17:58:09 qal21 Exp $"; | | * "$Id: spell_effect.c,v 1.157 2006/08/07 13:39:21 ryo_saeba Exp $"; |
*/ | | */ |
| | |
| | |
| | |
object *tmp, *god=find_god(determine_god(op)); | | object *tmp, *god=find_god(determine_god(op)); |
| | |
if(!god) { | | if(!god) { |
new_draw_info(NDI_UNIQUE, 0,op, | | new_draw_info(NDI_UNIQUE, 0,op,"You can't consecrate anything if you don't worship a god!"); |
"You can't consecrate anything if you don't worship a god!"); | | |
return 0; | | return 0; |
} | | } |
| | |
| | |
if(tmp->type==HOLY_ALTAR) { | | if(tmp->type==HOLY_ALTAR) { |
| | |
if(tmp->level > caster_level(caster, spell)) { | | if(tmp->level > caster_level(caster, spell)) { |
new_draw_info_format(NDI_UNIQUE, 0,op, | | new_draw_info_format(NDI_UNIQUE, 0,op,"You are not powerful enough to reconsecrate the %s", tmp->name); |
"You are not powerful enough to reconsecrate the %s", tmp->name); | | |
return 0; | | return 0; |
} else { | | } else { |
/* If we got here, we are consecrating an altar */ | | /* If we got here, we are consecrating an altar */ |
if(tmp->name) free_string(tmp->name); | | object* new_altar; |
sprintf(buf,"Altar of %s",god->name); | | int letter; |
tmp->name = add_string(buf); | | archetype* altar_arch; |
tmp->level = caster_level(caster, spell); | | snprintf(buf,MAX_BUF,"altar_"); |
tmp->other_arch = god->arch; | | letter=strlen(buf); |
if(op->type==PLAYER) esrv_update_item(UPD_NAME, op, tmp); | | strncpy(buf+letter,god->name,MAX_BUF-letter); |
new_draw_info_format(NDI_UNIQUE,0, op, | | for (; letter < strlen(buf); letter++) |
"You consecrated the altar to %s!",god->name); | | buf[letter] = tolower(buf[letter]); |
| | altar_arch = find_archetype(buf); |
| | if (!altar_arch) { |
| | new_draw_info_format(NDI_UNIQUE, 0, op, "You fail to consecrate the altar."); |
| | LOG(llevError, "cast_consecrate: can't find altar %s for god %s", buf, god->name); |
| | return; |
| | } |
| | new_altar = arch_to_object(altar_arch); |
| | new_altar->x = tmp->x; |
| | new_altar->y = tmp->y; |
| | insert_ob_in_map(new_altar,tmp->map,tmp,INS_BELOW_ORIGINATOR); |
| | if(op->type==PLAYER) { |
| | esrv_del_item(op->contr, tmp->count); |
| | esrv_send_item(op, new_altar); |
| | } |
| | remove_ob(tmp); |
| | new_draw_info_format(NDI_UNIQUE,0, op,"You consecrated the altar to %s!",god->name); |
return 1; | | return 1; |
} | | } |
} | | } |