… | |
… | |
900 | |
900 | |
901 | 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 */ |
902 | return 1; |
902 | return 1; |
903 | } |
903 | } |
904 | |
904 | |
905 | |
|
|
906 | /* cast_heal: Heals something. |
905 | /* cast_heal: Heals something. |
907 | * op is the caster. |
906 | * op is the caster. |
908 | * dir is the direction he is casting it in. |
907 | * dir is the direction he is casting it in. |
909 | * spell is the spell object. |
908 | * spell is the spell object. |
910 | */ |
909 | */ |
… | |
… | |
936 | { |
935 | { |
937 | /* See how many points we actually heal. Instead of messages |
936 | /* See how many points we actually heal. Instead of messages |
938 | * based on type of spell, we instead do messages based |
937 | * based on type of spell, we instead do messages based |
939 | * on amount of damage healed. |
938 | * on amount of damage healed. |
940 | */ |
939 | */ |
941 | if (heal > (tmp->stats.maxhp - tmp->stats.hp)) |
940 | if (heal > tmp->stats.maxhp - tmp->stats.hp) |
942 | heal = tmp->stats.maxhp - tmp->stats.hp; |
941 | heal = tmp->stats.maxhp - tmp->stats.hp; |
|
|
942 | |
943 | tmp->stats.hp += heal; |
943 | tmp->stats.hp += heal; |
944 | |
944 | |
945 | if (tmp->stats.hp >= tmp->stats.maxhp) |
945 | if (tmp->stats.hp >= tmp->stats.maxhp) |
946 | new_draw_info (NDI_UNIQUE, 0, tmp, "You feel just fine!"); |
946 | new_draw_info (NDI_UNIQUE, 0, tmp, "You feel just fine!"); |
947 | else if (heal > 50) |
947 | else if (heal > 50) |
… | |
… | |
956 | success = 1; |
956 | success = 1; |
957 | } |
957 | } |
958 | } |
958 | } |
959 | |
959 | |
960 | if (spell->attacktype & AT_DISEASE) |
960 | if (spell->attacktype & AT_DISEASE) |
961 | if (cure_disease (tmp, op)) |
961 | if (cure_disease (tmp, op, spell)) |
962 | success = 1; |
962 | success = 1; |
963 | |
963 | |
964 | if (spell->attacktype & AT_POISON) |
964 | if (spell->attacktype & AT_POISON) |
965 | { |
965 | { |
966 | at = archetype::find ("poisoning"); |
966 | at = archetype::find ("poisoning"); |
… | |
… | |
1015 | } |
1015 | } |
1016 | |
1016 | |
1017 | if (spell->stats.food && tmp->stats.food < 999) |
1017 | if (spell->stats.food && tmp->stats.food < 999) |
1018 | { |
1018 | { |
1019 | tmp->stats.food += spell->stats.food; |
1019 | tmp->stats.food += spell->stats.food; |
|
|
1020 | |
1020 | if (tmp->stats.food > 999) |
1021 | if (tmp->stats.food > 999) |
1021 | tmp->stats.food = 999; |
1022 | tmp->stats.food = 999; |
|
|
1023 | |
1022 | success = 1; |
1024 | success = 1; |
1023 | /* 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 */ |
1024 | 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"); |
1025 | } |
1027 | } |
1026 | |
1028 | |
… | |
… | |
1461 | |
1463 | |
1462 | return success; |
1464 | return success; |
1463 | } |
1465 | } |
1464 | |
1466 | |
1465 | /* Identifies objects in the players inventory/on the ground */ |
1467 | /* Identifies objects in the players inventory/on the ground */ |
1466 | |
|
|
1467 | int |
1468 | int |
1468 | cast_identify (object *op, object *caster, object *spell) |
1469 | cast_identify (object *op, object *caster, object *spell) |
1469 | { |
1470 | { |
|
|
1471 | dynbuf_text buf; |
1470 | object *tmp; |
1472 | object *tmp; |
1471 | int success = 0, num_ident; |
|
|
1472 | |
1473 | |
1473 | num_ident = spell->stats.dam + SP_level_dam_adjust (caster, spell); |
1474 | int num_ident = spell->stats.dam + SP_level_dam_adjust (caster, spell); |
1474 | |
1475 | |
1475 | if (num_ident < 1) |
1476 | if (num_ident < 1) |
1476 | num_ident = 1; |
1477 | num_ident = 1; |
1477 | |
1478 | |
1478 | for (tmp = op->inv; tmp; tmp = tmp->below) |
1479 | for (tmp = op->inv; tmp; tmp = tmp->below) |
… | |
… | |
1481 | { |
1482 | { |
1482 | identify (tmp); |
1483 | identify (tmp); |
1483 | |
1484 | |
1484 | if (op->type == PLAYER) |
1485 | if (op->type == PLAYER) |
1485 | { |
1486 | { |
1486 | new_draw_info_format (NDI_UNIQUE, 0, op, "You identified: %s.", long_desc (tmp, op)); |
1487 | buf.printf ("You identified: %s.\n\n", long_desc (tmp, op)); |
1487 | |
1488 | |
1488 | if (tmp->msg) |
1489 | if (tmp->msg) |
1489 | { |
1490 | buf << "The item has a story:\n\n" << tmp->msg << "\n\n"; |
1490 | new_draw_info (NDI_UNIQUE, 0, op, "The item has a story:"); |
|
|
1491 | new_draw_info (NDI_UNIQUE, 0, op, tmp->msg); |
|
|
1492 | } |
|
|
1493 | } |
1491 | } |
1494 | |
1492 | |
1495 | num_ident--; |
1493 | num_ident--; |
1496 | success = 1; |
|
|
1497 | if (!num_ident) |
1494 | if (!num_ident) |
1498 | break; |
1495 | break; |
1499 | } |
1496 | } |
1500 | } |
1497 | } |
1501 | |
1498 | |
… | |
… | |
1510 | { |
1507 | { |
1511 | identify (tmp); |
1508 | identify (tmp); |
1512 | |
1509 | |
1513 | if (op->type == PLAYER) |
1510 | if (op->type == PLAYER) |
1514 | { |
1511 | { |
1515 | new_draw_info_format (NDI_UNIQUE, 0, op, "On the ground you identified: %s.", long_desc (tmp, op)); |
1512 | buf.printf ("On the ground you identified: %s.\n\n", long_desc (tmp, op)); |
1516 | |
1513 | |
1517 | if (tmp->msg) |
1514 | if (tmp->msg) |
1518 | { |
1515 | buf << "The item has a story:\n\n" << tmp->msg << "\n\n"; |
1519 | new_draw_info (NDI_UNIQUE, 0, op, "The item has a story:"); |
|
|
1520 | new_draw_info (NDI_UNIQUE, 0, op, tmp->msg); |
|
|
1521 | } |
|
|
1522 | |
1516 | |
1523 | esrv_send_item (op, tmp); |
1517 | esrv_send_item (op, tmp); |
1524 | } |
1518 | } |
1525 | |
1519 | |
1526 | num_ident--; |
1520 | num_ident--; |
1527 | success = 1; |
|
|
1528 | if (!num_ident) |
1521 | if (!num_ident) |
1529 | break; |
1522 | break; |
1530 | } |
1523 | } |
1531 | } |
1524 | } |
1532 | |
1525 | |
1533 | if (!success) |
1526 | if (buf.empty ()) |
1534 | new_draw_info (NDI_UNIQUE, 0, op, "You can't reach anything unidentified."); |
1527 | { |
|
|
1528 | op->failmsg ("You can't reach anything unidentified."); |
|
|
1529 | return 0; |
|
|
1530 | } |
1535 | else |
1531 | else |
|
|
1532 | { |
|
|
1533 | if (op->contr) |
|
|
1534 | op->contr->infobox (MSG_CHANNEL ("identify"), buf); |
|
|
1535 | |
1536 | spell_effect (spell, op->x, op->y, op->map, op); |
1536 | spell_effect (spell, op->x, op->y, op->map, op); |
1537 | |
1537 | return 1; |
1538 | return success; |
1538 | } |
1539 | } |
1539 | } |
1540 | |
1540 | |
1541 | int |
1541 | int |
1542 | cast_detection (object *op, object *caster, object *spell, object *skill) |
1542 | cast_detection (object *op, object *caster, object *spell, object *skill) |
1543 | { |
1543 | { |
… | |
… | |
2172 | new_draw_info (NDI_UNIQUE, 0, op, "It can be no darker here."); |
2172 | new_draw_info (NDI_UNIQUE, 0, op, "It can be no darker here."); |
2173 | } |
2173 | } |
2174 | return success; |
2174 | return success; |
2175 | } |
2175 | } |
2176 | |
2176 | |
2177 | |
|
|
2178 | |
|
|
2179 | |
|
|
2180 | |
|
|
2181 | /* create an aura spell object and put it in the player's inventory. |
2177 | /* create an aura spell object and put it in the player's inventory. |
2182 | * as usual, op is player, caster is the object casting the spell, |
2178 | * as usual, op is player, caster is the object casting the spell, |
2183 | * spell is the spell object itself. |
2179 | * spell is the spell object itself. |
2184 | */ |
2180 | */ |
2185 | int |
2181 | int |
… | |
… | |
2196 | |
2192 | |
2197 | new_aura->duration = spell->duration + 10 * SP_level_duration_adjust (caster, spell); |
2193 | new_aura->duration = spell->duration + 10 * SP_level_duration_adjust (caster, spell); |
2198 | |
2194 | |
2199 | new_aura->stats.dam = spell->stats.dam + SP_level_dam_adjust (caster, spell); |
2195 | new_aura->stats.dam = spell->stats.dam + SP_level_dam_adjust (caster, spell); |
2200 | |
2196 | |
2201 | new_aura->set_owner (op); |
|
|
2202 | set_spell_skill (op, caster, spell, new_aura); |
2197 | set_spell_skill (op, caster, spell, new_aura); |
2203 | new_aura->attacktype = spell->attacktype; |
2198 | new_aura->attacktype = spell->attacktype; |
2204 | |
2199 | |
2205 | new_aura->level = caster_level (caster, spell); |
2200 | new_aura->level = caster_level (caster, spell); |
|
|
2201 | |
2206 | if (refresh) |
2202 | if (refresh) |
2207 | new_draw_info (NDI_UNIQUE, 0, op, "You recast the spell while in effect."); |
2203 | new_draw_info (NDI_UNIQUE, 0, op, "You recast the spell while in effect."); |
2208 | else |
2204 | else |
2209 | new_draw_info (NDI_UNIQUE, 0, op, "You create an aura of magical force."); |
2205 | new_draw_info (NDI_UNIQUE, 0, op, "You create an aura of magical force."); |
|
|
2206 | |
2210 | insert_ob_in_ob (new_aura, op); |
2207 | insert_ob_in_ob (new_aura, op); |
|
|
2208 | new_aura->set_owner (op); |
|
|
2209 | |
2211 | return 1; |
2210 | return 1; |
2212 | } |
2211 | } |
2213 | |
|
|
2214 | |
2212 | |
2215 | /* move aura function. An aura is a part of someone's inventory, |
2213 | /* move aura function. An aura is a part of someone's inventory, |
2216 | * which he carries with him, but which acts on the map immediately |
2214 | * which he carries with him, but which acts on the map immediately |
2217 | * around him. |
2215 | * around him. |
2218 | * Aura parameters: |
2216 | * Aura parameters: |
2219 | * duration: duration counter. |
2217 | * duration: duration counter. |
2220 | * attacktype: aura's attacktype |
2218 | * attacktype: aura's attacktype |
2221 | * other_arch: archetype to drop where we attack |
2219 | * other_arch: archetype to drop where we attack |
2222 | */ |
2220 | */ |
2223 | |
|
|
2224 | void |
2221 | void |
2225 | move_aura (object *aura) |
2222 | move_aura (object *aura) |
2226 | { |
2223 | { |
2227 | int i, mflags; |
|
|
2228 | object *env; |
|
|
2229 | maptile *m; |
|
|
2230 | |
|
|
2231 | /* auras belong in inventories */ |
2224 | /* auras belong in inventories */ |
2232 | env = aura->env; |
2225 | object *env = aura->env; |
|
|
2226 | object *owner = aura->owner; |
2233 | |
2227 | |
2234 | /* no matter what we've gotta remove the aura... |
2228 | /* no matter what we've gotta remove the aura... |
2235 | * we'll put it back if its time isn't up. |
2229 | * we'll put it back if its time isn't up. |
2236 | */ |
2230 | */ |
2237 | aura->remove (); |
2231 | aura->remove (); |
… | |
… | |
2242 | aura->destroy (); |
2236 | aura->destroy (); |
2243 | return; |
2237 | return; |
2244 | } |
2238 | } |
2245 | |
2239 | |
2246 | /* auras only exist in inventories */ |
2240 | /* auras only exist in inventories */ |
2247 | if (env == NULL || env->map == NULL) |
2241 | if (!env || !env->map) |
2248 | { |
2242 | { |
2249 | aura->destroy (); |
2243 | aura->destroy (); |
2250 | return; |
2244 | return; |
2251 | } |
2245 | } |
2252 | |
2246 | |
2253 | /* we need to jump out of the inventory for a bit |
2247 | /* we need to jump out of the inventory for a bit |
2254 | * in order to hit the map conveniently. |
2248 | * in order to hit the map conveniently. |
2255 | */ |
2249 | */ |
2256 | aura->insert_at (env, aura); |
2250 | aura->insert_at (env, aura); |
2257 | |
2251 | |
2258 | for (i = 1; i < 9; i++) |
2252 | for (int i = 1; i < 9; i++) |
2259 | { |
2253 | { |
2260 | sint16 nx, ny; |
2254 | mapxy pos (env); |
|
|
2255 | pos.move (i); |
2261 | |
2256 | |
2262 | nx = aura->x + freearr_x[i]; |
|
|
2263 | ny = aura->y + freearr_y[i]; |
|
|
2264 | mflags = get_map_flags (env->map, &m, nx, ny, &nx, &ny); |
|
|
2265 | |
|
|
2266 | /* Consider the movement tyep of the person with the aura as |
2257 | /* Consider the movement type of the person with the aura as |
2267 | * movement type of the aura. Eg, if the player is flying, the aura |
2258 | * movement type of the aura. Eg, if the player is flying, the aura |
2268 | * is flying also, if player is walking, it is on the ground, etc. |
2259 | * is flying also, if player is walking, it is on the ground, etc. |
2269 | */ |
2260 | */ |
2270 | if (!(mflags & P_OUT_OF_MAP) && !(OB_TYPE_MOVE_BLOCK (env, GET_MAP_MOVE_BLOCK (m, nx, ny)))) |
2261 | if (pos.normalise () && !(OB_TYPE_MOVE_BLOCK (env, pos->move_block))) |
2271 | { |
2262 | { |
2272 | hit_map (aura, i, aura->attacktype, 0); |
2263 | hit_map (aura, i, aura->attacktype, 0); |
2273 | |
2264 | |
2274 | if (aura->other_arch) |
2265 | if (aura->other_arch) |
2275 | m->insert (arch_to_object (aura->other_arch), nx, ny, aura); |
2266 | pos.insert (arch_to_object (aura->other_arch), aura); |
2276 | } |
2267 | } |
2277 | } |
2268 | } |
2278 | |
2269 | |
2279 | /* put the aura back in the player's inventory */ |
2270 | /* put the aura back in the player's inventory */ |
2280 | aura->remove (); |
2271 | env->insert (aura); |
2281 | insert_ob_in_ob (aura, env); |
2272 | aura->set_owner (owner); |
2282 | } |
2273 | } |
2283 | |
2274 | |
2284 | /* moves the peacemaker spell. |
2275 | /* moves the peacemaker spell. |
2285 | * op is the piece object. |
2276 | * op is the piece object. |
2286 | */ |
2277 | */ |
2287 | |
|
|
2288 | void |
2278 | void |
2289 | move_peacemaker (object *op) |
2279 | move_peacemaker (object *op) |
2290 | { |
2280 | { |
2291 | object *tmp; |
2281 | object *tmp; |
2292 | |
2282 | |