Skip to content

Commit

Permalink
Merge branch 'trait-flag-improvement' of https://github.com/chaosvolt…
Browse files Browse the repository at this point in the history
…/Cataclysm-BN into trait-flag-improvement
  • Loading branch information
chaosvolt committed Sep 11, 2023
2 parents 91b516e + 3ba4f47 commit 79bdcf5
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 29 deletions.
5 changes: 3 additions & 2 deletions src/character.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3488,8 +3488,9 @@ void Character::practice( const skill_id &id, int amount, int cap, bool suppress
focus_pool -= chance_to_drop / 100;
// Apex Predators don't think about much other than killing.
// They don't lose Focus when practicing combat skills.
if( ( rng( 1, 100 ) <= ( chance_to_drop % 100 ) ) && ( !( has_trait_flag( trait_flag_str_id( "PRED4" ) ) &&
skill.is_combat_skill() ) ) ) {
if( ( rng( 1, 100 ) <= ( chance_to_drop % 100 ) ) &&
( !( has_trait_flag( trait_flag_str_id( "PRED4" ) ) &&
skill.is_combat_skill() ) ) ) {
focus_pool--;
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/magic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,8 @@ float spell::spell_fail( const Character &guy ) const
return 1.0f;
}
float fail_chance = std::pow( ( effective_skill - 30.0f ) / 30.0f, 2 );
if( has_flag( spell_flag::SOMATIC ) && !guy.has_trait_flag( trait_flag_str_id( "SUBTLE_SPELL" ) ) ) {
if( has_flag( spell_flag::SOMATIC ) &&
!guy.has_trait_flag( trait_flag_str_id( "SUBTLE_SPELL" ) ) ) {
// the first 20 points of encumbrance combined is ignored
const int arms_encumb = std::max( 0, guy.encumb( bp_arm_l ) + guy.encumb( bp_arm_r ) - 20 );
// each encumbrance point beyond the "gray" color counts as half an additional fail %
Expand Down
53 changes: 27 additions & 26 deletions src/mondeath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -439,27 +439,28 @@ void mdeath::guilt( monster &z )
guilt_tresholds[25] = _( "You feel remorse for killing %s." );

if( g->u.has_trait( trait_PSYCHOPATH ) || g->u.has_trait_flag( trait_flag_str_id( "PRED3" ) ||
g->u.has_trait_flag( trait_flag_str_id( "PRED4" ) || g->u.has_trait( trait_KILLER ) ) {
return;
}
if( rl_dist( z.pos(), g->u.pos() ) > MAX_GUILT_DISTANCE ) {
// Too far away, we can deal with it.
return;
}
if( z.get_hp() >= 0 ) {
// We probably didn't kill it
return;
}
if( kill_count >= maxKills ) {
// player no longer cares
if( kill_count == maxKills ) {
g->u.has_trait_flag( trait_flag_str_id( "PRED4" ) || g->u.has_trait( trait_KILLER ) ) {

Check failure on line 442 in src/mondeath.cpp

View workflow job for this annotation

GitHub Actions / GCC 12, Ubuntu, Tiles, Sound, Lua, CMake, Languages

cannot convert ‘bool’ to ‘const trait_flag_id&’ {aka ‘const int_id<json_trait_flag>&’}
return;
}
if( rl_dist( z.pos(), g->u.pos() ) > MAX_GUILT_DISTANCE ) {
// Too far away, we can deal with it.
return;
}
if( z.get_hp() >= 0 ) {
// We probably didn't kill it
return;
}
if( kill_count >= maxKills ) {
// player no longer cares
if( kill_count == maxKills ) {
//~ Message after killing a lot of monsters which would normally affect the morale negatively. %s is the monster name, it will be pluralized with a number of 100.
add_msg( m_good, _( "After killing so many bloody %s you no longer care "
"about their deaths anymore." ), z.name( maxKills ) );
}
return;
} else if( ( g->u.has_trait_flag( trait_flag_str_id( "PRED1" ) ) || ( g->u.has_trait_flag( trait_flag_str_id( "PRED2" ) ) ) {
msg = ( _( "Culling the weak is distasteful, but necessary." ) );
} else if( ( g->u.has_trait_flag( trait_flag_str_id( "PRED1" ) ) ||
( g->u.has_trait_flag( trait_flag_str_id( "PRED2" ) ) ) {
msg = ( _( "Culling the weak is distasteful, but necessary." ) );
msgtype = m_neutral;
} else {
msgtype = m_bad;
Expand All @@ -474,20 +475,20 @@ void mdeath::guilt( monster &z )
add_msg( msgtype, msg, z.name() );

Check failure on line 475 in src/mondeath.cpp

View workflow job for this annotation

GitHub Actions / GCC 12, Ubuntu, Tiles, Sound, Lua, CMake, Languages

expected ‘)’ before ‘;’ token

Check failure on line 475 in src/mondeath.cpp

View workflow job for this annotation

GitHub Actions / GCC 12, Ubuntu, Tiles, Sound, Lua, CMake, Languages

suggest braces around empty body in an ‘if’ statement [-Werror=empty-body]

int moraleMalus = -50 * ( 1.0 - ( static_cast<float>( kill_count ) / maxKills ) );
int maxMalus = -250 * ( 1.0 - ( static_cast<float>( kill_count ) / maxKills ) );
time_duration duration = 30_minutes * ( 1.0 - ( static_cast<float>( kill_count ) / maxKills ) );
time_duration decayDelay = 3_minutes * ( 1.0 - ( static_cast<float>( kill_count ) / maxKills ) );
int maxMalus = -250 * ( 1.0 - ( static_cast<float>( kill_count ) / maxKills ) );
time_duration duration = 30_minutes * ( 1.0 - ( static_cast<float>( kill_count ) / maxKills ) );
time_duration decayDelay = 3_minutes * ( 1.0 - ( static_cast<float>( kill_count ) / maxKills ) );
if( z.type->in_species( ZOMBIE ) ) {
moraleMalus /= 10;
if( g->u.has_trait( trait_PACIFIST ) ) {
moraleMalus /= 10;
if( g->u.has_trait( trait_PACIFIST ) ) {
moraleMalus *= 5;
} else if( g->u.has_trait_flag( trait_flag_str_id( "PRED1" ) ) {

Check failure on line 485 in src/mondeath.cpp

View workflow job for this annotation

GitHub Actions / GCC 12, Ubuntu, Tiles, Sound, Lua, CMake, Languages

expected ‘)’ before ‘{’ token
moraleMalus /= 4;
} else if( g->u.has_trait_flag( trait_flag_str_id( "PRED2" ) ) {
moraleMalus /= 5;
}
moraleMalus /= 4;
} else if( g->u.has_trait_flag( trait_flag_str_id( "PRED2" ) ) {
moraleMalus /= 5;
}
g->u.add_morale( MORALE_KILLED_MONSTER, moraleMalus, maxMalus, duration, decayDelay );
}

Check failure on line 490 in src/mondeath.cpp

View workflow job for this annotation

GitHub Actions / GCC 12, Ubuntu, Tiles, Sound, Lua, CMake, Languages

expected primary-expression before ‘}’ token
g->u.add_morale( MORALE_KILLED_MONSTER, moraleMalus, maxMalus, duration, decayDelay );

}

Expand Down

0 comments on commit 79bdcf5

Please sign in to comment.