//No non-evil aligned sword users here...
IfGrabbed
  SetTargetToWhoeverIsHolding
  tmpargument = [EVIL]
  IfTargetHasSpecialID
    SetTargetToOldTarget
  Else
    DetachFromHolder  
    tmpargument = rand & 1095 + 0548
    DamageTarget
    tmpargument = 3
    SendMessageNear
    tmpargument = 4
    tmpdistance = 15000
    PlaySound

// ZZ> This function makes an item fall to the floor when spawned
IfSpawned				//
  SetTargetToSelf
  tmpargument = ACTIONJB		  //
  DoAction				  //
  KeepAction				  //
  MakeCrushValid
IfCrushed
  tmpx = selfx
  tmpy = selfy
  tmpdistance = selfz
  tmpargument = 1
  SpawnExactParticle
  SpawnExactParticle
  SpawnExactParticle
  SpawnExactParticle
  GoPoof
  tmpargument = 1
  SendMessageNear
IfDropped				// Make it lie on floor
  GetContent
  tmpx = tmpargument
  tmpy = 255
  IfXIsMoreThanY
    tmpargument = 255
    SetContent
  SetTargetToSelf
  KeepAction				  //
IfHitGround				// Make a sound
  tmpargument = 1			  //
  tmpdistance = rand & 2047 + 10000	  //
  PlaySound				  //
IfTakenOut				// Make a sound
  tmpargument = 2			  //
  tmpdistance = rand & 2047 + 10000	  //
  PlaySound				  //
  SetTargetToWhoeverIsHolding		  //
  IfTargetIsAPlayer			  //
    tmpargument = 2			  //
    SendMessageNear			  //
IfGrabbed				// Tell them what they've won...
  SetTargetToWhoeverIsHolding		  //
  IfTargetIsAPlayer			  //
    tmpargument = 0			  //
    SendMessageNear			  //


// Charge the Sword
IfTargetIsAttacking
  tmpargument = RED
  SparkleIcon


  GetContent
  tmpx = tmpargument + 4
  tmpy = 256
  IfXIsMoreThanY
    tmpx = 256
  tmpargument = tmpx
  SetContent
  tmpy = 4
  IfXIsEqualToY
    // Start charge sound
    tmpargument = 3
    tmpdistance = 11025
    PlaySound


// Unleash the power of the Sword
IfUsed
  GetContent
  tmpx = tmpargument
  tmpy = 256
  IfXIsEqualToY
    // Fully charged sound
    tmpargument = 4
    tmpdistance = 15000
    PlaySound
    UnsparkleIcon


    // magic stuff
    tmpx = targetx
    tmpy = targety
    tmpdistance = targetz

  tmpargument = 0
  SetContent



// effects depending on charge
GetContent
tmpx = tmpargument
tmpy = rand & 255
IfXIsMoreThanY
  tmpargument = 2
  tmpx = 0
  tmpy = 0
  tmpdistance = rand % 9 // Pick a vertex along the blade ( look at model )
  SpawnParticle




 
End					// All done
