#textdomain wesnoth-Naia

#define NO_START_OF_SCENARIO_SAVE
    [+endlevel]
        save=no
    [/endlevel]
#enddef

#define NO_REPLAY_SAVE
    [+endlevel]
        replay_save=no
    [/endlevel]
#enddef

#define ENDLEVEL_QUIET
    [endlevel]
        result=victory
        bonus,linger_mode,carryover_report=no,no,no
        music=silence.ogg
        {NEW_GOLD_CARRYOVER 100}
    [/endlevel]
#enddef

#define ENDLEVEL_CONTINUE
    [endlevel]
        result=victory
        bonus,linger_mode,carryover_report=no,yes,no
        music=silence.ogg
        {NEW_GOLD_CARRYOVER 100}
    [/endlevel]
#enddef

#define ENDLEVEL_VICTORY BONUS
    [endlevel]
        result=victory
        bonus={BONUS}
        linger_mode,carryover_report=yes,yes
        {NEW_GOLD_CARRYOVER 40}
    [/endlevel]
#enddef

#define ENDLEVEL_VICTORY_NO_GOLD_CARRYOVER
    [endlevel]
        result=victory
        bonus=no
        linger_mode,carryover_report=yes,yes
        {NEW_GOLD_CARRYOVER 0}
    [/endlevel]
#enddef

#define ENDLEVEL_DEFEAT
    [endlevel]
        result=defeat
    [/endlevel]
#enddef

#define SIGHTED_SUF_BY_PLAYER _SPOTTED_UNIT_SUF
    name=sighted
    [filter]
        {_SPOTTED_UNIT_SUF}
    [/filter]
    [filter_second]
        side=1
    [/filter_second]

    [redraw][/redraw]
#enddef

#define SIGHTED_SUF_BY_SIDE _SPOTTED_UNIT_SUF _SPOTTER_SIDE_NUM
    name=sighted
    [filter]
        {_SPOTTED_UNIT_SUF}
    [/filter]
    [filter_second]
        side={_SPOTTER_SIDE_NUM}
    [/filter_second]

    [redraw][/redraw]
#enddef

#define UNIT_VISIBLE_FOR_SIDE _SIDE
    [filter_vision]
        visible=yes
        side={_SIDE}
    [/filter_vision]
#enddef

#
# Fires a custom event when stumbling upon a unit matching the
# specified filter for the first time. The custom event should
# be a one-time-only event or weird things may happen.
#
# The unit stumbled upon will be the secondary unit for the
# custom event handler, while the player unit becomes the primary
# unit.
#
#define FIRE_EVENT_ON_STUMBLE_UPON _EVT_ID _SUF
    [event]
        name=sighted
        [filter]
            {_SUF}
        [/filter]
        [filter_second]
            side=1
        [/filter_second]
        [redraw][/redraw]
        [fire_event]
            name={_EVT_ID}
            [primary_unit]
                x,y=$x2,$y2
            [/primary_unit]
            [secondary_unit]
                x,y=$x1,$y1
            [/secondary_unit]
        [/fire_event]
    [/event]
    [event]
        name=attack
        [filter]
            {_SUF}
        [/filter]
        [filter_second]
            side=1
        [/filter_second]
        [fire_event]
            name={_EVT_ID}
            [primary_unit]
                x,y=$x2,$y2
            [/primary_unit]
            [secondary_unit]
                x,y=$x1,$y1
            [/secondary_unit]
        [/fire_event]
    [/event]
    [event]
        name=attack
        [filter]
            side=1
        [/filter]
        [filter_second]
            {_SUF}
        [/filter_second]
        [fire_event]
            name={_EVT_ID}
            [primary_unit]
                x,y=$x1,$y1
            [/primary_unit]
            [secondary_unit]
                x,y=$x2,$y2
            [/secondary_unit]
        [/fire_event]
    [/event]
#enddef

#define RETRIEVE_GOLD _AMOUNT
    # It's mandatory to use a variable instead of a macro, as the latter causes the resultant text
    # not to be matched in the gettext source.
    {VARIABLE temp_gold_retrieval_amount ({_AMOUNT})}
    [message]
        speaker=narrator
        image="items/gold-coins-medium.png"
        sound=gold.ogg
        message= _ "You retrieve $temp_gold_retrieval_amount pieces of gold."
    [/message]
    [gold]
        side=1
        amount=$temp_gold_retrieval_amount
    [/gold]
    {CLEAR_VARIABLE temp_gold_retrieval_amount}
#enddef

#define RECEIVE_GOLD _AMOUNT
    # It's mandatory to use a variable instead of a macro, as the latter causes the resultant text
    # not to be matched in the gettext source.
    {VARIABLE temp_gold_retrieval_amount ({_AMOUNT})}
    [message]
        speaker=narrator
        image="items/gold-coins-medium.png"
        sound=gold.ogg
        message= _ "You receive $temp_gold_retrieval_amount pieces of gold!"
    [/message]
    [gold]
        side=1
        amount=$temp_gold_retrieval_amount
    [/gold]
    {CLEAR_VARIABLE temp_gold_retrieval_amount}
#enddef

#define ADD_GOLD _SIDE _ONEASY _ONMEDIUM _ONHARD
    [gold]
        side={_SIDE}
        {QUANTITY amount {_ONEASY} {_ONMEDIUM} {_ONHARD} }
    [/gold]
#enddef

#define SET_GOLD _SIDE _ONEASY _ONMEDIUM _ONHARD
    [modify_side]
        side={_SIDE}
        {QUANTITY gold {_ONEASY} {_ONMEDIUM} {_ONHARD} }
    [/modify_side]
#enddef

#define SCROLL_TO_LOCATION_AND_RETURN_TO _X1 _Y1 _X2 _Y2
    [redraw][/redraw]

    [scroll_to]
        x={_X1}
        y={_Y1}
    [/scroll_to]

    [delay]
        time=250
    [/delay]

    [scroll_to]
        x={_X2}
        y={_Y2}
    [/scroll_to]
#enddef

#define SCROLL_TO_LOCATION_AND_RETURN_TO_PRIMARY_UNIT _X _Y
    {SCROLL_TO_LOCATION_AND_RETURN_TO ({_X}) ({_Y}) ($x1) ($y1)}
#enddef

#define SCROLL_TO_LOCATION_AND_RETURN_TO_SECONDARY_UNIT _X _Y
    {SCROLL_TO_LOCATION_AND_RETURN_TO ({_X}) ({_Y}) ($x2) ($y2)}
#enddef

#define CLEAR_CAVE_SHROUD _ADDITIONAL_SLF
    [remove_shroud]
        side=1
        terrain=!,X*,X*^*,*^X*
        [or]
            [filter_adjacent_location]
                terrain=!,X*,X*^*,*^X*
            [/filter_adjacent_location]
        [/or]
        [and]
            {_ADDITIONAL_SLF}
        [/and]
    [/remove_shroud]
#enddef

##
# Removes an event barrier consisting of adjacent hexes matching
# a terrain type filter (usually *^Zz\,*^Zz/,*^Zz|) on the specified location
# and highlights the affected locations for the player.
##
#define REMOVE_EVENT_BARRIER _TERRAIN_FILTER _TARGET_X _TARGET_Y
    [simplify_location_filter]
        x={_TARGET_X}
        y={_TARGET_Y}
        radius=6
        [filter_radius]
            terrain={_TERRAIN_FILTER}
        [/filter_radius]
        variable=temp_GATE_GLYPH_locs
    [/simplify_location_filter]

    [remove_terrain_overlays]
        x=$temp_GATE_GLYPH_locs.x
        y=$temp_GATE_GLYPH_locs.y
    [/remove_terrain_overlays]

    [remove_shroud]
        side=1
        x=$temp_GATE_GLYPH_locs.x
        y=$temp_GATE_GLYPH_locs.y
    [/remove_shroud]

    [redraw]
        side=1
    [/redraw]

    [scroll_to]
        x={_TARGET_X}
        y={_TARGET_Y}
    [/scroll_to]

    {HIGHLIGHT_GOAL (
        x=$temp_GATE_GLYPH_locs.x
        y=$temp_GATE_GLYPH_locs.y
    )}

    [scroll_to]
        x,y=$x1,$y1
    [/scroll_to]

    [redraw][/redraw]

    {CLEAR_VARIABLE temp_GATE_GLYPH_locs}
#enddef

#define DISALLOW_END_TURN
    [disallow_end_turn][/disallow_end_turn]
#enddef

#define ALLOW_END_TURN
    [allow_end_turn][/allow_end_turn]
#enddef

#define DO_NOT_REMOVE_FROM_CARRYOVER_ON_DEFEAT
    remove_from_carryover_on_defeat=no
#enddef

#
# Let someone else do the talking when an undead minion isn't expected to be
# capable of speech (see patch.lua for implementation).
#
#define UNIT_SPEAKS_FOR_UNDEAD_MINION _FALLBACK_SUF
    [fallback_if]
        race=bats,undead
        [not]
            type=Lich,Death Knight,Death Baron,Draug,Revenant,Deathblade,Bone Shooter,Banebow,Wraith,Spectre,Shadow,Nightgaunt
        [/not]
    [/fallback_if]
    [fallback_to]
        {_FALLBACK_SUF}
    [/fallback_to]
#enddef

#
# Stricter version of UNIT_SPEAKS_FOR_UNDEAD_MINION that doesn't allow even
# high-level undead units to speak.
#
#define UNIT_SPEAKS_FOR_UNDEAD_MINION_STRICT _FALLBACK_SUF
    [fallback_if]
        race=bats,undead
        [not]
            type=Lich
        [/not]
    [/fallback_if]
    [fallback_to]
        {_FALLBACK_SUF}
    [/fallback_to]
#enddef


#textdomain wesnoth-Naia

#
# Since 1.11.x the post-Fall ToD macros are in mainline, so #undef them first
# to avoid warnings with 1.13.x.
#

#undef TWO_SUNS_DEFAULT_SCHEDULE
#undef DAWN1
#undef MORNING1
#undef MIDDAY1
#undef AFTERNOON1
#undef DUSK1
#undef SHORTDARK
#undef DAWN2
#undef MORNING2
#undef MIDDAY2
#undef AFTERNOON2
#undef DUSK2
#undef LONGDARK1
#undef LONGDARK2
#undef LONGDARK3
#undef LONGDARK4

#define TWO_SUNS_DEFAULT_SCHEDULE
    {DAWN1}
    {MORNING1}
    {MIDDAY1}
    {AFTERNOON1}
    {DUSK1}
    {SHORTDARK}
    {DAWN2}
    {MORNING2}
    {MIDDAY2}
    {AFTERNOON2}
    {DUSK2}
    {LONGDARK1}
    {LONGDARK2}
    {LONGDARK3}
    {LONGDARK4}
#enddef

#define TWO_SUNS_SCHEDULE_IMAGE X Y
    image="misc/schedule-twosuns.png~CROP({X},{Y},125,39)"
#enddef

#define DAWN1
    [time]
        id=dawn1
        name= _ "First Dawn"
        {TWO_SUNS_SCHEDULE_IMAGE 1 1}
        red=0
        green=-10
        blue=-10
        sound=ambient/morning.ogg
    [/time]
#enddef

#define MORNING1
    [time]
        id=morning1
        name= _ "First Morning"
        {TWO_SUNS_SCHEDULE_IMAGE 127 1}
        red=5
        green=5
        blue=-5
        lawful_bonus=25
    [/time]
#enddef

#define MIDDAY1
    [time]
        id=midday1
        name= _ "First Midday"
        {TWO_SUNS_SCHEDULE_IMAGE 253 1}
        red=10
        green=5
        blue=0
        lawful_bonus=25
    [/time]
#enddef

#define AFTERNOON1
    [time]
        id=afternoon1
        name= _ "First Afternoon"
        {TWO_SUNS_SCHEDULE_IMAGE 1 41}
        red=10
        green=5
        blue=0
        lawful_bonus=25
    [/time]
#enddef

#define DUSK1
    [time]
        id=dusk1
        name= _ "First Dusk"
        {TWO_SUNS_SCHEDULE_IMAGE 127 41}
        red=15
        green=-15
        blue=-30
        sound=ambient/night.ogg
    [/time]
#enddef

#define SHORTDARK
    [time]
        id=short_dark
        name= _ "The Short Dark"
        {TWO_SUNS_SCHEDULE_IMAGE 253 41}
        red=-60
        green=-45
        blue=-15
        lawful_bonus=-25
    [/time]
#enddef

#define DAWN2
    [time]
        id=dawn2
        name= _ "Second Dawn"
        {TWO_SUNS_SCHEDULE_IMAGE 1 81}
        red=0
        green=-10
        blue=-10
        sound=ambient/morning.ogg
    [/time]
#enddef

#define MORNING2
    [time]
        id=morning2
        name= _ "Second Morning"
        {TWO_SUNS_SCHEDULE_IMAGE 127 81}
        red=5
        green=5
        blue=-5
        lawful_bonus=25
    [/time]
#enddef

#define MIDDAY2
    [time]
        id=midday2
        name= _ "Second Midday"
        {TWO_SUNS_SCHEDULE_IMAGE 253 81}
        red=10
        green=5
        blue=0
        lawful_bonus=25
    [/time]
