Open LyleSY opened 1 year ago
void mdefense::zapback( monster &m, Creature *const source,
dealt_projectile_attack const *proj )
{
if( source == nullptr ) {
return;
}
// If we have a projectile, we're a ranged attack, no zapback.
if( proj != nullptr ) {
return;
}
if( const Character *const foe = dynamic_cast<Character *>( source ) ) {
// Players/NPCs can avoid the shock if they wear non-conductive gear on their hands
if( !foe->worn.hands_conductive() ) {
return;
}
// Players/NPCs can avoid the shock by using non-conductive weapons
if( foe->get_wielded_item() && !foe->get_wielded_item()->conductive() ) {
if( foe->reach_attacking ) {
return;
}
if( foe->used_weapon() ) {
return;
}
}
}
if( source->is_elec_immune() ) {
return;
}
if( get_player_view().sees( source->pos() ) ) {
const game_message_type msg_type = source->is_avatar() ? m_bad : m_info;
add_msg( msg_type, _( "Striking the %1$s shocks %2$s!" ),
m.name(), source->disp_name() );
}
const damage_instance shock {
damage_type::ELECTRIC, static_cast<float>( rng( 1, 5 ) )
};
source->deal_damage( &m, bodypart_id( "arm_l" ), shock );
source->deal_damage( &m, bodypart_id( "arm_r" ), shock );
source->check_dead_state();
}
I think copying and adjusting this would be the bulk of the work making this viable.
There is an enchantment that can do similar (hit_me_effect), but right now enchantments doesn't work with monsters and NPCs, only for player
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Please do not bump or comment on this issue unless you are actively working on it. Stale issues, and stale issues that are closed are still considered.
Is your feature request related to a problem? Please describe.
Ankylosaurids had a bunch of spikes so if you decided to bite one, you would enjoy a mouthful of piercing damage, so much so that you would probably stop before you even hurt it. Also they might break off your teeth. We have ZAPBACK and ACIDSPLASH that are kind of similar.
Solution you would like.
ZAPBACK but cutting damage and no stun. Ideally it would only trigger if you don't have a reach attack, and would trigger a lot if you're just like punching it. I could imagine a use for this in main game too, basically a hedgehog zombie evolution. Ideally it goes away when the monster is knocked over.
Describe alternatives you have considered.
N/A
Additional context
"It would have certainly been off-putting for predators to bite down on an animal covered in sharp spines like these" from https://gizmodo.com/these-spikes-grew-right-out-of-a-dinosaurs-ribs-1847741722