Skip to content

Commit

Permalink
Remove obsolete death function
Browse files Browse the repository at this point in the history
  • Loading branch information
anothersimulacrum committed May 7, 2020
1 parent ac4a5dd commit 35da6c0
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 76 deletions.
72 changes: 0 additions & 72 deletions src/mondeath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -765,78 +765,6 @@ void mdeath::kill_breathers( monster &/*z*/ )
}
}

void mdeath::detonate( monster &z )
{
weighted_int_list<std::string> amm_list;
for( const auto &amm : z.ammo ) {
amm_list.add( amm.first, amm.second );
}

std::vector<std::string> pre_dets;
for( int i = 0; i < 3; i++ ) {
if( amm_list.get_weight() <= 0 ) {
break;
}
// Grab one item
std::string tmp = *amm_list.pick();
// and reduce its weight by 1
amm_list.add_or_replace( tmp, amm_list.get_specific_weight( tmp ) - 1 );
// and stash it for use
pre_dets.push_back( tmp );
}

// Update any hardcoded explosion equivalencies
std::vector<std::pair<std::string, long>> dets;
for( const std::string &bomb_id : pre_dets ) {
if( bomb_id == "bot_grenade_hack" ) {
dets.push_back( std::make_pair( "grenade_act", 5 ) );
} else if( bomb_id == "bot_flashbang_hack" ) {
dets.push_back( std::make_pair( "flashbang_act", 5 ) );
} else if( bomb_id == "bot_gasbomb_hack" ) {
dets.push_back( std::make_pair( "gasbomb_act", 20 ) );
} else if( bomb_id == "bot_c4_hack" ) {
dets.push_back( std::make_pair( "c4armed", 10 ) );
} else if( bomb_id == "bot_mininuke_hack" ) {
dets.push_back( std::make_pair( "mininuke_act", 20 ) );
} else {
// Get the transformation item
const iuse_transform *actor = dynamic_cast<const iuse_transform *>(
item::find_type( bomb_id )->get_use( "transform" )->get_actor_ptr() );
if( actor == nullptr ) {
// Invalid bomb item, move to the next ammo item
add_msg( m_debug, "Invalid bomb type in detonate mondeath for %s.", z.name() );
continue;
}
dets.emplace_back( actor->target, actor->ammo_qty );
}
}

if( g->u.sees( z ) ) {
if( dets.empty() ) {
add_msg( m_info,
//~ %s is the possessive form of the monster's name
_( "The %s's hands fly to its pockets, but there's nothing left in them." ),
z.name() );
} else {
//~ %s is the possessive form of the monster's name
add_msg( m_bad, _( "The %s's hands fly to its remaining pockets, opening them!" ),
z.name() );
}
}
// HACK, used to stop them from having ammo on respawn
z.add_effect( effect_no_ammo, 1_turns, num_bp, true );

// First die normally
mdeath::normal( z );
// Then detonate our suicide bombs
for( const auto &bombs : dets ) {
item bomb_item( bombs.first, 0 );
bomb_item.charges = bombs.second;
bomb_item.active = true;
g->m.add_item_or_charges( z.pos(), bomb_item );
}
}

void mdeath::broken_ammo( monster &z )
{
if( g->u.sees( z.pos() ) ) {
Expand Down
2 changes: 0 additions & 2 deletions src/mondeath.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@ void smokeburst( monster &z );
void fungalburst( monster &z );
// Snicker-snack!
void jabberwock( monster &z );
// Take the enemy with you
void detonate( monster &z );
// Breaks ammo and then itself
void broken_ammo( monster &z );
// Spawns 1-3 roach nymphs
Expand Down
2 changes: 0 additions & 2 deletions src/monstergenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -491,8 +491,6 @@ void MonsterGenerator::init_death()
death_map["FUNGALBURST"] = &mdeath::fungalburst;
// Snicker-snack!
death_map["JABBERWOCKY"] = &mdeath::jabberwock;
// Take them with you
death_map["DETONATE"] = &mdeath::detonate;
// Game over! Defense mode
death_map["GAMEOVER"] = &mdeath::gameover;
// Spawn some cockroach nymphs
Expand Down

0 comments on commit 35da6c0

Please sign in to comment.