From 6f1ee206a100f472345616adc066359309571928 Mon Sep 17 00:00:00 2001 From: Aloxaf Date: Sun, 26 Apr 2020 09:59:12 +0800 Subject: [PATCH 1/3] Fix attack of the tentacle dogs --- data/json/monsters/nether.json | 2 ++ src/monattack.cpp | 35 ++++++++++++++++++++++++++-------- 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/data/json/monsters/nether.json b/data/json/monsters/nether.json index 944c23e953c57..e6db9824e0b90 100644 --- a/data/json/monsters/nether.json +++ b/data/json/monsters/nether.json @@ -409,6 +409,7 @@ "default_faction": "mutant", "bodytype": "dog", "species": [ "NETHER" ], + "diff": 2, "volume": "62500 ml", "weight": "81500 g", "hp": 120, @@ -747,6 +748,7 @@ "default_faction": "mutant", "bodytype": "blob", "species": [ "NETHER" ], + "diff": 2, "volume": "92500 ml", "weight": "120 kg", "hp": 160, diff --git a/src/monattack.cpp b/src/monattack.cpp index 4ed6be321c67f..fa38a2eabd890 100644 --- a/src/monattack.cpp +++ b/src/monattack.cpp @@ -2523,14 +2523,18 @@ bool mattack::tentacle( monster *z ) // TODO: handle friendly monsters return false; } - Creature *target = &g->u; - if( !z->sees( g->u ) ) { + Creature *target = z->attack_target(); + if( target == nullptr || rl_dist( z->pos(), target->pos() ) > 3 || !z->sees( *target ) ) { return false; } - add_msg( m_bad, _( "The %s lashes its tentacle at you!" ), z->name() ); + auto msg_type = target == &g->u ? m_bad : m_info; + target->add_msg_player_or_npc( msg_type, + _( "The %s lashes its tentacle at you!" ), + _( "The %s lashes its tentacle at !" ), + z->name() ); z->moves -= 100; - if( g->u.uncanny_dodge() ) { + if( target->uncanny_dodge() ) { return true; } // Can we dodge the attack? Uses player dodge function % chance (melee.cpp) @@ -2543,11 +2547,26 @@ bool mattack::tentacle( monster *z ) body_part hit = target->get_random_body_part()->token; int dam = rng( 10, 20 ); - //~ 1$s is bodypart name, 2$d is damage value. - add_msg( m_bad, _( "Your %1$s is hit for %2$d damage!" ), body_part_name( hit ), dam ); - g->u.deal_damage( z, hit, damage_instance( DT_BASH, dam ) ); + dam = target->deal_damage( z, hit, damage_instance( DT_BASH, dam ) ).total_damage(); + + if( dam > 0 ) { + target->add_msg_player_or_npc( msg_type, + //~ 1$s is bodypart name, 2$d is damage value. + _( "Your %1$s is hit for %2$d damage!" ), + //~ 1$s is bodypart name, 2$d is damage value. + _( "'s %1$s is hit for %2$d damage!" ), + body_part_name( hit ), + dam ); + } else { + target->add_msg_player_or_npc( + _( "The %1$s lashes its tentacle at your %2$s, but glances off your armor!" ), + _( "The %1$s lashes its tentacle at 's %2$s, but glances off your armor!" ), + z->name(), + body_part_name_accusative( hit ) ); + } + target->on_hit( z, hit, z->type->melee_skill ); - g->u.check_dead_state(); + target->check_dead_state(); return true; } From 89eeaee77325cdbd5570c1d7ac910b99741fcdfd Mon Sep 17 00:00:00 2001 From: Aloxaf Date: Sun, 26 Apr 2020 15:23:39 +0800 Subject: [PATCH 2/3] Update src/monattack.cpp Co-Authored-By: Anton Burmistrov --- src/monattack.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/monattack.cpp b/src/monattack.cpp index fa38a2eabd890..05670b4e22340 100644 --- a/src/monattack.cpp +++ b/src/monattack.cpp @@ -2560,7 +2560,7 @@ bool mattack::tentacle( monster *z ) } else { target->add_msg_player_or_npc( _( "The %1$s lashes its tentacle at your %2$s, but glances off your armor!" ), - _( "The %1$s lashes its tentacle at 's %2$s, but glances off your armor!" ), + _( "The %1$s lashes its tentacle at 's %2$s, but glances off their armor!" ), z->name(), body_part_name_accusative( hit ) ); } From 5bb815396aecee0a4fbe982b58e2cba39f1e9246 Mon Sep 17 00:00:00 2001 From: Kevin Granade Date: Mon, 4 May 2020 21:37:09 +0000 Subject: [PATCH 3/3] Don't auto. --- src/monattack.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/monattack.cpp b/src/monattack.cpp index 027ddf596a342..07d929f0e94be 100644 --- a/src/monattack.cpp +++ b/src/monattack.cpp @@ -2529,7 +2529,7 @@ bool mattack::tentacle( monster *z ) if( target == nullptr || rl_dist( z->pos(), target->pos() ) > 3 || !z->sees( *target ) ) { return false; } - auto msg_type = target == &g->u ? m_bad : m_info; + game_message_type msg_type = target == &g->u ? m_bad : m_info; target->add_msg_player_or_npc( msg_type, _( "The %s lashes its tentacle at you!" ), _( "The %s lashes its tentacle at !" ),