#textdomain wesnoth-Invasion_from_the_Unknown
#
# Invasion from the Unknown
# Copyright (C) 2006 - 2023 by Iris Morelle <shadowm@wesnoth.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

# wmlscope: set export=no
# wmlindent: start ignoring

# After the recent changes on the campaign's WML and plot structure, wmllint goes mad
# since it does not know how to expand *macros* for the [campaign] nodes.
# wmllint: validate-off

# Wesnoth textdomain setup
[textdomain]
    name="wesnoth-Invasion_from_the_Unknown"
    path="data/add-ons/Invasion_from_the_Unknown/translations"
[/textdomain]

[textdomain]
    name="wesnoth-Naia"
#ifhave ~add-ons/Invasion_from_the_Unknown/Naia
    path="data/add-ons/Invasion_from_the_Unknown/Naia/translations"
#endif
#ifhave ~add-ons/Naia
    path="data/add-ons/Naia/translations"
#endif
[/textdomain]

# Campaign menu entries

#undef IFTU_SHARED_ATTRIBUTES
#undef IFTU_HAVE_MUSIC

#ifhave ~add-ons/IftU_Music/_main.cfg
    #define IFTU_HAVE_MUSIC
    #enddef
#endif

#
# Macros used by the campaign menu entries
#

#define IFTU_SHARED_DESCRIPTION_FOOTER
"

"+
_"Version"+" {~add-ons/Invasion_from_the_Unknown/dist/VERSION} "+{IFTU_WESNOTH_VERSION_SUPPORT_STATUS}+"
"+_"Feedback and bug reports:"+" https://r.wesnoth.org/t43309"+{IFTU_HAVE_MUSIC_STATUS}+"" #enddef

#define IFTU_WESNOTH_VERSION_SUPPORT_STATUS
    _ "for Wesnoth 1.16.0 and later" #enddef

#ifdef IFTU_HAVE_MUSIC
    #define IFTU_HAVE_MUSIC_STATUS
    #enddef
#else
    #define IFTU_HAVE_MUSIC_STATUS
        "
"+"! "+
_"Music add-on “IftU Music” is not currently installed."+"" #enddef
#endif

#define IFTU_SHARED_ATTRIBUTES EPISODE_ID_SUFFIX EPISODE_SUBTITLE EPISODE_DESCRIPTION
    id=Invasion_from_the_Unknown_{EPISODE_ID_SUFFIX}
    define=CAMPAIGN_INVASION_FROM_THE_UNKNOWN
    extra_defines=CAMPAIGN_INVASION_FROM_THE_UNKNOWN_EPISODE_{EPISODE_ID_SUFFIX}
    {ENABLE_DWARVISH_RUNESMITH}
    {ENABLE_DWARVISH_ARCANISTER}
    {ENABLE_NIGHTBLADE}
    version={~add-ons/Invasion_from_the_Unknown/dist/VERSION}
    abbrev= _ "IftU"
    # NOTE: not the real chronology of these campaigns.
    year="9998 AF"
    end_text= _ "To be continued..."
    name= _ "Invasion from the Unknown"+"
"+{EPISODE_SUBTITLE}
    description={EPISODE_DESCRIPTION}+{IFTU_SHARED_DESCRIPTION_FOOTER}
    # Credits data source
    {~add-ons/Invasion_from_the_Unknown/about.cfg}
#enddef

#define IFTU_DIFFICULTY_MENU_ENTRY _SYMBOL _ICON _LABEL _DESC _DEFAULT
    [difficulty]
        define={_SYMBOL}
        image={_ICON}+"~RC(magenta>red)"
        label={_LABEL}
        description={_DESC}
        default={_DEFAULT}
    [/difficulty]
#enddef

#define IFTU_DIFFICULTY_MENU _EASY_LABEL _EASY_ICON _NORMAL_LABEL _NORMAL_ICON _HARD_LABEL _HARD_ICON
    {IFTU_DIFFICULTY_MENU_ENTRY EASY   ({_EASY_ICON})   ({_EASY_LABEL})   ( _ "Easy")   no }
    {IFTU_DIFFICULTY_MENU_ENTRY NORMAL ({_NORMAL_ICON}) ({_NORMAL_LABEL}) ( _ "Normal") yes}
    {IFTU_DIFFICULTY_MENU_ENTRY HARD   ({_HARD_ICON})   ({_HARD_LABEL})   ( _ "Hard")   no }
#enddef

#ifndef __WMLUNITS__