#enddef

#define AFTERNOON2
    [time]
        id=afternoon2
        name= _ "Second Afternoon"
        {TWO_SUNS_SCHEDULE_IMAGE 1 121}
        red=10
        green=5
        blue=0
        lawful_bonus=25
    [/time]
#enddef

#define DUSK2
    [time]
        id=dusk2
        name= _ "Second Dusk"
        {TWO_SUNS_SCHEDULE_IMAGE 127 121}
        red=15
        green=-15
        blue=-30
        sound=ambient/night.ogg
    [/time]
#enddef

#define LONGDARK1
    [time]
        id=long_dark1
        name= _ "The Long Dark — First Watch"
        {TWO_SUNS_SCHEDULE_IMAGE 253 121}
        red=-70
        green=-50
        blue=-15
        lawful_bonus=-25
    [/time]
#enddef

#define LONGDARK2
    [time]
        id=long_dark2
        name= _ "The Long Dark — Second Watch"
        {TWO_SUNS_SCHEDULE_IMAGE 1 161}
        red=-70
        green=-50
        blue=-15
        lawful_bonus=-25
    [/time]
#enddef

#define LONGDARK3
    [time]
        id=long_dark3
        name= _ "The Long Dark — Third Watch"
        {TWO_SUNS_SCHEDULE_IMAGE 127 161}
        red=-70
        green=-50
        blue=-15
        lawful_bonus=-25
    [/time]
#enddef

#define LONGDARK4
    [time]
        id=long_dark4
        name= _ "The Long Dark — Fourth Watch"
        {TWO_SUNS_SCHEDULE_IMAGE 253 161}
        red=-70
        green=-50
        blue=-15
        lawful_bonus=-25
    [/time]
#enddef

#define INFERNO_NIGHT
    [time]
        id=inferno_night
        name= _ "Inferno"
        {TWO_SUNS_SCHEDULE_IMAGE 127 201}
        lawful_bonus=-30
        red=-20
        green=-40
        blue=-10
    [/time]
#enddef

#define ENDLESS_NIGHT
    [time]
        id=endless_night
        name= _ "The Endless Night"
        {TWO_SUNS_SCHEDULE_IMAGE 1 201}
        lawful_bonus=-25
        red=-30
        green=-30
        blue=-10
    [/time]
#enddef


#textdomain wesnoth-Naia

#define SCHEDULE_LIGHTING _R _G _B
    [+time]
        red={_R}
        green={_G}
        blue={_B}
    [/time]
#enddef

#
# The actual schedule declarations follow
#

#define INDOORS_HIVE
    [time]
        id=indoors_hive
        name= _ "Shaxthal Hive"
        image=misc/schedule-indoors-darker.png
        lawful_bonus=-25
        red=-60
        green=-60
        blue=0
    [/time]
#enddef

#define NEUTRAL_TOD
    [time]
        id=neutral_tod
        name= _ "Neutral time of day"
    [/time]
#enddef


#textdomain wesnoth-Naia

#define RAGGED_FLAG
    {FLAG_VARIANT6 ragged}
#enddef

#define ELVISH_FLAG
    {FLAG_VARIANT long}
#enddef

#define CHAOS_FLAG
    {FLAG_VARIANT undead}
#enddef

#define ARAGWAITH_FLAG
    {FLAG_VARIANT loyalist}
#enddef

#define ALLIANCE_FLAG
    {FLAG_VARIANT long}
#enddef

#define DWARVISH_FLAG
    {FLAG_VARIANT knalgan}
#enddef

#define NO_ECONOMY
    gold,village_gold=0,0
    {NO_INCOME}
#enddef

#define SET_RECRUIT_LIST _SIDE _LIST
    [modify_side]
        side={_SIDE}
        recruit={_LIST}
    [/modify_side]
#enddef

#define REMOVE_RECRUIT_LIST _SIDE
    [set_recruit]
        side={_SIDE}
        recruit=""
    [/set_recruit]
#enddef

#define ALLOW_RECRUIT _SIDE _LIST
    [allow_recruit]
        side={_SIDE}
        type={_LIST}
    [/allow_recruit]
#enddef

#define DISALLOW_RECRUIT _SIDE _LIST
    [disallow_recruit]
        side={_SIDE}
        type={_LIST}
    [/disallow_recruit]
#enddef


#textdomain wesnoth-Naia

#define CONTINUE_PLAYING_STORY_MUSIC_FIRST
    [+event]
        [+music]
            immediate=no
        [/music]
    [/event]
#enddef

#define SOUND_SOURCE _ID _X _Y _SNDLIST _TIMEOUT _TRIGGER_CHANCE_P_VAL
    [sound_source]
        id={_ID}
        x={_X}
        y={_Y}
        sounds={_SNDLIST}
        delay={_TIMEOUT}
        chance={_TRIGGER_CHANCE_P_VAL}
    [/sound_source]
#enddef

#define SOUND_SOURCE_IGNORE_FOGGED_LOCATION
    [+sound_source]
        check_fogged=false
    [/sound_source]
#enddef

#define SOUND_SOURCE_IGNORE_HIDDEN
    [+sound_source]
        check_fogged=false
        check_shrouded=false
    [/sound_source]
#enddef

#define CONTINUOUS_SOUND_SOURCE _ID _X _Y _SNDLIST
    {SOUND_SOURCE ({_ID}) ({_X}) ({_Y}) ({_SNDLIST}) (0) (100)}
#enddef

#define SOUND_SOURCE_RANGE _FULL _FADE
    [+sound_source]
        full_range={_FULL}
        fade_range={_FADE}
    [/sound_source]
#enddef

#define SOUND_SOURCE_ENTIRE_MAP
    {SOUND_SOURCE_RANGE 1000 1}
#enddef

#define REMOVE_SOUND_SOURCE _ID
    [remove_sound_source]
        id={_ID}
    [/remove_sound_source]
#enddef

#define CAVE_WATER_SOUND_SOURCE _X _Y
    [sound_source]
        id="__ss_cave_water_"+{_X}+"_"+{_Y} # wmllint: ignore
        x={_X}
        y={_Y}
        sounds={SOUND_LIST:CAVE_DRIP}
        # Play every three seconds, don't loop on a single sound
        # (which unfortunately means the sound source won't continue
        # updating while a GUI dialog is running).
        delay,loop,chance=3000,0,100
        full_range,fade_range=10,6
        # Ignore fog, but do not ignore shroud.
        check_fogged,check_shrouded=no,yes
    [/sound_source]
#enddef

#define BACKGROUND_SOUND_SOURCE_GENERIC _ID _SOUND_LIST
    [sound_source]
        id={_ID}
        x,y=1,1
        sounds={_SOUND_LIST}
        # Loop continuously forever
        delay,loop,chance=0,-1,100
        full_range,fade_range={INFINITY},{INFINITY}
        check_fogged,check_shrouded=no,no
    [/sound_source]
#enddef

#define CAVE_NOISE_SOUND_SOURCE
    {BACKGROUND_SOUND_SOURCE_GENERIC __ss_cave_noise_all ambient/cave.ogg}
#enddef

#define HIVE_NOISE_2_SOUND_SOURCE
    {BACKGROUND_SOUND_SOURCE_GENERIC __ss_hive_noise_2_all ambient/dark-2.ogg}
#enddef

#define SOUND_LIST:BIOMECHANICAL_HIT
shaxthal-hit-[1~4].ogg #enddef

#define SOUND_LIST:BIOMECHANICAL_DIE
shaxthal-die-[1~4].ogg #enddef

#define SOUND_LIST:BIOMECHANICAL_ROAM
ambient/shaxthal-roam-[1~2].ogg,shaxthal-die-[1~4].ogg #enddef

#define SOUND_LIST:IMP_HIT
{SOUND_LIST:OGRE_HIT}#enddef

#define SOUND_LIST:IMP_DIE
{SOUND_LIST:OGRE_DIE}#enddef

#define SOUND_LIST:PSY_HIT
{SOUND_LIST:LICH_HIT}#enddef

#define SOUND_LIST:PSY_DIE
lich-die.ogg #enddef

#define SOUND_LIST:ALIEN_HIT
yeti-hit.ogg #enddef

#define SOUND_LIST:ALIEN_DIE
yeti-die.ogg #enddef

#define SOUND_LIST:MATRIX_HIT
magic-dark.ogg,magic-dark-big.ogg #enddef

#define SOUND_LIST:MATRIX_DIE
magic-dark-miss.ogg,magic-dark-big-miss.ogg #enddef

#define SOUND_LIST:BOT_SMALL_HIT
bot-small-hit-[1~2].wav #enddef

#define SOUND_LIST:BOT_SMALL_DIE
bot-small-explosion-[1~3].ogg #enddef

#define SOUND_LIST:GUN_ACTIVATE
gun-activate-[1~2].ogg #enddef

#define SOUND_LIST:CAVE_DRIP
ambient/cave-drip-[1~5].ogg #enddef


#textdomain wesnoth-Naia

##
# Establishes a new timed unit respawn point. This can only be used in events.
#
# Example:
#   {TIMED_SPAWNER 4 (type=Shaxthal Assault Drone,Shaxthal Sentry Drone) 2 42 10}
#
# If you specify a comma-separated list of unit types in the UNIT_WML block, the spawn type
# will be randomized every cycle.
#
# A respawn interval of 0 turns will cause units to respawn immediately after being
# killed.
##
#define TIMED_SPAWNER _RESPAWN_TURNS _UNIT_WML _SIDE_NUMBER _X _Y
    {SPAWNER_BASE ({_RESPAWN_TURNS}) ({_UNIT_WML}) ({_SIDE_NUMBER}) ({_X}) ({_Y}) (yes)}
#enddef

##
# Establishes a new one-time respawn point. This can only be used in events.
#
# Example:
#   {ONETIME_SPAWNER (type=Shaxthal War Drone,Shaxthal Enforcer Drone) 5 31 42}
#
# If you specify a comma-separated list of unit types in the UNIT_WML block, the spawn type
# will be randomized every cycle.
##
#define ONETIME_SPAWNER _UNIT_WML _SIDE_NUMBER _X _Y
    {SPAWNER_BASE (0) ({_UNIT_WML}) ({_SIDE_NUMBER}) ({_X}) ({_Y}) (no)}
#enddef

##
# Specialized timed drone spawner using a special passive-aggressive AI behavior.
##
#define TIMED_DRONE_SPAWNER _RESPAWN_TURNS _UNIT_WML _SIDE_NUMBER _X _Y
    {SPAWNER_BASE ({_RESPAWN_TURNS}) (
        {_UNIT_WML}
        {DRONE_SPAWNER_AI ({_X}) ({_Y})}
    ) ({_SIDE_NUMBER}) ({_X}) ({_Y}) (yes)}
#enddef

##
# Specialized one-time drone spawner using a special passive-aggressive AI behavior.
##
#define ONETIME_DRONE_SPAWNER _UNIT_WML _SIDE_NUMBER _X _Y
    {SPAWNER_BASE (0) (
        {_UNIT_WML}
        {DRONE_SPAWNER_AI ({_X}) ({_Y})}
    ) ({_SIDE_NUMBER}) ({_X}) ({_Y}) (no)}
#enddef

##
# This is the main spawner logic. This macro must be present somewhere in the
# scenario at top level, preferably right before the first spawner macro inclusion.
#
# It is possible to disable all spawners in a scenario by setting the variable
# spawner_controller_enabled to a false boolean value. This is initially set to
# true.
##
#define SPAWN_CONTROLLER
    [event]
        name=prestart
        {VARIABLE spawner_controller_enabled yes}
    [/event]
    [event]
        name=victory
        {CLEAR_VARIABLE spawner_controller_enabled}
    [/event]
    [event]
        name=die
        first_time_only=no
        [filter_condition]
            {VARIABLE_BOOLEAN_EQUALS spawner_controller_enabled yes}
        [/filter_condition]
        [filter]
            [filter_wml]
                [variables]
                    spawner_respawn=yes
                [/variables]
            [/filter_wml]
        [/filter]

        # See lua/spawner.lua.
        [run_spawn_controller][/run_spawn_controller]
    [/event]
#enddef

##
# Implementation detail. Use TIMED_SPAWNER and ONE_TIME_SPAWNER instead.
##
#define SPAWNER_BASE _RESPAWN_TURNS _UNIT_WML _SIDE_NUMBER _X _Y _DO_RESPAWN
    [event]
        name="prestart,respawn:S{_SIDE_NUMBER}X{_X}Y{_Y}"
        first_time_only=no
        delayed_variable_substitution=no

        # See lua/spawner.lua.
        [spawner_spawn]
            {_UNIT_WML}

            side={_SIDE_NUMBER}
            x={_X}
            y={_Y}

            can_respawn={_DO_RESPAWN}
            respawn_turns={_RESPAWN_TURNS}
        [/spawner_spawn]
    [/event]
#enddef

##
# Implementation detail for TIMED_DRONE_SPAWNER and ONETIME_DRONE_SPAWNER.
##
#define DRONE_SPAWNER_AI _X _Y
    ai_special=guardian
#enddef

