Skip to content
Permalink
Browse files

Outlined bio_cranial_bomb (code does not compile)

I outlined the code for the cranial bomb, but it is not functional yet. In order for the code to work the initialization for int bomb_timer needs to happen in the correct spot.
  • Loading branch information...
HarrisonGreenlee committed Oct 9, 2019
1 parent 6363709 commit 3ef12ca149a7fd9b7a4148832b5a9dbc571022ef
Showing with 28 additions and 0 deletions.
  1. +8 −0 data/json/bionics.json
  2. +20 −0 src/player.cpp
@@ -235,6 +235,14 @@
"time": 1,
"flags": [ "BIONIC_TOGGLED" ]
},
{
"id": "bio_cranial_bomb",
"type": "bionic",
"name": "Cranial Bomb",
"description": "A tiny explosive charge has been embedded into your head. Because it is no longer recieving a cell signal, it's detonation timer has begun to count downwards. If it were to explode in your skull cavity, it would surely kill you.",
"occupied_bodyparts": [ [ "HEAD", 1 ] ],
"flags": [ "BIONIC_FAULTY" ]
},
{
"id": "bio_deformity",
"type": "bionic",
@@ -5778,6 +5778,9 @@ void player::suffer()
}
}

//This definitely does not belong here, but I have no idea where I should put it.
int bomb_timer = 144000;

// Negative bionics effects
if( has_bionic( bio_dis_shock ) && power_level > 9_kJ && one_turn_in( 2_hours ) &&
!has_effect( effect_narcosis ) ) {
@@ -5864,6 +5867,23 @@ void player::suffer()
add_effect( effect_glowy_led, 5_minutes );
charge_power( -1_kJ );
}
if( has_bionic( bio_cranial_bomb ) && one_turn_in( 1_minutes ) ) {
bomb_timer = bomb_timer - 1;

if( bomb_timer <= 0 )
{
hurtall( 9999, nullptr );
sfx::play_variant_sound( "bionics", "acid_discharge", 100 );
sfx::do_player_death_hurt( g->u, false );
} else if( bomb_timer <= 10 || ( bomb_timer <= 60 && bomb_timer % 10 == 0 ) ) {
add_msg_if_player( m_bad, _( "You have " + std::to_string( bomb_timer ) + " minutes before you are blown up." ) );
} else if( bomb_timer <= (60*12) && bomb_timer % 60 == 0 ) {
add_msg_if_player( m_bad, _( "You have " + std::to_string( bomb_timer / 60 ) + " hours before you are blown up." ) );
} else if( bomb_timer % (60*24) == 0 ) {
add_msg_if_player( m_bad, _( "You have " + std::to_string( bomb_timer / 60 / 24 ) + " days before you are blown up." ) );
}
}


// Artifact effects
if( has_artifact_with( AEP_ATTENTION ) ) {

0 comments on commit 3ef12ca

Please sign in to comment.
You can’t perform that action at this time.