//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     - Weapon Mastery
//8     - n/a
//9     - n/a
//10    - Grogging Hit
//11    - n/a
//12    - n/a
//13    - Hardy
//-----------------------------------------------------------------------------
//Reset
IfSpawned
  tmpargument = 0
  SetState
  SetContent

//-----------------------------------------------------------------------------
//For sunder strikes
IfSpawned
  SetOwnerToTarget
  
//-----------------------------------------------------------------------------
//Damage resist skill
tmpx = selflevel
tmpy = 11            //At least level 13
IfXIsMoreThanY
  IfAttacked
    tmpargument = selflevel > 2
    tmpargument = tmpargument * 128       //Reduce all damage by 1/2 per 4 levels
    HealSelf
  
//-----------------------------------------------------------------------------
IfHitGround
  tmpargument = 0
  PlaySound

//-----------------------------------------------------------------------------
//Weapon mastery skill
SetTargetToSelf
tmpx = selflevel
tmpy = 5             //Need level 7
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*2          //2% chance * (level-1)
    IfXIsLessThanY
      tmpargument = 128*selflevel + 128     //0.5 extra damage per level
      DamageTarget
      tmpargument = 10
      PlaySound
      tmpargument = 7
      SendMessage
      

//-----------------------------------------------------------------------------
//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
      tmpargument = 9
      SendMessage

//-----------------------------------------------------------------------------
//Grog strike abillity
tmpx = selflevel
tmpy = 8            //Need level 10
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 = 8
        SendMessage
        tmpargument = 11
        PlaySound
      
//-----------------------------------------------------------------------------
// 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
//------------------------------------------------------------------------------
