Skip to content

Commit

Permalink
Fedhas rework part 3: remove Sunlight
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
gammafunk committed Sep 14, 2019
1 parent 0258651 commit 565790d
Show file tree
Hide file tree
Showing 16 changed files with 12 additions and 203 deletions.
3 changes: 1 addition & 2 deletions crawl-ref/source/ability-type.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
5 changes: 0 additions & 5 deletions crawl-ref/source/ability.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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())
Expand Down
7 changes: 0 additions & 7 deletions crawl-ref/source/areas.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 0 additions & 7 deletions crawl-ref/source/dat/descript/ability.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion crawl-ref/source/dungeon.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion crawl-ref/source/env.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ struct crawl_environment
int forest_awoken_until;
int density;
int absdepth0;
vector<pair<coord_def, int> > sunlight;

// Remaining fields not marshalled:

Expand Down
156 changes: 0 additions & 156 deletions crawl-ref/source/god-abil.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<int> 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<typename T>
static bool less_second(const T & left, const T & right)
{
Expand Down
2 changes: 0 additions & 2 deletions crawl-ref/source/god-abil.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,6 @@ int place_ring(vector<coord_def>& ring_points,
// (walls/statues).
void collect_radius_points(vector<vector<coord_def> > &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<coord_def>& candidates);
bool fedhas_plant_ring_from_rations();
int fedhas_rain(const coord_def &target);
Expand Down
3 changes: 0 additions & 3 deletions crawl-ref/source/player-reacts.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion crawl-ref/source/religion.cc
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,6 @@ const vector<god_power> 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" },
Expand Down
1 change: 0 additions & 1 deletion crawl-ref/source/rltiles/dc-invocations.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Binary file not shown.
2 changes: 0 additions & 2 deletions crawl-ref/source/stairs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions crawl-ref/source/tag-version.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 10 additions & 13 deletions crawl-ref/source/tags.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions crawl-ref/source/tilepick.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 565790d

Please sign in to comment.