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

Hyper-metabolism rework #45687

Merged
merged 9 commits into from
Dec 5, 2020
Merged
Show file tree
Hide file tree
Changes from 2 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
23 changes: 21 additions & 2 deletions data/json/mutations/mutations.json
Original file line number Diff line number Diff line change
Expand Up @@ -3279,13 +3279,32 @@
"id": "EATHEALTH",
"name": { "str": "Hyper-Metabolism" },
"points": 15,
"description": "You metabolize nutrients so rapidly that you can convert food directly into useful tissue. Excess nutrition will convert to HP, rather than being wasted. Activate to skip prompt for overeating.",
"description": "Your particular metabolism allows you to burn calories at a prodigious rate to regenerate tissues in a matter of minutes, this is however a very wastefull process. Activate to start healing.",
Fris0uman marked this conversation as resolved.
Show resolved Hide resolved
"prereqs": [ "HUNGER3" ],
"types": [ "METABOLISM" ],
"threshreq": [ "THRESH_CHIMERA" ],
"category": [ "CHIMERA" ],
"valid": false,
"active": true
"active": true,
"transform": {
"target": "EATHEALTH_active",
"msg_transform": "Your hyper-metabolism starts burning up calories.",
"active": true,
"moves": 0
}
},
{
"type": "mutation",
"id": "EATHEALTH_active",
"name": { "str": "Hyper-Metabolism: burning" },
"description": "You're burning calories like crazy to heal your wounds.",
"copy-from": "EATHEALTH",
"cost": 3,
"time": 1,
"hunger": true,
"healing_awake": 300.0,
"healing_resting": 350.0,
"transform": { "target": "EATHEALTH", "msg_transform": "Your hyper-metabolism slows down.", "active": false, "moves": 0 }
},
{
"type": "mutation",
Expand Down
3 changes: 1 addition & 2 deletions src/character.h
Original file line number Diff line number Diff line change
Expand Up @@ -471,8 +471,7 @@ class Character : public Creature, public visitable<Character>
virtual int get_hunger() const;
virtual int get_starvation() const;
virtual int get_thirst() const;
/** Gets character's minimum hunger and thirst */
int stomach_capacity() const;

std::pair<std::string, nc_color> get_thirst_description() const;
std::pair<std::string, nc_color> get_hunger_description() const;
std::pair<std::string, nc_color> get_fatigue_description() const;
Expand Down
37 changes: 0 additions & 37 deletions src/consumption.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,23 +143,6 @@ static const std::map<itype_id, int> plut_charges = {
{ itype_id( "plut_slurry" ), PLUTONIUM_CHARGES / 2 }
};

int Character::stomach_capacity() const
{
if( has_trait( trait_GIZZARD ) ) {
return 0;
}

if( has_active_mutation( trait_HIBERNATE ) ) {
return -620;
}

if( has_trait( trait_GOURMAND ) || has_trait( trait_HIBERNATE ) ) {
return -60;
}

return -20;
}

// TODO: Move pizza scraping here.
static int compute_default_effective_kcal( const item &comest, const Character &you,
const cata::flat_set<flag_id> &extra_flags = {} )
Expand Down Expand Up @@ -1342,8 +1325,6 @@ bool Character::consume_effects( item &food )
mod_fatigue( nutr );
}
}
// TODO: remove this
int capacity = stomach_capacity();
// Moved here and changed a bit - it was too complex
// Incredibly minor stuff like this shouldn't require complexity
if( !is_npc() && has_trait( trait_SLIMESPAWNER ) &&
Expand All @@ -1365,24 +1346,6 @@ bool Character::consume_effects( item &food )
add_msg_if_player( m_good, _( "hey, you look like me! let's work together!" ) );
}

// Last thing that happens before capping hunger
if( get_hunger() < capacity && has_trait( trait_EATHEALTH ) ) {
int excess_food = capacity - get_hunger();
add_msg_player_or_npc( _( "You feel the %s filling you out." ),
_( "<npcname> looks better after eating the %s." ),
food.tname() );
// Guaranteed 1 HP healing, no matter what. You're welcome. ;-)
if( excess_food <= 5 ) {
healall( 1 );
} else {
// Straight conversion, except it's divided amongst all your body parts.
healall( excess_food /= 5 );
}

// Note: We want this here to prevent "you can't finish this" messages
set_hunger( capacity );
}

nutrients food_nutrients = compute_effective_nutrients( food );
const units::volume water_vol = ( food.get_comestible()->quench > 0 ) ?
food.get_comestible()->quench *
Expand Down