Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ritual Circles Work #72128

Merged
merged 2 commits into from
Mar 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions src/magic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1216,11 +1216,8 @@ bool spell::can_cast( const Character &guy ) const
return false;
}

// only required because crafting_inventory always rebuilds the cache. maybe a const version doesn't write to cache.
Character &guy_inv = const_cast<Character &>( guy );

if( !type->spell_components.is_empty() &&
!type->spell_components->can_make_with_inventory( guy_inv.crafting_inventory( guy.pos(), 0 ),
!type->spell_components->can_make_with_inventory( guy.crafting_inventory( guy.pos(), 0, false ),
return_true<item> ) ) {
return false;
}
Expand All @@ -1236,6 +1233,7 @@ void spell::use_components( Character &guy ) const
const requirement_data &spell_components = type->spell_components.obj();
// if we're here, we're assuming the Character has the correct components (using can_cast())
inventory map_inv;
map_inv.form_from_map( guy.pos(), 0, &guy, true, false );
for( const std::vector<item_comp> &comp_vec : spell_components.get_components() ) {
guy.consume_items( guy.select_item_component( comp_vec, 1, map_inv ), 1 );
}
Expand Down Expand Up @@ -2777,13 +2775,13 @@ void spellcasting_callback::spell_info_text( const spell &sp, int width )
if( sp.has_components() ) {
if( !sp.components().get_components().empty() ) {
for( const std::string &line : sp.components().get_folded_components_list(
width - 2, c_light_gray, pc.crafting_inventory(), return_true<item> ) ) {
width - 2, c_light_gray, pc.crafting_inventory( pc.pos(), 0, false ), return_true<item> ) ) {
info_txt.emplace_back( line );
}
}
if( !( sp.components().get_tools().empty() && sp.components().get_qualities().empty() ) ) {
for( const std::string &line : sp.components().get_folded_tools_list(
width - 2, c_light_gray, pc.crafting_inventory() ) ) {
width - 2, c_light_gray, pc.crafting_inventory( pc.pos(), 0, false ) ) ) {
info_txt.emplace_back( line );
}
}
Expand Down
Loading