#textdomain wesnoth-ai
[test]
id=bottleneck_defense
name= _ "Bottleneck Defense"
next_scenario=micro_ai_test
map_data="{ai/micro_ais/maps/bottleneck_defense.map}"
{DEFAULT_SCHEDULE}
turns=-1
victory_when_enemies_defeated=no
[side]
side=1
controller=ai
id=LuaAI
type=Lieutenant
defeat_condition=no_units_left
persistent=no
canrecruit=yes
recruit=Spearman,Bowman
gold=125
[unit]
type=White Mage
x,y=23,6
[/unit]
[/side]
[side]
side=2
controller=ai
type=Orcish Leader
id=Big Bad Orc
name= _ "Big Bad Orc"
persistent=no
canrecruit=yes
recruit=Orcish Archer,Orcish Grunt
gold=400
[ai]
aggression=1.0
[/ai]
[/side]
[side] # This side is only here because we need one persistent side for the game to go on
side=3
controller=null
persistent=yes
save_id=Grnk
hidden=yes
[/side]
[event]
name=prestart
{VARIABLE scenario_name bottleneck_defense}
# Set up the Bottleneck Defense Micro AI
[micro_ai]
side=1
ai_type=bottleneck_defense
action=add
x=14,14,14
y= 7, 9, 8
enemy_x=13,13
enemy_y= 8, 9
healer_x=14,14,15,15
healer_y= 7, 9, 8, 9
leadership_x=14,14,15,15
leadership_y= 7, 9, 9 ,8
active_side_leader=yes
[/micro_ai]
[/event]
[event]
name=start
{MESSAGE LuaAI "" "" _"All right, chaps. Those orcs need to be stopped."}
{STORE_UNIT_VAR (id=Big Bad Orc) profile profile}
{MESSAGE (Big Bad Orc) "$profile~FL()~RIGHT()" "" _"They there! We them get!"}
{CLEAR_VARIABLE profile}
# wmllint: unbalanced-on
{MESSAGE LuaAI "" "" _"We need to hold that pass for as long as we can. Let's put our strongest fighters on the front line and bring injured units to the back for healing. If we're careful enough, we might even win this battle. I'll join you as soon as I'm done recruiting and do my share of the fighting.
Note: The Bottleneck Defense AI is coded as a Micro AI. A Micro AI can be added and adapted to the need of a scenario easily using only WML and the [micro_ai] tag. Check out the Micro AI wiki page at http://wiki.wesnoth.org/Micro_AIs for more information."}
# wmllint: unbalanced-off
# wmllint: local spellings AIs RCA
[message]
speaker=narrator
caption= _ "Question for the Player"
image=wesnoth-icon.png
message= _ "In this scenario, the AI playing the humans in the east is instructed to form a defensive line at the pass and hold off the orcs for as long as possible. Do you want to play the orc side or let the default (RCA) AI do that?"
[option]
message= _ "I'll watch the two AIs fight it out."
[/option]
[option]
message= _ "I'll play the orcs."
[command]
[modify_side]
side=2
controller=human
[/modify_side]
[/command]
[/option]
[/message]
[objectives]
summary= _ "Take the pass"
[objective]
description= _ "Defeat all humans"
condition=win
[/objective]
[objective]
description= _ "Death of Big Bad Orc"
condition=lose
[/objective]
[objective]
description= _ "Only one orc remains"
condition=lose
[/objective]
[/objectives]
[/event]
# White Mage has to hang out at keep for one turn
[event]
name=side 1 turn 1 refresh
{MODIFY_UNIT (type=White Mage) moves 0}
[/event]
# When leader dies: message, then keep fighting
[event]
name=last_breath
[filter]
id=LuaAI
[/filter]
[if]
[have_unit]
side=1
[/have_unit]
[then]
{MESSAGE LuaAI "" "" _"I may have fallen, but we will continue to defend the pass to the last man!"}
[/then]
[/if]
[/event]
# When the last unit on one side dies, end the scenario
[event]
name=die
first_time_only=no
[if]
[not] # If all pass defenders have died
[have_unit]
side=1
[/have_unit]
[/not]
[or] # or if all orcs (except their leader) have died
[have_unit]
side=2
count=1
[/have_unit]
[/or]
[then]
[kill]
id=$unit.id
[/kill]
# So that game goes on to next scenario
[modify_side]
side=3
controller=human
[/modify_side]
{MESSAGE narrator "wesnoth-icon.png" "" _"Well, that was that."}
[endlevel]
result=victory
bonus=no
carryover_percentage=0
carryover_report=no
linger_mode=no
[/endlevel]
[/then]
[/if]
[/event]
# Spearmen only advance to Javelineers
[event]
name=recruit
first_time_only=no
[filter]
type=Spearman
[/filter]
{MODIFY_UNIT id=$unit.id advances_to Javelineer}
[/event]
[/test]