1 | /* |
1 | /* |
2 | * static char *rcsid_spell_util_c = |
2 | * static char *rcsid_spell_util_c = |
3 | * "$Id: spell_util.C,v 1.1 2006/08/13 17:16:05 elmex Exp $"; |
3 | * "$Id: spell_util.C,v 1.2 2006/08/15 16:19:55 elmex Exp $"; |
4 | */ |
4 | */ |
5 | |
5 | |
6 | |
6 | |
7 | /* |
7 | /* |
8 | CrossFire, A Multiplayer game for X-windows |
8 | CrossFire, A Multiplayer game for X-windows |
… | |
… | |
1120 | /* See if we can cast a spell here. If the caster and op are |
1120 | /* See if we can cast a spell here. If the caster and op are |
1121 | * not alive, then this would mean that the mapmaker put the |
1121 | * not alive, then this would mean that the mapmaker put the |
1122 | * objects on the space - presume that they know what they are |
1122 | * objects on the space - presume that they know what they are |
1123 | * doing. |
1123 | * doing. |
1124 | */ |
1124 | */ |
1125 | if (spell_ob->type == SPELL && caster->type != POTION && !QUERY_FLAG(op, FLAG_WIZCAST) && |
1125 | if (spell_ob->type == SPELL |
1126 | (QUERY_FLAG(caster, FLAG_ALIVE) || QUERY_FLAG(op, FLAG_ALIVE)) && |
1126 | && (mflags & P_SAFE_MAP || caster->type != POTION) // elmex: prevent potions from casting on safe maps |
|
|
1127 | && !QUERY_FLAG(op, FLAG_WIZCAST) |
|
|
1128 | && (QUERY_FLAG(caster, FLAG_ALIVE) |
|
|
1129 | || QUERY_FLAG(op, FLAG_ALIVE)) |
1127 | (((mflags & P_NO_MAGIC) && spell_ob->stats.sp) || |
1130 | && (((mflags & P_NO_MAGIC) && spell_ob->stats.sp) |
1128 | ((mflags & P_NO_CLERIC) && spell_ob->stats.grace))) { |
1131 | || ((mflags & P_NO_CLERIC) && spell_ob->stats.grace))) |
1129 | |
1132 | { |
1130 | if (op->type!=PLAYER) |
1133 | if (op->type!=PLAYER) |
1131 | return 0; |
1134 | return 0; |
1132 | |
1135 | |
1133 | if ((mflags & P_NO_CLERIC) && spell_ob->stats.grace) |
1136 | if ((mflags & P_NO_CLERIC) && spell_ob->stats.grace) |
1134 | new_draw_info_format(NDI_UNIQUE, 0,op,"This ground is unholy! %s ignores you.",godname); |
1137 | new_draw_info_format(NDI_UNIQUE, 0,op,"This ground is unholy! %s ignores you.",godname); |
|
|
1138 | else if (mflags & P_SAFE_MAP) |
|
|
1139 | new_draw_info(NDI_UNIQUE, 0,op, |
|
|
1140 | "This ground is sacred! The gods prevent any magical effects done by you here!."); |
1135 | else |
1141 | else |
1136 | switch(op->contr->shoottype) { |
1142 | switch(op->contr->shoottype) |
|
|
1143 | { |
1137 | case range_magic: |
1144 | case range_magic: |
1138 | new_draw_info(NDI_UNIQUE, 0,op,"Something blocks your spellcasting."); |
1145 | new_draw_info(NDI_UNIQUE, 0,op,"Something blocks your spellcasting."); |
1139 | break; |
1146 | break; |
1140 | case range_misc: |
1147 | case range_misc: |
1141 | new_draw_info(NDI_UNIQUE, 0,op,"Something blocks the magic of your item."); |
1148 | new_draw_info(NDI_UNIQUE, 0,op,"Something blocks the magic of your item."); |
1142 | break; |
1149 | break; |
1143 | case range_golem: |
1150 | case range_golem: |
1144 | new_draw_info(NDI_UNIQUE, 0,op,"Something blocks the magic of your scroll."); |
1151 | new_draw_info(NDI_UNIQUE, 0,op,"Something blocks the magic of your scroll."); |
1145 | break; |
1152 | break; |
1146 | default: |
1153 | default: |
1147 | break; |
1154 | break; |
1148 | } |
1155 | } |
1149 | return 0; |
1156 | return 0; |
1150 | } |
1157 | } |
1151 | |
1158 | |
1152 | if (caster == op && settings.casting_time == TRUE && spell_ob->type == SPELL) { |
1159 | if (caster == op && settings.casting_time == TRUE && spell_ob->type == SPELL) { |
1153 | if (op->casting_time==-1) { /* begin the casting */ |
1160 | if (op->casting_time==-1) { /* begin the casting */ |
1154 | op->casting_time = (sint16) (spell_ob->casting_time*PATH_TIME_MULT(op,spell_ob)); |
1161 | op->casting_time = (sint16) (spell_ob->casting_time*PATH_TIME_MULT(op,spell_ob)); |
1155 | op->spell = spell_ob; |
1162 | op->spell = spell_ob; |