From 565790df6793251a337b5b81bf5166dac68748dc Mon Sep 17 00:00:00 2001 From: gammafunk Date: Mon, 9 Sep 2019 01:05:46 -0500 Subject: [PATCH] Fedhas rework part 3: remove Sunlight Sunlight is a pretty tedious to use ability that strongly overlaps with TSO. Removing shallow and deep water when flight is extensively available is also not especially interesting. This adds a minor version tag to handle save compatibility, since we're removing a member of the global env that maps sunlight-affected squares. --- crawl-ref/source/ability-type.h | 3 +- crawl-ref/source/ability.cc | 5 - crawl-ref/source/areas.cc | 7 - crawl-ref/source/dat/descript/ability.txt | 7 - crawl-ref/source/dungeon.cc | 1 - crawl-ref/source/env.h | 1 - crawl-ref/source/god-abil.cc | 156 ------------------ crawl-ref/source/god-abil.h | 2 - crawl-ref/source/player-reacts.cc | 3 - crawl-ref/source/religion.cc | 1 - crawl-ref/source/rltiles/dc-invocations.txt | 1 - .../gui/invocations/fedhas_sunlight.png | Bin 356 -> 0 bytes crawl-ref/source/stairs.cc | 2 - crawl-ref/source/tag-version.h | 1 + crawl-ref/source/tags.cc | 23 ++- crawl-ref/source/tilepick.cc | 2 - 16 files changed, 12 insertions(+), 203 deletions(-) delete mode 100644 crawl-ref/source/rltiles/gui/invocations/fedhas_sunlight.png diff --git a/crawl-ref/source/ability-type.h b/crawl-ref/source/ability-type.h index 116fe7be98f..2969342edf2 100644 --- a/crawl-ref/source/ability-type.h +++ b/crawl-ref/source/ability-type.h @@ -173,12 +173,11 @@ enum ability_type ABIL_JIYVA_SLIMIFY, ABIL_JIYVA_CURE_BAD_MUTATION, // Fedhas - ABIL_FEDHAS_SUNLIGHT = 1140, + ABIL_FEDHAS_WALL_OF_BRIARS = 1140, ABIL_FEDHAS_RAIN, ABIL_FEDHAS_PLANT_RING, ABIL_FEDHAS_SPAWN_SPORES, ABIL_FEDHAS_EVOLUTION, - ABIL_FEDHAS_WALL_OF_BRIARS, // Cheibriados ABIL_CHEIBRIADOS_TIME_STEP = 1151, ABIL_CHEIBRIADOS_TIME_BEND, diff --git a/crawl-ref/source/ability.cc b/crawl-ref/source/ability.cc index ea38d018525..f681cec0e7a 100644 --- a/crawl-ref/source/ability.cc +++ b/crawl-ref/source/ability.cc @@ -514,8 +514,6 @@ static const ability_def Ability_List[] = 0, 0, 0, 15, {fail_basis::invo}, abflag::none }, // Fedhas - { ABIL_FEDHAS_SUNLIGHT, "Sunlight", - 2, 0, 50, 0, {fail_basis::invo, 30, 6, 20}, abflag::none }, { ABIL_FEDHAS_EVOLUTION, "Evolution", 2, 0, 0, 0, {fail_basis::invo, 30, 6, 20}, abflag::rations_or_piety }, { ABIL_FEDHAS_PLANT_RING, "Growth", @@ -2864,9 +2862,6 @@ static spret _do_ability(const ability_def& abil, bool fail) end_recall(); break; - case ABIL_FEDHAS_SUNLIGHT: - return fedhas_sunlight(fail); - case ABIL_FEDHAS_PLANT_RING: fail_check(); if (!fedhas_plant_ring_from_rations()) diff --git a/crawl-ref/source/areas.cc b/crawl-ref/source/areas.cc index 3910ffcd770..b3248f4a3fb 100644 --- a/crawl-ref/source/areas.cc +++ b/crawl-ref/source/areas.cc @@ -199,13 +199,6 @@ static void _update_agrid() no_areas = false; } - if (!env.sunlight.empty()) - { - for (const auto &entry : env.sunlight) - _set_agrid_flag(entry.first, areaprop::halo); - no_areas = false; - } - // TODO: update sanctuary here. _agrid_valid = true; diff --git a/crawl-ref/source/dat/descript/ability.txt b/crawl-ref/source/dat/descript/ability.txt index d285b42fc1e..294a4b3243c 100644 --- a/crawl-ref/source/dat/descript/ability.txt +++ b/crawl-ref/source/dat/descript/ability.txt @@ -486,13 +486,6 @@ Wall of Briars ability Grow short-lived briar patches around you. Monsters attacking these briars will be damaged by sharp thorns. Invocations skill increases the briars' health. %%%% -Sunlight ability - -Calls sunlight down over a small area of the dungeon. Monsters illuminated by -the light will be easier to hit. Water affected by the sunlight will evaporate. -In particular, deep water will become shallow water, and shallow water will dry -up completely, revealing the dungeon floor. -%%%% Growth ability Uses food to grow a ring of plants around yourself. If a complete ring cannot diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc index 1511b363229..4ddfc1df72d 100644 --- a/crawl-ref/source/dungeon.cc +++ b/crawl-ref/source/dungeon.cc @@ -1339,7 +1339,6 @@ void dgn_reset_level(bool enable_random_maps) env.spawn_random_rate = 0; env.density = 0; env.forest_awoken_until = 0; - env.sunlight.clear(); env.floor_colour = BLACK; env.rock_colour = BLACK; diff --git a/crawl-ref/source/env.h b/crawl-ref/source/env.h index 140e6678c67..d3604384113 100644 --- a/crawl-ref/source/env.h +++ b/crawl-ref/source/env.h @@ -107,7 +107,6 @@ struct crawl_environment int forest_awoken_until; int density; int absdepth0; - vector > sunlight; // Remaining fields not marshalled: diff --git a/crawl-ref/source/god-abil.cc b/crawl-ref/source/god-abil.cc index 8b6eb0667c5..8d040ebfac3 100644 --- a/crawl-ref/source/god-abil.cc +++ b/crawl-ref/source/god-abil.cc @@ -2210,162 +2210,6 @@ static bool _create_plant(coord_def& target, int hp_adjust = 0) return false; } -#define SUNLIGHT_DURATION 80 - -spret fedhas_sunlight(bool fail) -{ - dist spelld; - - bolt temp_bolt; - temp_bolt.colour = YELLOW; - - targeter_smite tgt(&you, LOS_RADIUS, 0, 1); - direction_chooser_args args; - args.restricts = DIR_TARGET; - args.mode = TARG_HOSTILE_SUBMERGED; - args.range = LOS_RADIUS; - args.needs_path = false; - args.top_prompt = "Select sunlight destination."; - args.hitfunc = &tgt; - direction(spelld, args); - - if (!spelld.isValid) - return spret::abort; - - fail_check(); - - const coord_def base = spelld.target; - - int revealed_count = 0; - - for (adjacent_iterator ai(base, false); ai; ++ai) - { - if (!in_bounds(*ai) || cell_is_solid(*ai)) - continue; - - for (size_t i = 0; i < env.sunlight.size(); ++i) - if (env.sunlight[i].first == *ai) - { - erase_any(env.sunlight, i); - break; - } - const int expiry = you.elapsed_time + SUNLIGHT_DURATION; - env.sunlight.emplace_back(*ai, expiry); - - temp_bolt.explosion_draw_cell(*ai); - - monster *victim = monster_at(*ai); - if (victim && you.see_cell(*ai) && !victim->visible_to(&you)) - { - // Like entering/exiting angel halos, flipping autopickup would - // be probably too much hassle. - revealed_count++; - } - - if (victim) - behaviour_event(victim, ME_ALERT, &you); - } - - { - unwind_var no_time(you.time_taken, 0); - process_sunlights(false); - } - -#ifndef USE_TILE_LOCAL - // Move the cursor out of the way (it looks weird). - coord_def temp = grid2view(base); - cgotoxy(temp.x, temp.y, GOTO_DNGN); -#endif - scaled_delay(200); - - if (revealed_count) - { - mprf("In the bright light, you notice %s.", revealed_count == 1 ? - "an invisible shape" : "some invisible shapes"); - } - - return spret::success; -} - -void process_sunlights(bool future) -{ - int time_cap = future ? INT_MAX - SUNLIGHT_DURATION : you.elapsed_time; - - int evap_count = 0; - - for (int i = env.sunlight.size() - 1; i >= 0; --i) - { - coord_def c = env.sunlight[i].first; - int until = env.sunlight[i].second; - - if (until <= time_cap) - erase_any(env.sunlight, i); - - until = min(until, time_cap); - int from = you.elapsed_time - you.time_taken; - - // Deterministic roll, to guarantee evaporation when shined long enough. - struct { level_id place; coord_def coord; int64_t game_start; } to_hash; - to_hash.place = level_id::current(); - to_hash.coord = c; - to_hash.game_start = you.birth_time; - int h = hash32(&to_hash, sizeof(to_hash)) % SUNLIGHT_DURATION; - - if ((from + h) / SUNLIGHT_DURATION == (until + h) / SUNLIGHT_DURATION) - continue; - - // Anything further on goes only on a successful evaporation roll, at - // most once peer coord per invocation. - - // If this is a water square we will evaporate it. - dungeon_feature_type ftype = grd(c); - dungeon_feature_type orig_type = ftype; - - switch (ftype) - { - case DNGN_SHALLOW_WATER: - ftype = DNGN_FLOOR; - break; - - case DNGN_DEEP_WATER: - ftype = DNGN_SHALLOW_WATER; - break; - - default: - break; - } - - if (orig_type != ftype) - { - dungeon_terrain_changed(c, ftype); - - if (you.see_cell(c)) - evap_count++; - - // This is a little awkward but if we evaporated all the way to - // the dungeon floor that may have given a monster - // ENCH_AQUATIC_LAND, and if that happened the player should get - // credit if the monster dies. The enchantment is inflicted via - // the dungeon_terrain_changed call chain and that doesn't keep - // track of what caused the terrain change. -cao - monster* mons = monster_at(c); - if (mons && ftype == DNGN_FLOOR - && mons->has_ench(ENCH_AQUATIC_LAND)) - { - mon_enchant temp = mons->get_ench(ENCH_AQUATIC_LAND); - temp.who = KC_YOU; - temp.source = MID_PLAYER; - mons->add_ench(temp); - } - } - } - - if (evap_count) - mpr("Some water evaporates in the bright sunlight."); - - invalidate_agrid(true); -} - template static bool less_second(const T & left, const T & right) { diff --git a/crawl-ref/source/god-abil.h b/crawl-ref/source/god-abil.h index a040adb06a7..b1bb58ae87c 100644 --- a/crawl-ref/source/god-abil.h +++ b/crawl-ref/source/god-abil.h @@ -117,8 +117,6 @@ int place_ring(vector& ring_points, // (walls/statues). void collect_radius_points(vector > &radius_points, const coord_def &origin, los_type los); -spret fedhas_sunlight(bool fail = false); -void process_sunlights(bool future = false); bool prioritise_adjacent(const coord_def& target, vector& candidates); bool fedhas_plant_ring_from_rations(); int fedhas_rain(const coord_def &target); diff --git a/crawl-ref/source/player-reacts.cc b/crawl-ref/source/player-reacts.cc index 1cd4aabd55e..bf176407edc 100644 --- a/crawl-ref/source/player-reacts.cc +++ b/crawl-ref/source/player-reacts.cc @@ -832,9 +832,6 @@ static void _decrement_durations() extract_manticore_spikes("You carefully extract the barbed spikes from " "your body."); - if (!env.sunlight.empty()) - process_sunlights(); - if (!you.duration[DUR_ANCESTOR_DELAY] && in_good_standing(GOD_HEPLIAKLQANA) && hepliaklqana_ancestor() == MID_NOBODY) diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index 53452c356cc..fd6d54344d1 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -263,7 +263,6 @@ const vector god_powers[NUM_GODS] = // Fedhas { - { 1, ABIL_FEDHAS_SUNLIGHT, "call sunshine" }, { 2, ABIL_FEDHAS_WALL_OF_BRIARS, "encircle yourself with summoned briar patches"}, { 2, ABIL_FEDHAS_EVOLUTION, "induce evolution" }, { 3, ABIL_FEDHAS_PLANT_RING, "cause a ring of plants to grow" }, diff --git a/crawl-ref/source/rltiles/dc-invocations.txt b/crawl-ref/source/rltiles/dc-invocations.txt index dfef4a21b58..395b54b2adb 100644 --- a/crawl-ref/source/rltiles/dc-invocations.txt +++ b/crawl-ref/source/rltiles/dc-invocations.txt @@ -24,7 +24,6 @@ fedhas_evolution ABILITY_FEDHAS_EVOLUTION fedhas_plant_ring ABILITY_FEDHAS_PLANT_RING fedhas_rain ABILITY_FEDHAS_RAIN fedhas_spawn_spores ABILITY_FEDHAS_SPAWN_SPORES -fedhas_sunlight ABILITY_FEDHAS_SUNLIGHT fedhas_wall_of_briars ABILITY_FEDHAS_WALL_OF_BRIARS gozag_potion_petition ABILITY_GOZAG_POTION_PETITION gozag_call_merchant ABILITY_GOZAG_CALL_MERCHANT diff --git a/crawl-ref/source/rltiles/gui/invocations/fedhas_sunlight.png b/crawl-ref/source/rltiles/gui/invocations/fedhas_sunlight.png deleted file mode 100644 index cb7cab270477e747e36c55d732b3a5da2de44968..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 356 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7dy1_3@Hu0R?H*kt*6Ooe39L<|fJ z92^`Hy7CcARfPz$57DGX9lle)pLfWE`6Nhp6&~@1zF~sFlNUUzw;?-nS4EF yfBm~{E$8Lh4=-eBvSMGbzVVIh+s|KF3q0+Q&*kAbzmQ826j+|FelF{r5}E+Lj)r#t diff --git a/crawl-ref/source/stairs.cc b/crawl-ref/source/stairs.cc index 22fe69f8b6b..d9f2dce391c 100644 --- a/crawl-ref/source/stairs.cc +++ b/crawl-ref/source/stairs.cc @@ -222,8 +222,6 @@ static void _clear_prisms() void leaving_level_now(dungeon_feature_type stair_used) { - process_sunlights(true); - if (stair_used == DNGN_EXIT_ZIGGURAT) { if (you.depth == 27) diff --git a/crawl-ref/source/tag-version.h b/crawl-ref/source/tag-version.h index a9530484646..6142b8c038a 100644 --- a/crawl-ref/source/tag-version.h +++ b/crawl-ref/source/tag-version.h @@ -235,6 +235,7 @@ enum tag_minor_version TAG_MINOR_SINGULAR_THEY, // Add singular they pronouns TAG_MINOR_ABYSS_UNIQUE_VAULTS, // Separate abyss vault tracking from main dungeon TAG_MINOR_INCREMENTAL_PREGEN, // save tracks whether the game is an incremental pregen game + TAG_MINOR_NO_SUNLIGHT, // Removal of Fedhas' Sunlight #endif NUM_TAG_MINORS, TAG_MINOR_VERSION = NUM_TAG_MINORS - 1 diff --git a/crawl-ref/source/tags.cc b/crawl-ref/source/tags.cc index 600d48e5cdc..c87c1d23a82 100644 --- a/crawl-ref/source/tags.cc +++ b/crawl-ref/source/tags.cc @@ -4457,13 +4457,6 @@ static void tag_construct_level(writer &th) marshallInt(th, env.forest_awoken_until); marshall_level_vault_data(th); marshallInt(th, env.density); - - marshallShort(th, env.sunlight.size()); - for (const auto &sunspot : env.sunlight) - { - marshallCoord(th, sunspot.first); - marshallInt(th, sunspot.second); - } } void marshallItem(writer &th, const item_def &item, bool iinfo) @@ -6055,15 +6048,19 @@ static void tag_read_level(reader &th) env.forest_awoken_until = unmarshallInt(th); unmarshall_level_vault_data(th); env.density = unmarshallInt(th); +#if TAG_MAJOR_VERSION == 34 - int num_lights = unmarshallShort(th); - ASSERT(num_lights >= 0); - env.sunlight.clear(); - while (num_lights-- > 0) + if (th.getMinorVersion() < TAG_MINOR_NO_SUNLIGHT) { - coord_def c = unmarshallCoord(th); - env.sunlight.emplace_back(c, unmarshallInt(th)); + int num_lights = unmarshallShort(th); + ASSERT(num_lights >= 0); + while (num_lights-- > 0) + { + unmarshallCoord(th); + unmarshallInt(th); + } } +#endif } #if TAG_MAJOR_VERSION == 34 diff --git a/crawl-ref/source/tilepick.cc b/crawl-ref/source/tilepick.cc index d919b49c738..f1cf92bd7f5 100644 --- a/crawl-ref/source/tilepick.cc +++ b/crawl-ref/source/tilepick.cc @@ -3515,8 +3515,6 @@ tileidx_t tileidx_ability(const ability_type ability) // Fedhas case ABIL_FEDHAS_WALL_OF_BRIARS: return TILEG_ABILITY_FEDHAS_WALL_OF_BRIARS; - case ABIL_FEDHAS_SUNLIGHT: - return TILEG_ABILITY_FEDHAS_SUNLIGHT; case ABIL_FEDHAS_RAIN: return TILEG_ABILITY_FEDHAS_RAIN; case ABIL_FEDHAS_PLANT_RING: