| | 3329 | /* |
|---|
| | 3330 | * Initialise the info |
|---|
| | 3331 | */ |
|---|
| | 3332 | errr eval_info(eval_info_power_func eval_info_process, header *head) |
|---|
| | 3333 | { |
|---|
| | 3334 | int err; |
|---|
| | 3335 | |
|---|
| | 3336 | /* Process the info */ |
|---|
| | 3337 | err = (*eval_info_process)(head); |
|---|
| | 3338 | |
|---|
| | 3339 | return(err); |
|---|
| | 3340 | } |
|---|
| | 3341 | |
|---|
| | 3342 | #ifdef ALLOW_TEMPLATES_PROCESS |
|---|
| | 3343 | |
|---|
| | 3344 | /* |
|---|
| | 3345 | * Total monster power |
|---|
| | 3346 | */ |
|---|
| | 3347 | static s32b tot_mon_power; |
|---|
| | 3348 | |
|---|
| | 3349 | |
|---|
| | 3350 | static long eval_blow_effect(int effect, int atk_dam, int rlev) |
|---|
| | 3351 | { |
|---|
| | 3352 | switch (effect) |
|---|
| | 3353 | { |
|---|
| | 3354 | /*other bad effects - minor*/ |
|---|
| | 3355 | case RBE_EAT_GOLD: |
|---|
| | 3356 | case RBE_EAT_ITEM: |
|---|
| | 3357 | case RBE_EAT_FOOD: |
|---|
| | 3358 | case RBE_EAT_LITE: |
|---|
| | 3359 | case RBE_LOSE_CHR: |
|---|
| | 3360 | { |
|---|
| | 3361 | atk_dam += 5; |
|---|
| | 3362 | break; |
|---|
| | 3363 | } |
|---|
| | 3364 | /*other bad effects - poison / disease */ |
|---|
| | 3365 | case RBE_POISON: |
|---|
| | 3366 | { |
|---|
| | 3367 | atk_dam *= 5; |
|---|
| | 3368 | atk_dam /= 4; |
|---|
| | 3369 | atk_dam += rlev; |
|---|
| | 3370 | break; |
|---|
| | 3371 | } |
|---|
| | 3372 | /*other bad effects - elements / sustains*/ |
|---|
| | 3373 | case RBE_TERRIFY: |
|---|
| | 3374 | case RBE_ELEC: |
|---|
| | 3375 | case RBE_COLD: |
|---|
| | 3376 | case RBE_FIRE: |
|---|
| | 3377 | { |
|---|
| | 3378 | atk_dam += 10; |
|---|
| | 3379 | break; |
|---|
| | 3380 | } |
|---|
| | 3381 | /*other bad effects - elements / major*/ |
|---|
| | 3382 | case RBE_ACID: |
|---|
| | 3383 | case RBE_BLIND: |
|---|
| | 3384 | case RBE_CONFUSE: |
|---|
| | 3385 | case RBE_LOSE_STR: |
|---|
| | 3386 | case RBE_LOSE_INT: |
|---|
| | 3387 | case RBE_LOSE_WIS: |
|---|
| | 3388 | case RBE_LOSE_DEX: |
|---|
| | 3389 | case RBE_HALLU: |
|---|
| | 3390 | { |
|---|
| | 3391 | atk_dam += 20; |
|---|
| | 3392 | break; |
|---|
| | 3393 | } |
|---|
| | 3394 | /*other bad effects - major*/ |
|---|
| | 3395 | case RBE_UN_BONUS: |
|---|
| | 3396 | case RBE_UN_POWER: |
|---|
| | 3397 | case RBE_LOSE_CON: |
|---|
| | 3398 | { |
|---|
| | 3399 | atk_dam += 30; |
|---|
| | 3400 | break; |
|---|
| | 3401 | } |
|---|
| | 3402 | /*other bad effects - major*/ |
|---|
| | 3403 | case RBE_PARALYZE: |
|---|
| | 3404 | case RBE_LOSE_ALL: |
|---|
| | 3405 | { |
|---|
| | 3406 | atk_dam += 40; |
|---|
| | 3407 | break; |
|---|
| | 3408 | } |
|---|
| | 3409 | /* Experience draining attacks */ |
|---|
| | 3410 | case RBE_EXP_10: |
|---|
| | 3411 | case RBE_EXP_20: |
|---|
| | 3412 | { |
|---|
| | 3413 | atk_dam += 1000 / (rlev + 1); |
|---|
| | 3414 | break; |
|---|
| | 3415 | } |
|---|
| | 3416 | case RBE_EXP_40: |
|---|
| | 3417 | case RBE_EXP_80: |
|---|
| | 3418 | { |
|---|
| | 3419 | atk_dam += 2000 / (rlev + 1); |
|---|
| | 3420 | break; |
|---|
| | 3421 | } |
|---|
| | 3422 | /*Earthquakes*/ |
|---|
| | 3423 | case RBE_SHATTER: |
|---|
| | 3424 | { |
|---|
| | 3425 | atk_dam += 300; |
|---|
| | 3426 | break; |
|---|
| | 3427 | } |
|---|
| | 3428 | /*nothing special*/ |
|---|
| | 3429 | default: break; |
|---|
| | 3430 | } |
|---|
| | 3431 | |
|---|
| | 3432 | return (atk_dam); |
|---|
| | 3433 | } |
|---|
| | 3434 | |
|---|
| | 3435 | |
|---|
| | 3436 | |
|---|
| | 3437 | /* |
|---|
| | 3438 | * Go through the attack types for this monster. |
|---|
| | 3439 | * We look for the maximum possible maximum damage that this |
|---|
| | 3440 | * monster can inflict in 10 game turns. |
|---|
| | 3441 | * |
|---|
| | 3442 | * We try to scale this based on assumed resists, |
|---|
| | 3443 | * chance of casting spells and of spells failing, |
|---|
| | 3444 | * chance of hitting in melee, and particularly speed. |
|---|
| | 3445 | */ |
|---|
| | 3446 | |
|---|
| | 3447 | static long eval_max_dam(monster_race *r_ptr) |
|---|
| | 3448 | { |
|---|
| | 3449 | int hp, rlev, i; |
|---|
| | 3450 | int melee_dam, atk_dam, spell_dam, breath_dam; |
|---|
| | 3451 | int dam = 1; |
|---|
| | 3452 | |
|---|
| | 3453 | /*clear the counters*/ |
|---|
| | 3454 | melee_dam = breath_dam = atk_dam = spell_dam = 0; |
|---|
| | 3455 | |
|---|
| | 3456 | /* Evaluate average HP for this monster */ |
|---|
| | 3457 | if (r_ptr->flags1 & (RF1_FORCE_MAXHP)) hp = r_ptr->hdice * r_ptr->hside; |
|---|
| | 3458 | else hp = r_ptr->hdice * (r_ptr->hside + 1) / 2; |
|---|
| | 3459 | |
|---|
| | 3460 | /* Extract the monster level, force 1 for town monsters */ |
|---|
| | 3461 | rlev = ((r_ptr->level >= 1) ? r_ptr->level : 1); |
|---|
| | 3462 | |
|---|
| | 3463 | /* Note the following code for average damage depends on |
|---|
| | 3464 | * a lot of "magic numbers" in melee2.c. This is |
|---|
| | 3465 | * unavoidable. Any change to the damage calculations |
|---|
| | 3466 | * in melee2.c may render the following inaccurate or |
|---|
| | 3467 | * obsolete. |
|---|
| | 3468 | * |
|---|
| | 3469 | * To do: (perhaps) change melee2.c to work with #define |
|---|
| | 3470 | * statements or separate methods that can be called from |
|---|
| | 3471 | * here, eliminating the need for duplication. |
|---|
| | 3472 | */ |
|---|
| | 3473 | |
|---|
| | 3474 | /* Assume single resist for the elemental attacks */ |
|---|
| | 3475 | breath_dam = ((hp / 3) > 1600 ? 533 : (hp / 9)); |
|---|
| | 3476 | if ((r_ptr->flags4 & RF4_BR_ACID) && spell_dam < breath_dam) spell_dam = breath_dam + 20; |
|---|
| | 3477 | if ((r_ptr->flags4 & RF4_BR_ELEC) && spell_dam < breath_dam) spell_dam = breath_dam + 10; |
|---|
| | 3478 | if ((r_ptr->flags4 & RF4_BR_FIRE) && spell_dam < breath_dam) spell_dam = breath_dam + 10; |
|---|
| | 3479 | if ((r_ptr->flags4 & RF4_BR_COLD) && spell_dam < breath_dam) spell_dam = breath_dam + 10; |
|---|
| | 3480 | /* Same for poison, but lower damage cap */ |
|---|
| | 3481 | breath_dam = ((hp / 3) > 800 ? 266 : (hp / 9)); |
|---|
| | 3482 | if ((r_ptr->flags4 & RF4_BR_POIS) && spell_dam < breath_dam) spell_dam = (breath_dam * 5 / 4) + rlev; |
|---|
| | 3483 | /* |
|---|
| | 3484 | * Different formulae for the high resist attacks |
|---|
| | 3485 | * (remember, we are assuming maximum resisted damage) |
|---|
| | 3486 | * See also: melee2.c, spells1.c |
|---|
| | 3487 | */ |
|---|
| | 3488 | breath_dam = ((hp / 6) > 550 ? 471 : ((hp * 6) / 42)); |
|---|
| | 3489 | if ((r_ptr->flags4 & RF4_BR_NETH) && spell_dam < breath_dam) spell_dam = breath_dam + 2000 / (rlev + 1); |
|---|
| | 3490 | breath_dam = ((hp / 6) > 500 ? 428 : ((hp * 6) / 42)); |
|---|
| | 3491 | if ((r_ptr->flags4 & RF4_BR_CHAO) && spell_dam < breath_dam) spell_dam = breath_dam + 2000 / (rlev + 1); |
|---|
| | 3492 | if ((r_ptr->flags4 & RF4_BR_DISE) && spell_dam < breath_dam) spell_dam = breath_dam + 50; |
|---|
| | 3493 | if ((r_ptr->flags4 & RF4_BR_SHAR) && spell_dam < breath_dam) spell_dam = (breath_dam * 5 / 4) + 5; |
|---|
| | 3494 | breath_dam = ((hp / 6) > 400 ? 228 : ((hp * 4) / 42)); |
|---|
| | 3495 | if ((r_ptr->flags4 & RF4_BR_LITE) && spell_dam < breath_dam) spell_dam = breath_dam + 10; |
|---|
| | 3496 | if ((r_ptr->flags4 & RF4_BR_DARK) && spell_dam < breath_dam) spell_dam = breath_dam + 10; |
|---|
| | 3497 | breath_dam = ((hp / 6) > 400 ? 285 : ((hp * 5) / 42)); |
|---|
| | 3498 | if ((r_ptr->flags4 & RF4_BR_CONF) && spell_dam < breath_dam) spell_dam = breath_dam + 20; |
|---|
| | 3499 | breath_dam = ((hp / 6) > 500 ? 357 : ((hp * 5) / 42)); |
|---|
| | 3500 | if ((r_ptr->flags4 & RF4_BR_SOUN) && spell_dam < breath_dam) spell_dam = breath_dam + 20; |
|---|
| | 3501 | breath_dam = ((hp / 6) > 400 ? 342 : ((hp * 6) / 42)); |
|---|
| | 3502 | if ((r_ptr->flags4 & RF4_BR_NEXU) && spell_dam < breath_dam) spell_dam = breath_dam + 20; |
|---|
| | 3503 | breath_dam = ((hp / 3) > 150 ? 150 : (hp / 9)); |
|---|
| | 3504 | if ((r_ptr->flags4 & RF4_BR_TIME) && spell_dam < breath_dam) spell_dam = breath_dam + 2000 / (rlev + 1); |
|---|
| | 3505 | breath_dam = ((hp / 6) > 200 ? 200 : (hp / 6)); |
|---|
| | 3506 | if ((r_ptr->flags4 & RF4_BR_INER) && spell_dam < breath_dam) spell_dam = breath_dam + 30; |
|---|
| | 3507 | breath_dam = ((hp / 3) > 200 ? 200 : (hp / 3)); |
|---|
| | 3508 | if ((r_ptr->flags4 & RF4_BR_GRAV) && spell_dam < breath_dam) spell_dam = breath_dam + 30; |
|---|
| | 3509 | breath_dam = ((hp / 6) > 150 ? 150 : (hp / 6)); |
|---|
| | 3510 | if ((r_ptr->flags4 & RF4_BR_PLAS) && spell_dam < breath_dam) spell_dam = breath_dam + 30; |
|---|
| | 3511 | breath_dam = ((hp / 6) > 200 ? 200 : (hp / 6)); |
|---|
| | 3512 | if ((r_ptr->flags4 & RF4_BR_WALL) && spell_dam < breath_dam) spell_dam = breath_dam + 30; |
|---|
| | 3513 | |
|---|
| | 3514 | /* Handle the attack spells, again assuming single resists */ |
|---|
| | 3515 | if ((r_ptr->flags5 & RF5_BA_ACID) && spell_dam < (rlev * 3 + 15) / 3 + 20) |
|---|
| | 3516 | spell_dam = (rlev * 3 + 15) / 3 + 20; |
|---|
| | 3517 | if ((r_ptr->flags5 & RF5_BA_ELEC) && spell_dam < ((rlev * 3 / 2) + 8) / 3 + 10) |
|---|
| | 3518 | spell_dam = ((rlev * 3 / 2) + 8) / 3 + 10; |
|---|
| | 3519 | if ((r_ptr->flags5 & RF5_BA_FIRE) && spell_dam < ((rlev * 7 / 2) + 10) / 3 + 10) |
|---|
| | 3520 | spell_dam = ((rlev * 7 / 2) + 10) / 3 + 10; |
|---|
| | 3521 | if ((r_ptr->flags5 & RF5_BA_COLD) && spell_dam < ((rlev * 3 / 2) + 10) / 3 + 10) |
|---|
| | 3522 | spell_dam = ((rlev * 3 / 2) + 10) / 3 + 10; |
|---|
| | 3523 | if ((r_ptr->flags5 & RF5_BA_POIS) && spell_dam < 8) |
|---|
| | 3524 | spell_dam = 8; |
|---|
| | 3525 | if ((r_ptr->flags5 & RF5_BA_NETH) && spell_dam < ((rlev + 150) * 6) / 7 + 2000 / (rlev + 1)) |
|---|
| | 3526 | spell_dam = ((rlev + 150) * 6) / 7 + 2000 / (rlev + 1); |
|---|
| | 3527 | if ((r_ptr->flags5 & RF5_BA_WATE) && spell_dam < ((rlev * 5) / 2) + 50 + 20) |
|---|
| | 3528 | spell_dam = ((rlev * 5) / 2) + 50 + 20; |
|---|
| | 3529 | if ((r_ptr->flags5 & RF5_BA_MANA) && spell_dam < rlev * 5 + 100) |
|---|
| | 3530 | spell_dam = rlev * 5 + 100; |
|---|
| | 3531 | if ((r_ptr->flags5 & RF5_BA_DARK) && spell_dam < ((rlev * 5 + 100) * 4) / 7 + 10) |
|---|
| | 3532 | spell_dam = (rlev * 20 + 400) / 7 + 10; |
|---|
| | 3533 | /* Small annoyance value */ |
|---|
| | 3534 | if ((r_ptr->flags5 & RF5_DRAIN_MANA) && spell_dam < 5) |
|---|
| | 3535 | spell_dam = 5; |
|---|
| | 3536 | /* For all attack forms the player can save against, spell_damage is halved */ |
|---|
| | 3537 | if ((r_ptr->flags5 & RF5_MIND_BLAST) && spell_dam < 32) |
|---|
| | 3538 | spell_dam = 32; |
|---|
| | 3539 | if ((r_ptr->flags5 & RF5_BRAIN_SMASH) && spell_dam < 90) |
|---|
| | 3540 | spell_dam = 90; |
|---|
| | 3541 | if ((r_ptr->flags5 & RF5_CAUSE_1) && spell_dam < 12) |
|---|
| | 3542 | spell_dam = 12; |
|---|
| | 3543 | if ((r_ptr->flags5 & RF5_CAUSE_2) && spell_dam < 32) |
|---|
| | 3544 | spell_dam = 32; |
|---|
| | 3545 | if ((r_ptr->flags5 & RF5_CAUSE_3) && spell_dam < 75) |
|---|
| | 3546 | spell_dam = 75; |
|---|
| | 3547 | if ((r_ptr->flags5 & RF5_CAUSE_4) && spell_dam < 112) |
|---|
| | 3548 | spell_dam = 112; |
|---|
| | 3549 | if ((r_ptr->flags5 & RF5_BO_ACID) && spell_dam < ((rlev / 3) + 56) / 3 + 20) |
|---|
| | 3550 | spell_dam = ((rlev / 3) + 56) / 3 + 20; |
|---|
| | 3551 | if ((r_ptr->flags5 & RF5_BO_ELEC) && spell_dam < ((rlev / 3) + 32) / 3 + 10) |
|---|
| | 3552 | spell_dam = ((rlev / 3) + 32) / 3 + 10; |
|---|
| | 3553 | if ((r_ptr->flags5 & RF5_BO_FIRE) && spell_dam < ((rlev / 3) + 72) / 3 + 10) |
|---|
| | 3554 | spell_dam = ((rlev / 3) + 72) / 3 + 10; |
|---|
| | 3555 | if ((r_ptr->flags5 & RF5_BO_COLD) && spell_dam < ((rlev / 3) + 48) / 3 + 10) |
|---|
| | 3556 | spell_dam = ((rlev / 3) + 48) / 3 + 10; |
|---|
| | 3557 | if ((r_ptr->flags5 & RF5_BO_NETH) && spell_dam < ((rlev * 18) / 2 + 330) / 7 + 2000 / (rlev + 1)) |
|---|
| | 3558 | spell_dam = ((rlev * 18) / 2 + 330) / 7; |
|---|
| | 3559 | if ((r_ptr->flags5 & RF5_BO_WATE) && spell_dam < rlev + 100 + 20) |
|---|
| | 3560 | spell_dam = rlev + 100; |
|---|
| | 3561 | if ((r_ptr->flags5 & RF5_BO_MANA) && spell_dam < (rlev * 7) / 2 + 50) |
|---|
| | 3562 | spell_dam = (rlev * 7) / 2 + 50; |
|---|
| | 3563 | if ((r_ptr->flags5 & RF5_BO_PLAS) && spell_dam < rlev + 66) |
|---|
| | 3564 | spell_dam = rlev + 66; |
|---|
| | 3565 | if ((r_ptr->flags5 & RF5_BO_ICEE) && spell_dam < (rlev + 36) / 3) |
|---|
| | 3566 | spell_dam = (rlev + 36) / 3; |
|---|
| | 3567 | if ((r_ptr->flags5 & RF5_MISSILE) && spell_dam < rlev / 3 + 12) |
|---|
| | 3568 | spell_dam = rlev / 3 + 12; |
|---|
| | 3569 | /* Small annoyance value */ |
|---|
| | 3570 | if ((r_ptr->flags5 & RF5_SCARE) && spell_dam < 5) |
|---|
| | 3571 | spell_dam = 5; |
|---|
| | 3572 | /* Somewhat higher annoyance values */ |
|---|
| | 3573 | if ((r_ptr->flags5 & RF5_BLIND) && spell_dam < 10) |
|---|
| | 3574 | spell_dam = 8; |
|---|
| | 3575 | if ((r_ptr->flags5 & RF5_CONF) && spell_dam < 10) |
|---|
| | 3576 | spell_dam = 10; |
|---|
| | 3577 | /* A little more dangerous */ |
|---|
| | 3578 | if ((r_ptr->flags5 & RF5_SLOW) && spell_dam < 15) |
|---|
| | 3579 | spell_dam = 15; |
|---|
| | 3580 | /* Quite dangerous at an early level */ |
|---|
| | 3581 | if ((r_ptr->flags5 & RF5_HOLD) && spell_dam < 25) |
|---|
| | 3582 | spell_dam = 25; |
|---|
| | 3583 | /* Arbitrary values along similar lines from here on */ |
|---|
| | 3584 | if ((r_ptr->flags6 & RF6_HASTE) && spell_dam < 70) |
|---|
| | 3585 | spell_dam = 70; |
|---|
| | 3586 | if ((r_ptr->flags6 & RF6_HEAL) && spell_dam < 30) |
|---|
| | 3587 | spell_dam = 30; |
|---|
| | 3588 | if ((r_ptr->flags6 & RF6_BLINK) && spell_dam < 5) |
|---|
| | 3589 | spell_dam = 15; |
|---|
| | 3590 | if ((r_ptr->flags6 & RF6_TELE_TO) && spell_dam < 25) |
|---|
| | 3591 | spell_dam = 25; |
|---|
| | 3592 | if ((r_ptr->flags6 & RF6_TELE_AWAY) && spell_dam < 25) |
|---|
| | 3593 | spell_dam = 25; |
|---|
| | 3594 | if ((r_ptr->flags6 & RF6_TELE_LEVEL) && spell_dam < 40) |
|---|
| | 3595 | spell_dam = 25; |
|---|
| | 3596 | if ((r_ptr->flags6 & RF6_DARKNESS) && spell_dam < 5) |
|---|
| | 3597 | spell_dam = 6; |
|---|
| | 3598 | if ((r_ptr->flags6 & RF6_TRAPS) && spell_dam < 10) |
|---|
| | 3599 | spell_dam = 5; |
|---|
| | 3600 | if ((r_ptr->flags6 & RF6_FORGET) && spell_dam < 25) |
|---|
| | 3601 | spell_dam = 5; |
|---|
| | 3602 | /* All summons are assigned arbitrary values */ |
|---|
| | 3603 | /* Summon kin is more dangerous at deeper levels */ |
|---|
| | 3604 | if ((r_ptr->flags6 & RF6_S_KIN) && spell_dam < rlev * 2) |
|---|
| | 3605 | spell_dam = rlev * 2; |
|---|
| | 3606 | /* Dangerous! */ |
|---|
| | 3607 | if ((r_ptr->flags6 & RF6_S_HI_DEMON) && spell_dam < 250) |
|---|
| | 3608 | spell_dam = 250; |
|---|
| | 3609 | /* Somewhat dangerous */ |
|---|
| | 3610 | if ((r_ptr->flags6 & RF6_S_MONSTER) && spell_dam < 40) |
|---|
| | 3611 | spell_dam = 40; |
|---|
| | 3612 | /* More dangerous */ |
|---|
| | 3613 | if ((r_ptr->flags6 & RF6_S_MONSTERS) && spell_dam < 80) |
|---|
| | 3614 | spell_dam = 80; |
|---|
| | 3615 | /* Mostly just annoying */ |
|---|
| | 3616 | if ((r_ptr->flags6 & RF6_S_ANIMAL) && spell_dam < 30) |
|---|
| | 3617 | spell_dam = 30; |
|---|
| | 3618 | if ((r_ptr->flags6 & RF6_S_SPIDER) && spell_dam < 20) |
|---|
| | 3619 | spell_dam = 20; |
|---|
| | 3620 | /* Can be quite dangerous */ |
|---|
| | 3621 | if ((r_ptr->flags6 & RF6_S_HOUND) && spell_dam < 100) |
|---|
| | 3622 | spell_dam = 100; |
|---|
| | 3623 | /* Dangerous! */ |
|---|
| | 3624 | if ((r_ptr->flags6 & RF6_S_HYDRA) && spell_dam < 150) |
|---|
| | 3625 | spell_dam = 150; |
|---|
| | 3626 | /* Can be quite dangerous */ |
|---|
| | 3627 | if ((r_ptr->flags6 & RF6_S_ANGEL) && spell_dam < 150) |
|---|
| | 3628 | spell_dam = 150; |
|---|
| | 3629 | /* All of these more dangerous at higher levels */ |
|---|
| | 3630 | if ((r_ptr->flags6 & RF6_S_DEMON) && spell_dam < (rlev * 3) / 2) |
|---|
| | 3631 | spell_dam = (rlev * 3) / 2; |
|---|
| | 3632 | if ((r_ptr->flags6 & RF6_S_UNDEAD) && spell_dam < (rlev * 3) / 2) |
|---|
| | 3633 | spell_dam = (rlev * 3) / 2; |
|---|
| | 3634 | if ((r_ptr->flags6 & RF6_S_DRAGON) && spell_dam < (rlev * 3) / 2) |
|---|
| | 3635 | spell_dam = (rlev * 3) / 2; |
|---|
| | 3636 | /* Extremely dangerous */ |
|---|
| | 3637 | if ((r_ptr->flags6 & RF6_S_HI_UNDEAD) && spell_dam < 400) |
|---|
| | 3638 | spell_dam = 400; |
|---|
| | 3639 | /* Extremely dangerous */ |
|---|
| | 3640 | if ((r_ptr->flags6 & RF6_S_HI_DRAGON) && spell_dam < 400) |
|---|
| | 3641 | spell_dam = 400; |
|---|
| | 3642 | /* Extremely dangerous */ |
|---|
| | 3643 | if ((r_ptr->flags6 & RF6_S_WRAITH) && spell_dam < 450) |
|---|
| | 3644 | spell_dam = 450; |
|---|
| | 3645 | /* Most dangerous summon */ |
|---|
| | 3646 | if ((r_ptr->flags6 & RF6_S_UNIQUE) && spell_dam < 500) |
|---|
| | 3647 | spell_dam = 500; |
|---|
| | 3648 | |
|---|
| | 3649 | /* Hack - Apply over 10 rounds */ |
|---|
| | 3650 | spell_dam *= 10; |
|---|
| | 3651 | |
|---|
| | 3652 | /* Scale for frequency and availability of mana / ammo */ |
|---|
| | 3653 | if (spell_dam) |
|---|
| | 3654 | { |
|---|
| | 3655 | int freq = r_ptr->freq_spell; |
|---|
| | 3656 | |
|---|
| | 3657 | /* Hack -- always get 1 shot */ |
|---|
| | 3658 | if (freq < 10) freq = 10; |
|---|
| | 3659 | |
|---|
| | 3660 | /* Adjust for frequency */ |
|---|
| | 3661 | spell_dam = spell_dam * freq / 100; |
|---|
| | 3662 | } |
|---|
| | 3663 | |
|---|
| | 3664 | /* Check attacks */ |
|---|
| | 3665 | for (i = 0; i < 4; i++) |
|---|
| | 3666 | { |
|---|
| | 3667 | /* Extract the attack infomation */ |
|---|
| | 3668 | int effect = r_ptr->blow[i].effect; |
|---|
| | 3669 | int method = r_ptr->blow[i].method; |
|---|
| | 3670 | int d_dice = r_ptr->blow[i].d_dice; |
|---|
| | 3671 | int d_side = r_ptr->blow[i].d_side; |
|---|
| | 3672 | |
|---|
| | 3673 | /* Hack -- no more attacks */ |
|---|
| | 3674 | if (!method) continue; |
|---|
| | 3675 | |
|---|
| | 3676 | /* Assume maximum damage*/ |
|---|
| | 3677 | atk_dam = eval_blow_effect(effect, d_dice * d_side, r_ptr->level); |
|---|
| | 3678 | |
|---|
| | 3679 | switch (method) |
|---|
| | 3680 | { |
|---|
| | 3681 | /*stun definitely most dangerous*/ |
|---|
| | 3682 | case RBM_PUNCH: |
|---|
| | 3683 | case RBM_KICK: |
|---|
| | 3684 | case RBM_BUTT: |
|---|
| | 3685 | case RBM_CRUSH: |
|---|
| | 3686 | { |
|---|
| | 3687 | atk_dam *= 4; |
|---|
| | 3688 | atk_dam /= 3; |
|---|
| | 3689 | break; |
|---|
| | 3690 | } |
|---|
| | 3691 | /*cut*/ |
|---|
| | 3692 | case RBM_CLAW: |
|---|
| | 3693 | case RBM_BITE: |
|---|
| | 3694 | { |
|---|
| | 3695 | atk_dam *= 7; |
|---|
| | 3696 | atk_dam /= 5; |
|---|
| | 3697 | break; |
|---|
| | 3698 | } |
|---|
| | 3699 | default: |
|---|
| | 3700 | { |
|---|
| | 3701 | break; |
|---|
| | 3702 | } |
|---|
| | 3703 | } |
|---|
| | 3704 | |
|---|
| | 3705 | /* Normal melee attack */ |
|---|
| | 3706 | if (!(r_ptr->flags1 & (RF1_NEVER_BLOW))) |
|---|
| | 3707 | { |
|---|
| | 3708 | /* Keep a running total */ |
|---|
| | 3709 | melee_dam += atk_dam; |
|---|
| | 3710 | } |
|---|
| | 3711 | } |
|---|
| | 3712 | |
|---|
| | 3713 | /* |
|---|
| | 3714 | * Apply damage over 10 rounds. We assume that the monster has to make contact first. |
|---|
| | 3715 | * Hack - speed has more impact on melee as has to stay in contact with player. |
|---|
| | 3716 | * Hack - this is except for pass wall and kill wall monsters which can always get to the player. |
|---|
| | 3717 | * Hack - use different values for huge monsters as they strike out to range 2. |
|---|
| | 3718 | */ |
|---|
| | 3719 | if (r_ptr->flags2 & (RF2_KILL_WALL | RF2_PASS_WALL)) |
|---|
| | 3720 | melee_dam *= 10; |
|---|
| | 3721 | else |
|---|
| | 3722 | { |
|---|
| | 3723 | melee_dam = melee_dam * 3 + melee_dam * extract_energy[r_ptr->speed + (r_ptr->flags6 & RF6_HASTE ? 5 : 0)] / 7; |
|---|
| | 3724 | } |
|---|
| | 3725 | |
|---|
| | 3726 | /* |
|---|
| | 3727 | * Scale based on attack accuracy. We make a massive number of assumptions here and just use monster level. |
|---|
| | 3728 | */ |
|---|
| | 3729 | melee_dam = melee_dam * MIN(45 + rlev * 3, 95) / 100; |
|---|
| | 3730 | |
|---|
| | 3731 | /* Hack -- Monsters that multiply ignore the following reductions */ |
|---|
| | 3732 | if (!(r_ptr->flags2 & (RF2_MULTIPLY))) |
|---|
| | 3733 | { |
|---|
| | 3734 | /*Reduce damamge potential for monsters that move randomly */ |
|---|
| | 3735 | if ((r_ptr->flags1 & (RF1_RAND_25)) || (r_ptr->flags1 & (RF1_RAND_50))) |
|---|
| | 3736 | { |
|---|
| | 3737 | int reduce = 100; |
|---|
| | 3738 | |
|---|
| | 3739 | if (r_ptr->flags1 & (RF1_RAND_25)) reduce -= 25; |
|---|
| | 3740 | if (r_ptr->flags1 & (RF1_RAND_50)) reduce -= 50; |
|---|
| | 3741 | |
|---|
| | 3742 | /*even moving randomly one in 8 times will hit the player*/ |
|---|
| | 3743 | reduce += (100 - reduce) / 8; |
|---|
| | 3744 | |
|---|
| | 3745 | /* adjust the melee damage*/ |
|---|
| | 3746 | melee_dam = (melee_dam * reduce) / 100; |
|---|
| | 3747 | } |
|---|
| | 3748 | |
|---|
| | 3749 | /*monsters who can't move aren't nearly as much of a combat threat*/ |
|---|
| | 3750 | if (r_ptr->flags1 & (RF1_NEVER_MOVE)) |
|---|
| | 3751 | { |
|---|
| | 3752 | if (r_ptr->flags6 & (RF6_TELE_TO | RF6_BLINK)) |
|---|
| | 3753 | { |
|---|
| | 3754 | /* Scale for frequency */ |
|---|
| | 3755 | melee_dam = melee_dam / 5 + 4 * melee_dam * r_ptr->freq_spell / 500; |
|---|
| | 3756 | |
|---|
| | 3757 | /* Incorporate spell failure chance */ |
|---|
| | 3758 | if (!(r_ptr->flags2 & RF2_STUPID)) melee_dam = melee_dam / 5 + 4 * melee_dam * MIN(75 + (rlev + 3) / 4, 100) / 500; |
|---|
| | 3759 | } |
|---|
| | 3760 | else if (r_ptr->flags2 & (RF2_INVISIBLE)) melee_dam /= 3; |
|---|
| | 3761 | else melee_dam /= 5; |
|---|
| | 3762 | } |
|---|
| | 3763 | } |
|---|
| | 3764 | |
|---|
| | 3765 | /* But keep at a minimum */ |
|---|
| | 3766 | if (melee_dam < 1) melee_dam = 1; |
|---|
| | 3767 | |
|---|
| | 3768 | /* |
|---|
| | 3769 | * Get the max damage attack |
|---|
| | 3770 | */ |
|---|
| | 3771 | |
|---|
| | 3772 | if (dam < spell_dam) dam = spell_dam; |
|---|
| | 3773 | if (dam < melee_dam) dam = melee_dam; |
|---|
| | 3774 | |
|---|
| | 3775 | r_ptr->highest_threat = dam; |
|---|
| | 3776 | |
|---|
| | 3777 | /* |
|---|
| | 3778 | * Adjust for speed. Monster at speed 120 will do double damage, |
|---|
| | 3779 | * monster at speed 100 will do half, etc. Bonus for monsters who can haste self. |
|---|
| | 3780 | */ |
|---|
| | 3781 | dam = (dam * extract_energy[r_ptr->speed + (r_ptr->flags6 & RF6_HASTE ? 5 : 0)]) / 10; |
|---|
| | 3782 | |
|---|
| | 3783 | /* |
|---|
| | 3784 | * Adjust threat for speed -- multipliers are more threatening. |
|---|
| | 3785 | */ |
|---|
| | 3786 | if (r_ptr->flags2 & (RF2_MULTIPLY)) |
|---|
| | 3787 | r_ptr->highest_threat = (r_ptr->highest_threat * extract_energy[r_ptr->speed + (r_ptr->flags6 & RF6_HASTE ? 5 : 0)]) / 5; |
|---|
| | 3788 | |
|---|
| | 3789 | /* |
|---|
| | 3790 | * Adjust threat for friends. |
|---|
| | 3791 | */ |
|---|
| | 3792 | if (r_ptr->flags1 & (RF1_FRIENDS)) |
|---|
| | 3793 | r_ptr->highest_threat *= 2; |
|---|
| | 3794 | else if (r_ptr->flags1 & (RF1_FRIEND)) |
|---|
| | 3795 | r_ptr->highest_threat = r_ptr->highest_threat * 3 / 2; |
|---|
| | 3796 | |
|---|
| | 3797 | /*but deep in a minimum*/ |
|---|
| | 3798 | if (dam < 1) dam = 1; |
|---|
| | 3799 | |
|---|
| | 3800 | /* We're done */ |
|---|
| | 3801 | return (dam); |
|---|
| | 3802 | } |
|---|
| | 3803 | |
|---|
| | 3804 | /* Evaluate and adjust a monsters hit points for how easily the monster is damaged */ |
|---|
| | 3805 | static long eval_hp_adjust(monster_race *r_ptr) |
|---|
| | 3806 | { |
|---|
| | 3807 | long hp; |
|---|
| | 3808 | int resists = 1; |
|---|
| | 3809 | int hide_bonus = 0; |
|---|
| | 3810 | |
|---|
| | 3811 | /* Get the monster base hitpoints */ |
|---|
| | 3812 | if (r_ptr->flags1 & (RF1_FORCE_MAXHP)) hp = r_ptr->hdice * r_ptr->hside; |
|---|
| | 3813 | else hp = r_ptr->hdice * (r_ptr->hside + 1) / 2; |
|---|
| | 3814 | |
|---|
| | 3815 | /* Never moves with no ranged attacks - high hit points count for less */ |
|---|
| | 3816 | if ((r_ptr->flags1 & (RF1_NEVER_MOVE)) && !(r_ptr->freq_innate || r_ptr->freq_spell)) |
|---|
| | 3817 | { |
|---|
| | 3818 | hp /= 2; |
|---|
| | 3819 | if (hp < 1) hp = 1; |
|---|
| | 3820 | } |
|---|
| | 3821 | |
|---|
| | 3822 | /* Just assume healers have more staying power */ |
|---|
| | 3823 | if (r_ptr->flags6 & RF6_HEAL) hp = (hp * 6) / 5; |
|---|
| | 3824 | |
|---|
| | 3825 | /* Miscellaneous improvements */ |
|---|
| | 3826 | if (r_ptr->flags2 & RF2_REGENERATE) {hp *= 10; hp /= 9;} |
|---|
| | 3827 | if (r_ptr->flags2 & RF2_PASS_WALL) {hp *= 3; hp /= 2;} |
|---|
| | 3828 | |
|---|
| | 3829 | /* Calculate hide bonus */ |
|---|
| | 3830 | if (r_ptr->flags2 & RF2_EMPTY_MIND) hide_bonus += 2; |
|---|
| | 3831 | else |
|---|
| | 3832 | { |
|---|
| | 3833 | if (r_ptr->flags2 & RF2_COLD_BLOOD) hide_bonus += 1; |
|---|
| | 3834 | if (r_ptr->flags2 & RF2_WEIRD_MIND) hide_bonus += 1; |
|---|
| | 3835 | } |
|---|
| | 3836 | |
|---|
| | 3837 | /* Invisibility */ |
|---|
| | 3838 | if (r_ptr->flags2 & RF2_INVISIBLE) |
|---|
| | 3839 | { |
|---|
| | 3840 | hp = (hp * (r_ptr->level + hide_bonus + 1)) / MAX(1, r_ptr->level); |
|---|
| | 3841 | } |
|---|
| | 3842 | |
|---|
| | 3843 | /* Monsters that can teleport are a hassle, and can easily run away */ |
|---|
| | 3844 | if ((r_ptr->flags6 & RF6_TPORT) || |
|---|
| | 3845 | (r_ptr->flags6 & RF6_TELE_AWAY)|| |
|---|
| | 3846 | (r_ptr->flags6 & RF6_TELE_LEVEL)) hp = (hp * 6) / 5; |
|---|
| | 3847 | |
|---|
| | 3848 | /* |
|---|
| | 3849 | * Monsters that multiply are tougher to kill |
|---|
| | 3850 | */ |
|---|
| | 3851 | if (r_ptr->flags2 & (RF2_MULTIPLY)) hp *= 2; |
|---|
| | 3852 | |
|---|
| | 3853 | /* Monsters with resistances are harder to kill. |
|---|
| | 3854 | Therefore effective slays / brands against them are worth more. */ |
|---|
| | 3855 | if (r_ptr->flags3 & RF3_IM_ACID) resists += 2; |
|---|
| | 3856 | if (r_ptr->flags3 & RF3_IM_FIRE) resists += 2; |
|---|
| | 3857 | if (r_ptr->flags3 & RF3_IM_COLD) resists += 2; |
|---|
| | 3858 | if (r_ptr->flags3 & RF3_IM_ELEC) resists += 2; |
|---|
| | 3859 | if (r_ptr->flags3 & RF3_IM_POIS) resists += 2; |
|---|
| | 3860 | |
|---|
| | 3861 | /* Bonus for multiple basic resists and weapon resists */ |
|---|
| | 3862 | if (resists >= 12) resists *= 6; |
|---|
| | 3863 | else if (resists >= 10) resists *= 4; |
|---|
| | 3864 | else if (resists >= 8) resists *= 3; |
|---|
| | 3865 | else if (resists >= 6) resists *= 2; |
|---|
| | 3866 | |
|---|
| | 3867 | /* If quite resistant, reduce resists by defense holes */ |
|---|
| | 3868 | if (resists >= 6) |
|---|
| | 3869 | { |
|---|
| | 3870 | if (r_ptr->flags3 & RF3_HURT_ROCK) resists -= 1; |
|---|
| | 3871 | if (!(r_ptr->flags3 & RF3_NO_SLEEP)) resists -= 3; |
|---|
| | 3872 | if (!(r_ptr->flags3 & RF3_NO_FEAR)) resists -= 2; |
|---|
| | 3873 | if (!(r_ptr->flags3 & RF3_NO_CONF)) resists -= 2; |
|---|
| | 3874 | if (!(r_ptr->flags3 & RF3_NO_STUN)) resists -= 1; |
|---|
| | 3875 | |
|---|
| | 3876 | if (resists < 5) resists = 5; |
|---|
| | 3877 | } |
|---|
| | 3878 | |
|---|
| | 3879 | /* If quite resistant, bonus for high resists */ |
|---|
| | 3880 | if (resists >= 3) |
|---|
| | 3881 | { |
|---|
| | 3882 | if (r_ptr->flags3 & RF3_IM_WATER) resists += 1; |
|---|
| | 3883 | if (r_ptr->flags3 & RF3_RES_NETH) resists += 1; |
|---|
| | 3884 | if (r_ptr->flags3 & RF3_RES_NEXUS) resists += 1; |
|---|
| | 3885 | if (r_ptr->flags3 & RF3_RES_DISE) resists += 1; |
|---|
| | 3886 | } |
|---|
| | 3887 | |
|---|
| | 3888 | /* Scale resists */ |
|---|
| | 3889 | resists = resists * 25; |
|---|
| | 3890 | |
|---|
| | 3891 | /* Monster resistances */ |
|---|
| | 3892 | if (resists < (r_ptr->ac + resists) / 3) |
|---|
| | 3893 | { |
|---|
| | 3894 | hp += (hp * resists) / (150 + r_ptr->level); |
|---|
| | 3895 | } |
|---|
| | 3896 | else |
|---|
| | 3897 | { |
|---|
| | 3898 | hp += (hp * (r_ptr->ac + resists) / 3) / (150 + r_ptr->level); |
|---|
| | 3899 | } |
|---|
| | 3900 | |
|---|
| | 3901 | /*boundry control*/ |
|---|
| | 3902 | if (hp < 1) hp = 1; |
|---|
| | 3903 | |
|---|
| | 3904 | return (hp); |
|---|
| | 3905 | |
|---|
| | 3906 | } |
|---|
| | 3907 | |
|---|
| | 3908 | |
|---|
| | 3909 | /* |
|---|
| | 3910 | * Evaluate the monster power ratings to be stored in r_info.raw |
|---|
| | 3911 | */ |
|---|
| | 3912 | errr eval_r_power(header *head) |
|---|
| | 3913 | { |
|---|
| | 3914 | int i, j; |
|---|
| | 3915 | byte lvl; |
|---|
| | 3916 | long hp, av_hp, av_dam; |
|---|
| | 3917 | long tot_hp[MAX_DEPTH]; |
|---|
| | 3918 | long dam; |
|---|
| | 3919 | long *power; |
|---|
| | 3920 | long tot_dam[MAX_DEPTH]; |
|---|
| | 3921 | long mon_count[MAX_DEPTH]; |
|---|
| | 3922 | monster_race *r_ptr = NULL; |
|---|
| | 3923 | |
|---|
| | 3924 | int iteration; |
|---|
| | 3925 | |
|---|
| | 3926 | /* Allocate space for power */ |
|---|
| | 3927 | C_MAKE(power, z_info->r_max, long); |
|---|
| | 3928 | |
|---|
| | 3929 | |
|---|
| | 3930 | for (iteration = 0; iteration < 3; iteration ++) |
|---|
| | 3931 | { |
|---|
| | 3932 | |
|---|
| | 3933 | /* Reset the sum of all monster power values */ |
|---|
| | 3934 | tot_mon_power = 0; |
|---|
| | 3935 | |
|---|
| | 3936 | /* Make sure all arrays start at zero */ |
|---|
| | 3937 | for (i = 0; i < MAX_DEPTH; i++) |
|---|
| | 3938 | { |
|---|
| | 3939 | tot_hp[i] = 0; |
|---|
| | 3940 | tot_dam[i] = 0; |
|---|
| | 3941 | mon_count[i] = 0; |
|---|
| | 3942 | } |
|---|
| | 3943 | |
|---|
| | 3944 | /* |
|---|
| | 3945 | * Go through r_info and evaluate power ratings & flows. |
|---|
| | 3946 | */ |
|---|
| | 3947 | for (i = 0; i < z_info->r_max; i++) |
|---|
| | 3948 | { |
|---|
| | 3949 | /* Point at the "info" */ |
|---|
| | 3950 | r_ptr = (monster_race*)head->info_ptr + i; |
|---|
| | 3951 | |
|---|
| | 3952 | /*** Evaluate power ratings ***/ |
|---|
| | 3953 | |
|---|
| | 3954 | /* Set the current level */ |
|---|
| | 3955 | lvl = r_ptr->level; |
|---|
| | 3956 | |
|---|
| | 3957 | /* Maximum damage this monster can do in 10 game turns */ |
|---|
| | 3958 | dam = eval_max_dam(r_ptr); |
|---|
| | 3959 | |
|---|
| | 3960 | /* Adjust hit points based on resistances */ |
|---|
| | 3961 | hp = eval_hp_adjust(r_ptr); |
|---|
| | 3962 | |
|---|
| | 3963 | /* Hack -- set exp */ |
|---|
| | 3964 | if (lvl == 0) r_ptr->mexp = 0L; |
|---|
| | 3965 | else |
|---|
| | 3966 | { |
|---|
| | 3967 | /* Compute depths of non-unique monsters */ |
|---|
| | 3968 | if (!(r_ptr->flags1 & (RF1_UNIQUE))) |
|---|
| | 3969 | { |
|---|
| | 3970 | long mexp = (hp * dam) / 25; |
|---|
| | 3971 | long threat = r_ptr->highest_threat; |
|---|
| | 3972 | |
|---|
| | 3973 | /* Compute level algorithmically */ |
|---|
| | 3974 | for (j = 1; (mexp > j + 4) || (threat > j + 5); mexp -= j * j, threat -= (j + 4), j++); |
|---|
| | 3975 | |
|---|
| | 3976 | /* Set level */ |
|---|
| | 3977 | lvl = MIN(( j > 250 ? 90 + (j - 250) / 20 : /* Level 90 and above */ |
|---|
| | 3978 | (j > 130 ? 70 + (j - 130) / 6 : /* Level 70 and above */ |
|---|
| | 3979 | (j > 40 ? 40 + (j - 40) / 3 : /* Level 40 and above */ |
|---|
| | 3980 | j))), 99); |
|---|
| | 3981 | |
|---|
| | 3982 | /* Set level */ |
|---|
| | 3983 | r_ptr->level = lvl; |
|---|
| | 3984 | } |
|---|
| | 3985 | |
|---|
| | 3986 | /* Hack -- for Ungoliant */ |
|---|
| | 3987 | if (hp > 10000) r_ptr->mexp = (hp / 25) * (dam / lvl); |
|---|
| | 3988 | else r_ptr->mexp = (hp * dam) / (lvl * 25); |
|---|
| | 3989 | |
|---|
| | 3990 | /* Round to 2 significant figures */ |
|---|
| | 3991 | if (r_ptr->mexp > 100) |
|---|
| | 3992 | { |
|---|
| | 3993 | if (r_ptr->mexp < 1000) { r_ptr->mexp = (r_ptr->mexp + 5) / 10; r_ptr->mexp *= 10; } |
|---|
| | 3994 | else if (r_ptr->mexp < 10000) { r_ptr->mexp = (r_ptr->mexp + 50) / 100; r_ptr->mexp *= 100; } |
|---|
| | 3995 | else if (r_ptr->mexp < 100000) { r_ptr->mexp = (r_ptr->mexp + 500) / 1000; r_ptr->mexp *= 1000; } |
|---|
| | 3996 | else if (r_ptr->mexp < 1000000) { r_ptr->mexp = (r_ptr->mexp + 5000) / 10000; r_ptr->mexp *= 10000; } |
|---|
| | 3997 | else if (r_ptr->mexp < 10000000) { r_ptr->mexp = (r_ptr->mexp + 50000) / 100000; r_ptr->mexp *= 100000; } |
|---|
| | 3998 | } |
|---|
| | 3999 | } |
|---|
| | 4000 | |
|---|
| | 4001 | if ((lvl) && (r_ptr->mexp < 1L)) r_ptr->mexp = 1L; |
|---|
| | 4002 | |
|---|
| | 4003 | /* |
|---|
| | 4004 | * Hack - We have to use an adjustment factor to prevent overflow. |
|---|
| | 4005 | */ |
|---|
| | 4006 | if (lvl >= 90) |
|---|
| | 4007 | { |
|---|
| | 4008 | hp /= 1000; |
|---|
| | 4009 | dam /= 1000; |
|---|
| | 4010 | } |
|---|
| | 4011 | else if (lvl >= 65) |
|---|
| | 4012 | { |
|---|
| | 4013 | hp /= 100; |
|---|
| | 4014 | dam /= 100; |
|---|
| | 4015 | } |
|---|
| | 4016 | else if (lvl >= 40) |
|---|
| | 4017 | { |
|---|
| | 4018 | hp /= 10; |
|---|
| | 4019 | dam /= 10; |
|---|
| | 4020 | } |
|---|
| | 4021 | |
|---|
| | 4022 | /* Define the power rating */ |
|---|
| | 4023 | power[i] = hp * dam; |
|---|
| | 4024 | |
|---|
| | 4025 | /* Adjust for group monsters. Average in-level group size is 5 */ |
|---|
| | 4026 | if (r_ptr->flags1 & RF1_UNIQUE) ; |
|---|
| | 4027 | |
|---|
| | 4028 | else if (r_ptr->flags1 & RF1_FRIEND) power[i] *= 2; |
|---|
| | 4029 | |
|---|
| | 4030 | else if (r_ptr->flags1 & RF1_FRIENDS) power[i] *= 5; |
|---|
| | 4031 | |
|---|
| | 4032 | /* Adjust for multiplying monsters. This is modified by the speed, |
|---|
| | 4033 | * as fast multipliers are much worse than slow ones. We also adjust for |
|---|
| | 4034 | * ability to bypass walls or doors. |
|---|
| | 4035 | */ |
|---|
| | 4036 | if (r_ptr->flags2 & RF2_MULTIPLY) |
|---|
| | 4037 | { |
|---|
| | 4038 | if (r_ptr->flags2 & (RF2_KILL_WALL | RF2_PASS_WALL)) |
|---|
| | 4039 | power[i] = MAX(power[i], power[i] * extract_energy[r_ptr->speed |
|---|
| | 4040 | + (r_ptr->flags6 & RF6_HASTE ? 5 : 0)]); |
|---|
| | 4041 | else if (r_ptr->flags2 & (RF2_OPEN_DOOR | RF2_BASH_DOOR)) |
|---|
| | 4042 | power[i] = MAX(power[i], power[i] * extract_energy[r_ptr->speed |
|---|
| | 4043 | + (r_ptr->flags6 & RF6_HASTE ? 5 : 0)] * 3 / 2); |
|---|
| | 4044 | else |
|---|
| | 4045 | power[i] = MAX(power[i], power[i] * extract_energy[r_ptr->speed |
|---|
| | 4046 | + (r_ptr->flags6 & RF6_HASTE ? 5 : 0)] / 2); |
|---|
| | 4047 | } |
|---|
| | 4048 | |
|---|
| | 4049 | /* |
|---|
| | 4050 | * Update the running totals - these will be used as divisors later |
|---|
| | 4051 | * Total HP / dam / count for everything up to the current level |
|---|
| | 4052 | */ |
|---|
| | 4053 | for (j = lvl; j < (lvl == 0 ? lvl + 1: MAX_DEPTH); j++) |
|---|
| | 4054 | { |
|---|
| | 4055 | int count = 10; |
|---|
| | 4056 | |
|---|
| | 4057 | /* |
|---|
| | 4058 | * Uniques don't count towards monster power on the level. |
|---|
| | 4059 | */ |
|---|
| | 4060 | if (r_ptr->flags1 & RF1_UNIQUE) continue; |
|---|
| | 4061 | |
|---|
| | 4062 | /* |
|---|
| | 4063 | * Specifically placed monsters don't count towards monster power on the level. |
|---|
| | 4064 | */ |
|---|
| | 4065 | if (!(r_ptr->rarity)) continue; |
|---|
| | 4066 | |
|---|
| | 4067 | /* |
|---|
| | 4068 | * Hack -- provide adjustment factor to prevent overflow |
|---|
| | 4069 | */ |
|---|
| | 4070 | if ((j == 90) && (r_ptr->level < 90)) |
|---|
| | 4071 | { |
|---|
| | 4072 | hp /= 10; |
|---|
| | 4073 | dam /= 10; |
|---|
| | 4074 | } |
|---|
| | 4075 | |
|---|
| | 4076 | if ((j == 65) && (r_ptr->level < 65)) |
|---|
| | 4077 | { |
|---|
| | 4078 | hp /= 10; |
|---|
| | 4079 | dam /= 10; |
|---|
| | 4080 | } |
|---|
| | 4081 | |
|---|
| | 4082 | if ((j == 40) && (r_ptr->level < 40)) |
|---|
| | 4083 | { |
|---|
| | 4084 | hp /= 10; |
|---|
| | 4085 | dam /= 10; |
|---|
| | 4086 | } |
|---|
| | 4087 | |
|---|
| | 4088 | /* |
<