[campaign]
    {IFTU_SHARED_ATTRIBUTES I ( _ "Episode I: Seeking the Light") ( _ "Long after the Fall, the last forest elves on the Great Continent are forced to abandon their secluded home and forge an unprecedented alliance in hopes of retaliating against the great evil that has befallen Irdya. But even then, they will require more than one ancient power to aid them in their quest...

(Intermediate level, 13 scenarios.)")}
    first_scenario=01_Border_Patrol
    rank=255
    icon="data/add-ons/Invasion_from_the_Unknown/images/campaign-icon-episode1.png~RC(magenta>orange)"
    image="data/add-ons/Invasion_from_the_Unknown/images/campaign-logo-episode1.png"
    {IFTU_DIFFICULTY_MENU
    ( _ "difficulty_menu^Ascetic") ("data/add-ons/Invasion_from_the_Unknown/images/units/elves-wood/anlinde-ascetic.png")
    ( _ "difficulty_menu^Mystic")  ("data/add-ons/Invasion_from_the_Unknown/images/units/elves-wood/anlinde-mystic.png")
    ( _ "difficulty_menu^Avatar")  ("data/add-ons/Invasion_from_the_Unknown/images/units/elves-wood/anlinde-avatar.png")
    }
[/campaign]
[campaign]
    {IFTU_SHARED_ATTRIBUTES II ( _ "Episode II: Armageddon") ( _ "As the dark veil of Chaos engulfs the land, an assorted group of foolish heroes prepares a counter-attack against their enemies with one unique goal in their minds. May they vanquish the forces that seek to destroy the last sanctuary standing in the Great Continent, or perish in the attempt.

(Intermediate level, 10 scenarios.)")}
    first_scenario=14_Bye_and_Behold
    rank=256
    icon="data/add-ons/Invasion_from_the_Unknown/images/campaign-icon-episode2.png~RC(magenta>gold)"
    image="data/add-ons/Invasion_from_the_Unknown/images/campaign-logo-episode2.jpg"
    {IFTU_DIFFICULTY_MENU
    ( _ "difficulty_menu^Disciple")      ("units/undead-necromancers/dark-sorcerer-magic-1.png")
    ( _ "difficulty_menu^Lich")          ("units/undead-necromancers/lich-magic-3.png")
    ( _ "difficulty_menu^Ancient Lich")  ("units/undead-necromancers/ancient-lich-melee-2.png")
    }
[/campaign]

#else

# Define a special campaign menu entry for use with wmlunits, to generate a
# single units tree for the entire two-campaign set.

[campaign]
    id=Invasion_from_the_Unknown_unit_tree
    define=CAMPAIGN_INVASION_FROM_THE_UNKNOWN
    extra_defines=ENABLE_DWARVISH_RUNESMITH,ENABLE_DWARVISH_ARCANISTER
    name= _ "Invasion from the Unknown"
    first_scenario=null
    rank=255
    icon="data/add-ons/Invasion_from_the_Unknown/images/campaign-icon-episode1.png~RC(magenta>orange)"
[/campaign]

#endif

#undef IFTU_SHARED_ATTRIBUTES
#undef IFTU_DIFFICULTY_MENU
#undef IFTU_DIFFICULTY_MENU_ENTRY
#undef IFTU_WESNOTH_VERSION_SUPPORT_STATUS
#undef IFTU_SHARED_DESCRIPTION_FOOTER
#undef IFTU_HAVE_MUSIC_STATUS

# wmllint: validate-on

#ifdef EDITOR
    #define CAMPAIGN_INVASION_FROM_THE_UNKNOWN
    #enddef
#endif

#ifdef CAMPAIGN_INVASION_FROM_THE_UNKNOWN

[binary_path]
    path="data/add-ons/Invasion_from_the_Unknown"
[/binary_path]

#ifdef IFTU_HAVE_MUSIC
[binary_path]
    path="data/add-ons/IftU_Music"
[/binary_path]
#endif

{~add-ons/Invasion_from_the_Unknown/base-loader.cfg}

#endif

#undef IFTU_HAVE_MUSIC

# wmllint: directory spellings Anlindë Mal Malin Keshar Hekuba Argan
# wmllint: directory spellings Goliath shaxthal shaxthals verlissh verlisshi
# wmllint: directory spellings Naia Sela Quetor'el Telchior Galas
# wmllint: directory spellings Elynia Lédinor Erathan Yechnagoth Zocthanol
# wmllint: directory spellings Zhangor Althurin Asthorgar Irdya Quenoth
# wmllint: directory spellings Eloh Armageddon Igor golem goliath magus
# wmllint: directory spellings Uria demoness demonesses imp Inferno
# wmllint: directory spellings Mindraider Psy faerie faeries gutwrencher
# wmllint: directory spellings razerman longbowman crossbowman hellhound
# wmllint: directory spellings Aragwaith Aragwaithi arcanister runemaster
# wmllint: directory spellings runesmith Kaleh Kalehssar Rogrimir
# wmllint: directory spellings Wesmere Tanuil Elyssa Quogar Ratham
# wmllint: directory spellings Rythé rythenians Argazar argazars longswordsmen
# wmllint: directory spellings headhunter soulhunter rayblade wyrm
# wmllint: directory spellings noctum ensnare pah Mal-Ravanal Landar
# wmllint: directory spellings De'Arthian Illana Arnesius Delarel
# wmllint: directory spellings Torancyn Aleazar Raelthyn invincibles
# wmllint: directory spellings touchplate touchgem lorekeeper lorekeepers
# wmllint: directory spellings Eisenstone biomechanical Herthgar Gnalvarden
# wmllint: directory spellings Valgran Aidal Kalari Aran-Balgur Aran-Nitar
# wmllint: directory spellings Xia'el Merthiaal Urvatha Irdyan Inodien Unarye
# wmllint: directory spellings Adavyan Arphalad Lorin Wylven Danaerad Astar
# wmllint: directory spellings Ardgam Dervale Ilgrid
# wmllint: directory spellings facemask unpetrified wisemen firestick
# wmllint: directory spellings loremaster loremasters dreadcrafter
# wmllint: directory spellings dreadcrafters spellcaster spellcasters
# wmllint: directory spellings unliving elvenkind marchlands Adel un-death
# wmllint: directory spellings blargh atchoo nah somethin' lookin' preparin'
# wmllint: directory spellings hidin' fascinatin' runecraftin' layin' confusin'
# wmllint: directory spellings explorin' searchin' interestin' dyin' na'
# wmllint: directory spellings dinnae didnae musta' mighta' ha' need'a winna'
# wmllint: directory spellings cannae whoah what're

# wmlindent: stop ignoring

# kate: indent-mode normal; encoding utf-8; space-indent on;


#textdomain wesnoth-Invasion_from_the_Unknown

#define ABILITY_INTIMIDATES
    [leadership]
        id=intimidates_terror
        value=-25
        cumulative=no
        name= _ "intimidates"
        description= _ "This unit intimidates adjacent level 0-1 enemy units, making them fight worse.

Affected units engaging in combat deal 25% less damage and become unable to exert their zone of control over those adjacent to the intimidating unit."
        special_note={SPECIAL_NOTE_INTIMIDATES}
        affect_self=no
        affect_allies=no
        affect_enemies=yes
        [affect_adjacent]
            adjacent=n,ne,se,s,sw,nw
            [filter]
                level=0
                [or]
                    level=1
                [/or]
            [/filter]
        [/affect_adjacent]
    [/leadership]
    [skirmisher]
        id=intimidates_distract
        affect_self=no
        affect_allies=yes
        [affect_adjacent]
            adjacent=n,ne,se,s,sw,nw
            [filter]
                [not]
                    [filter_adjacent]
                        is_enemy=yes
                        [not]
                            level=0
                        [/not]
                        [not]
                            level=1
                        [/not]
                    [/filter_adjacent]
                [/not]
            [/filter]
        [/affect_adjacent]
    [/skirmisher]
#enddef

#define ABILITY_SYLVAN_ESSENCE_NOUNION
    [heals]
        value=8
        id=sylvan_essence_healing_nounion
        name= _ "sylvan essence"
        description=_"This unit can heal and cure friendly units on adjacent hexes every turn, to a base maximum of 8 HP. In vegetated terrains, it will conceal itself from its enemies. It can also regenerate (but not unpoison) 3 HP per-turn, but only in vegetated terrains."+{NOTES_VEGETATED_TERRAINS}
        special_note={SPECIAL_NOTE_SYLVAN_ESSENCE}
        affect_allies=yes
        affect_self=no
        poison=cured
        [affect_adjacent]
            adjacent=n,ne,se,s,sw,nw
        [/affect_adjacent]
    [/heals]
    [hides]
        id=sylvan_essence_conceal_nounion
        affect_self=yes
        [filter_self]
            [filter_location]
                terrain={VEGETATED_TERRAINS}
            [/filter_location]
        [/filter_self]
    [/hides]
    [regenerate]
        value=3
        id=sylvan_essence_selfheal_nounion
        affect_self=yes
        [filter_self]
            [filter_location]
                terrain={VEGETATED_TERRAINS}
            [/filter_location]
        [/filter_self]
    [/regenerate]
#enddef

# FIXME
#undef ABILITY_SYLVAN_ESSENCE

#define ABILITY_SYLVAN_ESSENCE
    [illuminates]
        id=sylvan_essence_illum
        value=25
        max_value=25
        cumulative=no
        name= _ "sylvan essence"
        description=_"This unit illuminates the surrounding area, making lawful units fight better, and chaotic units fight worse. Any units adjacent to this unit will fight as if it were dusk when it is night, and as if it were day when it is dusk.

The unit also can heal and cure friendly units on adjacent hexes every turn, to a base maximum of 8 HP. In vegetated terrains, it will conceal itself from its enemies. It can also regenerate (but not unpoison) 4 HP per-turn, but only in vegetated terrains."+{NOTES_VEGETATED_TERRAINS}
        special_note={SPECIAL_NOTE_SYLVAN_ESSENCE}
        affect_self=yes
    [/illuminates]
    [heals]
        value=8
        id=sylvan_essence_healing
        affect_allies=yes
        affect_self=no
        poison=cured
        [affect_adjacent]
            adjacent=n,ne,se,s,sw,nw
        [/affect_adjacent]
    [/heals]
    [hides]
        id=sylvan_essence_conceal
        affect_self=yes
        [filter_self]
            [filter_location]
                terrain={VEGETATED_TERRAINS}
            [/filter_location]
        [/filter_self]
    [/hides]
    [regenerate]
        value=4
        id=sylvan_essence_selfheal
        affect_self=yes
        [filter_self]
            [filter_location]
                terrain={VEGETATED_TERRAINS}
            [/filter_location]
        [/filter_self]
    [/regenerate]
#enddef

#define ABILITY_REGENERATES4
    [regenerate]
        value=4
        id=regenerates4
        name= _ "regenerates +4"
        female_name= _ "female^regenerates +4"
        description= _ "The unit will heal itself 4 HP per turn. If it is poisoned, it will remove the poison instead of healing."
        special_note={SPECIAL_NOTE_REGENERATES4}
        affect_self=yes
        poison=cured
    [/regenerate]
#enddef

# kate: indent-mode normal; encoding utf-8; space-indent on;


#textdomain wesnoth-Invasion_from_the_Unknown

# why wmllint whyyyyy
# wmllint: local spelling ‹Max

###############################################################################
#                                   ANLINDË                                   #
###############################################################################

#define AMLA_FAERIE_TOUCH_DRAINS
    {CHARACTER_AMLA
    amla_faerie_touch_drains
    ()
    attacks/touch-faerie.png ( _ "Faerie touch: add drains special")
    (
        [effect]
            apply_to=attack
            name=faerie touch
            [set_specials]
                mode=append
                {WEAPON_SPECIAL_DRAIN}
            [/set_specials]
        [/effect]
    )}
#enddef

#define AMLA_GOSSAMER_L1
    {CHARACTER_AMLA
    amla_gossamer_l1
    ()
    attacks/web.png ( _ "Gossamer: strikes +1")
    (
        [effect]
            apply_to=attack
            name=gossamer
            increase_attacks=1
        [/effect]
    )}
#enddef

###############################################################################
#                                    ELYNIA                                   #
###############################################################################

#define AMLA_STRENGTH_L1
    {CHARACTER_AMLA
    amla_strength_l1
    ()
    attacks/staff-niryone.png ( _ "Strength I: hitpoints +4, melee damage +1")
    (
        [effect]
            apply_to=hitpoints
            increase=4
            increase_total=4
        [/effect]
        [effect]
            apply_to=attack
            range=melee
            increase_damage=1
        [/effect]
    )}
#enddef

#define AMLA_STRENGTH_L2
    {CHARACTER_AMLA
    amla_strength_l2
    amla_strength_l1
    attacks/staff-niryone.png ( _ "Strength II: hitpoints +4, melee strikes +1")
    (
        [effect]
            apply_to=hitpoints
            increase=4
            increase_total=4
        [/effect]
        [effect]
            apply_to=attack
            range=melee
            increase_attacks=1
        [/effect]
    )}
#enddef

#define AMLA_STRENGTH_L3
    {CHARACTER_AMLA
    amla_strength_l3
    amla_strength_l2
    attacks/staff-niryone.png ( _ "Strength III: hitpoints +5")
    (
        [effect]
            apply_to=hitpoints
            increase=5
            increase_total=5
        [/effect]
    )}
#enddef

#define AMLA_STRENGTH_L4
    {CHARACTER_AMLA
    amla_strength_l4
    amla_strength_l3
    attacks/staff-niryone.png ( _ "Strength IV: hitpoints +5, melee damage +1")
    (
        [effect]
            apply_to=hitpoints
            increase=5
            increase_total=5
        [/effect]
        [effect]
            apply_to=attack
            range=melee
            increase_damage=1
        [/effect]
    )}
#enddef

#define AMLA_STRENGTH_L5
    {CHARACTER_AMLA
    amla_strength_l5
    amla_strength_l4
    attacks/staff-niryone.png ( _ "Strength V: hitpoints +7")
    (
        [effect]
            apply_to=hitpoints
            increase=7
            increase_total=7
        [/effect]
    )}
#enddef

#define AMLA_FOCUS_L1
    {CHARACTER_AMLA
    amla_focus_l1
    amla_strength_l1
    attacks/faerie-fire.png ( _ "Focus I: faerie fire damage +1")
    (
        [effect]
            apply_to=attack
            name=faerie fire
            increase_damage=1
        [/effect]
    )}
#enddef

#define AMLA_FOCUS_L2
    {CHARACTER_AMLA
    amla_focus_l2
    amla_focus_l1,amla_strength_l3
    attacks/faerie-fire.png ( _ "Focus II: faerie fire strikes +1")
    (
        [effect]
            apply_to=attack
            name=faerie fire
            increase_attacks=1
        [/effect]
    )}
#enddef

#define AMLA_FOCUS_L3
    {CHARACTER_AMLA
    amla_focus_l3
    amla_focus_l2,amla_strength_l4
    attacks/entangle.png ( _ "Focus III: ensnare strikes +1")
    (
        [effect]
            apply_to=attack
            name=ensnare
            increase_attacks=1
        [/effect]
    )}
#enddef

#define AMLA_SHIELDING_L1
    {CHARACTER_AMLA
    amla_shielding_l1
    amla_focus_l1
    attacks/magic-missile.png ( _ "Shielding I: arcane resistance +10%")
    (
        [effect]
            apply_to=resistance
            replace=no
            [resistance]
                arcane=-10
            [/resistance]
        [/effect]
    )}
#enddef

#define AMLA_SHIELDING_L2
    {CHARACTER_AMLA
    amla_shielding_l2
    amla_shielding_l1,amla_focus_l2
    attacks/magic-missile.png ( _ "Shielding II: arcane resistance +10%, impact resistance +10%")
    (
        [effect]
            apply_to=resistance
            replace=no
            [resistance]
                arcane=-10
                impact=-10
            [/resistance]
        [/effect]
    )}
#enddef

#define AMLA_SHIELDING_L3
    {CHARACTER_AMLA
    amla_shielding_l3
    amla_shielding_l2,amla_strength_l4
    attacks/magic-missile.png ( _ "Shielding III: arcane resistance +10%, cold resistance +10%")
    (
        [effect]
            apply_to=resistance
            replace=no
            [resistance]
                arcane=-10
                cold=-10
            [/resistance]
        [/effect]
    )}
#enddef

#
# Thorns
#

#define AMLA_THORNS_L1
    {CHARACTER_AMLA
    amla_thorns_l1
    ()
    attacks/thorns.png ( _ "Thorns I: new attack (ranged/pierce 10×2, magical+drains)")
    (
        [effect]
            apply_to=new_attack
            icon=attacks/thorns.png
            name=thorns
            description={I18N:ATTACK_THORNS}
            type=pierce
            [specials]
                {WEAPON_SPECIAL_MAGICAL}
                {WEAPON_SPECIAL_DRAIN}
            [/specials]
            damage=10
            number=2
            range=ranged
        [/effect]
    )}
#enddef

#define AMLA_THORNS_L2
    {CHARACTER_AMLA
    amla_thorns_l2
    amla_thorns_l1
    attacks/thorns.png
    ( _ "Thorns II: strikes +1")
    (
        [effect]
            apply_to=attack
            name=thorns
            increase_attacks=1
        [/effect]
    )}
#enddef

#define AMLA_THORNS_L3
    {CHARACTER_AMLA
    amla_thorns_l3
    amla_thorns_l2
    attacks/thorns.png
    ( _ "Thorns III: damage +2")
    (
        [effect]
            apply_to=attack
            name=thorns
            increase_damage=2
        [/effect]
    )}
#enddef

# kate: indent-mode normal; encoding utf-8; space-indent on;


#textdomain wesnoth-Invasion_from_the_Unknown

#define MISSILE_FRAME_STONE_GAZE
    [missile_frame]
        offset=1.0
        begin=-200
        end=0
        image="projectiles/gaze.png"
        image_diagonal="projectiles/gaze.png"
    [/missile_frame]
#enddef

#define MISSILE_FRAME_DARKNESS_BEAM
    {NOCTUM_BEAM_ANIMATION} # FIXME
#enddef

#define UNION_FOG_FRAME _NUM _DX _DY _MODS
    fog_{_NUM}_start_time=-500
    fog_{_NUM}_offset=0.5~1.25:500,1.25~2.0:800
    fog_{_NUM}_alpha=0.0~1.0:300,1.0:700,1.0~0.0:300
    fog_{_NUM}_image_mod={_MODS}

    fog_{_NUM}_directional_x={_DX}
    fog_{_NUM}_directional_y={_DY}

    [fog_{_NUM}_frame]
        duration=1300
        image="projectiles/fog-n.png"
        image_diagonal="projectiles/fog-ne.png"
    [/fog_{_NUM}_frame]
#enddef

#define UNION_FOG
    {UNION_FOG_FRAME 1 0~75  0~25  ("O(0.75)~BLEND(128,128,128,0.75)")}
    {UNION_FOG_FRAME 2 0     0~-50 ("O(1.00)~BLEND(128,128,128,0.75)")}
    {UNION_FOG_FRAME 3 0~-75 0~-50 ("O(0.75)~BLEND(128,128,128,0.75)")}

    # This invisible frame is required to avoid hex refresh artifacts when
    # using directional_x/y. It's large enough to contain the entire fog
    # effect region and force it to be invalidated correctly throughout the
    # entire animation timeline.
    dummy_frame_offset=0.0
    dummy_start_time=-500
    [dummy_frame]
        image=misc/blank-hex.png~SCALE(800,800)
        duration=1300
    [/dummy_frame]
#enddef

#define UNION_BEAM
    beam_start_time=-650
    beam_auto_vflip=no
    beam_offset=1.0
    [beam_frame]
        halo="halo/holy/light-beam-[1~7,6~1].png:[30*6,130,70*6]"
        halo_mod="~SCALE(300,1340)~BLEND(255,255,128,0.2)"
        halo_y=26
    [/beam_frame]
#enddef

#define UNION_BEAM_DARK
    beam_start_time=-650
    beam_auto_vflip=no
    beam_offset=1.0
    [beam_frame]
        halo="halo/darkness-beam-[1~7,6~1].png:[30*6,130,70*6]"
        halo_mod="~SCALE(300,1340)"
        halo_y=26
    [/beam_frame]
#enddef

# kate: indent-mode normal; encoding utf-8; space-indent on;


#textdomain wesnoth-Invasion_from_the_Unknown

#define BOSS_SCENARIO_NOTE
    {OBJECTIVE_NOTE ( _ "You may recruit or recall troops during the first turn only, until all your recruitment space is used")}
    {OBJECTIVE_NOTE ( _ "Your income is disabled and you may not obtain gold from villages")}
#enddef

#define DEPLOY_PROVISIONAL_PLAYER_KEEP
    [store_starting_location]
        side=1
        variable=temp_DPPK_loc
    [/store_starting_location]

    [terrain]
        x=$temp_DPPK_loc.x
        y=$temp_DPPK_loc.y
        radius=1
        terrain=Ce
    [/terrain]

    [terrain]
        x=$temp_DPPK_loc.x
        y=$temp_DPPK_loc.y
        terrain=Ke
    [/terrain]

    {CLEAR_VARIABLE temp_DPPK_loc}
#enddef

#define REMOVE_PROVISIONAL_PLAYER_KEEP
    [store_starting_location]
        side=1
        variable=temp_RPPK_loc
    [/store_starting_location]

    [terrain]
        x=$temp_RPPK_loc.x
        y=$temp_RPPK_loc.y
        radius=1
        terrain=Re
    [/terrain]

    {CLEAR_VARIABLE temp_RPPK_loc}
#enddef

#define BOSS_SCENARIO_PLAYER_RECRUITMENT
    [event]
        name=prestart

        [modify_side]
            side=1
            {NO_INCOME}
            village_gold=0
        [/modify_side]

        {DEPLOY_PROVISIONAL_PLAYER_KEEP}
    [/event]

    # Facilities to set gold to 0 and disable recruiting on turn 2; after that, gold and
    # recruitment list are restored at victory event
    [event]
        name=turn 2

        [store_side]
            side=1
            variable=boss_side1_store
        [/store_side]

        {VARIABLE side1_restore_info.recruit $boss_side1_store.recruit}
        {VARIABLE side1_restore_info.gold $boss_side1_store.gold}

        [modify_side]
            side=1
            gold=0
        [/modify_side]

        {DISALLOW_RECRUIT 1 $side1_restore_info.recruit}

        {CLEAR_VARIABLE boss_side1_store}

        {REMOVE_PROVISIONAL_PLAYER_KEEP}
    [/event]

    [event]
        name=victory

        [modify_side]
            side=1
            recruit=$side1_restore_info.recruit
            gold=$side1_restore_info.gold
        [/modify_side]

        {CLEAR_VARIABLE side1_restore_info}
    [/event]

    # Make recalled and recruited units loyal for the remainder of this scenario
    [event]
        name=prerecruit,prerecall
        first_time_only=no
        [filter]
            side=1
        [/filter]

        [object]
            duration=scenario
            [filter]
                x,y=$x1,$y1
            [/filter]
            [effect]
                apply_to=loyal
            [/effect]
        [/object]
    [/event]
#enddef

#define FINAL_SCENARIO_PLAYER_RECRUITMENT
    [event]
        name=prerecruit,prerecall
        first_time_only=no
        [filter]
            side=1
        [/filter]

        [fire_event]
            name=remove unit upkeep
            [primary_unit]
                x,y=$x1,$y1
            [/primary_unit]
        [/fire_event]
    [/event]

    [event]
        name=post advance
        first_time_only=no
        [filter]
            side=1
            type=Soulless
        [/filter]

        [fire_event]
            name=remove unit upkeep
            [primary_unit]
                x,y=$x1,$y1
            [/primary_unit]
        [/fire_event]
    [/event]

    [event]
        name=remove unit upkeep
        first_time_only=no

        # This is never reverted later.
        [object]
            [filter]
                x,y=$x1,$y1
            [/filter]
            [effect]
                apply_to=loyal
            [/effect]
        [/object]
    [/event]
#enddef

#define FINAL_SCENARIO_PLAYER_RECRUITMENT_WITH_AUTORECALL
    {FINAL_SCENARIO_PLAYER_RECRUITMENT}

    [event]
        name=prestart

        [recall_all]
            side=1
        [/recall_all]
    [/event]
#enddef

#define BOSS_IMMORTALITY _ID _COND _REPLENISH_PERCENTAGE
    [event]
        id=boss_immortality_handler
        name=last breath
        first_time_only=no
        [filter]
            id={_ID}
        [/filter]
        [filter_second_attack]
            [not]
                name=union
            [/not]
        [/filter_second_attack]
        [filter_condition]
            {_COND}
        [/filter_condition]

        {VARIABLE temp_FBI_old_hp $unit.hitpoints}

        {VARIABLE unit.hitpoints "$($unit.max_hitpoints * ("+{_REPLENISH_PERCENTAGE}+"/100.0))"}

        # Deduct the killing XP from the attacker.

        {LOG_IFTU_DBG "boss_immortality_handler: reset to "+{_REPLENISH_PERCENTAGE}+"% HP ($temp_FBI_old_hp -> $unit.hitpoints of $unit.max_hitpoints)"}
        {LOG_IFTU_DBG "boss_immortality_handler: deducting $(max([4, 8 * $unit.level])) XP from $second_unit.id"}

        {VARIABLE_MIN second_unit.experience "$(max([4, 8 * $unit.level]))"}

        [unstore_unit]
            variable=unit
            find_vacant=no
            {COLOR_HEAL}
            text=$temp_FBI_old_hp
        [/unstore_unit]

        [unstore_unit]
            variable=second_unit
            find_vacant=no
        [/unstore_unit]

        {CLEAR_VARIABLE temp_FBI_old_hp}

        [fire_event]
            name=boss revived
            [primary_unit]
                x,y=$x1,$y1
            [/primary_unit]
        [/fire_event]
    [/event]
#enddef

#define DISABLE_BOSS_IMMORTALITY
    [remove_event]
        id=boss_immortality_handler
    [/remove_event]
#enddef

# Helper macros to propagate the event context to chained events with
# [fire_event].
#define PROPAGATE_FULL_EVENT_CONTEXT
    [primary_unit]
        x,y=$x1,$y1
    [/primary_unit]
    [secondary_unit]
        x,y=$x2,$y2
    [/secondary_unit]
    [insert_tag]
        name=primary_attack
        variable=weapon
    [/insert_tag]
    [insert_tag]
        name=secondary_attack
        variable=second_weapon
    [/insert_tag]
#enddef

#define PROPAGATE_FULL_EVENT_CONTEXT_INVERTED
    [primary_unit]
        x,y=$x2,$y2
    [/primary_unit]
    [secondary_unit]
        x,y=$x1,$y1
    [/secondary_unit]
    [insert_tag]
        name=primary_attack
        variable=second_weapon
    [/insert_tag]
    [insert_tag]
        name=secondary_attack
        variable=weapon
    [/insert_tag]
#enddef

# NOTE: S23B uses an ad-hoc variant of this code. Keep an eye on that if any
#       changes or fixes are required here.
#define BOSS_ABSORB_DAMAGE_EX _ID _COND _REGEN_FORMULA _FINAL_FILTERS
    [event]
        id=boss_absorbdmg_handler
        name=boss absorb damage
        first_time_only=no

        {_FINAL_FILTERS} # HACK

        [set_variables]
            name=unit
            mode=merge
            [value]
                hitpoints={_REGEN_FORMULA}
                [status]
                    poisoned=no
                    slowed=no
                    petrified=no
                [/status]
            [/value]
        [/set_variables]

        [unstore_unit]
            find_vacant=no
            variable=unit
            {COLOR_HEAL}
            male_text= _ "absorbed damage"
            female_text= _ "female^absorbed damage"
        [/unstore_unit]
    [/event]

    [event]
        name=attacker hits
        first_time_only=no
        [filter_second]
            id={_ID}
        [/filter_second]
        [filter_condition]
            {_COND}
        [/filter_condition]

        [fire_event]
            name=boss absorb damage
            {PROPAGATE_FULL_EVENT_CONTEXT_INVERTED}
        [/fire_event]
    [/event]

    [event]
        name=defender hits
        first_time_only=no
        [filter]
            id={_ID}
        [/filter]
        [filter_condition]
            {_COND}
        [/filter_condition]

        [fire_event]
            name=boss absorb damage
            {PROPAGATE_FULL_EVENT_CONTEXT}
        [/fire_event]
    [/event]
#enddef

#
# Stock values for _REGEN_FORMULA in BOSS_ABSORB_DAMAGE_EX.
#

#define BOSS_REGEN_FULL_HP
"$unit.max_hitpoints" #enddef

# NOTE: second argument is rounded because min()/max() get completely confused
#       by decimal values.
#define BOSS_REGEN_ATTACK_DAMAGE _FACTOR
"$( min($unit.max_hitpoints, round({_FACTOR}*$damage_inflicted + $unit.hitpoints)) )" #enddef

#define BOSS_ABSORB_FULL_DAMAGE _ID _COND
    {BOSS_ABSORB_DAMAGE_EX ({_ID}) ({_COND}) ({BOSS_REGEN_FULL_HP}) ()}
#enddef

# kate: indent-mode normal; encoding utf-8; space-indent on;


#textdomain wesnoth-Invasion_from_the_Unknown

# Unlike the rest, Galas' canrecruit and unrenamable
# attributes are included in his own macro. This is
# intentional as he's only used in [side] declarations.
#define CHARACTER_STATS_GALAS
    id=Galas
    name= _ "Galas"
    type=Elvish Fighter
    profile="portraits/galas.png"
    canrecruit=yes
    unrenamable=yes
    [modifications]
        {TRAIT_RESILIENT}
        {TRAIT_QUICK}
        [object]
            [effect]
                apply_to=image_mod
                add=RC(magenta>brown)
            [/effect]
        [/object]
    [/modifications]
#enddef

#define CHARACTER_STATS_ANLINDE
    id=Anlindë
    name= _ "Anlindë"
    type=Anlinde Elvish Ascetic
    profile="portraits/anlinde.png"
    {IS_HERO}
    unrenamable=yes
    [modifications]
        {TRAIT_STRONG}
        {TRAIT_INTELLIGENT}
        {MOD_LOYAL_HERO}
    [/modifications]
#enddef

#define CHARACTER_STATS_MAL_KESHAR
    id=Mal Keshar
    name= _ "Mal Keshar"
    type=Ancient Lich
    profile=portraits/mal-keshar.png
    {IS_HERO}
    unrenamable=yes
    [modifications]
        {TRAIT_UNDEAD}
        {MOD_LOYAL_HERO}
    [/modifications]
#enddef

#define CHARACTER_STATS_ELYNIA
    id=Elynia
    name= _ "Elynia"
    type=Lady of Light
    profile="portraits/elynia.png"
    {IS_HERO}
    unrenamable=yes
    [modifications]
        {TRAIT_RESILIENT}
        {TRAIT_DEXTROUS}
        {MOD_LOYAL_HERO}
    [/modifications]
#enddef

#define CHARACTER_STATS_UNARYE
    id=Unarye
    name= _ "Unarye"
    type=Elvish Sorceress
    #profile="portraits/unarye.png"
    {IS_HERO}
    unrenamable=yes
    [modifications]
        {TRAIT_DEXTROUS}
        {TRAIT_INTELLIGENT}
        {MOD_LOYAL_HERO}
    [/modifications]
#enddef

#define CHARACTER_STATS_INODIEN
    id=Inodien
    name= _ "Inodien"
    type=Elvish Marshal
    #profile="portraits/inodien.png"
    {IS_HERO}
    unrenamable=yes
    [modifications]
        {TRAIT_INTELLIGENT}
        {TRAIT_STRONG}
        {MOD_LOYAL_HERO}
    [/modifications]
#enddef

#define CHARACTER_STATS_ALTHURIN_BASE
    id=Althurin
    name= _ "Althurin"
    profile="portraits/althurin.png"
    type=Dwarvish Runemaster
    unrenamable=yes
    [modifications]
        {TRAIT_LOYAL}
        {TRAIT_INTELLIGENT}
    [/modifications]
#enddef

#define CHARACTER_STATS_ALTHURIN
    {CHARACTER_STATS_ALTHURIN_BASE}
    {IS_HERO}
#enddef

#define CHARACTER_STATS_ASTHORGAR_BASE
    id=King Asthorgar
    name= _ "King Asthorgar"
    profile="portraits/asthorgar.png"
    type=Dwarvish Lord
    unrenamable=yes
    [modifications]
        {TRAIT_INTELLIGENT}
        {TRAIT_RESILIENT}
    [/modifications]
#enddef

#define CHARACTER_STATS_ASTHORGAR
    {CHARACTER_STATS_ASTHORGAR_BASE}
    {IS_HERO}
    [+modifications]
        {TRAIT_LOYAL}
    [/modifications]
#enddef

#define CHARACTER_STATS_IGOR
    id=Igor
    name= _ "Igor"
    profile="portraits/igor.png"
    type=Wolf Rider
    {IS_LOYAL}
    unrenamable=yes
    [modifications]
        {TRAIT_LOYAL}
        {TRAIT_STRONG}
    [/modifications]
#enddef

#define CHARACTER_STATS_ERATHAN
    id=Erathan
    name= _ "Erathan"
    type=Aragwaith Strongbow
    profile=portraits/erathan.png
    {IS_HERO}
    unrenamable=yes
    [modifications]
        {TRAIT_LOYAL} # But only to himself
        {TRAIT_STRONG}
    [/modifications]
#enddef

#define CHARACTER_STATS_LEDINOR
    id=Lédinor
    name= _ "Lédinor"
    type=Elvish Lord
    profile=portraits/ledinor.png
    {IS_HERO}
    unrenamable=yes
    [modifications]
        {TRAIT_STRONG}
        {TRAIT_DEXTROUS}
        {MOD_LOYAL_HERO}
    [/modifications]
#enddef

#
# Northern council members
#

#define CHARACTER_STATS_DE_ARTHIAN
    id="De'Arthian"
    name= _ "De’Arthian"
    type=Aragwaith Ancient Banner
    #profile="portraits/dearthian.png"
    unrenamable=yes
    [modifications]
        {TRAIT_DEXTROUS}
        {TRAIT_RESILIENT}
    [/modifications]
#enddef

#define CHARACTER_STATS_ILLANA
    id=Illana
    name= _ "Illana"
    type=Aragwaith Sorceress
    #profile="portraits/illana.png"
    unrenamable=yes
    [modifications]
        {TRAIT_QUICK}
        {TRAIT_STRONG}
    [/modifications]
#enddef

#define CHARACTER_STATS_ARNESIUS
    id=Arnesius
    name= _ "Arnesius"
    type=Arch Mage
    gender=male
    #profile="portraits/arnesius.png"
    unrenamable=yes
    [modifications]
        {TRAIT_INTELLIGENT}
        {TRAIT_STRONG}
    [/modifications]
#enddef

#define CHARACTER_STATS_DELAREL
    id=Delarel
    name= _ "Delarel"
    type=Aragwaith Slayer
    #profile="portraits/delarel.png"
    unrenamable=yes
    [modifications]
        {TRAIT_RESILIENT}
        {TRAIT_INTELLIGENT}
    [/modifications]
#enddef

#define CHARACTER_STATS_TORANCYN
    id=Torancyn
    name= _ "Torancyn"
    type=Aragwaith Swordsmaster
    #profile="portraits/torancyn.png"
    unrenamable=yes
    [modifications]
        {TRAIT_STRONG}
        {TRAIT_RESILIENT}
    [/modifications]
#enddef

#define CHARACTER_STATS_ALEAZAR
    id=Aleazar
    name= _ "Aleazar"
    type=Aragwaith Shield Guard
    #profile="portraits/aleazar.png"
    unrenamable=yes
    [modifications]
        {TRAIT_INTELLIGENT}
        {TRAIT_STRONG}
    [/modifications]
#enddef

#
# Recurring enemies.
#

#define CHARACTER_STATS_MAL_HEKUBA
    id=Mal Hekuba
    name= _ "Mal Hekuba"
    type=Chaos Cardinal
    profile="portraits/mal-hekuba.png"
    unrenamable=yes
    [modifications]
        {TRAIT_UNDEAD}
        {TEAM_COLOR_OVERRIDE () purple}
    [/modifications]
#enddef

#define CHARACTER_STATS_ELYSSA
    id=Elyssa
    name= _ "Elyssa"
    type=Chaos Warlord
    profile="portraits/elyssa.png"
    unrenamable=yes
    variation=unmasked
    [modifications]
        {TRAIT_BIOMECHANICAL}
        {TRAIT_INTELLIGENT}
    [/modifications]
#enddef

#define RECALL_CHARACTER_INTERNAL _MACRO_STEM
    [unit]
        {CHARACTER_STATS_{_MACRO_STEM}}
        side=1
        placement=leader
    [/unit]
#enddef

#define RECALL_CHARACTER_AT_INTERNAL _MACRO_STEM _X _Y
    [unit]
        {CHARACTER_STATS_{_MACRO_STEM}}
        side=1
        placement=map
        x={_X}
        y={_Y}
    [/unit]
#enddef

#define RECALL_ALTHURIN
    {RECALL_CHARACTER_INTERNAL ALTHURIN}
#enddef
#define RECALL_ALTHURIN_AT _X _Y
    {RECALL_CHARACTER_AT_INTERNAL ALTHURIN ({_X}) ({_Y})}
#enddef

#define RECALL_ANLINDE
    {RECALL_CHARACTER_INTERNAL ANLINDE}
#enddef
#define RECALL_ANLINDE_AT _X _Y
    {RECALL_CHARACTER_AT_INTERNAL ANLINDE ({_X}) ({_Y})}
#enddef

#define RECALL_ELYNIA
    {RECALL_CHARACTER_INTERNAL ELYNIA}
#enddef
#define RECALL_ELYNIA_AT _X _Y
    {RECALL_CHARACTER_AT_INTERNAL ELYNIA ({_X}) ({_Y})}
#enddef

#define RECALL_ERATHAN
    {RECALL_CHARACTER_INTERNAL ERATHAN}
#enddef
#define RECALL_ERATHAN_AT _X _Y
    {RECALL_CHARACTER_AT_INTERNAL ERATHAN ({_X}) ({_Y})}
#enddef

#define RECALL_LEDINOR
    {RECALL_CHARACTER_INTERNAL LEDINOR}
#enddef

#define RECALL_LEDINOR_AT _X _Y
    {RECALL_CHARACTER_AT_INTERNAL LEDINOR ({_X}) ({_Y})}
#enddef

#define RECALL_MAL_KESHAR
    {RECALL_CHARACTER_INTERNAL MAL_KESHAR}
#enddef
#define RECALL_MAL_KESHAR_AT _X _Y
    {RECALL_CHARACTER_AT_INTERNAL MAL_KESHAR ({_X}) ({_Y})}
#enddef

#define RECALL_UNARYE
    {RECALL_CHARACTER_INTERNAL UNARYE}
#enddef
#define RECALL_UNARYE_AT _X _Y
    {RECALL_CHARACTER_AT_INTERNAL UNARYE ({_X}) ({_Y})}
#enddef

#define RECALL_ASTHORGAR
    {RECALL_CHARACTER_INTERNAL ASTHORGAR}
#enddef
#define RECALL_ASTHORGAR_AT _X _Y
    {RECALL_CHARACTER_AT_INTERNAL ASTHORGAR ({_X}) ({_Y})}
#enddef

#define CONDITIONAL_ON_CHARACTER _ID _WML_IF_HAVE _WML_IF_NOT_HAVE
    [if]
        [have_unit]
            id={_ID}
            search_recall_list=yes
        [/have_unit]
        [then]
            {_WML_IF_HAVE}
        [/then]
        [else]
            {_WML_IF_NOT_HAVE}
        [/else]
    [/if]
#enddef

#
# Igor is an optional unit, so use [recall] for him.
#

#define RECALL_IGOR
    [recall]
        id=Igor
    [/recall]
#enddef

#define RECALL_IGOR_AT _X _Y
    [recall]
        id=Igor
        x={_X}
        y={_Y}
    [/recall]
#enddef

#define CONDITIONAL_IGOR _WML_IF_HAVE _WML_IF_NOT_HAVE
    {CONDITIONAL_ON_CHARACTER Igor ({_WML_IF_HAVE}) ({_WML_IF_NOT_HAVE})}
#enddef

#define IF_HAVE_IGOR _WML_IF_HAVE
    {CONDITIONAL_ON_CHARACTER Igor ({_WML_IF_HAVE}) ()}
#enddef

#define IF_NOT_HAVE_IGOR _WML_IF_NOT_HAVE
    {CONDITIONAL_ON_CHARACTER Igor () ({_WML_IF_NOT_HAVE})}
#enddef

#
# Erathan becomes optional in scenario 21 onwards.
#

#define RECALL_ERATHAN2
    [recall]
        id=Erathan
    [/recall]
#enddef

#define RECALL_ERATHAN2_AT _X _Y
    [recall]
        id=Erathan
        x={_X}
        y={_Y}
    [/recall]
#enddef

#define CONDITIONAL_ERATHAN _WML_IF_HAVE _WML_IF_NOT_HAVE
    {CONDITIONAL_ON_CHARACTER Erathan ({_WML_IF_HAVE}) ({_WML_IF_NOT_HAVE})}
#enddef

#define IF_HAVE_ERATHAN _WML_IF_HAVE
    {CONDITIONAL_ON_CHARACTER Erathan ({_WML_IF_HAVE}) ()}
#enddef

#define IF_NOT_HAVE_ERATHAN _WML_IF_NOT_HAVE
    {CONDITIONAL_ON_CHARACTER Erathan () ({_WML_IF_NOT_HAVE})}
#enddef

# kate: indent-mode normal; encoding utf-8; space-indent on;


#textdomain wesnoth-Invasion_from_the_Unknown

# This dehydrates the given units. However, if the unit is adjacent to a
# friendly healer, the dehydration will be delayed instead: the unit suffers no
# ill effects, but it cannot receive any healing on this turn either. Basically,
# dehydration works just like poison.
#
# Each turn of dehydration lowers the unit's attack damage by 1 point and
# decreases hitpoints by -$dehydration_loss.

#define APPLY_DEHYDRATION_EFFECT FILTER
    [store_unit]
        [filter]
            {FILTER}
        [/filter]

        kill=no
        variable=dehydrating_units
    [/store_unit]

    [foreach]
        array=dehydrating_units
        variable=dehydrating_unit
        [do]
            {VARIABLE dehydrating_unit.resting no}

            [if]
                [have_unit]
                    x,y=$dehydrating_unit.x,$dehydrating_unit.y

                    [filter_adjacent]
                        is_enemy=no
                        ability=healing,curing
                    [/filter_adjacent]
                [/have_unit]

                [then]
                    {VARIABLE dehydrating_unit.status.dehydration_slowed_by_healer yes}

                    [unstore_unit]
                        variable=dehydrating_unit
                        find_vacant=no
                    [/unstore_unit]
                [/then]

                [else]
                    [foreach]
                        array=dehydrating_unit.attack
                        variable=du_attack
                        [do]
                            # if dehydrating for the first time, store the original attack stats
                            [if]
                                [variable]
                                    name=dehydrating_unit.status.dehydrated
                                    not_equals=yes
                                [/variable]

                                [then]
                                    {VARIABLE dehydrating_unit.variables.original_attack[$i].damage $du_attack.damage}
                                [/then]
                            [/if]

                            # the attack's damage drops by 1 point, but cannot drop to zero
                            {VARIABLE du_attack.damage "$(max(1, $du_attack.damage - 1))"}
                        [/do]
                    [/foreach]

                    # unit's hitpoints drop by $dehydration_loss, but cannot kill it
                    {VARIABLE dehydrating_unit.hitpoints "$(max(1, $dehydrating_unit.hitpoints - $dehydration_loss))"}

                    {VARIABLE dehydrating_unit.status.dehydrated yes}

                    [unstore_unit]
                        variable=dehydrating_unit
                        find_vacant=no
                        male_text= _ "dehydrated"
                        female_text= _ "female^dehydrated"
                        {COLOR_HARM}
                    [/unstore_unit]

                    [unit_overlay]
                        x,y=$dehydrating_unit.x,$dehydrating_unit.y
                        image="misc/dehydration-icon.png"
                    [/unit_overlay]
                [/else]
            [/if]
        [/do]
    [/foreach]

    {CLEAR_VARIABLE dehydrating_units}
#enddef

#define APPLY_HYDRATION_EFFECT FILTER
    [store_unit]
        [filter]
            {FILTER}
        [/filter]

        kill=no
        variable=hydrating_units
    [/store_unit]

    [foreach]
        array=hydrating_units
        variable=hydrating_unit
        [do]
            [if]
                [variable]
                    name=hydrating_unit.status.dehydrated
                    boolean_equals=yes
                [/variable]

                [then]
                    [foreach]
                        array=hydrating_unit.attack
                        variable=hu_attack
                        [do]
                            {VARIABLE hu_attack.damage $hydrating_unit.variables.original_attack[$i].damage}
                        [/do]
                    [/foreach]
                [/then]
            [/if]

            {VARIABLE hydrating_unit.status.dehydrated no}

            [unstore_unit]
                variable=hydrating_unit
                find_vacant=no
                male_text= _ "refreshed"
                female_text= _ "female^refreshed"
                {COLOR_HEAL}
            [/unstore_unit]

            [remove_unit_overlay]
                x,y=$hydrating_unit.x,$hydrating_unit.y
                image="misc/dehydration-icon.png"
            [/remove_unit_overlay]
        [/do]
    [/foreach]

    {CLEAR_VARIABLE hydrating_units}
#enddef

# kate: indent-mode normal; encoding utf-8; space-indent on;


#textdomain wesnoth-Invasion_from_the_Unknown

#define HYDRATING_TILES
W*,S*,W*^*,S*^*,*^Do,*^V* #enddef

#define NEUTRAL_TILES
G*,U*,C*,K*,*^F* #enddef

#define DEHYDRATABLE_UNIT_FILTER
    {NOT_ON_RECALL_LIST}
    [not]
        type=Giant Scorpion,Mudcrawler,Giant Mudcrawler,Mother Mudcrawler
    [/not]
    [not]
        race=undead,elvish_spirits,bats
    [/not]
    [not]
        status=not_living
    [/not]
    [not]
        [filter_wml]
            ai_special=guardian
        [/filter_wml]
    [/not]
    [not]
        [filter_wml]
            [variables]
                immune_to_dehydration=yes
            [/variables]
        [/filter_wml]
    [/not]
#enddef

#define SHOW_DEHYDRATION_HELP
    [fire_event]
        name=dehydration_logic_description
    [/fire_event]
#enddef

#define DEHYDRATION_EVENTS
    [event]
        name=prestart

        {VARIABLE dehydration_loss 4}

        [set_menu_item]
            id=wmi_dehydration_helptxt
            description= _ "Dehydration"
            image="icons/menu-dehydration.png"
            [command]
                [redraw][/redraw]

                [allow_undo][/allow_undo]

                {SHOW_DEHYDRATION_HELP}
            [/command]
        [/set_menu_item]
    [/event]

    [event]
        name=dehydration_logic_description
        first_time_only=no

        [transient_message]
            caption= _ "Dehydration"
            message= _ "At the beginning of each daytime turn — Dawn, Morning, Midday, Afternoon, and Dusk — all player-controlled living units, except bats, will suffer from <b>thirst</b> unless they are standing on grassland or forested terrains; in castles, encampments, or keeps; or hiding underground.

Each turn spent thirsty reduces a unit’s attack damage by 1 and causes $dehydration_loss hitpoints of damage. Thirsty units will regain full attack strength at the start of each turn by refreshing at a village or water hex, or being cared for by a healer. As with poison, a unit will not die of thirst even if it is reduced to 1 hitpoint; likewise, its attack damage will not drop below 1."
        [/transient_message]
    [/event]

    [event]
        name=side 1 turn
        first_time_only=no

        {APPLY_DEHYDRATION_EFFECT (
            side=$side_number
            {DEHYDRATABLE_UNIT_FILTER}
            [filter_location]
                [not]
                    terrain={HYDRATING_TILES}
                [/not]
                [not]
                    terrain={NEUTRAL_TILES}
                [/not]
                [not]
                    time_of_day=chaotic
                [/not]
            [/filter_location]
        )}

        {APPLY_HYDRATION_EFFECT (
            side=$side_number
            status=dehydrated
            {DEHYDRATABLE_UNIT_FILTER}
            [and]
                [filter_location]
                    terrain={HYDRATING_TILES}
                [/filter_location]
                [or]
                    [filter_adjacent]
                        is_enemy=no
                        ability=healing,curing
                    [/filter_adjacent]
                [/or]
            [/and]
        )}
    [/event]

    [event]
        name=side 1 turn refresh
        first_time_only=no

        {MODIFY_UNIT (
            side=1
            status=dehydration_slowed_by_healer
        ) status.dehydration_slowed_by_healer no}
    [/event]

    [event]
        name=advance
        first_time_only=no
        [filter]
            side=1
            status=dehydrated
        [/filter]

        {CLEAR_VARIABLE unit.status.dehydrated}

        [unstore_unit]
            variable=unit
            find_vacant=no
            male_text= _ "refreshed"
            female_text= _ "female^refreshed"
            {COLOR_HEAL}
        [/unstore_unit]

        [remove_unit_overlay]
            x,y=$unit.x,$unit.y
            image="misc/dehydration-icon.png"
        [/remove_unit_overlay]
    [/event]

    [event]
        name=victory

        {APPLY_HYDRATION_EFFECT (
            side=1
            status=dehydrated
            {DEHYDRATABLE_UNIT_FILTER}
        )}

        {CLEAR_VARIABLE dehydration_loss}

        {REMOVE_MENU_ITEM wmi_dehydration_helptxt}
    [/event]
#enddef

#define DO_NOT_DEHYDRATE
    [+unit]
        [variables]
            immune_to_dehydration=yes
        [/variables]
    [/unit]
#enddef

#define DEHYDRATION_NOTE
    {OBJECTIVE_NOTE ( _ "Living units (except bats) are subject to dehydration in this scenario")}
#enddef

# kate: indent-mode normal; encoding utf-8; space-indent on;


#textdomain wesnoth-Invasion_from_the_Unknown

#define CHARACTER_1ST_TIME_HELP _CID _HELPMSG
    [event]
        name=select
        [filter]
            id={_CID}
        [/filter]
        [filter_condition]
            {VARIABLE_BOOLEAN_EQUALS character_1st_time_help yes}
        [/filter_condition]

        [transient_message]
            caption= _ "UI^Character Description"
            image="$unit.image|~$(if('$unit.id' != 'Galas', 'TC(1,magenta)', 'RC(magenta>brown)'))"
            message={_HELPMSG}
        [/transient_message]
    [/event]
#enddef

#define GALAS_1ST_TIME_HELP
    {CHARACTER_1ST_TIME_HELP (Galas) ( _ "Galas is an Elvish Fighter. As such, he has two advancement choices from level 1: Captain and Hero. Choose his development path wisely and carefully.")}
#enddef

#define ANLINDE_1ST_TIME_HELP
    {CHARACTER_1ST_TIME_HELP (Anlindë) ( _ "Anlindë is an Elvish Ascetic. She has vast experience with offensive magic, but she also has the ability to cure allied units of poison. Keep in mind that she is the only unit of her kind.")}
#enddef

#define MAL_KESHAR_1ST_TIME_HELP
    {CHARACTER_1ST_TIME_HELP (Mal Keshar) ( _ "Mal Keshar is an Ancient Lich. Although he may be a virtually unstoppable weapon against most living units, keep in mind that he is weak against impact, arcane, and fire attacks, even more so in the daytime!")}
#enddef

#define ELYNIA_1ST_TIME_HELP
    {CHARACTER_1ST_TIME_HELP (Elynia) ( _ "Elynia is the Lady of Light; she has great mobility, including the ability to fly. Her skill with the staff as a melee weapon is also remarkable, but never leave her alone when fighting well-armed opponents.")}
#enddef

#define ALTHURIN_1ST_TIME_HELP
    {CHARACTER_1ST_TIME_HELP (Althurin) ( _ "Althurin is one of the best Dwarvish Runemasters of Knalga. His mastery of such craft allows him to accurately deal great damage with his own hammer.")}
#enddef

#define ERATHAN_1ST_TIME_HELP
    {CHARACTER_1ST_TIME_HELP (Erathan) ( _ "Erathan is an Aragwaith Strongbow. His skill with the bow is not as great as that of elvish archers, but he aspires to either improve it or enhance his ability with melee weapons such as the glaive. Nonetheless, he is not used to fighting in open fields, so be careful when deciding where he should attack from!")}
#enddef

#define RECRUITMENT_HINT _BASEFRAME _MSG
    [transient_message]
        image={_BASEFRAME}+"~RC(magenta>red)"
        message={_MSG}
    [/transient_message]
#enddef

#define AMLA_MENU_HINT
    #
    # The hint is only displayed once per save. It disables itself by creating
    # the need_amla_hint_displayed array (which is supposed to have only one
    # entry). Either Anlindë reaching level 4 or Elynia _existing_ can trigger
    # the hint.
    #

#ifndef CAMPAIGN_INVASION_FROM_THE_UNKNOWN_EPISODE_II
    [event]
        id=amla_menu_hint:anlinde_check
        name=post advance
        [filter]
            type=Anlinde Elvish Avatar
        [/filter]
        [filter_condition]
            {VARIABLE_NUMERICAL_EQUALS need_amla_hint_displayed.length 0}
        [/filter_condition]

        {VARIABLE need_amla_hint_displayed.value yes}
    [/event]
#endif

    [event]
        id=amla_menu_hint:elynia_check
        name=new turn
        [filter_condition]
            {VARIABLE_NUMERICAL_EQUALS need_amla_hint_displayed.length 0}

            [have_unit]
                id=Elynia
            [/have_unit]

            {VARIABLE_NUMERICAL_EQUALS turn_number 2}
        [/filter_condition]

        {VARIABLE need_amla_hint_displayed.value yes}
    [/event]

    [event]
        id=amla_menu_hint
        name=new turn
        [filter_condition]
            {VARIABLE_NUMERICAL_EQUALS need_amla_hint_displayed.length 1}
            {VARIABLE_BOOLEAN_EQUALS need_amla_hint_displayed.value yes}
        [/filter_condition]

        [scroll_to_unit]
            side=1
            canrecruit=yes
        [/scroll_to_unit]

        [if]
            [have_unit]
                id=Anlindë
            [/have_unit]
            [then]
                #
                # We have Anlindë (the most likely scenario).
                #
                [transient_message]
                    image=icons/book.png
                    message= _ "As a high-level unit under your control, Anlindë has special After Maximum Level Advancements (AMLAs). You can learn more about those by right-clicking her and choosing the Unit Advancements option."
                [/transient_message]
            [/then]
            [else]
                #
                # We don't have Anlindë, which means we have Elynia instead.
                # This should basically never happen with an Episode 1 save
                # unless the player has somehow neglected leveling up
                # Anlindë for an eternity.
                #
                [transient_message]
                    image=icons/book.png
                    message= _ "As a high-level unit under your control, Elynia has special After Maximum Level Advancements (AMLAs). You can learn more about those by right-clicking her and choosing the Unit Advancements option."
                [/transient_message]
            [/else]
        [/if]

        {VARIABLE need_amla_hint_displayed.value no}
    [/event]
#enddef

# kate: indent-mode normal; encoding utf-8; space-indent on;


#textdomain wesnoth-Invasion_from_the_Unknown

#define CHEST_OF_GOLD _AMOUNT _X _Y
    [item]
        x,y={_X},{_Y}
        image=items/chest-plain-closed.png
    [/item]

    [event]
        name=moveto
        [filter]
            x,y={_X},{_Y}
            side=1
        [/filter]

        [sound]
            name=open-chest.wav
        [/sound]

        [remove_item]
            x,y={_X},{_Y}
        [/remove_item]

        [item]
            x,y={_X},{_Y}
            image=items/chest-plain-open.png
        [/item]

        [redraw][/redraw]

        {VARIABLE temp_gold_found ({_AMOUNT})}

        # TODO: just have a dialog or instead of a unit talking about it...

        [message]
            speaker=unit
            female_message= _ "female^Hey! I just found $temp_gold_found pieces of gold in this chest!"
            male_message= _ "Hey! I just found $temp_gold_found pieces of gold in this chest!"
        [/message]

        {RETRIEVE_GOLD {_AMOUNT} }

        {CLEAR_VARIABLE temp_gold_found}
    [/event]
#enddef

################################# INDIVIDUAL OBJECTS CODE #################################
# NOTE: duration=scenario is the only case that allows id= to make sense and be useful

#define HOLY_WATER X Y
    {PICK_UP (items/holy-water.png) ({X}) ({Y}) (
        [not]
            status=not_living
        [/not]
        [not]
            race=bats
        [/not]
    )
    ( _ "Holy water! I have read that our ancestors used to put it on their weapons for fighting undead, as it is imbued with arcane energy, the greatest bane of those unnatural creatures. Of course, it could be used against our people as well — but it is fortunate that undead horrors are not capable of bearing its power. That is probably why they hid it in this secret chamber.")
    ( _ "I am not really suited for using this! Let someone else take it.")
    (
        [object]
            id=holywater_$x1|_$y1
            image=items/holy-water.png
            duration=scenario
            name={STR_HOLY_WATER}
            description={STR_HOLY_WATER_MATCHING_DESCRIPTION}
            [filter]
                x,y=$x1,$y1
            [/filter]
            [effect]
                apply_to=attack
                range=melee
                set_type=arcane
            [/effect]
        [/object]
    )}
#enddef

#define RING_SPEED X Y
    {PICK_UP (items/ring-gold.png) ({X}) ({Y}) (
        [not]
            status=not_living
        [/not]
    )
    ( _ "A gold ring, and there is an inscription on it. “You who take this ring will be swifter and more graceful, no matter what weight you carry on your back.” This would be useful here, since we are not very used to moving in these rough, dark caves.")
    ( _ "... But only a living creature could possibly make use of this ring.")
    (
        [object]
            image=icons/ring-gold.png
            duration=forever
            name= _ "Ring of Swiftness"
            description= _ "This ring will grant the bearer swift movement, increasing maximum movement by one unit per turn."
            [filter]
                x,y=$x1,$y1
            [/filter]
            [effect]
                apply_to=movement
                increase=1
            [/effect]
        [/object]
    )}
#enddef

#define POISONOUS_BOW X Y
    {PICK_UP (items/bow-poisonous.png) ({X}) ({Y})
    (type=Skeleton Archer,Revenant,Bone Shooter,Death Knight,Death Baron,Draug,Banebow,Elvish Archer,Elvish Marksman,Elvish Sharpshooter,Elvish Ranger,Elvish Avenger,Elvish Hero,Elvish Champion)
    ( _ "An enchanted bow! I have read that ancient armies used to hire powerful warlocks to grant mundane weapons special powers such as poisoning without need of preparing them beforehand, which is the main lack of those dumb orcish slayers. Well, this one seems to have such a power, judging by the fine inscription on it.")
    ( _ "I am not suited to use this weapon! Let someone else pick it up.")
    (
        [object]
            image=attacks/bow-orcish.png
            duration=forever
            name= _ "Poisonous Bow"
            description= _ "This bow has been enchanted. Every arrow shot with it will poison its target."
            [filter]
                x,y=$x1,$y1
            [/filter]
            [then]
                [message]
                    speaker=narrator
                    image="wesnoth-icon.png"
                    message= _ "The unit picks up the ordinary-looking bow, and immediately feels a chilling energy flow to their body. Out of curiosity, they decide to shoot a nearby wandering rat with it. The hapless creature begins emanating a disgusting smell like a concentrated mix of urine and decomposing flesh as it convulses and promptly dies."
                [/message]

                [message]
                    speaker=Galas
                    message= _ "We have never allowed the use of poison out of compassion towards the living, but our enemies do not seem to particularly care about such things themselves."
                [/message]

                [message]
                    speaker=Mal Keshar
                    message= _ "(cackles) Good, good. You have become quite the competent war leader, boy. Do not let such petty things as old-fashioned war customs discourage you from expanding your horizons."
                [/message]
            [/then]
            [effect]
                apply_to=new_attack
                name=poisonous bow
                description= _ "poisonous bow"
                icon=attacks/bow-orcish.png
                type=pierce
                range=ranged
                damage=11
                number=3
                [specials]
                    {WEAPON_SPECIAL_POISON}
                [/specials]
            [/effect]
            [effect]
                apply_to=new_animation
                [attack_anim]
                    [filter_attack]
                        name=poisonous bow
                    [/filter_attack]

                    missile_start_time=-150
                    [missile_frame]
                        image="projectiles/missile-n.png:150"
                        image_diagonal="projectiles/missile-ne.png:150"
                    [/missile_frame]

                    start_time=-375
                    [frame]
                        duration=400
                    [/frame]

                    {SOUND:HIT_AND_MISS bow.ogg bow-miss.ogg -375}
                [/attack_anim]
            [/effect]
        [/object]
    )}
#enddef

#define OBJ_VOID_ARMOR X Y ID
    {PICK_UP (items/armor.png) ({X}) ({Y})
    (type=Elvish Fighter,Elvish Captain,Elvish Hero,Elvish Marshal,Elvish Champion,Elvish Ranger,Elvish Avenger,Skeleton,Deathblade,Revenant,Draug,Death Baron,Death Knight,Skeleton Rider,Bone Knight)
    ( _ "How could this beautiful armor be abandoned in these deep caves? I suppose someone dropped it during an evacuation or such, since it looks like it hasn’t been worn before — well preserved nevertheless. It would fit an elvish or undead warrior of ours fine. We are rather short on battle gear and I don’t think its original owner would mind if we borrow and use it.")
    ( _ "Only a trained warrior may don this armor!")
    (
        [object]
            id={ID}
            name= _ "Void Armor"
            image="icons/void-armor.png"
            description= _ "A beautiful chest plate crafted from shimmering black steel, the Void Armor is virtually impenetrable to physical weapons!"
            duration=forever
            [filter]
                x,y=$x1,$y1
            [/filter]
            #
            # Set physical resistance to 50/50/60
            #
            [effect]
                apply_to=resistance
                replace=true
                [resistance]
                    blade=50
                    pierce=50
                    impact=40
                [/resistance]
            [/effect]
            #
            # Increase fire resistance by 10%
            #
            [effect]
                apply_to=resistance
                [resistance]
                    fire=-10
                [/resistance]
            [/effect]
        [/object]

        [message]
            speaker=narrator
            image="wesnoth-icon.png"
            message= _ "You struggle to lift and don the heavy plate. Once worn, however, it is amazingly comfortable. You have increased resistance to all physical damage!"
        [/message]

        [store_unit]
            [filter]
                x,y=$x1,$y1
            [/filter]
            kill=yes
            variable=void_armor_taker
        [/store_unit]

        [set_variables]
            name=void_armor_taker.modifications.trait
            mode=append
            [value]
                id=void_armor
                name= _ "void armor"
                description= _ "The Void Armor grants the following resistances:

Blade:   50%
Pierce:  50%
Impact:  60%
Fire:   +10%"
            [/value]
        [/set_variables]

        [unstore_unit]
            variable=void_armor_taker
            find_vacant=no
        [/unstore_unit]

        {CLEAR_VARIABLE void_armor_taker}
    )}
#enddef

#
# Explosive arrows from S14, a dwarven gift.
# (Thanks vultraz for the idea.)
#

#define EXPLOSIVE_ARROWS _X _Y
    # FIXME: need an actual quiver item
    {PICK_UP items/barrel.png ({_X}) ({_Y})
    (type="Elvish Archer,Elvish Marksman,Elvish Ranger,Elvish Sharpshooter,Elvish Avenger,Skeleton Archer,Bone Shooter,Banebow")
    ( _ "The arrows in this barrel are some of the most expensive weaponry ever devised by the dwarves of Herthgar, although most of the credit for the design goes to their fallen kin in Gnalvarden. Each arrow shaft has tiny runes engraved on them that react upon entering a living target and ignite the explosive tip. The resulting explosion deals great damage not just to the arrow’s target, but also to anything directly behind it. Surely this will come in handy later on, but we should make sure to hand these only to a very skilled archer so as to avoid wasting them — besides, it would not do for a novice to accidentally blow up one of our own.")
    ( _ "These arrows are more befitting for a skilled archer, which I certainly am not.")
    (
        [object]
            id=explosive_rune_arrows
            name= _ "Explosive Runic Arrows"
            image=attacks/bow-short-reinforced.png
            description= _ "When used against a living target, these arrows will explode dealing 80% damage to the unit directly behind it, regardless of its allegiance or type."
            duration=forever
            [filter]
                x,y=$x1,$y1
            [/filter]
            [effect]
                apply_to=new_attack
                name=shrapnel
                description= _ "explosive arrows (6)"
                icon=attacks/bow-short-reinforced.png
                type=fire
                range=ranged
                damage=28
                number=1
                [specials]
                    {WEAPON_SPECIAL_SHRAPNEL}
                [/specials]
            [/effect]
            [effect]
                apply_to=new_animation
                [attack_anim]
                    [filter_attack]
                        name=shrapnel
                    [/filter_attack]

                    missile_start_time=-150
                    [missile_frame]
                        duration=150
                        image="projectiles/missile-n.png"
                        image_diagonal="projectiles/missile-ne.png"
                    [/missile_frame]

                    start_time=-375
                    [if]
                        hits=yes
                        [frame]
                            duration=350
                            image=$unit.image
                            sound=bow.ogg
                        [/frame]

                        [frame]
                            duration=125
                            image=$unit.image
                            sound=explosion.ogg
                        [/frame]

                        burst_start_time=100
                        burst_offset=1.0
                        [burst_frame]
                            halo="projectiles/fire-burst-small-[1~8].png:75"
                        [/burst_frame]
                    [/if]
                    [else]
                        hits=no
                        [frame]
                            duration=475
                            image=$unit.image
                            sound=bow-miss.ogg
                        [/frame]
                    [/else]
                [/attack_anim]
            [/effect]
        [/object]

        #
        # The following actions are not in the [object] [then] block because
        # otherwise the game attempts to interpolate variables in the
        # WEAPON_SPECIAL_SHRAPNEL_IMPLEMENTATION text immediately.
        #

        [store_unit]
            [filter]
                x,y=$x1,$y1
            [/filter]
            variable=temp_shrapnel_unit
        [/store_unit]

        [set_variables]
            # Can't use $unit, the autostored version doesn't have the object
            # applied somehow. (Is $unit autostored when referencing $x1,$y1?)
            name=temp_shrapnel_unit.variables.shrapnel
            mode=merge
            [literal]
                count=6
                name= _ "explosive arrows"
            [/literal]
        [/set_variables]

        [unstore_unit]
            variable=temp_shrapnel_unit
            find_vacant=no
        [/unstore_unit]

        {CLEAR_VARIABLE temp_shrapnel_unit}

        {ATTACH_EVENTS_TO_UNIT x,y=$x1,$y1 ({WEAPON_SPECIAL_SHRAPNEL_IMPLEMENTATION})}

        [if]
            [have_unit]
                x,y=$x1,$y1
                [not]
                    race=undead
                [/not]
            [/have_unit]
            [then]
                [message]
                    speaker=Galas
                    message= _ "Careful! It would hurt me to lose one of our men by accidentally triggering an explosive artifact like those."
                [/message]

                [message]
                    speaker=unit
                    message= _ "(gulp) I will make sure to handle them with care, sir."
                [/message]
            [/then]
            [else]
                [message]
                    speaker=unit
                    message= _ "Heh. I don’t even need to worry about them accidentally exploding in my quiver!"
                [/message]

                [message]
                    speaker=Mal Keshar
                    message= _ "He he, yes, indeed. Is it not great?"
                [/message]

                [message]
                    speaker=Elynia
                    message= _ "Just make sure to aim those at our enemies, Mal Keshar."
                [/message]

                [message]
                    speaker=Mal Keshar
                    message= _ "Pah, distrustful much?"
                [/message]
            [/else]
        [/if]
    )}
#enddef

#define ACCURACY_BOW _X _Y
    {PICK_UP items/bow-elven.png {_X} {_Y}
    (type=Bone Shooter,Banebow,Elvish Ranger,Elvish Avenger,Aragwaith Strongbow,Aragwaith Greatbow,Aragwaith Slayer)
    ( _ "As I lift this enchanted bow, my vision appears to become sharper! This will surely prove useful later.")
    ( _ "Only a strong and experienced archer could possibly draw this bow!")
    (
        [object]
            id=accuracy_bow
            name= _ "Enchanted Longbow of Visual Acuity"
            image=attacks/bow-elven-magic.png
            description= _ "The unit’s ranged attacks are permanently given the Marksman weapon special."
            duration=forever
            [filter]
                x,y=$x1,$y1
            [/filter]
            [effect]
                apply_to=attack
                range=ranged
                [set_specials]
                    mode=append
                    {WEAPON_SPECIAL_MARKSMAN}
                [/set_specials]
            [/effect]
        [/object]
    )}
#enddef

#define CHILLING_BLADE _X _Y
    {PICK_UP items/sword.png {_X} {_Y}
    (type=Elvish Fighter,Elvish Hero,Elvish Champion,Elvish Captain,Elvish Marshal,Aragwaith Strongbow,Aragwaith Slayer,Aragwaith Greatbow,Elvish Archer,Elvish Ranger,Elvish Avenger,Elvish Marksman,Elvish Sharpshooter,Elvish Hunter,Elvish Trapper,Elvish Prowler,Elvish Scout,Elvish Rider,Elvish Outrider)
    ( _ "I feel a chilly aura around this sword. I wonder if... All right, woah, even the hilt is extremely cold to the touch! The blade freezes everything it touches, so this might come in handy when fighting one of the larger demons, perhaps. Still, I suspect only someone strong enough to withstand the cold should wield this weapon.")
    ( _ "Only a living sword user can wield this sword!")
    (
        [object]
            id=chilling_blade
            name= _ "Glacial Gladius"
            image=attacks/glacial-gladius.png
            description= _ "While wielding this sword, the unit’s melee attack damage is increased by +1 and deals cold damage. Additionally, the unit’s maximum hitpoints are decreased by 5%."
            duration=forever
            [filter]
                x,y=$x1,$y1
            [/filter]
            [effect]
                apply_to=attack
                range=melee
                set_description= _ "glacial gladius"
                set_type=cold
                set_icon=attacks/glacial-gladius.png
                increase_damage=1
                [set_specials]
                    mode=append
                    {WEAPON_SPECIAL_SLOW}
                [/set_specials]
            [/effect]
            [effect]
                apply_to=hitpoints
                increase_total=-5%
            [/effect]
        [/object]
    )}
#enddef

#define ARCANE_SHOT_AMULET _X _Y
    {PICK_UP items/ankh-necklace.png {_X} {_Y} (
        [not]
            race=undead,faerie,bats
        [/not]
        [not]
            status=not_living
        [/not]
    )
    ( _ "The scroll next to this amulet says: “This artifact imbues projectiles shot by the bearer with strong arcane energy, casting fear upon their unholy enemies.” I imagine the demons stole this from somewhere and did not find actual use for it.")
    ( _ "Only mundane creatures can use this amulet.")
    (
        [object]
            id=arcane_shot_amulet
            name= _ "Amulet of the Divine Breeze"
            image=icons/ankh_necklace.png
            duration=forever
            description= _ "This amulet will grant the bearer arcane power to their ranged attacks, and increases their resistance to arcane damage by 10%."
            [filter]
                x,y=$x1,$y1
            [/filter]
            [effect]
                apply_to=attack
                range=ranged
                set_type=arcane
            [/effect]
            [effect]
                apply_to=resistance
                replace=false
                [resistance]
                    arcane=-10
                [/resistance]
            [/effect]
        [/object]
    )}
#enddef

#define POTION_OF_STRENGTH_S21 _X _Y
    {PICK_UP items/potion-red.png {_X} {_Y} (
        [not]
            status=not_living
        [/not]
        [not]
            race=bats
        [/not]
    )
    ( _ "It is a strength potion. The flask contains only enough for one person, but surely it will come in handy when we finally confront that Chaos Emperor. Who should take it?")
    ( _ "This potion can only be used by living beings. Let another take it.")
    (
        [sound]
            name=potion.ogg
        [/sound]

        [object]
            id=s21_strength_potion
            name= _ "Potion of Strength"
            image=icons/potion-red-4.png
            duration=forever
            description= _ "The drinker’s strength is increased, adding 1 damage point to their melee attacks, and adding 8 points to their total HP."
            [filter]
                x,y=$x1,$y1
            [/filter]
            [effect]
                apply_to=attack
                range=melee
                increase_damage=1
            [/effect]
            [effect]
                apply_to=hitpoints
                increase_total=8
                heal_full=yes
            [/effect]
        [/object]
    )}
#enddef

#define POTION_OF_DEFTNESS_S21 _X _Y
    {PICK_UP items/potion-cyan.png {_X} {_Y} (
        [not]
            status=not_living
        [/not]
        [not]
            race=bats
        [/not]
    )
    ( _ "This potion is supposed to make one more agile. I wonder if this is what makes those demons so hard to hit rather than natural skill.")
    ( _ "This potion can only be used by living beings. Let another take it.")
    (
        [sound]
            name=potion.ogg
        [/sound]

        [object]
            id=s21_deftness_potion
            name= _ "Potion of Deftness"
            image=icons/potion-cyan-2.png
            duration=forever
            description= _ "This magic potion will increase the drinker’s movement points by one, and increase the inflicted base damage of its ranged attacks by one, if applicable."
            [filter]
                x,y=$x1,$y1
            [/filter]
            [effect]
                apply_to=attack
                range=ranged
                increase_damage=1
            [/effect]
            [effect]
                apply_to=movement
                increase=1
            [/effect]
        [/object]
    )}
#enddef

# kate: indent-mode normal; encoding utf-8; space-indent on;


#textdomain wesnoth-Invasion_from_the_Unknown

#define HEADER_NEW_OBJECTIVES
    summary= _ "New objectives:"
#enddef
#define HEADER_CURRENT_OBJECTIVES
    summary= _ "Current objectives:"
#enddef
#define HEADER_INITIAL_OBJECTIVES
    summary= _ "Initial objectives:"
#enddef
#define HEADER_FINAL_OBJECTIVES
    summary= _ "Final objectives:"
#enddef

#define OBJECTIVE_OR
    [objective]
        bullet=""
        description="<small>"+_"or"+"</small>"
        red,green,blue=255,255,255
        condition=win
    [/objective]
#enddef

#define OBJECTIVE_BONUS _DESCRIPTION
    [objective]
        description={_DESCRIPTION}+{EARLY_FINISH_BONUS_FOOTNOTE} # wmllint: noconvert
        condition=win
    [/objective]
#enddef

#define OBJECTIVE_BONUS_COMPLETED _DESCRIPTION
    [objective]
        description="<s>"+{_DESCRIPTION}+{EARLY_FINISH_BONUS_FOOTNOTE}+"</s>" # wmllint: noconvert
        condition=win
    [/objective]
#enddef

#define OBJECTIVE_VICTORY_COMPLETED _TEXT
    [objective]
        description="<s>"+{_TEXT}+"</s>" # wmllint: noconvert
        condition=win
    [/objective]
#enddef

# kate: indent-mode normal; encoding utf-8; space-indent on;


#textdomain wesnoth-Invasion_from_the_Unknown

#define PLAYER_RISE_UP_EXCLUSION_LIST
    [not]
        id=Galas,Elynia,Anlindë,Mal Keshar,Lédinor,Igor,Erathan,Althurin,King Asthorgar
    [/not]
    [not]
        [filter_wml]
            undead_variation=null
        [/filter_wml]
    [/not]
    [not]
        status=not_living
    [/not]
#enddef

#define PLAYER_RISE_UP_ENEMY_EXCLUSION_FILTER
    [not]
        #Basically not any type that has plague or eats its victim
        type=Walking Corpse,Soulless,Necromancer,Shadow Spawn,Shadow Courier,Master of Darkness
    [/not]
    [not]
        ability=feeding
    [/not]
#enddef

#define PLAYER_RISE_UP
    [event]
        name=die
        first_time_only=no
        [filter]
            side=1
            {PLAYER_RISE_UP_EXCLUSION_LIST}
        [/filter]
        [filter_second]
            {PLAYER_RISE_UP_ENEMY_EXCLUSION_FILTER}
        [/filter_second]
        [filter_condition]
            [have_unit]
                id=Mal Keshar
                side=1
            [/have_unit]
        [/filter_condition]

        [fire_event]
            name=player rise up
            [primary_unit]
                x,y=$x1,$y1
            [/primary_unit]
        [/fire_event]
    [/event]

    [event]
        name=player rise up

        [message]
            speaker=Mal Keshar
            message= _ "Rise, fallen warrior! Rise once more and slay the foe who felled you in your hour of glory!"
        [/message]
    [/event]

    [event]
        name=player rise up
        first_time_only=no

        [sound]
            name=zombie-attack.wav
        [/sound]

        [unit]
            animate=yes
            side=1
            type=Walking Corpse
            x,y=$x1,$y1
            overwrite=yes

            moves,attacks_left,resting=0,0,no
            random_traits=yes

            name=$unit.name
            facing=$unit.facing
            gender=$unit.gender
            variation=$unit.undead_variation
        [/unit]
    [/event]
#enddef

#define SAD_MUSIC
    [mood_music]
        name=sad.ogg
    [/mood_music]
#enddef

#define HERO_DEFEAT_ENDLEVEL
    [endlevel]
        result=defeat
        music=sad.ogg,defeat.ogg,defeat2.ogg
    [/endlevel]
#enddef

#define DEATH_HANDLER_BASE _SUF _PRE_ACTIONS _POST_ACTIONS
    [event]
        name=last breath
        [filter]
            {_SUF}
        [/filter]

        {_PRE_ACTIONS}
    [/event]

    [event]
        name=die
        [filter]
            {_SUF}
        [/filter]

        {_POST_ACTIONS}
    [/event]
#enddef

# wmlindent: start ignoring

# Triggers defeat on the death of a player-owned unit identified by id. The
# side check is required to avoid breaking S23B.
#define HERO_DEFEAT_EVENT _ID _PRE_ACTIONS _POST_ACTIONS
    {DEATH_HANDLER_BASE (side,id=1,{_ID})
    (
        {_PRE_ACTIONS}
    ) (
        {_POST_ACTIONS}
        {HERO_DEFEAT_ENDLEVEL}
    )}
#enddef

# Like HERO_DEFEAT_EVENT but doesn't check the unit's side. Only really used
# for Althurin and King Asthorgar, who aren't always controlled by side 1.
#define ANY_SIDE_HERO_DEFEAT_EVENT _ID _PRE_ACTIONS _POST_ACTIONS
    {DEATH_HANDLER_BASE (id={_ID})
    (
        {_PRE_ACTIONS}
    ) (
        {_POST_ACTIONS}
        {HERO_DEFEAT_ENDLEVEL}
    )}
#enddef

# Plays incidental music on the death of a player-owned unit. Again, the side
# check is required to avoid breaking S23B.
#define MINOR_DEATH_EVENT _ID _PRE_ACTIONS _POST_ACTIONS
    {DEATH_HANDLER_BASE (side,id=1,{_ID})
    (
        {SAD_MUSIC}
        {_PRE_ACTIONS}
    ) (
        {_POST_ACTIONS} # Actions come last on purpose.
    )}
#enddef

#define DEATH:IGOR:A
    {MINOR_DEATH_EVENT Igor (
        [message]
            speaker=Igor
            message= _ "You failed to protect me. Aargh..."
        [/message]
    ) (
        [set_variables]
            mode=replace
            name=necro_store
            to_variable=unit
        [/set_variables]

        # Remove dying unit placeholder.
        [kill]
            x,y=$x1,$y1
        [/kill]

        [sound]
            name=zombie-attack.wav
        [/sound]

        [unit]
            animate=yes
            type=Walking Corpse
            x,y=$necro_store.x,$necro_store.y
            upkeep=$necro_store.upkeep
            random_traits=yes
            moves=0
            resting=no
            side=1
            name=$necro_store.name
            facing=$necro_store.facing
            variation=$necro_store.undead_variation
        [/unit]

        {CLEAR_VARIABLE necro_store}

        [message]
            speaker=Mal Keshar
            message= _ "Ah, excellent, a fresh recruit!"
        [/message]
    )}
#enddef

#define DEATH:IGOR:B
    {MINOR_DEATH_EVENT Igor (
        [message]
            speaker=Igor
            message= _ "Alas. It’s been my best time with you, friends..."
        [/message]

        [message]
            speaker=Mal Keshar
            message= _ "He, he, he..."
        [/message]
    ) (
        [message]
            speaker=Elynia
            message= _ "(glaring) Don’t do it."
        [/message]

        [message]
            speaker=Mal Keshar
            message= _ "Um... all right. May I ask why?"
        [/message]

        [message]
            speaker=Elynia
            message= _ "He was very helpful with us — more than I ever expected from anyone of his kind. It would be very unseemly for us to disturb his well-deserved rest."
        [/message]

        [message]
            speaker=Mal Keshar
            message= _ "As you wish, lady. Hmph."
        [/message]
    )}
#enddef

#define DEATH:IGOR:C
    {MINOR_DEATH_EVENT Igor (
        [message]
            speaker=Igor
            message= _ "Alas. I wish I could’ve seen the end with you..."
        [/message]
    ) ()}
#enddef

#define DEATH:MAL_KESHAR:A
    {HERO_DEFEAT_EVENT (Mal Keshar) (
        [message]
            speaker=Mal Keshar
            message= _ "Vanquished by these foul enemies... it should not have ended like this..."
        [/message]
    ) ()}
#enddef

#define DEATH:MAL_KESHAR:B
    {HERO_DEFEAT_EVENT (Mal Keshar) (
        [message]
            speaker=Mal Keshar
            message= _ "Oh, the sweet, cold embrace of death... it has been far too long..."
        [/message]
    ) ()}
#enddef

#define DEATH:ERATHAN:A
    {HERO_DEFEAT_EVENT Erathan (
        [message]
            speaker=Erathan
            message= _ "I am finished..."
        [/message]
    ) ()}
#enddef

#define DEATH:ERATHAN:B
    {MINOR_DEATH_EVENT Erathan (
        [message]
            speaker=Erathan
            message= _ "So this is the end of the road for me..."
        [/message]
    ) ()}
#enddef

#define DEATH:ELYNIA:A
    {HERO_DEFEAT_EVENT Elynia (
        [message]
            speaker=Elynia
            message= _ "The darkness... it is taking me away..."
        [/message]
    ) (
        [message]
            speaker=Galas
            message= _ "No! Elynia!"
        [/message]
    )}
#enddef

#define DEATH:ELYNIA:B
    {HERO_DEFEAT_EVENT Elynia (
        [message]
            speaker=Elynia
            message= _ "I’m sorry Galas... Hopefully you will be able to finish our journey without me..."
        [/message]
    ) ()}
#enddef

#define DEATH:ANLINDE
    {HERO_DEFEAT_EVENT Anlindë (
        [message]
            speaker=Anlindë
            message= _ "I suppose I should have seen this coming..."
        [/message]
    ) ()}
#enddef

#define DEATH:GALAS:A
    {HERO_DEFEAT_EVENT Galas (
        [message]
            speaker=Galas
            message= _ "I have much... left... to do—"
        [/message]
    ) ()}
#enddef

#define DEATH:GALAS:B
    {HERO_DEFEAT_EVENT Galas (
        [message]
            speaker=Galas
            message= _ "Why... did it have to end like this..."
        [/message]
    ) ()}
#enddef

#define DEATH:LEDINOR
    {HERO_DEFEAT_EVENT Lédinor (
        [message]
            speaker=Lédinor
            message= _ "It is the end for me. At last I shall rest..."
        [/message]
    ) ()}
#enddef

#define DEATH:ALTHURIN
    {ANY_SIDE_HERO_DEFEAT_EVENT Althurin (
        [message]
            speaker=Althurin
            message= _ "Well, at least I tried... Ugh—"
        [/message]
    ) ()}
#enddef

#define DEATH:KING_ASTHORGAR
    {ANY_SIDE_HERO_DEFEAT_EVENT (King Asthorgar) (
        [message]
            speaker=King Asthorgar
            message= _ "Argh! This is the end for me."
        [/message]
    ) (
        [message]
            speaker=Galas
            message= _ "We were supposed to protect the king of Herthgar!"
        [/message]
    )}
#enddef

#define DEATH:REVENANT_RING
    [event]
        name=last breath
        [filter]
            ability=revenant_ring
        [/filter]

        # If this triggers for a unit that's being possessed by Argan then the player
        # gets to deal with it. Or exploit it for XP farming, I guess.

        [message]
            speaker=narrator
            image=wesnoth-icon.png
            message= _ "The Ring of the Revenant glows in the nick of time..."
        [/message]

        # This SHOULD remove the ability as well to make it impossible for this event
        # to trigger in later scenarios. If it doesn't, slap whoever is responsible on
        # the dev team with a trout for me.

        [remove_object]
            x,y=$x1,$y1
            object_id=revenant_ring
        [/remove_object]

        [if]
            # Can't use [have_unit] here because the primary unit is under 1 HP
            {VARIABLE_LEXICAL_EQUALS unit.type "Faerie Spirit"}
            [then]
                [message]
                    speaker=unit
                    message= _ "A powerful force... it is pulling my soul... argh..."
                [/message]

                [message]
                    speaker=Mal Keshar
                    message= _ "Um... this doesn’t seem good. Noooot good at all."
                [/message]

                [message]
                    speaker=unit
                    message= ""+_"AAAAAAAAAAAAAAAAAAAAAAAAAAH—"+""
                [/message]

                # Ensure the unit is actually alive first in case of weirdness.

                [modify_unit]
                    [filter]
                        x,y=$x1,$y1
                    [/filter]
                    hitpoints=1
                [/modify_unit]

                [animate_unit]
                    [filter]
                        x,y=$x1,$y1
                    [/filter]
                    flag=levelout
                    with_bars=yes
                [/animate_unit]

                # Yes, the new unit type flashes for a moment before playing the levelin
                # animation. Nope, it can't be helped. Wesnoth is such a great game engine.

                [transform_unit]
                    x,y=$x1,$y1
                    transform_to=Faerie Hamadryad
                [/transform_unit]

                [heal_unit]
                    [filter]
                        x,y=$x1,$y1
                    [/filter]
                    amount=full
                    restore_statuses=yes
                    restore_attacks=no
                [/heal_unit]

                [remove_trait]
                    x,y=$x1,$y1
                    trait_id=spirit
                [/remove_trait]

                # Just in case Wesnoth decides to do something stupid and someone decides
                # it's a "feature"

                [clear_unit_status]
                    [filter]
                        x,y=$x1,$y1
                    [/filter]
                    status=not_living,undrainable,unplagueable,unpoisonable
                [/clear_unit_status]

                [animate_unit]
                    [filter]
                        x,y=$x1,$y1
                    [/filter]
                    flag=levelin
                    with_bars=yes
                [/animate_unit]

                [message]
                    speaker=unit
                    message= _ "Wha— what happened?"
                [/message]

                [message]
                    speaker=Galas
                    message= _ "The ring brought her back to life...?"
                [/message]

                [message]
                    speaker=Elynia
                    message= _ "I suppose that’s one possible way to look at it. Faerie spirits are perpetually stuck in an intermediate state between life and death, between the material and spirit realms. That ring that once belonged to the second Wesnothian Emperor fully pulled her back into ours... or wherever we are, actually."
                [/message]

                [if]
                    [have_unit]
                        id=Igor
                    [/have_unit]
                    # No idle chatter if Mal Keshar doesn't exist or is on the
                    # wrong side
                    [have_unit]
                        id=Mal Keshar
                        side=1
                    [/have_unit]
                    [then]
                        [message]
                            speaker=Igor
                            message= _ "She’s so pretty!"
                        [/message]

                        [message]
                            speaker=Mal Keshar
                            # po: He's saying she will be killed and used as raw material for wood-related
                            # po: commercial activities, of course.
                            message= _ "I would not mess with a half-faerie half-tree creature if I were you. Only heartbreak lies that way. Plus she will probably inspire someone to pursue a career in furniture design before we are done with our little adventure — if you know what I mean."
                        [/message]
                    [/then]
                [/if]
            [/then]
            [else]
                [heal_unit]
                    [filter]
                        x,y=$x1,$y1
                    [/filter]
                    amount=full
                    animate=yes
                    restore_statuses=yes
                    restore_attacks=no
                [/heal_unit]
            [/else]
        [/if]
    [/event]
#enddef

# wmlindent: stop ignoring

#define DEATHS_ACT_0
    {DEATH:GALAS:A}
    {DEATH:ANLINDE}
#enddef

#define DEATHS_ACT_1
    {DEATH:GALAS:A}
    {DEATH:MAL_KESHAR:A}
    {DEATH:ANLINDE}
#enddef

#define DEATHS_ACT_2_1
    {DEATH:GALAS:A}
    {DEATH:MAL_KESHAR:A}
    {DEATH:IGOR:A}
    {DEATH:ANLINDE}
#enddef

#define DEATHS_ACT_2_2
    {DEATH:GALAS:A}
    {DEATH:ELYNIA:A}
    {DEATH:MAL_KESHAR:A}
    {DEATH:IGOR:A}
    {DEATH:ANLINDE}
#enddef

#define DEATHS_ACT_3
    {DEATH:GALAS:A}
    {DEATH:ELYNIA:A}
    {DEATH:MAL_KESHAR:A}
    {DEATH:ERATHAN:A}
    {DEATH:IGOR:B}
#enddef

#define DEATHS_ACT_4
    {DEATH:GALAS:B}
    {DEATH:ELYNIA:B}
    {DEATH:MAL_KESHAR:B}
    {DEATH:ERATHAN:B}
    {DEATH:IGOR:C}
    {DEATH:LEDINOR}
    {DEATH:REVENANT_RING}
#enddef

#define DEATHS_DWARVES
    {DEATH:ALTHURIN}
    {DEATH:KING_ASTHORGAR}
#enddef

# kate: indent-mode normal; encoding utf-8; space-indent on;


#textdomain wesnoth-Invasion_from_the_Unknown

#define NO_RECALLS
    disallow_recall=yes
#enddef

#define OVERRIDE_NEXT_SCENARIO _ID
    [+endlevel]
        next_scenario={_ID}
    [/endlevel]
#enddef

#define CAPTURE_VILLAGE _SIDE _X _Y
    [capture_village]
        side={_SIDE}
        x={_X}
        y={_Y}
    [/capture_village]
#enddef

#define SCROLL_TO_UNIT _ID
    [scroll_to_unit]
        id={_ID}
    [/scroll_to_unit]
#enddef

#define PLAYER_RECRUITMENT_SETUP_FOR_SCENARIO _SID
    [setup_recruitment_cost]
        scenario_number={_SID}
    [/setup_recruitment_cost]
#enddef

#define PER_VILLAGE_INCOME _INCOME
    village_gold={_INCOME}
#enddef

#define MYSTERIOUS_VOICE _MSG
    [message]
        speaker=narrator
        image=misc/blank-hex.png
        caption= _ "male^Mysterious Voice"
        message={_MSG}
    [/message]
#enddef

# kate: indent-mode normal; encoding utf-8; space-indent on;


#textdomain wesnoth-Invasion_from_the_Unknown

#define UNDERGROUND_VOLCANO R G B
    #
    # -30, -40, -40 are the default good values for an underground
    # reddish hue
    #
    [time]
        id=v_underground
        name= _ "Volcanic Underground"
        image=misc/time-schedules/schedule-underground.png
        lawful_bonus=-25
        red={R}
        green={G}
        blue={B}
    [/time]
#enddef

#define UNDERGROUND_VOLCANO_DEFAULT
    #
    # This is a custom schedule that gives everything a slight
    # reddish hue and gently pulsates. -30, -40, -40 are default
    # values that look good
    #
    {UNDERGROUND_VOLCANO -27 -37 -37}
    {UNDERGROUND_VOLCANO -28 -38 -38}
    {UNDERGROUND_VOLCANO -32 -42 -42}
    {UNDERGROUND_VOLCANO -36 -46 -46}
    {UNDERGROUND_VOLCANO -37 -47 -47}
    {UNDERGROUND_VOLCANO -36 -46 -46}
    {UNDERGROUND_VOLCANO -32 -42 -42}
    {UNDERGROUND_VOLCANO -28 -38 -38}
#enddef

#define ILLUMINATED_UNDERGROUND
    [time]
        id=illuminated_underground
        name= _ "Illuminated Underground"
        image=misc/time-schedules/schedule-underground-illum.png
        lawful_bonus=0
        red=-35
        green=-25
        blue=0
    [/time]
#enddef

# kate: indent-mode normal; encoding utf-8; space-indent on;


#textdomain wesnoth-Invasion_from_the_Unknown

#define TRAITS_SET_NO_STRONG
    ignore_race_traits=yes
    {TRAIT_QUICK}
    {TRAIT_INTELLIGENT}
    {TRAIT_RESILIENT}
#enddef

# kate: indent-mode normal; encoding utf-8; space-indent on;


#textdomain wesnoth-Invasion_from_the_Unknown

#define WIND_NOISE_SOUND_SOURCE
    {BACKGROUND_SOUND_SOURCE_GENERIC __ss_wind_blustery_all ambient/wind-blustery.ogg}
#enddef

#define SETUP_SHAXTHAL_ROAMING_SOUND_EFFECTS
    [event]
        name=moveto
        first_time_only=no
        [filter]
            race=shaxthal
            [not]
                type=Shaxthal Razorbird,Shaxthal Thunderbird
            [/not]
        [/filter]
        {RANDOM (1..6)}
        [if]
            {VARIABLE_NUMERICAL_LESS_THAN random 4}
            [then]
                [sound]
                    name={SOUND_LIST:BIOMECHANICAL_ROAM}
                [/sound]
            [/then]
        [/if]
    [/event]
#enddef

# kate: indent-mode normal; encoding utf-8; space-indent on;


#textdomain wesnoth-Invasion_from_the_Unknown

# wmlindent: start ignoring

#define SPECIAL_NOTE_DREAD
    _ "When this unit’s dreadful attack is used on offensive, it decreases the damage the unit may take in retaliation, but only if the victim is of equal or lesser level." #enddef

#define SPECIAL_NOTE_INTIMIDATES
    _ "This unit’s presence intimidates adjacent level 0-1 enemy units, causing them to deal less damage and be unable to maintain their zone of control." #enddef

#define SPECIAL_NOTE_REGENERATES4
    _ "This unit can either remove poison from itself or regenerate 4 hitpoints each turn."#enddef

# wmlindent: stop ignoring

# kate: indent-mode normal; encoding utf-8; space-indent on;