Subversion Repositories vaca_plus

Rev

Rev 25 | Blame | Compare with Previous | Last modification | View Log | RSS feed

/*
--------------------------------------------------------------------------------
Duke Caribbean: Life's A Beach
By Joris Weimar
© 1997 Sunstorm Interactive
--------------------------------------------------------------------------------
Duke Caribbean: Life's A Beach Plus
By Hendricks266
--------------------------------------------------------------------------------
// CON Files for the 'Duke Carribean Add-on' by SunStorm Interactive
//
// Actor - DRAGON - Sprite #3585
//
// --- Resources ---
//
// Sounds:
// Dragon Dying Sound     - DRAGDIE.WAV
// Dragon Hurt Sound      - DRAGHURT.WAV
// Dragon Roam Sound      - DRAGROAM.WAV
// Dragon Wake-up Sound   - DRAGRECO.WAV
//
// Art:
// 5 * 5 frame(s)         - Dragon Bouncing Animation
// 6 * 1 frame(s)         - Dragon Dying Animation  
// 5 * 2 frame(s)         - Dragon Firing Animation
*/

action DRAGONBOUNCE   0 2 5 1 20
action DRAGONBOUNCE2 10 3 5 1 20
action DRAGONSHOOT   31 2 5 1 40
action DRAGONSHRUNK   0 5 5 1 30
action DRAGONGROW     0 1 5
action DRAGONFROZEN  31 1 5 1
action DRAGONDEAD    30 1 1
action DRAGONDYING   25 6 1 1 12

move DRAGONSPEED 60 0
move DRAGONFLEE  300 0
move DRAGONSTOPPED
move DRAGONBACK  -500 0
move DRAGONSHRUNKSPEED 50 0

ai AIDRAGONFLEE     DRAGONBOUNCE DRAGONFLEE fleeenemy randomangle
ai AIDRAGONBOUNCESEE  DRAGONBOUNCE DRAGONSPEED seekplayer
ai AIDRAGONBOUNCE  DRAGONBOUNCE DRAGONSPEED faceplayer

ai AIDRAGONFLEE2     DRAGONBOUNCE2 DRAGONFLEE fleeenemy randomangle
ai AIDRAGONBOUNCESEE2  DRAGONBOUNCE2 DRAGONSPEED faceplayerslow
ai AIDRAGONBOUNCE2  DRAGONBOUNCE2 DRAGONSPEED faceplayer

ai AIDRAGONSHOOT   DRAGONSHOOT DRAGONSTOPPED faceplayer
ai AIDRAGONSHRUNK  DRAGONBOUNCE DRAGONSHRUNKSPEED fleeenemy randomangle
ai AIDRAGONGROW    DRAGONGROW DRAGONSPEED faceplayer
ai AIDRAGONDYING   DRAGONDYING  DRAGONBACK 
// faceplayer

state dragon_jibs
  state scrap3_colorchange
  debris SCRAP1 20
  debris SCRAP2 22
  debris SCRAP3 22
  debris SCRAP4 22
  debris SCRAP5 22
  getlastpal
  spritepal 0
  state standard_jibs
  getlastpal
ends

state dragongrowstate
  ifcount 32
  {
    state scrap3_colorchange
    debris SCRAP1 20
    debris SCRAP2 22
    debris SCRAP3 22
    debris SCRAP4 22
    debris SCRAP5 22
    getlastpal
    spritepal 0
    guts JIBS4 24
    guts JIBS6 28
    getlastpal
    addkills 1
    sound SQUISHED
    sound PIPEBOMB_EXPLODE
    sound BALLEXPLODE
    hitradius 2048 60 70 80 90
    spawn BLOODPOOL
    spawn EXPLOSION2
    killit
  }
  else
  {
    sizeto 84 100
    break
  }
ends


