Skip to content

Commit

Permalink
feat(balance): Make Stylish trait the default behavior, add Unstylish…
Browse files Browse the repository at this point in the history
… trait (#5826)

* Make Stylish default behavior

* Fix docs and npc generation

* style(autofix.ci): automated formatting

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
  • Loading branch information
RobbieNeko and autofix-ci[bot] authored Dec 22, 2024
1 parent 22673e8 commit c21d7d0
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 22 deletions.
4 changes: 2 additions & 2 deletions data/json/flags.json
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@
"id": "FANCY",
"type": "json_flag",
"context": [ "ARMOR", "TOOL_ARMOR" ],
"//": "Wearing this clothing gives a morale bonus if the player has the Stylish trait.",
"//": "Wearing this clothing gives a morale bonus if the player doesn't have the Fashion Deficient trait.",
"info": "This clothing is <info>fancy</info>.",
"conflicts": [ "SUPER_FANCY" ]
},
Expand Down Expand Up @@ -798,7 +798,7 @@
"id": "SUPER_FANCY",
"type": "json_flag",
"context": [ "ARMOR", "TOOL_ARMOR" ],
"//": "Gives an additional moral bonus over FANCY if the player has the Stylish trait.",
"//": "Gives an additional moral bonus over FANCY if the player doesn't have the Fashion Deficient trait.",
"info": "This clothing is <info>very fancy</info>.",
"conflicts": [ "FANCY" ]
},
Expand Down
8 changes: 4 additions & 4 deletions data/json/mutations/mutations.json
Original file line number Diff line number Diff line change
Expand Up @@ -502,10 +502,10 @@
},
{
"type": "mutation",
"id": "STYLISH",
"name": { "str": "Stylish" },
"points": 2,
"description": "Practicality is far less important than style. Your morale is improved by wearing fashionable and attractive clothing.",
"id": "UNSTYLISH",
"name": { "str": "Fashion Deficient" },
"points": -1,
"description": "You have no sense of style, and don't care about wearing anything 'fancy'; you'd be perfectly happy to wear non-matching socks, or wear socks and sandals. You get no morale bonus from fancy equipment.",
"starting_trait": true,
"valid": false
},
Expand Down
2 changes: 1 addition & 1 deletion data/json/npcs/starting_traits.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
{ "trait": "ROBUST", "prob": 10 },
{ "trait": "SELFAWARE", "prob": 10 },
{ "trait": "SPIRITUAL", "prob": 10 },
{ "trait": "STYLISH", "prob": 10 },
{ "trait": "UNSTYLISH", "prob": 10 },
{ "trait": "TERRIFYING", "prob": 10 },
{ "trait": "ALBINO", "prob": 1 },
{ "trait": "ASTHMA", "prob": 10 },
Expand Down
8 changes: 8 additions & 0 deletions data/json/obsoletion/mutations.json
Original file line number Diff line number Diff line change
Expand Up @@ -238,5 +238,13 @@
"points": 1,
"description": "This mutation has been obsoleted due to the hidden movement speed penalty being removed. If you see this on a profession or mutate this trait, this is a bug.",
"valid": false
},
{
"type": "mutation",
"id": "STYLISH",
"name": { "str": "Stylish" },
"points": 2,
"description": "Obsoleted due to becoming default behavior.",
"valid": false
}
]
2 changes: 1 addition & 1 deletion data/mods/Aftershock/npcs/Backgrounds/trait_groups.json
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,7 @@
{ "trait": "ROBUST", "prob": 10 },
{ "trait": "SELFAWARE", "prob": 10 },
{ "trait": "SPIRITUAL", "prob": 10 },
{ "trait": "STYLISH", "prob": 10 },
{ "trait": "UNSTYLISH", "prob": 10 },
{ "trait": "ALBINO", "prob": 5 },
{ "trait": "ASTHMA", "prob": 5 },
{ "trait": "CHEMIMBALANCE", "prob": 10 },
Expand Down
2 changes: 1 addition & 1 deletion data/mods/Aftershock/npcs/mutant_npcs/trait_groups.json
Original file line number Diff line number Diff line change
Expand Up @@ -899,7 +899,7 @@
{ "trait": "ROBUST", "prob": 10 },
{ "trait": "SELFAWARE", "prob": 10 },
{ "trait": "SPIRITUAL", "prob": 10 },
{ "trait": "STYLISH", "prob": 10 },
{ "trait": "UNSTYLISH", "prob": 10 },
{ "trait": "ALBINO", "prob": 5 },
{ "trait": "ASTHMA", "prob": 5 },
{ "trait": "CHEMIMBALANCE", "prob": 10 },
Expand Down
6 changes: 4 additions & 2 deletions doc/src/content/docs/en/mod/json/reference/json_flags.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,8 @@ to find which flags work elsewhere.
- `COLLAR` This piece of clothing has a wide collar that can keep your mouth warm.
- `DEAF` Makes the player deaf.
- `ELECTRIC_IMMUNE` This gear completely protects you from electric discharges.
- `FANCY` Wearing this clothing gives a morale bonus if the player has the `Stylish` trait.
- `FANCY` Wearing this clothing gives a morale bonus if the player doesn't have the
`Fashion Deficient` trait.
- `FIX_FARSIGHT` This gear corrects farsightedness.
- `FIX_NEARSIGHT` This gear corrects nearsightedness.
- `FLOTATION` Prevents the player from drowning in deep water. Also prevents diving underwater.
Expand Down Expand Up @@ -249,7 +250,8 @@ to find which flags work elsewhere.
0.70.
- `STURDY` This clothing is a lot more resistant to damage than normal.
- `SUN_GLASSES` Prevents glaring when in sunlight.
- `SUPER_FANCY` Gives an additional moral bonus over `FANCY` if the player has the `Stylish` trait.
- `SUPER_FANCY` Gives an additional moral bonus over `FANCY` if the player doesn't have the
`Fashion Deficient` trait.
- `SWIM_GOGGLES` Allows you to see much further under water.
- `THERMOMETER` This gear is equipped with an accurate thermometer (which is used to measure
temperature).
Expand Down
12 changes: 6 additions & 6 deletions src/morale.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ static const trait_id trait_OPTIMISTIC( "OPTIMISTIC" );
static const trait_id trait_ROOTS1( "ROOTS1" );
static const trait_id trait_ROOTS2( "ROOTS2" );
static const trait_id trait_ROOTS3( "ROOTS3" );
static const trait_id trait_STYLISH( "STYLISH" );
static const trait_id trait_UNSTYLISH( "UNSTYLISH" );

