#textdomain wesnoth-did

#define GHOST_ADVANCEMENT HP_INCREMENT XP_INCREMENT_E XP_INCREMENT_N XP_INCREMENT_H EFFECT_WML VARIATION_NAME
    [advancement]
        max_times=-1
        always_display=yes
        [effect]
            apply_to=hitpoints
            increase_total={HP_INCREMENT}
            increase={HP_INCREMENT}
            heal_full=no
        [/effect]
#ifdef EASY
        [effect]
            apply_to=max_experience
            increase={XP_INCREMENT_E}
        [/effect]
#endif
#ifdef NORMAL
        [effect]
            apply_to=max_experience
            increase={XP_INCREMENT_N}
        [/effect]
#endif
#ifdef HARD
        [effect]
            apply_to=max_experience
            increase={XP_INCREMENT_H}
        [/effect]
#endif
        [effect]
            apply_to=variation
            name={VARIATION_NAME}
        [/effect]
        {EFFECT_WML}
    [/advancement]
#enddef

#define GHOST_ADVANCE HP_INCREMENT XP_INCREMENT_E XP_INCREMENT_N XP_INCREMENT_H EFFECT_WML TYPE_NAME
    [advancement]
        max_times=-1
        always_display=yes
        [effect]
            apply_to=hitpoints
            increase_total={HP_INCREMENT}
            increase={HP_INCREMENT}
            heal_full=no
        [/effect]
#ifdef EASY
        [effect]
            apply_to=max_experience
            increase={XP_INCREMENT_E}
        [/effect]
#endif
#ifdef NORMAL
        [effect]
            apply_to=max_experience
            increase={XP_INCREMENT_N}
        [/effect]
#endif
#ifdef HARD
        [effect]
            apply_to=max_experience
            increase={XP_INCREMENT_H}
        [/effect]
#endif
        [effect]
            apply_to=type
            name={TYPE_NAME}
        [/effect]
        {EFFECT_WML}
    [/advancement]
#enddef

#define AUTO_ADVANCE VARIATION_NAME
    [advancement]
        max_times=-1
        always_display=yes
        description= _ "+2 HP"
        image=icons/potion_green_small.png
        [effect]
            apply_to=variation
            name={VARIATION_NAME}
        [/effect]
        [effect]
            apply_to=hitpoints
            increase_total=2
            increase=2
            heal_full=no
        [/effect]
#ifdef EASY
        [effect]
            apply_to=max_experience
            increase=44
        [/effect]
#endif
#ifdef NORMAL
        [effect]
            apply_to=max_experience
            increase=49
        [/effect]
#endif
#ifdef HARD
        [effect]
            apply_to=max_experience
            increase=54
        [/effect]
#endif
    [/advancement]
#enddef

############## GHOST ADVANCEMENTS ##############

#define GHOST_MELEE VARIANT_NAME
    {GHOST_ADVANCEMENT 2 10 12 14 (
        id=ghost_melee
        description= _ "+1 melee damage"
        image=attacks/touch-undead.png
        [effect]
            apply_to=attack
            name=touch
            increase_damage=1
        [/effect]
    ) {VARIANT_NAME}}
#enddef

#define GHOST_RANGED VARIANT_NAME
    {GHOST_ADVANCEMENT 2 10 12 14 (
        id=ghost_ranged
        description= _ "+1 ranged damage"
        image=attacks/wail.png
        [effect]
            apply_to=attack
            range=ranged
            increase_damage=1
        [/effect]
    ) {VARIANT_NAME}}
#enddef

#define GHOST_MOVEMENT VARIANT_NAME
    {GHOST_ADVANCEMENT 0 12 14 16 (
        id=ghost_movement
        description= _ "+1 movement"
        image=icons/sandals.png
        [effect]
            apply_to=movement
            increase=1
        [/effect]
    ) {VARIANT_NAME}}
#enddef

#define GHOST_MELEE_ADVANCE
    {GHOST_ADVANCE 1 10 12 14 (
        id=ghost_melee_advance
        description= _ "+1 melee damage"
        image=attacks/touch-undead.png
        [effect]
            apply_to=attack
            name=touch
            increase_damage=1
        [/effect]
        [effect]
            apply_to=max_experience
            set=15
        [/effect]
    ) Phantom}
#enddef

#define GHOST_RANGED_ADVANCE
    {GHOST_ADVANCE 1 10 12 14 (
        id=ghost_ranged_advance
        description= _ "+1 ranged damage"
        image=attacks/wail.png
        [effect]
            apply_to=attack
            range=ranged
            increase_damage=1
        [/effect]
        [effect]
            apply_to=max_experience
            set=15
        [/effect]
    ) Phantom}
#enddef