state dragondeathanglecode
      ifvare vaca_temp3 -1
        {
          getactor[THISACTOR].htang vaca_temp // get the angle of the projectile that hit the dragon
          ifvarg vaca_temp 1024 subvar vaca_temp 1024 else addvar vaca_temp 1024 // turn the angle around to face the projectile

          setvar vaca_temp2 0
          randvar vaca_temp2 128 // randomizes the angle within a certain logical range, since the bullet holes are facing the player
          ifrnd 128 addvarvar vaca_temp vaca_temp2 else subvarvar vaca_temp vaca_temp2

          getactor[THISACTOR].ang vaca_temp3 // pass this along to EVENT_ANIMATESPRITES

          setactor[THISACTOR].ang vaca_temp // sets the angle, just in time for movement
        }
ends

state DRAGONBOUNCESTATESEE
  ifbulletnear ai AIDRAGONFLEE

  ifai AIDRAGONBOUNCESEE
    {
    ifactioncount 2
      {
      sound DRAGONROAM
      ai AIDRAGONBOUNCESEE2
      }
    }
    else ifactioncount 3 ai AIDRAGONBOUNCESEE

  ifpdistl 6000
    {
    ifrnd 5
      ifp palive
        ai AIDRAGONSHOOT
   }

  ifcansee nullop else ai AIDRAGONBOUNCE
ends

state DRAGONBOUNCESTATE
  ifai AIDRAGONBOUNCE
    {
      ifactioncount 2
        {
          sound DRAGONROAM
          ai AIDRAGONBOUNCE2
        }
    }
  else
    {
      ifactioncount 3 ai AIDRAGONBOUNCE
    }

  ifcansee 
    ifrnd 64
      ifcanshoottarget
        {
          ifp palive ai AIDRAGONSHOOT
          else ai AIDRAGONBOUNCESEE
        }
ends


state DRAGONSHOOTSTATE
      ifcount 8 nullop
 else ifcount 7
        {
          shoot RPG
          sound DRAGONSHOOTING
        }

 ifactioncount 2
   {
     ifrnd 100
       {
         ifcansee nullop else ai AIDRAGONBOUNCESEE // This line should make the dragon smarter.
         resetcount
         resetactioncount
       }
     else
       {
         ai AIDRAGONBOUNCESEE
         resetcount
         resetactioncount
       }
   }
ends

state DRAGONHITSTATE
   ifdead
     {
       state random_wall_jibs
 
       ifwasweapon GROWSPARK
         {
           sound ACTOR_GROWING
           ai AIDRAGONGROW
           break
         }
 
      ifwasweapon FREEZEBLAST
        {
          sound SOMETHINGFROZE
          spritepal 1
          move 0
          action DRAGONFROZEN
          strength 0
          break
        }
       addkills 1
 
      ifwasweapon RADIUSEXPLOSION
        {
          sound SQUISHED
          state dragon_jibs
          killit
        }
 else ifwasweapon RPG
        {
          sound SQUISHED
          state dragon_jibs
          killit
        }
      else
        {
          state dragondeathanglecode
          ai AIDRAGONDYING
        }

      sound BALLEXPLODE
     }
   else
     {
       sound DRAGONPAIN
       state random_wall_jibs
       debris SCRAP3 5

       ifwasweapon SHRINKSPARK
         {
           sound ACTOR_SHRINKING
           ai AIDRAGONSHRUNK
         }
  else ifwasweapon GROWSPARK sound EXPANDERHIT
  else ifrnd 64 ifai AIDRAGONSHOOT nullop else ai AIDRAGONSHOOT
     }
ends

state DRAGONFLEESTATE
  ifai AIDRAGONFLEE
    {
      ifactioncount 2
        {
          sound DRAGONROAM
          ai AIDRAGONFLEE2
        }
    }
  else
    {
      ifactioncount 3 ai AIDRAGONFLEE
    }

  ifrnd 15 ai AIDRAGONBOUNCE
ends

state DRAGONSHRINKSTATE
  ifcount SHRUNKDONECOUNT ai AIDRAGONBOUNCE
  else
    ifcount SHRUNKCOUNT
      sizeto 42 50
  else
    state genericshrunkcode
ends