##
# HACK used in IftU S22B
##
#define TRY_RESPAWN_NOW _SIDE_NUMBER _X _Y
    [fire_event]
        name="respawn:S{_SIDE_NUMBER}X{_X}Y{_Y}"
    [/fire_event]
#enddef


#textdomain wesnoth-Naia

# wmlindent: start ignoring
#define SPECIAL_NOTE_OBSCURE
    _ "This unit darkens the surrounding area, making chaotic units fight better, and lawful units fight worse." #enddef

#define SPECIAL_NOTE_SYLVAN_ESSENCE
    _ "This unit’s powers are increased by the Sylvan Essence." #enddef

#define SPECIAL_NOTE_SYLVAN_SPARK
    _ "This unit will regenerate 5 HP per turn in forest or mushroom grove terrains." #enddef

#define SPECIAL_NOTE_DEFEND_ONLY
    _ "Some of this unit’s attacks are only available during defense." #enddef

#define SPECIAL_NOTE_ATTACK_ONLY
    _ "Some of this unit’s attacks are only available during offense." #enddef

#define SPECIAL_NOTE_ALWAYS_HITS
    _ "This unit’s attacks always hit its opponent." #enddef

#define SPECIAL_NOTE_PRECISION
    _ "This unit can attack very precisely, giving it a better chance to hit agile foes on the offense." #enddef

#define SPECIAL_NOTE_PROTECTION
    _ "Adjacent lower-level units of the same allegiance have their resistances increased by the sole presence of this unit." #enddef

#define SPECIAL_NOTE_TERROR
    _ "This unit can frighten enemy units that are next to it, making them fight worse." #enddef

#define SPECIAL_NOTE_BORE
    _ "This unit can hide in cave or stone walls to remain undetected by its enemies, as well as receive a 50% damage bonus on defense." #enddef

#define SPECIAL_NOTE_RESTRICTED_TO_WATER
    _ "This unit cannot move to terrains other than water, castle and villages." #enddef

#define SPECIAL_NOTE_ZEAL
    _ "The zeal of this unit inspires adjacent units to resist enemy attacks better and deal increased damage." #enddef

#define SPECIAL_NOTE_NECROSIS
    _ "This unit is able to infect victims with a powerful poison capable of killing and turning them into undead." #enddef

#define SPECIAL_NOTE_TESTAMENT
    _ "Upon death this unit heals adjacent allies and leaves a suitable testament to its existence on the map." #enddef

#define SPECIAL_NOTE_MARK
    _ "This unit is able to mark targets and increase damage dealt to them by all units until the controlling side’s turn ends." #enddef

#define SPECIAL_NOTE_ENERGIZE
    _ "This unit improves resistances of adjacent biomechanical units and heals them at the start of each turn." #enddef

# wmlindent: stop ignoring


#textdomain wesnoth-Naia

#define CAMPAIGN_INTRO_HEADER
    title="!" # wmllint: ignore
    title_alignment=center
    show_title=yes
#enddef

#define CAMPAIGN_INTRO_PADDING
    "

" #enddef

#define CAMPAIGN_INTRO_WARNING_TITLE
    ""+
    _ "Warning!"+"

" #enddef

# wmlindent: start ignoring
#define CAMPAIGN_INTRO_GAMEPLAY_WARNING
    _ "Some scenarios of this campaign work significantly different from normal Wesnoth gameplay. It is especially important to pay close attention to the mission objectives and not necessarily try to kill every single enemy, especially on shrouded maps, or in places where enemies seem to respawn continuously." #enddef

#ifdef CAMPAIGN_INVASION_FROM_THE_UNKNOWN

#define CAMPAIGN_INTRO_CONTENT_WARNING
    _ "Although not strictly required, players are advised to become familiar with the stories, characters, and historical events presented in Under the Burning Suns, and (optionally) Descent into Darkness before playing this campaign." #enddef

#else

#define CAMPAIGN_INTRO_CONTENT_WARNING
    _ "Although not strictly required, players are advised to become familiar with the stories, characters, and historical events presented in Under the Burning Suns, Invasion from the Unknown, and (optionally) Descent into Darkness before playing this campaign." #enddef

#endif

#define CAMPAIGN_INTRO_OPTIONS_WARNING
    _ "Certain sequences make use of floating labels, halos, and standing unit animations, so you might want to make sure these options are enabled under Preferences → Display." #enddef

# wmllint: markcheck off

#define STORYTXT_TITLE_CARD _ID _MAIN_TITLE _ALTERNATE_TITLE
    title=""+{_MAIN_TITLE}+" ("+{_ALTERNATE_TITLE}+")
"+{_ID}+""
#enddef

#define STORYTXT_TITLE_CARD_SIMPLE _ID _MAIN_TITLE
    title=""+{_MAIN_TITLE}+"
"+{_ID}+""
#enddef

# wmllint: markcheck on

# wmlindent: stop ignoring


#textdomain wesnoth-Naia

# "Armored" trait for vehicles and shaxthals
#define TRAIT_ARMORED
    [trait]
        id=armored
        male_name= _ "armored"
        female_name= _ "female^armored"
        description= _ "+15% bonus for all resistances (except arcane), -1 movement points"
        [effect]
            apply_to=resistance
            replace=no
            [resistance]
                blade=-15
                pierce=-15
                impact=-15
                fire=-15
                cold=-15
            [/resistance]
        [/effect]
        [effect]
            apply_to=movement
            increase=-1
        [/effect]
    [/trait]
#enddef

# Units with trait Biomechanical cannot be drained, poisoned or plagued.
#define TRAIT_BIOMECHANICAL
    [trait]
        id=biomechanical
        availability="musthave"
        male_name= _ "biomechanical"
        female_name= _ "female^biomechanical"
        description= _ "Immune to drain, poison and plague"
        [effect]
            apply_to=status
            add=not_living
        [/effect]
    [/trait]
#enddef

# Units with trait Spirit cannot be drained, poisoned or plagued.
#define TRAIT_SPIRIT
    [trait]
        id=spirit
        availability="musthave"
        male_name= _ "spirit"
        female_name= _ "female^spirit"
        description= _ "Immune to drain, poison, and plague"
        [effect]
            apply_to=status
            add=not_living
        [/effect]
    [/trait]
#enddef

#define TRAIT_DETERIORATED
    [trait]
        id=deteriorated
        male_name= _ "deteriorated"
        female_name= _ "female^deteriorated"
        description= _ "This undead unit has become weaker with the pass of time."
        [effect]
            apply_to="hitpoints"
            increase_total="-5%"
        [/effect]
        # Not so easy first AMLA.
        [effect]
            apply_to="max_experience"
            increase="50"
        [/effect]
    [/trait]
#enddef

# Used in IftU S23B
#define TRAIT_DETERIORATED_IFTU
    [trait]
        id=deteriorated
        male_name= _ "deteriorated"
        female_name= _ "female^deteriorated"
        description= _ "This undead unit has become weaker with the pass of time."
        [effect]
            apply_to="hitpoints"
            increase_total="-10%"
        [/effect]
    [/trait]
#enddef


#textdomain wesnoth-Naia

# Used to negate {IS_HERO}.
#define NO_OVERLAYS_NO_ELLIPSE
    overlays=""
    ellipse="" # wmllint: no ellipsecheck
#enddef

#define NO_UPKEEP_NO_OVERLAY
    [+unit]
        # dammit, esr
        upkeep=loyal
    [/unit]
#enddef

#define PETRIFIED
    [+unit]
        [status]
            petrified=yes
        [/status]
    [/unit]
#enddef

#define GENDER _GENDER
    [+unit]
        gender={_GENDER}
    [/unit]
#enddef

#define PLACEMENT _PLACEMENT
    [+unit]
        placement={_PLACEMENT}
    [/unit]
#enddef

#define PASSABLE
    [+unit]
        passable=yes
    [/unit]
#enddef

#define OVERWRITE
    [+unit]
        overwrite=yes
    [/unit]
#enddef

#define PALETTE _SRC _DEST
    [+unit]
        [+modifications]
            [object]
                [effect]
                    apply_to="image_mod"
                    add="PAL("+{_SRC}+">"+{_DEST}+")"
                [/effect]
            [/object]
        [/modifications]
    [/unit]
#enddef

#define DOOR_TILES_TO_UNITS _DOOR_OWNER_SIDE
    [setup_doors]
        side={_DOOR_OWNER_SIDE}
    [/setup_doors]
#enddef

#define FACE_DIRECTION _SUF _DIRECTION
    [set_facing]
        [filter]
            {_SUF}
        [/filter]
        facing={_DIRECTION}
    [/set_facing]
#enddef

#define FACE_LOCATION _SUF _TARGET_SLF
    [set_facing]
        [filter]
            {_SUF}
        [/filter]
        [filter_location]
            {_TARGET_SLF}
        [/filter_location]
    [/set_facing]
#enddef

#define FACE_UNIT _SUF _TARGET_SUF
    [set_facing]
        [filter]
            {_SUF}
        [/filter]
        [filter_second]
            {_TARGET_SUF}
        [/filter_second]
    [/set_facing]
#enddef

#define OPPOSITE_FACING
    [+set_facing]
        opposite=yes
    [/set_facing]
#enddef

#define FAKE_RECRUIT _SIDE _TYPE _X _Y
    [unit]
        side={_SIDE}
        type={_TYPE}
        x={_X}
        y={_Y}
        random_gender=yes
        random_traits=yes
        generate_name=yes
        moves=0
        attacks_left=0
        animate=yes
    [/unit]
#enddef

# Makes a unit loyal without displaying it as a trait, since it's a waste of
# real estate for hero units who are known to be close friends to the
# protagonists and therefore don't need to be explicitly displayed as loyal.
#define MOD_LOYAL_HERO
    [object]
        [effect]
            apply_to=loyal
        [/effect]
    [/object]
#enddef

# Adds a special ellipse to units intended for easily marking units. This is
# not intended to be used in production and is here solely for debug purposes.
#define MOD_DEBUG_ELLIPSE
    [object]
        [effect]
            apply_to=ellipse
            ellipse="misc/ellipse-debug"
        [/effect]
    [/object]
#enddef

#define UNIT_PALETTE_SWITCH _SUF _FROM _TO
    [object]
        silent=yes
        [filter]
            {_SUF}
        [/filter]
        [effect]
            apply_to=image_mod
            add="PAL("+{_FROM}+">"+{_TO}+")"
        [/effect]
    [/object]
#enddef

#define MOBILIZE_GUARDIANS _SUF
    [store_unit]
        [filter]
            {_SUF}
        [/filter]
        variable=temp_MG_store
    [/store_unit]

    [foreach]
        array=temp_MG_store
        variable=u

        [do]
            {CLEAR_VARIABLE u.status.guardian,u.ai_special}

            [unstore_unit]
                variable="u"
                find_vacant=no
            [/unstore_unit]
        [/do]
    [/foreach]

    {CLEAR_VARIABLE temp_MG_store}
#enddef

#define NO_EXPERIENCE_UNIT
    # The XP bar won't appear without any advancements.
    # experience=25
    # {AMLA_DEFAULT}
    # advances_to=null
    experience=1000
#enddef

# For use with MOVE_UNIT
#define IGNORE_MOVEMENT_COSTS
    [+move_unit]
        check_passability=no
    [/move_unit]
#enddef

# Resets one or more on-map units to their default statuses (including
# maximum HP, MP, and attacks.
#define RESET_UNIT_STATUSES _SUF
    [store_unit]
        [filter]
            {_SUF}
        [/filter]
        variable=temp_RUS_store
    [/store_unit]

    [foreach]
        array=temp_RUS_store
        variable=u

        [do]
            {CLEAR_VARIABLE u.status.uncovered}
            {CLEAR_VARIABLE u.status.poisoned}
            {CLEAR_VARIABLE u.status.slowed}
            {CLEAR_VARIABLE u.status.petrified}

            [set_variables]
                name=u
                mode=merge
                [value]
                    hitpoints=$u.max_hitpoints
                    moves=$u.max_moves
                    attacks_left=$u.max_attacks
                [/value]
            [/set_variables]

            [unstore_unit]
                variable=u
                find_vacant=no
            [/unstore_unit]
        [/do]
    [/foreach]

    {CLEAR_VARIABLE temp_RUS_store}
#enddef

#define RESET_AND_SEND_TO_RECALL_LIST _SUF
    [put_to_recall_list]
        {_SUF}
        heal=yes
    [/put_to_recall_list]
#enddef

#define ATTACH_EVENTS_TO_UNIT _SUF _EVENTS
    [store_unit]
        [filter]
            {_SUF}
        [/filter]
        variable=temp_AETU_store
    [/store_unit]

    [set_variables]
        name=temp_AETU_store_events
        [literal]
            {_EVENTS}
        [/literal]
    [/set_variables]

    [set_variables]
        name=temp_AETU_store.event
        mode=append
        to_variable=temp_AETU_store_events.event
    [/set_variables]

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

    {CLEAR_VARIABLE temp_AETU_store,temp_AETU_store_events}
#enddef

