… | |
… | |
3 | * |
3 | * |
4 | * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
4 | * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team |
5 | * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team |
6 | * Copyright (©) 1992,2007 Frank Tore Johansen |
6 | * Copyright (©) 1992,2007 Frank Tore Johansen |
7 | * |
7 | * |
8 | * Deliantra is free software: you can redistribute it and/or modify |
8 | * Deliantra is free software: you can redistribute it and/or modify it under |
9 | * it under the terms of the GNU General Public License as published by |
9 | * the terms of the Affero GNU General Public License as published by the |
10 | * the Free Software Foundation, either version 3 of the License, or |
10 | * Free Software Foundation, either version 3 of the License, or (at your |
11 | * (at your option) any later version. |
11 | * option) any later version. |
12 | * |
12 | * |
13 | * This program is distributed in the hope that it will be useful, |
13 | * This program is distributed in the hope that it will be useful, |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | * GNU General Public License for more details. |
16 | * GNU General Public License for more details. |
17 | * |
17 | * |
18 | * You should have received a copy of the GNU General Public License |
18 | * You should have received a copy of the Affero GNU General Public License |
19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
19 | * and the GNU General Public License along with this program. If not, see |
|
|
20 | * <http://www.gnu.org/licenses/>. |
20 | * |
21 | * |
21 | * The authors can be reached via e-mail to <support@deliantra.net> |
22 | * The authors can be reached via e-mail to <support@deliantra.net> |
22 | */ |
23 | */ |
23 | |
24 | |
24 | #include <global.h> |
25 | #include <global.h> |
… | |
… | |
1062 | break; |
1063 | break; |
1063 | } |
1064 | } |
1064 | else if (spell_ob->race && spell_ob->race == tmp2->name) |
1065 | else if (spell_ob->race && spell_ob->race == tmp2->name) |
1065 | { |
1066 | { |
1066 | if (!silent) |
1067 | if (!silent) |
1067 | new_draw_info_format (NDI_UNIQUE, 0, op, "You can not cast %s while %s is in effect", &spell_ob->name, &tmp2->name_pl); |
1068 | new_draw_info_format (NDI_UNIQUE, 0, op, |
|
|
1069 | "You can not cast %s while %s is in effect", |
|
|
1070 | &spell_ob->name, &tmp2->name_pl); |
1068 | |
1071 | |
1069 | return 0; |
1072 | return 0; |
1070 | } |
1073 | } |
1071 | } |
1074 | } |
1072 | } |
1075 | } |
1073 | |
1076 | |
1074 | if (!force) |
|
|
1075 | { |
|
|
1076 | force = get_archetype (FORCE_NAME); |
|
|
1077 | force->subtype = FORCE_CHANGE_ABILITY; |
|
|
1078 | |
|
|
1079 | if (spell_ob->race) |
|
|
1080 | force->name = spell_ob->race; |
|
|
1081 | else |
|
|
1082 | force->name = spell_ob->name; |
|
|
1083 | |
|
|
1084 | force->name_pl = spell_ob->name; |
|
|
1085 | new_draw_info (NDI_UNIQUE, 0, op, "You create an aura of magical force."); |
|
|
1086 | |
|
|
1087 | } |
|
|
1088 | else |
|
|
1089 | { |
|
|
1090 | int duration = change_ability_duration (spell_ob, caster); |
1077 | int duration = change_ability_duration (spell_ob, caster); |
1091 | |
1078 | |
|
|
1079 | if (force) |
|
|
1080 | { |
1092 | if (duration > force->duration) |
1081 | if (duration > force->duration) |
1093 | { |
1082 | { |
1094 | force->duration = duration; |
1083 | force->duration = duration; |
1095 | new_draw_info (NDI_UNIQUE, 0, op, "You recast the spell while in effect."); |
1084 | new_draw_info (NDI_UNIQUE, 0, op, "You recast the spell while in effect."); |
1096 | } |
1085 | } |
… | |
… | |
1098 | new_draw_info (NDI_UNIQUE, 0, op, "Recasting the spell had no effect."); |
1087 | new_draw_info (NDI_UNIQUE, 0, op, "Recasting the spell had no effect."); |
1099 | |
1088 | |
1100 | return 1; |
1089 | return 1; |
1101 | } |
1090 | } |
1102 | |
1091 | |
1103 | force->duration = spell_ob->duration + SP_level_duration_adjust (caster, spell_ob) * 50; |
1092 | new_draw_info_format (NDI_UNIQUE, 0, op, |
|
|
1093 | "You create an aura of magical force. H<The effect will last for about %.10g seconds.>", |
|
|
1094 | TICK2TIME (duration)); |
|
|
1095 | |
|
|
1096 | force = get_archetype (FORCE_NAME); |
|
|
1097 | force->subtype = FORCE_CHANGE_ABILITY; |
|
|
1098 | force->duration = duration; |
|
|
1099 | |
|
|
1100 | if (spell_ob->race) |
|
|
1101 | force->name = spell_ob->race; |
|
|
1102 | else |
|
|
1103 | force->name = spell_ob->name; |
|
|
1104 | |
|
|
1105 | force->name_pl = spell_ob->name; |
|
|
1106 | |
1104 | force->speed = 1.0; |
1107 | force->speed = 1.0; |
1105 | force->speed_left = -1.0; |
1108 | force->speed_left = -1.0; |
1106 | SET_FLAG (force, FLAG_APPLIED); |
1109 | SET_FLAG (force, FLAG_APPLIED); |
1107 | |
1110 | |
1108 | /* Now start processing the effects. First, protections */ |
1111 | /* Now start processing the effects. First, protections */ |
… | |
… | |
1571 | /* show invisible */ |
1574 | /* show invisible */ |
1572 | if (QUERY_FLAG (spell, FLAG_MAKE_INVIS) && |
1575 | if (QUERY_FLAG (spell, FLAG_MAKE_INVIS) && |
1573 | /* Might there be other objects that we can make visible? */ |
1576 | /* Might there be other objects that we can make visible? */ |
1574 | (tmp->invisible && (QUERY_FLAG (tmp, FLAG_MONSTER) |
1577 | (tmp->invisible && (QUERY_FLAG (tmp, FLAG_MONSTER) |
1575 | || (tmp->type == PLAYER && !QUERY_FLAG (tmp, FLAG_WIZ)) |
1578 | || (tmp->type == PLAYER && !QUERY_FLAG (tmp, FLAG_WIZ)) |
1576 | || tmp->type == CF_HANDLE |
1579 | || tmp->type == T_HANDLE |
1577 | || tmp->type == TRAPDOOR |
1580 | || tmp->type == TRAPDOOR |
1578 | || tmp->type == EXIT |
1581 | || tmp->type == EXIT |
1579 | || tmp->type == HOLE |
1582 | || tmp->type == HOLE |
1580 | || tmp->type == BUTTON |
1583 | || tmp->type == BUTTON |
1581 | || tmp->type == TELEPORTER |
1584 | || tmp->type == TELEPORTER |
… | |
… | |
2328 | { |
2331 | { |
2329 | new_draw_info (NDI_UNIQUE, 0, op, "Write what?"); |
2332 | new_draw_info (NDI_UNIQUE, 0, op, "Write what?"); |
2330 | return 0; |
2333 | return 0; |
2331 | } |
2334 | } |
2332 | |
2335 | |
2333 | if (strcasestr_local (msg, "endmsg")) |
2336 | if (!msg_is_safe (msg)) |
2334 | { |
2337 | { |
2335 | new_draw_info (NDI_UNIQUE, 0, op, "Trying to cheat are we?"); |
2338 | new_draw_info (NDI_UNIQUE, 0, op, "Trying to cheat are we?"); |
2336 | LOG (llevInfo, "write_rune: player %s tried to write bogus rune %s\n", &op->name, msg); |
2339 | LOG (llevInfo, "write_mark: player %s tried to write bogus rune %s\n", &op->name, msg); |
2337 | return 0; |
2340 | return 0; |
2338 | } |
2341 | } |
2339 | |
2342 | |
2340 | if (!spell->other_arch) |
2343 | if (!spell->other_arch) |
2341 | return 0; |
2344 | return 0; |