Changeset 889
- Timestamp:
- 05/11/08 21:11:07 (2 months ago)
- Files:
-
- trunk/lib/edit/object.txt (modified) (1 diff)
- trunk/src/cmd1.c (modified) (2 diffs)
- trunk/src/cmd2.c (modified) (1 diff)
- trunk/src/load.c (modified) (1 diff)
- trunk/src/obj-make.c (modified) (1 diff)
- trunk/src/obj-util.c (modified) (1 diff)
- trunk/src/object.h (modified) (1 diff)
- trunk/src/tvalsval.h (modified) (1 diff)
- trunk/src/wizard.c (modified) (1 diff)
- trunk/src/xtra2.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lib/edit/object.txt
r813 r889 3584 3584 N:480:copper 3585 3585 G:$:u 3586 I:100:0:0 3587 3588 N:481:silver 3589 G:$:s 3586 3590 I:100:1:0 3587 W:1:0:0:3 3588 3589 N:481:copper 3590 G:$:u 3591 3592 N:482:garnets 3593 G:$:r 3591 3594 I:100:2:0 3592 W:1:0:0:4 3593 3594 N:482:copper 3595 G:$:u 3595 3596 N:483:gold 3597 G:$:y 3596 3598 I:100:3:0 3597 W:1:0:0:5 3598 3599 N:483:silver 3600 G:$:s 3599 3600 N:484:opals 3601 G:$:W 3601 3602 I:100:4:0 3602 W:1:0:0:6 3603 3604 N:484:silver 3605 G:$:s 3603 3604 N:485:sapphires 3605 G:$:b 3606 3606 I:100:5:0 3607 W:1:0:0:7 3608 3609 N:485:silver 3610 G:$:s 3607 3608 N:486:rubies 3609 G:$:r 3611 3610 I:100:6:0 3612 W:1:0:0:8 3613 3614 N:486:garnets 3615 G:$:r 3611 3612 N:487:diamonds 3613 G:$:w 3616 3614 I:100:7:0 3617 W:1:0:0:9 3618 3619 N:487:garnets 3620 G:$:r 3615 3616 N:488:emeralds 3617 G:$:g 3621 3618 I:100:8:0 3622 W:1:0:0:10 3623 3624 N:488:gold 3625 G:$:y 3619 3620 N:489:mithril 3621 G:$:B 3626 3622 I:100:9:0 3627 W:1:0:0:12 3628 3629 N:489:gold 3630 G:$:y 3623 3624 N:490:adamantite 3625 G:$:G 3631 3626 I:100:10:0 3632 W:1:0:0:143633 3634 N:490:gold3635 G:$:y3636 I:100:11:03637 W:1:0:0:163638 3639 N:491:opals3640 G:$:W3641 I:100:12:03642 W:1:0:0:183643 3644 N:492:sapphires3645 G:$:b3646 I:100:13:03647 W:1:0:0:203648 3649 N:493:rubies3650 G:$:r3651 I:100:14:03652 W:1:0:0:243653 3654 N:494:diamonds3655 G:$:w3656 I:100:15:03657 W:1:0:0:283658 3659 N:495:emeralds3660 G:$:g3661 I:100:16:03662 W:1:0:0:323663 3664 N:496:mithril3665 G:$:B3666 I:100:17:03667 W:1:0:0:383668 3669 N:497:adamantite3670 G:$:G3671 I:100:18:03672 W:1:0:0:463673 3627 3674 3628 trunk/src/cmd1.c
r887 r889 135 135 for (this_o_idx = cave_o_idx[py][px]; this_o_idx; this_o_idx = next_o_idx) 136 136 { 137 int gold_type;138 139 137 /* Get the object */ 140 138 o_ptr = &o_list[this_o_idx]; … … 147 145 (o_ptr->sval >= SV_GOLD_MAX)) continue; 148 146 149 /* Hack -- adjust treasure type (to avoid picking up "gold, gold, and gold") */150 gold_type = o_ptr->sval;151 if ((gold_type == SV_COPPER2) || (gold_type == SV_COPPER3))152 gold_type = SV_COPPER1;153 if ((gold_type == SV_SILVER2) || (gold_type == SV_SILVER3))154 gold_type = SV_SILVER1;155 if ((gold_type == SV_GOLD2) || (gold_type == SV_GOLD3))156 gold_type = SV_GOLD1;157 if (gold_type == SV_GARNETS2)158 gold_type = SV_GARNETS1;159 160 147 /* Note that we have this kind of treasure */ 161 treasure[ gold_type]++;148 treasure[o_ptr->sval]++; 162 149 163 150 /* Increment total value */ trunk/src/cmd2.c
r887 r889 230 230 /* Small chests often drop gold */ 231 231 if (tiny && (rand_int(100) < 75)) 232 { 233 /* Make some gold */ 234 if (!make_gold(i_ptr, value)) continue; 235 } 232 make_gold(i_ptr, value); 236 233 237 234 /* Otherwise drop an item */ 238 235 else 239 236 { 240 /* Make an object */241 if (!make_object(i_ptr, value, FALSE, FALSE))continue;237 if (!make_object(i_ptr, value, FALSE, FALSE)) 238 continue; 242 239 } 243 240 trunk/src/load.c
r887 r889 196 196 switch (*tval) 197 197 { 198 case TV_GOLD: 199 { 200 if (*sval > SV_GOLD_MAX) 201 *sval = SV_GOLD_MAX; 202 return; 203 } 204 198 205 case TV_FOOD: 199 206 { trunk/src/obj-make.c
r887 r889 1431 1431 1432 1432 1433 /* 1434 * XXX XXX XXX Do not use these hard-coded values. 1435 */ 1436 #define MAX_GOLD 18 /* Number of "gold" entries */ 1437 1438 /* 1439 * Make a treasure object 1440 * 1441 * The location must be a legal, clean, floor grid. 1442 */ 1443 bool make_gold(object_type *j_ptr, int lev) 1433 /* The largest possible average gold drop at max depth with biggest spread */ 1434 #define MAX_GOLD_DROP (3*MAX_DEPTH + 30) 1435 1436 1437 /* 1438 * Make a money object 1439 */ 1440 void make_gold(object_type *j_ptr, int lev) 1444 1441 { 1445 1442 int sval; 1446 1443 int k_idx; 1447 s32b base; 1448 1449 1450 /* Hack -- Pick a Treasure variety */ 1451 sval = ((randint(lev + 2) + 2) / 2); 1452 1453 /* Apply "extra" magic */ 1454 if (one_in_(GREAT_OBJ)) 1455 { 1456 sval += randint(lev + 1); 1457 } 1458 1459 /* Hack -- Creeping Coins only generate "themselves" */ 1460 if (coin_type) sval = coin_type; 1461 1462 /* Do not create "illegal" Treasure Types */ 1463 if (sval > MAX_GOLD) sval = MAX_GOLD; 1464 1444 1445 /* This average is 20 at dlev0, 105 at dlev40, 220 at dlev100. */ 1446 /* Follows the formula: y=2x+20 */ 1447 s32b avg = 2*lev + 20; 1448 s32b spread = lev + 10; 1449 s32b value = rand_spread(avg, spread); 1450 1451 /* Pick a treasure variety scaled by level, or force a type */ 1452 if (coin_type) 1453 sval = coin_type; 1454 else 1455 sval = (((value * 100) / MAX_GOLD_DROP) * SV_GOLD_MAX) / 100; 1456 1457 /* Do not create illegal treasure types */ 1458 if (sval > SV_GOLD_MAX) sval = SV_GOLD_MAX; 1459 1460 /* Prepare a gold object */ 1465 1461 k_idx = lookup_kind(TV_GOLD, sval); 1466 1467 /* Prepare a gold object */1468 1462 object_prep(j_ptr, k_idx); 1469 1470 /* Hack -- Base coin cost */ 1471 base = k_info[k_idx].cost; 1472 1473 /* Determine how much the treasure is "worth" */ 1474 j_ptr->pval = (base + (8L * randint(base)) + randint(8)); 1475 1476 /* Success */ 1477 return (TRUE); 1463 j_ptr->pval = value; 1478 1464 } 1479 1465 trunk/src/obj-util.c
r887 r889 2384 2384 2385 2385 /* Make some gold */ 2386 if (make_gold(i_ptr, level)) 2387 { 2388 /* Give it to the floor */ 2389 (void)floor_carry(y, x, i_ptr); 2390 } 2386 make_gold(i_ptr, level); 2387 2388 /* Give it to the floor */ 2389 (void)floor_carry(y, x, i_ptr); 2391 2390 } 2392 2391 trunk/src/object.h
r854 r889 66 66 void apply_magic(object_type *o_ptr, int lev, bool okay, bool good, bool great); 67 67 bool make_object(object_type *j_ptr, int lev, bool good, bool great); 68 boolmake_gold(object_type *j_ptr, int lev);68 void make_gold(object_type *j_ptr, int lev); 69 69 int object_pseudo_heavy(const object_type *o_ptr); 70 70 int object_pseudo_light(const object_type *o_ptr); trunk/src/tvalsval.h
r887 r889 510 510 511 511 /* The "sval" codes for TV_GOLD */ 512 #define SV_COPPER1 1 513 #define SV_COPPER2 2 514 #define SV_COPPER3 3 515 #define SV_SILVER1 4 516 #define SV_SILVER2 5 517 #define SV_SILVER3 6 518 #define SV_GARNETS1 7 519 #define SV_GARNETS2 8 520 #define SV_GOLD1 9 521 #define SV_GOLD2 10 522 #define SV_GOLD3 11 523 #define SV_OPALS 12 524 #define SV_SAPPHIRES 13 525 #define SV_RUBIES 14 526 #define SV_DIAMONDS 15 527 #define SV_EMERALDS 16 528 #define SV_MITHRIL 17 529 #define SV_ADAMANTITE 18 530 531 #define SV_GOLD_MAX 19 532 512 enum 513 { 514 SV_COPPER = 0, 515 SV_SILVER = 1, 516 SV_GARNETS = 2, 517 SV_GOLD = 3, 518 SV_OPALS = 4, 519 SV_SAPPHIRES = 5, 520 SV_RUBIES = 6, 521 SV_DIAMONDS = 7, 522 SV_EMERALDS = 8, 523 SV_MITHRIL = 9, 524 SV_ADAMANTITE = 10, 525 526 SV_GOLD_MAX = 10 527 }; 533 528 534 529 trunk/src/wizard.c
r887 r889 1035 1035 if (k_info[k_idx].tval == TV_GOLD) 1036 1036 { 1037 /* Hack -- Base coin cost */ 1038 s32b base = k_info[k_idx].cost; 1039 1040 /* Determine how much the treasure is "worth" */ 1041 i_ptr->pval = (base + (8L * randint(base)) + randint(8)); 1037 coin_type = k_info[k_idx].sval; 1038 make_gold(i_ptr, p_ptr->depth); 1039 coin_type = 0; 1042 1040 } 1043 1041 trunk/src/xtra2.c
r887 r889 1093 1093 { 1094 1094 /* Look for textual clues */ 1095 if (strstr(name, " copper ")) return ( 3);1096 if (strstr(name, " silver ")) return ( 6);1097 if (strstr(name, " gold ")) return ( 11);1098 if (strstr(name, " mithril ")) return ( 17);1099 if (strstr(name, " adamantite ")) return ( 18);1095 if (strstr(name, " copper ")) return (SV_COPPER); 1096 if (strstr(name, " silver ")) return (SV_SILVER); 1097 if (strstr(name, " gold ")) return (SV_GOLD); 1098 if (strstr(name, " mithril ")) return (SV_MITHRIL); 1099 if (strstr(name, " adamantite ")) return (SV_ADAMANTITE); 1100 1100 1101 1101 /* Look for textual clues */ 1102 if (strstr(name, "Copper ")) return ( 3);1103 if (strstr(name, "Silver ")) return ( 6);1104 if (strstr(name, "Gold ")) return ( 11);1105 if (strstr(name, "Mithril ")) return ( 17);1106 if (strstr(name, "Adamantite ")) return ( 18);1102 if (strstr(name, "Copper ")) return (SV_COPPER); 1103 if (strstr(name, "Silver ")) return (SV_SILVER); 1104 if (strstr(name, "Gold ")) return (SV_GOLD); 1105 if (strstr(name, "Mithril ")) return (SV_MITHRIL); 1106 if (strstr(name, "Adamantite ")) return (SV_ADAMANTITE); 1107 1107 } 1108 1108 … … 1301 1301 { 1302 1302 /* Make some gold */ 1303 if (!make_gold(i_ptr, level)) continue; 1304 1305 /* Assume seen XXX XXX XXX */ 1303 make_gold(i_ptr, level); 1306 1304 dump_gold++; 1307 1305 } … … 1312 1310 /* Make an object */ 1313 1311 if (!make_object(i_ptr, level, good, great)) continue; 1314 1315 /* Assume seen XXX XXX XXX */1316 1312 dump_item++; 1317 1313 }
