diff options
-rw-r--r-- | crawl-ref/source/effects.cc | 60 | ||||
-rw-r--r-- | crawl-ref/source/enum.h | 3 | ||||
-rw-r--r-- | crawl-ref/source/itemprop.cc | 99 |
3 files changed, 74 insertions, 88 deletions
diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc index 7c2a4cb9f4..53884f1e41 100644 --- a/crawl-ref/source/effects.cc +++ b/crawl-ref/source/effects.cc @@ -606,43 +606,25 @@ bool acquirement(unsigned char force_class, int agent) skill = i; } - if (skill == SK_STAVES) - type_wanted = WPN_QUARTERSTAFF; // only one in this class - else + count = 0; + + item_def item_considered; + item_considered.base_type = OBJ_WEAPONS; + for (int i = 0; i < NUM_WEAPONS; ++i) { - count = 0; + item_considered.sub_type = i; - // skipping clubs, knives, blowguns - for (int i = WPN_MACE; i < NUM_WEAPONS; i++) - { - // FIXME: Add a flag to itemprop.cc to do these exclusions - // skipping giant clubs - if (i == WPN_GIANT_CLUB || i == WPN_GIANT_SPIKED_CLUB) - continue; - - // skipping knife and blowgun - if (i == WPN_KNIFE || i == WPN_BLOWGUN) - continue; - - // blessed blades can only be created by the player, never found - if (i == WPN_BLESSED_BLADE) - continue; - - // "rare" weapons are only considered some of the time... - // still, the chance is higher than actual random creation - int wskill = range_skill(OBJ_WEAPONS, i); - if (wskill == SK_RANGED_COMBAT) - wskill = weapon_skill(OBJ_WEAPONS, i); - if (wskill == skill - && (i < WPN_EVENINGSTAR || i > WPN_BROAD_AXE - || (i >= WPN_HAMMER && i <= WPN_SABRE) - || one_chance_in(4))) - { - count++; - if (one_chance_in( count )) - type_wanted = i; - } - } + const int acqweight = property(item_considered, PWPN_ACQ_WEIGHT); + + if (!acqweight) + continue; + + int wskill = range_skill(OBJ_WEAPONS, i); + if (wskill == SK_RANGED_COMBAT) + wskill = weapon_skill(OBJ_WEAPONS, i); + + if (wskill == skill && random2(count += acqweight) < acqweight) + type_wanted = i; } } else if (class_wanted == OBJ_MISSILES) @@ -1184,10 +1166,10 @@ bool acquirement(unsigned char force_class, int agent) // easier to read this way item_def& thing(mitm[thing_created]); - // give some more gold - if ( class_wanted == OBJ_GOLD ) - thing.quantity += 150; - + // give some more gold + if ( class_wanted == OBJ_GOLD ) + thing.quantity += 150; + // remove curse flag from item do_uncurse_item( thing ); diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h index ef51a97c1a..16d0e95be6 100644 --- a/crawl-ref/source/enum.h +++ b/crawl-ref/source/enum.h @@ -3934,7 +3934,8 @@ enum weapon_property_type { PWPN_DAMAGE, // 0 PWPN_HIT, - PWPN_SPEED + PWPN_SPEED, + PWPN_ACQ_WEIGHT }; #ifdef WIZARD diff --git a/crawl-ref/source/itemprop.cc b/crawl-ref/source/itemprop.cc index 34ce306f2a..1df988ee0e 100644 --- a/crawl-ref/source/itemprop.cc +++ b/crawl-ref/source/itemprop.cc @@ -162,6 +162,7 @@ struct weapon_def bool throwable; int dam_type; + int acquire_weight; }; static int Weapon_index[NUM_WEAPONS]; @@ -170,139 +171,139 @@ static weapon_def Weapon_prop[NUM_WEAPONS] = // Maces & Flails { WPN_WHIP, "whip", 4, 2, 13, 30, 2, SK_MACES_FLAILS, HANDS_ONE, SIZE_MEDIUM, MI_NONE, false, - DAMV_SLASHING }, + DAMV_SLASHING, 0 }, { WPN_CLUB, "club", 5, 3, 13, 50, 7, SK_MACES_FLAILS, HANDS_ONE, SIZE_SMALL, MI_NONE, true, - DAMV_CRUSHING }, + DAMV_CRUSHING, 0 }, { WPN_HAMMER, "hammer", 7, 3, 13, 90, 7, SK_MACES_FLAILS, HANDS_ONE, SIZE_SMALL, MI_NONE, false, - DAMV_CRUSHING }, + DAMV_CRUSHING, 0 }, { WPN_MACE, "mace", 8, 3, 14, 120, 8, SK_MACES_FLAILS, HANDS_ONE, SIZE_SMALL, MI_NONE, false, - DAMV_CRUSHING }, + DAMV_CRUSHING, 10 }, { WPN_FLAIL, "flail", 9, 2, 15, 130, 8, SK_MACES_FLAILS, HANDS_ONE, SIZE_SMALL, MI_NONE, false, - DAMV_CRUSHING }, + DAMV_CRUSHING, 10 }, { WPN_ANCUS, "ancus", 9, 2, 14, 120, 8, SK_MACES_FLAILS, HANDS_ONE, SIZE_MEDIUM, MI_NONE, false, - DAMV_CRUSHING }, + DAMV_CRUSHING, 10 }, { WPN_MORNINGSTAR, "morningstar", 10, -1, 15, 140, 8, SK_MACES_FLAILS, HANDS_ONE, SIZE_MEDIUM, MI_NONE, false, - DAMV_PIERCING | DAM_BLUDGEON }, + DAMV_PIERCING | DAM_BLUDGEON, 10 }, { WPN_DEMON_WHIP, "demon whip", 10, 1, 13, 30, 2, SK_MACES_FLAILS, HANDS_ONE, SIZE_MEDIUM, MI_NONE, false, - DAMV_SLASHING }, + DAMV_SLASHING, 2 }, { WPN_SPIKED_FLAIL, "spiked flail", 12, -2, 16, 190, 8, SK_MACES_FLAILS, HANDS_ONE, SIZE_MEDIUM, MI_NONE, false, - DAMV_PIERCING | DAM_BLUDGEON }, + DAMV_PIERCING | DAM_BLUDGEON, 10 }, { WPN_EVENINGSTAR, "eveningstar", 12, -1, 15, 180, 8, SK_MACES_FLAILS, HANDS_ONE, SIZE_MEDIUM, MI_NONE, false, - DAMV_PIERCING | DAM_BLUDGEON }, + DAMV_PIERCING | DAM_BLUDGEON, 2 }, { WPN_DIRE_FLAIL, "dire flail", 13, -3, 14, 240, 9, SK_MACES_FLAILS, HANDS_DOUBLE, SIZE_MEDIUM, MI_NONE, false, - DAMV_PIERCING | DAM_BLUDGEON }, + DAMV_PIERCING | DAM_BLUDGEON, 10 }, { WPN_GREAT_MACE, "great mace", 16, -4, 18, 270, 9, SK_MACES_FLAILS, HANDS_TWO, SIZE_LARGE, MI_NONE, false, - DAMV_CRUSHING }, + DAMV_CRUSHING, 10 }, { WPN_GIANT_CLUB, "giant club", 18, -6, 19, 330, 10, SK_MACES_FLAILS, HANDS_TWO, SIZE_BIG, MI_NONE, false, - DAMV_CRUSHING }, + DAMV_CRUSHING, 0 }, { WPN_GIANT_SPIKED_CLUB, "giant spiked club", 20, -7, 20, 350, 10, SK_MACES_FLAILS, HANDS_TWO, SIZE_BIG, MI_NONE, false, - DAMV_PIERCING | DAM_BLUDGEON }, + DAMV_PIERCING | DAM_BLUDGEON, 0 }, // Short blades { WPN_KNIFE, "knife", 3, 5, 10, 10, 1, SK_SHORT_BLADES, HANDS_ONE, SIZE_LITTLE, MI_NONE, false, - DAMV_STABBING | DAM_SLICE }, + DAMV_STABBING | DAM_SLICE, 0 }, { WPN_DAGGER, "dagger", 4, 6, 10, 20, 1, SK_SHORT_BLADES, HANDS_ONE, SIZE_LITTLE, MI_NONE, true, - DAMV_STABBING | DAM_SLICE }, + DAMV_STABBING | DAM_SLICE, 10 }, { WPN_QUICK_BLADE, "quick blade", 5, 6, 7, 50, 0, SK_SHORT_BLADES, HANDS_ONE, SIZE_LITTLE, MI_NONE, false, - DAMV_STABBING | DAM_SLICE }, + DAMV_STABBING | DAM_SLICE, 2 }, { WPN_SHORT_SWORD, "short sword", 6, 4, 11, 80, 2, SK_SHORT_BLADES, HANDS_ONE, SIZE_SMALL, MI_NONE, false, - DAMV_SLICING | DAM_PIERCE }, + DAMV_SLICING | DAM_PIERCE, 10 }, { WPN_SABRE, "sabre", 7, 4, 12, 90, 2, SK_SHORT_BLADES, HANDS_ONE, SIZE_SMALL, MI_NONE, false, - DAMV_SLICING | DAM_PIERCE }, + DAMV_SLICING | DAM_PIERCE, 10 }, // Long swords { WPN_FALCHION, "falchion", 8, 2, 13, 170, 4, SK_LONG_SWORDS, HANDS_ONE, SIZE_MEDIUM, MI_NONE, false, - DAMV_SLICING }, // or perhaps DAMV_CHOPPING is more apt? + DAMV_SLICING, 10 }, // or perhaps DAMV_CHOPPING is more apt? { WPN_LONG_SWORD, "long sword", 10, 1, 14, 160, 3, SK_LONG_SWORDS, HANDS_ONE, SIZE_MEDIUM, MI_NONE, false, - DAMV_SLICING }, + DAMV_SLICING, 10 }, { WPN_SCIMITAR, "scimitar", 11, -1, 14, 170, 3, SK_LONG_SWORDS, HANDS_ONE, SIZE_MEDIUM, MI_NONE, false, - DAMV_SLICING }, + DAMV_SLICING, 10 }, { WPN_KATANA, "katana", 13, 2, 13, 160, 3, SK_LONG_SWORDS, HANDS_HALF, SIZE_MEDIUM, MI_NONE, false, - DAMV_SLICING }, + DAMV_SLICING, 2 }, { WPN_DEMON_BLADE, "demon blade", 13, -1, 15, 200, 4, SK_LONG_SWORDS, HANDS_ONE, SIZE_MEDIUM, MI_NONE, false, - DAMV_SLICING }, + DAMV_SLICING, 2 }, { WPN_BLESSED_BLADE, "blessed blade", 14, 0, 14, 200, 4, SK_LONG_SWORDS, HANDS_ONE, SIZE_MEDIUM, MI_NONE, false, - DAMV_SLICING }, + DAMV_SLICING, 0 }, { WPN_DOUBLE_SWORD, "double sword", 15, -2, 16, 220, 5, SK_LONG_SWORDS, HANDS_HALF, SIZE_MEDIUM, MI_NONE, false, - DAMV_SLICING }, + DAMV_SLICING, 2 }, { WPN_GREAT_SWORD, "great sword", 16, -3, 17, 250, 6, SK_LONG_SWORDS, HANDS_TWO, SIZE_LARGE, MI_NONE, false, - DAMV_SLICING }, + DAMV_SLICING, 10 }, { WPN_TRIPLE_SWORD, "triple sword", 19, -4, 19, 260, 6, SK_LONG_SWORDS, HANDS_TWO, SIZE_LARGE, MI_NONE, false, - DAMV_SLICING }, + DAMV_SLICING, 2 }, // Axes { WPN_HAND_AXE, "hand axe", 7, 3, 13, 80, 6, SK_AXES, HANDS_ONE, SIZE_SMALL, MI_NONE, true, - DAMV_CHOPPING }, + DAMV_CHOPPING, 10 }, { WPN_WAR_AXE, "war axe", 11, 0, 16, 180, 7, SK_AXES, HANDS_ONE, SIZE_MEDIUM, MI_NONE, false, - DAMV_CHOPPING }, + DAMV_CHOPPING, 10 }, { WPN_BROAD_AXE, "broad axe", 14, -2, 17, 230, 8, SK_AXES, HANDS_HALF, SIZE_MEDIUM, MI_NONE, false, - DAMV_CHOPPING }, + DAMV_CHOPPING, 10 }, { WPN_BATTLEAXE, "battleaxe", 17, -4, 18, 250, 8, SK_AXES, HANDS_TWO, SIZE_LARGE, MI_NONE, false, - DAMV_CHOPPING }, + DAMV_CHOPPING, 10 }, { WPN_EXECUTIONERS_AXE, "executioner\'s axe", 20, -6, 20, 280, 9, SK_AXES, HANDS_TWO, SIZE_LARGE, MI_NONE, false, - DAMV_CHOPPING }, + DAMV_CHOPPING, 2 }, // Polearms { WPN_SPEAR, "spear", 6, 3, 12, 50, 3, SK_POLEARMS, HANDS_HALF, SIZE_SMALL, MI_NONE, true, - DAMV_PIERCING }, + DAMV_PIERCING, 10 }, { WPN_TRIDENT, "trident", 9, 2, 14, 160, 4, SK_POLEARMS, HANDS_HALF, SIZE_MEDIUM, MI_NONE, false, - DAMV_PIERCING }, + DAMV_PIERCING, 10 }, { WPN_DEMON_TRIDENT, "demon trident", 13, 0, 14, 160, 4, SK_POLEARMS, HANDS_HALF, SIZE_MEDIUM, MI_NONE, false, - DAMV_PIERCING }, + DAMV_PIERCING, 2 }, { WPN_HALBERD, "halberd", 13, -3, 16, 200, 5, SK_POLEARMS, HANDS_TWO, SIZE_LARGE, MI_NONE, false, - DAMV_CHOPPING | DAM_PIERCE }, + DAMV_CHOPPING | DAM_PIERCE, 10 }, { WPN_SCYTHE, "scythe", 14, -4, 20, 220, 7, SK_POLEARMS, HANDS_TWO, SIZE_LARGE, MI_NONE, false, - DAMV_SLICING }, + DAMV_SLICING, 10 }, { WPN_GLAIVE, "glaive", 15, -3, 18, 200, 6, SK_POLEARMS, HANDS_TWO, SIZE_LARGE, MI_NONE, false, - DAMV_CHOPPING }, + DAMV_CHOPPING, 10 }, { WPN_LOCHABER_AXE, "lochaber axe", 18, -6, 20, 200, 8, SK_POLEARMS, HANDS_TWO, SIZE_LARGE, MI_NONE, false, - DAMV_CHOPPING }, + DAMV_CHOPPING, 2 }, { WPN_QUARTERSTAFF, "quarterstaff", 9, 2, 12, 180, 7, SK_STAVES, HANDS_DOUBLE, SIZE_LARGE, MI_NONE, false, - DAMV_CRUSHING }, + DAMV_CRUSHING, 10 }, { WPN_LAJATANG, "lajatang", 14, -3, 14, 200, 3, SK_STAVES, HANDS_DOUBLE, SIZE_LARGE, MI_NONE, false, - DAMV_SLICING }, + DAMV_SLICING, 2 }, // Range weapons // Notes: @@ -312,22 +313,22 @@ static weapon_def Weapon_prop[NUM_WEAPONS] = // - str weight is used for speed and applying dex to skill { WPN_BLOWGUN, "blowgun", 0, 2, 10, 20, 0, SK_DARTS, HANDS_HALF, SIZE_LITTLE, MI_NEEDLE, false, - DAMV_NON_MELEE }, + DAMV_NON_MELEE, 0 }, { WPN_SLING, "sling", 0, 2, 11, 20, 1, SK_SLINGS, HANDS_HALF, SIZE_LITTLE, MI_STONE, false, - DAMV_NON_MELEE }, + DAMV_NON_MELEE, 10 }, { WPN_HAND_CROSSBOW, "hand crossbow", 3, 4, 15, 70, 5, SK_CROSSBOWS, HANDS_HALF, SIZE_SMALL, MI_DART, false, - DAMV_NON_MELEE }, + DAMV_NON_MELEE, 10 }, { WPN_CROSSBOW, "crossbow", 5, 4, 15, 150, 8, SK_CROSSBOWS, HANDS_TWO, SIZE_MEDIUM, MI_BOLT, false, - DAMV_NON_MELEE }, + DAMV_NON_MELEE, 10 }, { WPN_BOW, "bow", 3, 1, 11, 90, 2, SK_BOWS, HANDS_TWO, SIZE_MEDIUM, MI_ARROW, false, - DAMV_NON_MELEE }, + DAMV_NON_MELEE, 10 }, { WPN_LONGBOW, "longbow", 6, 0, 12, 120, 3, SK_BOWS, HANDS_TWO, SIZE_LARGE, MI_ARROW, false, - DAMV_NON_MELEE }, + DAMV_NON_MELEE, 10 }, }; struct missile_def @@ -1845,6 +1846,8 @@ int property( const item_def &item, int prop_type ) return (Weapon_prop[ Weapon_index[item.sub_type] ].hit); else if (prop_type == PWPN_SPEED) return (Weapon_prop[ Weapon_index[item.sub_type] ].speed); + else if (prop_type == PWPN_ACQ_WEIGHT) + return (Weapon_prop[ Weapon_index[item.sub_type] ].acquire_weight); break; case OBJ_MISSILES: |