Skip to content

Commit

Permalink
Revamped Free Start (CleverRaven#64697)
Browse files Browse the repository at this point in the history
* Add difficulty info to character creation screen

* Remove some difficulty impact refs

* Working needs to be refactored

Basic UI Changes and freeform upgrades

* Refactored and working, might need balance

* Added option for debug

* Last few bits of cleanup

* Fixes

* more fixes

* more fixing without compiling

* more cleanup of unused

* FIX CLANG

* spacing

Consolidated descriptors, added 1 additional band, Lifestyle

Co-Authored-By: pfj <[email protected]>
Co-Authored-By: Terrorforge <[email protected]>
Co-Authored-By: PatrikLundell <[email protected]>

---------

Co-authored-by: David Seguin <[email protected]>
Co-authored-by: pfj <[email protected]>
Co-authored-by: Terrorforge <[email protected]>
Co-authored-by: PatrikLundell <[email protected]>
  • Loading branch information
5 people authored and Maleclypse committed Apr 6, 2023
1 parent abb4ea0 commit ed2ea6a
Show file tree
Hide file tree
Showing 8 changed files with 735 additions and 245 deletions.
2 changes: 2 additions & 0 deletions src/avatar.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ class avatar : public Character

// newcharacter.cpp
bool create( character_type type, const std::string &tempname = "" );
// initialize avatar and avatar mocks
void initialize( character_type type );
void add_profession_items();
void randomize( bool random_scenario, bool play_now = false );
void randomize_cosmetics();
Expand Down
4 changes: 4 additions & 0 deletions src/character.h
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,10 @@ class Character : public Creature, public visitable
Character &operator=( const Character & ) = delete;
~Character() override;

// initialize avatar and avatar mocks
void initialize();


Character *as_character() override {
return this;
}
Expand Down
416 changes: 222 additions & 194 deletions src/newcharacter.cpp

Large diffs are not rendered by default.

109 changes: 60 additions & 49 deletions src/npc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1560,39 +1560,71 @@ void npc::invalidate_range_cache()

void npc::form_opinion( const Character &you )
{
op_of_u = get_opinion_values( you );

decide_needs();
for( const npc_need &i : needs ) {
if( i == need_food || i == need_drink ) {
op_of_u.value += 2;
}
}

if( op_of_u.fear < personality.bravery + 10 &&
op_of_u.fear - personality.aggression > -10 && op_of_u.trust > -8 ) {
set_attitude( NPCATT_TALK );
} else if( op_of_u.fear - 2 * personality.aggression - personality.bravery < -30 ) {
set_attitude( NPCATT_KILL );
} else if( my_fac && my_fac->likes_u < -10 ) {
if( is_player_ally() ) {
mutiny();
}
set_attitude( NPCATT_KILL );
} else {
set_attitude( NPCATT_FLEE_TEMP );
}

add_msg_debug( debugmode::DF_NPC, "%s formed an opinion of you: %s", get_name(),
npc_attitude_id( attitude ) );
}

npc_opinion npc::get_opinion_values( const Character &you ) const
{
npc_opinion npc_values = op_of_u;


const item_location weapon = you.get_wielded_item();
// FEAR
if( !you.is_armed() ) {
// Unarmed, but actually unarmed ("unarmed weapons" are not unarmed)
op_of_u.fear -= 3;
npc_values.fear -= 3;
} else if( weapon->is_gun() ) {
// TODO: Make bows not guns
if( weapon->has_flag( flag_PRIMITIVE_RANGED_WEAPON ) ) {
op_of_u.fear += 2;
npc_values.fear += 2;
} else {
op_of_u.fear += 6;
npc_values.fear += 6;
}
} else if( you.weapon_value( *weapon ) > 20 ) {
op_of_u.fear += 2;
npc_values.fear += 2;
}

///\EFFECT_STR increases NPC fear of the player
if( you.str_max >= 16 ) {
op_of_u.fear += 2;
npc_values.fear += 2;
} else if( you.str_max >= 12 ) {
op_of_u.fear += 1;
npc_values.fear += 1;
} else if( you.str_max <= 3 ) {
op_of_u.fear -= 3;
npc_values.fear -= 3;
} else if( you.str_max <= 5 ) {
op_of_u.fear -= 1;
npc_values.fear -= 1;
}

// is your health low
for( const std::pair<const bodypart_str_id, bodypart> &elem : get_player_character().get_body() ) {
const int hp_max = elem.second.get_hp_max();
const int hp_cur = elem.second.get_hp_cur();
if( hp_cur <= hp_max / 2 ) {
op_of_u.fear--;
npc_values.fear--;
}
}

Expand All @@ -1601,15 +1633,15 @@ void npc::form_opinion( const Character &you )
const int hp_max = elem.second.get_hp_max();
const int hp_cur = elem.second.get_hp_cur();
if( hp_cur <= hp_max / 2 ) {
op_of_u.fear++;
npc_values.fear++;
}
}

if( you.has_trait( trait_SAPIOVORE ) ) {
op_of_u.fear += 10; // Sapiovores = Scary
npc_values.fear += 10; // Sapiovores = Scary
}
if( you.has_trait( trait_TERRIFYING ) ) {
op_of_u.fear += 6;
npc_values.fear += 6;
}

int u_ugly = 0;
Expand All @@ -1623,79 +1655,58 @@ void npc::form_opinion( const Character &you )
u_ugly += bp->ugliness_mandatory;
u_ugly += bp->ugliness - ( bp->ugliness * worn.get_coverage( bp ) / 100 );
}
op_of_u.fear += u_ugly / 2;
op_of_u.trust -= u_ugly / 3;
npc_values.fear += u_ugly / 2;
npc_values.trust -= u_ugly / 3;