#define GHOST_MOVE_ADVANCE
    {GHOST_ADVANCE 0 12 14 16 (
        id=ghost_move_advance
        description= _ "+1 movement"
        image=icons/sandals.png
        [effect]
            apply_to=movement
            increase=1
        [/effect]
        [effect]
            apply_to=max_experience
            set=15
        [/effect]
    ) Phantom}
#enddef

############## WRAITH ADVANCEMENTS ##############

#define WRAITH_MELEE VARIANT_NAME
    {GHOST_ADVANCEMENT 2 10 12 14 (
        id=wraith_melee
        description= _ "+1 melee damage"
        image=attacks/baneblade.png
        [effect]
            apply_to=attack
            name=baneblade
            increase_damage=1
        [/effect]
    ) {VARIANT_NAME}}
#enddef

#define WRAITH_MALEVOLENCE VARIANT_NAME
    {GHOST_ADVANCEMENT 1 40 45 50 (
        id=wraith_malevolence
        description= _ "Wail gains the malevolence special"
        image=attacks/wail.png
        [effect]
            apply_to=attack
            name=wail
            [set_specials]
                {WEAPON_SPECIAL_MALEVOLENCE}
                mode=append
            [/set_specials]
        [/effect]
    ) {VARIANT_NAME}}
#enddef

#define WRAITH_HYSTERIA VARIANT_NAME
    {GHOST_ADVANCEMENT 4 50 55 60 (
        id=wraith_hysteria
        description= _ "Wail gains the hysteria special"
        image=attacks/wail.png
        [effect]
            apply_to=attack
            name=wail
            [set_specials]
                {WEAPON_SPECIAL_HYSTERIA}
                mode=append
            [/set_specials]
        [/effect]
    ) {VARIANT_NAME}}
#enddef

#define WRAITH_MELEE_ADVANCE
    {GHOST_ADVANCE 2 10 12 14 (
        id=wraith_melee_advance
        description= _ "+1 melee damage"
        image=attacks/baneblade.png
        [effect]
            apply_to=attack
            name=baneblade
            increase_damage=1
        [/effect]
        [effect]
            apply_to=max_experience
            set=90
        [/effect]
    ) Eidolon}
#enddef

#define WRAITH_RANGED_ADVANCE
    {GHOST_ADVANCE 2 10 12 14 (
        id=wraith_ranged_advance
        description= _ "+1 ranged damage"
        image=attacks/wail.png
        [effect]
            apply_to=attack
            range=ranged
            increase_damage=1
        [/effect]
        [effect]
            apply_to=max_experience
            set=90
        [/effect]
    ) Eidolon}
#enddef

#define WRAITH_MALEVOLENCE_ADVANCE
    {GHOST_ADVANCE 1 40 45 50 (
        id=wraith_malevolence_advance
        description= _ "Wail gains the malevolence special"
        image=attacks/wail.png
        [effect]
            apply_to=attack
            name=wail
            [set_specials]
                {WEAPON_SPECIAL_MALEVOLENCE}
                mode=append
            [/set_specials]
        [/effect]
        [effect]
            apply_to=max_experience
            set=90
        [/effect]
    ) Eidolon}
#enddef

#define WRAITH_HYSTERIA_ADVANCE
    {GHOST_ADVANCE 4 50 55 60 (
        id=wraith_hysteria_advance
        description= _ "Wail gains the hysteria special"
        image=attacks/wail.png
        [effect]
            apply_to=attack
            name=wail
            [set_specials]
                {WEAPON_SPECIAL_HYSTERIA}
                mode=append
            [/set_specials]
        [/effect]
        [effect]
            apply_to=max_experience
            set=90
        [/effect]
    ) Eidolon}
#enddef

#define WRAITH_RESIST_ADVANCE
    {GHOST_ADVANCE 6 40 45 50 (
        id=wraith_resist_advance
        description= _ "Gains +20% resistance to fire"
        image=attacks/fire-blast.png
        [effect]
            apply_to=resistance
            [resistance]
                fire=-20
            [/resistance]
        [/effect]
        [effect]
            apply_to=max_experience
            set=90
        [/effect]
    ) Eidolon}
#enddef

#define GHOST_BASE
    name= _ "Spectral Servant"
    hitpoints=17
    movement=6
#ifdef EASY
    experience=14
#endif
#ifdef NORMAL
    experience=16
#endif
#ifdef HARD
    experience=18
#endif
    advances_to=null
    [attack]
        name=touch
        description=_"touch"
        icon=attacks/touch-undead.png
        type=arcane
        range=melee
        damage=5
        number=3
        [specials]
            {WEAPON_SPECIAL_DRAIN}
        [/specials]
    [/attack]
    [attack]
        name=wail
        description=_"wail"
        type=cold
        range=ranged
        damage=4
        number=3
    [/attack]
#enddef