namespace io
{
Expand Down Expand Up @@ -269,7 +269,7 @@ player_morale::player_morale() :
level_is_valid( false ),
took_prozac( false ),
took_prozac_bad( false ),
stylish( false ),
stylish( true ),
perceived_pain( 0 )
{
using namespace std::placeholders;
Expand All @@ -288,9 +288,9 @@ player_morale::player_morale() :
mutations[trait_BADTEMPER] = mutation_data(
std::bind( set_badtemper, _1, -9 ),
std::bind( set_badtemper, _1, 0 ) );
mutations[trait_STYLISH] = mutation_data(
std::bind( set_stylish, _1, true ),
std::bind( set_stylish, _1, false ) );
mutations[trait_UNSTYLISH] = mutation_data(
std::bind( set_stylish, _1, false ),
std::bind( set_stylish, _1, true ) );
mutations[trait_FLOWERS] = mutation_data( update_constrained );
mutations[trait_ROOTS1] = mutation_data( update_constrained );
mutations[trait_ROOTS2] = mutation_data( update_constrained );
Expand Down Expand Up @@ -892,7 +892,7 @@ void player_morale::clear()
}
took_prozac = false;
took_prozac_bad = false;
stylish = false;
stylish = true;
super_fancy_items.clear();

invalidate();
Expand Down
11 changes: 6 additions & 5 deletions tests/morale_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,13 +179,18 @@ TEST_CASE( "player_morale", "[morale]" )
m.on_item_wear( heels );

WHEN( "not a stylish person" ) {
m.on_mutation_gain( trait_id( "UNSTYLISH" ) );
THEN( "just don't care (even if man)" ) {
CHECK( m.get_level() == 0 );
}

AND_WHEN( "not anymore" ) {
m.on_mutation_loss( trait_id( "UNSTYLISH" ) );
CHECK( m.get_level() == 19 );
}
}

WHEN( "a stylish person" ) {
m.on_mutation_gain( trait_id( "STYLISH" ) );

CHECK( m.get_level() == 19 );

Expand Down Expand Up @@ -216,10 +221,6 @@ TEST_CASE( "player_morale", "[morale]" )
CHECK( m.get_level() == 20 );
}
}
AND_WHEN( "not anymore" ) {
m.on_mutation_loss( trait_id( "STYLISH" ) );
CHECK( m.get_level() == 0 );
}
}
}

Expand Down

0 comments on commit c21d7d0

Please sign in to comment.