Skip to content
Permalink
Browse files

Merge remote-tracking branch 'origin/pr/20627'

* origin/pr/20627:
  Tweak some bad bionics
  • Loading branch information...
kevingranade committed Jan 18, 2018
2 parents 6ea8789 + 7ddb201 commit 1e592d76b7d2c8c1d3f813861eb4771dcc645777
Showing with 76 additions and 98 deletions.
  1. +7 −7 data/json/bionics.json
  2. +2 −1 data/json/item_groups.json
  3. +23 −44 src/melee.cpp
  4. +43 −45 src/player.cpp
  5. +1 −1 src/ranged.cpp
@@ -11,7 +11,7 @@
"id": "bio_ads",
"type": "bionic",
"name": "Active Defense System",
"description": "A thin forcefield surrounds your body, continually draining power. Anything attempting to penetrate this field has a chance of being deflected at the cost of more energy. Melee attacks will be stopped more often than bullets.",
"description": "A thin forcefield surrounds your body, continually draining power. Anything attempting to penetrate this field has a chance of being deflected at the cost of energy. Bullets will be stopped more often than swords and those in turn more often than massive objects.",
"occupied_bodyparts": [
[ "TORSO", 10 ],
[ "HEAD", 1 ],
@@ -47,7 +47,7 @@
"toggled": true,
"act_cost": 1,
"react_cost": 1,
"time": 16
"time": 100
},
{
"id": "bio_ankles",
@@ -719,7 +719,7 @@
"toggled": true,
"act_cost": 1,
"react_cost": 1,
"time": 1
"time": 10
},
{
"id": "bio_noise",
@@ -750,7 +750,7 @@
"id": "bio_ods",
"type": "bionic",
"name": "Offensive Defense System",
"description": "A thin forcefield surrounds your body, continually draining power. This field does not deflect penetration, but rather delivers a very strong shock, damaging unarmed attackers and those with a conductive weapon.",
"description": "A thin forcefield surrounds your body, continually draining power. This field does not deflect penetration, but rather delivers a strong shock, damaging unarmed attackers and those with a conductive weapon.",
"occupied_bodyparts": [
[ "TORSO", 10 ],
[ "HEAD", 1 ],
@@ -986,9 +986,9 @@
[ "LEG_R", 1 ]
],
"toggled": true,
"act_cost": 10,
"react_cost": 10,
"time": 1
"act_cost": 1,
"react_cost": 1,
"time": 10
},
{
"id": "bio_scent_vision",
@@ -8588,7 +8588,8 @@
["bio_blaster", 15],
["bio_emp", 20],
["bio_chain_lightning", 15],
["bio_adrenaline", 20]
["bio_adrenaline", 20],
["bio_ods", 10]
]
},{
"type" : "item_group",
@@ -1458,57 +1458,36 @@ std::string player::melee_special_effects( Creature &t, damage_instance &d, item

target = t.disp_name();

// Bonus attacks!
bool shock_them = (has_active_bionic( bionic_id( "bio_shock" ) ) && power_level >= 2 &&
(weap.has_flag( "UNARMED_WEAPON" ) || weap.made_of( material_id( "iron" ) ) ||
weap.made_of( material_id( "steel" ) ) || weap.made_of( material_id( "silver" ) ) ||
weap.made_of( material_id( "gold" ) ) || weap.made_of( material_id( "superalloy" ) )) && one_in(3));
if( has_active_bionic( bionic_id( "bio_shock" ) ) && power_level >= 2 &&
( !is_armed() || weapon.conductive() ) ) {
charge_power( -2 );
d.add_damage( DT_ELECTRIC, rng( 2, 10 ) );

bool drain_them = (has_active_bionic( bionic_id( "bio_heat_absorb" ) ) && power_level >= 1 &&
weap.is_null() && t.is_warm());
drain_them &= one_in(2); // Only works half the time

bool burn_them = weap.has_flag("FLAMING");


if (shock_them) { // bionics only
charge_power(-2);
int shock = rng(2, 5);
d.add_damage(DT_ELECTRIC, shock * rng(1, 3));
if( is_player() ) {
dump << string_format( _("You shock %s."), target.c_str() ) << std::endl;
} else {
add_msg_if_npc( _("<npcname> shocks %s."), target.c_str() );
}
}

if (is_player()) {
dump << string_format(_("You shock %s."), target.c_str()) << std::endl;
} else
add_msg_player_or_npc(m_good, _("You shock %s."),
_("<npcname> shocks %s."),
target.c_str());
}

if (drain_them) { // bionics only
power_level--;
charge_power(rng(0, 2));
d.add_damage(DT_COLD, 1);
if (t.is_player()) {
add_msg_if_npc(m_bad, _("<npcname> drains your body heat!"));
if( has_active_bionic( bionic_id( "bio_heat_absorb" ) ) && !is_armed() && t.is_warm() ) {
charge_power( 3 );
d.add_damage( DT_COLD, 3 );
if( is_player() ) {
dump << string_format( _("You drain %s's body heat."), target.c_str() ) << std::endl;
} else {
if (is_player()) {
dump << string_format(_("You drain %s's body heat."), target.c_str()) << std::endl;
} else
add_msg_player_or_npc(m_good, _("You drain %s's body heat!"),
_("<npcname> drains %s's body heat!"),
target.c_str());
add_msg_if_npc( _("<npcname> drains %s's body heat!"), target.c_str() );
}
}

if (burn_them) { // for flaming weapons
d.add_damage(DT_HEAT, rng(1, 8));
if( weapon.has_flag( "FLAMING" ) ) {
d.add_damage( DT_HEAT, rng( 1, 8 ) );

if (is_player()) {
dump << string_format(_("You burn %s."), target.c_str()) << std::endl;
} else
add_msg_player_or_npc(m_good, _("You burn %s."),
_("<npcname> burns %s."),
target.c_str());
if( is_player() ) {
dump << string_format( _("You burn %s."), target.c_str() ) << std::endl;
} else {
add_msg_player_or_npc( _("<npcname> burns %s."), target.c_str());
}
}

//Hurting the wielder from poorly-chosen weapons
@@ -3766,22 +3766,26 @@ void player::on_hit( Creature *source, body_part bp_hit,
}

bool u_see = g->u.sees( *this );
if (has_active_bionic( bio_ods ) ) {
if (is_player()) {
add_msg(m_good, _("Your offensive defense system shocks %s in mid-attack!"),
source->disp_name().c_str());
} else if (u_see) {
add_msg(_("%1$s's offensive defense system shocks %2$s in mid-attack!"),
if( has_active_bionic( bionic_id( "bio_ods" ) ) && power_level > 5 ) {
if( is_player() ) {
add_msg( m_good, _( "Your offensive defense system shocks %s in mid-attack!" ),
source->disp_name().c_str());
} else if( u_see ) {
add_msg( _( "%1$s's offensive defense system shocks %2$s in mid-attack!" ),
disp_name().c_str(),
source->disp_name().c_str());
source->disp_name().c_str() );
}
int shock = rng( 1, 4 );
charge_power( -shock );
damage_instance ods_shock_damage;
ods_shock_damage.add_damage(DT_ELECTRIC, rng(10,40));
source->deal_damage(this, bp_torso, ods_shock_damage);
}
if ((!(wearing_something_on(bp_hit))) && (has_trait( trait_SPINES ) || has_trait( trait_QUILLS ))) {
int spine = rng(1, (has_trait( trait_QUILLS ) ? 20 : 8));
if (!is_player()) {
ods_shock_damage.add_damage( DT_ELECTRIC, shock * 5 );
// Should hit body part used for attack
source->deal_damage( this, bp_torso, ods_shock_damage );
}
if( !wearing_something_on( bp_hit ) &&
( has_trait( trait_SPINES ) || has_trait( trait_QUILLS ) ) ) {
int spine = rng( 1, has_trait( trait_QUILLS ) ? 20 : 8 );
if( !is_player() ) {
if( u_see ) {
add_msg(_("%1$s's %2$s puncture %3$s in mid-attack!"), name.c_str(),
(has_trait( trait_QUILLS ) ? _("quills") : _("spines")),
@@ -10353,54 +10357,48 @@ float player::bionic_armor_bonus( body_part bp, damage_type dt ) const
if( has_bionic( bio_carbon ) ) {
if( dt == DT_BASH ) {
result += 2;
} else if( dt == DT_CUT ) {
} else if( dt == DT_CUT || dt == DT_STAB ) {
result += 4;
} else if( dt == DT_STAB ) {
result += 3.2;
}
}
//all the other bionic armors reduce bash/cut/stab by 3/3/2.4
// All the other bionic armors reduce bash/cut/stab by 3
// Map body parts to a set of bionics that protect it
// @todo: JSONize passive bionic armor instead of hardcoding it
static const std::map< body_part, bionic_id > armor_bionics = {
{ bp_head, { bio_armor_head } },
{ bp_arm_l, { bio_armor_arms } },
{ bp_arm_r, { bio_armor_arms } },
{ bp_torso, { bio_armor_torso } },
{ bp_leg_l, { bio_armor_legs } },
{ bp_leg_r, { bio_armor_legs } },
{ bp_eyes, { bio_armor_eyes } }
{ bp_head, { bio_armor_head } },
{ bp_arm_l, { bio_armor_arms } },
{ bp_arm_r, { bio_armor_arms } },
{ bp_torso, { bio_armor_torso } },
{ bp_leg_l, { bio_armor_legs } },
{ bp_leg_r, { bio_armor_legs } },
{ bp_eyes, { bio_armor_eyes } }
};
auto iter = armor_bionics.find( bp );
if( iter != armor_bionics.end() ) {
if( has_bionic( iter->second ) ) {
if( dt == DT_BASH || dt == DT_CUT ) {
result += 3;
} else if( dt == DT_STAB ) {
result += 2.4;
}
}
if( iter != armor_bionics.end() && has_bionic( iter->second ) &&
( dt == DT_BASH || dt == DT_CUT || dt == DT_STAB ) ) {
result += 3;
}
return result;
}

void player::passive_absorb_hit( body_part bp, damage_unit &du ) const
{
du.amount -= bionic_armor_bonus( bp, du.type ); //Check for passive armor bionics
// >0 check because some mutations provide negative armor
if( du.amount > 0.0f ) {
// Horrible hack warning!
// Get rid of this as soon as CUT and STAB are split
if( du.type == DT_STAB ) {
damage_unit du_copy = du;
du_copy.type = DT_CUT;
du.amount -= 0.8f * mutation_armor( bp, du_copy );
} else {
du.amount -= mutation_armor( bp, du );
}
// Thin skin check goes before subdermal armor plates because SUBdermal
if( du.amount > 0.0f ) {
// Horrible hack warning!
// Get rid of this as soon as CUT and STAB are split
if( du.type == DT_STAB ) {
damage_unit du_copy = du;
du_copy.type = DT_CUT;
du.amount -= mutation_armor( bp, du_copy );
} else {
du.amount -= mutation_armor( bp, du );
}
du.amount -= mabuff_armor_bonus( du.type );
du.amount = std::max( 0.0f, du.amount );
}
du.amount -= bionic_armor_bonus( bp, du.type ); //Check for passive armor bionics
du.amount -= mabuff_armor_bonus( du.type );
du.amount = std::max( 0.0f, du.amount );
}

void player::absorb_hit(body_part bp, damage_instance &dam) {
@@ -1343,7 +1343,7 @@ std::vector<tripoint> target_handler::target_ui( player &pc, target_mode mode,
static projectile make_gun_projectile( const item &gun ) {
projectile proj;
proj.speed = 1000;
proj.impact = damage_instance::physical( 0, gun.gun_damage(), 0, gun.gun_pierce() );
proj.impact = damage_instance::physical( 0, 0, gun.gun_damage(), gun.gun_pierce() );
proj.range = gun.gun_range();
proj.proj_effects = gun.ammo_effects();

0 comments on commit 1e592d7

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