Skip to content

Commit

Permalink
You can now pick up gold in frail corners (#1678)
Browse files Browse the repository at this point in the history
Fixes #1517
  • Loading branch information
AdamPlenty committed Jul 28, 2022
1 parent 644cfa0 commit 6657e5a
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/magic.c
Expand Up @@ -584,7 +584,8 @@ TbBool can_cast_power_at_xy(PlayerNumber plyr_idx, PowerKind pwkind,
}
PlayerNumber slb_owner;
slb_owner = slabmap_owner(slb);
if ((mapblk->flags & SlbAtFlg_Blocking) != 0)
TbBool subtile_is_liquid_or_path = ( (subtile_is_liquid(stl_x, stl_y)) || (subtile_is_unclaimed_path(stl_x, stl_y)) );
if ( ((mapblk->flags & SlbAtFlg_Blocking) != 0) && (!subtile_is_liquid_or_path) )
{
if ((can_cast & PwCast_Claimable) != 0)
{
Expand Down Expand Up @@ -626,7 +627,7 @@ TbBool can_cast_power_at_xy(PlayerNumber plyr_idx, PowerKind pwkind,
{
if ((can_cast & PwCast_Claimable) != 0)
{
if (slab_kind_is_liquid(slb->kind))
if (subtile_is_liquid(stl_x, stl_y))
{
return false;
}
Expand All @@ -641,6 +642,10 @@ TbBool can_cast_power_at_xy(PlayerNumber plyr_idx, PowerKind pwkind,
if (slbattr->category == SlbAtCtg_Unclaimed) {
return true;
}
if (subtile_is_liquid_or_path)
{
return true;
}
}
if ((can_cast & PwCast_NeutrlGround) != 0)
{
Expand Down
17 changes: 17 additions & 0 deletions src/map_columns.c
Expand Up @@ -545,6 +545,11 @@ TbBool cube_is_lava(long cube_id)
return (cube_id == 40) || (cube_id == 41);
}

TbBool cube_is_unclaimed_path(long cube_id)
{
return ( (cube_id == 0) || ( (cube_id >= 25) && (cube_id <= 29) ) );
}

/**
* Returns if given cube is a sacrificial ground or magic door surface.
* @param cube_id
Expand Down Expand Up @@ -596,6 +601,18 @@ TbBool subtile_has_sacrificial_on_top(MapSubtlCoord stl_x, MapSubtlCoord stl_y)
return cube_pos<4 && cube_is_sacrificial(i);
}

TbBool subtile_is_liquid(MapSubtlCoord stl_x, MapSubtlCoord stl_y)
{
return ( (subtile_has_water_on_top(stl_x, stl_y)) || (subtile_has_lava_on_top(stl_x, stl_y)) );
}

TbBool subtile_is_unclaimed_path(MapSubtlCoord stl_x, MapSubtlCoord stl_y)
{
long i;
i = get_top_cube_at(stl_x, stl_y, NULL);
return cube_is_unclaimed_path(i);
}

/******************************************************************************/
#ifdef __cplusplus
}
Expand Down
3 changes: 3 additions & 0 deletions src/map_columns.h
Expand Up @@ -99,10 +99,13 @@ long get_ceiling_height_at_subtile(MapSubtlCoord stl_x, MapSubtlCoord stl_y);
TbBool cube_is_water(long cube_id);
TbBool cube_is_lava(long cube_id);
TbBool cube_is_sacrificial(long cube_id);
TbBool cube_is_unclaimed_path(long cube_id);

TbBool subtile_has_water_on_top(MapSubtlCoord stl_x, MapSubtlCoord stl_y);
TbBool subtile_has_lava_on_top(MapSubtlCoord stl_x, MapSubtlCoord stl_y);
TbBool subtile_has_sacrificial_on_top(MapSubtlCoord stl_x, MapSubtlCoord stl_y);
TbBool subtile_is_liquid(MapSubtlCoord stl_x, MapSubtlCoord stl_y);
TbBool subtile_is_unclaimed_path(MapSubtlCoord stl_x, MapSubtlCoord stl_y);

/******************************************************************************/
#ifdef __cplusplus
Expand Down
2 changes: 2 additions & 0 deletions src/packets_input.c
Expand Up @@ -208,6 +208,7 @@ TbBool process_dungeon_power_hand_state(long plyr_idx)
player->additional_flags |= PlaAF_ChosenSubTileIsHigh;
get_dungeon_highlight_user_roomspace(&playeradd->render_roomspace, player->id_number, stl_x, stl_y);
tag_cursor_blocks_dig(player->id_number, stl_x, stl_y, player->full_slab_cursor);
player->thing_under_hand = 0;
}
}
if (player->hand_thing_idx != 0)
Expand Down Expand Up @@ -261,6 +262,7 @@ TbBool process_dungeon_control_packet_dungeon_control(long plyr_idx)
{
if (player->primary_cursor_state == CSt_PickAxe)
{
player->thing_under_hand = 0;
get_dungeon_highlight_user_roomspace(&playeradd->render_roomspace, player->id_number, stl_x, stl_y);
tag_cursor_blocks_dig(player->id_number, stl_x, stl_y, player->full_slab_cursor);
}
Expand Down

0 comments on commit 6657e5a

Please sign in to comment.