#textdomain wesnoth-nr
## Common code for hero deaths.

# Krash death events
[event]
    name=last breath
    [filter]
        id=Krash
    [/filter]

    [message]
        speaker=Krash
        message= _ " *roars in pain*"
    [/message]
    [message]
        speaker=Tallin
        message= _ "Krash!"
    [/message]
[/event]

[event]
    name=die
    [filter]
        id=Krash
    [/filter]
    [music]
        name=sad.ogg
        play_once=yes
    [/music]

    [message]
        speaker=Father Morvin
        message= _ "It's no good, Tallin, he is gone."
    [/message]
    [message]
        speaker=Tallin
        message= _ "You wretched monsters! You are going to pay for this!"
    [/message]
    [message]
        speaker=Camerin
        message= _ "Awww, I liked that guy!"
    [/message]
    {VARIABLE Krash_alive no}
[/event]

# Death events for Stalrag and lich brothers, in ifdef to prevent them
# firing when you fight them in Settling Disputes
#ifdef ALLIED_LICH
[event]
    name=last breath
    [filter]
        id="Ro'Sothian"
    [/filter]

    [music]
        name=sad.ogg
        play_once=yes
    [/music]
    [message]
        speaker="Ro'Sothian"
        # wmllint: local spelling outta
        message= _ "I have had enough! Come on brother, let's get outta here."
    [/message]
    {FLASH_WHITE ()}
    [message]
        speaker=Tallin
        message= _ "Dang it! They're gone, and the creatures they control are leaving too. Without them, this is hopeless."
    [/message]
    [endlevel]
        result=defeat
    [/endlevel]
[/event]

[event]
    name=last breath
    [filter]
        id="Ro'Arthian"
    [/filter]

    [music]
        name=sad.ogg
        play_once=yes
    [/music]
    [message]
        speaker="Ro'Arthian"
        message= _ "I have had enough! Come on brother, let's get outta here."
    [/message]
    {FLASH_WHITE ()}
    [message]
        speaker=Tallin
        message= _ "Dang it! They're gone, and the creatures they control are leaving too. Without them, this is hopeless."
    [/message]
    [endlevel]
        result=defeat
    [/endlevel]
[/event]

[event]
    name=last breath
    [filter]
        id=Stalrag
    [/filter]

    [message]
        speaker=Stalrag
        message= _ "Farewell, my friends. I now go to join my fallen brothers."
    [/message]
[/event]

[event]
    name=last breath
    [filter]
        id=Stalrag
    [/filter]

    [music]
        name=sad.ogg
        play_once=yes
    [/music]
    [role]
        type=Dwarvish Berserker,Dwarvish Ulfsurker
        role=Shinsplitter
    [/role]
    [if]
        [not]
            [have_unit]
                role=Shinsplitter
            [/have_unit]
        [/not]
        [then]
            [recall]
                role=Shinsplitter
            [/recall]
        [/then]
    [/if]
    [message]
        role=Shinsplitter
        message= _ "No, Stalrag! Without you what will become of the Shinsplitters?"
    [/message]
    [message]
        speaker=Stalrag
        message= _ "Shinsplitters... join Tallin.... He is your new.... leader.... trust..... and..... serve..... him.... as.... you...... have..... served.... me."
    [/message]
    [message]
        speaker=Tallin
        message= _ "Your death shall not go unavenged, brave Stalrag. DEATH TO THE ORCS!!!"
    [/message]
    [message]
        role=Shinsplitter
        message= _ "DIE, YOU FOUL SCUM!!!"
    [/message]
[/event]
#endif

# Tallin death
[event]
    name=last breath
    [filter]
        id=Tallin
    [/filter]

    [music]
        name=sad.ogg
        play_once=yes
    [/music]
    [message]
        speaker=Tallin
        message= _ "Argh! I am finished, but our campaign must... not end... crush..... our..... enemies ..... and ..... save..... our...... people......."
    [/message]
    [message]
        role=Supporter
        message= _ "No, Tallin, we can't do it without you!"
    [/message]
    [endlevel]
        result=defeat
    [/endlevel]
