Example #1
0
bool update(void)
{
  bool GotEm, GotEm0, GotEm1, GotEm2, GotEm3;
  MoveGhost(&Ghost0); MoveGhost(&Ghost1); MoveGhost(&Ghost2);
  MoveGhost(&Ghost3); MovePac(&Pac);
  if(BlueCount) TheBlue();
  GotEm0=false; GotEm1=false; GotEm2=false; GotEm3=false;
  if((Pac.bx==Ghost0.bx)&&(Pac.by==Ghost0.by)) { GotEm=true; GotEm0=true; }
  if((Pac.bx==Ghost1.bx)&&(Pac.by==Ghost1.by)) { GotEm=true; GotEm1=true; }
  if((Pac.bx==Ghost2.bx)&&(Pac.by==Ghost2.by)) { GotEm=true; GotEm2=true; }
  if((Pac.bx==Ghost3.bx)&&(Pac.by==Ghost3.by)) { GotEm=true; GotEm3=true; }
  if(GotEm) {
    if(GotEm0) {
      if(Ghost0.lastint==G_SCARED) DoEyes(&Ghost0);
      if(Ghost0.lastint==G_SMART) DoDie();
    }
    if(GotEm1) {
      if(Ghost1.lastint==G_SCARED) DoEyes(&Ghost1);
      if(Ghost1.lastint==G_SMART) DoDie();
    }
    if(GotEm2) {
      if(Ghost2.lastint==G_SCARED) DoEyes(&Ghost2);
      if(Ghost2.lastint==G_SMART) DoDie();
    }
    if(GotEm3) {
      if(Ghost3.lastint==G_SCARED) DoEyes(&Ghost3);
      if(Ghost3.lastint==G_SMART) DoDie();
    }
  }
  if(NumDots==0) {
    WAITING=false; DIED=false;
  }
  //update_window(destw);
  return GotEm;
}
		void MoveInLineOfSight(Unit *who) {
			if (!who || who->GetTypeId() != TYPEID_PLAYER)
				return;

			if (who->GetTypeId() == TYPEID_PLAYER) {
				switch (me->GetAreaId()) {
				case 199: //felstone
					if (CAST_PLR(who)->GetQuestStatus(5216)
							== QUEST_STATUS_INCOMPLETE
							|| CAST_PLR(who)->GetQuestStatus(5229)
									== QUEST_STATUS_INCOMPLETE) {
						me->SummonCreature(11075, 0.0f, 0.0f, 0.0f, 0.0f,
								TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000);
						DoDie();
					}
					break;
				case 200: //dalson
					if (CAST_PLR(who)->GetQuestStatus(5219)
							== QUEST_STATUS_INCOMPLETE
							|| CAST_PLR(who)->GetQuestStatus(5231)
									== QUEST_STATUS_INCOMPLETE) {
						me->SummonCreature(11077, 0.0f, 0.0f, 0.0f, 0.0f,
								TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000);
						DoDie();
					}
					break;
				case 201: //gahrron
					if (CAST_PLR(who)->GetQuestStatus(5225)
							== QUEST_STATUS_INCOMPLETE
							|| CAST_PLR(who)->GetQuestStatus(5235)
									== QUEST_STATUS_INCOMPLETE) {
						me->SummonCreature(11078, 0.0f, 0.0f, 0.0f, 0.0f,
								TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000);
						DoDie();
					}
					break;
				case 202: //writhing
					if (CAST_PLR(who)->GetQuestStatus(5222)
							== QUEST_STATUS_INCOMPLETE
							|| CAST_PLR(who)->GetQuestStatus(5233)
									== QUEST_STATUS_INCOMPLETE) {
						me->SummonCreature(11076, 0.0f, 0.0f, 0.0f, 0.0f,
								TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000);
						DoDie();
					}
					break;
				}
			}
		}
        void MoveInLineOfSight(Unit* who) override
        {
            if (!who)
                return;

            Player* player = who->ToPlayer();
            if (!player)
                return;

            switch (me->GetAreaId())
            {
                case 199:                                   //felstone
                    if (player->GetQuestStatus(5216) == QUEST_STATUS_INCOMPLETE ||
                        player->GetQuestStatus(5229) == QUEST_STATUS_INCOMPLETE)
                    {
                        me->SummonCreature(11075, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000);
                        DoDie();
                    }
                    break;
                case 200:                                   //dalson
                    if (player->GetQuestStatus(5219) == QUEST_STATUS_INCOMPLETE ||
                        player->GetQuestStatus(5231) == QUEST_STATUS_INCOMPLETE)
                    {
                        me->SummonCreature(11077, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000);
                        DoDie();
                    }
                    break;
                case 201:                                   //gahrron
                    if (player->GetQuestStatus(5225) == QUEST_STATUS_INCOMPLETE ||
                        player->GetQuestStatus(5235) == QUEST_STATUS_INCOMPLETE)
                    {
                        me->SummonCreature(11078, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000);
                        DoDie();
                    }
                    break;
                case 202:                                   //writhing
                    if (player->GetQuestStatus(5222) == QUEST_STATUS_INCOMPLETE ||
                        player->GetQuestStatus(5233) == QUEST_STATUS_INCOMPLETE)
                    {
                        me->SummonCreature(11076, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000);
                        DoDie();
                    }
                    break;
            }
        }