Skip to content

Commit

Permalink
S23: Prevent metamorph,summon,collar,Rashti from bypassing heat (#45)
Browse files Browse the repository at this point in the history
After #38, a third fire elemental obtained from collar
no longer allowed a fourth fire elemental recruited.

This commit prevents a third fire elemental obtained
through normal means to allow a fourth through collar.
  • Loading branch information
Slayer95 committed Apr 6, 2023
1 parent 6cd389d commit d50081c
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 9 deletions.
41 changes: 39 additions & 2 deletions macros/abilities.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#enddef

#define METAMORPH_FIRE ELEM TRANSFORM_MESSAGE IMAGE
{VARIABLE elem {ELEM}}
[set_menu_item]
id=metamorph_{ELEM}
description={TRANSFORM_MESSAGE}
Expand All @@ -64,9 +65,26 @@
[/filter_wml]
[/not]
[/have_unit]
[not]
[variable]
name=toohot
equals=yes
[/variable]
[variable]
name=elem
equals=Fire
[/variable]
[/not]
[/show_if]

[command]
[fire_event]
name=pre metamorph
[primary_unit]
x,y=$x1,$y1
[/primary_unit]
[/fire_event]

[if]
[have_unit]
type=EoMa_Water_Elemental,EoMa_Fire_Elemental,EoMa_Air_Elemental,EoMa_Earth_Elemental
Expand Down Expand Up @@ -99,11 +117,19 @@
[/effect]
moves=0
[/modify_unit]
[fire_event]
name=post metamorph
[primary_unit]
x,y=$x1,$y1
[/primary_unit]
[/fire_event]
[/command]
[/set_menu_item]
{CLEAR_VARIABLE elem}
#enddef

#define METAMORPH_FIRE_NO_AIR ELEM TRANSFORM_MESSAGE IMAGE
{VARIABLE elem {ELEM}}
[set_menu_item]
id=metamorph_{ELEM}
description={TRANSFORM_MESSAGE}
Expand Down Expand Up @@ -131,11 +157,21 @@
terrain=Q*,*^Qov,Mv
[/not]
[/have_location]
[not]
[variable]
name=toohot
equals=yes
[/variable]
[variable]
name=elem
equals=Fire
[/variable]
[/not]
[/show_if]

[command]
[fire_event]
name=pre collar
name=pre metamorph
[primary_unit]
x,y=$x1,$y1
[/primary_unit]
Expand Down Expand Up @@ -174,13 +210,14 @@
moves=0
[/modify_unit]
[fire_event]
name=post collar
name=post metamorph
[primary_unit]
x,y=$x1,$y1
[/primary_unit]
[/fire_event]
[/command]
[/set_menu_item]
{CLEAR_VARIABLE elem}
#enddef

#define METAMORPH_ALL
Expand Down
1 change: 1 addition & 0 deletions macros/macros.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@
x,y=$summonerleader.x,$summonerleader.y
find_vacant=yes
text= _ "Recalled..."
fire_event=yes
{COLOR_HEAL}
[/unstore_unit]
[animate_unit]
Expand Down
38 changes: 31 additions & 7 deletions scenarios/23_Ruins.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2221,6 +2221,7 @@ The order in which the spells are cast does not matter."
{CLEAR_VARIABLE castle_new}
{CLEAR_VARIABLE keep_new}
{CLEAR_VARIABLE summoners}
{CLEAR_VARIABLE toohot}
[endlevel]
result=victory
carryover_report=no
Expand Down Expand Up @@ -2596,7 +2597,7 @@ The order in which the spells are cast does not matter."

#fire elemental limit
[event]
name=recruit,recall,post advance,post summon,post gate,post collar
name=unit placed,post advance,post metamorph
first_time_only=yes

[filter]
Expand All @@ -2611,7 +2612,7 @@ The order in which the spells are cast does not matter."

#lock fire elementals
[event]
name=recruit,recall,post advance,post summon,post gate,post collar
name=unit placed,post advance,post metamorph
first_time_only=no

[filter]
Expand All @@ -2624,8 +2625,9 @@ The order in which the spells are cast does not matter."
count=3-999
[/have_unit]
[then]
{VARIABLE toohot yes}
[disallow_recruit]
side=1
side=1,5
type=EoMa_Fire_Avatar,EoMa_Fire_Elemental
[/disallow_recruit]
[store_unit]
Expand All @@ -2644,9 +2646,29 @@ The order in which the spells are cast does not matter."
[/if]
[/event]

[event]
name=try summon EoMa_Fire_Elemental
first_time_only=no

[if]
[have_unit]
type=EoMa_Fire_God,EoMa_Fire_Avatar,EoMa_Fire_Elemental
count=3-999
[/have_unit]
[then]
[fire_event]
name=fire_comment
[/fire_event]
[return][/return]
[/then]
[/if]
[/event]

#unlock fire elementals
[event]
name=die,pre collar
# Listen to last breath rather than die, so that unlocking always
# happens before possible revivals on a later name=die (e.g. from Collar.)
name=last breath,pre metamorph
first_time_only=no

[filter]
Expand All @@ -2655,12 +2677,13 @@ The order in which the spells are cast does not matter."

[if]
[have_unit]
type=EoMa_Fire_Avatar,EoMa_Fire_Elemental
count=3-999
type=EoMa_Fire_God,EoMa_Fire_Avatar,EoMa_Fire_Elemental
count=4-999
[/have_unit]
[else]
{VARIABLE toohot no}
[allow_recruit]
side=1
side=1,5
type=EoMa_Fire_Avatar,EoMa_Fire_Elemental
[/allow_recruit]
[foreach]
Expand All @@ -2679,6 +2702,7 @@ The order in which the spells are cast does not matter."

[event]
name=fire_comment
first_time_only=no

[message]
speaker=Mehir
Expand Down

0 comments on commit d50081c

Please sign in to comment.