#
# Abort an attack sequence by temporarily removing the second unit from the
# map. This is meant to be used in an 'attack' event handler.
#
#define ABORT_ATTACK
    [set_variables]
        name=temp_ABORT_ATTACK_unit
        mode=replace
        to_variable=second_unit
    [/set_variables]

    [kill]
        x,y=$x2,$y2
    [/kill]

    [event]
        name=attack end

        {VARIABLE_INC unit.attacks_left}

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

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

        {CLEAR_VARIABLE temp_ABORT_ATTACK_unit}
    [/event]
#enddef


#textdomain wesnoth-Naia

#define BLACK_SCREEN
    [color_adjust]
        red,green,blue=-500,-500,-500
    [/color_adjust]
#enddef

#define WHITE_SCREEN
    [color_adjust]
        red,green,blue=500,500,500
    [/color_adjust]
#enddef

#define RED_SCREEN
    [color_adjust]
        red,green,blue=500,-500,-500
    [/color_adjust]
#enddef

#define RESET_SCREEN
    [reset_screen][/reset_screen]
#enddef

#define HIGHLIGHT_GOAL _SLF
    [highlight_goal]
        {_SLF}
    [/highlight_goal]
#enddef

#define UNIT_SPELL_POPUP _SUF _TEXT
    [floating_text]
        [filter]
            {_SUF}
        [/filter]
        text=""+{_TEXT}+"" # wmllint: ignore
    [/floating_text]
#enddef


#textdomain wesnoth-Naia

#
# SUF matching units that can cleanse the necrosis effect. This is a
# hand-tailored list including abilities known to fit the bill in
# Naia/IftU/AtS.
#
# (No, we can't use 'ability_type=heals' because not all healing abilities
# in mainline or UMC remove poison.)
#
#define NECROSIS:CLEANSER_SUF
    ability=curing,sylvan_essence_healing_and_curing,sylvan_essence_healing
#enddef

#define NECROSIS:TICK_DAMAGE_AMOUNT
    10 #enddef

#define NECROSIS:STATUS_EFFECT_OBJECT_ID
    necrosis_effects #enddef

#define NECROSIS:CLEANSE_UNIT_BY_ID _ID _DISPLAY_LABEL
    {VARIABLE necrosis_clear_id      {_ID}}
    {VARIABLE necrosis_display_label {_DISPLAY_LABEL}}

    [fire_event]
        name=necrosis cleanse single unit
    [/fire_event]

    {CLEAR_VARIABLE necrosis_clear_id,necrosis_display_label}
#enddef

#define WEAPON_SPECIAL_NECROSIS_EVENTS
    [event]
        id="necrosis:attacker_hits"
        name=attacker hits
        first_time_only=no
        [filter_attack]
            special=necrosis
        [/filter_attack]

        {EVENT_FORWARD_DISPATCH "necrosis proc"}
    [/event]

    [event]
        id="necrosis:defender_hits"
        name=defender hits
        first_time_only=no
        [filter_second_attack]
            special=necrosis
        [/filter_second_attack]

        {EVENT_INVERSE_DISPATCH "necrosis proc"}
    [/event]

    [event]
        id="necrosis:main"
        name=necrosis proc
        first_time_only=no
        [filter_second]
            [not]
                status=unpoisonable,not_living,necrosed
            [/not]
        [/filter_second]

        {VARIABLE second_unit.status.necrosed         yes}
        {VARIABLE second_unit.variables.necrosis_side $unit.side}

        [unstore_unit]
            find_vacant=no
            variable=second_unit
            female_text= _ "female^necrosed"
            male_text= _ "necrosed"
            red,green,blue=64,32,128
        [/unstore_unit]

        [object]
            id={NECROSIS:STATUS_EFFECT_OBJECT_ID}
            take_only_once=no
            silent=yes
            duration=scenario

            [filter]
                x,y=$x2,$y2
            [/filter]

            [effect]
                apply_to=image_mod
                add="BLEND(64,32,128,0.4)"
            [/effect]
        [/object]

        [sound]
            name="poison.ogg"
        [/sound]
    [/event]

    #
    # Function event for implementing the removal of necrosis effects.
    #
    # Parameters in the global variable table:
    #  - necrosis_clear_id <str>
    #    Id of the unit that needs to be cleansed.
    #  - necrosis_display_label <bool>
    #    Display floating label indicating the status change.
    #
    [event]
        id="necrosis:func:cleanse_single_unit"
        name=necrosis cleanse single unit
        first_time_only=no

        [store_unit]
            [filter]
                id=$necrosis_clear_id
            [/filter]
            variable=necrosis_cleansee
            kill=no
        [/store_unit]

        {CLEAR_VARIABLE necrosis_cleansee.status.necrosed,necrosis_cleansee.variables.necrosis_side}

        [for]
            array=necrosis_cleansee.modifications.object
            reverse=yes
            [do]
                [if]
                    {VARIABLE_LEXICAL_EQUALS necrosis_cleansee.modifications.object[$i].id {NECROSIS:STATUS_EFFECT_OBJECT_ID}}
                    [then]
                        {CLEAR_VARIABLE necrosis_cleansee.modifications.object[$i]}
                    [/then]
                [/if]
            [/do]
        [/for]

        [if]
            {VARIABLE_BOOLEAN_EQUALS necrosis_display_label true}
            [then]
                [unstore_unit]
                    variable=necrosis_cleansee
                    find_vacant=no
                    female_text= _ "female^cleansed"
                    male_text= _ "cleansed"
                    red,green,blue=0,255,0
                [/unstore_unit]
            [/then]
            [else]
                [unstore_unit]
                    variable=necrosis_cleansee
                    find_vacant=no
                [/unstore_unit]
            [/else]
        [/if]

        {CLEAR_VARIABLE necrosis_cleansee}
    [/event]

    #
    # Main damage per turn tick event.
    #
    [event]
        id="necrosis:tick"
        name=turn refresh
        first_time_only=no

        [store_unit]
            [filter]
                side=$side_number
                status=necrosed
                [not]
                    x,y=recall,recall
                [/not]
            [/filter]
            variable=necrosed_units
            kill=no
        [/store_unit]

        [foreach]
            array=necrosed_units
            [do]
                [if]
                    [have_unit]
                        x,y=$this_item.x,$this_item.y
                        [and]
                            # Next to a unit that can remove poison
                            [filter_adjacent]
                                {NECROSIS:CLEANSER_SUF}
                                is_enemy=no
                            [/filter_adjacent]
                            # Or stationed on a village or oasis
                            [or]
                                [filter_location]
                                    formula="(healing > 0)"
                                [/filter_location]
                            [/or]
                        [/and]
                    [/have_unit]
                    [then]
                        {NECROSIS:CLEANSE_UNIT_BY_ID $this_item.id yes}
                    [/then]
                    [else]
                        [harm_unit]
                            [filter]
                                x,y=$this_item.x,$this_item.y
                            [/filter]

                            amount={NECROSIS:TICK_DAMAGE_AMOUNT}
                            animate=yes
                            kill=yes
                            fire_event=yes
                        [/harm_unit]
                    [/else]
                [/if]
            [/do]
        [/foreach]

        {CLEAR_VARIABLE necrosed_units}
    [/event]

    #
    # Necrosis death handler.
    #
    [event]
        id="necrosis:death"
        name=die
        first_time_only=no
        [filter]
            status=necrosed
        [/filter]

        # NOTE: The resulting undead unit isn't loyal. This is intentional.

        [unit]
            type=Ghoul
            side=$unit.variables.necrosis_side
            name=$unit.name
            x,y=$x1,$y1
            overwrite=yes
            random_gender=yes # futureproofing x3
            random_traits=yes
            generate_name=yes
        [/unit]
    [/event]

    #
    # Cleanses all units on victory (SP).
    #
    [event]
        id="necrosis:scenario_cleanup"
        name=victory

        [store_unit]
            [filter]
                status=necrosed
            [/filter]
            variable=necrosed_units
            kill=no
        [/store_unit]

        [foreach]
            array=necrosed_units
            [do]
                {NECROSIS:CLEANSE_UNIT_BY_ID $this_item.id no}
            [/do]
        [/foreach]

        {CLEAR_VARIABLE necrosed_units}
    [/event]
#enddef

#define WEAPON_SPECIAL_MARK_CLEAR_STATUS _EXTRA_SUF
    [store_unit]
        [filter]
            status=marked
            {_EXTRA_SUF}
        [/filter]
        kill=no
        variable=temp_SP_MARK_cleanup
    [/store_unit]

    [foreach]
        array=temp_SP_MARK_cleanup
        [do]
            {CLEAR_VARIABLE this_item.status.marked}

            [unstore_unit]
                find_vacant=no
                variable=this_item
            [/unstore_unit]
        [/do]
    [/foreach]

    {CLEAR_VARIABLE temp_SP_MARK_cleanup}
#enddef

#define WEAPON_SPECIAL_MARK_EVENTS
    [event]
        id=sp_mark:attacker_hits
        name=attacker hits
        first_time_only=no
        [filter_attack]
            special_id=mark
        [/filter_attack]
        [filter_second]
            [not]
                status=marked
            [/not]
        [/filter_second]

        {VARIABLE second_unit.status.marked yes}

        [unstore_unit]
            find_vacant=no
            variable=second_unit
            female_text = _ "female^marked"
            male_text= _ "marked"
            red,green,blue=128,196,196
        [/unstore_unit]

        [sp_mark_calculate_bonus]
            variable=temp_SP_MARK_res
        [/sp_mark_calculate_bonus]

        [object]
            silent=yes
            duration=turn end
            [filter]
                x,y=$x2,$y2
            [/filter]
            [effect]
                apply_to=image_mod
                add="CS(0,50,50)"
            [/effect]
            [effect]
                apply_to=resistance
                [insert_tag]
                    name=resistance
                    variable=temp_SP_MARK_res
                [/insert_tag]
            [/effect]
        [/object]

        {CLEAR_VARIABLE temp_SP_MARK_res}

        [event]
            id="sp_mark:side$second_unit.side|_cleanup"
            name="side $second_unit.side turn end"
            delayed_variable_substitution=no

            {WEAPON_SPECIAL_MARK_CLEAR_STATUS side=$second_unit.side}

            [remove_event]
                id="sp_mark:side$second_unit.side|_cleanup"
            [/remove_event]
        [/event]
    [/event]

    [event]
        id=sp_mark:scenario_cleanup
        name=victory

        {WEAPON_SPECIAL_MARK_CLEAR_STATUS ()}
    [/event]
#enddef


#textdomain wesnoth-Naia

# wmllint: unbalanced-on
# wmlindent: start ignoring

#
# Used as a convenience wrapper to include weapon special implementation
# details in unit type definitions without copy-pasting the close-reopen tag
# boilerplate. This requires that the macro actually holding the event WML for
# the weapon special is named WEAPON_SPECIAL_<suffix>_EVENTS:
#
#   [dummy]
#      id=one_punch
#   [/dummy]
#
#   {WEAPON_SPECIAL_EVENTS ONE_PUNCH} # includes WEAPON_SPECIAL_ONE_PUNCH_EVENTS
#
#define WEAPON_SPECIAL_EVENTS _SUFFIX
    # wmlxgettext: [attack]
    # wmlxgettext: [specials]
        [/specials]
    [/attack]
        {WEAPON_SPECIAL_{_SUFFIX}_EVENTS}
    [+attack]
        [+specials]
    # wmlxgettext: [/specials]
    # wmlxgettext: [/attack]
#enddef

# wmlindent: stop ignoring

# Following two specials close the [specials] tag and open it later to
# insert a weapon _weight value, eliminating the need to specify it manually
# within the unit's WML file. Therefore, they are intentionally unbalanced WML

#define WEAPON_SPECIAL_ATTACK_ONLY
    [damage]
        id=attack_only
        name= _ "attack only"
        name_inactive= _ "attack only"
        description= _ "This weapon will never be used on defense."
        special_note={SPECIAL_NOTE_ATTACK_ONLY}
        multiply=0
        active_on=defense
    [/damage]
# wmlindent: start ignoring
# wmlxgettext: [specials]
    [/specials]
    defense_weight=0
    [+specials]
# wmlxgettext: [/specials]
# wmlindent: stop ignoring
#enddef

#define WEAPON_SPECIAL_DEFEND_ONLY
    [damage]
        id=defend_only
        name= _ "defend only"
        name_inactive= _ "defend only"
        description= _ "This weapon will only be available for defense."
        special_note={SPECIAL_NOTE_DEFEND_ONLY}
        multiply=0
        active_on=offense
    [/damage]
# wmlindent: start ignoring
# wmlxgettext: [specials]
    [/specials]
    attack_weight=0
    [+specials]
# wmlxgettext: [/specials]
# wmlindent: stop ignoring
#enddef

# wmllint: unbalanced-off

#define WEAPON_SPECIAL_ALWAYS_HITS
    [chance_to_hit]
        id=always_hits
        name= _ "always hits"
        description= _ "This attack always has a 100% chance to hit regardless of the defensive ability of the unit being attacked."
        special_note={SPECIAL_NOTE_ALWAYS_HITS}
        value=100
        cumulative=no
    [/chance_to_hit]
#enddef

