mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-12 11:21:15 +00:00
Rewrote the rising water event to be much shorter and more efficient,
...and cleaned up some of the human explorers' conditional dialogue.
This commit is contained in:
parent
e471d376da
commit
15f648adfc
@ -664,13 +664,6 @@
|
||||
value=0
|
||||
[/set_variable]
|
||||
|
||||
# used to display alternate death message if the last of the 3 humans dies
|
||||
# from drowning instead of being killed by another unit
|
||||
[set_variable]
|
||||
name=human_drowned
|
||||
value=0
|
||||
[/set_variable]
|
||||
|
||||
[set_variable]
|
||||
name=entered_gate
|
||||
value=0
|
||||
@ -1696,110 +1689,96 @@
|
||||
add=1
|
||||
[/set_variable]
|
||||
|
||||
#kill human before displaying messages
|
||||
[kill]
|
||||
side=2
|
||||
animate=no
|
||||
[/kill]
|
||||
|
||||
# Vary dialogue depending on what kind of sea life the humans originally
|
||||
# mentioned. Also if last human died from drowning instead of being killed
|
||||
# have Kaleh as the question, instead of the victorious unit.
|
||||
|
||||
[if]
|
||||
[variable]
|
||||
name=type_of_sealife
|
||||
numerical_equals=1
|
||||
[/variable]
|
||||
[switch]
|
||||
variable=type_of_sealife
|
||||
|
||||
[then]
|
||||
# case 1: humans saw an elf first and mentioned hermit crabs
|
||||
# case 1: humans saw an elf first and mentioned hermit crabs
|
||||
[case]
|
||||
value=1
|
||||
|
||||
[if]
|
||||
[variable]
|
||||
name=human_drowned
|
||||
numerical_equals=1
|
||||
[/variable]
|
||||
# Checks if the unit was killed by the player or whether it drowned
|
||||
[have_unit]
|
||||
side=1
|
||||
x,y=$x2,$y2
|
||||
[/have_unit]
|
||||
|
||||
[then]
|
||||
[message]
|
||||
speaker=Kaleh
|
||||
message= _ "Fish bait? Hermit Crabs? Who are these humans and what were they talking about?"
|
||||
[/message]
|
||||
[/then]
|
||||
|
||||
[else]
|
||||
{CHECK_SPEAKER}
|
||||
[message]
|
||||
speaker=$speaking_unit.id
|
||||
message= _ "Fish bait? Hermit Crabs? Who are these humans and what were they talking about?"
|
||||
[/message]
|
||||
{CLEAR_VARIABLE speaking_unit}
|
||||
[/else]
|
||||
[/if]
|
||||
[/then]
|
||||
|
||||
[else]
|
||||
[if]
|
||||
[variable]
|
||||
name=type_of_sealife
|
||||
numerical_equals=2
|
||||
[/variable]
|
||||
|
||||
[then]
|
||||
# case 2: humans saw troll ally first and mentioned barnacles
|
||||
|
||||
[if]
|
||||
[variable]
|
||||
name=human_drowned
|
||||
numerical_equals=1
|
||||
[/variable]
|
||||
|
||||
[then]
|
||||
[message]
|
||||
speaker=Kaleh
|
||||
message= _ "Fish bait? Barnacles? Who are these humans and what were they talking about?"
|
||||
[/message]
|
||||
[/then]
|
||||
|
||||
[else]
|
||||
{CHECK_SPEAKER}
|
||||
[message]
|
||||
speaker=$speaking_unit.id
|
||||
message= _ "Fish bait? Barnacles? Who are these humans and what were they talking about?"
|
||||
[/message]
|
||||
{CLEAR_VARIABLE speaking_unit}
|
||||
[/else]
|
||||
[/if]
|
||||
[/then]
|
||||
|
||||
[else]
|
||||
# case 3: humans saw dwarf ally first and mentioned cuttlefish
|
||||
|
||||
[if]
|
||||
[variable]
|
||||
name=human_drowned
|
||||
numerical_equals=1
|
||||
[/variable]
|
||||
|
||||
[then]
|
||||
[message]
|
||||
speaker=Kaleh
|
||||
message= _ "Fish bait? Cuttlefish? Who are these humans and what were they talking about?"
|
||||
[/message]
|
||||
[/then]
|
||||
|
||||
[else]
|
||||
[message]
|
||||
speaker=second_unit
|
||||
message= _ "Fish bait? Cuttlefish? Who are these humans and what were they talking about?"
|
||||
[/message]
|
||||
[/else]
|
||||
[/if]
|
||||
[message]
|
||||
speaker=Kaleh
|
||||
message= _ "Fish bait? Hermit Crabs? Who are these humans and what were they talking about?"
|
||||
[/message]
|
||||
[/else]
|
||||
[/if]
|
||||
[/else]
|
||||
[/if]
|
||||
[/case]
|
||||
|
||||
# case 2: humans saw troll ally first and mentioned barnacles
|
||||
[case]
|
||||
value=2
|
||||
|
||||
[if]
|
||||
[have_unit]
|
||||
side=1
|
||||
x,y=$x2,$y2
|
||||
[/have_unit]
|
||||
|
||||
[then]
|
||||
{CHECK_SPEAKER}
|
||||
[message]
|
||||
speaker=$speaking_unit.id
|
||||
message= _ "Fish bait? Barnacles? Who are these humans and what were they talking about?"
|
||||
[/message]
|
||||
{CLEAR_VARIABLE speaking_unit}
|
||||
[/then]
|
||||
|
||||
[else]
|
||||
[message]
|
||||
speaker=Kaleh
|
||||
message= _ "Fish bait? Barnacles? Who are these humans and what were they talking about?"
|
||||
[/message]
|
||||
[/else]
|
||||
[/if]
|
||||
[/case]
|
||||
|
||||
# case 3: humans saw dwarf ally first and mentioned cuttlefish
|
||||
[case]
|
||||
value=3
|
||||
|
||||
[if]
|
||||
[have_unit]
|
||||
side=1
|
||||
x,y=$x2,$y2
|
||||
[/have_unit]
|
||||
|
||||
[then]
|
||||
[message]
|
||||
speaker=second_unit
|
||||
message= _ "Fish bait? Cuttlefish? Who are these humans and what were they talking about?"
|
||||
[/message]
|
||||
[/then]
|
||||
|
||||
[else]
|
||||
[message]
|
||||
speaker=Kaleh
|
||||
message= _ "Fish bait? Cuttlefish? Who are these humans and what were they talking about?"
|
||||
[/message]
|
||||
[/else]
|
||||
[/if]
|
||||
[/case]
|
||||
[/switch]
|
||||
|
||||
[message]
|
||||
speaker=Zhul
|
||||
@ -5706,14 +5685,13 @@
|
||||
# Turn all cave tiles within one hex of water to shallow water
|
||||
|
||||
# Step by Step Process:
|
||||
# 1. change all shallow water hexes to ice
|
||||
# 2. change hexes adjacent to ice to shallow water (except for cave wall)
|
||||
# 3. change ice to deep water
|
||||
# 4. kill any unit in deep water, destroy any items in deep water
|
||||
# 1. change all shallow water hexes to deep water
|
||||
# 2. change all hexes adjacent to water to shallow water
|
||||
# 3. destroy any items in the new deep water
|
||||
# 4. kill any units in deep water
|
||||
|
||||
[event]
|
||||
name=new turn
|
||||
|
||||
first_time_only=no
|
||||
|
||||
[if]
|
||||
@ -5731,213 +5709,93 @@
|
||||
[/not]
|
||||
|
||||
[then]
|
||||
# 1. change all shallow water hexes to ice
|
||||
[store_locations]
|
||||
[filter_adjacent_location]
|
||||
terrain=Ww
|
||||
[/filter_adjacent_location]
|
||||
|
||||
terrain=!,Xu,Mm^Xm,Md,W*
|
||||
variable=dry_to_shallow_locs
|
||||
[/store_locations]
|
||||
|
||||
[store_locations]
|
||||
terrain=Ww
|
||||
variable=shallowwater_loc
|
||||
variable=shallow_to_deep_locs
|
||||
[/store_locations]
|
||||
|
||||
{FOREACH shallowwater_loc i}
|
||||
[set_variable]
|
||||
name=water_x
|
||||
to_variable=shallowwater_loc[$i].x
|
||||
[/set_variable]
|
||||
|
||||
[set_variable]
|
||||
name=water_y
|
||||
to_variable=shallowwater_loc[$i].y
|
||||
[/set_variable]
|
||||
|
||||
{FOREACH dry_to_shallow_locs i}
|
||||
[terrain]
|
||||
terrain=Ai
|
||||
x,y=$water_x,$water_y
|
||||
terrain=Ww
|
||||
x,y=$dry_to_shallow_locs[$i].x,$dry_to_shallow_locs[$i].y
|
||||
[/terrain]
|
||||
{NEXT i}
|
||||
|
||||
{CLEAR_VARIABLE shallowwater_loc}
|
||||
|
||||
# 2. change caves adjacent to ice to shallow water
|
||||
|
||||
#That step of the algorithm was bugged and otherwise completly insane
|
||||
#So completly rewritten below
|
||||
#And mercifuly short
|
||||
|
||||
[store_locations]
|
||||
terrain=Ai
|
||||
variable=ice_loc
|
||||
[/store_locations]
|
||||
|
||||
{FOREACH ice_loc i}
|
||||
[set_variable]
|
||||
name=coord_x
|
||||
to_variable=ice_loc[$i].x
|
||||
[/set_variable]
|
||||
|
||||
[set_variable]
|
||||
name=coord_y
|
||||
to_variable=ice_loc[$i].y
|
||||
[/set_variable]
|
||||
|
||||
# find adjacent hex with cave floor or dirt
|
||||
|
||||
[store_locations]
|
||||
[filter_adjacent_location]
|
||||
x=$coord_x
|
||||
y=$coord_y
|
||||
[/filter_adjacent_location]
|
||||
terrain=Uu, Re, Uu^Vu, Ce, Ke, Ch, Rr, Qxu, Uh, Uu^Uf, Urb
|
||||
variable=hex_loc
|
||||
[/store_locations]
|
||||
|
||||
{FOREACH hex_loc j}
|
||||
[set_variable]
|
||||
name=water_x
|
||||
to_variable=hex_loc[$j].x
|
||||
[/set_variable]
|
||||
|
||||
[set_variable]
|
||||
name=water_y
|
||||
to_variable=hex_loc[$j].y
|
||||
[/set_variable]
|
||||
|
||||
[terrain]
|
||||
terrain=Ww
|
||||
x,y=$water_x,$water_y
|
||||
[/terrain]
|
||||
{NEXT j}
|
||||
{NEXT i}
|
||||
|
||||
{CLEAR_VARIABLE ice_loc}
|
||||
|
||||
# 3. change ice to deep water
|
||||
|
||||
[store_locations]
|
||||
terrain=Ai
|
||||
variable=shallowwater_loc
|
||||
[/store_locations]
|
||||
|
||||
{FOREACH shallowwater_loc i}
|
||||
[set_variable]
|
||||
name=water_x
|
||||
to_variable=shallowwater_loc[$i].x
|
||||
[/set_variable]
|
||||
|
||||
[set_variable]
|
||||
name=water_y
|
||||
to_variable=shallowwater_loc[$i].y
|
||||
[/set_variable]
|
||||
|
||||
{FOREACH shallow_to_deep_locs i}
|
||||
[terrain]
|
||||
terrain=Wo
|
||||
x,y=$water_x,$water_y
|
||||
x,y=$shallow_to_deep_locs[$i].x,$shallow_to_deep_locs[$i].y
|
||||
[/terrain]
|
||||
|
||||
[removeitem]
|
||||
x,y=$shallow_to_deep_locs[$i].x,$shallow_to_deep_locs[$i].y
|
||||
[/removeitem]
|
||||
{NEXT i}
|
||||
|
||||
# 4. kill any unit in deep water, destroy any items in deep water
|
||||
# Killing of units who ended up in deep water
|
||||
# Note: the only reason I'm not doing this in the above FOREACH
|
||||
# is to catch corner cases where a unit ends up in deep water on
|
||||
# its own turn, which the above loop would not catch
|
||||
[store_unit]
|
||||
[filter]
|
||||
[filter_location]
|
||||
terrain=Wo
|
||||
[/filter_location]
|
||||
|
||||
[store_locations]
|
||||
terrain=Wo
|
||||
variable=deepwater_loc
|
||||
[/store_locations]
|
||||
# Undead can't drown
|
||||
[not]
|
||||
side=3
|
||||
[/not]
|
||||
|
||||
{FOREACH deepwater_loc i}
|
||||
[set_variable]
|
||||
name=water_x
|
||||
to_variable=deepwater_loc[$i].x
|
||||
[/set_variable]
|
||||
# Only units which cannot move in deep water can drown
|
||||
movement_cost=99
|
||||
[/filter]
|
||||
|
||||
[set_variable]
|
||||
name=water_y
|
||||
to_variable=deepwater_loc[$i].y
|
||||
[/set_variable]
|
||||
|
||||
#destroy any items in deep water
|
||||
[removeitem]
|
||||
x,y=$water_x,$water_y
|
||||
[/removeitem]
|
||||
|
||||
# If unit side is not 3 then kill unit. (side 3is undead who can't drown)
|
||||
# Also if unit side is 1 then display death message: "I'm drowning!"
|
||||
|
||||
[store_locations]
|
||||
x,y=$water_x,$water_y
|
||||
[filter]
|
||||
side=1,2,4,5,6,7,8,9
|
||||
[/filter]
|
||||
variable=victim_side
|
||||
[/store_locations]
|
||||
kill=no
|
||||
variable=drowning_units
|
||||
[/store_unit]
|
||||
|
||||
{FOREACH drowning_units i}
|
||||
# If unit side is 1 then display a death message
|
||||
[if]
|
||||
[variable]
|
||||
name=victim_side.length
|
||||
numerical_equals=1
|
||||
[/variable]
|
||||
[have_unit]
|
||||
x,y=$drowning_units[$i].x,$drowning_units[$i].y
|
||||
side=1
|
||||
|
||||
[not]
|
||||
type=Dust Devil
|
||||
[/not]
|
||||
|
||||
[not]
|
||||
type=Flesh Golem
|
||||
[/not]
|
||||
[/have_unit]
|
||||
|
||||
[then]
|
||||
[store_locations]
|
||||
x,y=$water_x,$water_y
|
||||
[filter]
|
||||
side=1
|
||||
[/filter]
|
||||
variable=victim_side
|
||||
[/store_locations]
|
||||
|
||||
[if]
|
||||
[variable]
|
||||
name=victim_side.length
|
||||
numerical_equals=1
|
||||
[/variable]
|
||||
|
||||
[then]
|
||||
[message]
|
||||
x,y=$water_x,$water_y
|
||||
message= _ "Help, I'm drowning!"
|
||||
[/message]
|
||||
[/then]
|
||||
[/if]
|
||||
|
||||
# if it is a human that drowned, set the flag
|
||||
# flag is used for death event of 3 human spelunkers, to display
|
||||
# alternate death message if the last of them dies from drowning
|
||||
[store_locations]
|
||||
x,y=$water_x,$water_y
|
||||
[filter]
|
||||
side=2
|
||||
[/filter]
|
||||
variable=victim_side
|
||||
[/store_locations]
|
||||
|
||||
[if]
|
||||
[variable]
|
||||
name=victim_side.length
|
||||
numerical_equals=1
|
||||
[/variable]
|
||||
|
||||
[then]
|
||||
[set_variable]
|
||||
name=human_drowned
|
||||
value=1
|
||||
[/set_variable]
|
||||
[/then]
|
||||
[/if]
|
||||
|
||||
[kill]
|
||||
x,y=$water_x,$water_y
|
||||
animate=no
|
||||
fire_event=yes
|
||||
[/kill]
|
||||
|
||||
#clear the flag
|
||||
[set_variable]
|
||||
name=human_drowned
|
||||
value=0
|
||||
[/set_variable]
|
||||
[message]
|
||||
x,y=$drowning_units[$i].x,$drowning_units[$i].y
|
||||
message= _ "Help, I'm drowning!"
|
||||
[/message]
|
||||
[/then]
|
||||
[/if]
|
||||
|
||||
[kill]
|
||||
x,y=$drowning_units[$i].x,$drowning_units[$i].y
|
||||
animate=yes
|
||||
fire_event=yes
|
||||
[/kill]
|
||||
{NEXT i}
|
||||
|
||||
{CLEAR_VARIABLE deepwater_loc}
|
||||
{CLEAR_VARIABLE shallow_to_deep_locs,dry_to_shallow_locs,drowning_units}
|
||||
[/then]
|
||||
[/if]
|
||||
[/event]
|
||||
@ -6394,7 +6252,6 @@
|
||||
|
||||
{CLEAR_VARIABLE type_of_sealife}
|
||||
{CLEAR_VARIABLE humans_killed}
|
||||
{CLEAR_VARIABLE human_drowned}
|
||||
{CLEAR_VARIABLE entered_training_hall}
|
||||
{CLEAR_VARIABLE broke_circle}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user