#textdomain wesnoth
# Utility macros for scenario-objective control.

# These macros don't depend on any others.  Please don't change this.
# ! in comments is used in generating HTML documentation, ignore it otherwise.

# Max number of turns in a scenario, mainly for use as a turn upper bound
# in ai declarations for aggression, etc.
#define FOREVER
999 #enddef

# The effectively infinite radius.
#define INFINITY
999 #enddef

# Everywhere on the map.  For filters that would otherwise touch recall lists.
#define EVERYWHERE
x,y=1-999,1-999 #enddef

#define SET_OBJECTIVES SIDE SUMMARY NOTE CONDITION_WML
    # Sets the objectives for a given player
    # Side 0 means every player. Does not affect gameplay,
    # except that it tells the player what the objectives of a scenario are.
    #
    # For example, we could set the objective for all players to: "survive for
    # 3 turns" with this:
    #! {SET_OBJECTIVES 0 "Survive for 3 turns" () ()}
    #
    [objectives]
        side = {SIDE}
        summary = {SUMMARY}
        note = {NOTE}
        {CONDITION_WML}
    [/objectives]
#enddef

#define VICTORY_CONDITION DESCRIPTION
    # Used in conjunction with SET_OBJECTIVES this sets a victory condition
    # (marked green).
    #
    # For example we could tell player 2 to win by killing all other players
    #! {SET_OBJECTIVES 0 "Kill eachother." (
    #!    {VICTORY_CONDITION "Kill all other players."}
    #! )}
    #
    [objective]
        condition = "win"
        description = {DESCRIPTION}
    [/objective]
#enddef

#define DEFEAT_CONDITION DESCRIPTION
    # Used in conjunction with SET_OBJECTIVES this sets a defeat condition
    # (marked red).
    #
    # For example we could tell all players that they lose if they die.
    #! {SET_OBJECTIVES 0 "Survive." (
    #!    {DEFEAT_CONDITION "Death of your leader."}
    #! )}
    #
    [objective]
        condition = "lose"
        description = {DESCRIPTION}
    [/objective]
#enddef

#define SIDE_PLAYER SIDE TEAM DESCRIPTION GOLD INCOME SIDE_WML
    # Defines a multiplayer side in a scenario that is controllable by the player.
    #
    # For example we can set side 1 to be a player belonging to team "Good Guys"
    # starting with 200g and no income:
    #! {SIDE_PLAYER 1 "Good Guys" "Good Guy #1" 200 -2 ()}
    [side]	# wmllint: validate-off
        user_team_name={DESCRIPTION}
        side={SIDE}
        team_name={TEAM}
        canrecruit=yes
        controller=human
        gold={GOLD}
        income={INCOME}
        {SIDE_WML}
    [/side]	# wmllint: validate-on
#enddef

#define SIDE_COMPUTER SIDE TEAM DESCRIPTION GOLD INCOME SIDE_WML AI_WML
    # Defines a multiplayer side in a scenario that is controllad by
    # the computer.
    #
    # For example, we can set side 4 to be a computer belonging to
    # team "Evil Guys" starting with 666g and 999 income.
    # We also make it more aggressive:
    #! {SIDE_COMPUTER 4 "Evil Guys" "Evil One" 666 999 (
    #!    aggression=0.95
    #! )}
    #
    [side]	# wmllint: validate-off
        user_team_name={DESCRIPTION}
        side={SIDE}
        team_name={TEAM}
        canrecruit=yes
        controller=ai
        allow_player=no
        disallow_observers=yes
        gold={GOLD}
        income={INCOME}
        {SIDE_WML}
        [ai]
            {AI_WML}
        [/ai]
    [/side]	# wmllint: validate-on
#enddef

#define NO_MAP_DATA
    # The display code in the game becomes confused if you give it a
    # scenario with no map data (like, a text epilog).  Use this
    # macro to feed it dummy map data that won't actually be used.
    map_data="usage=map
border_size=1

Gg          , Gg          , Gg          , Gg          
Gg          , 1 Gg        , 2 Gg        , Gg          
Gg          , Gg          , Gg          , Gg         
"
#enddef

#define AI_CANT_PLAY SIDES
    # Displays a standard warning at the start of the first AI turn for each
    # given side about the AI not knowing how to play this side properly. Use
    # this to tag sides intended solely for human players in special multiplayer
    # scenarios (ones with shops, custom right-click options and such).
    #
    # Example:
    # ! {AI_CANT_PLAY 1,2,3,4}
    [event]
        name=ai turn
        first_time_only=no

        [if]
            [have_unit]
                side=$side_number

                [and]
                    side={SIDES}
                [/and]
            [/have_unit]

            [variable]
                name=side_$side_number|_ai_warning_displayed
                not_equals=yes
            [/variable]

            [then]
                [message]
                    speaker=narrator
                    message= _ "The computer player might not be able to play side $side_number properly in this scenario. Side $side_number is intended to be played by a human player."
                    image=images/wesnoth-icon.png
                [/message]

                [set_variable]
                    name=side_$side_number|_ai_warning_displayed
                    value=yes
                [/set_variable]
            [/then]
        [/if]
    [/event]
#enddef
