Skip to content

Commit

Permalink
Add WATERWALKING flag, implement it in Magiclysm/MoM/XE (#75135)
Browse files Browse the repository at this point in the history
* Initial commit

* Update src/avatar_action.cpp

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update src/character.cpp

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update src/character.cpp

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update src/game.cpp

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update src/game.cpp

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update src/game.cpp

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Kick tests

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
Standing-Storm and github-actions[bot] authored Jul 22, 2024
1 parent 54ec149 commit 179f25a
Show file tree
Hide file tree
Showing 12 changed files with 146 additions and 92 deletions.
5 changes: 5 additions & 0 deletions data/json/flags.json
Original file line number Diff line number Diff line change
Expand Up @@ -2531,5 +2531,10 @@
"id": "ITEM_WATERPROOFING",
"type": "json_flag",
"info": "Something is preventing your worn and carried items from being effected by water."
},
{
"id": "WATERWALKING",
"type": "json_flag",
"info": "You can walk across the surface of water."
}
]
44 changes: 3 additions & 41 deletions data/mods/Magiclysm/Spells/druid.json
Original file line number Diff line number Diff line change
Expand Up @@ -1251,11 +1251,11 @@
"id": "druid_water_walking",
"type": "SPELL",
"name": "Water Strider's Walk",
"description": "While standing in water, enchant yourself so that the water will buoy you up and prevent you from sinking.",
"description": "Enchant yourself so that the water will buoy you up and prevent you from sinking, allowing you to walk on its surface.",
"valid_targets": [ "self" ],
"flags": [ "CONCENTRATE", "VERBAL", "SOMATIC", "NO_LEGS" ],
"effect": "effect_on_condition",
"effect_str": "EOC_DRUID_WATER_WALKING",
"effect": "attack",
"effect_str": "effect_druid_water_walking",
"shape": "blast",
"energy_source": "MANA",
"spell_class": "DRUID",
Expand All @@ -1268,44 +1268,6 @@
"duration_increment": { "math": [ "enhancement_proficiency_bonus_calculate(30000, 0.07)" ] },
"extra_effects": [ { "id": "eoc_enhancement_setup", "hit_self": true } ]
},
{
"type": "effect_on_condition",
"id": "EOC_DRUID_WATER_WALKING",
"condition": { "u_is_on_terrain_with_flag": "LIQUID" },
"effect": { "u_cast_spell": { "id": "druid_water_walking_real", "hit_self": true } },
"false_effect": { "u_message": "You must be standing on water to cast Water Strider's Walk", "type": "bad" }
},
{
"id": "druid_water_walking_real",
"type": "SPELL",
"name": "Water Strider's Walk Real",
"description": "The actual spell that lets you walk on water. It's a bug if you have it.",
"valid_targets": [ "self" ],
"flags": [ "CONCENTRATE", "VERBAL", "SOMATIC" ],
"effect": "spawn_item",
"effect_str": "aura_druid_waterwalk",
"shape": "blast",
"difficulty": 4,
"min_damage": 1,
"max_damage": 1,
"min_duration": {
"math": [ "( (u_spell_level('druid_water_walking') * 30000) + enhancement_proficiency_bonus_calculate(30000, 200))" ]
},
"max_duration": {
"math": [ "( (u_spell_level('druid_water_walking') * 30000) + enhancement_proficiency_bonus_calculate(30000, 200))" ]
}
},
{
"type": "effect_on_condition",
"id": "EOC_DRUID_WATERWALKING_REMOVERE",
"eoc_type": "EVENT",
"required_event": "avatar_moves",
"condition": { "and": [ { "u_has_item": "aura_druid_waterwalk" }, { "not": { "u_is_on_terrain_with_flag": "LIQUID" } } ] },
"effect": [
{ "u_remove_item_with": "aura_druid_waterwalk" },
{ "u_message": "As you leave the water, your spell fades.", "type": "bad" }
]
},
{
"id": "druid_traverse_the_wilds",
"type": "SPELL",
Expand Down
9 changes: 9 additions & 0 deletions data/mods/Magiclysm/effects/effects.json
Original file line number Diff line number Diff line change
Expand Up @@ -1293,6 +1293,15 @@
}
]
},
{
"type": "effect_type",
"id": "effect_druid_water_walking",
"name": [ "Water Strider's Walk" ],
"desc": [ "You can walk on the surface of the water" ],
"rating": "good",
"remove_message": "You can no longer walk on the water.",
"flags": [ "ITEM_WATERPROOFING", "WATERWALKING" ]
},
{
"type": "effect_type",
"id": "effect_druid_shifter_raven_form_levitation",
Expand Down
37 changes: 0 additions & 37 deletions data/mods/Magiclysm/items/ethereal_items.json
Original file line number Diff line number Diff line change
Expand Up @@ -1579,43 +1579,6 @@
}
]
},
{
"id": "aura_druid_waterwalk",
"type": "ARMOR",
"name": "Waterstrider's Walk",
"description": "You can easily walk on the surface of the water.",
"weight": "0 g",
"volume": "0 ml",
"price": "0 cent",
"material": [ "concentrated_mana" ],
"symbol": "O",
"color": "blue",
"flags": [
"AURA",
"SEMITANGIBLE",
"ONLY_ONE",
"PADDED",
"INTEGRATED",
"ALLOWS_NATURAL_ATTACKS",
"TRADER_AVOID",
"WATER_FRIENDLY",
"NO_REPAIR",
"NO_TAKEOFF",
"ZERO_WEIGHT",
"NONCONDUCTIVE",
"FLOTATION"
],
"relic_data": {
"passive_effects": [
{
"has": "WORN",
"condition": "ALWAYS",
"values": [ { "value": "MAX_MANA", "add": 0 } ],
"ench_effects": [ { "effect": "effect_item_protection_water", "intensity": 1 } ]
}
]
}
},
{
"id": "item_earthshaper_map_01",
"copy-from": "abstractmap",
Expand Down
38 changes: 38 additions & 0 deletions data/mods/Magiclysm/obsolete/eocs.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,43 @@
"type": "effect_on_condition",
"id": "EOC_BIO_EAT_TONS_OF_FOOD_MUTATION_REMOVER",
"effect": [ ]
},
{
"type": "effect_on_condition",
"id": "EOC_DRUID_WATER_WALKING",
"condition": { "u_is_on_terrain_with_flag": "LIQUID" },
"effect": { "u_cast_spell": { "id": "druid_water_walking_real", "hit_self": true } },
"false_effect": { "u_message": "You must be standing on water to cast Water Strider's Walk", "type": "bad" }
},
{
"id": "druid_water_walking_real",
"type": "SPELL",
"name": "Water Strider's Walk Real",
"description": "The actual spell that lets you walk on water. It's a bug if you have it.",
"valid_targets": [ "self" ],
"flags": [ "CONCENTRATE", "VERBAL", "SOMATIC" ],
"effect": "spawn_item",
"effect_str": "aura_druid_waterwalk",
"shape": "blast",
"difficulty": 4,
"min_damage": 1,
"max_damage": 1,
"min_duration": {
"math": [ "( (u_spell_level('druid_water_walking') * 30000) + enhancement_proficiency_bonus_calculate(30000, 200))" ]
},
"max_duration": {
"math": [ "( (u_spell_level('druid_water_walking') * 30000) + enhancement_proficiency_bonus_calculate(30000, 200))" ]
}
},
{
"type": "effect_on_condition",
"id": "EOC_DRUID_WATERWALKING_REMOVERE",
"eoc_type": "EVENT",
"required_event": "avatar_moves",
"condition": { "and": [ { "u_has_item": "aura_druid_waterwalk" }, { "not": { "u_is_on_terrain_with_flag": "LIQUID" } } ] },
"effect": [
{ "u_remove_item_with": "aura_druid_waterwalk" },
{ "u_message": "As you leave the water, your spell fades.", "type": "bad" }
]
}
]
39 changes: 39 additions & 0 deletions data/mods/Magiclysm/obsolete/items.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
[
{
"id": "aura_druid_waterwalk",
"type": "ARMOR",
"name": "Waterstrider's Walk",
"description": "You can easily walk on the surface of the water.",
"weight": "0 g",
"volume": "0 ml",
"price": "0 cent",
"material": [ "concentrated_mana" ],
"symbol": "O",
"color": "blue",
"flags": [
"AURA",
"SEMITANGIBLE",
"ONLY_ONE",
"PADDED",
"INTEGRATED",
"ALLOWS_NATURAL_ATTACKS",
"TRADER_AVOID",
"WATER_FRIENDLY",
"NO_REPAIR",
"NO_TAKEOFF",
"ZERO_WEIGHT",
"NONCONDUCTIVE",
"FLOTATION"
],
"relic_data": {
"passive_effects": [
{
"has": "WORN",
"condition": "ALWAYS",
"values": [ { "value": "MAX_MANA", "add": 0 } ],
"ench_effects": [ { "effect": "effect_item_protection_water", "intensity": 1 } ]
}
]
}
}
]
13 changes: 11 additions & 2 deletions data/mods/MindOverMatter/effects/effects_psionic.json
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,16 @@
]
}
],
"flags": [ "ETHEREAL", "INVISIBLE", "FEATHER_FALL", "CLIMB_NO_LADDER", "LEVITATION", "NO_PSIONICS" ]
"flags": [
"ETHEREAL",
"INVISIBLE",
"FEATHER_FALL",
"CLIMB_NO_LADDER",
"LEVITATION",
"ITEM_WATERPROOFING",
"WALK_UNDERWATER",
"NO_PSIONICS"
]
},
{
"type": "effect_type",
Expand Down Expand Up @@ -1549,7 +1558,7 @@
"rating": "good",
"max_duration": "7 days",
"max_intensity": 34,
"flags": [ "LEVITATION" ]
"flags": [ "LEVITATION", "ITEM_WATERPROOFING", "WATERWALKING" ]
},
{
"type": "effect_type",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,17 @@
{
"type": "mutation",
"id": "WAVE_RIDER",
"name": { "str": "Wave Rider" },
"name": { "str": "The Sea Bears Me Up" },
"points": 0,
"visibility": 0,
"ugliness": 0,
"description": "The waves themselves answer your call and create a special vehicle for you to travel across the surface of water.",
"description": "The waves themselves answer your call and support you, allowing you to walk on the surface of the water. Activate to walk on water.",
"category": [ "UNDINE" ],
"spells_learned": [ [ "wave_rider", 1 ] ]
"prereqs": [ "WATER_SEALED" ],
"prereqs2": [ "UNDINE_DEX_UP_1" ],
"active": true,
"activated_is_setup": true,
"active_flags": [ "WATERWALKING" ]
},
{
"type": "mutation",
Expand Down
3 changes: 2 additions & 1 deletion doc/JSON_FLAGS.md
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ Character flags can be `trait_id`, `json_flag_id` or `flag_id`. Some of these a
- ```SHAPESHIFT_SIZE_HUGE``` Changes your size to `creature_size::huge`. Checked last of the shapeshift size category flags and before any normal size flag. This and other shapeshift size flags must be paired with the ```TEMPORARY_SHAPESHIFT``` flag.
- ```SHAPESHIFT_SIZE_LARGE``` Changes your size to `creature_size::large`. Checked third of the shapeshift size category flags and before any normal size flag.
- ```SHAPESHIFT_SIZE_SMALL``` Changes your size to `creature_size::small`. Checked second of the shapeshift size category flags and before any normal size flag.
- ```SHAPESHIFT_SIZE_TINY``` Changes your size to `creature_size::tiny`. Checked second of the shapeshift size category flags and before any normal size flag.
- ```SHAPESHIFT_SIZE_TINY``` Changes your size to `creature_size::tiny`. Checked first of the shapeshift size category flags and before any normal size flag.
- ```SLUDGE_IMMUNE``` Critter is immune to sludge trail field (`fd_sludge`)
- ```SMALL``` Changes your size to `creature_size::small`. Checked second of the size category flags.
- ```SPIRITUAL``` Changes character's moral behaviour in some situations.
Expand All @@ -431,6 +431,7 @@ Character flags can be `trait_id`, `json_flag_id` or `flag_id`. Some of these a
- ```TREE_COMMUNION_PLUS``` Gain greatly enhanced effects from the Mycorrhizal Communion mutation.
- ```WALK_UNDERWATER``` your stamina burn is not increased when you swim, emulating you walking on the water bottom.
- ```WALL_CLING``` You can ascend/descend sheer cliffs as long as the tile above borders at least one wall. Chance to slip and fall each step.
- ```WATERWALKING``` You can walk across the surface of the water as though it were solid ground. Should usually be combined with `ITEM_WATERPROOFING` to protect items as well.
- ```WATCH``` You always know what time it is.
- ```WEBBED_FEET``` You have webbings on your feet, supporting your swimming speed if not wearing footwear.
- ```WEBBED_HANDS``` You have webbings on your hands, supporting your swimming speed.
Expand Down
7 changes: 5 additions & 2 deletions src/avatar_action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ static const furn_str_id furn_f_safe_c( "f_safe_c" );
static const itype_id itype_swim_fins( "swim_fins" );

static const json_character_flag json_flag_ITEM_WATERPROOFING( "ITEM_WATERPROOFING" );
static const json_character_flag json_flag_WATERWALKING( "WATERWALKING" );

static const move_mode_id move_mode_prone( "prone" );

Expand Down Expand Up @@ -452,6 +453,7 @@ bool avatar_action::move( avatar &you, map &m, const tripoint &d )
!m.has_flag_furn( "BRIDGE", dest_loc );
bool fromSwimmable = m.has_flag( ter_furn_flag::TFLAG_SWIMMABLE, you.pos_bub() );
bool fromDeepWater = m.has_flag( ter_furn_flag::TFLAG_DEEP_WATER, you.pos_bub() );
bool waterWalking = you.has_flag( json_flag_WATERWALKING );
bool fromBoat = veh0 != nullptr;
bool toBoat = veh1 != nullptr;
if( is_riding ) {
Expand All @@ -464,7 +466,7 @@ bool avatar_action::move( avatar &you, map &m, const tripoint &d )
}
}
// Dive into water!
if( toSwimmable && toDeepWater && !toBoat ) {
if( toSwimmable && toDeepWater && !toBoat && !waterWalking ) {
// Requires confirmation if we were on dry land previously
if( is_riding ) {
auto *mon = you.mounted_creature.get();
Expand Down Expand Up @@ -646,7 +648,8 @@ void avatar_action::swim( map &m, avatar &you, const tripoint &p )

int movecost = you.swim_speed();
you.practice( skill_swimming, you.is_underwater() ? 2 : 1 );
if( movecost >= 500 || you.has_effect( effect_winded ) ) {
if( ( movecost >= 500 || you.has_effect( effect_winded ) ) &&
!you.has_flag( json_flag_WATERWALKING ) ) {
if( !you.is_underwater() &&
!( you.shoe_type_count( itype_swim_fins ) == 2 ||
( you.shoe_type_count( itype_swim_fins ) == 1 && one_in( 2 ) ) ) ) {
Expand Down
9 changes: 9 additions & 0 deletions src/character.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@ static const json_character_flag json_flag_TOUGH_FEET( "TOUGH_FEET" );
static const json_character_flag json_flag_UNCANNY_DODGE( "UNCANNY_DODGE" );
static const json_character_flag json_flag_WALK_UNDERWATER( "WALK_UNDERWATER" );
static const json_character_flag json_flag_WATCH( "WATCH" );
static const json_character_flag json_flag_WATERWALKING( "WATERWALKING" );
static const json_character_flag json_flag_WEBBED_FEET( "WEBBED_FEET" );
static const json_character_flag json_flag_WEBBED_HANDS( "WEBBED_HANDS" );
static const json_character_flag json_flag_WINGS_2( "WINGS_2" );
Expand Down Expand Up @@ -7052,6 +7053,7 @@ void Character::burn_move_stamina( int moves )
///\EFFECT_SWIMMING decreases stamina burn when swimming
//Appropriate traits let you walk along the bottom without getting as tired
if( get_map().has_flag( ter_furn_flag::TFLAG_DEEP_WATER, pos_bub() ) &&
!has_flag( json_flag_WATERWALKING ) &&
( !has_flag( json_flag_WALK_UNDERWATER ) ||
get_map().has_flag( ter_furn_flag::TFLAG_GOES_DOWN, pos_bub() ) ) &&
!get_map().has_flag_furn( "BRIDGE", pos_bub() ) &&
Expand Down Expand Up @@ -10278,11 +10280,17 @@ std::vector<run_cost_effect> Character::run_cost_effects( float &movecost ) cons
// The "FLAT" tag includes soft surfaces, so not a good fit.
const bool on_road = flatground && here.has_flag( ter_furn_flag::TFLAG_ROAD, pos_bub() );
const bool on_fungus = here.has_flag_ter_or_furn( ter_furn_flag::TFLAG_FUNGUS, pos_bub() );
const bool water_walking = here.has_flag_ter_or_furn( ter_furn_flag::TFLAG_SWIMMABLE, pos_bub() ) &&
has_flag( json_flag_WATERWALKING );

if( is_mounted() ) {
return effects;
}

if( water_walking ) {
movecost = 100;
}

if( movecost > 105 ) {
float obstacle_mult = enchantment_cache->modify_value( enchant_vals::mod::MOVECOST_OBSTACLE_MOD,
1 );
Expand All @@ -10292,6 +10300,7 @@ std::vector<run_cost_effect> Character::run_cost_effects( float &movecost ) cons
run_cost_effect_mul( 0.5, _( "Parkour" ) );
}


if( movecost < 100 ) {
run_cost_effect effect { _( "Bonuses Capped" ) };
effects.push_back( effect );
Expand Down
Loading

0 comments on commit 179f25a

Please sign in to comment.