diff --git a/bionics.cpp b/bionics.cpp index 8403a025e982a..6b6287ca2282d 100644 --- a/bionics.cpp +++ b/bionics.cpp @@ -220,6 +220,9 @@ void player::activate_bionic(int b, game *g) pkill = pain; } else if (bio.id == "bio_nanobots"){ healall(4); + } else if (bio.id == "bio_night"){ + if (g->turn % 5) + g->add_msg("Artificial night generator active!"); } else if (bio.id == "bio_resonator"){ g->sound(posx, posy, 30, "VRRRRMP!"); for (int i = posx - 1; i <= posx + 1; i++) { @@ -1045,6 +1048,9 @@ Interfaces your power system with the internal charging port on suits of power a The Mk. II was designed by DoubleTech Inc., to meet the popularity of the Mk. II\n\ power armor series."); + bionics["bio_night"] = new bionic_data("Artificial Night Generator", false, true, 1, 2, "\ +Destructive interference eliminates all light within a 15 tile radius."); + bionics["bio_flashbang"] = new bionic_data("Flashbang Generator", false, true, 5, 0, "\ Light emitting diodes integrated into your skin can release a flash comparable\n\ to a flashbang grenade, blinding nearby enemies. Speakers integrated into your\n\ diff --git a/game.cpp b/game.cpp index 4be27c5f36a21..19daa84e71c2d 100644 --- a/game.cpp +++ b/game.cpp @@ -3837,7 +3837,7 @@ bool game::sees_u(int x, int y, int &t) if( range <= 0) range = 1; - return (!u.has_active_bionic("bio_cloak") && + return ((!u.has_active_bionic("bio_cloak") || !u.has_active_bionic("bio_night")) && !u.has_artifact_with(AEP_INVISIBLE) && m.sees(x, y, u.posx, u.posy, range, t)); } @@ -3852,7 +3852,9 @@ bool game::u_see(int x, int y) else if (wanted_range <= u.sight_range(light_level()) || (wanted_range <= u.sight_range(DAYLIGHT_LEVEL) && m.light_at(x, y) >= LL_LOW)) - can_see = m.pl_sees(u.posx, u.posy, x, y, wanted_range); + can_see = m.pl_sees(u.posx, u.posy, x, y, wanted_range); + if (u.has_active_bionic("bio_night") && wanted_range < 15 && wanted_range > u.sight_range(1)) + return false; return can_see; } diff --git a/itypedef.cpp b/itypedef.cpp index aef1f97b1be00..dc50113e7f809 100644 --- a/itypedef.cpp +++ b/itypedef.cpp @@ -349,7 +349,8 @@ BIO_SINGLE("bio_armor_legs", 3, 3500, c_cyan, 3); BIO_SINGLE("bio_face_mask", 1, 8500, c_magenta, 5); BIO_SINGLE("bio_scent_mask", 1, 8500, c_magenta, 5); BIO_SINGLE("bio_cloak", 1, 8500, c_magenta, 5); -BIO_SINGLE("bio_fingerhack", 1, 3500, c_magenta, 2); +BIO_SINGLE("bio_fingerhack", 1, 3500, c_magenta, 2); +BIO_SINGLE("bio_night", 1, 8500, c_magenta, 5); // defensive BIO_SINGLE("bio_ads", 1, 9500, c_ltblue, 7); BIO_SINGLE("bio_ods", 1, 9500, c_ltblue, 7); diff --git a/lightmap.cpp b/lightmap.cpp index 35d55f36b055f..abc9d62fb54fd 100644 --- a/lightmap.cpp +++ b/lightmap.cpp @@ -172,6 +172,16 @@ void map::generate_lightmap(game* g) } } } + for(int sx = 0; sx < LIGHTMAP_CACHE_X; ++sx) + { + for(int sy = 0; sy < LIGHTMAP_CACHE_Y; ++sy) + { + if (g->u.has_active_bionic("bio_night") && rl_dist(sx, sy, g->u.posx, g->u.posy) < 15) + { + lm[sx][sy] = 0; + } + } + } } lit_level map::light_at(int dx, int dy) diff --git a/map.cpp b/map.cpp index 3cb858a29d0e7..993700f5db141 100644 --- a/map.cpp +++ b/map.cpp @@ -3082,7 +3082,8 @@ void map::draw(game *g, WINDOW* w, const point center) } } - if (dist > real_max_sight_range || + if ((g->u.has_active_bionic("bio_night") && dist < 15 && dist > natural_sight_range) || // if bio_night active, blackout 15 tile radius around player + dist > real_max_sight_range || (dist > light_sight_range && (lit == LL_DARK || (u_sight_impaired && lit != LL_BRIGHT) || diff --git a/mapitemsdef.cpp b/mapitemsdef.cpp index f1d866d1ed1de..f8295f7868db0 100644 --- a/mapitemsdef.cpp +++ b/mapitemsdef.cpp @@ -628,7 +628,7 @@ void game::init_mapitems() "bio_membrane", "bio_gills", "bio_purifier", "bio_climate", "bio_heatsink", "bio_blood_filter", "bio_recycler", "bio_digestion", "bio_evap", "bio_water_extractor", - "bio_face_mask", "bio_scent_mask", "bio_cloak", "bio_fingerhack", + "bio_face_mask", "bio_scent_mask", "bio_cloak", "bio_fingerhack", "bio_night", "bio_carbon", "bio_armor_head", "bio_armor_torso", "bio_armor_arms", "bio_armor_legs", "bio_shock", "bio_heat_absorb", "bio_claws", "bio_shockwave", @@ -717,7 +717,7 @@ void game::init_mapitems() "bio_carbon", "bio_armor_head", "bio_armor_torso", "bio_armor_arms", "bio_armor_legs", "bio_targeting", "bio_ground_sonar", - "bio_face_mask", "bio_scent_mask", "bio_cloak", "bio_fingerhack", + "bio_face_mask", "bio_scent_mask", "bio_cloak", "bio_fingerhack", "bio_night", "bio_nanobots", "bio_blood_anal", "bio_ads", "bio_ods", "bio_blaster", "bio_laser", "bio_emp", "bio_railgun", "bio_flashbang",