[/event]
# Eryssa death
[event]
    name=last breath
    [filter]
        id=Eryssa
    [/filter]

    [music]
        name=sad.ogg
        play_once=yes
    [/music]
    [message]
        speaker=Eryssa
        message= _ "Alas, you must continue your mission without me!"
    [/message]
    [if]
        [have_unit]
            id=Elenia
        [/have_unit]
        [then]
            [message]
                speaker=Elenia
                message= _ "Eryssa, no! Please don't die!"
            [/message]
            [message]
                speaker=Tallin
                message= _ "I am sorry, Elenia, we tried our best. *sigh* I will never forget you, Eryssa."
            [/message]
        [/then]
        [else]
            [message]
                speaker=Tallin
                message= _ "You wretches are going to pay for this! FORWARD, MEN!"
            [/message]
        [/else]
    [/if]
    {VARIABLE Eryssa_alive no}
[/event]

# Sister Thera death, seven randomly chosen dialogues
[event]
    name=last breath
    first_time_only=no
    [filter]
        id=Sister Thera
    [/filter]
    {RANDOM 1..7}

    [switch]
        variable=random
        [case]
            value=1
            [message]
                speaker=Sister Thera
                message= _ "Ahhhh! Save me, my husband!"
            [/message]
            [message]
                speaker=Father Morvin
                message= _ " *rolls eyes* Dramatic as always."
            [/message]
        [/case]
        [case]
            value=2
            [message]
                speaker=Sister Thera
                message= _ "Ahhhhhhh!"
            [/message]
            [message]
                speaker=Father Morvin
                message= _ "You monsters think you are so tough don't you? Well check this out."
            [/message]
        [/case]
        [case]
            value=3
            [message]
                speaker=Sister Thera
                message= _ "Ahhhhhhh!"
            [/message]
            [message]
                speaker=Father Morvin
                message= _ "You incompetent fools, you think you can kill us? Good luck!"
            [/message]
        [/case]
        [case]
            value=4
            [message]
                speaker=Sister Thera
                # wmllint: local spelling Ack!
                message= _ "Ack! Stupid slobbering beast!"
            [/message]
            [message]
                speaker=Father Morvin
                message= _ "Your efforts to destroy us are in vain, you foul creature."
            [/message]
        [/case]
        [case]
            value=5
            [if]
                [have_unit]
                    id=Father Morvin
                [/have_unit]
                [then]
                    [message]
                        speaker=Sister Thera
                        message= _ "Oh no, Morvin! We have failed in our mission to help Tallin!"
                    [/message]
                    [message]
                        speaker=Father Morvin
                        message= _ "Failed? Never! The word failure is not in our dictionary."
                    [/message]
                [/then]
            [/if]
        [/case]
        [case]
            value=6
            [message]
                speaker=Sister Thera
                message= _ "Alas! I am dying! Morvin darling, I wish you were beside me so that I may die in your arms! So that I may feel the kiss of your lips on mine one last time!"
            [/message]
            [if]
                [have_unit]
                    id=Father Morvin
                [/have_unit]
                [then]
                    [message]
                        speaker=Father Morvin
                        message= _ " *rolls eyes* Thera, do you always have to be so dramatic?"
                    [/message]
                    [message]
                        role=Supporter
                        message= _ "Um..... Father? Your wife just got killed..."
                    [/message]
                    [message]
                        speaker=Father Morvin
                        message= _ "Oh right. I CALL UPON THE LORDS OF LIGHT TO GRANT YOU LIFE!"
                    [/message]
                [/then]
            [/if]
        [/case]
        [else]
            [message]
                speaker=Sister Thera
                message= _ "You cruel creature! How dare you use your brute strength against such a frail creature as me."
            [/message]
            [message]
                speaker=Father Morvin
                message= _ "Don't worry, Thera, you will have plenty of opportunities to set him straight."
            [/message]
        [/else]
    [/switch]
    {FLASH_WHITE ()}
    # Find a respawn point, start within 1 hex of Father Morvin, increase range if nothing suitable
    # Search around Tallin if Morvin is still jailed
    {VARIABLE current_radius 1}
    [if]
        [have_unit]
            id=Father Morvin
        [/have_unit]
        [then]
            {VARIABLE respawn_hub "Father Morvin"}
        [/then]
        [else]
            {VARIABLE respawn_hub "Tallin"}
        [/else]
    [/if]
    [while]
        [variable]
            name=respawn_point.length
            equals=0
        [/variable]
        [do]
            [store_locations]
                variable=respawn_point
                [and]
                    [filter]
                        id=$respawn_hub
                    [/filter]
                    radius=$current_radius
                [/and]
                # Exclude hexes with units on them and impassable terrain
                [and]
                    [not]
                        [filter]
                        [/filter]
                    [/not]
                    [not]
                        terrain=Wo,*^Xm,X*,Q*
                    [/not]
                [/and]
            [/store_locations]
            {VARIABLE_OP current_radius add 1}
        [/do]
    [/while]
    # Store unit to check if it advanced to mage of light
    [store_unit]
        [filter]
            id=Sister Thera
        [/filter]
        variable=type_check
        kill=yes
        fire_event=no
    [/store_unit]
    [unit]
        type=$type_check.type
        gender=female
        id=Sister Thera
        name= _ "Sister Thera"
        profile=portraits/Sister_Thera.png
        side=1
        x=$respawn_point.x
        y=$respawn_point.y
        [modifications]
            {TRAIT_LOYAL}
            {TRAIT_QUICK}
        [/modifications]
        {IS_LOYAL}
    [/unit]
    {CLEAR_VARIABLE respawn_point}
    {CLEAR_VARIABLE type_check}
    {CLEAR_VARIABLE current_radius}
    [switch]
        variable=random
        [case]
            value=1
            [if]
                [have_unit]
                    id=Father Morvin
                [/have_unit]
                [then]
                    [message]
                        speaker=Father Morvin
                        message= _ "Thera, when this is all over, you should paint your face and join a theater."
                    [/message]
                    [message]
                        speaker=Sister Thera
                        message= _ "Hey, don't you always say that life is nothing but a drama?"
                    [/message]
                    [message]
                        speaker=Father Morvin
                        message= _ "Yes, it may be a drama, but that's no excuse for overacting!"
                    [/message]
                    [message]
                        speaker=Sister Thera
                        message= _ " *giggle* Who needs an excuse for overacting?"
                    [/message]
                [/then]
            [/if]
        [/case]
        [case]
            value=2
            [message]
                speaker=Sister Thera
                message= _ "Whoa! That trick is a bit hard on the constitution."
            [/message]
            [if]
                [have_unit]
                    id=Father Morvin
                [/have_unit]
                [then]
                    [message]
                        speaker=Father Morvin
                        message= _ "Well, be grateful that you are alive."
                    [/message]
                    [message]
                        speaker=Sister Thera
                        message= _ " *giggle* Thank you honey."
                    [/message]
                    [message]
                        speaker=Father Morvin
                        message= _ "Thank the Lords of Light, not me!"
                    [/message]
                [/then]
            [/if]
        [/case]
        [case]
            value=3
            [message]
                speaker=Sister Thera
                message= _ "Ouch! That hurts. Let's try not to do that again, shall we?"
            [/message]
        [/case]
        [case]
            value=4
            [message]
                speaker=Sister Thera
                message= _ "There we go, payback time!"
            [/message]
        [/case]
        [case]
            value=5
            [message]
                speaker=Sister Thera
                message= _ "There we go, let's give this one more shot!"
            [/message]
            [message]
                speaker=Father Morvin
                message= _ "Just try not to kill yourself again."
            [/message]
        [/case]
        [case]
            value=6
            [if]
                [have_unit]
                    id=Father Morvin
                [/have_unit]
                [then]
                    # wmllint: local spelling unclerical
                    [message]
                        speaker=Father Morvin
                        message= _ "Thera, you should know by now that it is very unclerical to make such a spectacle of yourself."
                    [/message]
                    [message]
                        speaker=Sister Thera
                        message= _ "Come on, honey! Those were my dying words, after all!"
                    [/message]
                    [message]
                        speaker=Father Morvin
                        message= _ " *rolls eyes* Women!"
                    [/message]
                [/then]
            [/if]
        [/case]
        [else]
            [if]
                [have_unit]
                    id=Father Morvin
                [/have_unit]
                [then]
                    [message]
                        speaker=Sister Thera
                        message= _ "That's darned right!"
                    [/message]
                    [message]
                        speaker=Father Morvin
                        message= _ "Thera! Language like that coming from you! You should really stop hanging around the dwarves so much."
                    [/message]
                    [message]
                        speaker=Sister Thera
                        message= _ " *giggle* Sorry."
                    [/message]
                [/then]
            [/if]
        [/else]
    [/switch]

    [clear_variable]
        name=random
    [/clear_variable]
