예제 #1
0
void ai_boss_misery(Object *o)
{
  /*debug("state: %d", o->state);
  debug("timer: %d", o->timer);
  debug("timer2: %d", o->timer2);*/

  switch (o->state)
  {
    // fight begin and default/base state
    case STATE_FIGHTING:
    {
      o->flags |= FLAG_SHOOTABLE;
      o->savedhp = o->hp;

      o->timer    = 0;
      o->frame    = 0;
      o->xinertia = 0;
      o->state++;
    }
    case STATE_FIGHTING + 1:
    {
      FACEPLAYER;

      o->yinertia += (o->y < o->ymark) ? 0x20 : -0x20;
      LIMITY(0x200);

      if (++o->timer > 200 || (o->savedhp - o->hp) >= 80)
      {
        o->state = STATE_FLASH_FOR_SPELL;
        o->timer = 0;
      }
    }
    break;
  }

  run_spells(o);
  run_teleport(o);

  run_intro(o);
  run_defeated(o);

  LIMITX(0x200);
  LIMITY(0x400);
}
예제 #2
0
void ai_ballos_priest(Object *o)
{
	//AIDEBUG;
	//debug("timer3: %d", o->timer3);
	
	/*if (o->state < 1000)
	{
		FindObjectByID2(500)->Delete();
		StartScript(900);
		return;
	}*/
	
	run_intro(o);
	run_defeated(o);
	
	run_flight(o);
	run_lightning(o);
	
	switch(o->state)
	{
		// show "ninja" stance for "timer" ticks,
		// then prepare to fly horizontally
		case BP_FIGHTING_STANCE:
		{
			o->frame = 1;
			o->animtimer = 0;
			o->state++;
			
			o->damage = DMG_NORMAL;
			o->savedhp = o->hp;
		}
		case BP_FIGHTING_STANCE+1:
		{
			ANIMATE(10, 1, 2);
			FACEPLAYER;
			
			if (--o->timer < 0 || (o->savedhp - o->hp) > 50)
			{
				if (++o->timer3 > 4)
				{
					o->state = BP_LIGHTNING_STRIKE;
					o->timer3 = 0;
				}
				else
				{
					o->state = BP_PREPARE_FLY_LR;
					o->timer2 = 0;
				}
			}
		}
		break;
		
		// prepare for flight attack
		case BP_PREPARE_FLY_LR:
		case BP_PREPARE_FLY_UD:
		{
			o->timer2++;
			o->state++;
			
			o->timer = 0;
			o->frame = 3;	// fists in
			o->damage = DMG_NORMAL;
			
			// Fly/UD faces player only once, at start
			FACEPLAYER;
		}
		case BP_PREPARE_FLY_LR+1:
		{
			FACEPLAYER;
		}
		case BP_PREPARE_FLY_UD+1:
		{
			// braking, if we came here out of another fly state
			o->xinertia *= 8; o->xinertia /= 9;
			o->yinertia *= 8; o->yinertia /= 9;
			
			if (++o->timer > 20)
			{
				sound(SND_FUNNY_EXPLODE);
				
				if (o->state == BP_PREPARE_FLY_LR+1)
				{
					o->state = BP_FLY_LR;		// flying left/right
				}
				else if (player->y < (o->y + (12 << CSF)))
				{
					o->state = BP_FLY_UP;		// flying up
				}
				else
				{
					o->state = BP_FLY_DOWN;		// flying down
				}
			}
		}
		break;
	}
	
	// his bounding box is in a slightly different place on L/R frames
	if (o->dirparam != o->dir)
	{
		sprites[o->sprite].bbox = sprites[o->sprite].frame[0].dir[o->dir].pf_bbox;
		o->dirparam = o->dir;
	}
}