define CANNONBALL 3627

// RIOT TANK with Pigcop inside

define TANK 3590
define TANKSTRENGTH           400          // 2 3 4 5 7 8
//                   off-set, numofframes, numofrot, skipframes, delay
action ATANKSPIN   0 1 7 1 4
action ATANKSHOOTING 7 2 7 1 10
action ATANKWAIT 0 1 7 1 1
action ATANKDESTRUCT 0 1 7 1 1
action ATANKDEAD 0 1 7 1 1
// move TANKVEL horiz vert
move TANKFORWARD 100
move TANKSTOP

actor TANK TANKSTRENGTH fall

    ifaction 0
    {
        sizeat 48 48
        action ATANKWAIT
    }
    else ifaction ATANKSPIN
        { ifactioncount 32 { move TANKSTOP geth action ATANKSHOOTING }
          else ifactioncount 1 { sound INTRUDER_ALERT }

          ifrnd 16 { move TANKFORWARD faceplayerslow }
        }
    else ifaction ATANKSHOOTING
    {
        ifactioncount 6 { resetcount move 0 action ATANKWAIT }
        else ifactioncount 2 { sound PRED_ATTACK ifrnd 128 { shoot FIRELASER } }
        ifrnd 16 { move TANKSTOP geth faceplayerslow }
    }
    else ifaction ATANKWAIT
        {
        ifactioncount 32 { move TANKFORWARD geth action ATANKSPIN }
        }
    else ifaction ATANKDESTRUCT
    {
     ifactioncount 64 { action ATANKDEAD }
     else ifactioncount 56 { sound LASERTRIP_ARMING }
     else ifactioncount 48 { sound LASERTRIP_ARMING }
     else ifactioncount 32 { sound LASERTRIP_ARMING }
     else ifactioncount 16 { sound LASERTRIP_ARMING }
    }
    else ifaction ATANKDEAD
     { addkills 1
       hitradius 4096 WEAKEST WEAK MEDIUMSTRENGTH TOUGH
       sound LASERTRIP_EXPLODE
       debris SCRAP1 15
       spawn EXPLOSION2
       ifrnd 128 spawn PIGCOP
       killit
     }

    ifhitweapon
    {
      ifdead { action ATANKDEAD }
      else { ifwasweapon SHOTSPARK1 { sound PISTOL_RICOCHET
             // addstrength 6
             break }
             else { debris SCRAP1 1 }
           }
    }

    ifpdistl 1024
    { ifhitspace
      { ifp pfacing
       ifcanshoottarget { break }
       else { action ATANKDESTRUCT }
      }
    }

enda

// ifp pfacing palive
// ifcanshoottarget  // dont use alot. uses hitscan
// actioncount = reset when action called
// count       = reset when move called






// CANNON for Pirates of the Carribean

define CANNON 3620
define CANNONSTRENGTH 400
// off-set, numofframes, numofrot, skipframes, delay
action ACANNONWAIT 0 1 7 1 1
action ACANNONSHOOTING 0 1 7 1 1
// move CANNONVEL horiz vert
move CANNONSTOP

actor CANNON CANNONSTRENGTH // fall

    ifaction 0
    {
        sizeat 64 64
        action ACANNONWAIT
    }
    else ifaction ACANNONSHOOTING
    {
//        spawn CANNONBALL
        shoot SHRINKER
        action ACANNONWAIT
    }
    else ifaction ACANNONWAIT
    {
        ifactioncount 64
        { ifrnd 128 { action ACANNONSHOOTING }
          else { resetactioncount }
        }
    }

    ifhitweapon
    {
      ifdead
      {
       addkills 1
       hitradius 4096 WEAKEST WEAK MEDIUMSTRENGTH TOUGH
       spawn EXPLOSION2
       killit
      }
      else { debris SCRAP1 1 }
    }

    ifpdistl 1024
    { ifhitspace
      { ifp pfacing
       ifcanshoottarget
       { shoot SHRINKER }
//        { spawn CANNONBALL killit }
       else { break  }
      }
    }

enda


// CANNONBALL for Pirates of the Carribean

// define CANNONBALL 3627
define CANNONBALLSTRENGTH 400
action ACANNONBALLFLY 0 1 0 1 1
move CANNONBALL1 100 0
move CANNONBALL2 100 10
move CANNONBALL3 100 20
move CANNONBALL4 100 40
move CANNONBALL5 100 80

actor CANNONBALL CANNONBALLSTRENGTH

    ifaction 0
    {
        sizeat 32 32
        action ACANNONBALLFLY
    }
    else ifaction ACANNONBALLFLY
    {
     ifactioncount 46 { ifactioncount 47 { } else { move CANNONBALL5 geth getv } }
     else
     ifactioncount 44 { ifactioncount 45 { } else { move CANNONBALL4 geth getv } }
     else
     ifactioncount 40 { ifactioncount 41 { } else { move CANNONBALL3 geth getv } }
     else
     ifactioncount 32 { ifactioncount 33 { } else { move CANNONBALL2 geth getv } }
     else
     ifactioncount 16 { ifactioncount 17 { } else { move CANNONBALL1 geth getv } }
    }

    ifhitweapon
    {
      ifdead
      { spawn EXPLOSION2 killit
        hitradius 4096 WEAKEST WEAK MEDIUMSTRENGTH TOUGH
      }
      else { debris SCRAP1 1 }
    }

enda


// CANNONBALLS for Pirates of the Carribean

define CANNONBALLS 3628
define CANNONBALLSSTRENGTH 10
action ACANNONBALLSWAIT 0 1 0 1 1
move CANNONBALLSVEL

actor CANNONBALLS CANNONBALLSSTRENGTH

    ifhitweapon
    {
      ifdead
      { spawn EXPLOSION2 killit
        hitradius 4096 WEAKEST WEAK MEDIUMSTRENGTH TOUGH
      }
      else { debris SCRAP1 1 }
    }

enda