#define WEAPON_SPECIAL_PRECISION
    # Canned definition of the Precision ability to be included in a
    # [specials] clause.
    [chance_to_hit]
        id=precision
        name= _ "precision"
        description= _ "When used offensively, this attack always has at least a 50% chance to hit."
        special_note={SPECIAL_NOTE_PRECISION}
        value=50
        cumulative=yes
        active_on=offense
    [/chance_to_hit]
#enddef

#define WEAPON_SPECIAL_NECROSIS
    [dummy]
        id=necrosis
        name= _ "necrosis"
        description= _ "This attack infects living targets, causing them to lose 10 HP every turn until cured in a village or by a unit able to remove poison (regenerates does not counter necrosis). Any targets who die while necrosed become Ghouls belonging to the same side as the unit which originally infected them."
        special_note={SPECIAL_NOTE_NECROSIS}
    [/dummy]

    {WEAPON_SPECIAL_EVENTS NECROSIS}
#enddef

#define WEAPON_SPECIAL_MARK
    [dummy]
        id=mark
        name= _ "mark"
        description= _ "When used offensively, this attack disrupts its opponent’s stance, decreasing all resistances by 20% (down to a minimum of -50%) until the affected unit’s turn ends."
        special_note={SPECIAL_NOTE_MARK}
        active_on=offense
    [/dummy]

    {WEAPON_SPECIAL_EVENTS MARK}
#enddef


# wmllint: no translatables

#define WALL_MOUNTED_BANNER_OVERLAY _TILE_STR _IMAGE
    [terrain_graphics]
        map="
, *
* , *
, 1
* , *
, *"
        [tile]
            pos=1
            type={_TILE_STR}
        [/tile]
        probability=100
        [image]
            layer=0
            name={_IMAGE}
            base=90,144
            center=82,138
        [/image]
    [/terrain_graphics]
#enddef

#define WALL_FLAGS_NW_N
"wall-s,wall-se" #enddef

#define WALL_FLAGS_N_NE
"wall-s,wall-sw" #enddef

# From IMAGE_NW_N
#define WALL_OVERLAY_IMAGE_SE _BUILDER _IMAGESTEM
    [image]
        name={BUILD_IMAGE {_BUILDER} {_IMAGESTEM} -se}
        base=81,144
        center=90,130
    [/image]
#enddef

# From IMAGE_N_NE
#define WALL_OVERLAY_IMAGE_SW _BUILDER _IMAGESTEM
    [image]
        name={BUILD_IMAGE {_BUILDER} {_IMAGESTEM} -sw}
        base=99,144
        center=90,134
    [/image]
#enddef

#define WALL_OVERLAY_SE _TERRAINLIST _ADJACENT _IMAGESTEM
    [terrain_graphics]
        map="
,  *
2,   *
,  1
*,   *
,  *"
        [tile]
            pos=1
            type={_ADJACENT}
        [/tile]
        [tile]
            pos=2
            type={_TERRAINLIST}
            set_no_flag=wall-moss-se
        [/tile]
        {WALL_OVERLAY_IMAGE_SE IMAGE_SINGLE {_IMAGESTEM}}
    [/terrain_graphics]
#enddef

#define WALL_OVERLAY_SW _TERRAINLIST _ADJACENT _IMAGESTEM
    [terrain_graphics]
        map="
,  *
*,   2
,  1
*,   *
,  *"
        [tile]
            pos=1
            type={_ADJACENT}
        [/tile]
        [tile]
            pos=2
            type={_TERRAINLIST}
            set_no_flag=wall-moss-sw
        [/tile]
        {WALL_OVERLAY_IMAGE_SW IMAGE_SINGLE {_IMAGESTEM}}
    [/terrain_graphics]
#enddef

#define TERRAIN_P _P
    [+terrain_graphics]
        probability={_P}
    [/terrain_graphics]
#enddef


# wmllint: no translatables

#define GATE_FRAGMENT_OVERLAY TERRAIN LAYER FLAG IMAGESTEM X_SHIFT
    [terrain_graphics]
        map="
, *
* , *
, 1
* , *
, *"

        [tile]
            pos=1
            type={TERRAIN}
            set_no_flag={FLAG}
        [/tile]

        probability=100
        [image]
            # HACK: because I don't want to do the maths
            name="../misc/blank-hex.png~BLIT(terrain/"+{IMAGESTEM}+".png~CROP("+{X_SHIFT}+",0,36,72),"+{X_SHIFT}+",0)"
            variations=";2;3;4;5;6;7;8;9;10;11"
            layer={LAYER}
            base=90,144
            center=90,144
        [/image]
    [/terrain_graphics]
#enddef

#define GATE_OVERLAY TERRAIN WEST_LAYER EAST_LAYER IMAGESTEM
    {GATE_FRAGMENT_OVERLAY ({TERRAIN}) ({WEST_LAYER}) gate-west {IMAGESTEM} 0 }
    {GATE_FRAGMENT_OVERLAY ({TERRAIN}) ({EAST_LAYER})  gate-east {IMAGESTEM} 36}
#enddef


# wmllint: no translatables

#define RAIN_ON_TOD _TOD_LIST
#arg FRAME_TIME
80#endarg
#arg RAINDROPS_FRAME_TIME
300#endarg

    #
    # Main overlay
    #
    [terrain_graphics]
        map="
1
1"

        set_flag=rain
        no_flag=rain

        [tile]
            pos=1
        [/tile]

        [image]
            layer=1
            name=weather/none.png
            [variant]
                tod={_TOD_LIST}
                name=weather/rain-1.png:{FRAME_TIME},weather/rain-2.png:{FRAME_TIME},weather/rain-3.png:{FRAME_TIME},weather/rain-4.png:{FRAME_TIME},weather/rain-5.png:{FRAME_TIME},weather/rain-6.png:{FRAME_TIME},weather/rain-7.png:{FRAME_TIME},weather/rain-8.png:{FRAME_TIME}
                random_start=no
            [/variant]
        [/image]
    [/terrain_graphics]

    #
    # Raindrops on water terrains
    #
    [terrain_graphics]
        [tile]
            x=1
            y=1
            type=W*,S*,Cm*,Km*

            [image]
                layer=-1
                name=weather/none.png
                [variant]
                    tod={_TOD_LIST}
                    name=weather/raindrops-3.png:{RAINDROPS_FRAME_TIME},weather/raindrops-4.png:{RAINDROPS_FRAME_TIME},weather/raindrops-1.png:{RAINDROPS_FRAME_TIME},weather/raindrops-2.png:{RAINDROPS_FRAME_TIME}
                    random_start=yes
                [/variant]
            [/image]
        [/tile]
    [/terrain_graphics]
#enddef

#define SNOW_ON_TOD _TOD_LIST
#arg FRAME_TIME
800#endarg
    # was 500

    [terrain_graphics]
        map="
1

*"
        no_flag=snow
        set_flag=snow

        [tile]
            pos=1
        [/tile]

        [image]
            layer=1
            name=weather/none.png
            [variant]
                tod={_TOD_LIST}
                name=weather/snow-1.png:{FRAME_TIME},weather/snow-2.png:{FRAME_TIME},weather/snow-3.png:{FRAME_TIME},weather/snow-4.png:{FRAME_TIME},weather/snow-5.png:{FRAME_TIME},weather/snow-6.png:{FRAME_TIME}
                random_start=no
            [/variant]
        [/image]
    [/terrain_graphics]
#enddef


# wmllint: no translatables

# Wasteland terrain graphics - below everything
{TERRAIN_BASE                      Uzw               wasteland            } # AtS, IftU terrain codes

{TRANSITION_COMPLETE_L   Gs        Uzw  -260         grass/semi-dry-medium}
{TRANSITION_COMPLETE_L   Gg        Uzw  -261         grass/green-medium   }
{TRANSITION_COMPLETE_L   Gd        Uzw  -262         grass/dry-medium     }
{TRANSITION_COMPLETE_LF  Ai,W*,S*  Uzw  -223 inside  cave/floor           }

# Dark hive floor terrain graphics
{TERRAIN_BASE_P           Yhr            8     dark-hive/floor3                }
{TERRAIN_BASE_P           Yhr           25     dark-hive/floor2                }
{TERRAIN_BASE             Yhr                  dark-hive/floor                 }
{TERRAIN_BASE_P           Yhl            8     dark-hive/lair3                 }
{TERRAIN_BASE_P           Yhl           25     dark-hive/lair2                 }
{TERRAIN_BASE             Yhl                  dark-hive/lair                  }
{TERRAIN_BASE_P           Yhs            8     dark-hive/surface3              }
{TERRAIN_BASE_P           Yhs           25     dark-hive/surface2              }
{TERRAIN_BASE             Yhs                  dark-hive/surface               }

# Dark hive floor's pits
{OVERLAY_PL               *^Xp     10    -1    dark-hive/pit-2                 }
{OVERLAY_PL               *^Xp     11    -1    dark-hive/pit-3                 }
{OVERLAY_PL               *^Xp     13    -1    dark-hive/pit-4                 }
{OVERLAY_PL               *^Xp     14    -1    dark-hive/pit-5                 }
{OVERLAY_PL               *^Xp     17    -1    dark-hive/pit-6                 }
{OVERLAY_PL               *^Xp     20    -1    dark-hive/pit-7                 }
{OVERLAY_PL               *^Xp     25    -1    dark-hive/pit-8                 }
{OVERLAY_L                *^Xp           -1    dark-hive/pit-1                 }

# Dark hive moss
{WALL_OVERLAY_SE          *^Xzm/ (!,Xo*)        walls/moss3} {TERRAIN_P 33}
{WALL_OVERLAY_SE          *^Xzm/ (!,Xo*)        walls/moss2} {TERRAIN_P 50}
{WALL_OVERLAY_SE          *^Xzm/ (!,Xo*)        walls/moss}

{WALL_OVERLAY_SW          *^Xzm\ (!,Xo*)        walls/moss3} {TERRAIN_P 33}
{WALL_OVERLAY_SW          *^Xzm\ (!,Xo*)        walls/moss2} {TERRAIN_P 50}
{WALL_OVERLAY_SW          *^Xzm\ (!,Xo*)        walls/moss}

# Statues
{OVERLAY                  *^Eza                ../scenery/statue-adavyan       }

# Big ass trees
{OVERLAY                  *^Fezo               oak-tree-dead                   }
{OVERLAY                  *^Feza               great-tree-snow                 }

# Gate terrain graphics
{GATE_OVERLAY *^Z/  () 1 dark-gate-se}
{GATE_OVERLAY *^Z\  1 () dark-gate-sw}

#define EVENT_GATE_IPF
"~CS(38,14,-34)" #enddef

{GATES_VERTICAL_NS_L 		(*^Zz|)		(X*)	0 	{EVENT_GATE_IPF} 	portals/gate-rusty}
{GATES_DIAGONAL_SW_L 		(*^Zz\)		(X*)	0 	{EVENT_GATE_IPF} 	portals/gate-rusty}
{GATES_DIAGONAL_SE_L 		(*^Zz/)		(X*)	0 	{EVENT_GATE_IPF} 	portals/gate-rusty}

{GATES_VERTICAL_NS_L 		(*^Zz|o)	(X*)	0 	{EVENT_GATE_IPF} 	portals/gate-rusty-open}
{GATES_DIAGONAL_SW_L 		(*^Zz\o)	(X*)	0 	{EVENT_GATE_IPF} 	portals/gate-rusty-open}
{GATES_DIAGONAL_SE_L 		(*^Zz/o)	(X*)	0 	{EVENT_GATE_IPF} 	portals/gate-rusty-open}

#undef EVENT_GATE_IPF

# Banners

{WALL_MOUNTED_BANNER_OVERLAY *^Ebur ../scenery/banner-uria-wall.png       }
{WALL_MOUNTED_BANNER_OVERLAY *^Ebme ../scenery/banner-yechnagoth-wall.png }

{DISABLE_BASE_TRANSITIONS Qxv}

# Dark hive transitions
{NEW:BEACH                  (Yhr,Yhl,Yhs)               W*         flat/shore}

# Don't replace transitions from specific "dominant" terrains such as rockbound
# cave, sand, road, mountains, hills, etc.
#
# NOTE: (Naia #11, IftU #73, AtS #83)
#
# The deprecated Mushroom Grove gains compulsory Mycelium base graphics in
# 1.16 with weird layering in order to enforce the Mycelium + Mushroom Grove
# combination on almost all base terrains for no discernible reason. Wesnoth
# devs, everyone!

# This makes it first so no transitions are drawn into Mycelium/Deprecated
# Mushroom Grove.
{TRANSITION_RESTRICTED_L        Yhr (!,Yhr,Uh*,H*,M*,Q*,Xo*,Urb,Rr,Rp,Ds,T*,*^Uf*) -499 (dark-hive/floor)  }
{TRANSITION_RESTRICTED_L        Yhl (!,Yhl,Uh*,H*,M*,Q*,Xo*,Urb,Rr,Rp,Ds,T*,*^Uf*) -499 (dark-hive/lair)   }
{TRANSITION_RESTRICTED_L        Yhs (!,Yhs,Uh*,H*,M*,Q*,Xo*,Urb,Rr,Rp,Ds,T*,*^Uf*) -499 (dark-hive/surface)}
# Now we make a special case for Mycelium/Deprecated Mushroom Grove (which is
# drawn at layer -319 as of 1.15.4) and force our transitions over it.
{TRANSITION_RESTRICTED_L        Yhr (T*,*^Uf*)                                     -318 (dark-hive/floor)  }
{TRANSITION_RESTRICTED_L        Yhl (T*,*^Uf*)                                     -318 (dark-hive/lair)   }
{TRANSITION_RESTRICTED_L        Yhs (T*,*^Uf*)                                     -318 (dark-hive/surface)}
# Note that we don't need to interfere with the new Mushroom Grove overlays
# (^T*) because they don't force base graphics and transitions down our
# throats.

