#textdomain wesnoth-ai

[test]
    id=high_xp_attack
    name=_"High XP Attack"

    map_file=ai/maps/scenario-high_xp_attack.map
    {DEFAULT_SCHEDULE}
    turns=unlimited
    victory_when_enemies_defeated=yes

    [side]
        side=1
        controller=human
        id=player
        name=_"Sly Player"
        type=Necromancer
        x,y=17,58
        persistent=no
        facing=sw

        team_name=player
        user_team_name=_"Sly Player"
        recruit=Skeleton,Skeleton Archer

        gold=0
    [/side]

    [side]
        type=Dwarvish Steelclad
        id=dwarf
        name=_"Fearless AI Leader"
        side=2
        x,y=8,53
        facing=se

        team_name=dwarves
        user_team_name=_"Fearless AI"
        recruit=Dwarvish Fighter,Dwarvish Scout,Dwarvish Thunderer

        gold=0
    [/side]

    # Prestart actions
    [event]
        name=prestart

        [terrain]
            x,y=21,55
            terrain=Rd
        [/terrain]

        {UNIT 1 (Skeleton) 6 58 (random_traits,experience=no,33)}
        {UNIT 2 (Dwarvish Scout) 6 56 (random_traits=no)}
        {UNIT 2 (Dwarvish Scout) 4 58 (random_traits=no)}
        {UNIT 2 (Dwarvish Fighter) 8 59 (random_traits=no)}

        {UNIT 1 (Skeleton) 23 55 (random_traits,experience,hitpoints=no,34,10)}
        {UNIT 2 (Dwarvish Scout) 27 54 (random_traits=no)}

        # Groups of units with enemy 2 XP from leveling
        {UNIT 1 (Revenant) 8 29 (random_traits,experience=no,83)}
        {UNIT 2 (Dwarvish Scout) 5 29 (random_traits=no)}
        {UNIT 2 (Dwarvish Scout) 5 30 (random_traits=no)}
        {UNIT 2 (Dwarvish Steelclad) 6 29 (random_traits=no)}

        {UNIT 1 (Revenant) 18 29 (random_traits,experience=no,83)}
        {UNIT 2 (Dwarvish Fighter) 21 29 (random_traits,hitpoints=no,2)}
        {UNIT 2 (Dwarvish Fighter) 21 30 (random_traits,hitpoints=no,2)}
        {UNIT 2 (Dwarvish Runesmith) 20 29 (random_traits=no)}

        # Move-out-of-way triple
        {UNIT 1 (Skeleton) 20 54 (random_traits,experience=no,34)}
        {UNIT 2 (Dwarvish Runesmith) 19 54 (random_traits=no)}
        {UNIT 2 (Dwarvish Scout) 14 51 (random_traits=no)}

        # Revenant - Fighter pairs
        {UNIT 1 (Revenant) 32 41 (random_traits,experience=no,84)}
        {UNIT 1 (Revenant) 46 41 (random_traits,experience,hitpoints=no,84,25)}
        {UNIT 2 (Dwarvish Fighter) 35 40 (random_traits,hitpoints=no,7)}
        {UNIT 2 (Dwarvish Fighter) 43 40 (random_traits,hitpoints=no,18)}

        # Poisoned enemies
        {UNIT 1 (Ghoul) 52 55 (random_traits,experience,hitpoints=no,34,16)}
        [+unit]
            [status]
                poisoned=yes
            [/status]
        [/unit]
        {UNIT 1 (Ghoul) 56 55 (random_traits,experience,hitpoints=no,34,24)}
        [+unit]
            [status]
                poisoned=yes
            [/status]
        [/unit]
        {UNIT 2 (Dwarvish Fighter) 54 54 (random_traits=no)}
        {UNIT 2 (Dwarvish Fighter) 54 55 (random_traits=no)}
    [/event]

    [event]
        name=start

        [message]
            id=player
            message=_"Hahaha! I have placed my units at strategic choke points and given them XP close to leveling. I am safe from the stupid Wesnoth AI."
        [/message]

        [message]
            id=dwarf
            message=_"You’re in for a nasty surprise ..."
        [/message]

        [message]
            speaker=narrator
            image="wesnoth-icon.png"
            caption=_"Note"
            message=_"This is a test scenario for a new AI algorithm that attacks units close to leveling. A few test cases are already set up on the map, but it is really expected that you add more units and/or change hitpoints and experience using debug commands to try out other situations."
        [/message]

        [message]
            x,y=52,55
            message=_"Poisoned units are only attacked if there is a chance to kill them. Otherwise we simply wait and let the poison do its work."
        [/message]

        [message]
            x,y=19,54
            message=_"The scout in the northwest is the better choice for forcing the skeleton to level up, so I’ll move out of the way for him."
        [/message]

        [message]
            x,y=8,29
            message=_"Here we have a unit 2 XP from leveling with both L1 and L2 AI units in reach. In this case, we wait to see what the default AI does. After the default AI attacks with one of the L1 units and the enemy is 1 XP from leveling, we execute a level-up attack."
        [/message]
        [message]
            x,y=18,29
            message=_"This is an equivalent setup, except that the default AI chooses not to attack with the (weakened) L1 units. In this case, we execute the level-up attack with the L2 unit after the default AI is done."
        [/message]

        [message]
            x,y=35,40
            message=_"There’s a high chance that I will die in attacking that revenant, so the AI will not attack with aggression=0.4 (the default). By contrast, with aggression=1 (which you can set in a moment), it does attack."
        [/message]
        [message]
            x,y=43,40
            message=_"I have a much lower chance to die and will attack even with the default setting for aggression."
        [/message]

        [message]
            speaker=narrator
            image=wesnoth-icon.png
            message=_"What value should we use for aggression for the AI side?"
            [option]
                label=_"aggression 0.4 (the default)"
            [/option]
            [option]
                label=_"aggression 1.0"
                [command]
                    [modify_side]
                        side=2
                        [ai]
                            aggression=1
                        [/ai]
                    [/modify_side]
                [/command]
            [/option]
        [/message]

        [objectives]
            [note]
                description=_"Modify the units on the map as desired, then end the turn"
            [/note]
        [/objectives]
    [/event]
[/test]