[/event]

# Father Morvin - See above
[event]
    name=last breath
    first_time_only=no
    [filter]
        id=Father Morvin
    [/filter]

    {RANDOM 1..7}
    [switch]
        variable=random
        [case]
            value=1
            [message]
                speaker=Father Morvin
                message= _ "Alas! So.... close."
            [/message]
            [message]
                speaker=Sister Thera
                message= _ "Hey, that's not right. The good guys aren't supposed to die. Oh well, I'll fix that."
            [/message]
        [/case]
        [case]
            value=2
            [message]
                speaker=Father Morvin
                message= _ "Argh!"
            [/message]
            [message]
                speaker=Sister Thera
                message= _ "You incompetent fools, you think you can kill us? Good luck!"
            [/message]
        [/case]
        [case]
            value=3
            [message]
                speaker=Father Morvin
                message= _ "Argh!"
            [/message]
            [message]
                speaker=Sister Thera
                message= _ "Oh dear. Did you just go and get yourself killed again, Morvin? Well, I'll fix that."
            [/message]
        [/case]
        [case]
            value=4
            [message]
                speaker=Father Morvin
                message= _ "The forces of good can never be defeated by the likes of you!"
            [/message]
            [message]
                speaker=Sister Thera
                message= _ "Yeah, try taking a bath and you MIGHT be able to kill him for good *wink wink*. But for the time being, abracadabra!"
            [/message]
        [/case]
        [case]
            value=5
            [message]
                speaker=Father Morvin
                message= _ "Argh!"
            [/message]
            [message]
                speaker=Sister Thera
                message= _ "Stupid troll, maybe next time you should try killing someone who can be killed."
            [/message]
        [/case]
        [case]
            value=6
            [message]
                speaker=Father Morvin
                message= _ "Argh! I'll just come back and finish you in my next life."
            [/message]
            [message]
                speaker=Sister Thera
                message= _ "Which might be sooner than you think."
            [/message]
        [/case]
        [else]
            [message]
                speaker=Father Morvin
                message= _ "Ack! I have been brained!"
            [/message]
            [message]
                speaker=Sister Thera
                # wmllint: local spelling Eeeeww
                message= _ "Eeeeww! Gross! Ahh never mind, I'll get you cleaned up good."
            [/message]
        [/else]
    [/switch]

    {VARIABLE current_radius 1}
    [if]
        [have_unit]
            id=Sister Thera
        [/have_unit]
        [then]
            {VARIABLE respawn_hub "Sister Thera"}
        [/then]
        [else]
            {VARIABLE respawn_hub "Tallin"}
        [/else]
    [/if]
    [while]
        [variable]
            name=respawn_point.length
            equals=0
        [/variable]
        [do]
            [store_locations]
                variable=respawn_point
                [and]
                    [filter]
                        id=$respawn_hub
                    [/filter]
                    radius=$current_radius
                [/and]
                # Exclude hexes with units on them and impassable terrain
                [and]
                    [not]
                        [filter]
                        [/filter]
                    [/not]
                    [not]
                        terrain=Wo,*^Xm,X*,Q*
                    [/not]
                [/and]
            [/store_locations]
            {VARIABLE_OP current_radius add 1}
        [/do]
    [/while]
    [store_unit]
        [filter]
            id=Father Morvin
        [/filter]
        variable=type_check
        kill=yes
        fire_event=no
    [/store_unit]
    {FLASH_WHITE ()}
    [unit]
        type=$type_check.type
        id=Father Morvin
        name= _ "Father Morvin"
        profile=portraits/Father_Morvin.png
        side=1
        x=$respawn_point.x
        y=$respawn_point.y
        [modifications]
            {TRAIT_LOYAL}
            {TRAIT_RESILIENT}
        [/modifications]
        {IS_LOYAL}
    [/unit]
    {CLEAR_VARIABLE type_check}
    {CLEAR_VARIABLE respawn_point}
    {CLEAR_VARIABLE current_radius}

    [switch]
        variable=random
        [case]
            value=1
            [message]
                speaker=Sister Thera
                message= _ "There we go."
            [/message]
            [message]
                speaker=Father Morvin
                message= _ "Ahh yes, that's better."
            [/message]
        [/case]
        [case]
            value=2
            [message]
                speaker=Father Morvin
                message= _ "Ouch! That hurts. Let's try not to do that again, shall we?"
            [/message]
        [/case]
        [case]
            value=3
            [if]
                [have_unit]
                    id=Sister Thera
                [/have_unit]
                [then]
                    [message]
                        speaker=Sister Thera
                        message= _ "Morvin! You bad boy, always getting into trouble."
                    [/message]
                    [message]
                        speaker=Father Morvin
                        message= _ "Sorry, won't do it again. Promise!"
                    [/message]
                [/then]
            [/if]
        [/case]
        [case]
            value=4
            [if]
                [have_unit]
                    id=Sister Thera
                [/have_unit]
                [then]
                    [message]
                        speaker=Father Morvin
                        message= _ "I heard that, Thera."
                    [/message]
                    [message]
                        speaker=Sister Thera
                        message= _ "Hey, just trying to give him an incentive to drown himself."
                    [/message]
                [/then]
            [/if]
        [/case]
        [case]
            value=5
            # no message for this case
        [/case]
        [case]
            value=6
            [message]
                speaker=Sister Thera
                message= _ "See?"
            [/message]
            [message]
                speaker=Father Morvin
                message= _ "Now where did he go!?"
            [/message]
        [/case]
        [else]
            [if]
                [have_unit]
                    id=Sister Thera
                [/have_unit]
                [then]
                    [message]
                        speaker=Father Morvin
                        message= _ "Ahhh, Thera, you would make such a good housewife!"
                    [/message]
                    [message]
                        speaker=Sister Thera
                        # wmllint: local spelling pouty
                        message= _ "Yes, if you would ever buy me a house! *pouty face*"
                    [/message]
                    [message]
                        speaker=Father Morvin
                        message= _ "Thera, don't you think that this isn't really a good time to talk about that?"
                    [/message]
                    [message]
                        speaker=Sister Thera
                        message= _ " *giggle* Sorry!"
                    [/message]
                [/then]
            [/if]
        [/else]
    [/switch]

    [clear_variable]
        name=random
    [/clear_variable]
