Fix refunding and returning to recall list of wrong recalls (fixes bug #10993).

This commit is contained in:
Jan Rietema 2008-02-08 16:47:31 +00:00
parent aa14678eb0
commit 48e0ab14eb

View file

@ -40,42 +40,87 @@
[/if]
#enddef
#define REFUND TYPE
#define REFUND_AND_REMOVE_RECRUIT
[if]
[variable]
name={TYPE}
equals=Elvish Fighter
# is it a recall?
# FIXME: units could be recalled with 0 xp
name=recruit.experience
greater_than=0
[/variable]
[then]
[gold]
amount=14
amount=20
[/gold]
# put the unit back into the recall list
# ugly trait hack...
[unit]
side=$recruit.side
user_description=$recruit.user_description
type=$recruit.type
experience=$recruit.experience
gender=$recruit.gender
[modifications]
[trait]
id=$recruit.modifications.trait[0].id
name=$recruit.modifications.trait[0].name
[effect]
apply_to=$recruit.modifications.trait[0].effect[0].apply_to
# hitpoints (resilient & quick)
increase_total=$recruit.modifications.trait[0].effect[0].increase_total
times=$recruit.modifications.trait[0].effect[0].times
# damage (strong, dextrous)
increase_damage=$recruit.modifications.trait[0].effect[0].increase_damage
range=$recruit.modifications.trait[0].effect[0].range
# movement (quick), experience (intelligent)
increase=$recruit.modifications.trait[0].effect[0].increase
[/effect]
[effect]
apply_to=$recruit.modifications.trait[0].effect[1].apply_to
# hitpoints (resilient & quick)
increase_total=$recruit.modifications.trait[0].effect[1].increase_total
times=$recruit.modifications.trait[0].effect[1].times
# damage (strong, dextrous)
increase_damage=$recruit.modifications.trait[0].effect[1].increase_damage
range=$recruit.modifications.trait[0].effect[1].range
# movement (quick), experience (intelligent)
increase=$recruit.modifications.trait[0].effect[1].increase
[/effect]
[/trait]
[trait]
id=$recruit.modifications.trait[1].id
name=$recruit.modifications.trait[1].name
[effect]
apply_to=$recruit.modifications.trait[1].effect[0].apply_to
# hitpoints (resilient & quick)
increase_total=$recruit.modifications.trait[1].effect[0].increase_total
times=$recruit.modifications.trait[1].effect[0].times
# damage (strong, dextrous)
increase_damage=$recruit.modifications.trait[1].effect[0].increase_damage
range=$recruit.modifications.trait[1].effect[0].range
# movement (quick), experience (intelligent)
increase=$recruit.modifications.trait[1].effect[0].increase
[/effect]
[effect]
apply_to=$recruit.modifications.trait[1].effect[1].apply_to
# hitpoints (resilient & quick)
increase_total=$recruit.modifications.trait[1].effect[1].increase_total
times=$recruit.modifications.trait[1].effect[1].times
# damage (strong, dextrous)
increase_damage=$recruit.modifications.trait[1].effect[1].increase_damage
range=$recruit.modifications.trait[1].effect[1].range
# movement (quick), experience (intelligent)
increase=$recruit.modifications.trait[1].effect[1].increase
[/effect]
[/trait]
[/modifications]
[/unit]
[/then]
[else]
[if]
[variable]
name={TYPE}
equals=Elvish Archer
[/variable]
[then]
[gold]
amount=17
[/gold]
[/then]
[else]
[if]
[variable]
name={TYPE}
equal=Elvish Shaman
[/variable]
[then]
[gold]
amount=15
[/gold]
[/then]
[/if]
[/else]
[/if]
# simply use cost to return
[gold]
amount=$recruit.cost
[/gold]
[/else]
[/if]
#enddef
@ -516,6 +561,7 @@ One Elvish Shaman")}
# What did they recruit?
[store_unit]
variable=recruit
kill=yes
[filter]
x,y=$x1,$y1
[/filter]
@ -530,13 +576,13 @@ One Elvish Shaman")}
not_equals=Elvish Shaman
[/variable]
[then]
{REFUND recruit.type}
[kill]
x,y=$x1,$y1
[/kill]
{REFUND_AND_REMOVE_RECRUIT}
{TEACHER (_"No! I said recruit an Elvish SHAMAN! Now try again...")}
[/then]
[else]
[unstore_unit]
variable=recruit
[/unstore_unit]
{VARIABLE_OP recruit_num add 1}
{UNLABEL 10,2}
{CLEAR_PRINT}
@ -562,17 +608,11 @@ One Elvish Shaman")}
not_equals=Elvish Archer
[/variable]
[then]
{REFUND recruit.type}
[kill]
x,y=$x1,$y1
[/kill]
{REFUND_AND_REMOVE_RECRUIT}
{TEACHER (_"No! I said recruit an Elvish ARCHER! Now try again...")}
[/then]
[else]
{VARIABLE_OP recruit_num add 1}
[kill]
x,y=$x1,$y1
[/kill]
[unit]
description=Eowynial
user_description=_"Eowynial"
@ -607,17 +647,11 @@ One Elvish Shaman")}
not_equals=Elvish Archer
[/variable]
[then]
{REFUND recruit.type}
[kill]
x,y=$x1,$y1
[/kill]
{REFUND_AND_REMOVE_RECRUIT}
{TEACHER (_"No! I said recruit an Elvish ARCHER! Now try again...")}
[/then]
[else]
{VARIABLE_OP recruit_num add 1}
[kill]
x,y=$x1,$y1
[/kill]
[unit]
description=Elriend
user_description=_"Elriend"
@ -653,15 +687,14 @@ One Elvish Shaman")}
not_equals=$recall_name2
[/variable]
[then]
# FIXME: Did they recruit, or recall?
{REFUND recruit.type}
[kill]
x,y=$x1,$y1
[/kill]
{REFUND_AND_REMOVE_RECRUIT}
{TEACHER (_"No! I said RECALL $recall_name2|! Now try again...")}
[/then]
[else]
{VARIABLE_OP recruit_num add 1}
[unstore_unit]
variable=recruit
[/unstore_unit]
{UNLABEL 11,4}
# wmlindent: start ignoring
{LABEL (_"Archer #1") 9,4}
@ -679,18 +712,11 @@ One Elvish Shaman")}
not_equals=Elvish Fighter
[/variable]
[then]
{REFUND recruit.type}
[kill]
x,y=$x1,$y1
[/kill]
{REFUND_AND_REMOVE_RECRUIT}
{TEACHER (_"No! I said recruit an Elvish FIGHTER! Now try again...")}
[/then]
[else]
{VARIABLE_OP recruit_num add 1}
[kill]
x,y=$x1,$y1
[/kill]
[unit]
description=Golir
user_description=_"Golir"
@ -741,37 +767,21 @@ One Elvish Shaman")}
equals=$recall_name2
[/variable]
[then]
[gold]
amount=20
[/gold]
[store_unit]
variable=unrecall
[filter]
x,y=$x1,$y1
[/filter]
kill=yes
[/store_unit]
{VARIABLE unrecall.x 0}
{VARIABLE unrecall.y 0}
[unstore_unit]
variable=unrecall
[/unstore_unit]
{CLEAR_VARIABLE unrecall}
{REFUND_AND_REMOVE_RECRUIT}
{TEACHER (_"No! I said recall $recall_name1, not $recall_name2|! Now try again...")}
[/then]
[else]
{REFUND recruit.type}
{REFUND_AND_REMOVE_RECRUIT}
{TEACHER (_"No! I said RECALL $recall_name1 from the last battle, not recruit a new $recruit.language_name|! Now try again...")}
[kill]
x,y=$x1,$y1
[/kill]
[/else]
[/if]
[/then]
[else]
{VARIABLE_OP recruit_num add 1}
{UNLABEL 10,4}
[unstore_unit]
variable=recruit
[/unstore_unit]
[if]
[variable]
name=recall_xp2
@ -797,20 +807,20 @@ One Elvish Shaman")}
name=recruit.type
not_equals=Elvish Fighter
[/variable]
[or]
[variable]
# FIXME: not a perfect indicator of recall
name=recruit.experience
greater_than=0
[/variable]
[/or]
[then]
{REFUND recruit.type}
{REFUND_AND_REMOVE_RECRUIT}
{TEACHER (_"$recruit.language_name|? I said RECRUIT a new ELVISH FIGHTER. Now try again...")}
[kill]
x,y=$x1,$y1
[/kill]
[/then]
[else]
{UNLABEL 10,4}
{VARIABLE_OP recruit_num add 1}
[kill]
x,y=$x1,$y1
[/kill]
[unit]
description=Elindel
user_description=_"Elindel"