if( you.get_stim() > 20 ) {
op_of_u.fear++;
npc_values.fear++;
}

if( you.has_effect( effect_drunk ) ) {
op_of_u.fear -= 2;
npc_values.fear -= 2;
}

// TRUST
if( op_of_u.fear > 0 ) {
op_of_u.trust -= 3;
npc_values.trust -= 3;
} else {
op_of_u.trust += 1;
npc_values.trust += 1;
}

if( weapon && weapon->is_gun() ) {
op_of_u.trust -= 2;
npc_values.trust -= 2;
} else if( !you.is_armed() ) {
op_of_u.trust += 2;
npc_values.trust += 2;
}

// TODO: More effects
if( you.has_effect( effect_high ) ) {
op_of_u.trust -= 1;
npc_values.trust -= 1;
}
if( you.has_effect( effect_drunk ) ) {
op_of_u.trust -= 2;
npc_values.trust -= 2;
}
if( you.get_stim() > 20 || you.get_stim() < -20 ) {
op_of_u.trust -= 1;
npc_values.trust -= 1;
}
if( you.get_painkiller() > 30 ) {
op_of_u.trust -= 1;
npc_values.trust -= 1;
}

if( op_of_u.trust > 0 ) {
// Trust is worth a lot right now
op_of_u.trust /= 2;
npc_values.trust /= 2;
}

// VALUE
op_of_u.value = 0;
npc_values.value = 0;
for( const std::pair<const bodypart_str_id, bodypart> &elem : get_body() ) {
if( elem.second.get_hp_cur() < elem.second.get_hp_max() * 0.8f ) {
op_of_u.value++;
}
}
decide_needs();
for( const npc_need &i : needs ) {
if( i == need_food || i == need_drink ) {
op_of_u.value += 2;
npc_values.value++;
}
}

if( op_of_u.fear < personality.bravery + 10 &&
op_of_u.fear - personality.aggression > -10 && op_of_u.trust > -8 ) {
set_attitude( NPCATT_TALK );
} else if( op_of_u.fear - 2 * personality.aggression - personality.bravery < -30 ) {
set_attitude( NPCATT_KILL );
} else if( my_fac && my_fac->likes_u < -10 ) {
if( is_player_ally() ) {
mutiny();
}
set_attitude( NPCATT_KILL );
} else {
set_attitude( NPCATT_FLEE_TEMP );
}

add_msg_debug( debugmode::DF_NPC, "%s formed an opinion of you: %s", get_name(),
npc_attitude_id( attitude ) );
return npc_values;
}

void npc::mutiny()
Expand Down
1 change: 1 addition & 0 deletions src/npc.h
Original file line number Diff line number Diff line change
Expand Up @@ -818,6 +818,7 @@ class npc : public Character

// Interaction with the player
void form_opinion( const Character &you );
npc_opinion get_opinion_values( const Character &you ) const;
std::string pick_talk_topic( const Character &u );
std::string const &get_specified_talk_topic( std::string const &topic_id );
float character_danger( const Character &u ) const;
Expand Down
11 changes: 9 additions & 2 deletions src/options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2633,8 +2633,8 @@ void options_manager::add_options_world_default()

add( "CHARACTER_POINT_POOLS", "world_default", to_translation( "Character point pools" ),
to_translation( "Allowed point pools for character generation." ),
{ { "any", to_translation( "Any" ) }, { "multi_pool", to_translation( "Multi-pool only" ) }, { "no_freeform", to_translation( "No freeform" ) } },
"any"
{ { "any", to_translation( "Any" ) }, { "multi_pool", to_translation( "Legacy Multipool" ) }, { "story_teller", to_translation( "Survivor" ) } },
"story_teller"
);

add_empty_line();
Expand Down Expand Up @@ -2680,6 +2680,13 @@ void options_manager::add_options_debug()

add_empty_line();

add( "DEBUG_DIFFICULTIES", "debug", to_translation( "Show values for character creation" ),
to_translation( "In character creation will show the underlying value that is used to determine difficulty." ),
false
);

add_empty_line();

add( "SKILL_TRAINING_SPEED", "debug", to_translation( "Skill training speed" ),
to_translation( "Scales experience gained from practicing skills and reading books. 0.5 is half as fast as default, 2.0 is twice as fast, 0.0 disables skill training except for NPC training." ),
0.0, 100.0, 1.0, 0.1
Expand Down
Loading

0 comments on commit ed2ea6a

Please sign in to comment.