#textdomain wesnoth-test

[test]
    name=_"Test scenario"
    map_data="
Hh          , Hh          , Gg          , Wwf         , Wwf         , Gs^Fp       , Mm          , Hh          , Gg          , Gs^Fp       , Gg          , Hh          , Gg          , Mm          , Hh          , Mm          , Wwf         , Wwf         , Hh          , Gs^Fp       , Hh          , Mm          , Mm
Hh          , Hh          , Gg^Ve       , Wwf         , Wwf         , Gs^Fp       , Mm          , Hh          , Gg          , Gs^Fp       , Gg          , Hh          , Gg          , Mm          , Hh          , Mm          , Wwf         , Wwf         , Hh          , Gs^Fp       , Hh          , Mm          , Mm
Wwf         , Wwf         , Wwf         , Wwf         , Gg          , Wwf         , Wwf         , Hh          , Gg          , Gg          , Wwf         , Ch          , Wwf         , Gs^Fp       , Wwf         , Wwf         , Re          , Re          , Hh          , Mm          , Wwf         , Mm          , Mm
Mm          , Mm          , Wwf         , Gs^Fp       , Gg^Vh       , Wwf         , Gg          , Gg          , Wwf         , Wwf         , Wwf         , 1 Kh        , Ch          , Wwf         , Re          , Re          , Rd          , Rd          , Wwf         , Wwf         , Gs^Fp       , Wwf         , Wwf
Wwf         , Wwf         , Mm          , Wwf         , Gs^Fp       , Wwf         , Wwf         , Wwf         , Gg^Vh       , Gg          , Wwf         , Ch          , Wwf         , Ch          , Rd          , Rd          , Wwf         , Wwf         , Gg^Vh       , Gs^Fp       , Re^Gvs      , Hh          , Hh
Hh          , Hh          , Wwf         , Gs^Fp       , Wwf         , Wwf         , Gg          , Gg          , Gg          , Gg          , Wwf         , Ch          , Gg          , Wwf         , Wwf         , Wwf         , Mm          , Gs^Fp       , Re          , Re^Gvs      , Gg^Wm       , Re^Gvs      , Re^Gvs
Wwf         , Wwf         , Mm          , Wwf         , Hh          , Gs^Fp       , Rd          , Rd          , Gg          , Gg          , Wwf         , Wwf         , Gs^Fp       , Gg          , Hh          , Gg          , Re          , Re          , Rd          , Rd          , Gg          , Hh          , Hh
Hh          , Hh          , Gs^Fp       , Gg          , Gg          , Rd          , Gg          , Gg          , Wwf         , Wwf         , Gs^Fp       , Wwf         , Gs^Fp       , Mm          , Re          , Re          , Rd          , Rd          , Gg          , Gg^Efm      , Mm          , Gs^Fp       , Gs^Fp
Gs^Fp       , Gs^Fp       , Gg          , Gg          , Wwf         , Gg          , Wwf         , Wwf         , Mm          , Hh          , Wwf         , Wwf         , Re          , Re          , Rd          , Rd          , Rd          , Gg          , Gs^Fp       , Gs^Fp       , Gs^Fp       , Hh          , Hh
Hh          , Hh          , Wwf         , Wwf         , Hh          , Wwf         , Gg          , Gg          , Gg          , Gg          , Wwf         , Re          , Re          , Rd          , Gg          , Gg          , Gg          , Gg^Vh       , Hh          , Gg          , Wwf         , Gg^Efm      , Gg^Efm
Wwf         , Wwf         , Hh          , Gg^Efm      , Gs^Fp       , Hh^Vhh      , Gg          , Gg          , Gg          , Ss^Vhs      , Hh          , Ww          , Gs^Fp       , Gg          , Gs^Fp       , Hh          , Wwf         , Wwf         , Wwf         , Wwf         , Gg          , Wwf         , Wwf
Hh          , Hh          , Gg          , Gg          , Re          , Gg          , Re          , Re          , Gg          , Ss          , Gs^Fp       , Ww          , Hh          , Mm          , Ww          , Wwf         , Gg          , Gg          , Ds          , Gg          , Gg          , Gs^Fp       , Gs^Fp
Gs^Fp       , Gs^Fp       , Gg          , Rd          , Rd          , Re          , Rd          , Re          , Hh          , Mm          , Wwf         , Ww          , Ww          , Ww          , Gg          , Gg          , Hh          , Gs^Fp       , Rd          , Rd          , Hh          , Gg          , Gg
Rd          , Rd          , Gs^Fp       , Hh          , Rd          , Rd          , Gs^Fp       , Re          , Gg          , Gg          , Wwf         , Gg          , Wwf         , Gg          , Gg          , Re          , Gs^Fp       , Hh          , Rd          , Mm          , Gs^Fp       , Rd          , Rd
Rd          , Rd          , Hh          , Mm          , Rd          , Hh          , Hh          , Re          , Gg          , Gg          , Ww          , Gg          , Wwf         , Gg          , Hh          , Re          , Rd          , Rd          , Rd          , Hh          , Gg          , Rd          , Rd
Gg          , Gg          , Gg          , Rd          , Ds          , Gs^Fp       , Gg          , Gg          , Ww          , Ww          , Hh          , Ww          , Gs^Fp       , Mm          , Gg          , Re          , Re          , Re          , Re          , Rd          , Gg          , Gs^Fp       , Gs^Fp
Gs^Fp       , Gs^Fp       , Gg          , Gg          , Wwf         , Gg          , Wwf         , Wwf         , Gs^Fp       , Mm          , Gs^Fp       , Ww          , Hh          , Ss          , Gg          , Re          , Gg          , Gg          , Gs^Fp       , Gg          , Hh          , Hh          , Hh
Wwf         , Wwf         , Wwf         , Wwf         , Hh          , Wwf         , Gg          , Hh          , Gg          , Gg          , Re          , Ww          , Wwf         , Ss^Vhs      , Gg          , Gg          , Gg          , Hh^Vhh      , Hh          , Gg^Efm      , Wwf         , Wwf         , Wwf
Gg^Efm      , Gg^Efm      , Gs^Fp       , Gg          , Gs^Fp       , Gg^Vh       , Rd          , Gg          , Rd          , Rd          , Re          , Re          , Wwf         , Gg          , Mm          , Gg          , Wwf         , Wwf         , Wwf         , Wwf         , Gg          , Mm          , Mm
Hh          , Hh          , Mm          , Gs^Fp       , Gg          , Gg          , Rd          , Rd          , Re          , Re          , Gs^Fp       , Wwf         , Gs^Fp       , Hh          , Wwf         , Wwf         , Gg          , Gg          , Gg          , Gg          , Gs^Fp       , Gs^Fp       , Gs^Fp
Gs^Fp       , Gs^Fp       , Gg          , Gg^Efm      , Rd          , Rd          , Re          , Re          , Hh          , Mm          , Gg          , Wwf         , Wwf         , Wwf         , Gg          , Gg          , Rd          , Rd          , Hh          , Gg          , Mm          , Hh          , Hh
Hh          , Hh          , Gg^Wm       , Rd          , Re          , Re          , Mm          , Gg          , Wwf         , Wwf         , Wwf         , Ch          , Gg          , Gg          , Gg          , Rd          , Gg          , Gs^Fp       , Wwf         , Wwf         , Wwf         , Wwf         , Wwf
Re^Gvs      , Re^Gvs      , Re^Gvs      , Re^Gvs      , Gg^Vh       , Gs^Fp       , Wwf         , Wwf         , Rd          , Ch          , Ch          , Ch          , Gg          , Gg          , Gg^Vh       , Gg          , Wwf         , Wwf         , Gs^Fp       , Gs^Fp       , Gg^Ve       , Gg          , Gg
Hh          , Hh          , Gs^Fp       , Gs^Fp       , Wwf         , Wwf         , Rd          , Rd          , Re          , Re          , Wwf         , 2 Kh        , Wwf         , Gg          , Wwf         , Wwf         , Gg          , Wwf         , Wwf         , Wwf         , Wwf         , Gs^Fp       , Gs^Fp
Gs^Fp       , Gs^Fp       , Wwf         , Wwf         , Mm          , Rd          , Gs^Fp       , Hh          , Wwf         , Wwf         , Gg          , Ch          , Gg          , Wwf         , Hh          , Gg          , Wwf         , Wwf         , Gg^Vh       , Gg          , Wwf         , Mm          , Mm
Gs^Fp       , Gs^Fp       , Wwf         , Wwf         , Mm          , Rd          , Gs^Fp       , Wwf         , Wwf         , Gg          , Gg          , Gg          , Gg          , Gg          , Hh          , Gg          , Wwf         , Wwf         , Gg          , Gg          , Wwf         , Mm          , Mm
"

    turns=90
    id=formula

    {DEFAULT_SCHEDULE}

    [label]
        x,y=16,5
        text=_"Patrol waypoint 1"
    [/label]

    [label]
        x,y=16,15
        text=_"Patrol waypoint 2"
    [/label]

    [label]
        x,y=3,14
        text=_"Formula priorities test"
    [/label]

    [label]
        x,y=2,12
        text=_"first"
    [/label]

    [label]
        x,y=3,11
        text=_"second"
    [/label]

    [label]
        x,y=3,13
        text=_"third"
    [/label]

    [label]
        x,y=8,5
        text=_"Location guarded (range = 3)"
    [/label]

    [side]
        type=Dwarvish Steelclad
        id=side_1_leader
        side=1
        canrecruit=yes
        recruit=Dwarvish Guardsman,Dwarvish Fighter,Dwarvish Thunderer,Thief,Poacher,Footpad
        gold=100
        controller=human
        suppress_end_turn_confirmation=yes
        [unit]
            x,y=10,8
            type="Elvish Archer"
            hitpoints=1
            generate_name=yes
        [/unit]

        [unit]
            x,y=3,12
            type="Elvish Fighter"
            random_traits=no
            generate_name=yes
            [modifications]
                [trait]
                    id=move
                    [effect]
                        apply_to=movement
                        set=0
                    [/effect]
                [/trait]
                [trait]
                    id=hp
                    [effect]
                        apply_to=hitpoints
                        increase_total=120
                    [/effect]
                [/trait]
            [/modifications]
        [/unit]
    [/side]

    [side]
        #controller=human
        suppress_end_turn_confirmation=yes
        name=_"FormulaAI"
        type=Dark Sorcerer
        side=2
        canrecruit=yes
        recruit=Skeleton,Skeleton Archer,Walking Corpse,Ghost,Vampire Bat,Dark Adept,Ghoul
        gold=100
        shroud=yes

        [unit]
            x,y=8,5
            type="Orcish Archer"
            generate_name=yes
            [ai]
                formula="if(attack, attack, move(me.loc, me.vars.guard_loc))
                    where attack = choose(filter(attacks, units = [me.loc] and distance_between(me.vars.guard_loc, target) <= me.vars.guard_radius), avg_damage_inflicted)"
                [vars]
                    guard_radius=3
                    guard_loc="loc(8,5)"
                [/vars]
            [/ai]
        [/unit]
        [unit]
            x,y=3,8
            type="Walking Corpse"
            generate_name=yes
            [ai]
                formula="move(me.loc, nearest_loc(nearest_loc(me.loc,map(filter(map.terrain,castle=1),loc)),unit_moves(me.loc)))"
            [/ai]
        [/unit]

        [unit]
            x,y=16,5
            type="Wolf Rider"
            generate_name=yes
            [ai]
                loop_formula="{ai/formula/patrol.fai}"
                [vars]
                    guard_radius=3
                    waypoints=[ loc(16,5) -> loc(16,15), loc(16,15) -> loc(16,5) ]
                    next_step="loc(16,5)"
                [/vars]
            [/ai]
        [/unit]

        [unit]
            x,y=3,11
            type="Goblin Spearman"
            generate_name=yes
            [ai]
                formula="attack(me.loc, me.loc, loc(3,12))"
                priority=10
            [/ai]
        [/unit]

        [unit]
            x,y=3,13
            type="Goblin Spearman"
            generate_name=yes
            [ai]
                priority=9
                formula="attack(me.loc, me.loc, loc(3,12))"
            [/ai]
        [/unit]

        [unit]
            x,y=2,12
            type="Goblin Spearman"
            generate_name=yes
            [ai]
                priority=11
                formula="attack(me.loc, me.loc, loc(3,12))"
            [/ai]
        [/unit]

        [unit]
            x,y=7,20
            type="Silver Mage"
            generate_name=yes
        [/unit]

        [unit]
            x,y=6,20
            type="Ghost"
            generate_name=yes
        [/unit]
        [unit]
            x,y=15,22
            type="Ghost"
            generate_name=yes
        [/unit]
        [unit]
            x,y=12,19
            type="Ghost"
            generate_name=yes
        [/unit]
        [unit]
            x,y=10,6
            type="Lich"
            experience=149
            generate_name=yes
        [/unit]

        [ai]
            [stage]
                engine=fai
                name=unit_formulas
            [/stage]

            [stage]
                engine=fai
                name=side_formulas
                move="{ai/formula/opening.fai}"
            [/stage]

            [stage]
                id=rca_formulas
                name=ai_default_rca::candidate_action_evaluation_loop
                [candidate_action]
                    engine=fai
                    name=scouting
                    type=movement
                    action="{ai/formula/scouting_move.fai}"
                    evaluation="{ai/formula/scouting_eval.fai}"
                [/candidate_action]

                [candidate_action]
                    engine=fai
                    name=level_up_attack
                    type=attack
                    action="{ai/formula/level_up_attack_move.fai}"
                    evaluation="{ai/formula/level_up_attack_eval.fai}"
                [/candidate_action]
            [/stage]
        [/ai]
    [/side]
[/test]

# vim: tabstop=4: shiftwidth=4: expandtab: softtabstop=4: autoindent:
