name	 	Raven
health		100
type		enemy
nomove		1 1
nodieblink	2
gfxshadow	1
facing		1
death		1
nolife		1
setlayer	1
animationscript	data/scripts/truck.c
takedamagescript data/scripts/blink.c

load		Tomax
load		Xamot
load		ExitD2


anim spawn
	delay	60
	offset	210 260
	jumpframe 1 0 -1.5 0
	frame	data/chars/raven/raven.gif
	frame	data/chars/raven/raven.gif
	@cmd	spawnGun "Tomax" -94 30 -15 1
	@cmd	spawnGun "Xamot" -45 15 0 2
	frame	data/chars/raven/raven.gif


anim idle
	loop    1
	delay	10
	offset	210 260
	frame	data/chars/raven/raven.gif
	@cmd	attack1 -500 0 150 "ANI_ATTACK1"
	frame	data/chars/raven/raven.gif

anim attack1
@script
    void self = getlocalvar("self");

    if( frame == 0){
      void Tomax = getentityvar(self, 1);
      void Xamot = getentityvar(self, 2);
      int TomaxH = getentityproperty(Tomax, "health");
      int XamotH = getentityproperty(Xamot, "health");

      if( TomaxH <= 0 && XamotH <= 0){
        changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW1"));
      } else {
        int r = rand()%30;

        if( r > 0){
          changeentityproperty(self, "animation", openborconstant("ANI_ATTACK2"));
        }
      }
    } 
@end_script
	loop	1
	delay	1
	offset	210 260
	attack	0
	@cmd	dasher 0 0 0
	frame	data/chars/raven/raven.gif
	delay	60
	attack	100 200 200 102 10 0 1 0 15
	@cmd	dasher 0.5 0 -0.5
	frame	data/chars/raven/raven.gif
	@cmd	dasher 0.5 0 0.5
	frame	data/chars/raven/raven.gif
	@cmd	dasher -0.5 0 0.5
	frame	data/chars/raven/raven.gif
	@cmd	dasher -0.5 0 -0.5
	frame	data/chars/raven/raven.gif

anim attack2
@script
    void self = getlocalvar("self");

    if( frame == 0){
      void Tomax = getentityvar(self, 1);
      void Xamot = getentityvar(self, 2);
      int TomaxH = getentityproperty(Tomax, "health");
      int XamotH = getentityproperty(Xamot, "health");

      if( TomaxH <= 0 && XamotH <= 0){
        changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW1"));
      } else {
        int r = rand()%30;

        if( r > 0){
          changeentityproperty(self, "animation", openborconstant("ANI_ATTACK1"));
        }
      }
    } 
@end_script
	loop	1
	delay	1
	offset	210 260
	attack	0
	@cmd	dasher 0 0 0
	frame	data/chars/raven/raven.gif
	delay	60
	attack	100 200 200 102 10 0 1 0 15
	@cmd	dasher -0.5 0 0.5
	frame	data/chars/raven/raven.gif
	@cmd	dasher 0.5 0 -0.5
	frame	data/chars/raven/raven.gif
	@cmd	dasher -0.5 0 -0.5
	frame	data/chars/raven/raven.gif
	@cmd	dasher 0.5 0 0.5
	frame	data/chars/raven/raven.gif

anim follow1
	delay	1
	offset	210 260
	frame	data/chars/raven/raven.gif
	delay	100
	@cmd	dasher 0 0 0
	frame	data/chars/raven/raven.gif
	@cmd	spawnGun "ExitD2" -95 50 -20 3
	frame	data/chars/raven/raven.gif


anim death
	delay	15
	offset	210 260
	frame	data/chars/raven/raven.gif
	frame	data/chars/raven/raven.gif
