Gather all alchemy info into a single place

This commit is contained in:
2024-08-28 21:46:18 -04:00
committed by Celtic Minstrel
parent 877b188b33
commit 71a9d11cd0
12 changed files with 207 additions and 172 deletions

View File

@@ -340,116 +340,12 @@ cItem::cItem(eItemPreset preset) : cItem() {
cItem::cItem(eAlchemy recipe) : cItem(ITEM_POTION) {
full_name = get_str("magic-names", int(recipe) + 200);
switch(recipe) {
case eAlchemy::NONE: break;
case eAlchemy::CURE_WEAK:
value = 40;
ability = eItemAbil::AFFECT_STATUS;
abil_strength = 2;
abil_data.status = eStatus::POISON;
break;
case eAlchemy::HEAL_WEAK:
value = 60;
ability = eItemAbil::AFFECT_HEALTH;
abil_strength = 2;
break;
case eAlchemy::POISON_WEAK:
value = 15;
ability = eItemAbil::POISON_WEAPON;
abil_strength = 2;
break;
case eAlchemy::SPEED_WEAK:
value = 50;
ability = eItemAbil::AFFECT_STATUS;
abil_strength = 2;
abil_data.status = eStatus::HASTE_SLOW;
break;
case eAlchemy::POISON_MED:
value = 50;
ability = eItemAbil::POISON_WEAPON;
abil_strength = 4;
break;
case eAlchemy::HEAL_MED:
value = 180;
ability = eItemAbil::AFFECT_HEALTH;
abil_strength = 5;
break;
case eAlchemy::CURE_STRONG:
value = 200;
ability = eItemAbil::AFFECT_STATUS;
abil_strength = 8;
abil_data.status = eStatus::POISON;
break;
case eAlchemy::SPEED_MED:
value = 100;
ability = eItemAbil::AFFECT_STATUS;
abil_strength = 5;
abil_data.status = eStatus::HASTE_SLOW;
break;
case eAlchemy::GRAYMOLD:
value = 150;
ability = eItemAbil::AFFECT_STATUS;
abil_strength = 4;
abil_data.status = eStatus::DISEASE;
magic_use_type = eItemUse::HELP_ALL;
break;
case eAlchemy::POWER_WEAK:
value = 100;
ability = eItemAbil::AFFECT_SPELL_POINTS;
abil_strength = 2;
break;
case eAlchemy::CLARITY:
value = 200;
ability = eItemAbil::AFFECT_STATUS;
abil_strength = 8;
abil_data.status = eStatus::DUMB;
break;
case eAlchemy::POISON_STRONG:
value = 150;
ability = eItemAbil::POISON_WEAPON;
abil_strength = 6;
break;
case eAlchemy::HEAL_STRONG:
value = 300;
ability = eItemAbil::AFFECT_HEALTH;
abil_strength = 8;
break;
case eAlchemy::POISON_KILL:
value = 400;
ability = eItemAbil::POISON_WEAPON;
abil_strength = 8;
break;
case eAlchemy::RESURRECT:
value = 100;
ability = eItemAbil::RESURRECTION_BALM;
break;
case eAlchemy::POWER_MED:
value = 300;
ability = eItemAbil::AFFECT_SPELL_POINTS;
abil_strength = 5;
break;
case eAlchemy::KNOWLEDGE:
value = 500;
ability = eItemAbil::AFFECT_SKILL_POINTS;
abil_strength = 2;
break;
case eAlchemy::STRENGTH:
value = 175;
ability = eItemAbil::AFFECT_STATUS;
abil_strength = 8;
abil_data.status = eStatus::BLESS_CURSE;
break;
case eAlchemy::BLISS:
value = 250;
ability = eItemAbil::BLISS_DOOM;
abil_strength = 5;
break;
case eAlchemy::POWER_STRONG:
value = 500;
ability = eItemAbil::AFFECT_SKILL_POINTS;
abil_strength = 8;
break;
}
const cAlchemy& info = *recipe;
value = info.value;
ability = info.ability;
abil_strength = info.abil_strength;
abil_data = info.abil_data;
magic_use_type = info.magic_use_type;
}
void cItem::enchant_weapon(eEnchant enchant_type,short new_val) {

View File

@@ -12,13 +12,10 @@
#include <string>
#include <iosfwd>
#include "damage.hpp"
#include "location.hpp"
#include "item_abilities.hpp"
#include "item_variety.hpp"
#include "race.hpp"
#include "skills_traits.hpp"
#include "spell.hpp"
#include "alchemy.hpp"
namespace legacy { struct item_record_type; };
@@ -41,16 +38,6 @@ enum eItemPreset {
ITEM_SHOP,
};
union uItemAbilData {
unsigned int value = 0;
eStatus status;
ePartyStatus party;
eSpell spell;
eDamageType damage;
eRace race;
eSkill skill;
};
class cItem {
public:
eItemType variety;

View File

@@ -9,6 +9,11 @@
#ifndef BoE_ITEM_ABILITIES_HPP
#define BoE_ITEM_ABILITIES_HPP
#include "damage.hpp"
#include "race.hpp"
#include "skills_traits.hpp"
#include "spell.hpp"
enum class eItemAbil {
// Weapon abilities
NONE = 0,
@@ -111,6 +116,16 @@ inline eItemAbilCat getItemAbilCategory(eItemAbil abil) {
return eItemAbilCat::INVALID;
}
union uItemAbilData {
unsigned int value = 0;
eStatus status;
ePartyStatus party;
eSpell spell;
eDamageType damage;
eRace race;
eSkill skill;
};
std::ostream& operator << (std::ostream& out, eItemAbil e);
std::istream& operator >> (std::istream& in, eItemAbil& e);