Skip to content

Commit

Permalink
Merge pull request CleverRaven#19 from lispcoc/variant_jp
Browse files Browse the repository at this point in the history
Hentai MOD用のインターフェースを追加する
  • Loading branch information
roloa authored Apr 18, 2020
2 parents 7525047 + ff03433 commit cdf327c
Show file tree
Hide file tree
Showing 16 changed files with 1,055 additions and 56 deletions.
94 changes: 92 additions & 2 deletions src/activity_handlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,9 @@ static const activity_id ACT_TAKE_WASHLET("ACT_TAKE_WASHLET");
static const activity_id ACT_EXCRETE("ACT_EXCRETE");
static const activity_id ACT_TAKE_SHOWER("ACT_TAKE_SHOWER");

// for hentai
static const activity_id ACT_HENTAI_PLAY_WITH( "ACT_HENTAI_PLAY_WITH" );

static const efftype_id effect_blind( "blind" );
static const efftype_id effect_controlled( "controlled" );
static const efftype_id effect_narcosis( "narcosis" );
Expand All @@ -232,6 +235,10 @@ const efftype_id effect_comfortness( "comfortness" );
const efftype_id effect_ecstasy( "ecstasy" );
const efftype_id effect_maid_fatigue( "maid_fatigue" );

// for hentai
const efftype_id effect_movingdoing( "movingdoing" );
const efftype_id effect_lust( "lust" );

static const zone_type_id zone_type_FARM_PLOT( "FARM_PLOT" );

static const skill_id skill_computer( "computer" );
Expand Down Expand Up @@ -374,7 +381,8 @@ activity_handlers::do_turn_functions = {
{ ACT_LITTLEMAID_SPECIAL, littlemaid_special_do_turn },
{ ACT_TAKE_SHOWER, take_shower_do_turn },
{ ACT_TAKE_WASHLET, take_washlet_do_turn },
{ ACT_EXCRETE, excrete_do_turn }
{ ACT_EXCRETE, excrete_do_turn },
{ ACT_HENTAI_PLAY_WITH, hentai_play_with_do_turn }
};


Expand Down Expand Up @@ -456,7 +464,8 @@ activity_handlers::finish_functions = {
{ ACT_LITTLEMAID_SPECIAL, littlemaid_special_finish },
{ ACT_TAKE_SHOWER, take_shower_finish },
{ ACT_TAKE_WASHLET, take_washlet_finish },
{ ACT_EXCRETE, excrete_finish }
{ ACT_EXCRETE, excrete_finish },
{ ACT_HENTAI_PLAY_WITH, hentai_play_with_finish }
};

bool activity_handlers::resume_for_multi_activities( player &p )
Expand Down Expand Up @@ -5395,3 +5404,84 @@ void activity_handlers::take_shower_finish( player_activity *act, player *p ){
}


void activity_handlers::hentai_play_with_do_turn( player_activity *act, player *p ){
item &it = p->i_at( act->position );
npc *partner = nullptr;
if( act->values.size() >= 2 ) {
partner = g->critter_by_id<npc>( character_id( act->values[1] ) );
}
if( partner != nullptr ) {
partner->set_moves( -200 );
}
if( calendar::once_every( 10_minutes ) ) {
add_msg( SNIPPET.random_from_category( act->str_values[0] ).value_or( translation() )) ;

int bonus = p->dex_cur;
float bonus_multiplier = 1.0f;
if( it.is_null() ) {
bonus_multiplier *= 1.5f;
}
p->add_effect( effect_movingdoing, 10_minutes );
if( partner != nullptr ) {
bonus_multiplier *= 2.0f;
bonus = std::max( p->dex_cur, partner->dex_cur );
partner->add_effect( effect_movingdoing, 10_minutes );
partner->add_morale( morale_type( act->str_values[1] ), bonus * bonus_multiplier, 0, 1_hours, 15_minutes );
}
p->add_morale( morale_type( act->str_values[1] ), bonus * bonus_multiplier, 0, 1_hours, 15_minutes );
}
}

