<?xml version="1.0" encoding="utf-8"?>

<puzzle>
   <!-- team include(s), max of 2 per puzzle -->
   <includeTeam>humans</includeTeam>
   <!-- board spec -->
   <board>
      <Art gridOffsetX="-2.0" gridOffsetY="0.0">GameBoard02.pvr</Art>
      <deployZone>
         <tile x="0" y="1"/>
         <tile x="0" y="3"/>
      </deployZone>
      <preplace name="knight" x="3" y="1" player ="0"/>
      <preplace name="archer" x="3" y="0" player ="0"/>
      <preplace name="wizard" x="2" y="2" player ="0"/>
      <preplace name="cleric" x="6" y="0" player ="1"/>              
      <preplace name="wizard" x="5" y="2" player ="1"/>       
   </board>
   <!-- tile spec -->
   <tileAllocation randomize="false">
      <tile name="weapon">1</tile>
      <tile name="armor">1</tile>
   </tileAllocation>
   <script>
      <onStart>
         <hideUI name="SubmitButton"/>
         <hideUI name="TileChest"/>
         <hideUI name="SettingsButton"/>         
         <showDialog name="welcome" tapToClose="true" closeTag="OK1" showTapIcon="true">Tutorial_4_01</showDialog>
      </onStart>
      <onNamedTag tagName="OK1">
         <hideDialog name="welcome"/>
         <showArrow grid="TileRack" slotX="0" slotY="0" orientation="Down"/>          
         <showDialog name="equip1" vAlign="Top" background="TutorialBubble02.png">Tutorial_4_02</showDialog>
      </onNamedTag>
      <onUnitEquipped count="1">
         <hideArrow/> 
         <hideDialog name="equip1"/>
         <showDialog name="equip2" vAlign="Top" background="TutorialBubble02.png">Tutorial_4_03</showDialog>
      </onUnitEquipped>
      <onUnitEquipped count="2">
         <sendTag tagName="equipped"/>
         <hideDialog name="equip2"/>
         <showDialog name="doneequip" tapToClose="true" closeTag="OK2" showTapIcon="true">Tutorial_4_04</showDialog>
      </onUnitEquipped>
      <onNamedTag tagName="OK2">
         <sendTag tagName="Winning"/>
         <hideDialog name="doneequip"/>
         <showDialog name="taketurns" vAlign="Top" background="TutorialBubble02.png">Tutorial_4_05</showDialog>
      </onNamedTag>
      <onAPRemaining count="0">
         <hideAllDialogs/>
         <showDialog name="submit" vAlign="Top" background="TutorialBubble02.png">Tutorial_4_06</showDialog>
         <showUI name="SubmitButton"/>
         <showArrow uiElement="SubmitButton" orientation="Down"/>
      </onAPRemaining>
      <onSubmit>
         <hideArrow/>           
         <hideAllDialogs/>
         <victory/>
      </onSubmit>
      <untilTag tagName="Winning">
         <onAPRemaining count="0">
            <hideAllDialogs/>
            <hideArrow/>
            <showDialog name="fail" tapToClose="true" closeTag="reset" showTapIcon="true">Tutorial_Error_NoAP</showDialog>
         </onAPRemaining>
         <onNamedTag tagName="reset">
            <reset/>
         </onNamedTag>
      </untilTag>
      <onUndo>
         <reset/>
      </onUndo>
   </script>
</puzzle>
