alchemy: correct problems when using the new code...

legacy[unlock/dispel_barrier]: do not use freebie mode for items, ...
This commit is contained in:
ALONSO Laurent
2021-10-05 13:19:31 +02:00
committed by Celtic Minstrel
parent d1af077e3e
commit 710d80dbb0
2 changed files with 20 additions and 13 deletions

View File

@@ -1,9 +1,10 @@
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<?xml-stylesheet href="dialog.xsl" type="text/xsl"?>
<dialog defbtn='cancel'>
<button name='left' type='left' def-key='left' top='303' left='287'/>
<button name='right' type='right' def-key='right' top='303' left='350'/>
<button name='cancel' type='regular' def-key='esc' top='303' left='415'>Cancel</button>
<button name='left' type='left' def-key='left' top='330' left='287'/>
<button name='right' type='right' def-key='right' top='330' left='350'/>
<button name='cancel' type='regular' def-key='esc' top='330' left='415'>Cancel</button>
<text name='result' top='330' left='5' width='259' height='36' font='bold'></text>
<text size='large' top='8' left='53' width='71' height='16'>Alchemy:</text>
<text size='large' top='29' left='53' width='32' height='16'>For:</text>
<text name='mixer' framed='true' top='29' left='89' width='165' height='16'/>

View File

@@ -1200,14 +1200,16 @@ void cast_town_spell(location where) {
}
short adjust = can_see_light(univ.party.town_loc,where,sight_obscurity);
if(!spell_freebie)
// legacy scenario always use pc characteristic
bool freebie = univ.scenario.is_legacy ? false : spell_freebie;
if(!freebie)
univ.party[who_cast].cur_sp -= (*town_spell).cost;
ter = univ.town->terrain(where.x,where.y);
short adj = spell_freebie ? 1 : univ.party[who_cast].stat_adj(eSkill::INTELLIGENCE);
short level = spell_freebie ? store_item_spell_level : univ.party[who_cast].level;
short adj = freebie ? 1 : univ.party[who_cast].stat_adj(eSkill::INTELLIGENCE);
short level = freebie ? store_item_spell_level : univ.party[who_cast].level;
if(!spell_freebie && (*town_spell).level <= univ.party[who_cast].get_prot_level(eItemAbil::MAGERY) && !(*town_spell).is_priest())
level++;
if(!spell_freebie && univ.party[who_cast].traits[eTrait::ANAMA] && (*town_spell).is_priest())
if(!freebie && univ.party[who_cast].traits[eTrait::ANAMA] && (*town_spell).is_priest())
level++;
// TODO: Should we do this here? Or in the handling of targeting modes?
@@ -2049,9 +2051,9 @@ extern const eItemAbil alch_ingred2[20];
static void display_alchemy_graphics(cDialog& me, short &pc_num);
static bool alch_potion_event_filter(cDialog&me, short &pc_num, std::string item_hit, eKeyMod) {
int potion_id = boost::lexical_cast<int>(item_hit.substr(6));
int potion_id = boost::lexical_cast<int>(item_hit.substr(6))-1;
if(!univ.party[pc_num].has_space()) {
add_string_to_buf("Alchemy: Can't carry another item.");
me["result"].setText("Alchemy: Can't carry another item.");
return false;
}
@@ -2078,7 +2080,8 @@ static bool alch_potion_event_filter(cDialog&me, short &pc_num, std::string item
};
int r1 = get_ran(1,1,100);
if(r1 < fail_chance[univ.party[pc_num].skill(eSkill::ALCHEMY) - alch_difficulty[potion_id]]) {
add_string_to_buf("Alchemy: Failed.");
me["result"].setColour(sf::Color::Red);
me["result"].setText("Alchemy: Failed.");
r1 = get_ran(1,0,1);
play_sound(41 );
}
@@ -2090,12 +2093,15 @@ static bool alch_potion_event_filter(cDialog&me, short &pc_num, std::string item
store_i.charges++;
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);
me["result"].setColour(sf::Color::Red);
me["result"].setText("No room in inventory.\nPotion placed on floor.");
place_item(store_i,univ.party.town_loc);
// checkme: redraw terrain here?
}
else
add_string_to_buf("Alchemy: Successful.");
else {
me["result"].setColour(sf::Color::White);
me["result"].setText("Alchemy: Successful.");
}
}
put_item_screen(stat_window);
display_alchemy_graphics(me, pc_num);