state DRAGONDYINGSTATE
  ifactioncount 6
    {
      state rf
      iffloordistl 8 sound THUD
      action DRAGONDEAD
      move DRAGONSTOPPED
      break
    }
  else move DRAGONBACK
// Note: Because of the way actioncounts work, "ifactioncount" really asks if it is at that value or greater.
//       That's why we have to put bigger ones first, with "else" statements.
ends

useractor enemy DRAGON DRAGONSTRENGTH DRAGONBOUNCE
  fall
  cstator 257
  setactor[THISACTOR].mdflags 16

  ifai 0
  {
    setvar vaca_temp3 -1
    ai AIDRAGONBOUNCE
  }

   state checksquished

      ifaction DRAGONDEAD
        {
          cstat 0
          ifrespawn
            ifcount RESPAWNACTORTIME
              {
                spawn TRANSPORTERSTAR
                cstat 257
                strength DRAGONSTRENGTH
                setvar vaca_temp3 -1
                ai AIDRAGONBOUNCE
              }
            else
              {
                strength 0
                ifhitweapon
                  ifwasweapon RADIUSEXPLOSION
                    {
                      sound BALLEXPLODE
                      state dragon_jibs
                      killit
                    }
                break
              }
        }
 else ifaction DRAGONFROZEN
        {
         // setactor[THISACTOR].mdflags 2
          ifcount THAWTIME
            {
              ai AIDRAGONBOUNCE
              getlastpal
            }
     else ifcount FROZENDRIPTIME ifrnd 8 spawn WATERDRIP

          ifhitweapon
            {
              ifwasweapon FREEZEBLAST
                {
                  strength 0
                  break
                }
              addkills 1
      
              lotsofglass 30
              ifrnd 84 spawn BLOODPOOL
              sound GLASS_BREAKING
              killit
            }
          ifp pfacing
            ifpdistl FROZENQUICKKICKDIST
              pkick
          break
        }

     ifai AIDRAGONDYING
       {
         state DRAGONDYINGSTATE
         break
       }

  ifhitweapon
    state DRAGONHITSTATE

      ifai AIDRAGONGROW state dragongrowstate
 else ifai AIDRAGONSHRUNK state DRAGONSHRINKSTATE
 else
  {
    sizeat 42 50
      ifai AIDRAGONBOUNCESEE state DRAGONBOUNCESTATESEE
 else ifai AIDRAGONBOUNCE state DRAGONBOUNCESTATE
 else ifai AIDRAGONSHOOT state DRAGONSHOOTSTATE
 else ifai AIDRAGONFLEE state DRAGONFLEESTATE
 else ifai AIDRAGONFLEE2 state DRAGONFLEESTATE
 else ifai AIDRAGONBOUNCESEE2 state DRAGONBOUNCESTATESEE
 else ifai AIDRAGONBOUNCE2 state DRAGONBOUNCESTATE
  }
enda

useractor notenemy DRAGONDEATH 0
  setvar vaca_temp3 -1
  setactor[THISACTOR].mdflags 16

  addvar vaca_temp 1
  ifvare vaca_temp 1
  {
    getplayer[THISACTOR].i vaca_temp2 // get the player's ID

    // get the coordinates of the player and dragon
    getactor[vaca_temp2].x vaca_x2
    getactor[vaca_temp2].y vaca_y2
    getactor[THISACTOR].x vaca_x
    getactor[THISACTOR].y vaca_y 

    subvarvar vaca_x2 vaca_x
    subvarvar vaca_y2 vaca_y
    getangle vaca_y vaca_x2 vaca_y2 // calculates the angle to face the player

    setactor[THISACTOR].htang vaca_y
  }
  ifvare vaca_temp 26
  {
    setvar vaca_temp 0
    getactor[THISACTOR].x vaca_x
    subvar vaca_x 1536
    setactor[THISACTOR].x vaca_x
    sizeat 42 50
    state random_wall_jibs
    sound BALLEXPLODE
    cactor DRAGON
    state dragondeathanglecode
    ai AIDRAGONDYING
  }
enda