… | |
… | |
1036 | }; |
1036 | }; |
1037 | |
1037 | |
1038 | int |
1038 | int |
1039 | cast_change_ability (object *op, object *caster, object *spell_ob, int dir, int silent) |
1039 | cast_change_ability (object *op, object *caster, object *spell_ob, int dir, int silent) |
1040 | { |
1040 | { |
1041 | object *force = NULL; |
1041 | object *force = 0; |
1042 | int i; |
1042 | int i; |
1043 | |
1043 | |
1044 | /* if dir = 99 op defaults to tmp, eat_special_food() requires this. */ |
1044 | /* if dir = 99 op defaults to tmp, eat_special_food() requires this. */ |
1045 | object *tmp = dir |
1045 | object *tmp = dir |
1046 | ? find_target_for_friendly_spell (op, dir) |
1046 | ? find_target_for_friendly_spell (op, dir) |
1047 | : op; |
1047 | : op; |
1048 | |
1048 | |
1049 | if (!tmp) |
1049 | if (!tmp) |
1050 | return 0; |
1050 | return 0; |
1051 | |
1051 | |
1052 | /* If we've already got a force of this type, don't add a new one. */ |
1052 | /* If we've already got a force of this type, don't add a new one. */ |
… | |
… | |
1061 | } |
1061 | } |
1062 | else if (spell_ob->race && spell_ob->race == tmp2->name) |
1062 | else if (spell_ob->race && spell_ob->race == tmp2->name) |
1063 | { |
1063 | { |
1064 | if (!silent) |
1064 | if (!silent) |
1065 | new_draw_info_format (NDI_UNIQUE, 0, op, "You can not cast %s while %s is in effect", &spell_ob->name, &tmp2->name_pl); |
1065 | new_draw_info_format (NDI_UNIQUE, 0, op, "You can not cast %s while %s is in effect", &spell_ob->name, &tmp2->name_pl); |
|
|
1066 | |
1066 | return 0; |
1067 | return 0; |
1067 | } |
1068 | } |
1068 | } |
1069 | } |
1069 | } |
1070 | } |
1070 | if (force == NULL) |
1071 | |
|
|
1072 | if (!force) |
1071 | { |
1073 | { |
1072 | force = get_archetype (FORCE_NAME); |
1074 | force = get_archetype (FORCE_NAME); |
1073 | force->subtype = FORCE_CHANGE_ABILITY; |
1075 | force->subtype = FORCE_CHANGE_ABILITY; |
|
|
1076 | |
1074 | if (spell_ob->race) |
1077 | if (spell_ob->race) |
1075 | force->name = spell_ob->race; |
1078 | force->name = spell_ob->race; |
1076 | else |
1079 | else |
1077 | force->name = spell_ob->name; |
1080 | force->name = spell_ob->name; |
|
|
1081 | |
1078 | force->name_pl = spell_ob->name; |
1082 | force->name_pl = spell_ob->name; |
1079 | new_draw_info (NDI_UNIQUE, 0, op, "You create an aura of magical force."); |
1083 | new_draw_info (NDI_UNIQUE, 0, op, "You create an aura of magical force."); |
1080 | |
1084 | |
1081 | } |
1085 | } |
1082 | else |
1086 | else |
… | |
… | |
1088 | { |
1092 | { |
1089 | force->duration = duration; |
1093 | force->duration = duration; |
1090 | new_draw_info (NDI_UNIQUE, 0, op, "You recast the spell while in effect."); |
1094 | new_draw_info (NDI_UNIQUE, 0, op, "You recast the spell while in effect."); |
1091 | } |
1095 | } |
1092 | else |
1096 | else |
1093 | { |
|
|
1094 | new_draw_info (NDI_UNIQUE, 0, op, "Recasting the spell had no effect."); |
1097 | new_draw_info (NDI_UNIQUE, 0, op, "Recasting the spell had no effect."); |
1095 | } |
|
|
1096 | |
1098 | |
1097 | return 1; |
1099 | return 1; |
1098 | } |
1100 | } |
1099 | |
1101 | |
1100 | force->duration = spell_ob->duration + SP_level_duration_adjust (caster, spell_ob) * 50; |
1102 | force->duration = spell_ob->duration + SP_level_duration_adjust (caster, spell_ob) * 50; |