# HACK: Wesnoth 1.6 RC 1. Define a custom Re transition, as
# the default mainline one is drawn below Yhs and looks awful.
{TRANSITION_RESTRICTED_LF       Yhr (Re,Rb,Rd) -331    transition3           (dark-hive/floor)  }
{TRANSITION_RESTRICTED_LF       Yhl (Re,Rb,Rd) -332    transition3           (dark-hive/lair)   }
{TRANSITION_RESTRICTED_LF       Yhs (Re,Rb,Rd) -333    transition3           (dark-hive/surface)}

# Volcanic abyss terrain graphics
{TERRAIN_BASE             Qxv                  volcanic-abyss                        }
{WALL_TRANSITION_LF       Qxv     (!,Qxv)    -90        ground       unwalkable/chasm}

# Earthy rockbound cave
{TRANSITION_COMPLETE_L     Uhe              (!,Uhe,W*,Ai)            -200      cave/earthy-hills}

# Fake shroud
{OVERLAY_L                *^Zok           1         void/void }
{TRANSITION_RESTRICTED_LF *^Zok (!,*^Zok) 1 overlay void/void }

#ifdef EDITOR

{EDITOR_OVERLAY *^Gov tile-icons/overlay-flat}
{EDITOR_OVERLAY *^Uov tile-icons/overlay-rough}

{EDITOR_OVERLAY *^Zok tile-icons/fake-shroud}

#endif


#textdomain wesnoth-Naia

{./elves-wood/}


#textdomain wesnoth-Naia

[race]
    id=faerie
    female_name= _ "race^Faerie"
    male_name= _ "race+male^Faerie"
    plural_name= _ "race^Faeries"
    description= _ "Forests, caverns, mountains, and large bodies of water are propitious places to find many kinds of rare and mysterious creatures. Such environments are thus preferred by the remnants of the peoples said to antedate civilized life on Irdya, such as woses and merfolk, and the varied group of beings more commonly known as the true faeries."
    num_traits=2
    ignore_global_traits=yes
    {TRAIT_QUICK}
    {TRAIT_INTELLIGENT}
    {TRAIT_RESILIENT}
    markov_chain_size=3
    {ELVISH_NAMES}
    undead_variation=null
[/race]

[movetype]
    name=elynia_lowfloat
    flies=true
    [movement_costs]
        deep_water=4
        shallow_water=2
        reef=2
        swamp_water=2
        flat=1
        sand=1
        forest=1
        hills=1
        mountains=2
        village=1
        castle=1
        cave=1
        frozen=1
        unwalkable={UNREACHABLE}
        impassable={UNREACHABLE}
        fungus=2
    [/movement_costs]

    [defense]
        deep_water=70
        shallow_water=60
        swamp_water=60
        reef=60
        flat=50
        sand=60
        forest=30
        hills=50
        mountains=40
        village=40
        castle=40
        cave=50
        frozen=60
        unwalkable=80
        impassable=70
        fungus=50
    [/defense]

    [resistance]
        blade=100
        pierce=100
        impact=100
        fire=90
        cold=100
        arcane=110
    [/resistance]
[/movetype]

[movetype]
    name=woodlandfaerie
    flying=yes
    [movement_costs]
        deep_water=2
        shallow_water=1
        reef=1
        swamp_water=1
        flat=1
        sand=1
        forest=1
        hills=1
        mountains=2
        village=1
        castle=1
        cave=1
        frozen=1
        fungus=2
    [/movement_costs]
    [defense]
        deep_water=70
        shallow_water=60
        reef=50
        swamp_water=60
        flat=50
        sand=60
        forest=40
        hills=50
        mountains=40
        village=40
        castle=40
        cave=50
        frozen=60
        fungus=50
    [/defense]
    [resistance]
        blade=100
        pierce=100
        impact=100
        fire=80
        cold=110
        arcane=110
    [/resistance]
[/movetype]

{./faeries/}


#textdomain wesnoth-Naia

[race]
    id=aragwaith
    male_name= _ "race^Aragwaith"
    female_name= _ "race+female^Aragwaith"
    plural_name= _ "race^Aragwaithi"
    editor_icon=icons/unit-groups/race_human
    num_traits=2
    markov_chain_size=3
    {HUMAN_NAMES}
    description= _ "During most of the Golden Age, the humans who inhabited the Great Continent were mostly Wesnothians, divided across various territories such as the Northlands, Elensefar and the kingdom of Wesnoth itself. However, there was once a time of great strife during which a new race of humans started to appear from nowhere. They were the ‘Aragwaithi’, which meant ‘noble’ in their native language.

It has been since then rumored that they came from the Vast Sea to settle in Wesnoth. They mostly lived as mercenaries in that time, until the Fall. After that, they supposedly moved to the northmost lands of the Continent, were the sands could not reach, and the green could survive.

Albeit being humans, many of their customs and racial features are strongly reminiscent of elves. Their sages have a mastery of magic that is not to be underestimated on the battlefield."
[/race]

[movetype]
    name=aragwaithfoot
    [movement_costs]
        deep_water={UNREACHABLE}
        shallow_water=3
        reef=2
        swamp_water=2
        flat=1
        sand=1
        forest=2
        hills=2
        mountains=2
        village=1
        castle=1
        cave=2
        frozen=2
        unwalkable={UNREACHABLE}
        impassable={UNREACHABLE}
        fungus=2
    [/movement_costs]
    [defense]
        deep_water=80
        shallow_water=80
        reef=70
        swamp_water=70
        flat=60
        sand=50
        forest=50
        hills=50
        mountains=40
        village=40
        castle=40
        cave=50
        frozen=60
        impassable=10
        fungus=50
    [/defense]
    [resistance]
        blade=100
        pierce=100
        impact=100
        fire=100
        cold=100
        arcane=80
    [/resistance]
[/movetype]

[movetype]
    name=aragwaithmounted
    [movement_costs]
        deep_water={UNREACHABLE}
        shallow_water=3
        reef=2
        swamp_water=2
        flat=1
        sand=1
        forest=2
        hills=2
        mountains=3
        village=1
        castle=1
        cave=3
        frozen=2
        unwalkable={UNREACHABLE}
        impassable={UNREACHABLE}
        fungus=3
    [/movement_costs]
    [defense]
        deep_water=80
        shallow_water=80
        reef=70
        swamp_water=70
        flat=60
        sand=60
        forest=70
        hills=60
        mountains=60
        village=60
        castle=60
        cave=60
        frozen=60
        impassable=10
        fungus=80
    [/defense]
    [resistance]
        blade=80
        pierce=120
        impact=70
        fire=100
        cold=100
        arcane=80
    [/resistance]
[/movetype]

[movetype]
    name=armorerfoot
    [movement_costs]
        deep_water={UNREACHABLE}
        shallow_water=4
        reef=3
        swamp_water=4
        flat=1
        sand=2
        forest=2
        hills=3
        mountains={UNREACHABLE}
        village=1
        castle=1
        cave=2
        unwalkable={UNREACHABLE}
        impassable={UNREACHABLE}
        frozen=4
        fungus=2
    [/movement_costs]
    [defense]
        deep_water=90
        shallow_water=90
        reef=80
        swamp_water=90
        flat=70
        sand=80
        forest=60
        hills=60
        mountains=80
        village=60
        castle=50
        cave=60
        unwalkable=80
        impassable=80
        frozen=80
        fungus=60
    [/defense]
    [resistance]
        blade=70
        pierce=70
        impact=80
        fire=90
        cold=100
        arcane=80
    [/resistance]
[/movetype]

{./humans/}


#textdomain wesnoth-Naia

[race]
    id=imps
    male_name= _ "race^Imp"
    female_name= _ "race+female^Imp"
    plural_name= _ "race^Imps"
    description= _ "Lesser demons are frequently and incorrectly classified in a separate group of their own. Although they generally lack the magic abilities and intellectual power of their better known relatives, their numbers and raw strength usually suffice to compensate."
    {DEMON_NAMES}
    num_traits=2
    ignore_global_traits=yes
    undead_variation=null
    {TRAIT_STRONG}
    {TRAIT_QUICK}
    {TRAIT_RESILIENT}
    {TRAIT_WEAK}
    {TRAIT_SLOW}
    {TRAIT_DIM}
[/race]

[movetype]
    name=impfoot
    [movement_costs]
        deep_water={UNREACHABLE}
        shallow_water=2
        reef=2
        swamp_water=2
        flat=1
        sand=2
        forest=2
        hills=2
        mountains=3
        village=1
        castle=1
        cave=2
        unwalkable={UNREACHABLE}
        impassable={UNREACHABLE}
        frozen=3
        fungus=2
    [/movement_costs]
    [defense]
        deep_water=70
        shallow_water=70
        reef=60
        swamp_water=60
        flat=50
        sand=50
        forest=30
        hills=40
        mountains=30
        village=30
        castle=30
        cave=40
        unwalkable=50
        impassable=90
        frozen=70
        fungus=30
    [/defense]
    [resistance]
        blade=100
        pierce=100
        impact=100
        fire=100
        cold=110
        arcane=110
    [/resistance]
[/movetype]

{./imps/}


#textdomain wesnoth-Naia

{./mechanical/}


#textdomain wesnoth-Naia

[movetype]
    name=houndfoot
    [movement_costs]
        deep_water={UNREACHABLE}
        shallow_water=2
        swamp_water=2
        reef=2
        flat=1
        sand=2
        forest=2
        hills=2
        mountains=3
        village=1
        castle=1
        cave=3
        unwalkable={UNREACHABLE}
        impassable={UNREACHABLE}
        frozen=2
        fungus=2
    [/movement_costs]
    [defense]
        deep_water=80
        shallow_water=80
        swamp_water=70
        reef=70
        flat=70
        sand=70
        forest=50
        hills=60
        mountains=50
        village=60
        castle=50
        cave=70
        unwalkable=50
        impassable=90
        frozen=80
        fungus=50
    [/defense]
    [resistance]
        blade=100
        pierce=110
        impact=100
        fire=100
        cold=100
        arcane=110
    [/resistance]
[/movetype]

[movetype]
    name=fireafinity
    flies=true
    [movement_costs]
        deep_water=4
        shallow_water=3
        swamp_water=3
        reef=3
        flat=1
        sand=1
        forest=2
        hills=1
        mountains=1
        village=1
        castle=1
        cave=1
        unwalkable=1
        impassable={UNREACHABLE}
        frozen=4
        fungus=2
    [/movement_costs]
    [defense]
        deep_water=90
        shallow_water=80
        swamp_water=80
        reef=70
        flat=50
        sand=50
        forest=70
        hills=50
        mountains=50
        village=50
        castle=50
        cave=50
        unwalkable=30
        impassable=30
        frozen=90
        fungus=70
    [/defense]
    [resistance]
        blade=80
        pierce=80
        impact=90
        fire=40
        cold=160
        arcane=160
    [/resistance]
[/movetype]

[movetype]
    name=rockafinity
    [movement_costs]
        deep_water={UNREACHABLE}
        shallow_water=3
        swamp_water=3
        reef=3
        flat=1
        sand=2
        forest=2
        hills=2
        mountains=3
        village=1
        castle=1
        cave=1
        unwalkable={UNREACHABLE}
        impassable={UNREACHABLE}
        frozen=2
        fungus=2
    [/movement_costs]
    [defense]
        deep_water=90
        shallow_water=80
        swamp_water=80
        reef=50
        flat=40
        sand=40
        forest=60
        hills=50
        mountains=50
        village=40
        castle=40
        cave=40
        unwalkable=90
        impassable=30
        frozen=40
        fungus=60
    [/defense]
    [resistance]
        blade=80
        pierce=80
        impact=90
        fire=140
        cold=70
        arcane=160
    [/resistance]
[/movetype]

[movetype]
    name=waterdependency
    [movement_costs]
        deep_water=1
        shallow_water=1
        swamp_water=1
        reef=1
        flat={UNREACHABLE}
        sand={UNREACHABLE}
        forest={UNREACHABLE}
        hills={UNREACHABLE}
        mountains={UNREACHABLE}
        village=1
        castle=1
        cave={UNREACHABLE}
        unwalkable={UNREACHABLE}
        impassable={UNREACHABLE}
        frozen={UNREACHABLE}
        fungus={UNREACHABLE}
    [/movement_costs]
    [defense]
        deep_water=40
        shallow_water=40
        swamp_water=40
        reef=40
        flat=90
        sand=90
        forest=90
        hills=90
        mountains=90
        village=40
        castle=40
        cave=90
        unwalkable=90
        impassable=90
        frozen=90
        fungus=90
    [/defense]
    [resistance]
        blade=80
        pierce=80
        impact=80
        fire=90
        cold=70
        arcane=160
    [/resistance]
    [special_note]
        note={SPECIAL_NOTE_RESTRICTED_TO_WATER}
    [/special_note]
