//Soldier special abillties:
//LEVEL   ABILLITY
//1     - Weapon Profiency, Defender (100% block rating)
//2     - Critical Strike
//3     - n/a
//4     - n/a
//5     - Sunder Strike
//6     - n/a
//7     - n/a 
//8     - Weapon Mastery
//9     - n/a
//10    - n/a 
//11    - Grogging Hit
//12    - n/a
//13    - n/a
//14    - Hardy
//-----------------------------------------------------------------------------
//Reset
IfSpawned
  tmpargument = 0
  SetState
  SetContent

//-----------------------------------------------------------------------------
//For sunder strikes
IfSpawned
  SetOwnerToTarget
  
//-----------------------------------------------------------------------------
//Damage resist skill
tmpx = selflevel
tmpy = 12            //At least level 14
IfXIsMoreThanY
  tmpargument = selflevel * 24       //Reduce all damage by 1/10 per level
  SetDamageThreshold

//-----------------------------------------------------------------------------
IfHitGround
  tmpargument = 0
  PlaySound

//-----------------------------------------------------------------------------
//Weapon mastery skill
SetTargetToSelf
tmpx = selflevel
tmpy = 6             //Need level 8
IfXIsMoreThanY
  IfScoredAHit
    SetTargetToWhoeverWasHit
    tmpargument = 512           //+2 damage
    DamageTarget
  
//-----------------------------------------------------------------------------
//Critical hit abillity
tmpx = selflevel
tmpy = 0             //Need level 2
IfXIsMoreThanY
  IfScoredAHit
    SetTargetToWhoeverWasHit
    tmpx = rand % 100
    tmpy = selflevel          //1% chance * (level-1)
    IfXIsLessThanY
      tmpargument = 128*selflevel + 128     //0.5 extra damage per level
      DamageTarget
      tmpargument = 10
      PlaySound
      
      //Draw the text
      tmpdistance = 3         //Duration
      tmpargument = 7         //Message 7
      tmpturn = RED           //Message color
      DrawBillboard
  
//-----------------------------------------------------------------------------
//Sunder attack abillity
tmpx = selflevel
tmpy = 3             //Need level 5
IfXIsMoreThanY
  IfScoredAHit
    SetTargetToWhoeverWasHit
    tmpx = rand % 100
    tmpy = selflevel*2          //2% chance per (level-1)
    IfXIsLessThanY
      EnchantTarget
      tmpargument = 12
      PlaySound
      
      //Draw the text
      tmpdistance = 3         //Duration
      tmpargument = 9         //Message 9
      tmpturn = BLUE          //Message color
      DrawBillboard

//-----------------------------------------------------------------------------
//Grog strike abillity
tmpx = selflevel
tmpy = 9            //Need level 11
IfXIsMoreThanY
  IfScoredAHit
    SetTargetToWhoeverWasHit
    GetTargetGrogTime
    tmpx = tmpargument
    tmpy = 0
    IfXIsEqualToY				//Dont stack this with itself
      tmpx = selflevel * 2      //2% per level
      tmpy = rand % 100
      IfXIsMoreThanY
        tmpargument = selflevel>4  //Increases 1 with every 4 levels
        GrogTarget
        tmpargument = 11
        PlaySound
        
        //Draw the text
        tmpdistance = 3         //Duration
        tmpargument = 9         //Message 8
        tmpturn = GREEN         //Message color
        DrawBillboard
      
//-----------------------------------------------------------------------------
// ZZ> Gong sound
IfCleanedUp
  tmpargument = 2
  PlayFullSound

//------------------------------------------------------------------------------
// ZZ> Scream and shout
IfUsed
  tmpargument = 8
  PlaySound

//------------------------------------------------------------------------------
// ZZ> Handle being bored by cheering or sneezing
IfBored
  tmpargument = 6
  SendMessageNear
  tmpargument = 9
  PlaySound
  tmpargument = ACTIONMC
  DoAction

//------------------------------------------------------------------------------
// ZZ> Handle death by sending a message and other stuff
IfKilled
  tmpargument = 7
  PlaySound
  tmpargument = 3
  IfArmorIs
    tmpargument = MESSAGECOSTUME
  Else
    tmpargument = MESSAGEDEATH
  IfTargetIsOnSameTeam
    tmpargument = MESSAGEFRAG
    IfTargetIsSelf
      tmpargument = MESSAGEACCIDENT
  SendMessage

  // Drop goodies
  tmpargument = 1+selflevel*selflevel*100		//The money loss formula
  DropMoney
  DropKeys

  // Make the character body
  tmpargument = 45
  SetBumpHeight

//------------------------------------------------------------------------------
// ZZ> For helper AIs
IfLeaderKilled
  BecomeLeader

//------------------------------------------------------------------------------
// ZZ> Handle being attacked by blocking or countering or running away
IfAttacked
  // Pick either 0 or 7, Parry or Combat
  SetTargetToWhoeverAttacked
  IfTargetIsOnSameTeam
    tmpargument = 3
    PlaySound
    tmpargument = MESSAGEOUCH
    SendMessageNear
  Else
    tmpargument = rand & 1 + 5
    PlaySound

//------------------------------------------------------------------------------
// ZZ> Handle having too much in inventory
IfTooMuchBaggage
  tmpargument = 1
  SendMessageNear
  tmpargument = 4
  PlaySound
  tmpargument = 50
  SetReloadTime

//------------------------------------------------------------------------------
End
//------------------------------------------------------------------------------
