… | |
… | |
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 | |
… | |
… | |
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 | |
2214 | |
2209 | |
2215 | |
2210 | /* move aura function. An aura is a part of someone's inventory, |
2216 | /* move aura function. An aura is a part of someone's inventory, |
… | |
… | |
2277 | } |
2283 | } |
2278 | |
2284 | |
2279 | /* moves the peacemaker spell. |
2285 | /* moves the peacemaker spell. |
2280 | * op is the piece object. |
2286 | * op is the piece object. |
2281 | */ |
2287 | */ |
2282 | |
|
|
2283 | void |
2288 | void |
2284 | move_peacemaker (object *op) |
2289 | move_peacemaker (object *op) |
2285 | { |
2290 | { |
2286 | object *tmp; |
2291 | object *tmp; |
2287 | |
2292 | |