… | |
… | |
284 | } |
284 | } |
285 | |
285 | |
286 | void |
286 | void |
287 | player::disconnect () |
287 | player::disconnect () |
288 | { |
288 | { |
|
|
289 | if (ob) |
|
|
290 | { |
|
|
291 | ob->close_container (); //TODO: client-specific |
|
|
292 | ob->drop_unpaid_items (); |
|
|
293 | } |
|
|
294 | |
289 | if (ns) |
295 | if (ns) |
290 | { |
296 | { |
291 | if (active) |
297 | if (active) |
292 | INVOKE_PLAYER (LOGOUT, this, ARG_INT (0)); |
298 | INVOKE_PLAYER (LOGOUT, this, ARG_INT (0)); |
293 | |
299 | |
294 | INVOKE_PLAYER (DISCONNECT, this); |
300 | INVOKE_PLAYER (DISCONNECT, this); |
295 | |
301 | |
296 | ns->reset_stats (); |
302 | ns->reset_stats (); |
297 | ns->pl = 0; |
303 | ns->pl = 0; |
298 | ns = 0; |
304 | ns = 0; |
299 | } |
|
|
300 | |
|
|
301 | if (ob) |
|
|
302 | { |
|
|
303 | ob->close_container (); //TODO: client-specific |
|
|
304 | ob->drop_unpaid_items (); |
|
|
305 | } |
305 | } |
306 | |
306 | |
307 | observe = ob; |
307 | observe = ob; |
308 | |
308 | |
309 | deactivate (); |
309 | deactivate (); |
… | |
… | |
425 | unsigned lastdist; |
425 | unsigned lastdist; |
426 | rv_vector rv; |
426 | rv_vector rv; |
427 | |
427 | |
428 | for (ol = first_friendly_object, lastdist = 1000; ol; ol = ol->next) |
428 | for (ol = first_friendly_object, lastdist = 1000; ol; ol = ol->next) |
429 | { |
429 | { |
430 | /* We should not find free objects on this friendly list, but it |
|
|
431 | * does periodically happen. Given that, lets deal with it. |
|
|
432 | * While unlikely, it is possible the next object on the friendly |
|
|
433 | * list is also free, so encapsulate this in a while loop. |
|
|
434 | */ |
|
|
435 | while (QUERY_FLAG (ol->ob, FLAG_FREED) || !QUERY_FLAG (ol->ob, FLAG_FRIENDLY)) |
|
|
436 | { |
|
|
437 | object *tmp = ol->ob; |
|
|
438 | |
|
|
439 | /* Can't do much more other than log the fact, because the object |
|
|
440 | * itself will have been cleared. |
|
|
441 | */ |
|
|
442 | LOG (llevDebug, "get_nearest_player: Found free/non friendly object '%s' on friendly list\n", |
|
|
443 | tmp->debug_desc ()); |
|
|
444 | ol = ol->next; |
|
|
445 | remove_friendly_object (tmp); |
|
|
446 | if (!ol) |
|
|
447 | return op; |
|
|
448 | } |
|
|
449 | |
|
|
450 | /* Remove special check for player from this. First, it looks to cause |
|
|
451 | * some crashes (ol->ob->contr not set properly?), but secondly, a more |
|
|
452 | * complicated method of state checking would be needed in any case - |
|
|
453 | * as it was, a clever player could type quit, and the function would |
|
|
454 | * skip them over while waiting for confirmation. Remove |
|
|
455 | * on_same_map check, as can_detect_enemy also does this |
|
|
456 | */ |
|
|
457 | if (!can_detect_enemy (mon, ol->ob, &rv)) |
430 | if (!can_detect_enemy (mon, ol->ob, &rv)) |
458 | continue; |
431 | continue; |
459 | |
432 | |
460 | if (lastdist > rv.distance) |
433 | if (lastdist > rv.distance) |
461 | { |
434 | { |
… | |
… | |
2446 | { |
2419 | { |
2447 | gen_grace = op->stats.maxgrace; |
2420 | gen_grace = op->stats.maxgrace; |
2448 | rate_grace -= rate_grace / 2 * op->contr->gen_grace; |
2421 | rate_grace -= rate_grace / 2 * op->contr->gen_grace; |
2449 | } |
2422 | } |
2450 | |
2423 | |
2451 | /* Regenerate Spell Points */ |
|
|
2452 | if (!op->contr->golem && --op->last_sp < 0) |
|
|
2453 | { |
|
|
2454 | gen_sp = gen_sp * 10 / (op->contr->gen_sp_armour < 10 ? 10 : op->contr->gen_sp_armour); |
|
|
2455 | if (op->stats.sp < op->stats.maxsp) |
|
|
2456 | { |
|
|
2457 | op->stats.sp++; |
|
|
2458 | /* dms do not consume food */ |
|
|
2459 | if (!QUERY_FLAG (op, FLAG_WIZ)) |
|
|
2460 | { |
|
|
2461 | op->stats.food--; |
|
|
2462 | if (op->contr->digestion < 0) |
|
|
2463 | op->stats.food += op->contr->digestion; |
|
|
2464 | else if (op->contr->digestion > 0 && random_roll (0, op->contr->digestion, op, PREFER_HIGH)) |
|
|
2465 | op->stats.food = last_food; |
|
|
2466 | } |
|
|
2467 | } |
|
|
2468 | |
|
|
2469 | if (max_sp > 1) |
|
|
2470 | { |
|
|
2471 | over_sp = (gen_sp + 10) / rate_sp; |
|
|
2472 | if (over_sp > 0) |
|
|
2473 | { |
|
|
2474 | if (op->stats.sp < op->stats.maxsp) |
|
|
2475 | { |
|
|
2476 | op->stats.sp += over_sp > max_sp ? max_sp : over_sp; |
|
|
2477 | |
|
|
2478 | if (random_roll (0, rate_sp - 1, op, PREFER_LOW) > ((gen_sp + 10) % rate_sp)) |
|
|
2479 | op->stats.sp--; |
|
|
2480 | |
|
|
2481 | if (op->stats.sp > op->stats.maxsp) |
|
|
2482 | op->stats.sp = op->stats.maxsp; |
|
|
2483 | } |
|
|
2484 | op->last_sp = 0; |
|
|
2485 | } |
|
|
2486 | else |
|
|
2487 | op->last_sp = rate_sp / (gen_sp < 20 ? 30 : gen_sp + 10); |
|
|
2488 | } |
|
|
2489 | else |
|
|
2490 | op->last_sp = rate_sp / (gen_sp < 20 ? 30 : gen_sp + 10); |
|
|
2491 | } |
|
|
2492 | |
|
|
2493 | /* Regenerate Grace */ |
2424 | /* Regenerate Grace */ |
2494 | /* I altered this a little - maximum grace is ony achieved through prayer -b.t. */ |
2425 | /* I altered this a little - maximum grace is ony achieved through prayer -b.t. */ |
2495 | if (--op->last_grace < 0) |
2426 | if (--op->last_grace < 0) |
2496 | { |
2427 | { |
2497 | if (op->stats.grace < op->stats.maxgrace / 2) |
2428 | if (op->stats.grace < op->stats.maxgrace / 2) |
… | |
… | |
2516 | op->last_grace = rate_grace / (gen_grace < 20 ? 30 : gen_grace + 10); |
2447 | op->last_grace = rate_grace / (gen_grace < 20 ? 30 : gen_grace + 10); |
2517 | } |
2448 | } |
2518 | /* wearing stuff doesn't detract from grace generation. */ |
2449 | /* wearing stuff doesn't detract from grace generation. */ |
2519 | } |
2450 | } |
2520 | |
2451 | |
|
|
2452 | if (op->stats.food > 0) |
|
|
2453 | { |
2521 | /* Regenerate Hit Points */ |
2454 | /* Regenerate Spell Points */ |
2522 | if (--op->last_heal < 0) |
2455 | if (!op->contr->golem && --op->last_sp < 0) |
2523 | { |
|
|
2524 | if (op->stats.hp < op->stats.maxhp) |
|
|
2525 | { |
2456 | { |
2526 | op->stats.hp++; |
2457 | gen_sp = gen_sp * 10 / (op->contr->gen_sp_armour < 10 ? 10 : op->contr->gen_sp_armour); |
2527 | /* dms do not consume food */ |
2458 | |
2528 | if (!QUERY_FLAG (op, FLAG_WIZ)) |
2459 | if (op->stats.sp < op->stats.maxsp) |
2529 | { |
2460 | { |
|
|
2461 | op->stats.sp++; |
|
|
2462 | |
|
|
2463 | /* dms do not consume food */ |
|
|
2464 | if (!QUERY_FLAG (op, FLAG_WIZ)) |
|
|
2465 | { |
2530 | op->stats.food--; |
2466 | op->stats.food--; |
|
|
2467 | |
2531 | if (op->contr->digestion < 0) |
2468 | if (op->contr->digestion < 0) |
2532 | op->stats.food += op->contr->digestion; |
2469 | op->stats.food += op->contr->digestion; |
2533 | else if (op->contr->digestion > 0 && random_roll (0, op->contr->digestion, op, PREFER_HIGH)) |
2470 | else if (op->contr->digestion > 0 && random_roll (0, op->contr->digestion, op, PREFER_HIGH)) |
2534 | op->stats.food = last_food; |
2471 | op->stats.food = last_food; |
|
|
2472 | } |
2535 | } |
2473 | } |
2536 | } |
|
|
2537 | |
2474 | |
2538 | if (max_hp > 1) |
2475 | if (max_sp > 1) |
2539 | { |
|
|
2540 | over_hp = (gen_hp < 20 ? 30 : gen_hp + 10) / rate_hp; |
|
|
2541 | if (over_hp > 0) |
|
|
2542 | { |
2476 | { |
2543 | op->stats.sp += over_hp + (RANDOM () % rate_hp > ((gen_hp < 20 ? 30 : gen_hp + 10) % rate_hp)) ? -1 : 0; |
2477 | over_sp = (gen_sp + 10) / rate_sp; |
|
|
2478 | if (over_sp > 0) |
|
|
2479 | { |
|
|
2480 | if (op->stats.sp < op->stats.maxsp) |
|
|
2481 | { |
|
|
2482 | op->stats.sp += over_sp > max_sp ? max_sp : over_sp; |
|
|
2483 | |
|
|
2484 | if (random_roll (0, rate_sp - 1, op, PREFER_LOW) > ((gen_sp + 10) % rate_sp)) |
|
|
2485 | op->stats.sp--; |
|
|
2486 | |
|
|
2487 | if (op->stats.sp > op->stats.maxsp) |
|
|
2488 | op->stats.sp = op->stats.maxsp; |
|
|
2489 | } |
|
|
2490 | |
2544 | op->last_heal = 0; |
2491 | op->last_sp = 0; |
|
|
2492 | } |
|
|
2493 | else |
|
|
2494 | op->last_sp = rate_sp / (gen_sp < 20 ? 30 : gen_sp + 10); |
2545 | } |
2495 | } |
2546 | else |
2496 | else |
|
|
2497 | op->last_sp = rate_sp / (gen_sp < 20 ? 30 : gen_sp + 10); |
|
|
2498 | } |
|
|
2499 | |
|
|
2500 | /* Regenerate Hit Points */ |
|
|
2501 | if (--op->last_heal < 0) |
|
|
2502 | { |
|
|
2503 | if (op->stats.hp < op->stats.maxhp) |
2547 | { |
2504 | { |
2548 | op->last_heal = rate_hp / (gen_hp < 20 ? 30 : gen_hp + 10); |
2505 | op->stats.hp++; |
|
|
2506 | |
|
|
2507 | /* dms do not consume food */ |
|
|
2508 | if (!QUERY_FLAG (op, FLAG_WIZ)) |
|
|
2509 | { |
|
|
2510 | op->stats.food--; |
|
|
2511 | |
|
|
2512 | if (op->contr->digestion < 0) |
|
|
2513 | op->stats.food += op->contr->digestion; |
|
|
2514 | else if (op->contr->digestion > 0 && random_roll (0, op->contr->digestion, op, PREFER_HIGH)) |
|
|
2515 | op->stats.food = last_food; |
|
|
2516 | } |
2549 | } |
2517 | } |
|
|
2518 | |
|
|
2519 | if (max_hp > 1) |
|
|
2520 | { |
|
|
2521 | over_hp = (gen_hp < 20 ? 30 : gen_hp + 10) / rate_hp; |
|
|
2522 | |
|
|
2523 | if (over_hp > 0) |
|
|
2524 | { |
|
|
2525 | op->stats.sp += over_hp + (RANDOM () % rate_hp > ((gen_hp < 20 ? 30 : gen_hp + 10) % rate_hp)) ? -1 : 0; |
|
|
2526 | op->last_heal = 0; |
|
|
2527 | } |
|
|
2528 | else |
|
|
2529 | op->last_heal = rate_hp / (gen_hp < 20 ? 30 : gen_hp + 10); |
2550 | } |
2530 | } |
2551 | else |
2531 | else |
2552 | { |
|
|
2553 | op->last_heal = rate_hp / (gen_hp < 20 ? 30 : gen_hp + 10); |
2532 | op->last_heal = rate_hp / (gen_hp < 20 ? 30 : gen_hp + 10); |
2554 | } |
2533 | } |
2555 | } |
2534 | } |
2556 | |
2535 | |
2557 | /* Digestion */ |
2536 | /* Digestion */ |
2558 | if (--op->last_eat < 0) |
2537 | if (--op->last_eat < 0) |
… | |
… | |
2595 | new_draw_info (NDI_UNIQUE, 0, op, "You blindly grab for a bite of food."); |
2574 | new_draw_info (NDI_UNIQUE, 0, op, "You blindly grab for a bite of food."); |
2596 | manual_apply (op, flesh, 0); |
2575 | manual_apply (op, flesh, 0); |
2597 | } |
2576 | } |
2598 | } |
2577 | } |
2599 | |
2578 | |
2600 | while (op->stats.food < 0 && op->stats.hp >= 0) |
2579 | if (op->stats.food < 0) |
2601 | op->stats.food++, op->stats.hp--; |
2580 | { |
|
|
2581 | op->stats.hp += op->stats.food; |
|
|
2582 | op->stats.food = 0; |
|
|
2583 | } |
2602 | |
2584 | |
2603 | if (op->stats.hp < 0 && !QUERY_FLAG (op, FLAG_WIZ)) |
2585 | if (op->stats.hp < 0 && !QUERY_FLAG (op, FLAG_WIZ)) |
2604 | kill_player (op); |
2586 | kill_player (op); |
2605 | } |
2587 | } |
2606 | } |
2588 | } |
… | |
… | |
2653 | { |
2635 | { |
2654 | tmp->destroy (); |
2636 | tmp->destroy (); |
2655 | new_draw_info (NDI_UNIQUE, 0, tmp, "Your mind feels clearer"); |
2637 | new_draw_info (NDI_UNIQUE, 0, tmp, "Your mind feels clearer"); |
2656 | } |
2638 | } |
2657 | |
2639 | |
2658 | cure_disease (op, 0); /* remove any disease */ |
2640 | cure_disease (op, 0, 0); /* remove any disease */ |
2659 | op->stats.hp = op->stats.maxhp; |
2641 | op->stats.hp = op->stats.maxhp; |
2660 | if (op->stats.food <= 0) |
2642 | if (op->stats.food <= 0) |
2661 | op->stats.food = 999; |
2643 | op->stats.food = 999; |
2662 | |
2644 | |
2663 | /* create a bodypart-trophy to make the winner happy */ |
2645 | /* create a bodypart-trophy to make the winner happy */ |
… | |
… | |
2863 | { |
2845 | { |
2864 | tmp->destroy (); |
2846 | tmp->destroy (); |
2865 | new_draw_info (NDI_UNIQUE, 0, tmp, "Your mind feels clearer"); |
2847 | new_draw_info (NDI_UNIQUE, 0, tmp, "Your mind feels clearer"); |
2866 | } |
2848 | } |
2867 | |
2849 | |
2868 | cure_disease (op, 0); /* remove any disease */ |
2850 | cure_disease (op, 0, 0); /* remove any disease */ |
2869 | |
2851 | |
2870 | /*add_exp(op, (op->stats.exp * -0.20)); */ |
2852 | /*add_exp(op, (op->stats.exp * -0.20)); */ |
2871 | apply_death_exp_penalty (op); |
2853 | apply_death_exp_penalty (op); |
2872 | if (op->stats.food < 100) |
2854 | if (op->stats.food < 100) |
2873 | op->stats.food = 900; |
2855 | op->stats.food = 900; |
… | |
… | |
3027 | void |
3009 | void |
3028 | make_visible (object *op) |
3010 | make_visible (object *op) |
3029 | { |
3011 | { |
3030 | op->hide = 0; |
3012 | op->hide = 0; |
3031 | op->invisible = 0; |
3013 | op->invisible = 0; |
|
|
3014 | |
3032 | if (op->type == PLAYER) |
3015 | if (op->type == PLAYER) |
3033 | { |
3016 | { |
3034 | op->contr->tmp_invis = 0; |
3017 | op->contr->tmp_invis = 0; |
3035 | op->contr->invis_race = 0; |
3018 | op->contr->invis_race = 0; |
3036 | } |
3019 | } |
… | |
… | |
3049 | |
3032 | |
3050 | /* look at the surrounding terrain to determine |
3033 | /* look at the surrounding terrain to determine |
3051 | * the hideability of this object. Positive levels |
3034 | * the hideability of this object. Positive levels |
3052 | * indicate greater hideability. |
3035 | * indicate greater hideability. |
3053 | */ |
3036 | */ |
3054 | |
|
|
3055 | int |
3037 | int |
3056 | hideability (object *ob) |
3038 | hideability (object *ob) |
3057 | { |
3039 | { |
3058 | int i, level = 0, mflag; |
3040 | int i, level = 0, mflag; |
3059 | sint16 x, y; |
3041 | sint16 x, y; |
… | |
… | |
3184 | * object op. This function works fine for monsters, |
3166 | * object op. This function works fine for monsters, |
3185 | * but we dont worry if the object isnt the top one in |
3167 | * but we dont worry if the object isnt the top one in |
3186 | * a pile (say a coin under a table would return "viewable" |
3168 | * a pile (say a coin under a table would return "viewable" |
3187 | * by this routine). Another question, should we be |
3169 | * by this routine). Another question, should we be |
3188 | * concerned with the direction the player is looking |
3170 | * concerned with the direction the player is looking |
3189 | * in? Realistically, most of use cant see stuff behind |
3171 | * in? Realistically, most of us can't see stuff behind |
3190 | * our backs...on the other hand, does the "facing" direction |
3172 | * our backs...on the other hand, does the "facing" direction |
3191 | * imply the way your head, or body is facing? Its possible |
3173 | * imply the way your head, or body is facing? It's possible |
3192 | * for them to differ. Sigh, this fctn could get a bit more complex. |
3174 | * for them to differ. Sigh, this fctn could get a bit more complex. |
3193 | * -b.t. |
3175 | * -b.t. |
3194 | * This function is now map tiling safe. |
3176 | * This function is now map tiling safe. |
3195 | */ |
3177 | */ |
3196 | |
|
|
3197 | int |
3178 | int |
3198 | player_can_view (object *pl, object *op) |
3179 | player_can_view (object *pl, object *op) |
3199 | { |
3180 | { |
3200 | rv_vector rv; |
3181 | rv_vector rv; |
3201 | int dx, dy; |
3182 | int dx, dy; |
… | |
… | |
3213 | |
3194 | |
3214 | get_rangevector (pl, op, &rv, 0x1); |
3195 | get_rangevector (pl, op, &rv, 0x1); |
3215 | |
3196 | |
3216 | /* starting with the 'head' part, lets loop |
3197 | /* starting with the 'head' part, lets loop |
3217 | * through the object and find if it has any |
3198 | * through the object and find if it has any |
3218 | * part that is in the los array but isnt on |
3199 | * part that is in the los array but isn't on |
3219 | * a blocked los square. |
3200 | * a blocked los square. |
3220 | * we use the archetype to figure out offsets. |
3201 | * we use the archetype to figure out offsets. |
3221 | */ |
3202 | */ |
3222 | while (op) |
3203 | while (op) |
3223 | { |
3204 | { |
… | |
… | |
3226 | |
3207 | |
3227 | /* only the viewable area the player sees is updated by LOS |
3208 | /* only the viewable area the player sees is updated by LOS |
3228 | * code, so we need to restrict ourselves to that range of values |
3209 | * code, so we need to restrict ourselves to that range of values |
3229 | * for any meaningful values. |
3210 | * for any meaningful values. |
3230 | */ |
3211 | */ |
3231 | if (FABS (dx) <= (pl->contr->ns->mapx / 2) && |
3212 | if (abs (dx) <= (pl->contr->ns->mapx / 2) && |
3232 | FABS (dy) <= (pl->contr->ns->mapy / 2) && |
3213 | abs (dy) <= (pl->contr->ns->mapy / 2) && |
3233 | !pl->contr->blocked_los[dx + (pl->contr->ns->mapx / 2)][dy + (pl->contr->ns->mapy / 2)]) |
3214 | !pl->contr->blocked_los[dx + (pl->contr->ns->mapx / 2)][dy + (pl->contr->ns->mapy / 2)]) |
3234 | return 1; |
3215 | return 1; |
|
|
3216 | |
3235 | op = op->more; |
3217 | op = op->more; |
3236 | } |
3218 | } |
|
|
3219 | |
3237 | return 0; |
3220 | return 0; |
3238 | } |
3221 | } |
3239 | |
3222 | |
3240 | /* routine for both players and monsters. We call this when |
3223 | /* routine for both players and monsters. We call this when |
3241 | * there is a possibility for our action distrubing our hiding |
3224 | * there is a possibility for our action distrubing our hiding |
… | |
… | |
3244 | * return 0. |
3227 | * return 0. |
3245 | */ |
3228 | */ |
3246 | int |
3229 | int |
3247 | action_makes_visible (object *op) |
3230 | action_makes_visible (object *op) |
3248 | { |
3231 | { |
3249 | |
|
|
3250 | if (op->invisible && QUERY_FLAG (op, FLAG_ALIVE)) |
3232 | if (op->invisible && QUERY_FLAG (op, FLAG_ALIVE)) |
3251 | { |
3233 | { |
3252 | if (QUERY_FLAG (op, FLAG_MAKE_INVIS)) |
3234 | if (QUERY_FLAG (op, FLAG_MAKE_INVIS)) |
3253 | return 0; |
3235 | return 0; |
3254 | |
3236 | |
… | |
… | |
3260 | { |
3242 | { |
3261 | new_draw_info_format (NDI_UNIQUE, 0, op, "You become %s!", op->hide ? "unhidden" : "visible"); |
3243 | new_draw_info_format (NDI_UNIQUE, 0, op, "You become %s!", op->hide ? "unhidden" : "visible"); |
3262 | return 1; |
3244 | return 1; |
3263 | } |
3245 | } |
3264 | } |
3246 | } |
|
|
3247 | |
3265 | return 0; |
3248 | return 0; |
3266 | } |
3249 | } |
3267 | |
3250 | |
3268 | /* op_on_battleground - checks if the given object op (usually |
3251 | /* op_on_battleground - checks if the given object op (usually |
3269 | * a player) is standing on a valid battleground-tile, |
3252 | * a player) is standing on a valid battleground-tile, |
… | |
… | |
3274 | * Default is to do the same as before, so only people wanting to have different points need worry about this |
3257 | * Default is to do the same as before, so only people wanting to have different points need worry about this |
3275 | */ |
3258 | */ |
3276 | int |
3259 | int |
3277 | op_on_battleground (object *op, int *x, int *y) |
3260 | op_on_battleground (object *op, int *x, int *y) |
3278 | { |
3261 | { |
3279 | object *tmp; |
|
|
3280 | |
|
|
3281 | /* A battleground-tile needs the following attributes to be valid: |
3262 | /* A battleground-tile needs the following attributes to be valid: |
3282 | * is_floor 1 (has to be the FIRST floor beneath the player's feet), |
3263 | * is_floor 1 (has to be the FIRST floor beneath the player's feet), |
3283 | * name="battleground", no_pick 1, type=58 (type BATTLEGROUND) |
3264 | * name="battleground", no_pick 1, type=58 (type BATTLEGROUND) |
3284 | * and the exit-coordinates sp/hp must both be > 0. |
3265 | * and the exit-coordinates sp/hp must both be > 0. |
3285 | * => The intention here is to prevent abuse of the battleground- |
3266 | * => The intention here is to prevent abuse of the battleground- |
3286 | * feature (like pickable or hidden battleground tiles). */ |
3267 | * feature (like pickable or hidden battleground tiles). */ |
3287 | for (tmp = op->below; tmp != NULL; tmp = tmp->below) |
3268 | for (object *tmp = op->below; tmp; tmp = tmp->below) |
3288 | { |
3269 | { |
3289 | if (QUERY_FLAG (tmp, FLAG_IS_FLOOR)) |
3270 | if (QUERY_FLAG (tmp, FLAG_IS_FLOOR)) |
3290 | { |
3271 | { |
3291 | if (QUERY_FLAG (tmp, FLAG_NO_PICK) && |
3272 | if (QUERY_FLAG (tmp, FLAG_NO_PICK) |
3292 | strcmp (tmp->name, "battleground") == 0 && tmp->type == BATTLEGROUND && EXIT_X (tmp) && EXIT_Y (tmp)) |
3273 | && tmp->type == BATTLEGROUND |
|
|
3274 | && tmp->name == shstr_battleground |
|
|
3275 | && EXIT_X (tmp) && EXIT_Y (tmp)) |
3293 | { |
3276 | { |
3294 | /*before we assign the exit, check if this is a teambattle */ |
3277 | /* before we assign the exit, check if this is a teambattle */ |
3295 | if (EXIT_ALT_X (tmp) && EXIT_ALT_Y (tmp) && EXIT_PATH (tmp)) |
3278 | if (EXIT_ALT_X (tmp) && EXIT_ALT_Y (tmp) && EXIT_PATH (tmp)) |
3296 | { |
3279 | { |
3297 | object *invtmp; |
|
|
3298 | |
|
|
3299 | for (invtmp = op->inv; invtmp != NULL; invtmp = invtmp->below) |
3280 | for (object *invtmp = op->inv; invtmp; invtmp = invtmp->below) |
3300 | { |
3281 | { |
3301 | if (invtmp->type == FORCE && invtmp->slaying && !strcmp (EXIT_PATH (tmp), invtmp->slaying)) |
3282 | if (invtmp->type == FORCE && invtmp->slaying && tmp->slaying == invtmp->slaying) |
3302 | { |
3283 | { |
3303 | if (x != NULL && y != NULL) |
3284 | if (x && y) |
3304 | *x = EXIT_ALT_X (tmp), *y = EXIT_ALT_Y (tmp); |
3285 | *x = EXIT_ALT_X (tmp), *y = EXIT_ALT_Y (tmp); |
|
|
3286 | |
3305 | return 1; |
3287 | return 1; |
3306 | } |
3288 | } |
3307 | } |
3289 | } |
3308 | } |
3290 | } |
|
|
3291 | |
3309 | if (x != NULL && y != NULL) |
3292 | if (x && y) |
3310 | *x = EXIT_X (tmp), *y = EXIT_Y (tmp); |
3293 | *x = EXIT_X (tmp), *y = EXIT_Y (tmp); |
|
|
3294 | |
3311 | return 1; |
3295 | return 1; |
3312 | } |
3296 | } |
3313 | } |
3297 | } |
3314 | } |
3298 | } |
|
|
3299 | |
3315 | /* If we got here, did not find a battleground */ |
3300 | /* If we got here, did not find a battleground */ |
3316 | return 0; |
3301 | return 0; |
3317 | } |
3302 | } |
3318 | |
3303 | |
3319 | /* |
3304 | /* |
… | |
… | |
3335 | char buf[MAX_BUF]; /* tmp. string buffer */ |
3320 | char buf[MAX_BUF]; /* tmp. string buffer */ |
3336 | int i = 0, j = 0; |
3321 | int i = 0, j = 0; |
3337 | |
3322 | |
3338 | /* get the appropriate treasurelist */ |
3323 | /* get the appropriate treasurelist */ |
3339 | if (atnr == ATNR_FIRE) |
3324 | if (atnr == ATNR_FIRE) |
3340 | trlist = treasurelist::find ("dragon_ability_fire"); |
3325 | trlist = treasurelist::find (shstr_dragon_ability_fire); |
3341 | else if (atnr == ATNR_COLD) |
3326 | else if (atnr == ATNR_COLD) |
3342 | trlist = treasurelist::find ("dragon_ability_cold"); |
3327 | trlist = treasurelist::find (shstr_dragon_ability_cold); |
3343 | else if (atnr == ATNR_ELECTRICITY) |
3328 | else if (atnr == ATNR_ELECTRICITY) |
3344 | trlist = treasurelist::find ("dragon_ability_elec"); |
3329 | trlist = treasurelist::find (shstr_dragon_ability_elec); |
3345 | else if (atnr == ATNR_POISON) |
3330 | else if (atnr == ATNR_POISON) |
3346 | trlist = treasurelist::find ("dragon_ability_poison"); |
3331 | trlist = treasurelist::find (shstr_dragon_ability_poison); |
3347 | |
3332 | |
3348 | if (trlist == NULL || who->type != PLAYER) |
3333 | if (trlist == NULL || who->type != PLAYER) |
3349 | return; |
3334 | return; |
3350 | |
3335 | |
3351 | for (i = 0, tr = trlist->items; tr != NULL && i < level - 1; tr = tr->next, i++); |
3336 | for (i = 0, tr = trlist->items; tr != NULL && i < level - 1; tr = tr->next, i++); |