| 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 |
#include "cmds.h" |
|---|
| 21 |
#include "game-event.h" |
|---|
| 22 |
#include "game-cmd.h" |
|---|
| 23 |
#include "ui-menu.h" |
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 |
|
|---|
| 29 |
|
|---|
| 30 |
|
|---|
| 31 |
|
|---|
| 32 |
|
|---|
| 33 |
|
|---|
| 34 |
|
|---|
| 35 |
|
|---|
| 36 |
|
|---|
| 37 |
|
|---|
| 38 |
|
|---|
| 39 |
|
|---|
| 40 |
|
|---|
| 41 |
|
|---|
| 42 |
|
|---|
| 43 |
|
|---|
| 44 |
|
|---|
| 45 |
|
|---|
| 46 |
|
|---|
| 47 |
|
|---|
| 48 |
|
|---|
| 49 |
|
|---|
| 50 |
|
|---|
| 51 |
|
|---|
| 52 |
|
|---|
| 53 |
|
|---|
| 54 |
|
|---|
| 55 |
|
|---|
| 56 |
typedef struct birther birther; |
|---|
| 57 |
|
|---|
| 58 |
|
|---|
| 59 |
|
|---|
| 60 |
|
|---|
| 61 |
|
|---|
| 62 |
struct birther |
|---|
| 63 |
{ |
|---|
| 64 |
byte sex; |
|---|
| 65 |
byte race; |
|---|
| 66 |
byte class; |
|---|
| 67 |
|
|---|
| 68 |
s16b age; |
|---|
| 69 |
s16b wt; |
|---|
| 70 |
s16b ht; |
|---|
| 71 |
s16b sc; |
|---|
| 72 |
|
|---|
| 73 |
s32b au; |
|---|
| 74 |
|
|---|
| 75 |
s16b stat[A_MAX]; |
|---|
| 76 |
|
|---|
| 77 |
char history[250]; |
|---|
| 78 |
}; |
|---|
| 79 |
|
|---|
| 80 |
|
|---|
| 81 |
|
|---|
| 82 |
|
|---|
| 83 |
|
|---|
| 84 |
|
|---|
| 85 |
static void save_roller_data(birther *player) |
|---|
| 86 |
{ |
|---|
| 87 |
int i; |
|---|
| 88 |
|
|---|
| 89 |
|
|---|
| 90 |
player->sex = p_ptr->psex; |
|---|
| 91 |
player->race = p_ptr->prace; |
|---|
| 92 |
player->class = p_ptr->pclass; |
|---|
| 93 |
player->age = p_ptr->age; |
|---|
| 94 |
player->wt = p_ptr->wt_birth; |
|---|
| 95 |
player->ht = p_ptr->ht_birth; |
|---|
| 96 |
player->sc = p_ptr->sc; |
|---|
| 97 |
player->au = p_ptr->au_birth; |
|---|
| 98 |
|
|---|
| 99 |
|
|---|
| 100 |
for (i = 0; i < A_MAX; i++) |
|---|
| 101 |
{ |
|---|
| 102 |
player->stat[i] = p_ptr->stat_birth[i]; |
|---|
| 103 |
} |
|---|
| 104 |
|
|---|
| 105 |
|
|---|
| 106 |
my_strcpy(player->history, p_ptr->history, sizeof(player->history)); |
|---|
| 107 |
} |
|---|
| 108 |
|
|---|
| 109 |
|
|---|
| 110 |
|
|---|
| 111 |
|
|---|
| 112 |
|
|---|
| 113 |
|
|---|
| 114 |
|
|---|
| 115 |
|
|---|
| 116 |
|
|---|
| 117 |
|
|---|
| 118 |
static void load_roller_data(birther *player, birther *prev_player) |
|---|
| 119 |
{ |
|---|
| 120 |
int i; |
|---|
| 121 |
|
|---|
| 122 |
|
|---|
| 123 |
|
|---|
| 124 |
|
|---|
| 125 |
birther temp; |
|---|
| 126 |
WIPE(&temp, birther); |
|---|
| 127 |
|
|---|
| 128 |
|
|---|
| 129 |
if (prev_player) |
|---|
| 130 |
save_roller_data(&temp); |
|---|
| 131 |
|
|---|
| 132 |
|
|---|
| 133 |
|
|---|
| 134 |
|
|---|
| 135 |
p_ptr->psex = player->sex; |
|---|
| 136 |
p_ptr->prace = player->race; |
|---|
| 137 |
p_ptr->pclass = player->class; |
|---|
| 138 |
p_ptr->age = player->age; |
|---|
| 139 |
p_ptr->wt = p_ptr->wt_birth = player->wt; |
|---|
| 140 |
p_ptr->ht = p_ptr->ht_birth = player->ht; |
|---|
| 141 |
p_ptr->sc = player->sc; |
|---|
| 142 |
p_ptr->au = p_ptr->au_birth = player->au; |
|---|
| 143 |
|
|---|
| 144 |
|
|---|
| 145 |
for (i = 0; i < A_MAX; i++) |
|---|
| 146 |
{ |
|---|
| 147 |
p_ptr->stat_max[i] = p_ptr->stat_cur[i] = p_ptr->stat_birth[i] = player->stat[i]; |
|---|
| 148 |
} |
|---|
| 149 |
|
|---|
| 150 |
|
|---|
| 151 |
my_strcpy(p_ptr->history, player->history, sizeof(p_ptr->history)); |
|---|
| 152 |
|
|---|
| 153 |
|
|---|
| 154 |
|
|---|
| 155 |
if (prev_player) |
|---|
| 156 |
*prev_player = temp; |
|---|
| 157 |
} |
|---|
| 158 |
|
|---|
| 159 |
|
|---|
| 160 |
|
|---|
| 161 |
|
|---|
| 162 |
|
|---|
| 163 |
|
|---|
| 164 |
|
|---|
| 165 |
|
|---|
| 166 |
|
|---|
| 167 |
|
|---|
| 168 |
|
|---|
| 169 |
|
|---|
| 170 |
|
|---|
| 171 |
|
|---|
| 172 |
static int adjust_stat(int value, int amount, int auto_roll) |
|---|
| 173 |
{ |
|---|
| 174 |
|
|---|
| 175 |
if ((amount < 0) || adult_maximize) |
|---|
| 176 |
{ |
|---|
| 177 |
return (modify_stat_value(value, amount)); |
|---|
| 178 |
} |
|---|
| 179 |
|
|---|
| 180 |
|
|---|
| 181 |
else |
|---|
| 182 |
{ |
|---|
| 183 |
int i; |
|---|
| 184 |
|
|---|
| 185 |
|
|---|
| 186 |
for (i = 0; i < amount; i++) |
|---|
| 187 |
{ |
|---|
| 188 |
if (value < 18) |
|---|
| 189 |
{ |
|---|
| 190 |
value++; |
|---|
| 191 |
} |
|---|
| 192 |
else if (value < 18+70) |
|---|
| 193 |
{ |
|---|
| 194 |
value += ((auto_roll ? 15 : randint1(15)) + 5); |
|---|
| 195 |
} |
|---|
| 196 |
else if (value < 18+90) |
|---|
| 197 |
{ |
|---|
| 198 |
value += ((auto_roll ? 6 : randint1(6)) + 2); |
|---|
| 199 |
} |
|---|
| 200 |
else if (value < 18+100) |
|---|
| 201 |
{ |
|---|
| 202 |
value++; |
|---|
| 203 |
} |
|---|
| 204 |
} |
|---|
| 205 |
} |
|---|
| 206 |
|
|---|
| 207 |
|
|---|
| 208 |
return (value); |
|---|
| 209 |
} |
|---|
| 210 |
|
|---|
| 211 |
|
|---|
| 212 |
|
|---|
| 213 |
|
|---|
| 214 |
|
|---|
| 215 |
|
|---|
| 216 |
|
|---|
| 217 |
|
|---|
| 218 |
|
|---|
| 219 |
static void get_stats(int stat_use[A_MAX]) |
|---|
| 220 |
{ |
|---|
| 221 |
int i, j; |
|---|
| 222 |
|
|---|
| 223 |
int bonus; |
|---|
| 224 |
|
|---|
| 225 |
int dice[18]; |
|---|
| 226 |
|
|---|
| 227 |
|
|---|
| 228 |
|
|---|
| 229 |
while (TRUE) |
|---|
| 230 |
{ |
|---|
| 231 |
|
|---|
| 232 |
for (j = i = 0; i < 18; i++) |
|---|
| 233 |
{ |
|---|
| 234 |
|
|---|
| 235 |
dice[i] = randint1(3 + i % 3); |
|---|
| 236 |
|
|---|
| 237 |
|
|---|
| 238 |
j += dice[i]; |
|---|
| 239 |
} |
|---|
| 240 |
|
|---|
| 241 |
|
|---|
| 242 |
if ((j > 42) && (j < 54)) break; |
|---|
| 243 |
} |
|---|
| 244 |
|
|---|
| 245 |
|
|---|
| 246 |
for (i = 0; i < A_MAX; i++) |
|---|
| 247 |
{ |
|---|
| 248 |
|
|---|
| 249 |
j = 5 + dice[3*i] + dice[3*i+1] + dice[3*i+2]; |
|---|
| 250 |
|
|---|
| 251 |
|
|---|
| 252 |
p_ptr->stat_max[i] = j; |
|---|
| 253 |
|
|---|
| 254 |
|
|---|
| 255 |
bonus = rp_ptr->r_adj[i] + cp_ptr->c_adj[i]; |
|---|
| 256 |
|
|---|
| 257 |
|
|---|
| 258 |
if (adult_maximize) |
|---|
| 259 |
{ |
|---|
| 260 |
|
|---|
| 261 |
p_ptr->stat_cur[i] = p_ptr->stat_max[i]; |
|---|
| 262 |
|
|---|
| 263 |
|
|---|
| 264 |
stat_use[i] = modify_stat_value(p_ptr->stat_max[i], bonus); |
|---|
| 265 |
} |
|---|
| 266 |
|
|---|
| 267 |
|
|---|
| 268 |
else |
|---|
| 269 |
{ |
|---|
| 270 |
|
|---|
| 271 |
stat_use[i] = adjust_stat(p_ptr->stat_max[i], bonus, FALSE); |
|---|
| 272 |
|
|---|
| 273 |
|
|---|
| 274 |
p_ptr->stat_cur[i] = p_ptr->stat_max[i] = stat_use[i]; |
|---|
| 275 |
} |
|---|
| 276 |
|
|---|
| 277 |
p_ptr->stat_birth[i] = p_ptr->stat_max[i]; |
|---|
| 278 |
} |
|---|
| 279 |
} |
|---|
| 280 |
|
|---|
| 281 |
|
|---|
| 282 |
|
|---|
| 283 |
|
|---|
| 284 |
|
|---|
| 285 |
static void get_extra(void) |
|---|
| 286 |
{ |
|---|
| 287 |
int i, j, min_value, max_value; |
|---|
| 288 |
|
|---|
| 289 |
|
|---|
| 290 |
p_ptr->max_lev = p_ptr->lev = 1; |
|---|
| 291 |
|
|---|
| 292 |
|
|---|
| 293 |
p_ptr->expfact = rp_ptr->r_exp + cp_ptr->c_exp; |
|---|
| 294 |
|
|---|
| 295 |
|
|---|
| 296 |
p_ptr->hitdie = rp_ptr->r_mhp + cp_ptr->c_mhp; |
|---|
| 297 |
|
|---|
| 298 |
|
|---|
| 299 |
p_ptr->mhp = p_ptr->hitdie; |
|---|
| 300 |
|
|---|
| 301 |
|
|---|
| 302 |
min_value = (PY_MAX_LEVEL * (p_ptr->hitdie - 1) * 3) / 8; |
|---|
| 303 |
min_value += PY_MAX_LEVEL; |
|---|
| 304 |
|
|---|
| 305 |
|
|---|
| 306 |
max_value = (PY_MAX_LEVEL * (p_ptr->hitdie - 1) * 5) / 8; |
|---|
| 307 |
max_value += PY_MAX_LEVEL; |
|---|
| 308 |
|
|---|
| 309 |
|
|---|
| 310 |
p_ptr->player_hp[0] = p_ptr->hitdie; |
|---|
| 311 |
|
|---|
| 312 |
|
|---|
| 313 |
while (TRUE) |
|---|
| 314 |
{ |
|---|
| 315 |
|
|---|
| 316 |
for (i = 1; i < PY_MAX_LEVEL; i++) |
|---|
| 317 |
{ |
|---|
| 318 |
j = randint1(p_ptr->hitdie); |
|---|
| 319 |
p_ptr->player_hp[i] = p_ptr->player_hp[i-1] + j; |
|---|
| 320 |
} |
|---|
| 321 |
|
|---|
| 322 |
|
|---|
| 323 |
|
|---|
| 324 |
|
|---|
| 325 |
if (p_ptr->player_hp[PY_MAX_LEVEL-1] < min_value) continue; |
|---|
| 326 |
if (p_ptr->player_hp[PY_MAX_LEVEL-1] > max_value) continue; |
|---|
| 327 |
|
|---|
| 328 |
|
|---|
| 329 |
break; |
|---|
| 330 |
} |
|---|
| 331 |
} |
|---|
| 332 |
|
|---|
| 333 |
|
|---|
| 334 |
static void get_bonuses() |
|---|
| 335 |
{ |
|---|
| 336 |
|
|---|
| 337 |
p_ptr->update |= (PU_BONUS | PU_HP); |
|---|
| 338 |
|
|---|
| 339 |
|
|---|
| 340 |
update_stuff(); |
|---|
| 341 |
|
|---|
| 342 |
|
|---|
| 343 |
p_ptr->chp = p_ptr->mhp; |
|---|
| 344 |
|
|---|
| 345 |
|
|---|
| 346 |
p_ptr->csp = p_ptr->msp; |
|---|
| 347 |
} |
|---|
| 348 |
|
|---|
| 349 |
|
|---|
| 350 |
|
|---|
| 351 |
|
|---|
| 352 |
|
|---|
| 353 |
static void get_history(void) |
|---|
| 354 |
{ |
|---|
| 355 |
int i, chart, roll, social_class; |
|---|
| 356 |
|
|---|
| 357 |
|
|---|
| 358 |
|
|---|
| 359 |
p_ptr->history[0] = '\0'; |
|---|
| 360 |
|
|---|
| 361 |
|
|---|
| 362 |
|
|---|
| 363 |
social_class = randint1(4); |
|---|
| 364 |
|
|---|
| 365 |
|
|---|
| 366 |
chart = rp_ptr->hist; |
|---|
| 367 |
|
|---|
| 368 |
|
|---|
| 369 |
|
|---|
| 370 |
while (chart) |
|---|
| 371 |
{ |
|---|
| 372 |
|
|---|
| 373 |
i = 0; |
|---|
| 374 |
|
|---|
| 375 |
|
|---|
| 376 |
roll = randint1(100); |
|---|
| 377 |
|
|---|
| 378 |
|
|---|
| 379 |
while ((chart != h_info[i].chart) || (roll > h_info[i].roll)) i++; |
|---|
| 380 |
|
|---|
| 381 |
|
|---|
| 382 |
my_strcat(p_ptr->history, (h_text + h_info[i].text), sizeof(p_ptr->history)); |
|---|
| 383 |
|
|---|
| 384 |
|
|---|
| 385 |
social_class += (int)(h_info[i].bonus) - 50; |
|---|
| 386 |
|
|---|
| 387 |
|
|---|
| 388 |
chart = h_info[i].next; |
|---|
| 389 |
} |
|---|
| 390 |
|
|---|
| 391 |
|
|---|
| 392 |
|
|---|
| 393 |
|
|---|
| 394 |
if (social_class > 75) social_class = 75; |
|---|
| 395 |
else if (social_class < 1) social_class = 1; |
|---|
| 396 |
|
|---|
| 397 |
|
|---|
| 398 |
p_ptr->sc = social_class; |
|---|
| 399 |
} |
|---|
| 400 |
|
|---|
| 401 |
|
|---|
| 402 |
|
|---|
| 403 |
|
|---|
| 404 |
|
|---|
| 405 |
static void get_ahw(void) |
|---|
| 406 |
{ |
|---|
| 407 |
|
|---|
| 408 |
p_ptr->age = rp_ptr->b_age + randint1(rp_ptr->m_age); |
|---|
| 409 |
|
|---|
| 410 |
|
|---|
| 411 |
if (p_ptr->psex == SEX_MALE) |
|---|
| 412 |
{ |
|---|
| 413 |
p_ptr->ht = p_ptr->ht_birth = Rand_normal(rp_ptr->m_b_ht, rp_ptr->m_m_ht); |
|---|
| 414 |
p_ptr->wt = p_ptr->wt_birth = Rand_normal(rp_ptr->m_b_wt, rp_ptr->m_m_wt); |
|---|
| 415 |
} |
|---|
| 416 |
|
|---|
| 417 |
|
|---|
| 418 |
else if (p_ptr->psex == SEX_FEMALE) |
|---|
| 419 |
{ |
|---|
| 420 |
p_ptr->ht = p_ptr->ht_birth = Rand_normal(rp_ptr->f_b_ht, rp_ptr->f_m_ht); |
|---|
| 421 |
p_ptr->wt = p_ptr->wt_birth = Rand_normal(rp_ptr->f_b_wt, rp_ptr->f_m_wt); |
|---|
| 422 |
} |
|---|
| 423 |
} |
|---|
| 424 |
|
|---|
| 425 |
|
|---|
| 426 |
|
|---|
| 427 |
|
|---|
| 428 |
|
|---|
| 429 |
|
|---|
| 430 |
|
|---|
| 431 |
static void get_money(int stat_use[A_MAX]) |
|---|
| 432 |
{ |
|---|
| 433 |
int i; |
|---|
| 434 |
|
|---|
| 435 |
int gold; |
|---|
| 436 |
|
|---|
| 437 |
|
|---|
| 438 |
gold = (p_ptr->sc * 6) + randint1(100) + 300; |
|---|
| 439 |
|
|---|
| 440 |
|
|---|
| 441 |
for (i = 0; i < A_MAX; i++) |
|---|
| 442 |
{ |
|---|
| 443 |
|
|---|
| 444 |
if (stat_use[i] >= 18+50) gold -= 300; |
|---|
| 445 |
else if (stat_use[i] >= 18+20) gold -= 200; |
|---|
| 446 |
else if (stat_use[i] > 18) gold -= 150; |
|---|
| 447 |
else gold -= (stat_use[i] - 8) * 10; |
|---|
| 448 |
} |
|---|
| 449 |
|
|---|
| 450 |
|
|---|
| 451 |
if (OPT(birth_money)) gold = MAX(500, gold); |
|---|
| 452 |
else gold = MAX(200, gold); |
|---|
| 453 |
|
|---|
| 454 |
|
|---|
| 455 |
p_ptr->au = p_ptr->au_birth = gold; |
|---|
| 456 |
} |
|---|
| 457 |
|
|---|
| 458 |
|
|---|
| 459 |
|
|---|
| 460 |
|
|---|
| 461 |
|
|---|
| 462 |
|
|---|
| 463 |
static void player_wipe(void) |
|---|
| 464 |
{ |
|---|
| 465 |
int i; |
|---|
| 466 |
|
|---|
| 467 |
|
|---|
| 468 |
(void)WIPE(p_ptr, player_type); |
|---|
| 469 |
|
|---|
| 470 |
|
|---|
| 471 |
for (i = 0; i < INVEN_TOTAL; i++) |
|---|
| 472 |
{ |
|---|
| 473 |
object_wipe(&inventory[i]); |
|---|
| 474 |
} |
|---|
| 475 |
|
|---|
| 476 |
|
|---|
| 477 |
|
|---|
| 478 |
for (i = 0; i < z_info->a_max; i++) |
|---|
| 479 |
{ |
|---|
| 480 |
artifact_type *a_ptr = &a_info[i]; |
|---|
| 481 |
a_ptr->cur_num = 0; |
|---|
| 482 |
} |
|---|
| 483 |
|
|---|
| 484 |
|
|---|
| 485 |
|
|---|
| 486 |
for (i = 0; i < MAX_Q_IDX; i++) |
|---|
| 487 |
{ |
|---|
| 488 |
q_list[i].level = 0; |
|---|
| 489 |
} |
|---|
| 490 |
|
|---|
| 491 |
|
|---|
| 492 |
q_list[0].level = 99; |
|---|
| 493 |
|
|---|
| 494 |
|
|---|
| 495 |
q_list[1].level = 100; |
|---|
| 496 |
|
|---|
| 497 |
|
|---|
| 498 |
|
|---|
| 499 |
for (i = 1; i < z_info->k_max; i++) |
|---|
| 500 |
{ |
|---|
| 501 |
object_kind *k_ptr = &k_info[i]; |
|---|
| 502 |
|
|---|
| 503 |
|
|---|
| 504 |
k_ptr->tried = FALSE; |
|---|
| 505 |
|
|---|
| 506 |
|
|---|
| 507 |
k_ptr->aware = FALSE; |
|---|
| 508 |
} |
|---|
| 509 |
|
|---|
| 510 |
|
|---|
| 511 |
|
|---|
| 512 |
for (i = 1; i < z_info->r_max; i++) |
|---|
| 513 |
{ |
|---|
| 514 |
monster_race *r_ptr = &r_info[i]; |
|---|
| 515 |
monster_lore *l_ptr = &l_list[i]; |
|---|
| 516 |
|
|---|
| 517 |
|
|---|
| 518 |
r_ptr->cur_num = 0; |
|---|
| 519 |
|
|---|
| 520 |
|
|---|
| 521 |
r_ptr->max_num = 100; |
|---|
| 522 |
|
|---|
| 523 |
|
|---|
| 524 |
if (r_ptr->flags[0] & (RF0_UNIQUE)) r_ptr->max_num = 1; |
|---|
| 525 |
|
|---|
| 526 |
|
|---|
| 527 |
l_ptr->pkills = 0; |
|---|
| 528 |
} |
|---|
| 529 |
|
|---|
| 530 |
|
|---|
| 531 |
|
|---|
| 532 |
r_info[z_info->r_max-1].max_num = 0; |
|---|
| 533 |
|
|---|
| 534 |
|
|---|
| 535 |
|
|---|
| 536 |
p_ptr->food = PY_FOOD_FULL - 1; |
|---|
| 537 |
|
|---|
| 538 |
|
|---|
| 539 |
|
|---|
| 540 |
for (i = 0; i < PY_MAX_SPELLS; i++) p_ptr->spell_order[i] = 99; |
|---|
| 541 |
|
|---|
| 542 |
|
|---|
| 543 |
|
|---|
| 544 |
turn = old_turn = 1; |
|---|
| 545 |
} |
|---|
| 546 |
|
|---|
| 547 |
|
|---|
| 548 |
|
|---|
| 549 |
|
|---|
| 550 |
static void wield_all(void) |
|---|
| 551 |
{ |
|---|
| 552 |
object_type *o_ptr; |
|---|
| 553 |
object_type *i_ptr; |
|---|
| 554 |
object_type object_type_body; |
|---|
| 555 |
|
|---|
| 556 |
int slot; |
|---|
| 557 |
int item; |
|---|
| 558 |
|
|---|
| 559 |
|
|---|
| 560 |
for (item = INVEN_PACK - 1; item >= 0; item--) |
|---|
| 561 |
{ |
|---|
| 562 |
o_ptr = &inventory[item]; |
|---|
| 563 |
|
|---|
| 564 |
|
|---|
| 565 |
if (!o_ptr->k_idx) continue; |
|---|
| 566 |
|
|---|
| 567 |
|
|---|
| 568 |
slot = wield_slot(o_ptr); |
|---|
| 569 |
if (slot < INVEN_WIELD) continue; |
|---|
| 570 |
if (inventory[slot].k_idx) continue; |
|---|
| 571 |
|
|---|
| 572 |
|
|---|
| 573 |
i_ptr = &object_type_body; |
|---|
| 574 |
object_copy(i_ptr, o_ptr); |
|---|
| 575 |
|
|---|
| 576 |
|
|---|
| 577 |
i_ptr->number = 1; |
|---|
| 578 |
|
|---|
| 579 |
|
|---|
| 580 |
if (item >= 0) |
|---|
| 581 |
{ |
|---|
| 582 |
inven_item_increase(item, -1); |
|---|
| 583 |
inven_item_optimize(item); |
|---|
| 584 |
} |
|---|
| 585 |
|
|---|
| 586 |
|
|---|
| 587 |
else |
|---|
| 588 |
{ |
|---|
| 589 |
floor_item_increase(0 - item, -1); |
|---|
| 590 |
floor_item_optimize(0 - item); |
|---|
| 591 |
} |
|---|
| 592 |
|
|---|
| 593 |
|
|---|
| 594 |
o_ptr = &inventory[slot]; |
|---|
| 595 |
|
|---|
| 596 |
|
|---|
| 597 |
object_copy(o_ptr, i_ptr); |
|---|
| 598 |
|
|---|
| 599 |
|
|---|
| 600 |
p_ptr->total_weight += i_ptr->weight; |
|---|
| 601 |
|
|---|
| 602 |
|
|---|
| 603 |
p_ptr->equip_cnt++; |
|---|
| 604 |
} |
|---|
| 605 |
|
|---|
| 606 |
return; |
|---|
| 607 |
} |
|---|
| 608 |
|
|---|
| 609 |
|
|---|
| 610 |
|
|---|
| 611 |
|
|---|
| 612 |
|
|---|
| 613 |
|
|---|
| 614 |
|
|---|
| 615 |
static void player_outfit(void) |
|---|
| 616 |
{ |
|---|
| 617 |
int i; |
|---|
| 618 |
const start_item *e_ptr; |
|---|
| 619 |
object_type *i_ptr; |
|---|
| 620 |
object_type object_type_body; |
|---|
| 621 |
|
|---|
| 622 |
|
|---|
| 623 |
|
|---|
| 624 |
for (i = 0; i < MAX_START_ITEMS; i++) |
|---|
| 625 |
{ |
|---|
| 626 |
|
|---|
| 627 |
e_ptr = &(cp_ptr->start_items[i]); |
|---|
| 628 |
|
|---|
| 629 |
|
|---|
| 630 |
i_ptr = &object_type_body; |
|---|
| 631 |
|
|---|
| 632 |
|
|---|
| 633 |
if (e_ptr->tval > 0) |
|---|
| 634 |
{ |
|---|
| 635 |
|
|---|
| 636 |
int k_idx = lookup_kind(e_ptr->tval, e_ptr->sval); |
|---|
| 637 |
|
|---|
| 638 |
|
|---|
| 639 |
if (!k_idx) continue; |
|---|
| 640 |
|
|---|
| 641 |
|
|---|
| 642 |
object_prep(i_ptr, k_idx); |
|---|
| 643 |
i_ptr->number = (byte)rand_range(e_ptr->min, e_ptr->max); |
|---|
| 644 |
i_ptr->origin = ORIGIN_BIRTH; |
|---|
| 645 |
|
|---|
| 646 |
object_aware(i_ptr); |
|---|
| 647 |
object_known(i_ptr); |
|---|
| 648 |
(void)inven_carry(i_ptr); |
|---|
| 649 |
k_info[k_idx].everseen = TRUE; |
|---|
| 650 |
} |
|---|
| 651 |
} |
|---|
| 652 |
|
|---|
| 653 |
|
|---|
| 654 |
|
|---|
| 655 |
|
|---|
| 656 |
|
|---|
| 657 |
i_ptr = &object_type_body; |
|---|
| 658 |
|
|---|
| 659 |
|
|---|
| 660 |
object_prep(i_ptr, lookup_kind(TV_FOOD, SV_FOOD_RATION)); |
|---|
| 661 |
i_ptr->number = (byte)rand_range(3, 7); |
|---|
| 662 |
i_ptr->origin = ORIGIN_BIRTH; |
|---|
| 663 |
object_aware(i_ptr); |
|---|
| 664 |
object_known(i_ptr); |
|---|
| 665 |
k_info[i_ptr->k_idx].everseen = TRUE; |
|---|
| 666 |
(void)inven_carry(i_ptr); |
|---|
| 667 |
|
|---|
| 668 |
|
|---|
| 669 |
|
|---|
| 670 |
i_ptr = &object_type_body; |
|---|
| 671 |
|
|---|
| 672 |
|
|---|
| 673 |
object_prep(i_ptr, lookup_kind(TV_LITE, SV_LITE_TORCH)); |
|---|
| 674 |
i_ptr->number = (byte)rand_range(3, 7); |
|---|
| 675 |
i_ptr->timeout = FUEL_TORCH; |
|---|
| 676 |
i_ptr->origin = ORIGIN_BIRTH; |
|---|
| 677 |
object_aware(i_ptr); |
|---|
| 678 |
object_known(i_ptr); |
|---|
| 679 |
k_info[i_ptr->k_idx].everseen = TRUE; |
|---|
| 680 |
(void)inven_carry(i_ptr); |
|---|
| 681 |
|
|---|
| 682 |
|
|---|
| 683 |
|
|---|
| 684 |
wield_all(); |
|---|
| 685 |
} |
|---|
| 686 |
|
|---|
| 687 |
|
|---|
| 688 |
|
|---|
| 689 |
|
|---|
| 690 |
|
|---|
| 691 |
|
|---|
| 692 |
|
|---|
| 693 |
|
|---|
| 694 |
|
|---|
| 695 |
|
|---|
| 696 |
static game_command get_birth_command() |
|---|
| 697 |
{ |
|---|
| 698 |
game_command cmd = { CMD_NULL, 0, {0} }; |
|---|
| 699 |
|
|---|
| 700 |
while (cmd.command == CMD_NULL) |
|---|
| 701 |
{ |
|---|
| 702 |
cmd = get_game_command(); |
|---|
| 703 |
|
|---|
| 704 |
if (cmd.command == CMD_QUIT) |
|---|
| 705 |
quit(NULL); |
|---|
| 706 |
|
|---|
| 707 |
if (cmd.command == CMD_OPTIONS) |
|---|
| 708 |
{ |
|---|
| 709 |
|
|---|
| 710 |
|
|---|
| 711 |
|
|---|
| 712 |
do_cmd_options(); |
|---|
| 713 |
|
|---|
| 714 |
|
|---|
| 715 |
cmd.command = CMD_NULL; |
|---|
| 716 |
} |
|---|
| 717 |
} |
|---|
| 718 |
|
|---|
| 719 |
|
|---|
| 720 |
|
|---|
| 721 |
return cmd; |
|---|
| 722 |
} |
|---|
| 723 |
|
|---|
| 724 |
|
|---|
| 725 |
|
|---|
| 726 |
|
|---|
| 727 |
static const int birth_stat_costs[18 + 1] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 4 }; |
|---|
| 728 |
|
|---|
| 729 |
|
|---|
| 730 |
#define MAX_BIRTH_POINTS 24 |
|---|
| 731 |
|
|---|
| 732 |
|
|---|
| 733 |
static void recalculate_stats(int *stats, int points_left) |
|---|
| 734 |
{ |
|---|
| 735 |
int i; |
|---|
| 736 |
|
|---|
| 737 |
|
|---|
| 738 |
for (i = 0; i < A_MAX; i++) |
|---|
| 739 |
{ |
|---|
| 740 |
|
|---|
| 741 |
if (adult_maximize) |
|---|
| 742 |
{ |
|---|
| 743 |
|
|---|
| 744 |
p_ptr->stat_cur[i] = p_ptr->stat_max[i] = p_ptr->stat_birth[i] = stats[i]; |
|---|
| 745 |
} |
|---|
| 746 |
|
|---|
| 747 |
|
|---|
| 748 |
else |
|---|
| 749 |
{ |
|---|
| 750 |
|
|---|
| 751 |
int bonus = rp_ptr->r_adj[i] + cp_ptr->c_adj[i]; |
|---|
| 752 |
|
|---|
| 753 |
|
|---|
| 754 |
p_ptr->stat_cur[i] = p_ptr->stat_max[i] = |
|---|
| 755 |
modify_stat_value(stats[i], bonus); |
|---|
| 756 |
} |
|---|
| 757 |
} |
|---|
| 758 |
|
|---|
| 759 |
|
|---|
| 760 |
p_ptr->au = OPT(birth_money) ? 500 : 200; |
|---|
| 761 |
p_ptr->au += (50 * points_left); |
|---|
| 762 |
p_ptr->au_birth = p_ptr->au; |
|---|
| 763 |
|
|---|
| 764 |
|
|---|
| 765 |
get_bonuses(); |
|---|
| 766 |
|
|---|
| 767 |
|
|---|
| 768 |
event_signal(EVENT_GOLD); |
|---|
| 769 |
event_signal(EVENT_AC); |
|---|
| 770 |
event_signal(EVENT_HP); |
|---|
| 771 |
event_signal(EVENT_STATS); |
|---|
| 772 |
} |
|---|
| 773 |
|
|---|
| 774 |
|
|---|
| 775 |
|
|---|
| 776 |
|
|---|
| 777 |
|
|---|
| 778 |
|
|---|
| 779 |
|
|---|
| 780 |
|
|---|
| 781 |
static enum birth_stage do_point_based(bool reset) |
|---|
| 782 |
{ |
|---|
| 783 |
game_command cmd = { CMD_NULL, 0, {0} }; |
|---|
| 784 |
|
|---|
| 785 |
int i, j; |
|---|
| 786 |
int stats[A_MAX]; |
|---|
| 787 |
|
|---|
| 788 |
int points_spent[A_MAX]; |
|---|
| 789 |
int points_left; |
|---|
| 790 |
|
|---|
| 791 |
|
|---|
| 792 |
|
|---|
| 793 |
enum birth_stage next_stage = BIRTH_ROLLER_CHOICE; |
|---|
| 794 |
|
|---|
| 795 |
if (reset) |
|---|
| 796 |
{ |
|---|
| 797 |
|
|---|
| 798 |
get_extra(); |
|---|
| 799 |
get_ahw(); |
|---|
| 800 |
get_history(); |
|---|
| 801 |
} |
|---|
| 802 |
|
|---|
| 803 |
|
|---|
| 804 |
event_signal_birthstage(BIRTH_POINTBASED, NULL); |
|---|
| 805 |
|
|---|
| 806 |
|
|---|
| 807 |
points_left = MAX_BIRTH_POINTS; |
|---|
| 808 |
|
|---|
| 809 |
for (i = 0; i < A_MAX; i++) |
|---|
| 810 |
{ |
|---|
| 811 |
|
|---|
| 812 |
stats[i] = 10; |
|---|
| 813 |
points_spent[i] = 0; |
|---|
| 814 |
|
|---|
| 815 |
|
|---|
| 816 |
|
|---|
| 817 |
|
|---|
| 818 |
if (!reset) |
|---|
| 819 |
{ |
|---|
| 820 |
for (j = 10; j < p_ptr->stat_birth[i]; j++) |
|---|
| 821 |
{ |
|---|
| 822 |
int stat_cost = birth_stat_costs[j + 1]; |
|---|
| 823 |
stats[i]++; |
|---|
| 824 |
points_spent[i] += stat_cost; |
|---|
| 825 |
points_left -= stat_cost; |
|---|
| 826 |
} |
|---|
| 827 |
} |
|---|
| 828 |
} |
|---|
| 829 |
|
|---|
| 830 |
|
|---|
| 831 |
|
|---|
| 832 |
|
|---|
| 833 |
recalculate_stats(stats, points_left); |
|---|
| 834 |
event_signal_birthstats(points_spent, points_left); |
|---|
| 835 |
|
|---|
| 836 |
|
|---|
| 837 |
while (cmd.command != CMD_ACCEPT_STATS && |
|---|
| 838 |
cmd.command != CMD_BIRTH_BACK) |
|---|
| 839 |
{ |
|---|
| 840 |
cmd = get_birth_command(); |
|---|
| 841 |
|
|---|
| 842 |
|
|---|
| 843 |
|
|---|
| 844 |
|
|---|
| 845 |
if (cmd.command != CMD_BIRTH_BACK || !reset) |
|---|
| 846 |
next_stage = BIRTH_POINTBASED; |
|---|
| 847 |
|
|---|
| 848 |
switch (cmd.command) |
|---|
| 849 |
{ |
|---|
| 850 |
case CMD_BUY_STAT: |
|---|
| 851 |
{ |
|---|
| 852 |
|
|---|
| 853 |
int choice = cmd.params.choice; |
|---|
| 854 |
if (choice >= A_MAX || choice < 0) continue; |
|---|
| 855 |
|
|---|
| 856 |
|
|---|
| 857 |
if (stats[choice] < 18) |
|---|
| 858 |
{ |
|---|
| 859 |
|
|---|
| 860 |
|
|---|
| 861 |
int stat_cost = birth_stat_costs[stats[choice] + 1]; |
|---|
| 862 |
|
|---|
| 863 |
if (stat_cost <= points_left) |
|---|
| 864 |
{ |
|---|
| 865 |
stats[choice]++; |
|---|
| 866 |
points_spent[choice] += stat_cost; |
|---|
| 867 |
points_left -= stat_cost; |
|---|
| 868 |
|
|---|
| 869 |
|
|---|
| 870 |
event_signal_birthstats(points_spent, points_left); |
|---|
| 871 |
|
|---|
| 872 |
|
|---|
| 873 |
|
|---|
| 874 |
recalculate_stats(stats, points_left); |
|---|
| 875 |
} |
|---|
| 876 |
} |
|---|
| 877 |
|
|---|
| 878 |
break; |
|---|
| 879 |
} |
|---|
| 880 |
|
|---|
| 881 |
case CMD_SELL_STAT: |
|---|
| 882 |
{ |
|---|
| 883 |
|
|---|
| 884 |
int choice = cmd.params.choice; |
|---|
| 885 |
if (choice >= A_MAX || choice < 0) continue; |
|---|
| 886 |
|
|---|
| 887 |
|
|---|
| 888 |
if (stats[choice] > 10) |
|---|
| 889 |
{ |
|---|
| 890 |
int stat_cost = birth_stat_costs[stats[choice]]; |
|---|
| 891 |
|
|---|
| 892 |
stats[choice]--; |
|---|
| 893 |
points_spent[choice] -= stat_cost; |
|---|
| 894 |
points_left += stat_cost; |
|---|
| 895 |
|
|---|
| 896 |
|
|---|
| 897 |
event_signal_birthstats(points_spent, points_left); |
|---|
| 898 |
|
|---|
| 899 |
|
|---|
| 900 |
|
|---|
| 901 |
recalculate_stats(stats, points_left); |
|---|
| 902 |
} |
|---|
| 903 |
break; |
|---|
| 904 |
} |
|---|
| 905 |
|
|---|
| 906 |
case CMD_ACCEPT_STATS: |
|---|
| 907 |
{ |
|---|
| 908 |
next_stage = BIRTH_NAME_CHOICE; |
|---|
| 909 |
break; |
|---|
| 910 |
} |
|---|
| 911 |
default: |
|---|
| 912 |
{ |
|---|
| 913 |
|
|---|
| 914 |
} |
|---|
| 915 |
} |
|---|
| 916 |
} |
|---|
| 917 |
|
|---|
| 918 |
return next_stage; |
|---|
| 919 |
} |
|---|
| 920 |
|
|---|
| 921 |
|
|---|