Gather all alchemy info into a single place
This commit is contained in:
@@ -387,6 +387,7 @@
|
||||
<ClCompile Include="..\..\..\src\gfx\render_shapes.cpp" />
|
||||
<ClCompile Include="..\..\..\src\gfx\render_text.cpp" />
|
||||
<ClCompile Include="..\..\..\src\gfx\tiling.cpp" />
|
||||
<ClCompile Include="..\..\..\src\alchemy.cpp" />
|
||||
<ClCompile Include="..\..\..\src\damage.cpp" />
|
||||
<ClCompile Include="..\..\..\src\location.cpp" />
|
||||
<ClCompile Include="..\..\..\src\mathutil.cpp" />
|
||||
|
@@ -716,6 +716,7 @@
|
||||
<ClCompile Include="..\..\..\src\universe\universe.cpp">
|
||||
<Filter>Universe</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\alchemy.cpp" />
|
||||
<ClCompile Include="..\..\..\src\damage.cpp" />
|
||||
<ClCompile Include="..\..\..\src\location.cpp" />
|
||||
<ClCompile Include="..\..\..\src\mathutil.cpp" />
|
||||
|
@@ -105,6 +105,7 @@
|
||||
9153C79F1A994A1300D7F8A7 /* SFML.framework in Copy Libraries and Frameworks */ = {isa = PBXBuildFile; fileRef = 91F6F8E218F87F3700E3EA15 /* SFML.framework */; };
|
||||
9153C7A01A994A1700D7F8A7 /* SFML.framework in Copy Libraries and Frameworks */ = {isa = PBXBuildFile; fileRef = 91F6F8E218F87F3700E3EA15 /* SFML.framework */; };
|
||||
915473BF2C7E11B900EB1C94 /* damage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 915473BE2C7E11B900EB1C94 /* damage.cpp */; };
|
||||
915473C62C7FCDBB00EB1C94 /* alchemy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 915473C52C7FCDBB00EB1C94 /* alchemy.cpp */; };
|
||||
915AF9E81BBF8B5C008AEF49 /* scrollpane.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 919B13A81BBE2B54009905A4 /* scrollpane.cpp */; };
|
||||
9176FEC71D550EFE006EF694 /* out_legacy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9176FEC01D550EFC006EF694 /* out_legacy.cpp */; };
|
||||
9176FEC81D550EFE006EF694 /* scen_legacy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9176FEC11D550EFC006EF694 /* scen_legacy.cpp */; };
|
||||
@@ -692,6 +693,7 @@
|
||||
915325161A2E1DA8000A9A1C /* oldstructs.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = oldstructs.cpp; sourceTree = "<group>"; };
|
||||
915325181A2E37EE000A9A1C /* special_parse.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = special_parse.cpp; sourceTree = "<group>"; };
|
||||
915473BE2C7E11B900EB1C94 /* damage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = damage.cpp; sourceTree = "<group>"; };
|
||||
915473C52C7FCDBB00EB1C94 /* alchemy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = alchemy.cpp; sourceTree = "<group>"; };
|
||||
91574CC323CB97C5004766F8 /* enum_map.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = enum_map.hpp; sourceTree = "<group>"; };
|
||||
91597A6C1A3BED2D00BE7BF9 /* spell.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = spell.hpp; sourceTree = "<group>"; };
|
||||
91597A6E1A3BEDC700BE7BF9 /* spell.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = spell.cpp; sourceTree = "<group>"; };
|
||||
@@ -1331,6 +1333,7 @@
|
||||
9185BDA41EA053E00027C346 /* misc */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
915473C52C7FCDBB00EB1C94 /* alchemy.cpp */,
|
||||
915473BE2C7E11B900EB1C94 /* damage.cpp */,
|
||||
91279BE10F9D0F73007B0D52 /* location.cpp */,
|
||||
91B3F11E0F97801F00BF5B67 /* mathutil.cpp */,
|
||||
@@ -2058,6 +2061,7 @@
|
||||
919CC26D1B3773DB00273FDA /* message.cpp in Sources */,
|
||||
919CC26E1B3773E000273FDA /* pict.cpp in Sources */,
|
||||
919CC26F1B3773E700273FDA /* stack.cpp in Sources */,
|
||||
915473C62C7FCDBB00EB1C94 /* alchemy.cpp in Sources */,
|
||||
919CC2701B3773EC00273FDA /* scrollbar.cpp in Sources */,
|
||||
919CC2711B3773F300273FDA /* cursors.mac.mm in Sources */,
|
||||
919CC2721B3773F800273FDA /* fileio.cpp in Sources */,
|
||||
|
129
src/alchemy.cpp
Normal file
129
src/alchemy.cpp
Normal file
@@ -0,0 +1,129 @@
|
||||
//
|
||||
// alchemy.cpp
|
||||
// BoE
|
||||
//
|
||||
// Created by Celtic Minstrel on 2023-08-28.
|
||||
//
|
||||
//
|
||||
|
||||
#include "alchemy.hpp"
|
||||
|
||||
std::map<eAlchemy,cAlchemy> cAlchemy::dictionary;
|
||||
|
||||
// Fail chance lookup, based on adjusted skill
|
||||
const std::array<short, 9> cAlchemy::fail_chances = {
|
||||
50,40,30,20,10,
|
||||
8,6,4,2,
|
||||
};
|
||||
|
||||
cAlchemy::cAlchemy(eAlchemy id) : id(id) {}
|
||||
|
||||
cAlchemy& cAlchemy::withValue(short val) {
|
||||
value = val;
|
||||
return *this;
|
||||
}
|
||||
|
||||
cAlchemy& cAlchemy::withDifficulty(int d) {
|
||||
difficulty = d;
|
||||
return *this;
|
||||
}
|
||||
|
||||
cAlchemy& cAlchemy::withIngredient(eItemAbil ingred) {
|
||||
ingred1 = ingred;
|
||||
ingred2 = eItemAbil::NONE;
|
||||
return *this;
|
||||
}
|
||||
|
||||
cAlchemy& cAlchemy::withIngredients(eItemAbil first, eItemAbil second) {
|
||||
ingred1 = first;
|
||||
ingred2 = second;
|
||||
return *this;
|
||||
}
|
||||
|
||||
cAlchemy& cAlchemy::withAbility(eItemAbil abil, int stren) {
|
||||
ability = abil;
|
||||
abil_strength = stren;
|
||||
return *this;
|
||||
}
|
||||
|
||||
cAlchemy& cAlchemy::withAbility(eItemAbil abil, int stren, eStatus status) {
|
||||
withAbility(abil, stren);
|
||||
abil_data.status = status;
|
||||
return *this;
|
||||
}
|
||||
|
||||
cAlchemy& cAlchemy::withUse(eItemUse use) {
|
||||
magic_use_type = use;
|
||||
return *this;
|
||||
}
|
||||
|
||||
const cAlchemy& cAlchemy::finish() {
|
||||
dictionary.emplace(id, *this);
|
||||
return *this;
|
||||
}
|
||||
|
||||
short cAlchemy::fail_chance(short skill) const {
|
||||
if(skill < difficulty) return 100;
|
||||
if(skill - difficulty > fail_chances.size()) return 0;
|
||||
return fail_chances[skill - difficulty];
|
||||
}
|
||||
|
||||
short cAlchemy::charges(short skill) const {
|
||||
if(skill < difficulty) return 0;
|
||||
short diff = skill - difficulty;
|
||||
if(diff >= 11) return 3;
|
||||
if(diff >= 5) return 2;
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool cAlchemy::can_make(short skill) const {
|
||||
return fail_chance(skill) < 100;
|
||||
}
|
||||
|
||||
const cAlchemy& operator* (eAlchemy alch) {
|
||||
return cAlchemy::dictionary.at(alch);
|
||||
}
|
||||
|
||||
cAlchemy A_CURE_WEAK = cAlchemy(eAlchemy::CURE_WEAK).withDifficulty(1).withValue(40)
|
||||
.withIngredient(eItemAbil::HOLLY).withAbility(eItemAbil::AFFECT_STATUS, 2, eStatus::POISON).finish();
|
||||
cAlchemy A_HEAL_WEAK = cAlchemy(eAlchemy::HEAL_WEAK).withDifficulty(1).withValue(60)
|
||||
.withIngredient(eItemAbil::COMFREY).withAbility(eItemAbil::AFFECT_HEALTH, 2).finish();
|
||||
cAlchemy A_POISON_WEAK = cAlchemy(eAlchemy::POISON_WEAK).withDifficulty(1).withValue(15)
|
||||
.withIngredient(eItemAbil::HOLLY).withAbility(eItemAbil::POISON_WEAPON, 2).finish();
|
||||
cAlchemy A_SPEED_WEAK = cAlchemy(eAlchemy::SPEED_WEAK).withDifficulty(3).withValue(50)
|
||||
.withIngredients(eItemAbil::COMFREY, eItemAbil::WORMGRASS).withAbility(eItemAbil::AFFECT_STATUS, 2, eStatus::HASTE_SLOW).finish();
|
||||
cAlchemy A_POISON_MED = cAlchemy(eAlchemy::POISON_MED).withDifficulty(3).withValue(50)
|
||||
.withIngredient(eItemAbil::WORMGRASS).withAbility(eItemAbil::POISON_WEAPON, 4).finish();
|
||||
|
||||
cAlchemy A_HEAL_MED = cAlchemy(eAlchemy::HEAL_MED).withDifficulty(4).withValue(180)
|
||||
.withIngredient(eItemAbil::NETTLE).withAbility(eItemAbil::AFFECT_HEALTH, 5).finish();
|
||||
cAlchemy A_CURE_STRONG = cAlchemy(eAlchemy::CURE_STRONG).withDifficulty(5).withValue(200)
|
||||
.withIngredient(eItemAbil::NETTLE).withAbility(eItemAbil::AFFECT_STATUS, 8, eStatus::POISON).finish();
|
||||
cAlchemy A_SPEED_MED = cAlchemy(eAlchemy::SPEED_MED).withDifficulty(5).withValue(100)
|
||||
.withIngredients(eItemAbil::WORMGRASS, eItemAbil::NETTLE).withAbility(eItemAbil::AFFECT_STATUS, 5, eStatus::HASTE_SLOW).finish();
|
||||
cAlchemy A_GRAYMOLD = cAlchemy(eAlchemy::GRAYMOLD).withDifficulty(7).withValue(150)
|
||||
.withIngredient(eItemAbil::GRAYMOLD).withAbility(eItemAbil::AFFECT_STATUS, 4, eStatus::DISEASE).withUse(eItemUse::HELP_ALL).finish();
|
||||
cAlchemy A_POWER_WEAK = cAlchemy(eAlchemy::POWER_WEAK).withDifficulty(9).withValue(100)
|
||||
.withIngredients(eItemAbil::WORMGRASS, eItemAbil::ASPTONGUE).withAbility(eItemAbil::AFFECT_SPELL_POINTS, 2).finish();
|
||||
|
||||
cAlchemy A_CLARITY = cAlchemy(eAlchemy::CLARITY).withDifficulty(9).withValue(200)
|
||||
.withIngredients(eItemAbil::GRAYMOLD, eItemAbil::HOLLY).withAbility(eItemAbil::AFFECT_STATUS, 8, eStatus::DUMB).finish();
|
||||
cAlchemy A_POISON_STRING = cAlchemy(eAlchemy::POISON_STRONG).withDifficulty(10).withValue(150)
|
||||
.withIngredient(eItemAbil::ASPTONGUE).withAbility(eItemAbil::POISON_WEAPON, 6).finish();
|
||||
cAlchemy A_HEAL_STRONG = cAlchemy(eAlchemy::HEAL_STRONG).withDifficulty(12).withValue(300)
|
||||
.withIngredients(eItemAbil::GRAYMOLD, eItemAbil::COMFREY).withAbility(eItemAbil::AFFECT_HEALTH, 8).finish();
|
||||
cAlchemy A_POISON_KILL = cAlchemy(eAlchemy::POISON_KILL).withDifficulty(12).withValue(400)
|
||||
.withIngredient(eItemAbil::MANDRAKE).withAbility(eItemAbil::POISON_WEAPON, 8).finish();
|
||||
cAlchemy A_RESURRECT = cAlchemy(eAlchemy::RESURRECT).withDifficulty(9).withValue(100)
|
||||
.withIngredient(eItemAbil::EMBERF).withAbility(eItemAbil::RESURRECTION_BALM, 0).finish();
|
||||
|
||||
cAlchemy A_POWER_MED = cAlchemy(eAlchemy::POWER_MED).withDifficulty(14).withValue(300)
|
||||
.withIngredients(eItemAbil::MANDRAKE, eItemAbil::ASPTONGUE).withAbility(eItemAbil::AFFECT_SPELL_POINTS, 5).finish();
|
||||
cAlchemy A_KNOWLEDGE = cAlchemy(eAlchemy::KNOWLEDGE).withDifficulty(19).withValue(500)
|
||||
.withIngredients(eItemAbil::MANDRAKE, eItemAbil::EMBERF).withAbility(eItemAbil::AFFECT_SKILL_POINTS, 2).finish();
|
||||
cAlchemy A_STRENGTH = cAlchemy(eAlchemy::STRENGTH).withDifficulty(10).withValue(175)
|
||||
.withIngredients(eItemAbil::NETTLE, eItemAbil::EMBERF).withAbility(eItemAbil::AFFECT_STATUS, 8, eStatus::BLESS_CURSE).finish();
|
||||
cAlchemy A_BLISS = cAlchemy(eAlchemy::BLISS).withDifficulty(16).withValue(250)
|
||||
.withIngredients(eItemAbil::GRAYMOLD, eItemAbil::ASPTONGUE).withAbility(eItemAbil::BLISS_DOOM, 5).finish();
|
||||
cAlchemy A_POWER_STRONG = cAlchemy(eAlchemy::POWER_STRONG).withDifficulty(20).withValue(500)
|
||||
.withIngredients(eItemAbil::MANDRAKE, eItemAbil::EMBERF).withAbility(eItemAbil::AFFECT_SKILL_POINTS, 8).finish();
|
@@ -9,6 +9,12 @@
|
||||
#ifndef BoE_ALCHEMY_HPP
|
||||
#define BoE_ALCHEMY_HPP
|
||||
|
||||
#include "scenario/item_abilities.hpp"
|
||||
#include "scenario/item_variety.hpp"
|
||||
|
||||
#include <array>
|
||||
#include <map>
|
||||
|
||||
enum class eAlchemy {
|
||||
NONE = -1,
|
||||
CURE_WEAK = 0,
|
||||
@@ -33,4 +39,33 @@ enum class eAlchemy {
|
||||
POWER_STRONG = 19,
|
||||
};
|
||||
|
||||
class cAlchemy {
|
||||
static std::map<eAlchemy,cAlchemy> dictionary;
|
||||
static const std::array<short, 9> fail_chances;
|
||||
friend const cAlchemy& operator*(eAlchemy spell_num);
|
||||
public:
|
||||
cAlchemy(eAlchemy id);
|
||||
cAlchemy& withValue(short val);
|
||||
cAlchemy& withDifficulty(int d);
|
||||
cAlchemy& withIngredient(eItemAbil ingred);
|
||||
cAlchemy& withIngredients(eItemAbil first, eItemAbil second);
|
||||
cAlchemy& withAbility(eItemAbil abil, int stren);
|
||||
cAlchemy& withAbility(eItemAbil abil, int stren, eStatus status);
|
||||
cAlchemy& withUse(eItemUse use);
|
||||
const cAlchemy& finish();
|
||||
eAlchemy id;
|
||||
short value = 0;
|
||||
int difficulty = 0;
|
||||
eItemAbil ability = eItemAbil::NONE, ingred1, ingred2;
|
||||
unsigned int abil_strength = 0;
|
||||
uItemAbilData abil_data;
|
||||
eItemUse magic_use_type = eItemUse::HELP_ONE;
|
||||
short fail_chance(short skill) const;
|
||||
short charges(short skill) const;
|
||||
bool can_make(short skill) const;
|
||||
};
|
||||
|
||||
// Need to declare this a second time in order for it to be in scope where it's needed
|
||||
const cAlchemy& operator* (eAlchemy alch);
|
||||
|
||||
#endif
|
||||
|
@@ -75,9 +75,6 @@ extern short store_talk_face_pic;
|
||||
extern cUniverse univ;
|
||||
extern cCustomGraphics spec_scen_g;
|
||||
extern bool fog_lifted;
|
||||
extern const short alch_difficulty[20];
|
||||
extern const eItemAbil alch_ingred1[20];
|
||||
extern const eItemAbil alch_ingred2[20];
|
||||
extern enum_map(eGuiArea, rectangle) win_to_rects;
|
||||
|
||||
// Talk vars
|
||||
@@ -741,12 +738,13 @@ void draw_shop_graphics(bool pressed,rectangle clip_area_rect) {
|
||||
base_item.ident = true;
|
||||
cur_info_str = base_item.interesting_string();
|
||||
break;
|
||||
case eShopItemType::ALCHEMY:
|
||||
cur_info_str = get_str("item-abilities", int(alch_ingred1[base_item.item_level]) + 1);
|
||||
if(alch_ingred2[base_item.item_level] != eItemAbil::NONE) {
|
||||
cur_info_str += " and " + get_str("item-abilities", int(alch_ingred2[base_item.item_level]) + 1);
|
||||
case eShopItemType::ALCHEMY: {
|
||||
const cAlchemy& info = *(eAlchemy(base_item.item_level));
|
||||
cur_info_str = get_str("item-abilities", int(info.ingred1) + 1);
|
||||
if(info.ingred2 != eItemAbil::NONE) {
|
||||
cur_info_str += " and " + get_str("item-abilities", int(info.ingred2) + 1);
|
||||
}
|
||||
break;
|
||||
} break;
|
||||
case eShopItemType::MAGE_SPELL:
|
||||
spell = cSpell::fromNum(eSkill::MAGE_SPELLS, base_item.item_level);
|
||||
cur_info_str = "Level: " + std::to_string((*spell).level) + " SP: " + std::to_string((*spell).cost);
|
||||
|
@@ -2041,17 +2041,7 @@ void start_town_targeting(eSpell s_num,short who_c,bool freebie,eSpellPat pat) {
|
||||
}
|
||||
}
|
||||
|
||||
extern const short alch_difficulty[20];
|
||||
extern const eItemAbil alch_ingred1[20];
|
||||
extern const eItemAbil alch_ingred2[20];
|
||||
|
||||
void do_alchemy() {
|
||||
static const short fail_chance[20] = {
|
||||
50,40,30,20,10,
|
||||
8,6,4,2,0,
|
||||
0,0,0,0,0,
|
||||
0,0,0,0,0
|
||||
};
|
||||
short r1;
|
||||
short pc_num;
|
||||
|
||||
@@ -2061,21 +2051,21 @@ void do_alchemy() {
|
||||
|
||||
eAlchemy potion = alch_choice(pc_num);
|
||||
// TODO: Remove need for this cast by changing the above data to either std::maps or an unary operator*
|
||||
int which_p = int(potion);
|
||||
if(potion != eAlchemy::NONE) {
|
||||
if(!univ.party[pc_num].has_space()) {
|
||||
add_string_to_buf("Alchemy: Can't carry another item.");
|
||||
return;
|
||||
}
|
||||
const cAlchemy& info = *potion;
|
||||
|
||||
cInvenSlot which_item = univ.party[pc_num].has_abil(alch_ingred1[which_p]);
|
||||
cInvenSlot which_item = univ.party[pc_num].has_abil(info.ingred1);
|
||||
if(!which_item) {
|
||||
add_string_to_buf("Alchemy: Don't have ingredients.");
|
||||
return;
|
||||
}
|
||||
|
||||
if(alch_ingred2[which_p] != eItemAbil::NONE) {
|
||||
cInvenSlot which_item2 = univ.party[pc_num].has_abil(alch_ingred2[which_p]);
|
||||
if(info.ingred2 != eItemAbil::NONE) {
|
||||
cInvenSlot which_item2 = univ.party[pc_num].has_abil(info.ingred2);
|
||||
if(!which_item2) {
|
||||
add_string_to_buf("Alchemy: Don't have ingredients.");
|
||||
return;
|
||||
@@ -2093,7 +2083,8 @@ void do_alchemy() {
|
||||
play_sound(8);
|
||||
|
||||
r1 = get_ran(1,1,100);
|
||||
if(r1 < fail_chance[univ.party[pc_num].skill(eSkill::ALCHEMY) - alch_difficulty[which_p]]) {
|
||||
short skill = univ.party[pc_num].skill(eSkill::ALCHEMY);
|
||||
if(r1 < info.fail_chance(skill)) {
|
||||
add_string_to_buf("Alchemy: Failed.");
|
||||
r1 = get_ran(1,0,1);
|
||||
(void) r1; // TODO: Why does it even do this?
|
||||
@@ -2101,10 +2092,7 @@ void do_alchemy() {
|
||||
}
|
||||
else {
|
||||
cItem store_i(potion);
|
||||
if(univ.party[pc_num].skill(eSkill::ALCHEMY) - alch_difficulty[which_p] >= 5)
|
||||
store_i.charges++;
|
||||
if(univ.party[pc_num].skill(eSkill::ALCHEMY) - alch_difficulty[which_p] >= 11)
|
||||
store_i.charges++;
|
||||
store_i.charges = info.charges(skill);
|
||||
store_i.graphic_num += get_ran(1,0,2);
|
||||
if(!univ.party[pc_num].give_item(store_i,false)) {
|
||||
add_string_to_buf("No room in inventory. Potion placed on floor.", 2);
|
||||
@@ -2133,7 +2121,6 @@ static bool alch_choice_event_filter(cDialog& me, std::string item_hit, eKeyMod)
|
||||
}
|
||||
|
||||
eAlchemy alch_choice(short pc_num) {
|
||||
short difficulty[20] = {1,1,1,3,3, 4,5,5,7,9, 9,10,12,12,9, 14,19,10,16,20};
|
||||
|
||||
set_cursor(sword_curs);
|
||||
|
||||
@@ -2143,7 +2130,7 @@ eAlchemy alch_choice(short pc_num) {
|
||||
std::string n = boost::lexical_cast<std::string>(i + 1);
|
||||
chooseAlchemy["label" + n].setText(get_str("magic-names", i + 200));
|
||||
chooseAlchemy["potion" + n].attachClickHandler(alch_choice_event_filter);
|
||||
if(univ.party[pc_num].skill(eSkill::ALCHEMY) < difficulty[i] || !univ.party.alchemy[i])
|
||||
if(!univ.party.alchemy[i] || (*eAlchemy(i)).can_make(univ.party[pc_num].skill(eSkill::ALCHEMY)))
|
||||
chooseAlchemy["potion" + n].hide();
|
||||
}
|
||||
std::ostringstream sout;
|
||||
|
@@ -216,25 +216,6 @@ void pick_race_abil(cPlayer *pc,short mode,cDialog* parent) {
|
||||
pickAbil.run();
|
||||
}
|
||||
|
||||
extern const short alch_difficulty[20] = {
|
||||
1,1,1,3,3,
|
||||
4,5,5,7,9,
|
||||
9,10,12,12,9,
|
||||
14,19,10,16,20
|
||||
};
|
||||
extern const eItemAbil alch_ingred1[20] = {
|
||||
eItemAbil::HOLLY,eItemAbil::COMFREY,eItemAbil::HOLLY,eItemAbil::COMFREY,eItemAbil::WORMGRASS,
|
||||
eItemAbil::NETTLE,eItemAbil::NETTLE,eItemAbil::WORMGRASS,eItemAbil::GRAYMOLD,eItemAbil::WORMGRASS,
|
||||
eItemAbil::GRAYMOLD,eItemAbil::ASPTONGUE,eItemAbil::GRAYMOLD,eItemAbil::MANDRAKE,eItemAbil::EMBERF,
|
||||
eItemAbil::MANDRAKE,eItemAbil::MANDRAKE,eItemAbil::NETTLE,eItemAbil::GRAYMOLD,eItemAbil::MANDRAKE,
|
||||
};
|
||||
extern const eItemAbil alch_ingred2[20] = {
|
||||
eItemAbil::NONE,eItemAbil::NONE,eItemAbil::NONE,eItemAbil::WORMGRASS,eItemAbil::NONE,
|
||||
eItemAbil::NONE,eItemAbil::NONE,eItemAbil::NETTLE,eItemAbil::NONE,eItemAbil::ASPTONGUE,
|
||||
eItemAbil::HOLLY,eItemAbil::NONE,eItemAbil::COMFREY,eItemAbil::NONE,eItemAbil::NONE,
|
||||
eItemAbil::ASPTONGUE,eItemAbil::EMBERF,eItemAbil::EMBERF,eItemAbil::ASPTONGUE,eItemAbil::EMBERF,
|
||||
};
|
||||
|
||||
void display_alchemy(bool allowEdit,cDialog* parent) {
|
||||
set_cursor(sword_curs);
|
||||
|
||||
@@ -243,7 +224,7 @@ void display_alchemy(bool allowEdit,cDialog* parent) {
|
||||
for(short i = 0; i < 20; i++) {
|
||||
std::string id = "potion" + boost::lexical_cast<std::string>(i + 1);
|
||||
std::string name = get_str("magic-names", i + 200) + " (";
|
||||
name += std::to_string(alch_difficulty[i]);
|
||||
name += std::to_string((*eAlchemy(i)).difficulty);
|
||||
name += ')';
|
||||
showAlch->addLabelFor(id, name, LABEL_LEFT, 83, true);
|
||||
if(!allowEdit)
|
||||
|
@@ -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) {
|
||||
|
@@ -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;
|
||||
|
@@ -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);
|
||||
|
||||
|
@@ -7,6 +7,7 @@ tools = Split("""
|
||||
drawable_manager.cpp
|
||||
keymods.cpp
|
||||
replay.cpp
|
||||
../alchemy.cpp
|
||||
../damage.cpp
|
||||
../location.cpp
|
||||
../mathutil.cpp
|
||||
|
Reference in New Issue
Block a user