Skip to content

Commit

Permalink
make packmule and disorganize affect movecost for grabbing items (#40820
Browse files Browse the repository at this point in the history
)

* make packmule and disorganize affect movecost for grabbing items

* increase bonus to 10% for packmule
  • Loading branch information
KorGgenT authored May 26, 2020
1 parent e0694c4 commit d195589
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 6 deletions.
10 changes: 6 additions & 4 deletions data/json/mutations/mutations.json
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,9 @@
"type": "mutation",
"id": "PACKMULE",
"name": { "str": "Packmule" },
"points": 2,
"description": "You can manage to find space for anything! You can carry 40% more volume.",
"points": 1,
"description": "You pack things very efficiently! You can retrieve things from containers 10% faster.",
"obtain_cost_multiplier": 0.9,
"starting_trait": true,
"valid": false,
"cancels": [ "DISORGANIZED" ]
Expand Down Expand Up @@ -866,8 +867,9 @@
"type": "mutation",
"id": "DISORGANIZED",
"name": { "str": "Disorganized" },
"points": -3,
"description": "You are terrible at organizing and storing your possessions. You can carry 40% less volume.",
"points": -1,
"description": "You are terrible at organizing and storing your possessions. You retrieve things from containers 10% slower.",
"obtain_cost_multiplier": 1.1,
"starting_trait": true,
"valid": false,
"cancels": [ "PACKMULE" ]
Expand Down
1 change: 1 addition & 0 deletions src/character.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6879,6 +6879,7 @@ mutation_value_map = {
{ "map_memory_capacity_multiplier", calc_mutation_value_multiplicative<&mutation_branch::map_memory_capacity_multiplier> },
{ "reading_speed_multiplier", calc_mutation_value_multiplicative<&mutation_branch::reading_speed_multiplier> },
{ "skill_rust_multiplier", calc_mutation_value_multiplicative<&mutation_branch::skill_rust_multiplier> },
{ "obtain_cost_multiplier", calc_mutation_value_multiplicative<&mutation_branch::obtain_cost_multiplier> },
{ "consume_time_modifier", calc_mutation_value_multiplicative<&mutation_branch::consume_time_modifier> }
};

Expand Down
2 changes: 2 additions & 0 deletions src/item_contents.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ class item_contents
int best_quality( const quality_id &id ) const;

// what will the move cost be of taking @it out of this container?
// should only be used from item_location if possible, to account for
// player inventory handling penalties from traits
int obtain_cost( const item &it ) const;
// what will the move cost be of storing @it into this container? (CONTAINER pocket type)
int insert_cost( const item &it ) const;
Expand Down
3 changes: 2 additions & 1 deletion src/item_location.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,8 @@ class item_location::impl::item_in_container : public item_location::impl
// TODO: Differentiate holsters from backpacks
parent_obtain_cost /= 2;
}
return ch.item_handling_cost( *target(), true, container_mv ) +
return ch.mutation_value( "obtain_cost_multiplier" ) *
ch.item_handling_cost( *target(), true, container_mv ) +
// we aren't "obtaining" the parent item, just digging through it
parent_obtain_cost;
}
Expand Down
2 changes: 2 additions & 0 deletions src/mutation.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,8 @@ struct mutation_branch {
float fatigue_regen_modifier = 0.0f;
// Modifier for the rate at which stamina regenerates.
float stamina_regen_modifier = 0.0f;
// the modifier for obtaining an item from a container as a handling penalty
float obtain_cost_multiplier = 1.0f;

// Adjusts sight range on the overmap. Positives make it farther, negatives make it closer.
float overmap_sight = 0.0f;
Expand Down
1 change: 1 addition & 0 deletions src/mutation_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ void mutation_branch::load( const JsonObject &jo, const std::string & )
optional( jo, was_loaded, "fatigue_modifier", fatigue_modifier, 0.0f );
optional( jo, was_loaded, "fatigue_regen_modifier", fatigue_regen_modifier, 0.0f );
optional( jo, was_loaded, "stamina_regen_modifier", stamina_regen_modifier, 0.0f );
optional( jo, was_loaded, "obtain_cost_multiplier", obtain_cost_multiplier, 1.0f );
optional( jo, was_loaded, "overmap_sight", overmap_sight, 0.0f );
optional( jo, was_loaded, "overmap_multiplier", overmap_multiplier, 1.0f );
optional( jo, was_loaded, "map_memory_capacity_multiplier", map_memory_capacity_multiplier, 1.0f );
Expand Down
2 changes: 1 addition & 1 deletion src/npc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2765,7 +2765,7 @@ bool npc::dispose_item( item_location &&obj, const std::string & )
if( e.can_holster( *obj ) ) {
auto ptr = dynamic_cast<const holster_actor *>( e.type->get_use( "holster" )->get_actor_ptr() );
opts.emplace_back( dispose_option {
item_store_cost( *obj, e, false, e.contents.obtain_cost( *obj ) ),
item_store_cost( *obj, e, false, obj.obtain_cost( *this ) ),
[this, ptr, &e, &obj]{ ptr->store( *this, e, *obj ); }
} );
}
Expand Down

0 comments on commit d195589

Please sign in to comment.