Browse Source

Ensure Spectral Elixir is only usable after black mushroom quest is finished

pull/5766/head^2
obligaron 3 years ago committed by Anders Jenbo
parent
commit
6edae7cf6c
  1. 4
      Source/itemdat.cpp
  2. 2
      Source/itemdat.h
  3. 2
      Source/player.h
  4. 5
      Source/towners.cpp

4
Source/itemdat.cpp

@ -47,7 +47,7 @@ string_view ItemTypeToString(ItemType itemType)
}
/** Contains the data related to each item ID. */
ItemData AllItemsList[] = {
const ItemData AllItemsList[] = {
// clang-format off
// _item_indexes iRnd, iClass, iLoc, iCurs, itype, iItemId, iName, iSName, iMinMLvl, iDurability, iMinDam, iMaxDam, iMinAC, iMaxAC, iMinStr, iMinMag, iMinDex, iFlags, iMiscId, iSpell, iUsable, iValue
/*IDI_GOLD */ { IDROP_REGULAR, ICLASS_GOLD, ILOC_UNEQUIPABLE, ICURS_GOLD, ItemType::Gold, UITYPE_NONE, N_("Gold"), nullptr, 1, 0, 0, 0, 0, 0, 0, 0, 0, ItemSpecialEffect::None, IMISC_NONE, SpellID::Null, true, 0 },
@ -70,7 +70,7 @@ ItemData AllItemsList[] = {
/*IDI_MUSHROOM */ { IDROP_NEVER, ICLASS_QUEST, ILOC_UNEQUIPABLE, ICURS_BLACK_MUSHROOM, ItemType::Misc, UITYPE_NONE, N_("Black Mushroom"), nullptr, 0, 0, 0, 0, 0, 0, 0, 0, 0, ItemSpecialEffect::None, IMISC_NONE, SpellID::Null, false, 0 },
/*IDI_BRAIN */ { IDROP_NEVER, ICLASS_QUEST, ILOC_UNEQUIPABLE, ICURS_BRAIN, ItemType::Misc, UITYPE_NONE, N_("Brain"), nullptr, 0, 0, 0, 0, 0, 0, 0, 0, 0, ItemSpecialEffect::None, IMISC_NONE, SpellID::Null, false, 0 },
/*IDI_FUNGALTM */ { IDROP_NEVER, ICLASS_QUEST, ILOC_UNEQUIPABLE, ICURS_FUNGAL_TOME, ItemType::Misc, UITYPE_NONE, N_("Fungal Tome"), nullptr, 0, 0, 0, 0, 0, 0, 0, 0, 0, ItemSpecialEffect::None, IMISC_NONE, SpellID::Null, false, 0 },
/*IDI_SPECELIX */ { IDROP_NEVER, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_SPECTRAL_ELIXIR, ItemType::Misc, UITYPE_ELIXIR, N_("Spectral Elixir"), nullptr, 15, 0, 0, 0, 0, 0, 0, 0, 0, ItemSpecialEffect::None, IMISC_SPECELIX, SpellID::Null, false, 0 },
/*IDI_SPECELIX */ { IDROP_NEVER, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_SPECTRAL_ELIXIR, ItemType::Misc, UITYPE_ELIXIR, N_("Spectral Elixir"), nullptr, 15, 0, 0, 0, 0, 0, 0, 0, 0, ItemSpecialEffect::None, IMISC_SPECELIX, SpellID::Null, true, 0 },
/*IDI_BLDSTONE */ { IDROP_NEVER, ICLASS_QUEST, ILOC_UNEQUIPABLE, ICURS_BLOOD_STONE, ItemType::Misc, UITYPE_NONE, N_("Blood Stone"), nullptr, 0, 0, 0, 0, 0, 0, 0, 0, 0, ItemSpecialEffect::None, IMISC_NONE, SpellID::Null, false, 0 },
/*IDI_MAPOFDOOM */ { IDROP_NEVER, ICLASS_QUEST, ILOC_UNEQUIPABLE, ICURS_MAP_OF_THE_STARS, ItemType::Misc, UITYPE_MAPOFDOOM, N_("Cathedral Map"), nullptr, 0, 0, 0, 0, 0, 0, 0, 0, 0, ItemSpecialEffect::None, IMISC_MAPOFDOOM, SpellID::Null, true, 0 },
/*IDI_EAR */ { IDROP_NEVER, ICLASS_QUEST, ILOC_UNEQUIPABLE, ICURS_EAR_SORCERER, ItemType::Misc, UITYPE_NONE, N_("Heart"), nullptr, 0, 0, 0, 0, 0, 0, 0, 0, 0, ItemSpecialEffect::None, IMISC_EAR, SpellID::Null, false, 0 },

2
Source/itemdat.h

@ -590,7 +590,7 @@ struct UniqueItem {
ItemPower powers[6];
};
extern ItemData AllItemsList[];
extern const ItemData AllItemsList[];
extern const PLStruct ItemPrefixes[];
extern const PLStruct ItemSuffixes[];
extern const UniqueItem UniqueItems[];

2
Source/player.h

@ -372,6 +372,8 @@ struct Player {
bool CanUseItem(const Item &item) const
{
if (item.IDidx == IDI_SPECELIX && Quests[Q_MUSHROOM]._qactive != QUEST_DONE)
return false;
return _pStrength >= item._iMinStr
&& _pMagic >= item._iMinMag
&& _pDexterity >= item._iMinDex;

5
Source/towners.cpp

@ -449,7 +449,10 @@ void TalkToWitch(Player &player, Towner & /*witch*/)
if (HasInventoryOrBeltItemWithId(player, IDI_SPECELIX)) {
InitQTextMsg(TEXT_MUSH12);
Quests[Q_MUSHROOM]._qactive = QUEST_DONE;
AllItemsList[IDI_SPECELIX].iUsable = true; /// BUGFIX: This will cause the elixir to be usable in the next game
// Ensure Spectral Elixir is usable after the quest is finished
for (Item &item : InventoryAndBeltPlayerItemsRange { player }) {
item.updateRequiredStatsCacheForPlayer(player);
}
return;
}
}

Loading…
Cancel
Save