#define WRAITH_BASE
    name= _ "Phantom"
    hitpoints=22
    movement=6
    advances_to=null
    [attack]
        name=baneblade
        description=_"baneblade"    # wmllint: no spellcheck (until name->id)
        type=arcane
        range=melee
        damage=6
        number=4
        [specials]
            {WEAPON_SPECIAL_DRAIN}
        [/specials]
    [/attack]
    [attack]
        name=wail
        description=_"wail"
        type=cold
        range=ranged
        damage=4
        number=4
    [/attack]
#enddef

#define SPECTRE_BASE
    name= _ "Eidolon"
    hitpoints=27
    movement=6
    experience=90
    advances_to=null
    [attack]
        name=baneblade
        description=_"baneblade"    # wmllint: no spellcheck (until name->id)
        type=arcane
        range=melee
        damage=8
        number=4
        [specials]
            {WEAPON_SPECIAL_DRAIN}
        [/specials]
    [/attack]
    [attack]
        name=wail
        description=_"wail"
        type=cold
        range=ranged
        damage=6
        number=4
    [/attack]
#enddef

[unit_type]
    id=Spectral Servant
    {GHOST_BASE}
    [base_unit]
        id=Ghost
    [/base_unit]
    [variation]
        {GHOST_BASE}
        hide_help=yes
        variation_id=SS1
        inherit=yes
        {GHOST_MELEE SS2MELEE}
        {GHOST_RANGED SS2RANGED}
    [/variation]
    [variation]
        {GHOST_BASE}
        hide_help=yes
        variation_id=SS2MELEE
        inherit=yes
        {GHOST_RANGED_ADVANCE}
        {GHOST_MOVE_ADVANCE}
    [/variation]
    [variation]
        {GHOST_BASE}
        hide_help=yes
        variation_id=SS2RANGED
        inherit=yes
        {GHOST_MELEE_ADVANCE}
        {GHOST_MOVE_ADVANCE}
    [/variation]
[/unit_type]

[unit_type]
    id=Phantom
    {WRAITH_BASE}
    [base_unit]
        id=Wraith
    [/base_unit]
    experience=0
    {AUTO_ADVANCE W0}

    [variation]
        {WRAITH_BASE}
        hide_help=yes
        variation_id=W0
        inherit=yes
        {WRAITH_MALEVOLENCE W1}
        {WRAITH_HYSTERIA W1}
        {WRAITH_MELEE W1NOABILITY}
        {GHOST_RANGED W1NOABILITY}
    [/variation]
    [variation]
        {WRAITH_BASE}
        hide_help=yes
        variation_id=W1
        inherit=yes
        {WRAITH_MELEE W2}
        {GHOST_RANGED W2}
        {GHOST_MOVEMENT W2}
    [/variation]
    [variation]
        {WRAITH_BASE}
        hide_help=yes
        variation_id=W1NOABILITY
        inherit=yes
        {WRAITH_MALEVOLENCE W2}
        {WRAITH_HYSTERIA W2}
        {WRAITH_MELEE W2NOABILITY}
        {GHOST_RANGED W2NOABILITY}
        {GHOST_MOVEMENT W2NOABILITY}
    [/variation]
    [variation]
        {WRAITH_BASE}
        hide_help=yes
        variation_id=W2
        inherit=yes
        {WRAITH_MELEE_ADVANCE}
        {WRAITH_RANGED_ADVANCE}
        {WRAITH_RESIST_ADVANCE}
    [/variation]
    [variation]
        {WRAITH_BASE}
        hide_help=yes
        variation_id=W2NOABILITY
        inherit=yes
        {WRAITH_MELEE_ADVANCE}
        {WRAITH_RANGED_ADVANCE}
        {WRAITH_MALEVOLENCE_ADVANCE}
        {WRAITH_HYSTERIA_ADVANCE}
    [/variation]
[/unit_type]

[unit_type]
    id=Eidolon
    {SPECTRE_BASE}
    [base_unit]
        id=Spectre
    [/base_unit]
    {AMLA_EIDOLON}
[/unit_type]

#undef GHOST_ADVANCEMENT
#undef GHOST_ADVANCE
#undef AUTO_ADVANCE
#undef GHOST_MELEE
#undef GHOST_RANGED
#undef GHOST_MOVEMENT
#undef GHOST_MELEE_ADVANCE
#undef GHOST_RANGED_ADVANCE
#undef GHOST_MOVE_ADVANCE
#undef WRAITH_MELEE
#undef WRAITH_MALEVOLENCE
#undef WRAITH_HYSTERIA
#undef WRAITH_MELEE_ADVANCE
#undef WRAITH_RANGED_ADVANCE
#undef WRAITH_MALEVOLENCE_ADVANCE
#undef WRAITH_HYSTERIA_ADVANCE
#undef WRAITH_RESIST_ADVANCE
#undef GHOST_BASE
#undef WRAITH_BASE
#undef SPECTRE_BASE
