예제 #1
0
void TowerDefenseInstanceScript::TowerDefenseMapInstanceScript::SetupEventData()
{
    Player *player = GetPlayer();
    if(!player)
        return;

    SetEventId(GenerateEventId()); // set the event id
    SetPlayerGUID(player->GetGUIDLow()); // set the player guid 
    SetCurrentWaveId(0); // set the current wave id to zero
    SetBaseHealth(100); // set the base health to 100
    SetResources(GetStartResources()); // set the resources that the player has to starter resources
    SetUnits(0); // set the number of spawned attackers to zero
    SetFinished(false); // set the event to unfinished
    SetEventStatus(TD_EVENT_STATUS_TELEPORT); // Set the event status to started and not running a wave
    Events.Reset();
}
예제 #2
0
void TowerDefenseInstanceScript::TowerDefenseMapInstanceScript::UpdateResources(TDEventUpdateType type, uint32 add)
{
    if(!type || !add)
        return;

    Player *player = GetPlayer();
    if(!player)
        return;

    uint32 currentRes = GetResources();
    uint32 newRes = 0;
    if(type == TD_EVENT_INC){
        newRes = currentRes + add;
    }else{
        newRes = currentRes - add;
    }
    SetResources(newRes);
    RecordLog("TowerDefense: New resources were set: it is now %u.", newRes);
}
예제 #3
0
void TowerDefenseInstanceScript::TowerDefenseMapInstanceScript::DeleteEventData()
{
    Player *player = GetPlayer();
    if(!player)
        return;

    SetEventId(0);
    SetPlayerGUID(0);
    SetCurrentWaveId(0);
    SetBaseHealth(0);
    SetResources(0);
    SetUnits(0);
    SetFinished(false);
    SetEventStatus(TD_EVENT_STATUS_NONE);
    CountDown = 0;
    Events.Reset();
    RecordLog("TowerDefense: the tower defense event for player %s was deleted", player->GetName());
    _player = NULL;
}
예제 #4
0
파일: City.cpp 프로젝트: Daizee/spitfireiii
void NpcCity::Initialize(bool resources, bool troops)
{
	switch (m_level)
	{
	case 1:
		SetResources(55000, 100000, 20000, 20000, 20000);
		SetMaxResources(55000, 100000, 20000, 20000, 20000);
		SetTroops(50, 40, 30, 10, 8);
		SetForts(1000, 0, 0, 0, 0);
		SetupBuildings();
		break;
	case 2:
		SetResources(65000, 200000, 30000, 30000, 30000);
		SetMaxResources(65000, 200000, 30000, 30000, 30000);
		SetTroops(50, 45, 40, 30, 25);
		SetForts(1850, 550, 0, 0, 0);
		SetupBuildings();
		break;
	case 3:
		SetResources(75000, 900000, 75000, 75000, 75000);
		SetMaxResources(75000, 900000, 75000, 75000, 75000);
		SetTroops(200, 160, 65, 40, 60);
		SetForts(2000, 1000, 650, 0, 0);
		SetupBuildings();
		break;
	case 4:
		SetResources(300000, 1600000, 120000, 120000, 120000);
		SetMaxResources(300000, 1600000, 120000, 120000, 120000);
		SetTroops(400, 400, 100, 100, 150);
		SetForts(4500, 1875, 550, 0, 0);
		SetupBuildings();
		break;
	case 5:
		SetResources(450000, 3000000, 180000, 180000, 180000);
		SetMaxResources(450000, 3000000, 180000, 180000, 180000);
		SetTroops(750, 1000, 350, 250, 200);
		SetForts(3750, 1875, 1250, 750, 0);
		SetupBuildings();
		break;
	case 6:
		SetResources(600000, 4000000, 200000, 200000, 200000);
		SetMaxResources(600000, 4000000, 200000, 200000, 200000);
		SetTroops(4000, 1750, 550, 500, 450);
		SetForts(4250, 1500, 1500, 950, 400);
		SetupBuildings();
		break;
	case 7:
		SetResources(800000, 4500000, 500000, 500000, 500000);
		SetMaxResources(800000, 4500000, 500000, 500000, 500000);
		SetTroops(12000, 3000, 750, 800, 750);
		SetForts(5600, 2800, 1850, 1100, 700);
		SetupBuildings();
		break;
	case 8:
		SetResources(1000000, 8000000, 800000, 800000, 800000);
		SetMaxResources(1000000, 8000000, 800000, 800000, 800000);
		SetTroops(15000, 6750, 4000, 3000, 2000);
		SetForts(7200, 3600, 2400, 1440, 900);
		SetupBuildings();
		break;
	case 9:
		SetResources(1200000, 14000000, 550000, 550000, 550000);
		SetMaxResources(1200000, 14000000, 550000, 550000, 550000);
		SetTroops(60000, 18000, 2000, 6750, 2500);
		SetForts(9000, 4500, 3000, 1800, 1125);
		SetupBuildings();
		break;
	case 10:
		SetResources(1500000, 19000000, 600000, 600000, 600000);
		SetMaxResources(1500000, 19000000, 600000, 600000, 600000);
		SetTroops(400000, 0, 0, 0, 0);
		SetForts(11000, 5500, 3666, 2200, 1375);
		SetupBuildings();
		break;
	default:
		SetResources(55000, 100000, 20000, 20000, 20000);
		SetMaxResources(55000, 100000, 20000, 20000, 20000);
		SetTroops(50, 40, 30, 10, 8);
		SetForts(1000, 0, 0, 0, 0);
		SetupBuildings();
		break;
	}
// 	memcpy(&m_maxresources, &m_resources, sizeof(stResources));
// 	memcpy(&m_maxtroops, &m_troops, sizeof(stTroops));
// 	memcpy(&m_maxforts, &m_forts, sizeof(stForts));
}