| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
#include "angband.h" |
|---|
| 19 |
#include "tvalsval.h" |
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
static u32b obj_total[MAX_DEPTH]; |
|---|
| 23 |
static byte *obj_alloc; |
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 |
#define MAX_O_DEPTH 100 |
|---|
| 27 |
|
|---|
| 28 |
|
|---|
| 29 |
|
|---|
| 30 |
|
|---|
| 31 |
void free_obj_alloc(void) |
|---|
| 32 |
{ |
|---|
| 33 |
FREE(obj_alloc); |
|---|
| 34 |
} |
|---|
| 35 |
|
|---|
| 36 |
|
|---|
| 37 |
|
|---|
| 38 |
|
|---|
| 39 |
|
|---|
| 40 |
bool init_obj_alloc(void) |
|---|
| 41 |
{ |
|---|
| 42 |
int k_max = z_info->k_max; |
|---|
| 43 |
int item, lev; |
|---|
| 44 |
|
|---|
| 45 |
|
|---|
| 46 |
|
|---|
| 47 |
FREE(obj_alloc); |
|---|
| 48 |
|
|---|
| 49 |
|
|---|
| 50 |
obj_alloc = C_ZNEW((MAX_O_DEPTH + 1) * k_max, byte); |
|---|
| 51 |
|
|---|
| 52 |
|
|---|
| 53 |
C_WIPE(obj_total, MAX_O_DEPTH + 1, u32b); |
|---|
| 54 |
|
|---|
| 55 |
|
|---|
| 56 |
|
|---|
| 57 |
for (item = 1; item < k_max; item++) |
|---|
| 58 |
{ |
|---|
| 59 |
object_kind *k_ptr = &k_info[item]; |
|---|
| 60 |
|
|---|
| 61 |
int min = k_ptr->alloc_min; |
|---|
| 62 |
int max = k_ptr->alloc_max; |
|---|
| 63 |
|
|---|
| 64 |
|
|---|
| 65 |
if (!k_ptr->alloc_prob) continue; |
|---|
| 66 |
|
|---|
| 67 |
|
|---|
| 68 |
for (lev = 0; lev <= MAX_O_DEPTH; lev++) |
|---|
| 69 |
{ |
|---|
| 70 |
int rarity = k_ptr->alloc_prob; |
|---|
| 71 |
|
|---|
| 72 |
|
|---|
| 73 |
if ((lev < min) || (lev > max)) rarity = 0; |
|---|
| 74 |
|
|---|
| 75 |
|
|---|
| 76 |
obj_total[lev] += rarity; |
|---|
| 77 |
obj_alloc[(lev * k_max) + item] = rarity; |
|---|
| 78 |
} |
|---|
| 79 |
} |
|---|
| 80 |
|
|---|
| 81 |
return TRUE; |
|---|
| 82 |
} |
|---|
| 83 |
|
|---|
| 84 |
|
|---|
| 85 |
|
|---|
| 86 |
|
|---|
| 87 |
|
|---|
| 88 |
|
|---|
| 89 |
|
|---|
| 90 |
s16b get_obj_num(int level) |
|---|
| 91 |
{ |
|---|
| 92 |
|
|---|
| 93 |
size_t ind, item; |
|---|
| 94 |
u32b value; |
|---|
| 95 |
|
|---|
| 96 |
|
|---|
| 97 |
if ((level > 0) && one_in_(GREAT_OBJ)) |
|---|
| 98 |
{ |
|---|
| 99 |
|
|---|
| 100 |
level = 1 + (level * MAX_O_DEPTH / randint1(MAX_O_DEPTH)); |
|---|
| 101 |
} |
|---|
| 102 |
|
|---|
| 103 |
|
|---|
| 104 |
level = MIN(level, MAX_O_DEPTH); |
|---|
| 105 |
level = MAX(level, 0); |
|---|
| 106 |
|
|---|
| 107 |
|
|---|
| 108 |
ind = level * z_info->k_max; |
|---|
| 109 |
value = randint0(obj_total[level]); |
|---|
| 110 |
for (item = 1; item < z_info->k_max; item++) |
|---|
| 111 |
{ |
|---|
| 112 |
|
|---|
| 113 |
if (value < obj_alloc[ind + item]) break; |
|---|
| 114 |
|
|---|
| 115 |
|
|---|
| 116 |
value -= obj_alloc[ind + item]; |
|---|
| 117 |
} |
|---|
| 118 |
|
|---|
| 119 |
|
|---|
| 120 |
|
|---|
| 121 |
return item; |
|---|
| 122 |
} |
|---|
| 123 |
|
|---|
| 124 |
|
|---|
| 125 |
|
|---|
| 126 |
|
|---|
| 127 |
|
|---|
| 128 |
|
|---|
| 129 |
|
|---|
| 130 |
|
|---|
| 131 |
|
|---|
| 132 |
|
|---|
| 133 |
|
|---|
| 134 |
|
|---|
| 135 |
|
|---|
| 136 |
|
|---|
| 137 |
|
|---|
| 138 |
|
|---|
| 139 |
|
|---|
| 140 |
|
|---|
| 141 |
|
|---|
| 142 |
|
|---|
| 143 |
|
|---|
| 144 |
|
|---|
| 145 |
|
|---|
| 146 |
|
|---|
| 147 |
|
|---|
| 148 |
|
|---|
| 149 |
|
|---|
| 150 |
|
|---|
| 151 |
|
|---|
| 152 |
|
|---|
| 153 |
|
|---|
| 154 |
|
|---|
| 155 |
|
|---|
| 156 |
|
|---|
| 157 |
|
|---|
| 158 |
|
|---|
| 159 |
|
|---|
| 160 |
|
|---|
| 161 |
|
|---|
| 162 |
|
|---|
| 163 |
|
|---|
| 164 |
|
|---|
| 165 |
|
|---|
| 166 |
static s16b m_bonus(int max, int level) |
|---|
| 167 |
{ |
|---|
| 168 |
int bonus, stand, extra, value; |
|---|
| 169 |
|
|---|
| 170 |
|
|---|
| 171 |
|
|---|
| 172 |
if (level > MAX_DEPTH - 1) level = MAX_DEPTH - 1; |
|---|
| 173 |
|
|---|
| 174 |
|
|---|
| 175 |
|
|---|
| 176 |
bonus = ((max * level) / MAX_DEPTH); |
|---|
| 177 |
|
|---|
| 178 |
|
|---|
| 179 |
extra = ((max * level) % MAX_DEPTH); |
|---|
| 180 |
|
|---|
| 181 |
|
|---|
| 182 |
if (randint0(MAX_DEPTH) < extra) bonus++; |
|---|
| 183 |
|
|---|
| 184 |
|
|---|
| 185 |
|
|---|
| 186 |
stand = (max / 4); |
|---|
| 187 |
|
|---|
| 188 |
|
|---|
| 189 |
extra = (max % 4); |
|---|
| 190 |
|
|---|
| 191 |
|
|---|
| 192 |
if (randint0(4) < extra) stand++; |
|---|
| 193 |
|
|---|
| 194 |
|
|---|
| 195 |
|
|---|
| 196 |
value = Rand_normal(bonus, stand); |
|---|
| 197 |
|
|---|
| 198 |
|
|---|
| 199 |
if (value < 0) return (0); |
|---|
| 200 |
|
|---|
| 201 |
|
|---|
| 202 |
if (value > max) return (max); |
|---|
| 203 |
|
|---|
| 204 |
|
|---|
| 205 |
return (value); |
|---|
| 206 |
} |
|---|
| 207 |
|
|---|
| 208 |
|
|---|
| 209 |
|
|---|
| 210 |
|
|---|
| 211 |
|
|---|
| 212 |
|
|---|
| 213 |
|
|---|
| 214 |
static void object_mention(const object_type *o_ptr) |
|---|
| 215 |
{ |
|---|
| 216 |
char o_name[80]; |
|---|
| 217 |
|
|---|
| 218 |
|
|---|
| 219 |
object_desc_spoil(o_name, sizeof(o_name), o_ptr, FALSE, ODESC_BASE); |
|---|
| 220 |
|
|---|
| 221 |
|
|---|
| 222 |
if (artifact_p(o_ptr)) |
|---|
| 223 |
msg_format("Artifact (%s)", o_name); |
|---|
| 224 |
else if (ego_item_p(o_ptr)) |
|---|
| 225 |
msg_format("Ego-item (%s)", o_name); |
|---|
| 226 |
else |
|---|
| 227 |
msg_format("Object (%s)", o_name); |
|---|
| 228 |
} |
|---|
| 229 |
|
|---|
| 230 |
|
|---|
| 231 |
|
|---|
| 232 |
|
|---|
| 233 |
|
|---|
| 234 |
|
|---|
| 235 |
|
|---|
| 236 |
|
|---|
| 237 |
|
|---|
| 238 |
|
|---|
| 239 |
static int make_ego_item(object_type *o_ptr, int level, bool force_uncursed) |
|---|
| 240 |
{ |
|---|
| 241 |
int i, j; |
|---|
| 242 |
|
|---|
| 243 |
int e_idx; |
|---|
| 244 |
|
|---|
| 245 |
long value, total; |
|---|
| 246 |
|
|---|
| 247 |
ego_item_type *e_ptr; |
|---|
| 248 |
|
|---|
| 249 |
alloc_entry *table = alloc_ego_table; |
|---|
| 250 |
|
|---|
| 251 |
|
|---|
| 252 |
|
|---|
| 253 |
if (o_ptr->name1) return (FALSE); |
|---|
| 254 |
if (o_ptr->name2) return (FALSE); |
|---|
| 255 |
|
|---|
| 256 |
|
|---|
| 257 |
if (level > 0) |
|---|
| 258 |
{ |
|---|
| 259 |
|
|---|
| 260 |
if (one_in_(GREAT_EGO)) |
|---|
| 261 |
{ |
|---|
| 262 |
|
|---|
| 263 |
level = 1 + (level * MAX_DEPTH / randint1(MAX_DEPTH)); |
|---|
| 264 |
} |
|---|
| 265 |
} |
|---|
| 266 |
|
|---|
| 267 |
|
|---|
| 268 |
total = 0L; |
|---|
| 269 |
|
|---|
| 270 |
|
|---|
| 271 |
for (i = 0; i < alloc_ego_size; i++) |
|---|
| 272 |
{ |
|---|
| 273 |
|
|---|
| 274 |
table[i].prob3 = 0; |
|---|
| 275 |
|
|---|
| 276 |
|
|---|
| 277 |
if (table[i].level > level) continue; |
|---|
| 278 |
|
|---|
| 279 |
|
|---|
| 280 |
e_idx = table[i].index; |
|---|
| 281 |
|
|---|
| 282 |
|
|---|
| 283 |
e_ptr = &e_info[e_idx]; |
|---|
| 284 |
|
|---|
| 285 |
|
|---|
| 286 |
if (force_uncursed && (e_ptr->flags3 & TR3_LIGHT_CURSE)) continue; |
|---|
| 287 |
|
|---|
| 288 |
|
|---|
| 289 |
for (j = 0; j < EGO_TVALS_MAX; j++) |
|---|
| 290 |
{ |
|---|
| 291 |
|
|---|
| 292 |
if (o_ptr->tval == e_ptr->tval[j]) |
|---|
| 293 |
{ |
|---|
| 294 |
|
|---|
| 295 |
if (o_ptr->sval >= e_ptr->min_sval[j]) |
|---|
| 296 |
{ |
|---|
| 297 |
|
|---|
| 298 |
if (o_ptr->sval <= e_ptr->max_sval[j]) |
|---|
| 299 |
{ |
|---|
| 300 |
|
|---|
| 301 |
table[i].prob3 = table[i].prob2; |
|---|
| 302 |
} |
|---|
| 303 |
} |
|---|
| 304 |
} |
|---|
| 305 |
} |
|---|
| 306 |
|
|---|
| 307 |
|
|---|
| 308 |
total += table[i].prob3; |
|---|
| 309 |
} |
|---|
| 310 |
|
|---|
| 311 |
|
|---|
| 312 |
if (total == 0) return (0); |
|---|
| 313 |
|
|---|
| 314 |
|
|---|
| 315 |
|
|---|
| 316 |
value = randint0(total); |
|---|
| 317 |
|
|---|
| 318 |
|
|---|
| 319 |
for (i = 0; i < alloc_ego_size; i++) |
|---|
| 320 |
{ |
|---|
| 321 |
|
|---|
| 322 |
if (value < table[i].prob3) break; |
|---|
| 323 |
|
|---|
| 324 |
|
|---|
| 325 |
value = value - table[i].prob3; |
|---|
| 326 |
} |
|---|
| 327 |
|
|---|
| 328 |
|
|---|
| 329 |
e_idx = (byte)table[i].index; |
|---|
| 330 |
o_ptr->name2 = e_idx; |
|---|
| 331 |
|
|---|
| 332 |
return ((e_info[e_idx].flags3 & TR3_LIGHT_CURSE) ? -2 : 2); |
|---|
| 333 |
} |
|---|
| 334 |
|
|---|
| 335 |
|
|---|
| 336 |
|
|---|
| 337 |
|
|---|
| 338 |
|
|---|
| 339 |
|
|---|
| 340 |
static void copy_artifact_data(object_type *o_ptr, artifact_type *a_ptr) |
|---|
| 341 |
{ |
|---|
| 342 |
|
|---|
| 343 |
a_ptr->cur_num = 1; |
|---|
| 344 |
|
|---|
| 345 |
|
|---|
| 346 |
o_ptr->pval = a_ptr->pval; |
|---|
| 347 |
o_ptr->ac = a_ptr->ac; |
|---|
| 348 |
o_ptr->dd = a_ptr->dd; |
|---|
| 349 |
o_ptr->ds = a_ptr->ds; |
|---|
| 350 |
o_ptr->to_a = a_ptr->to_a; |
|---|
| 351 |
o_ptr->to_h = a_ptr->to_h; |
|---|
| 352 |
o_ptr->to_d = a_ptr->to_d; |
|---|
| 353 |
o_ptr->weight = a_ptr->weight; |
|---|
| 354 |
|
|---|
| 355 |
|
|---|
| 356 |
if (a_ptr->flags3 & TR3_LIGHT_CURSE) |
|---|
| 357 |
o_ptr->flags3 |= TR3_LIGHT_CURSE; |
|---|
| 358 |
|
|---|
| 359 |
|
|---|
| 360 |
rating += 10; |
|---|
| 361 |
|
|---|
| 362 |
|
|---|
| 363 |
if (a_ptr->cost > 50000L) rating += 10; |
|---|
| 364 |
|
|---|
| 365 |
|
|---|
| 366 |
good_item_flag = TRUE; |
|---|
| 367 |
|
|---|
| 368 |
|
|---|
| 369 |
if (cheat_peek) object_mention(o_ptr); |
|---|
| 370 |
} |
|---|
| 371 |
|
|---|
| 372 |
|
|---|
| 373 |
|
|---|
| 374 |
|
|---|
| 375 |
|
|---|
| 376 |
|
|---|
| 377 |
|
|---|
| 378 |
|
|---|
| 379 |
|
|---|
| 380 |
|
|---|
| 381 |
|
|---|
| 382 |
|
|---|
| 383 |
|
|---|
| 384 |
|
|---|
| 385 |
|
|---|
| 386 |
static bool make_artifact_special(object_type *o_ptr, int level) |
|---|
| 387 |
{ |
|---|
| 388 |
int i; |
|---|
| 389 |
|
|---|
| 390 |
int k_idx; |
|---|
| 391 |
|
|---|
| 392 |
|
|---|
| 393 |
|
|---|
| 394 |
if (adult_no_artifacts) return (FALSE); |
|---|
| 395 |
|
|---|
| 396 |
|
|---|
| 397 |
if (!p_ptr->depth) return (FALSE); |
|---|
| 398 |
|
|---|
| 399 |
|
|---|
| 400 |
for (i = 0; i < ART_MIN_NORMAL; ++i) |
|---|
| 401 |
{ |
|---|
| 402 |
artifact_type *a_ptr = &a_info[i]; |
|---|
| 403 |
|
|---|
| 404 |
|
|---|
| 405 |
if (!a_ptr->name) continue; |
|---|
| 406 |
|
|---|
| 407 |
|
|---|
| 408 |
if (a_ptr->cur_num) continue; |
|---|
| 409 |
|
|---|
| 410 |
|
|---|
| 411 |
if (a_ptr->level > p_ptr->depth) |
|---|
| 412 |
{ |
|---|
| 413 |
|
|---|
| 414 |
int d = (a_ptr->level - p_ptr->depth) * 2; |
|---|
| 415 |
|
|---|
| 416 |
|
|---|
| 417 |
if (randint0(d) != 0) continue; |
|---|
| 418 |
} |
|---|
| 419 |
|
|---|
| 420 |
|
|---|
| 421 |
if (randint0(a_ptr->rarity) != 0) continue; |
|---|
| 422 |
|
|---|
| 423 |
|
|---|
| 424 |
k_idx = lookup_kind(a_ptr->tval, a_ptr->sval); |
|---|
| 425 |
|
|---|
| 426 |
|
|---|
| 427 |
if (k_info[k_idx].level > level) |
|---|
| 428 |
{ |
|---|
| 429 |
|
|---|
| 430 |
int d = (k_info[k_idx].level - level) * 5; |
|---|
| 431 |
|
|---|
| 432 |
|
|---|
| 433 |
if (randint0(d) != 0) continue; |
|---|
| 434 |
} |
|---|
| 435 |
|
|---|
| 436 |
|
|---|
| 437 |
object_prep(o_ptr, k_idx); |
|---|
| 438 |
|
|---|
| 439 |
|
|---|
| 440 |
o_ptr->name1 = i; |
|---|
| 441 |
|
|---|
| 442 |
|
|---|
| 443 |
copy_artifact_data(o_ptr, a_ptr); |
|---|
| 444 |
|
|---|
| 445 |
|
|---|
| 446 |
return TRUE; |
|---|
| 447 |
} |
|---|
| 448 |
|
|---|
| 449 |
|
|---|
| 450 |
return FALSE; |
|---|
| 451 |
} |
|---|
| 452 |
|
|---|
| 453 |
|
|---|
| 454 |
|
|---|
| 455 |
|
|---|
| 456 |
|
|---|
| 457 |
|
|---|
| 458 |
|
|---|
| 459 |
|
|---|
| 460 |
|
|---|
| 461 |
static bool make_artifact(object_type *o_ptr) |
|---|
| 462 |
{ |
|---|
| 463 |
int i; |
|---|
| 464 |
|
|---|
| 465 |
|
|---|
| 466 |
|
|---|
| 467 |
if (adult_no_artifacts) return (FALSE); |
|---|
| 468 |
|
|---|
| 469 |
|
|---|
| 470 |
if (!p_ptr->depth) return (FALSE); |
|---|
| 471 |
|
|---|
| 472 |
|
|---|
| 473 |
if (o_ptr->number != 1) return (FALSE); |
|---|
| 474 |
|
|---|
| 475 |
|
|---|
| 476 |
for (i = ART_MIN_NORMAL; i < z_info->a_max; i++) |
|---|
| 477 |
{ |
|---|
| 478 |
artifact_type *a_ptr = &a_info[i]; |
|---|
| 479 |
|
|---|
| 480 |
|
|---|
| 481 |
if (!a_ptr->name) continue; |
|---|
| 482 |
|
|---|
| 483 |
|
|---|
| 484 |
if (a_ptr->cur_num) continue; |
|---|
| 485 |
|
|---|
| 486 |
|
|---|
| 487 |
if (a_ptr->tval != o_ptr->tval) continue; |
|---|
| 488 |
if (a_ptr->sval != o_ptr->sval) continue; |
|---|
| 489 |
|
|---|
| 490 |
|
|---|
| 491 |
if (a_ptr->level > p_ptr->depth) |
|---|
| 492 |
{ |
|---|
| 493 |
|
|---|
| 494 |
int d = (a_ptr->level - p_ptr->depth) * 2; |
|---|
| 495 |
|
|---|
| 496 |
|
|---|
| 497 |
if (randint0(d) != 0) continue; |
|---|
| 498 |
} |
|---|
| 499 |
|
|---|
| 500 |
|
|---|
| 501 |
if (randint0(a_ptr->rarity) != 0) continue; |
|---|
| 502 |
|
|---|
| 503 |
|
|---|
| 504 |
o_ptr->name1 = i; |
|---|
| 505 |
|
|---|
| 506 |
|
|---|
| 507 |
copy_artifact_data(o_ptr, a_ptr); |
|---|
| 508 |
|
|---|
| 509 |
return TRUE; |
|---|
| 510 |
} |
|---|
| 511 |
|
|---|
| 512 |
return FALSE; |
|---|
| 513 |
} |
|---|
| 514 |
|
|---|
| 515 |
|
|---|
| 516 |
|
|---|
| 517 |
|
|---|
| 518 |
|
|---|
| 519 |
|
|---|
| 520 |
|
|---|
| 521 |
|
|---|
| 522 |
|
|---|
| 523 |
|
|---|
| 524 |
|
|---|
| 525 |
static void a_m_aux_1(object_type *o_ptr, int level, int power) |
|---|
| 526 |
{ |
|---|
| 527 |
int tohit1 = randint1(5) + m_bonus(5, level); |
|---|
| 528 |
int tohit2 = m_bonus(10, level); |
|---|
| 529 |
|
|---|
| 530 |
int todam1 = randint1(5) + m_bonus(5, level); |
|---|
| 531 |
int todam2 = m_bonus(10, level); |
|---|
| 532 |
|
|---|
| 533 |
switch (power) |
|---|
| 534 |
{ |
|---|
| 535 |
case -2: |
|---|
| 536 |
o_ptr->to_h -= tohit2; |
|---|
| 537 |
o_ptr->to_d -= todam2; |
|---|
| 538 |
|
|---|
| 539 |
case -1: |
|---|
| 540 |
o_ptr->to_h -= tohit1; |
|---|
| 541 |
o_ptr->to_d -= todam1; |
|---|
| 542 |
break; |
|---|
| 543 |
|
|---|
| 544 |
case 2: |
|---|
| 545 |
o_ptr->to_h += tohit2; |
|---|
| 546 |
o_ptr->to_d += todam2; |
|---|
| 547 |
|
|---|
| 548 |
case 1: |
|---|
| 549 |
o_ptr->to_h += tohit1; |
|---|
| 550 |
o_ptr->to_d += todam1; |
|---|
| 551 |
break; |
|---|
| 552 |
} |
|---|
| 553 |
|
|---|
| 554 |
|
|---|
| 555 |
|
|---|
| 556 |
switch (o_ptr->tval) |
|---|
| 557 |
{ |
|---|
| 558 |
case TV_DIGGING: |
|---|
| 559 |
{ |
|---|
| 560 |
|
|---|
| 561 |
if (power < -1) |
|---|
| 562 |
{ |
|---|
| 563 |
|
|---|
| 564 |
o_ptr->pval = 0 - (5 + randint1(5)); |
|---|
| 565 |
} |
|---|
| 566 |
|
|---|
| 567 |
|
|---|
| 568 |
else if (power < 0) |
|---|
| 569 |
{ |
|---|
| 570 |
|
|---|
| 571 |
o_ptr->pval = -o_ptr->pval; |
|---|
| 572 |
} |
|---|
| 573 |
|
|---|
| 574 |
break; |
|---|
| 575 |
} |
|---|
| 576 |
|
|---|
| 577 |
|
|---|
| 578 |
case TV_HAFTED: |
|---|
| 579 |
case TV_POLEARM: |
|---|
| 580 |
case TV_SWORD: |
|---|
| 581 |
{ |
|---|
| 582 |
|
|---|
| 583 |
if (power > 1) |
|---|
| 584 |
{ |
|---|
| 585 |
|
|---|
| 586 |
while ((o_ptr->dd * o_ptr->ds > 0) && |
|---|
| 587 |
one_in_(10L * o_ptr->dd * o_ptr->ds)) |
|---|
| 588 |
{ |
|---|
| 589 |
o_ptr->dd++; |
|---|
| 590 |
} |
|---|
| 591 |
|
|---|
| 592 |
|
|---|
| 593 |
if (o_ptr->dd > 9) o_ptr->dd = 9; |
|---|
| 594 |
} |
|---|
| 595 |
|
|---|
| 596 |
break; |
|---|
| 597 |
} |
|---|
| 598 |
|
|---|
| 599 |
|
|---|
| 600 |
case TV_BOLT: |
|---|
| 601 |
case TV_ARROW: |
|---|
| 602 |
case TV_SHOT: |
|---|
| 603 |
{ |
|---|
| 604 |
|
|---|
| 605 |
if (power > 1) |
|---|
| 606 |
{ |
|---|
| 607 |
|
|---|
| 608 |
while ((o_ptr->dd * o_ptr->ds > 0) && |
|---|
| 609 |
one_in_(10L * o_ptr->dd * o_ptr->ds)) |
|---|
| 610 |
{ |
|---|
| 611 |
o_ptr->dd++; |
|---|
| 612 |
} |
|---|
| 613 |
|
|---|
| 614 |
|
|---|
| 615 |
if (o_ptr->dd > 9) o_ptr->dd = 9; |
|---|
| 616 |
} |
|---|
| 617 |
|
|---|
| 618 |
break; |
|---|
| 619 |
} |
|---|
| 620 |
} |
|---|
| 621 |
} |
|---|
| 622 |
|
|---|
| 623 |
|
|---|
| 624 |
|
|---|
| 625 |
|
|---|
| 626 |
|
|---|
| 627 |
static void a_m_aux_2(object_type *o_ptr, int level, int power) |
|---|
| 628 |
{ |
|---|
| 629 |
int toac1 = randint1(5) + m_bonus(5, level); |
|---|
| 630 |
int toac2 = m_bonus(10, level); |
|---|
| 631 |
|
|---|
| 632 |
|
|---|
| 633 |
if (power == -2) |
|---|
| 634 |
o_ptr->to_a -= toac1 + toac2; |
|---|
| 635 |
else if (power == -1) |
|---|
| 636 |
o_ptr->to_a -= toac1; |
|---|
| 637 |
else if (power == 1) |
|---|
| 638 |
o_ptr->to_a += toac1; |
|---|
| 639 |
else if (power == 2) |
|---|
| 640 |
o_ptr->to_a += toac1 + toac2; |
|---|
| 641 |
|
|---|
| 642 |
|
|---|
| 643 |
|
|---|
| 644 |
switch (o_ptr->tval) |
|---|
| 645 |
{ |
|---|
| 646 |
case TV_DRAG_ARMOR: |
|---|
| 647 |
{ |
|---|
| 648 |
|
|---|
| 649 |
rating += 30; |
|---|
| 650 |
|
|---|
| 651 |
|
|---|
| 652 |
if (cheat_peek) object_mention(o_ptr); |
|---|
| 653 |
|
|---|
| 654 |
break; |
|---|
| 655 |
} |
|---|
| 656 |
} |
|---|
| 657 |
} |
|---|
| 658 |
|
|---|
| 659 |
|
|---|
| 660 |
|
|---|
| 661 |
|
|---|
| 662 |
|
|---|
| 663 |
|
|---|
| 664 |
|
|---|
| 665 |
|
|---|
| 666 |
|
|---|
| 667 |
|
|---|
| 668 |
|
|---|
| 669 |
static void a_m_aux_3(object_type *o_ptr, int level, int power) |
|---|
| 670 |
{ |
|---|
| 671 |
if (power < 0) |
|---|
| 672 |
o_ptr->flags3 |= TR3_LIGHT_CURSE; |
|---|
| 673 |
|
|---|
| 674 |
|
|---|
| 675 |
switch (o_ptr->tval) |
|---|
| 676 |
{ |
|---|
| 677 |
case TV_RING: |
|---|
| 678 |
{ |
|---|
| 679 |
|
|---|
| 680 |
switch (o_ptr->sval) |
|---|
| 681 |
{ |
|---|
| 682 |
|
|---|
| 683 |
case SV_RING_STRENGTH: |
|---|
| 684 |
case SV_RING_CONSTITUTION: |
|---|
| 685 |
case SV_RING_DEXTERITY: |
|---|
| 686 |
case SV_RING_INTELLIGENCE: |
|---|
| 687 |
{ |
|---|
| 688 |
|
|---|
| 689 |
o_ptr->pval = 1 + m_bonus(5, level); |
|---|
| 690 |
|
|---|
| 691 |
|
|---|
| 692 |
if (power < 0) |
|---|
| 693 |
o_ptr->pval = -o_ptr->pval; |
|---|
| 694 |
|
|---|
| 695 |
break; |
|---|
| 696 |
} |
|---|
| 697 |
|
|---|
| 698 |
|
|---|
| 699 |
case SV_RING_SPEED: |
|---|
| 700 |
{ |
|---|
| 701 |
|
|---|
| 702 |
o_ptr->pval = randint1(5) + m_bonus(5, level); |
|---|
| 703 |
|
|---|
| 704 |
|
|---|
| 705 |
while (randint0(100) < 50) o_ptr->pval++; |
|---|
| 706 |
|
|---|
| 707 |
|
|---|
| 708 |
if (power < 0) |
|---|
| 709 |
{ |
|---|
| 710 |
|
|---|
| 711 |
o_ptr->pval = -o_ptr->pval; |
|---|
| 712 |
} |
|---|
| 713 |
else |
|---|
| 714 |
{ |
|---|
| 715 |
|
|---|
| 716 |
rating += 25; |
|---|
| 717 |
|
|---|
| 718 |
|
|---|
| 719 |
if (cheat_peek) object_mention(o_ptr); |
|---|
| 720 |
} |
|---|
| 721 |
|
|---|
| 722 |
break; |
|---|
| 723 |
} |
|---|
| 724 |
|
|---|
| 725 |
|
|---|
| 726 |
case SV_RING_SEARCHING: |
|---|
| 727 |
{ |
|---|
| 728 |
|
|---|
| 729 |
o_ptr->pval = 1 + m_bonus(5, level); |
|---|
| 730 |
|
|---|
| 731 |
|
|---|
| 732 |
if (power < 0) |
|---|
| 733 |
o_ptr->pval = -o_ptr->pval; |
|---|
| 734 |
|
|---|
| 735 |
break; |
|---|
| 736 |
} |
|---|
| 737 |
|
|---|
| 738 |
|
|---|
| 739 |
case SV_RING_LIGHT: |
|---|
| 740 |
case SV_RING_DARK: |
|---|
| 741 |
{ |
|---|
| 742 |
|
|---|
| 743 |
o_ptr->pval = 1 + m_bonus(5, level); |
|---|
| 744 |
|
|---|
| 745 |
break; |
|---|
| 746 |
} |
|---|
| 747 |
|
|---|
| 748 |
|
|---|
| 749 |
case SV_RING_FLAMES: |
|---|
| 750 |
case SV_RING_ACID: |
|---|
| 751 |
case SV_RING_ICE: |
|---|
| 752 |
case SV_RING_LIGHTNING: |
|---|
| 753 |
{ |
|---|
| 754 |
|
|---|
| 755 |
o_ptr->to_a = 5 + randint1(5) + m_bonus(10, level); |
|---|
| 756 |
|
|---|
| 757 |
break; |
|---|
| 758 |
} |
|---|
| 759 |
|
|---|
| 760 |
|
|---|
| 761 |
case SV_RING_DAMAGE: |
|---|
| 762 |
{ |
|---|
| 763 |
|
|---|
| 764 |
o_ptr->to_d = 5 + randint1(3) + m_bonus(7, level); |
|---|
| 765 |
|
|---|
| 766 |
|
|---|
| 767 |
if (power < 0) |
|---|
| 768 |
o_ptr->to_d = -o_ptr->to_d; |
|---|
| 769 |
|
|---|
| 770 |
break; |
|---|
| 771 |
} |
|---|
| 772 |
|
|---|
| 773 |
|
|---|
| 774 |
case SV_RING_ACCURACY: |
|---|
| 775 |
{ |
|---|
| 776 |
|
|---|
| 777 |
o_ptr->to_h = 5 + randint1(3) + m_bonus(7, level); |
|---|
| 778 |
|
|---|
| 779 |
|
|---|
| 780 |
if (power < 0) |
|---|
| 781 |
o_ptr->to_h = -o_ptr->to_h; |
|---|
| 782 |
|
|---|
| 783 |
break; |
|---|
| 784 |
} |
|---|
| 785 |
|
|---|
| 786 |
|
|---|
| 787 |
case SV_RING_PROTECTION: |
|---|
| 788 |
{ |
|---|
| 789 |
|
|---|
| 790 |
o_ptr->to_a = 5 + randint1(5) + m_bonus(10, level); |
|---|
| 791 |
|
|---|
| 792 |
|
|---|
| 793 |
if (power < 0) |
|---|
| 794 |
o_ptr->to_a = -o_ptr->to_a; |
|---|
| 795 |
|
|---|
| 796 |
break; |
|---|
| 797 |
} |
|---|
| 798 |
|
|---|
| 799 |
|
|---|
| 800 |
case SV_RING_SLAYING: |
|---|
| 801 |
{ |
|---|
| 802 |
|
|---|
| 803 |
o_ptr->to_d = randint1(5) + m_bonus(5, level); |
|---|
| 804 |
o_ptr->to_h = randint1(5) + m_bonus(5, level); |
|---|
| 805 |
|
|---|
| 806 |
|
|---|
| 807 |
&nbs |
|---|