Skip to content

Commit

Permalink
Mi-go furnitures contain a fetid goop that can mask your scent (#36160)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fris0uman authored and ZhilkinSerg committed Jan 4, 2020
1 parent eb750c3 commit 235601a
Show file tree
Hide file tree
Showing 18 changed files with 250 additions and 5 deletions.
23 changes: 23 additions & 0 deletions data/json/effects.json
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,12 @@
"name": [ "Assisted" ],
"desc": [ "You're receiving assistance to practice a surgery." ]
},
{
"type": "effect_type",
"id": "masked_scent",
"name": [ "Masked scent" ],
"desc": [ "Your scent is masked by another one." ]
},
{
"type": "effect_type",
"id": "got_checked",
Expand Down Expand Up @@ -1867,6 +1873,23 @@
},
"show_in_info": true
},
{
"type": "effect_type",
"id": "fetid_goop",
"name": [ "Covered in fetid goop" ],
"desc": [ "The feeling of the goop slowly sliding on your skin revulses you and the smell makes you gag." ],
"apply_message": "You're disgusted by the goop.",
"rating": "bad",
"base_mods": {
"str_mod": [ -1 ],
"per_mod": [ -1 ],
"dex_mod": [ -1 ],
"int_mod": [ -1 ],
"speed_mod": [ -10 ],
"vomit_chance": [ 100 ]
},
"show_in_info": true
},
{
"type": "effect_type",
"id": "has_og_comm_freq"
Expand Down
43 changes: 38 additions & 5 deletions data/json/furniture_and_terrain/furniture-migo.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,14 @@
"light_emitted": 15,
"required_str": -1,
"flags": [ "TRANSPARENT" ],
"bash": { "str_min": 8, "str_max": 20, "sound": "splorch!", "sound_fail": "whump!", "furn_set": "f_alien_scar" }
"bash": {
"str_min": 8,
"str_max": 20,
"sound": "splorch!",
"sound_fail": "whump!",
"furn_set": "f_alien_scar",
"items": [ { "item": "fetid_goop", "count": [ 3, 5 ], "prob": 100 } ]
}
},
{
"type": "furniture",
Expand All @@ -26,7 +33,14 @@
"light_emitted": 3,
"flags": [ "TRANSPARENT", "EMITTER" ],
"emissions": [ "emit_hot_air_migo_seep" ],
"bash": { "str_min": 13, "str_max": 26, "sound": "splorch!", "sound_fail": "whump!", "furn_set": "f_alien_scar" }
"bash": {
"str_min": 13,
"str_max": 26,
"sound": "splorch!",
"sound_fail": "whump!",
"furn_set": "f_alien_scar",
"items": [ { "item": "fetid_goop", "count": [ 3, 7 ], "prob": 100 } ]
}
},
{
"type": "furniture",
Expand All @@ -41,7 +55,14 @@
"flags": [ "TRANSPARENT", "EMITTER" ],
"emissions": [ "emit_migo_atmosphere", "emit_hot_air_migo_blast" ],
"//": "TODO: Make a custom toxic gas emission that is not visible to the player",
"bash": { "str_min": 30, "str_max": 60, "sound": "splorch!", "sound_fail": "whump!", "furn_set": "f_alien_scar" }
"bash": {
"str_min": 30,
"str_max": 60,
"sound": "splorch!",
"sound_fail": "whump!",
"furn_set": "f_alien_scar",
"items": [ { "item": "fetid_goop", "count": [ 15, 25 ], "prob": 100 } ]
}
},
{
"type": "furniture",
Expand Down Expand Up @@ -71,7 +92,13 @@
"flags": [ "TRANSPARENT", "EMITTER" ],
"emissions": [ "emit_hot_air_migo_seep", "emit_shock_burst" ],
"//": "TODO: Make a custom toxic gas emission that is not visible to the player",
"bash": { "str_min": 250, "str_max": 600, "sound": "splorch!", "sound_fail": "splat!" }
"bash": {
"str_min": 250,
"str_max": 600,
"sound": "splorch!",
"sound_fail": "splat!",
"items": [ { "item": "fetid_goop", "count": [ 6, 13 ], "prob": 100 } ]
}
},
{
"type": "furniture",
Expand All @@ -84,7 +111,13 @@
"coverage": 40,
"required_str": -1,
"flags": [ "TRANSPARENT" ],
"bash": { "str_min": 25, "str_max": 60, "sound": "splorch!", "sound_fail": "whump." }
"bash": {
"str_min": 25,
"str_max": 60,
"sound": "splorch!",
"sound_fail": "whump.",
"items": [ { "item": "fetid_goop", "count": [ 5, 10 ], "prob": 100 } ]
}
},
{
"type": "furniture",
Expand Down
5 changes: 5 additions & 0 deletions data/json/item_actions.json
Original file line number Diff line number Diff line change
Expand Up @@ -1039,6 +1039,11 @@
"id": "reveal_map",
"name": "Read"
},
{
"type": "item_action",
"id": "change_scent",
"name": "Mask scent"
},
{
"type": "item_action",
"id": "unfold_vehicle",
Expand Down
18 changes: 18 additions & 0 deletions data/json/items/biosignatures.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,23 @@
"name": "roach dirt",
"copy-from": "feces_bird",
"description": "Large black pellets of rotting material."
},
{
"type": "GENERIC",
"id": "fetid_goop",
"symbol": "~",
"color": "white",
"name": "fetid goop",
"weight": "750 g",
"volume": "1 L",
"description": "A foul smelling goop. It has a disgusting texture and a powerful smell that overrides every other smell around it.",
"use_action": {
"type": "change_scent",
"scent_typeid": "sc_fetid",
"moves": 200,
"duration": "1 h",
"charges_to_use": 1,
"effects": [ { "id": "fetid_goop", "duration": 3600 } ]
}
}
]
6 changes: 6 additions & 0 deletions data/json/monsters/mi-go.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"vision_night": 20,
"harvest": "zombie_meatslug",
"path_settings": { "max_dist": 50 },
"scents_ignored": [ "sc_fetid" ],
"special_attacks": [
[ "PARROT", 0 ],
{ "id": "scratch", "damage_max_instance": [ { "damage_type": "cut", "amount": 23, "armor_multiplier": 0.8 } ] }
Expand Down Expand Up @@ -74,6 +75,7 @@
"vision_night": 20,
"harvest": "zombie_meatslug",
"path_settings": { "max_dist": 50 },
"scents_ignored": [ "sc_fetid" ],
"special_attacks": [
[ "PARROT", 0 ],
{ "id": "scratch", "damage_max_instance": [ { "damage_type": "cut", "amount": 23, "armor_multiplier": 0.8 } ] },
Expand Down Expand Up @@ -122,6 +124,7 @@
"vision_night": 20,
"harvest": "zombie_meatslug",
"path_settings": { "max_dist": 50 },
"scents_ignored": [ "sc_fetid" ],
"special_attacks": [
[ "PARROT", 2 ],
{ "id": "scratch", "damage_max_instance": [ { "damage_type": "cut", "amount": 12, "armor_multiplier": 0.4 } ] }
Expand Down Expand Up @@ -169,6 +172,7 @@
"vision_night": 20,
"harvest": "zombie_meatslug",
"path_settings": { "max_dist": 50 },
"scents_ignored": [ "sc_fetid" ],
"special_attacks": [
[ "PARROT", 5 ],
[ "SHRIEK_ALERT", 5 ],
Expand Down Expand Up @@ -220,6 +224,7 @@
"vision_night": 25,
"harvest": "zombie_meatslug",
"path_settings": { "max_dist": 50 },
"scents_ignored": [ "sc_fetid" ],
"special_attacks": [
[ "PARROT", 5 ],
[ "LONGSWIPE", 12 ],
Expand Down Expand Up @@ -270,6 +275,7 @@
"vision_night": 25,
"harvest": "zombie_meatslug",
"path_settings": { "max_dist": 50 },
"scents_ignored": [ "sc_fetid" ],
"special_attacks": [
{
"type": "gun",
Expand Down
27 changes: 27 additions & 0 deletions data/json/scent_types.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,32 @@
"type": "scent_type",
"id": "sc_flower",
"receptive_species": [ "MAMMAL", "INSECT", "MOLLUSK", "BIRD" ]
},
{
"type": "scent_type",
"id": "sc_fetid",
"receptive_species": [
"MAMMAL",
"BIRD",
"AMPHIBIAN",
"REPTILE",
"FISH",
"MUTANT",
"NETHER",
"BLOB",
"FUNGUS",
"INSECT",
"SPIDER",
"PLANT",
"MOLLUSK",
"WORM",
"ZOMBIE",
"ROBOT",
"HORROR",
"ABERRATION",
"HALLUCINATION",
"HUMAN",
"UNKNOWN"
]
}
]
10 changes: 10 additions & 0 deletions doc/JSON_INFO.md
Original file line number Diff line number Diff line change
Expand Up @@ -1875,6 +1875,16 @@ The contents of use_action fields can either be a string indicating a built-in f
"emp_blast_radius": 4,
"scrambler_blast_radius": 4
},
"use_action": {
"type": "change_scent", // Change the scent type of the user.
"scent_typeid": "sc_fetid", // The scenttype_id of the new scent.
"charges_to_use": 2, // Charges consumed when the item is used. (Default: 1)
"scent_mod": 150, // Modifier added to the scent intensity. (Default: 0)
"duration": "6 m", // How long does the effect last.
"effects": [ { "id": "fetid_goop", "duration": 360, "bp": "TORSO", "permanent": true } ], // List of effects with their id, duration, bodyparts, and permanent bool
"waterproof": true, // Is the effect waterproof. (Default: false)
"moves": 500 // Number of moves required in the process.
},
"use_action": {
"type": "unfold_vehicle", // Transforms the item into a vehicle.
"vehicle_name": "bicycle", // Vehicle name to create.
Expand Down
5 changes: 5 additions & 0 deletions doc/MONSTERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ The numeric part of the string must be an integer. Use the largest unit you can

List of scenttype_id tracked by this monster. scent_types are defined in scent_types.json

## "scent_ignored"
(array of strings, optional)

List of scenttype_id ignored by this monster. scent_types are defined in scent_types.json

## "symbol", "color"
(string)

Expand Down
12 changes: 12 additions & 0 deletions src/character.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6452,6 +6452,18 @@ scenttype_id Character::get_type_of_scent() const
return type_of_scent;
}

void Character::restore_scent()
{
const std::string prev_scent = get_value( "prev_scent" );
if( !prev_scent.empty() ) {
remove_effect( efftype_id( "masked_scent" ) );
set_type_of_scent( scenttype_id( prev_scent ) );
remove_value( "prev_scent" );
remove_value( "waterproof_scent" );
add_msg_if_player( m_info, _( "You smell like yourself again." ) );
}
}

void Character::spores()
{
fungal_effects fe( *g, g->m );
Expand Down
2 changes: 2 additions & 0 deletions src/character.h
Original file line number Diff line number Diff line change
Expand Up @@ -1420,6 +1420,8 @@ class Character : public Creature, public visitable<Character>
void update_type_of_scent( trait_id mut, bool gain = true );
void set_type_of_scent( scenttype_id id );
scenttype_id get_type_of_scent() const;
/**restore scent after masked_scent effect run out or is removed by water*/
void restore_scent();
/** Modifies intensity of painkillers */
void mod_painkiller( int npkill );
/** Sets intensity of painkillers */
Expand Down
1 change: 1 addition & 0 deletions src/item_factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,7 @@ void Item_factory::init()
add_actor( std::make_unique<pick_lock_actor>() );
add_actor( std::make_unique<deploy_furn_actor>() );
add_actor( std::make_unique<place_monster_iuse>() );
add_actor( std::make_unique<change_scent_iuse>() );
add_actor( std::make_unique<place_npc_iuse>() );
add_actor( std::make_unique<reveal_map_actor>() );
add_actor( std::make_unique<salvage_actor>() );
Expand Down
41 changes: 41 additions & 0 deletions src/iuse_actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4748,3 +4748,44 @@ std::unique_ptr<iuse_actor> sew_advanced_actor::clone() const
{
return std::make_unique<sew_advanced_actor>( *this );
}

void change_scent_iuse::load( const JsonObject &obj )
{
scenttypeid = scenttype_id( obj.get_string( "scent_typeid" ) );
if( !scenttypeid.is_valid() ) {
obj.throw_error( "Invalid scent type id.", "scent_typeid" );
}
if( obj.has_array( "effects" ) ) {
for( JsonObject e : obj.get_array( "effects" ) ) {
effects.push_back( load_effect_data( e ) );
}
}
assign( obj, "moves", moves );
assign( obj, "charges_to_use", charges_to_use );
assign( obj, "scent_mod", scent_mod );
assign( obj, "duration", duration );
assign( obj, "waterproof", waterproof );
}

int change_scent_iuse::use( player &p, item &it, bool, const tripoint & ) const
{
p.set_value( "prev_scent", p.get_type_of_scent().c_str() );
if( waterproof ) {
p.set_value( "waterproof_scent", "true" );
}
p.add_effect( efftype_id( "masked_scent" ), duration, num_bp, false, scent_mod );
p.set_type_of_scent( scenttypeid );
p.mod_moves( -moves );
add_msg( m_info, _( "You use the %s to mask your scent" ), it.tname() );

// Apply the various effects.
for( const auto &eff : effects ) {
p.add_effect( eff.id, eff.duration, eff.bp, eff.permanent );
}
return charges_to_use;
}

std::unique_ptr<iuse_actor> change_scent_iuse::clone() const
{
return std::make_unique<change_scent_iuse>( *this );
}
28 changes: 28 additions & 0 deletions src/iuse_actor.h
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,34 @@ class place_monster_iuse : public iuse_actor
std::unique_ptr<iuse_actor> clone() const override;
};

/**
* This iuse contains the logic to change one's scent.
*/
class change_scent_iuse : public iuse_actor
{
public:
/** The scent type id of the new scent. */
scenttype_id scenttypeid;
/** How many move points this action takes. */
int moves = 100;
/**How many charge are consumed on use*/
int charges_to_use = 1;
/**Scent value modifier*/
int scent_mod = 0;
/**How long does the scent stays*/
time_duration duration;
/**Is the scent mask waterproof*/
bool waterproof = false;
/**Side effect of using the item*/
std::vector<effect_data> effects;

change_scent_iuse() : iuse_actor( "change_scent" ) { }
~change_scent_iuse() override = default;
void load( const JsonObject &obj ) override;
int use( player &, item &, bool, const tripoint & ) const override;
std::unique_ptr<iuse_actor> clone() const override;
};

/**
* This iuse contains the logic to summon an npc on the map.
*/
Expand Down
6 changes: 6 additions & 0 deletions src/monmove.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1065,6 +1065,7 @@ tripoint monster::scent_move()
}

const std::set<scenttype_id> &tracked_scents = type->scents_tracked;
const std::set<scenttype_id> &ignored_scents = type->scents_ignored;

std::vector<tripoint> smoves;

Expand Down Expand Up @@ -1106,6 +1107,11 @@ tripoint monster::scent_move()
right_scent = true;
}
}
// is the monster actually ignoring this scent
if( !ignored_scents.empty() && ( ignored_scents.find( type_scent ) != ignored_scents.end() ) ) {
right_scent = false;
}


if( ( !fleeing && smell < bestsmell ) || ( fleeing && smell > bestsmell ) || !right_scent ) {
continue;
Expand Down
Loading

0 comments on commit 235601a

Please sign in to comment.