… | |
… | |
1463 | |
1463 | |
1464 | return success; |
1464 | return success; |
1465 | } |
1465 | } |
1466 | |
1466 | |
1467 | /* Identifies objects in the players inventory/on the ground */ |
1467 | /* Identifies objects in the players inventory/on the ground */ |
1468 | |
|
|
1469 | int |
1468 | int |
1470 | cast_identify (object *op, object *caster, object *spell) |
1469 | cast_identify (object *op, object *caster, object *spell) |
1471 | { |
1470 | { |
|
|
1471 | dynbuf_text buf; |
1472 | object *tmp; |
1472 | object *tmp; |
1473 | int success = 0, num_ident; |
|
|
1474 | |
1473 | |
1475 | num_ident = spell->stats.dam + SP_level_dam_adjust (caster, spell); |
1474 | int num_ident = spell->stats.dam + SP_level_dam_adjust (caster, spell); |
1476 | |
1475 | |
1477 | if (num_ident < 1) |
1476 | if (num_ident < 1) |
1478 | num_ident = 1; |
1477 | num_ident = 1; |
1479 | |
1478 | |
1480 | for (tmp = op->inv; tmp; tmp = tmp->below) |
1479 | for (tmp = op->inv; tmp; tmp = tmp->below) |
… | |
… | |
1483 | { |
1482 | { |
1484 | identify (tmp); |
1483 | identify (tmp); |
1485 | |
1484 | |
1486 | if (op->type == PLAYER) |
1485 | if (op->type == PLAYER) |
1487 | { |
1486 | { |
1488 | 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)); |
1489 | |
1488 | |
1490 | if (tmp->msg) |
1489 | if (tmp->msg) |
1491 | { |
1490 | buf << "The item has a story:\n\n" << tmp->msg << "\n\n"; |
1492 | new_draw_info (NDI_UNIQUE, 0, op, "The item has a story:"); |
|
|
1493 | new_draw_info (NDI_UNIQUE, 0, op, tmp->msg); |
|
|
1494 | } |
|
|
1495 | } |
1491 | } |
1496 | |
1492 | |
1497 | num_ident--; |
1493 | num_ident--; |
1498 | success = 1; |
|
|
1499 | if (!num_ident) |
1494 | if (!num_ident) |
1500 | break; |
1495 | break; |
1501 | } |
1496 | } |
1502 | } |
1497 | } |
1503 | |
1498 | |
… | |
… | |
1512 | { |
1507 | { |
1513 | identify (tmp); |
1508 | identify (tmp); |
1514 | |
1509 | |
1515 | if (op->type == PLAYER) |
1510 | if (op->type == PLAYER) |
1516 | { |
1511 | { |
1517 | 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)); |
1518 | |
1513 | |
1519 | if (tmp->msg) |
1514 | if (tmp->msg) |
1520 | { |
1515 | buf << "The item has a story:\n\n" << tmp->msg << "\n\n"; |
1521 | new_draw_info (NDI_UNIQUE, 0, op, "The item has a story:"); |
|
|
1522 | new_draw_info (NDI_UNIQUE, 0, op, tmp->msg); |
|
|
1523 | } |
|
|
1524 | |
1516 | |
1525 | esrv_send_item (op, tmp); |
1517 | esrv_send_item (op, tmp); |
1526 | } |
1518 | } |
1527 | |
1519 | |
1528 | num_ident--; |
1520 | num_ident--; |
1529 | success = 1; |
|
|
1530 | if (!num_ident) |
1521 | if (!num_ident) |
1531 | break; |
1522 | break; |
1532 | } |
1523 | } |
1533 | } |
1524 | } |
1534 | |
1525 | |
1535 | if (!success) |
1526 | if (buf.empty ()) |
1536 | 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 | } |
1537 | else |
1531 | else |
|
|
1532 | { |
|
|
1533 | if (op->contr) |
|
|
1534 | op->contr->infobox (MSG_CHANNEL ("identify"), buf); |
|
|
1535 | |
1538 | spell_effect (spell, op->x, op->y, op->map, op); |
1536 | spell_effect (spell, op->x, op->y, op->map, op); |
1539 | |
1537 | return 1; |
1540 | return success; |
1538 | } |
1541 | } |
1539 | } |
1542 | |
1540 | |
1543 | int |
1541 | int |
1544 | cast_detection (object *op, object *caster, object *spell, object *skill) |
1542 | cast_detection (object *op, object *caster, object *spell, object *skill) |
1545 | { |
1543 | { |
… | |
… | |
2210 | new_aura->set_owner (op); |
2208 | new_aura->set_owner (op); |
2211 | |
2209 | |
2212 | return 1; |
2210 | return 1; |
2213 | } |
2211 | } |
2214 | |
2212 | |
2215 | |
|
|
2216 | /* 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, |
2217 | * 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 |
2218 | * around him. |
2215 | * around him. |
2219 | * Aura parameters: |
2216 | * Aura parameters: |
2220 | * duration: duration counter. |
2217 | * duration: duration counter. |
2221 | * attacktype: aura's attacktype |
2218 | * attacktype: aura's attacktype |
2222 | * other_arch: archetype to drop where we attack |
2219 | * other_arch: archetype to drop where we attack |
2223 | */ |
2220 | */ |
2224 | |
|
|
2225 | void |
2221 | void |
2226 | move_aura (object *aura) |
2222 | move_aura (object *aura) |
2227 | { |
2223 | { |
2228 | int i, mflags; |
|
|
2229 | object *env; |
|
|
2230 | maptile *m; |
|
|
2231 | |
|
|
2232 | /* auras belong in inventories */ |
2224 | /* auras belong in inventories */ |
2233 | env = aura->env; |
2225 | object *env = aura->env; |
|
|
2226 | object *owner = aura->owner; |
2234 | |
2227 | |
2235 | /* no matter what we've gotta remove the aura... |
2228 | /* no matter what we've gotta remove the aura... |
2236 | * we'll put it back if its time isn't up. |
2229 | * we'll put it back if its time isn't up. |
2237 | */ |
2230 | */ |
2238 | aura->remove (); |
2231 | aura->remove (); |
… | |
… | |
2243 | aura->destroy (); |
2236 | aura->destroy (); |
2244 | return; |
2237 | return; |
2245 | } |
2238 | } |
2246 | |
2239 | |
2247 | /* auras only exist in inventories */ |
2240 | /* auras only exist in inventories */ |
2248 | if (env == NULL || env->map == NULL) |
2241 | if (!env || !env->map) |
2249 | { |
2242 | { |
2250 | aura->destroy (); |
2243 | aura->destroy (); |
2251 | return; |
2244 | return; |
2252 | } |
2245 | } |
2253 | |
2246 | |
2254 | /* we need to jump out of the inventory for a bit |
2247 | /* we need to jump out of the inventory for a bit |
2255 | * in order to hit the map conveniently. |
2248 | * in order to hit the map conveniently. |
2256 | */ |
2249 | */ |
2257 | aura->insert_at (env, aura); |
2250 | aura->insert_at (env, aura); |
2258 | |
2251 | |
2259 | for (i = 1; i < 9; i++) |
2252 | for (int i = 1; i < 9; i++) |
2260 | { |
2253 | { |
2261 | sint16 nx, ny; |
2254 | mapxy pos (env); |
|
|
2255 | pos.move (i); |
2262 | |
2256 | |
2263 | nx = aura->x + freearr_x[i]; |
|
|
2264 | ny = aura->y + freearr_y[i]; |
|
|
2265 | mflags = get_map_flags (env->map, &m, nx, ny, &nx, &ny); |
|
|
2266 | |
|
|
2267 | /* Consider the movement tyep of the person with the aura as |
2257 | /* Consider the movement type of the person with the aura as |
2268 | * 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 |
2269 | * 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. |
2270 | */ |
2260 | */ |
2271 | 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))) |
2272 | { |
2262 | { |
2273 | hit_map (aura, i, aura->attacktype, 0); |
2263 | hit_map (aura, i, aura->attacktype, 0); |
2274 | |
2264 | |
2275 | if (aura->other_arch) |
2265 | if (aura->other_arch) |
2276 | m->insert (arch_to_object (aura->other_arch), nx, ny, aura); |
2266 | pos.insert (arch_to_object (aura->other_arch), aura); |
2277 | } |
2267 | } |
2278 | } |
2268 | } |
2279 | |
2269 | |
2280 | /* put the aura back in the player's inventory */ |
2270 | /* put the aura back in the player's inventory */ |
2281 | aura->remove (); |
2271 | env->insert (aura); |
2282 | insert_ob_in_ob (aura, env); |
2272 | aura->set_owner (owner); |
2283 | } |
2273 | } |
2284 | |
2274 | |
2285 | /* moves the peacemaker spell. |
2275 | /* moves the peacemaker spell. |
2286 | * op is the piece object. |
2276 | * op is the piece object. |
2287 | */ |
2277 | */ |