[/movetype]

{./monsters/}


#textdomain wesnoth-Naia

#define SHAXTHAL_RACE_DESCRIPTION
    _ "Of the many monstrosities comprising the Chaos legions, the most fearsome of them easily are these alien war-beasts known as the ‘Shaxthals’, always present among the front lines when the Overlords choose not to take any prisoners. Their unnatural strength and durable exoskeletons are completely unrivaled by any living creature native to Irdya, and their ability to decimate enemy armies and topple constructions with relative ease makes them an ideal companion for the demon hordes. Those few fools who attempt to fight them head-on almost never survive to tell the tale, as they either get their skulls shattered by a red energy blast originating from the creatures’ maws, or are ripped to shreds in an instant by their teeth and claws."
#enddef

[race]
    id=shaxthal
    male_name= _ "race^Shaxthal"
    female_name= _ "race+female^Shaxthal"
    plural_name= _ "race^Shaxthals"
#ifdef CAMPAIGN_AFTER_THE_STORM
    description= _ "Long before the arrival of humans, an advanced people called the Argazar created a new lifeform combining characteristics from all other creatures known to them. These creatures known as the ‘invincibles’ or ‘Shaxthals’ were originally meant to become the basis for their research into attaining immortality. However, the enemy nation of Rythé forced the Argazar to repurpose their creations for warfare, thus attracting the attention of a mysterious and powerful foe.

Following a devastating strike that poisoned the air and almost completely wiped out their civilization, the remnants of the Argazar found themselves forced to flee to a primitive world “beyond the veil” called Irdya. As life on the surface proved impossible, the Argazar attempted to rebuild their civilization underground. However, the few Shaxthal creatures they brought with them unexpectedly manifested minds of their own and rebelled against their creators. In the process, they began to assimilate the survivors and spawn new generations with new and more sophisticated bodies.

With barely a few dozen Argazars left, they finally found a way to thwart the Shaxthals’ reproductive capabilities, kill the majority of the creatures, and put a few specimens into hibernation for further research. As the last of their people perished, their historians’ hope was that some day a new civilization would emerge and bring the Argazar back to life using the knowledge they recorded into their many crystal glyphs.

Unbeknownst to them, the first race to discover their legacy would have no intention of using any of their findings for good."+"

"+{SHAXTHAL_RACE_DESCRIPTION}
#else
    description={SHAXTHAL_RACE_DESCRIPTION}
#endif
    undead_variation=null
    ignore_global_traits=yes
    num_traits=2
    {TRAIT_BIOMECHANICAL}
    {TRAIT_STRONG}
    {TRAIT_RESILIENT}
    {TRAIT_QUICK}
    {TRAIT_ARMORED}
    {TRAIT_INTELLIGENT}
[/race]

[movetype]
    name=biomechanical_smallfoot
    [movement_costs]
        deep_water={UNREACHABLE}
        shallow_water=3
        reef=2
        swamp_water=3
        flat=1
        sand=2
        forest=2
        hills=2
        mountains=3
        village=1
        castle=1
        cave=2
        frozen=2
        unwalkable={UNREACHABLE}
        impassable={UNREACHABLE}
        fungus=2
    [/movement_costs]
    [defense]
        deep_water=90
        shallow_water=80
        swamp_water=80
        reef=70
        flat=60
        sand=60
        forest=50
        hills=50
        mountains=40
        village=40
        castle=40
        cave=60
        frozen=70
        unwalkable=80
        impassable=60
        fungus=50
    [/defense]
    [resistance]
        blade=90
        pierce=70
        impact=100
        fire=110
        cold=90
        arcane=100
    [/resistance]
[/movetype]

[movetype]
    name=biomechanical_elusivefoot
    [movement_costs]
        deep_water=3
        shallow_water=2
        swamp_water=2
        reef=2
        flat=1
        sand=1
        forest=2
        hills=2
        mountains=3
        village=1
        castle=1
        cave=1
        frozen=2
        unwalkable={UNREACHABLE}
        impassable={UNREACHABLE}
        fungus=2
    [/movement_costs]
    [defense]
        deep_water=90
        shallow_water=70
        swamp_water=70
        reef=70
        flat=60
        sand=60
        forest=50
        hills=50
        mountains=40
        village=40
        castle=40
        cave=60
        frozen=70
        unwalkable=80
        impassable=60
        fungus=50
    [/defense]
    [resistance]
        blade=90
        pierce=70
        impact=100
        fire=110
        cold=90
        arcane=100
    [/resistance]
[/movetype]

[movetype]
    name=biomechanical_drone
    [movement_costs]
        deep_water=1
        shallow_water=1
        swamp_water=1
        reef=1
        flat=1
        sand=1
        forest=1
        hills=1
        mountains=1
        village=1
        castle=1
        cave=1
        frozen=1
        unwalkable=1
        impassable={UNREACHABLE}
        fungus=1
    [/movement_costs]
    [defense]
        deep_water=50
        shallow_water=50
        swamp_water=50
        reef=50
        flat=50
        sand=50
        forest=50
        hills=50
        mountains=50
        village=40
        castle=40
        cave=50
        frozen=50
        unwalkable=50
        impassable=80
        fungus=50
    [/defense]
    [resistance]
        blade=90
        pierce=70
        impact=100
        fire=110
        cold=90
        arcane=100
    [/resistance]
[/movetype]

#define SHAXTHAL_SET_SURFACE_VARIATIONS_FLAG
    [event]
        name=prestart
        {VARIABLE shaxthals_in_surface yes}
    [/event]

    [event]
        name=victory
        {CLEAR_VARIABLE shaxthals_in_surface}
    [/event]
#enddef

#define SHAXTHAL_ONRECRUIT_CHECK_SURFACE_FLAG _TYPE_SELF
    [event]
        name=prerecruit
        first_time_only=no
        [filter]
            type={_TYPE_SELF}
        [/filter]
        [filter_condition]
            [variable]
                name=shaxthals_in_surface
                boolean_equals=yes
            [/variable]
        [/filter_condition]

        [object]
            silent=yes
            [filter]
                x,y=$x1,$y1
            [/filter]
            [effect]
                apply_to=variation
                name=surface
            [/effect]
        [/object]
    [/event]
#enddef

#define SHAXTHAL_MAKE_SURFACE_VARIATION
    [+unit]
        variation=surface
    [/unit]
#enddef

#ifdef CAMPAIGN_AFTER_THE_STORM

#define SHAXTHAL_ATS_ADVANCEMENT _PROMOTION_TYPE _LEVELUP_XP _AMLA_XP
experience={_LEVELUP_XP}
advances_to={_PROMOTION_TYPE}
#enddef

#else

#define SHAXTHAL_ATS_ADVANCEMENT _PROMOTION_TYPE _LEVELUP_XP _AMLA_XP
experience={_AMLA_XP}
advances_to=null
{AMLA_DEFAULT}
#enddef

#endif

{./shaxthal/}


#textdomain wesnoth-Naia

{./undead/}


#textdomain wesnoth-Naia

[race]
    id=verlissh
    male_name= _ "race^Verlissh"
    female_name= _ "race+female^Verlissh"
    plural_name= _ "race^Verlisshi"
    description= _ "In order to expand its frontiers and defend its territory more effectively, the Chaos Empire has resorted to summoning all sorts of previously unseen creatures to support its vast military force. Some are said to come from the darkest depths of Irdya; others are rumored to hail from the unknown lands beyond the sky itself. Very little is known for certain about these monsters beyond their evident connection to the Lorekeepers’ arcane arts."
    undead_variation=null
    ignore_global_traits=yes
    num_traits=1
    {TRAIT_FEARLESS}
    {TRAIT_STRONG}
    {TRAIT_RESILIENT}
[/race]

[movetype]
    name=verlissh_smallfoot
    [movement_costs]
        deep_water={UNREACHABLE}
        shallow_water=3
        reef=2
        swamp_water=3
        flat=1
        sand=1
        forest=2
        hills=2
        mountains=3
        village=1
        castle=1
        cave=1
        frozen=3
        unwalkable={UNREACHABLE}
        impassable={UNREACHABLE}
        fungus=2
    [/movement_costs]

    [defense]
        deep_water=80
        shallow_water=80
        reef=70
        swamp_water=80
        flat=60
        sand=60
        forest=50
        hills=50
        mountains=40
        village=40
        castle=40
        cave=60
        frozen=80
        unwalkable=80
        impassable=60
        fungus=50
    [/defense]

    [resistance]
        blade=100
        pierce=80
        impact=90
        fire=80
        cold=90
        arcane=100
    [/resistance]
[/movetype]

#define VERLISSH_MACHINE_STANDING_ANIMATION _BASEFRAME
    [standing_anim]
        start_time=0
        auto_hflip=no
        blend_color=0,255,255
        [frame]
            duration=2500
            image={_BASEFRAME}
            blend_ratio="0.00~0.05:800,0.05~0.02:400,0.02~0.06:800,0.06~0.00"
        [/frame]
    [/standing_anim]
#enddef

#define VERLISSH_MACHINE_DEATH_ANIMATION _BASEFRAME
    [death]
        start_time=0
        auto_hflip=no
        [frame]
            duration=1
            image={_BASEFRAME}
        [/frame]
    [/death]
#enddef

#define VERLISSH_MACHINE_DEFENSE_ANIMATION _BASEFRAME
    [defend]
        start_time=-125
        sound_start_time=-26
        auto_hflip=no

        [frame]
            duration=250
            image={_BASEFRAME}
        [/frame]

        [sound_frame]
            duration=1
        [/sound_frame]

        [if]
            hits=hit
            [sound_frame]
                duration=150
                sound={SOUND_LIST:MATRIX_HIT}
            [/sound_frame]
        [/if]
        [else]
            hits=miss,kill
            [sound_frame]
                duration=150
            [/sound_frame]
        [/else]
    [/defend]
#enddef

#define VERLISSH_MACHINE_ENERGY_ANIMATION _BASEFRAME
    start_time=-100
    missile_start_time=-50
    sound_start_time=-101
    auto_hflip=no

    [missile_frame]
        duration=200
        image="projectiles/darkmissile-n.png"
        image_diagonal="projectiles/darkmissile-ne.png"
    [/missile_frame]

    [frame]
        duration=200
        image={_BASEFRAME}
    [/frame]

    [sound_frame]
        duration=1
    [/sound_frame]
    [if]
        hits=no
        [sound_frame]
            duration=200
            sound=magic-dark-miss.ogg
        [/sound_frame]
    [/if]
    [else]
        hits=yes
        [sound_frame]
            duration=200
            sound=magic-dark.ogg
        [/sound_frame]
    [/else]
#enddef

#define VERLISSH_MACHINE_GOO_ANIMATION _BASEFRAME
    start_time=-300
    sound_start_time=-301
    auto_hflip=no

    {MISSILE_FRAME_SLIME}

    [frame]
        duration=300
        image={_BASEFRAME}
    [/frame]

    [sound_frame]
        duration=1
    [/sound_frame]
    [if]
        hits=no
        [sound_frame]
            duration=200
            sound=squishy-miss.wav
        [/sound_frame]
    [/if]
    [else]
        hits=yes
        [sound_frame]
            duration=200
            sound=squishy-strike.wav
        [/sound_frame]
    [/else]

#enddef

#define VERLISSH_MACHINE_NAMES
#ifdef ENABLE_VERLISSH_MACHINE_NAMES
    [event]
        id=verlissh_machine_name_generator
        name=unit placed
        first_time_only=no
        [filter]
            type=Verlissh Matrix Flow System,Verlissh Matrix Core
        [/filter]

        [verlissh_namegen][/verlissh_namegen]
    [/event]
#endif
#enddef

{./verlissh/}


#textdomain wesnoth-Naia

{./wolves/}


#textdomain wesnoth-Naia

[unit_type]
    id=Demon
    name= _ "Demon"
    race=demon
    gender=male,female
    image="units/demons/regular.png"
    profile="portraits/demon-regular.png"
    hitpoints=32
    movement_type=demonfoot
    movement=5
    experience=38
    level=1
    alignment=chaotic
    advances_to=Demon Grunt,Demon Zephyr
    cost=15
    usage=mixed fighter
    {TRAIT_DEXTROUS}
    description= _ "Legend has it that at the beginning of time, powerful creatures called ‘demons’ governed all that existed. The Lords of Light and Darkness, seeing the danger they posed for the balance of nature, banished them to a separate plane of existence, trapped with no means of escape from inside. It would take eons before the combined effort of foolish sorcerers and the most dreadful Demon Lord to ever exist would allow Uria unleash her hordes on a ravaged land.

