… | |
… | |
56 | |
56 | |
57 | nx = op->x + freearr_x[dir]; |
57 | nx = op->x + freearr_x[dir]; |
58 | ny = op->y + freearr_y[dir]; |
58 | ny = op->y + freearr_y[dir]; |
59 | m = op->map; |
59 | m = op->map; |
60 | |
60 | |
61 | if (get_map_flags (m, &m, nx, ny, &nx, &ny) && (P_OUT_OF_MAP | P_SAFE | P_NO_MAGIC | P_NO_CLERIC)) |
61 | if (get_map_flags (m, &m, nx, ny, &nx, &ny) & (P_OUT_OF_MAP | P_SAFE | P_NO_MAGIC | P_NO_CLERIC)) |
62 | { |
62 | { |
63 | new_draw_info (NDI_UNIQUE, 0, op, "Can't make a rune there!"); |
63 | new_draw_info (NDI_UNIQUE, 0, op, "Can't make a rune there!"); |
64 | return 0; |
64 | return 0; |
65 | } |
65 | } |
66 | |
66 | |
… | |
… | |
68 | if (tmp->type == RUNE) |
68 | if (tmp->type == RUNE) |
69 | break; |
69 | break; |
70 | |
70 | |
71 | if (tmp) |
71 | if (tmp) |
72 | { |
72 | { |
73 | new_draw_info (NDI_UNIQUE, 0, op, "You can't write a rune there."); |
73 | new_draw_info (NDI_UNIQUE, 0, op, "You can't write a rune on top of another rune."); |
74 | return 0; |
74 | return 0; |
75 | } |
75 | } |
76 | |
76 | |
77 | if (spell->other_arch) |
77 | if (spell->other_arch) |
78 | rune_spell = arch_to_object (spell->other_arch); |
78 | rune_spell = arch_to_object (spell->other_arch); |
… | |
… | |
90 | return 0; |
90 | return 0; |
91 | } |
91 | } |
92 | |
92 | |
93 | rune_spell = NULL; |
93 | rune_spell = NULL; |
94 | for (tmp = op->inv; tmp; tmp = tmp->below) |
94 | for (tmp = op->inv; tmp; tmp = tmp->below) |
95 | { |
|
|
96 | if (tmp->type == SPELL) |
95 | if (tmp->type == SPELL) |
97 | { |
96 | { |
98 | ms = item_matched_string (op, tmp, runename); |
97 | ms = item_matched_string (op, tmp, runename); |
99 | if (ms > bestmatch) |
98 | if (ms > bestmatch) |
100 | { |
99 | { |
101 | bestmatch = ms; |
100 | bestmatch = ms; |
102 | rune_spell = tmp; |
101 | rune_spell = tmp; |
103 | } |
102 | } |
104 | } |
103 | } |
105 | } |
|
|
106 | |
104 | |
107 | if (!rune_spell) |
105 | if (!rune_spell) |
108 | { |
106 | { |
109 | new_draw_info_format (NDI_UNIQUE, 0, op, "You don't know any spell named %s", runename); |
107 | new_draw_info_format (NDI_UNIQUE, 0, op, "You don't know any spell named %s", runename); |
110 | return 0; |
108 | return 0; |
… | |
… | |
114 | { |
112 | { |
115 | new_draw_info_format (NDI_UNIQUE, 0, op, "You can't cast %s with %s", &rune_spell->name, &spell->name); |
113 | new_draw_info_format (NDI_UNIQUE, 0, op, "You can't cast %s with %s", &rune_spell->name, &spell->name); |
116 | return 0; |
114 | return 0; |
117 | } |
115 | } |
118 | |
116 | |
119 | if (caster->path_denied & spell->path_attuned) |
117 | if (caster->path_denied & spell->path_attuned && !caster->flag [FLAG_WIZCAST]) |
120 | { |
118 | { |
121 | new_draw_info_format (NDI_UNIQUE, 0, op, "%s belongs to a spell path denied to you.", &rune_spell->name); |
119 | new_draw_info_format (NDI_UNIQUE, 0, op, "%s belongs to a spell path denied to you.", &rune_spell->name); |
122 | return 0; |
120 | return 0; |
123 | } |
121 | } |
124 | |
122 | |
125 | if (caster_level (caster, rune_spell) < rune_spell->level) |
123 | if (caster_level (caster, rune_spell) < rune_spell->level && !caster->flag [FLAG_WIZCAST]) |
126 | { |
124 | { |
127 | new_draw_info_format (NDI_UNIQUE, 0, op, "%s is beyond your ability to cast!", &rune_spell->name); |
125 | new_draw_info_format (NDI_UNIQUE, 0, op, "%s is beyond your ability to cast!", &rune_spell->name); |
128 | return 0; |
126 | return 0; |
129 | } |
127 | } |
130 | |
128 | |
… | |
… | |
196 | } |
194 | } |
197 | else |
195 | else |
198 | op->invisible = 1; |
196 | op->invisible = 1; |
199 | |
197 | |
200 | if (op->invisible != det) |
198 | if (op->invisible != det) |
201 | update_object (op, UP_OBJ_FACE); |
199 | update_object (op, UP_OBJ_CHANGE); |
202 | } |
200 | } |
203 | |
|
|
204 | |
201 | |
205 | /* peterm: rune_attack |
202 | /* peterm: rune_attack |
206 | * function handles those runes which detonate but do not cast spells. |
203 | * function handles those runes which detonate but do not cast spells. |
207 | */ |
204 | */ |
208 | |
|
|
209 | |
|
|
210 | void |
205 | void |
211 | rune_attack (object *op, object *victim) |
206 | rune_attack (object *op, object *victim) |
212 | { |
207 | { |
213 | if (victim) |
208 | if (victim) |
214 | { |
209 | { |
… | |
… | |
276 | if (rv.distance > 1) |
271 | if (rv.distance > 1) |
277 | return; |
272 | return; |
278 | |
273 | |
279 | trap_show (trap, env); |
274 | trap_show (trap, env); |
280 | |
275 | |
|
|
276 | if (victim->type == PLAYER) // only count players as enemies |
|
|
277 | trap->enemy = victim; // set the victim as the traps enemy, so that summoned |
|
|
278 | // creatures know who to attack. |
|
|
279 | |
281 | /* Only if it is a spell do we proceed here */ |
280 | /* Only if it is a spell do we proceed here */ |
282 | if ((trap->inv && trap->inv->type == SPELL) || (trap->other_arch && trap->other_arch->clone.type == SPELL)) |
281 | if ((trap->inv && trap->inv->type == SPELL) || (trap->other_arch && trap->other_arch->clone.type == SPELL)) |
283 | { |
282 | { |
284 | |
283 | |
285 | if (trap->destroyed ()) |
284 | if (trap->destroyed ()) |
… | |
… | |
412 | { |
411 | { |
413 | if (where == NULL) |
412 | if (where == NULL) |
414 | return 0; |
413 | return 0; |
415 | |
414 | |
416 | object *tmp = get_archetype ("runedet"); |
415 | object *tmp = get_archetype ("runedet"); |
417 | tmp->face = &new_faces[GET_ANIMATION (trap, 0)]; |
416 | tmp->face = GET_ANIMATION (trap, 0); |
418 | tmp->insert_at (where, 0); |
417 | tmp->insert_at (where, 0); |
419 | |
418 | |
420 | return 1; |
419 | return 1; |
421 | } |
420 | } |
422 | |
421 | |