New item variety: Special

- When picked up or purchased, the party gains a special item
This commit is contained in:
2015-01-20 17:17:23 -05:00
parent decdc3111b
commit 7837459177
13 changed files with 49 additions and 32 deletions

View File

@@ -99,7 +99,7 @@ public:
bool can_find_town[200];
short key_times[100];
std::vector<cTimer> party_event_timers;
char spec_items[50];
std::array<bool,50> spec_items;
char help_received[120];
short m_killed[200]; // monsters killed per town, I think
long long total_m_killed, total_dam_done, total_xp_gained, total_dam_taken;

View File

@@ -116,7 +116,7 @@ void cPlayer::sort_items() {
{it::TOOL, 7}, {it::FOOD, 20}, {it::SHIELD, 10}, {it::ARMOR, 10}, {it::HELM, 10},
{it::GLOVES, 10}, {it::SHIELD_2, 10}, {it::BOOTS, 10}, {it::RING, 5}, {it::NECKLACE, 6},
{it::WEAPON_POISON, 4}, {it::NON_USE_OBJECT, 11}, {it::PANTS, 12}, {it::CROSSBOW, 9}, {it::BOLTS, 9},
{it::MISSILE_NO_AMMO, 9}, {it::UNUSED1, 20}, {it::UNUSED2, 20}
{it::MISSILE_NO_AMMO, 9}, {it::UNUSED1, 20}, {it::SPECIAL, 20}
};
bool no_swaps = false;
@@ -153,6 +153,12 @@ bool cPlayer::give_item(cItem item, bool do_print, bool allow_overload) {
print_result("You get some food.");
return true;
}
if(item.variety == eItemType::SPECIAL) {
party.spec_items[item.item_level] = true;
if(do_print && print_result)
print_result("You get a special item.");
return true;
}
if(!allow_overload && item.item_weight() > free_weight()) {
if(do_print && print_result) {
//beep(); // TODO: This is a game event, so it should have a game sound, not a system alert.
@@ -286,7 +292,10 @@ short cPlayer::skill(eSkill skill) {
}
eBuyStatus cPlayer::ok_to_buy(short cost,cItem item) {
if(item.variety != eItemType::GOLD && item.variety != eItemType::FOOD) {
if(item.variety == eItemType::SPECIAL) {
if(party.spec_items[item.item_level])
return eBuyStatus::HAVE_LOTS;
} else if(item.variety != eItemType::GOLD && item.variety != eItemType::FOOD) {
for(int i = 0; i < 24; i++)
if(items[i].variety != eItemType::NO_ITEM && items[i].type_flag == item.type_flag && items[i].charges > 123)
return eBuyStatus::HAVE_LOTS;

View File

@@ -298,8 +298,8 @@ enum class eItemType {
CROSSBOW = 23,
BOLTS = 24,
MISSILE_NO_AMMO = 25, //e.g slings
UNUSED1 = 26, // these are here solely because they are options in the editor
UNUSED2 = 27,
SPECIAL = 26, // these are here solely because they are options in the editor
UNUSED1 = 27,
};
inline bool isArmourType(eItemType type) {