[/event]

# Elenia death
[event]
    name=last breath
    [filter]
        id=Elenia
    [/filter]

    [music]
        name=sad.ogg
        play_once=yes
    [/music]
    {VARIABLE Elenia_alive no}
    [message]
        speaker=Elenia
        message= _ " Alas! My wanderings have come to an end."
    [/message]
    [message]
        speaker=Tallin
        message= _ "Blast it, we have lost a valuable ally."
    [/message]
    [message]
        speaker=Sister Thera
        message= _ "Farewell Elenia. May you find peace in your final journey."
    [/message]
[/event]

# Camerin death
[event]
    name=last breath
    [filter]
        id=Camerin
    [/filter]

    [music]
        name=sad.ogg
        play_once=yes
    [/music]
    [message]
        speaker=Camerin
        message= _ " What... how can this happen?"
    [/message]
    [message]
        speaker=Tallin
        message= _ "He was stark raving mad, but I am sure going to miss him."
    [/message]
[/event]

# Hamel death in scenario 2,3 and 4
#ifdef DEFEAT_WHEN_HAMEL_DEAD
[event]
    name=die
    [filter]
        id=Hamel
    [/filter]

    [message]
        speaker=Tallin
        message= _ "No! Without the dwarvish weapons we have no hope!"
    [/message]
    [endlevel]
        result=defeat
    [/endlevel]
[/event]
#endif

# This death event makes sure there is allways a supporter around
[event]
    name=die
    [filter]
        [filter_wml]
            [variables]
                role=Supporter
            [/variables]
        [/filter_wml]
    [/filter]

    [store_unit]
        [filter]
            race=human
            alignment=lawful
            [not]
                id=Camerin
            [/not]
            [not]
                id=Tallin
            [/not]
            [not]
                usage=healer
            [/not]
            [not]
                role=Supporter
            [/not]
        [/filter]
        kill=no
        variable=new_supporter
    [/store_unit]
    {VARIABLE new_supporter.variables.role Supporter}
    [unstore_unit]
        variable=new_supporter
    [/unstore_unit]
    [role]
        id=$new_supporter.id
        role=Supporter
    [/role]
    {CLEAR_VARIABLE new_supporter}
[/event]
