… | |
… | |
335 | * pl is invisible. |
335 | * pl is invisible. |
336 | */ |
336 | */ |
337 | int |
337 | int |
338 | makes_invisible_to (object *pl, object *mon) |
338 | makes_invisible_to (object *pl, object *mon) |
339 | { |
339 | { |
340 | |
|
|
341 | if (!pl->invisible) |
340 | if (!pl->invisible) |
342 | return 0; |
341 | return 0; |
|
|
342 | |
343 | if (pl->type == PLAYER) |
343 | if (pl->type == PLAYER) |
344 | { |
344 | { |
345 | /* If race isn't set, then invisible unless it is undead */ |
345 | /* If race isn't set, then invisible unless it is undead */ |
346 | if (!pl->contr->invis_race) |
346 | if (!pl->contr->invis_race) |
347 | { |
347 | { |
348 | if (QUERY_FLAG (mon, FLAG_UNDEAD)) |
348 | if (QUERY_FLAG (mon, FLAG_UNDEAD)) |
349 | return 0; |
349 | return 0; |
|
|
350 | |
350 | return 1; |
351 | return 1; |
351 | } |
352 | } |
|
|
353 | |
352 | /* invis_race is set if we get here */ |
354 | /* invis_race is set if we get here */ |
353 | if (!strcmp (pl->contr->invis_race, "undead") && is_true_undead (mon)) |
355 | if (!strcmp (pl->contr->invis_race, "undead") && is_true_undead (mon)) |
354 | return 1; |
356 | return 1; |
|
|
357 | |
355 | /* No race, can't be invisible to it */ |
358 | /* No race, can't be invisible to it */ |
356 | if (!mon->race) |
359 | if (!mon->race) |
357 | return 0; |
360 | return 0; |
|
|
361 | |
358 | if (strstr (mon->race, pl->contr->invis_race)) |
362 | if (strstr (mon->race, pl->contr->invis_race)) |
359 | return 1; |
363 | return 1; |
|
|
364 | |
360 | /* Nothing matched above, return 0 */ |
365 | /* Nothing matched above, return 0 */ |
361 | return 0; |
366 | return 0; |
362 | } |
367 | } |
363 | else |
368 | else |
364 | { |
369 | { |
… | |
… | |
601 | |
606 | |
602 | if (is_dragon_pl (op)) |
607 | if (is_dragon_pl (op)) |
603 | /* now grab the 'dragon_ability'-force from the player's inventory */ |
608 | /* now grab the 'dragon_ability'-force from the player's inventory */ |
604 | for (tmp = op->inv; tmp; tmp = tmp->below) |
609 | for (tmp = op->inv; tmp; tmp = tmp->below) |
605 | { |
610 | { |
606 | if (tmp->type == FORCE && !strcmp (tmp->arch->archname, "dragon_ability_force")) |
611 | if (tmp->type == FORCE && tmp->arch->archname == shstr_dragon_ability_force) |
607 | { |
612 | { |
608 | if (tmp->stats.exp == 0) |
613 | if (tmp->stats.exp == 0) |
609 | buf << "Your metabolism isn't focused on anything.\n"; |
614 | buf << "Your metabolism isn't focused on anything.\n"; |
610 | else |
615 | else |
611 | buf << "Your metabolism is focused on " << change_resist_msg[tmp->stats.exp] << ".\n"; |
616 | buf << "Your metabolism is focused on " << change_resist_msg[tmp->stats.exp] << ".\n"; |
… | |
… | |
895 | |
900 | |
896 | op->speed_left = -FABS (op->speed) * 5; /* Freeze them for a short while */ |
901 | op->speed_left = -FABS (op->speed) * 5; /* Freeze them for a short while */ |
897 | return 1; |
902 | return 1; |
898 | } |
903 | } |
899 | |
904 | |
900 | |
|
|
901 | /* cast_heal: Heals something. |
905 | /* cast_heal: Heals something. |
902 | * op is the caster. |
906 | * op is the caster. |
903 | * dir is the direction he is casting it in. |
907 | * dir is the direction he is casting it in. |
904 | * spell is the spell object. |
908 | * spell is the spell object. |
905 | */ |
909 | */ |
… | |
… | |
931 | { |
935 | { |
932 | /* See how many points we actually heal. Instead of messages |
936 | /* See how many points we actually heal. Instead of messages |
933 | * based on type of spell, we instead do messages based |
937 | * based on type of spell, we instead do messages based |
934 | * on amount of damage healed. |
938 | * on amount of damage healed. |
935 | */ |
939 | */ |
936 | if (heal > (tmp->stats.maxhp - tmp->stats.hp)) |
940 | if (heal > tmp->stats.maxhp - tmp->stats.hp) |
937 | heal = tmp->stats.maxhp - tmp->stats.hp; |
941 | heal = tmp->stats.maxhp - tmp->stats.hp; |
|
|
942 | |
938 | tmp->stats.hp += heal; |
943 | tmp->stats.hp += heal; |
939 | |
944 | |
940 | if (tmp->stats.hp >= tmp->stats.maxhp) |
945 | if (tmp->stats.hp >= tmp->stats.maxhp) |
941 | new_draw_info (NDI_UNIQUE, 0, tmp, "You feel just fine!"); |
946 | new_draw_info (NDI_UNIQUE, 0, tmp, "You feel just fine!"); |
942 | else if (heal > 50) |
947 | else if (heal > 50) |
… | |
… | |
951 | success = 1; |
956 | success = 1; |
952 | } |
957 | } |
953 | } |
958 | } |
954 | |
959 | |
955 | if (spell->attacktype & AT_DISEASE) |
960 | if (spell->attacktype & AT_DISEASE) |
956 | if (cure_disease (tmp, op)) |
961 | if (cure_disease (tmp, op, spell)) |
957 | success = 1; |
962 | success = 1; |
958 | |
963 | |
959 | if (spell->attacktype & AT_POISON) |
964 | if (spell->attacktype & AT_POISON) |
960 | { |
965 | { |
961 | at = archetype::find ("poisoning"); |
966 | at = archetype::find ("poisoning"); |
… | |
… | |
1010 | } |
1015 | } |
1011 | |
1016 | |
1012 | if (spell->stats.food && tmp->stats.food < 999) |
1017 | if (spell->stats.food && tmp->stats.food < 999) |
1013 | { |
1018 | { |
1014 | tmp->stats.food += spell->stats.food; |
1019 | tmp->stats.food += spell->stats.food; |
|
|
1020 | |
1015 | if (tmp->stats.food > 999) |
1021 | if (tmp->stats.food > 999) |
1016 | tmp->stats.food = 999; |
1022 | tmp->stats.food = 999; |
|
|
1023 | |
1017 | success = 1; |
1024 | success = 1; |
1018 | /* We could do something a bit better like the messages for healing above */ |
1025 | /* We could do something a bit better like the messages for healing above */ |
1019 | new_draw_info (NDI_UNIQUE, 0, tmp, "You feel your belly fill with food"); |
1026 | new_draw_info (NDI_UNIQUE, 0, tmp, "You feel your belly fill with food"); |
1020 | } |
1027 | } |
1021 | |
1028 | |
… | |
… | |
1397 | value -= nrof * nugget[i]->value; |
1404 | value -= nrof * nugget[i]->value; |
1398 | |
1405 | |
1399 | object *tmp = arch_to_object (nugget[i]); |
1406 | object *tmp = arch_to_object (nugget[i]); |
1400 | tmp->nrof = nrof; |
1407 | tmp->nrof = nrof; |
1401 | tmp->flag [FLAG_IDENTIFIED] = true; |
1408 | tmp->flag [FLAG_IDENTIFIED] = true; |
1402 | caster->map->insert (tmp, x, y, caster, 0); |
1409 | op->map->insert (tmp, x, y, op, 0); |
1403 | } |
1410 | } |
1404 | |
1411 | |
1405 | if (weight > weight_max) |
1412 | if (weight > weight_max) |
1406 | goto bailout; |
1413 | goto bailout; |
1407 | } |
1414 | } |
… | |
… | |
2167 | new_draw_info (NDI_UNIQUE, 0, op, "It can be no darker here."); |
2174 | new_draw_info (NDI_UNIQUE, 0, op, "It can be no darker here."); |
2168 | } |
2175 | } |
2169 | return success; |
2176 | return success; |
2170 | } |
2177 | } |
2171 | |
2178 | |
2172 | |
|
|
2173 | |
|
|
2174 | |
|
|
2175 | |
|
|
2176 | /* create an aura spell object and put it in the player's inventory. |
2179 | /* create an aura spell object and put it in the player's inventory. |
2177 | * as usual, op is player, caster is the object casting the spell, |
2180 | * as usual, op is player, caster is the object casting the spell, |
2178 | * spell is the spell object itself. |
2181 | * spell is the spell object itself. |
2179 | */ |
2182 | */ |
2180 | int |
2183 | int |
… | |
… | |
2191 | |
2194 | |
2192 | new_aura->duration = spell->duration + 10 * SP_level_duration_adjust (caster, spell); |
2195 | new_aura->duration = spell->duration + 10 * SP_level_duration_adjust (caster, spell); |
2193 | |
2196 | |
2194 | new_aura->stats.dam = spell->stats.dam + SP_level_dam_adjust (caster, spell); |
2197 | new_aura->stats.dam = spell->stats.dam + SP_level_dam_adjust (caster, spell); |
2195 | |
2198 | |
2196 | new_aura->set_owner (op); |
|
|
2197 | set_spell_skill (op, caster, spell, new_aura); |
2199 | set_spell_skill (op, caster, spell, new_aura); |
2198 | new_aura->attacktype = spell->attacktype; |
2200 | new_aura->attacktype = spell->attacktype; |
2199 | |
2201 | |
2200 | new_aura->level = caster_level (caster, spell); |
2202 | new_aura->level = caster_level (caster, spell); |
|
|
2203 | |
2201 | if (refresh) |
2204 | if (refresh) |
2202 | new_draw_info (NDI_UNIQUE, 0, op, "You recast the spell while in effect."); |
2205 | new_draw_info (NDI_UNIQUE, 0, op, "You recast the spell while in effect."); |
2203 | else |
2206 | else |
2204 | new_draw_info (NDI_UNIQUE, 0, op, "You create an aura of magical force."); |
2207 | new_draw_info (NDI_UNIQUE, 0, op, "You create an aura of magical force."); |
|
|
2208 | |
2205 | insert_ob_in_ob (new_aura, op); |
2209 | insert_ob_in_ob (new_aura, op); |
|
|
2210 | new_aura->set_owner (op); |
|
|
2211 | |
2206 | return 1; |
2212 | return 1; |
2207 | } |
2213 | } |
2208 | |
|
|
2209 | |
2214 | |
2210 | /* move aura function. An aura is a part of someone's inventory, |
2215 | /* move aura function. An aura is a part of someone's inventory, |
2211 | * which he carries with him, but which acts on the map immediately |
2216 | * which he carries with him, but which acts on the map immediately |
2212 | * around him. |
2217 | * around him. |
2213 | * Aura parameters: |
2218 | * Aura parameters: |
2214 | * duration: duration counter. |
2219 | * duration: duration counter. |
2215 | * attacktype: aura's attacktype |
2220 | * attacktype: aura's attacktype |
2216 | * other_arch: archetype to drop where we attack |
2221 | * other_arch: archetype to drop where we attack |
2217 | */ |
2222 | */ |
2218 | |
|
|
2219 | void |
2223 | void |
2220 | move_aura (object *aura) |
2224 | move_aura (object *aura) |
2221 | { |
2225 | { |
2222 | int i, mflags; |
|
|
2223 | object *env; |
|
|
2224 | maptile *m; |
|
|
2225 | |
|
|
2226 | /* auras belong in inventories */ |
2226 | /* auras belong in inventories */ |
2227 | env = aura->env; |
2227 | object *env = aura->env; |
|
|
2228 | object *owner = aura->owner; |
2228 | |
2229 | |
2229 | /* no matter what we've gotta remove the aura... |
2230 | /* no matter what we've gotta remove the aura... |
2230 | * we'll put it back if its time isn't up. |
2231 | * we'll put it back if its time isn't up. |
2231 | */ |
2232 | */ |
2232 | aura->remove (); |
2233 | aura->remove (); |
… | |
… | |
2237 | aura->destroy (); |
2238 | aura->destroy (); |
2238 | return; |
2239 | return; |
2239 | } |
2240 | } |
2240 | |
2241 | |
2241 | /* auras only exist in inventories */ |
2242 | /* auras only exist in inventories */ |
2242 | if (env == NULL || env->map == NULL) |
2243 | if (!env || !env->map) |
2243 | { |
2244 | { |
2244 | aura->destroy (); |
2245 | aura->destroy (); |
2245 | return; |
2246 | return; |
2246 | } |
2247 | } |
2247 | |
2248 | |
2248 | /* we need to jump out of the inventory for a bit |
2249 | /* we need to jump out of the inventory for a bit |
2249 | * in order to hit the map conveniently. |
2250 | * in order to hit the map conveniently. |
2250 | */ |
2251 | */ |
2251 | aura->insert_at (env, aura); |
2252 | aura->insert_at (env, aura); |
2252 | |
2253 | |
2253 | for (i = 1; i < 9; i++) |
2254 | for (int i = 1; i < 9; i++) |
2254 | { |
2255 | { |
2255 | sint16 nx, ny; |
2256 | mapxy pos (env); |
|
|
2257 | pos.move (i); |
2256 | |
2258 | |
2257 | nx = aura->x + freearr_x[i]; |
|
|
2258 | ny = aura->y + freearr_y[i]; |
|
|
2259 | mflags = get_map_flags (env->map, &m, nx, ny, &nx, &ny); |
|
|
2260 | |
|
|
2261 | /* Consider the movement tyep of the person with the aura as |
2259 | /* Consider the movement type of the person with the aura as |
2262 | * movement type of the aura. Eg, if the player is flying, the aura |
2260 | * movement type of the aura. Eg, if the player is flying, the aura |
2263 | * is flying also, if player is walking, it is on the ground, etc. |
2261 | * is flying also, if player is walking, it is on the ground, etc. |
2264 | */ |
2262 | */ |
2265 | if (!(mflags & P_OUT_OF_MAP) && !(OB_TYPE_MOVE_BLOCK (env, GET_MAP_MOVE_BLOCK (m, nx, ny)))) |
2263 | if (pos.normalise () && !(OB_TYPE_MOVE_BLOCK (env, pos->move_block))) |
2266 | { |
2264 | { |
2267 | hit_map (aura, i, aura->attacktype, 0); |
2265 | hit_map (aura, i, aura->attacktype, 0); |
2268 | |
2266 | |
2269 | if (aura->other_arch) |
2267 | if (aura->other_arch) |
2270 | m->insert (arch_to_object (aura->other_arch), nx, ny, aura); |
2268 | pos.insert (arch_to_object (aura->other_arch), aura); |
2271 | } |
2269 | } |
2272 | } |
2270 | } |
2273 | |
2271 | |
2274 | /* put the aura back in the player's inventory */ |
2272 | /* put the aura back in the player's inventory */ |
2275 | aura->remove (); |
2273 | env->insert (aura); |
2276 | insert_ob_in_ob (aura, env); |
2274 | aura->set_owner (owner); |
2277 | } |
2275 | } |
2278 | |
2276 | |
2279 | /* moves the peacemaker spell. |
2277 | /* moves the peacemaker spell. |
2280 | * op is the piece object. |
2278 | * op is the piece object. |
2281 | */ |
2279 | */ |
2282 | |
|
|
2283 | void |
2280 | void |
2284 | move_peacemaker (object *op) |
2281 | move_peacemaker (object *op) |
2285 | { |
2282 | { |
2286 | object *tmp; |
2283 | object *tmp; |
2287 | |
2284 | |