void activity_handlers::hentai_play_with_finish( player_activity *act, player *p ){
const std::function<std::string( const std::string & )> get_text =[&]( const std::string & id ) {
return snippet_id( id )->translated();
};
p->add_msg_if_player( m_good, get_text( "hentai_play_with_finish" ) );
p->remove_effect( effect_lust );
p->remove_effect( effect_movingdoing );

npc *partner = nullptr;
if( act->values.size() >= 2 ) {
partner = g->critter_by_id<npc>( character_id( act->values[1] ) );
}
if( partner != nullptr ) {
partner->remove_effect( effect_lust );
partner->remove_effect( effect_movingdoing );
partner->set_moves( 0 );

if( act->name == "play_with_love" ) {
partner->op_of_u.trust += 2;
partner->op_of_u.value += 2;
partner->op_of_u.fear -= 1;
partner->op_of_u.anger -= 1;
} else if( act->name == "play_with_fear" ) {
partner->op_of_u.trust -= 2;
partner->op_of_u.fear += 5;
partner->op_of_u.anger += 1;
partner->op_of_u.owed -= 1;
}
}

item &it = p->i_at( act->position );
if( !it.is_null() ) {
if( ( rng( 1, 100 ) <= act->values[0] ) ) {
p->add_msg_if_player( m_bad, string_format( _( act->str_values[2] ), it.display_name() ) );
p->i_rem( &it );
it = null_item_reference();
}
}

item liquid = item( "h_body_fluids", calendar::turn );
if( !it.is_null() ) {
item used = item( it.get_property_string( "used_item" ) );
if( !used.is_null() ) {
used.fill_with( liquid );
p->i_add( used );
}
p->i_rem( &it );
} else {
g->m.add_item( p->pos(), liquid );
}

act->set_to_null();
}
2 changes: 2 additions & 0 deletions src/activity_handlers.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ void littlemaid_special_do_turn( player_activity *act, player *p );
void excrete_do_turn( player_activity *act, player *p );
void take_washlet_do_turn( player_activity *act, player *p );
void take_shower_do_turn( player_activity *act, player *p );
void hentai_play_with_do_turn( player_activity *act, player *p );

// defined in activity_handlers.cpp
extern const std::map< activity_id, std::function<void( player_activity *, player * )> >
Expand Down Expand Up @@ -276,6 +277,7 @@ void littlemaid_special_finish( player_activity *act, player *p );
void excrete_finish( player_activity *act, player *p );
void take_washlet_finish( player_activity *act, player *p );
void take_shower_finish( player_activity *act, player *p );
void hentai_play_with_finish( player_activity *act, player *p );

void try_sleep_query( player_activity *act, player *p );
int use_toilet_paper( player *p );
Expand Down
13 changes: 13 additions & 0 deletions src/character.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ static const efftype_id effect_took_xanax( "took_xanax" );
static const efftype_id effect_webbed( "webbed" );
static const efftype_id effect_winded( "winded" );

// for hentai mod
static const efftype_id effect_corrupt( "corrupt" );

static const trait_id trait_ACIDBLOOD( "ACIDBLOOD" );
static const trait_id trait_ACIDPROOF( "ACIDPROOF" );
static const trait_id trait_ADRENALINE( "ADRENALINE" );
Expand Down Expand Up @@ -9185,3 +9188,13 @@ void Character::use_fire( const int quantity )
return;
}
}

void Character::gain_corrupt( int intensity, const time_duration &dur )
{
if( intensity > int_cur ) {
add_effect( effect_corrupt, dur );
} else {
add_msg_player_or_npc( _( "However you successfully resist the temptation!" ),
_( "However <npcname> successfully resists the temptation!" ) );
}
}
3 changes: 3 additions & 0 deletions src/character.h
Original file line number Diff line number Diff line change
Expand Up @@ -2024,6 +2024,9 @@ class Character : public Creature, public visitable<Character>

time_point next_climate_control_check;
bool last_climate_control_ret;

// for hentai mod
void gain_corrupt( int intensity, const time_duration &dur ) override;
};

// Little size helper, exposed for use in deserialization code.
Expand Down
8 changes: 8 additions & 0 deletions src/creature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ static const efftype_id effect_stunned( "stunned" );
static const efftype_id effect_tied( "tied" );
static const efftype_id effect_zapped( "zapped" );

