Exemplo n.º 1
0
int		main(void)
{
	ZombieEvent event = ZombieEvent();
	Zombie* michael = event.newZombie("michael");
	michael->Announce();
	delete michael;
	event.randomChump();
	Zombie julie = Zombie("julie", "runner");
	julie.Announce();
	return (0);
}
Exemplo n.º 2
0
void			wave(ZombieEvent &event, const char *type, int len)
{
	Zombie			*tmp;

	event.setZombieType(type);
	while (len-- > 0)
	{
		tmp = event.newZombie("LAAAL");
		tmp->announce();
		delete tmp;
	}
}
Exemplo n.º 3
0
            void SpellHit(Unit* caster, SpellInfo const* spell)
            {
                if (caster->GetTypeId() == TYPEID_UNIT && spell->Id == SPELL_COUNTER)
                {
                    ++killCounter;
                    ZombieEvent* global;
                    ZombieAI* zombieAI;
                    Creature* zombie = me->FindNearestCreature(NPC_ZOMBIE, 200.0f, true);

                    if (zombie)
                        zombieAI = CAST_AI(ZombieAI, zombie->AI());

                    if (killCounter >= global->GetWaveTotalAmount()) // Wave End
                    {
                        ++waveCounter;
                        killCounter = 0; // Reset amount of zombies killed this wave
                        DespawnTurrets(true); // There shouldn't be any turrets but clear them anyway.

                        // Prepare next wave
                        // Amount of zombies we should spawn
                        if (waveCounter <= 5) // we should go easy on the players on wave 5 and below
                        {
                            global->SetAmountToSpawn(global->GetWaveTotalAmount() + ((waveCounter * urand(7,10)) * 2));
                            global->SetWaveTotalAmount(global->GetAmountToSpawn());
                        }
                        else
                        {
                            global->SetAmountToSpawn(global->GetWaveTotalAmount() + ((waveCounter * urand(9,12)) * 2));
                            global->SetWaveTotalAmount(global->GetAmountToSpawn());
                        }

                        if (zombieAI)
                            zombieAI->zombieMovementSpeed += 0.05f; // Slightly increase the movement speed of zombies in next wave

                        if (urand(0, 1) == 0) // 50% chance to spawn a turret on new wave
                        {
                            int8 t = urand(0, 2);
                            if (urand(0, 1) == 0)
                                me->SummonCreature(NPC_TURRET_P1, TurretPlacePoints[t].GetPositionX(), TurretPlacePoints[t].GetPositionY(), TurretPlacePoints[t].GetPositionZ(), TurretPlacePoints[t].GetOrientation(), TEMPSUMMON_TIMED_DESPAWN, 30000);
                            else
                                me->SummonCreature(NPC_TURRET_P2, TurretPlacePoints[t].GetPositionX(), TurretPlacePoints[t].GetPositionY(), TurretPlacePoints[t].GetPositionZ(), TurretPlacePoints[t].GetOrientation(), TEMPSUMMON_TIMED_DESPAWN, 30000);
                        }
                    }
                    else
                    {
                        // Don't spawn powerups when switching waves
                        if (zombieAI)
                            zombieAI->attemptSpawnPowerUp = true; 
                    }
                }
            }
Exemplo n.º 4
0
int				main(void)
{
	ZombieEvent		event;

	srand(time(NULL));
	std::cout << "OMG! FUS ZOMBIES COMMING" << std::endl;
	wave(event, "FUS", 5);
	std::cout << "OMG! RO ZOMBIES COMMING" << std::endl;
	wave(event, "RO", 5);
	std::cout << "OMG! DA ZOMBIES COMMING" << std::endl;
	wave(event, "DA", 5);
	std::cout << "LOL F****D UP ZOMBIE" << std::endl;
	event.randomChump();
	event.randomChump();
	event.randomChump();
	event.randomChump();
	event.randomChump();
	event.randomChump();
	return (0);
}
Exemplo n.º 5
0
            void StartSpawningZombies()
            {
                for (uint8 i = 0; i < MAX_SPAWNPOINTS; i++)
                {
                    if (!canSpawn[i])
                        continue;
                    
                    if (global->GetAmountToSpawn() <= 0)
                        continue;
 
                    float x = ZombieSpawnPoints[i].GetPositionX() + irand(-4, 4);
                    float y = ZombieSpawnPoints[i].GetPositionY() + irand(-4, 4);
                    float z = ZombieSpawnPoints[i].GetPositionZ();
                    float ground_Z = me->GetMap()->GetHeight(x, y, z, true, MAX_FALL_DISTANCE);
                    if (fabs(ground_Z - z) < 0.1f)
                        z = ground_Z;

                    if (Creature* zombie = me->SummonCreature(NPC_ZOMBIE, x, y, z, ZombieSpawnPoints[i].GetOrientation(), TEMPSUMMON_MANUAL_DESPAWN))
                    {
                        zombie->CastSpell(zombie, SPELL_EMERGE_VISUAL, false);
                        global->SetAmountToSpawn(global->GetAmountToSpawn() -1);
                    }
                }
            }
Exemplo n.º 6
0
int		main(void)
{
	srand(time(0));
	ZombieEvent		eve = ZombieEvent();

	Zombie			*z1 = eve.randomChump();
	eve.setZombieType("SWAAAAAG");
	Zombie			*z2 = eve.randomChump();
	Zombie			*z3 = eve.randomChump();
	eve.setZombieType("Bobo Parisien");
	Zombie			*z4 = eve.randomChump();

	z1->announce();
	z2->announce();
	z4->announce();
	z3->announce();
	delete z1;
	delete z2;
	delete z3;
	delete z4;
	return (0);
}
Exemplo n.º 7
0
 void Reset()
 {
     killCounter = 0;
     waveCounter = 0;
     global->SetWaveTotalAmount(20); // first wave should always start off with 20 zombies.
 }