These fighter demons are nimble and sturdy creatures who have largely forgone the need for armor or clothing to protect themselves from physical damage. Although their sharp claws and unnatural strength allow them to tear opponents apart with ease, they usually prefer wielding crude blade weapons to appear even more intimidating in combat."
    die_sound={SOUND_LIST:HUMAN_DIE}
    {DEFENSE_ANIM "units/demons/regular.png" "units/demons/regular.png" {SOUND_LIST:HUMAN_HIT} }
    [attack]
        name=axe
        description={I18N:ATTACK_AXE}
        icon="attacks/axe-deathblade.png"
        type=blade
        range=melee
        damage=5
        number=3
    [/attack]
    [attack]
        name=fireball
        description={I18N:ATTACK_FIREBALL}
        type=fire
        range=ranged
        damage=4
        number=3
    [/attack]

    [attack_anim]
        [filter_attack]
            name=axe
        [/filter_attack]
        [if]
            hits=yes
            [frame]
                begin=-100
                end=100
                #image="units/demons/demon-attack1.png"
                image="units/demons/regular.png"
                sound=axe.ogg
            [/frame]
        [/if]
        [else]
            hits=no
            [frame]
                begin=-100
                end=100
                #image="units/demons/demon-attack1.png"
                image="units/demons/regular.png"
                sound={SOUND_LIST:MISS}
            [/frame]
        [/else]
        [frame]
            begin=100
            end=200
            #image="units/demons/demon-attack2.png"
            image="units/demons/regular.png"
        [/frame]
    [/attack_anim]
    [attack_anim]
        [filter_attack]
            name=fireball
        [/filter_attack]
        {MISSILE_FRAME_FIREBALL_XY 0 0}
        [frame]
            begin=-250
            end=-175
            #image="units/demons/demon-range1.png"
            image="units/demons/regular.png"
        [/frame]
        [frame]
            begin=-175
            end=-50
            #image="units/demons/demon-range1.png"
            image="units/demons/regular.png"
            sound=fire.wav
        [/frame]
        [frame]
            begin=-50
            end=50
            #image="units/demons/demon-range2.png"
            image="units/demons/regular.png"
        [/frame]
        [frame]
            begin=50
            end=100
            #image="units/demons/demon-range3.png"
            image="units/demons/regular.png"
        [/frame]
    [/attack_anim]

    [female]
        name= _ "female^Demoness"
        gender=female
        image="units/demons/regular+female.png"
        profile="portraits/demon-regular+female.png"
        die_sound={SOUND_LIST:HUMAN_FEMALE_DIE}
        {DEFENSE_ANIM "units/demons/regular+female.png" "units/demons/regular+female.png" {SOUND_LIST:HUMAN_FEMALE_HIT} }
        [attack_anim]
            [filter_attack]
                name=axe
            [/filter_attack]
            [if]
                [frame]
                    #image="units/demons/regular+female-attack1.png"
                    image="units/demons/regular+female.png"
                [/frame]
            [/if]
            [else]
                [frame]
                    #image="units/demons/regular+female-attack1.png"
                    image="units/demons/regular+female.png"
                [/frame]
            [/else]
            [frame]
                #image="units/demons/regular+female-attack2.png"
                image="units/demons/regular+female.png"
            [/frame]
        [/attack_anim]
        [attack_anim]
            [filter_attack]
                name=fireball
            [/filter_attack]
            [frame]
                #image="units/demons/regular+female-range1.png"
                image="units/demons/regular+female.png"
            [/frame]
            [frame]
                #image="units/demons/regular+female-range1.png"
                image="units/demons/regular+female.png"
            [/frame]
            [frame]
                #image="units/demons/regular+female-range2.png"
                image="units/demons/regular+female.png"
            [/frame]
            [frame]
                #image="units/demons/regular+female-range3.png"
                image="units/demons/regular+female.png"
            [/frame]
        [/attack_anim]
    [/female]
[/unit_type]


#textdomain wesnoth-Naia

[unit_type]
    id=Demon Grunt
    name= _ "Demon Grunt"
    race=demon
    gender=male,female
    image="units/demons/grunt.png"
    profile="portraits/demon-regular.png"
    hitpoints=43
    movement_type=demonfoot
    movement=5
    experience=90
    level=2
    alignment=neutral
    advances_to=Demon Warrior
    cost=28
    usage=mixed fighter
    [resistance]
        blade=80
        impact=90
        cold=90
    [/resistance]
    {TRAIT_DEXTROUS}
    description= _ "The best demon fighters are renowned for their unrivaled strength and performance under any environmental conditions. They obtain and craft new weapons and armor using whatever they can salvage from defeated foes, and learn new combat skills as they adapt to the land to which they are sent by their overlords."
    die_sound={SOUND_LIST:HUMAN_DIE}
    {DEFENSE_ANIM "units/demons/grunt.png" "units/demons/grunt.png" {SOUND_LIST:HUMAN_HIT} }
    [attack]
        name=axe
        description={I18N:ATTACK_AXE}
        type=blade
        range=melee
        damage=7
        number=3
        icon=attacks/axe-undead.png
    [/attack]
    [attack]
        name=infernal chill
        description= _ "infernal chill"
        type=cold
        range=ranged
        damage=9
        number=3
        icon=attacks/iceball.png
    [/attack]

    [attack_anim]
        [filter_attack]
            name=axe
        [/filter_attack]
        start_time=-100
        [if]
            hits=yes
            [frame]
                duration=200
                #image="units/demons/grunt-attack1.png"
                image="units/demons/grunt.png"
                sound=axe.ogg
            [/frame]
        [/if]
        [else]
            hits=no
            [frame]
                duration=200
                #image="units/demons/grunt-attack1.png"
                image="units/demons/grunt.png"
                sound={SOUND_LIST:MISS}
            [/frame]
        [/else]
        [frame]
            duration=100
            #image="units/demons/grunt-attack2.png"
            image="units/demons/grunt.png"
        [/frame]
    [/attack_anim]
    [attack_anim]
        [filter_attack]
            name=infernal chill
        [/filter_attack]
        start_time=-300
        {MISSILE_FRAME_INFERNAL_CHILL}
        [frame]
            duration=50
            image="units/demons/grunt.png"
            halo=halo/saurian-magic-halo-1.png
        [/frame]
        [frame]
            duration=60
            image="units/demons/grunt.png"
            halo=halo/saurian-magic-halo-2.png
            sound=magicmissile.wav
        [/frame]
        [frame]
            duration=70
            image="units/demons/grunt.png"
            halo=halo/saurian-magic-halo-3.png
        [/frame]
        [frame]
            duration=80
            image="units/demons/grunt.png"
            halo=halo/saurian-magic-halo-4.png
        [/frame]
        [frame]
            duration=90
            image="units/demons/grunt.png"
            halo=halo/saurian-magic-halo-5.png
        [/frame]
        [frame]
            duration=100
            image="units/demons/grunt.png"
            halo=halo/saurian-magic-halo-6.png
        [/frame]
        [frame]
            duration=100
            image="units/demons/grunt.png"
            halo=halo/saurian-magic-halo-7.png
        [/frame]
    [/attack_anim]

    [female]
        name= _ "female^Demoness Grunt"
        gender=female
        image="units/demons/grunt+female.png"
        profile="portraits/demon-regular+female.png"
        die_sound={SOUND_LIST:HUMAN_FEMALE_DIE}
        {DEFENSE_ANIM "units/demons/grunt+female.png" "units/demons/grunt+female.png" {SOUND_LIST:HUMAN_FEMALE_HIT} }
        [attack_anim]
            [filter_attack]
                name=axe
            [/filter_attack]
            [if]
                [frame]
                    #image="units/demons/grunt+female-attack1.png"
                    image="units/demons/grunt+female.png"
                [/frame]
            [/if]
            [else]
                [frame]
                    #image="units/demons/grunt+female-attack1.png"
                    image="units/demons/grunt+female.png"
                [/frame]
            [/else]
            [frame]
                #image="units/demons/grunt+female-attack2.png"
                image="units/demons/grunt+female.png"
            [/frame]
        [/attack_anim]
        [attack_anim]
            [filter_attack]
                name=infernal chill
            [/filter_attack]
            [frame]
                image="units/demons/grunt+female.png"
            [/frame]
            [frame]
                image="units/demons/grunt+female.png"
            [/frame]
            [frame]
                image="units/demons/grunt+female.png"
            [/frame]
            [frame]
                image="units/demons/grunt+female.png"
            [/frame]
            [frame]
                image="units/demons/grunt+female.png"
            [/frame]
            [frame]
                image="units/demons/grunt+female.png"
            [/frame]
            [frame]
                image="units/demons/grunt+female.png"
            [/frame]
        [/attack_anim]
    [/female]
[/unit_type]


#textdomain wesnoth-Naia

[unit_type]
    id=Demon Warrior
    name= _ "Demon Warrior"
    race=demon
    gender=male,female
    image="units/demons/warrior.png"
    profile="portraits/demon-regular.png"
    hitpoints=59
    movement_type=demonfoot
    movement=5
    experience=150
    level=3
    alignment=neutral
    advances_to=null
    {AMLA_DEFAULT}
    cost=56
    usage=mixed fighter
    {TRAIT_DEXTROUS}
    [resistance]
        blade=80
        pierce=90
        impact=80
        cold=90
    [/resistance]
    description= _ "The few natives of Irdya who have dared underestimate the might of these demonic warriors have invariably suffered horrific deaths at the hands of these blood-thirsty behemoths. The power of the armies of Chaos largely depends on the Lorekeepers’ wisdom in selecting the best fighters to serve them with their undying loyalty to Uria’s cause. But in time, a legendary warrior might rise from the ranks of servility and dethrone a mighty Demon Lord—even their own—and become him or herself a great vassal of Uria."
    die_sound={SOUND_LIST:HUMAN_DIE}
    {DEFENSE_ANIM "units/demons/warrior.png" "units/demons/warrior.png" {SOUND_LIST:HUMAN_HIT} }
    [attack]
        name=axe
        description={I18N:ATTACK_AXE}
        type=blade
        range=melee
        damage=9
        number=4
        icon=attacks/axe-undead.png
    [/attack]
    [attack]
        name=infernal chill
        description= _ "infernal chill"
        type=cold
        range=ranged
        damage=10
        number=4
        icon=attacks/iceball.png
    [/attack]
    [attack_anim]
        [filter_attack]
            name=axe
        [/filter_attack]
        [if]
            hits=yes
            [frame]
                begin=-100
                end=100
                image="units/demons/warrior.png"
                sound=axe.ogg
            [/frame]
        [/if]
        [else]
            hits=no
            [frame]
                begin=-100
                end=100
                image="units/demons/warrior.png"
                sound={SOUND_LIST:MISS}
            [/frame]
        [/else]
        [frame]
            begin=100
            end=200
            image="units/demons/warrior.png"
        [/frame]
    [/attack_anim]
    [attack_anim]
        [filter_attack]
            name=infernal chill
        [/filter_attack]
        {MISSILE_FRAME_INFERNAL_CHILL}
        [frame]
            begin=-300
            end=-250
            image="units/demons/warrior.png"
            halo=halo/saurian-magic-halo-1.png
        [/frame]
        [frame]
            begin=-250
            end=-190
            image="units/demons/warrior.png"
            halo=halo/saurian-magic-halo-2.png
            sound=magicmissile.wav
        [/frame]
        [frame]
            begin=-190
            end=-120
            image="units/demons/warrior.png"
            halo=halo/saurian-magic-halo-3.png
        [/frame]
        [frame]
            begin=-120
            end=-40
            image="units/demons/warrior.png"
            halo=halo/saurian-magic-halo-4.png
        [/frame]
        [frame]
            begin=-40
            end=50
            image="units/demons/warrior.png"
            halo=halo/saurian-magic-halo-5.png
        [/frame]
        [frame]
            begin=50
            end=150
            image="units/demons/warrior.png"
            halo=halo/saurian-magic-halo-6.png
        [/frame]
        [frame]
            begin=150
            end=250
            image="units/demons/warrior.png"
            halo=halo/saurian-magic-halo-7.png
        [/frame]
    [/attack_anim]

    [female]
        name= _ "female^Demoness Warrior"
        gender=female
        image="units/demons/warrior+female.png"
        profile="portraits/demon-regular+female.png"
        die_sound={SOUND_LIST:HUMAN_FEMALE_DIE}
        {DEFENSE_ANIM "units/demons/warrior+female.png" "units/demons/warrior+female.png" {SOUND_LIST:HUMAN_FEMALE_HIT} }
        [attack_anim]
            [filter_attack]
                name=axe
            [/filter_attack]
            [if]
                [frame]
                    image="units/demons/warrior+female.png"
                [/frame]
            [/if]
            [else]
                [frame]
                    image="units/demons/warrior+female.png"
                [/frame]
            [/else]
            [frame]
                image="units/demons/warrior+female.png"
            [/frame]
        [/attack_anim]
        [attack_anim]
            [filter_attack]
                name=infernal chill
            [/filter_attack]
            [frame]
                image="units/demons/warrior+female.png"
            [/frame]
            [frame]
                image="units/demons/warrior+female.png"
            [/frame]
            [frame]
                image="units/demons/warrior+female.png"
            [/frame]
            [frame]
                image="units/demons/warrior+female.png"
            [/frame]
            [frame]
                image="units/demons/warrior+female.png"
            [/frame]
            [frame]
                image="units/demons/warrior+female.png"
            [/frame]
            [frame]
                image="units/demons/warrior+female.png"
            [/frame]
        [/attack_anim]
    [/female]
[/unit_type]