// for hentai mod
static const efftype_id effect_corrupt( "corrupt" );

const std::map<std::string, m_size> Creature::size_map = {
{"TINY", MS_TINY}, {"SMALL", MS_SMALL}, {"MEDIUM", MS_MEDIUM},
{"LARGE", MS_LARGE}, {"HUGE", MS_HUGE}
Expand Down Expand Up @@ -1764,3 +1767,8 @@ bool Creature::has_movement_impairing() const
}
return false;
}

void Creature::gain_corrupt( int, const time_duration &dur )
{
add_effect( effect_corrupt, dur );
}
1 change: 1 addition & 0 deletions src/creature.h
Original file line number Diff line number Diff line change
Expand Up @@ -836,6 +836,7 @@ class Creature
public:
// for hentai mod
bool has_movement_impairing() const;
virtual void gain_corrupt( int intensity, const time_duration &dur );
};

#endif
5 changes: 5 additions & 0 deletions src/item_factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -934,6 +934,7 @@ void Item_factory::init()
add_iuse( "XANAX", &iuse::xanax );
add_iuse( "BREAK_STICK", &iuse::break_stick );
add_iuse( "UNDERGROUND_SONAR", &iuse::underground_sonar );
add_iuse( "NAMING", &iuse::naming );

add_actor( std::make_unique<ammobelt_actor>() );
add_actor( std::make_unique<bandolier_actor>() );
Expand Down Expand Up @@ -974,6 +975,10 @@ void Item_factory::init()
add_actor( std::make_unique<cast_spell_actor>() );
add_actor( std::make_unique<weigh_self_actor>() );
add_actor( std::make_unique<sew_advanced_actor>() );
add_actor( std::make_unique<yiff_actor>() );
add_actor( std::make_unique<anthropomorph_actor>() );
add_actor( std::make_unique<make_pet_actor>() );
add_actor( std::make_unique<transsexual_actor>() );
// An empty dummy group, it will not spawn anything. However, it makes that item group
// id valid, so it can be used all over the place without need to explicitly check for it.
m_template_groups["EMPTY_GROUP"] = std::make_unique<Item_group>( Item_group::G_COLLECTION, 100, 0,
Expand Down
32 changes: 32 additions & 0 deletions src/iuse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9739,6 +9739,38 @@ int iuse::underground_sonar( player *p, item *, bool, const tripoint &pt )
return 0;
}

int iuse::naming( player *p, item *, bool, const tripoint & )
{
if( p->is_npc() ) {
return 0;
}
const std::function<bool( const tripoint & )> f = [&]( const tripoint & pnt ) {
return g->critter_at<player>( pnt ) != nullptr;
};
const cata::optional<tripoint> pnt_ = choose_adjacent_highlight( _( "Use to whom?" ),
_( "There is no one to use to nearby." ), f, false );
if( !pnt_ ) {
return 0;
}
const tripoint &pnt = *pnt_;
if( player *const target = g->critter_at<player>( pnt ) ) {
if( target != nullptr ) {
std::string filterstring = target->name;
string_input_popup popup;
popup.title( _( "Naming:" ) )
.width( 85 ).description( string_format( _( "Target:\n%s\n" ), target->name ) )
.edit( filterstring );
if( popup.confirmed() && !filterstring.empty() ) {
p->add_msg_if_player( m_info, _( "New name is %s!" ), filterstring );
target->name = filterstring;
return 1;
}
}
}

return 0;
}

void use_function::dump_info( const item &it, std::vector<iteminfo> &dump ) const
{
if( actor != nullptr ) {
Expand Down
1 change: 1 addition & 0 deletions src/iuse.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ class iuse
int play_game( player *, item *, bool, const tripoint & );
int magic_8_ball( player *, item *, bool, const tripoint & );
int underground_sonar( player *, item *, bool, const tripoint & );
int naming( player *p, item *, bool, const tripoint & );

// MACGUFFINS

Expand Down
Loading

0 comments on commit cdf327c

Please sign in to comment.