Ejemplo n.º 1
0
Character::Character(int classType){
	skills_ = NULL;
	inv_ = NULL;
	class_type_ = classType;
	name_ = Class();
	switch( classType ){
		case CLASS_BARBARIAN:
			_BarbarianInit();
			break;
		case CLASS_PALADIN:
			_PaladinInit();
			break;
		case CLASS_ASSASSIN:
			_AssassinInit();
			break;
		case CLASS_WIZARD:
			_WizardInit();
			break;
		case CLASS_RANGER:
			_RangerInit();
			break;
		case CLASS_DRUID:
			_DruidInit();
			break;
		default:
			break;
	}

	max_hp_         = vitality_ * vitality_mod_;
	hp_             = max_hp_;
	attack_power_   = strength_ * power_mod_;
	max_initiative_ = 100;

	skills_ = new Skill*[8];	
	AddSkill(Skill::CreateSkill(skill_ranger_poisonarrow));
	AddSkill(Skill::CreateSkill(skill_ranger_salve));
	AddSkill(Skill::CreateSkill(skill_ranger_strongdraw));
	AddSkill(Skill::CreateSkill(skill_ranger_firstaid));
	AddSkill(Skill::CreateSkill(skill_ranger_cripplingshot));
	AddSkill(Skill::CreateSkill(skill_ranger_preparation));
	AddSkill(Skill::CreateSkill(skill_ranger_magicalarrow));
	AddSkill(Skill::CreateSkill(skill_ranger_steadyshot));
	SetSkill(0, 0);
	SetSkill(1, 1);
	SetSkill(2, 2);
	SetSkill(3, 3);
	SetSkill(4, 4);
	SetSkill(5, 5);
	SetSkill(6, 6);
	SetSkill(7, 7);
	inv_ = new Inventory();
}
Ejemplo n.º 2
0
void Object::DynamicInit() {
  switch (Skill("DynamicInit")) {
    case (2): { // Cyberpunk City
      DynamicInit2();
    } break;
    case (1): { // Dwarven Mine
      DynamicInit1();
    } break;
    default: {
      fprintf(stderr, "Unknown dynamic-type (%d) init requested!\n", Skill("DynamicInit"));
    } break;
  }
  SetSkill("DynamicInit", 0);
}
Ejemplo n.º 3
0
//================================================================================
// Constructor
//================================================================================
CSquad::CSquad()
{
    // Predeterminado
    SetName( "WithoutName" );
    SetMemberLimit( 0 );
    SetTacticalMode( 99 );
    SetStrategie( ENDURE_UNTIL_DEATH );
    SetSkill( 99 );
    SetFollowLeader( false );
    SetLeader( NULL );

    m_nController = NULL;

    // Nos agregamos a la lista
    TheSquads->AddSquad( this );
}
Ejemplo n.º 4
0
void Client::CheckIncreaseTradeskill(int16 bonusstat, int16 stat_modifier, float skillup_modifier, uint16 success_modifier, SkillUseTypes tradeskill)
{
	uint16 current_raw_skill = GetRawSkill(tradeskill);

	if(!CanIncreaseTradeskill(tradeskill))
		return;	//not allowed to go higher.

	float chance_stage2 = 0;

	//A successfull combine doubles the stage1 chance for an skillup
	//Some tradeskill are harder than others. See above for more.
	float chance_stage1 = (bonusstat - stat_modifier) / (skillup_modifier * success_modifier);

	//In stage2 the only thing that matters is your current unmodified skill.
	//If you want to customize here you probbably need to implement your own
	//formula instead of tweaking the below one.
	if (chance_stage1 > zone->random.Real(0, 99)) {
		if (current_raw_skill < 15) {
			//Always succeed
			chance_stage2 = 100;
		} else if (current_raw_skill < 175) {
			//From skill 16 to 174 your chance of success falls linearly from 92% to 13%.
			chance_stage2 = (200 - current_raw_skill) / 2;
		} else {
			//At skill 175, your chance of success falls linearly from 12.5% to 2.5% at skill 300.
			chance_stage2 = 12.5 - (.08 * (current_raw_skill - 175));
		}
	}

	chance_stage2 = mod_tradeskill_skillup(chance_stage2);

	if (chance_stage2 > zone->random.Real(0, 99)) {
		//Only if stage1 and stage2 succeeded you get a skillup.
		SetSkill(tradeskill, current_raw_skill + 1);

		if(title_manager.IsNewTradeSkillTitleAvailable(tradeskill, current_raw_skill + 1))
			NotifyNewTitlesAvailable();
	}

	Log.Out(Logs::Detail, Logs::Tradeskills, "...skillup_modifier: %f , success_modifier: %d , stat modifier: %d", skillup_modifier , success_modifier , stat_modifier);
	Log.Out(Logs::Detail, Logs::Tradeskills, "...Stage1 chance was: %f percent", chance_stage1);
	Log.Out(Logs::Detail, Logs::Tradeskills, "...Stage2 chance was: %f percent. 0 percent means stage1 failed", chance_stage2);
}
Ejemplo n.º 5
0
// Change in focus
void CScreenPlayerSkills::OnFocus(LTBOOL bFocus)
{
	CUserProfile *pProfile = g_pProfileMgr->GetCurrentProfile();
		
	if (bFocus)
	{
		m_nPool = g_pSkillsButeMgr->GetMultiplayerPool();
		for (int i = 0; i < kNumSkills; i++)
		{
			eSkill skl = (eSkill)i;
			if (g_pSkillsButeMgr->IsAvailable(skl) )
			{
				int tgt = pProfile->m_nPlayerSkills[i];
				m_nLevels[i] = 0;
				int old = 0;

				while (old < tgt && SetSkill(i,old+1))
				{
					old++;
				}

			}
		}
		
			
        UpdateData(LTFALSE);
	}
	else
	{
		UpdateData();

		for (int i = 0; i < kNumSkills; i++)
		{
			pProfile->m_nPlayerSkills[i] = m_nLevels[i];
		}

		pProfile->Save();

	}
	CBaseScreen::OnFocus(bFocus);

}
Ejemplo n.º 6
0
static void create() {
    vendor::create();
    SetKeyName("shiela");
    SetId("shiela", "vendor", "shop keeper", "keeper", "shopkeeper");
    SetShort("Shiela, the local weapon vendor");
    SetLong("She buys and sells weapons.");
    SetLevel(15);
    SetRace( "human");
    SetGender("female");
    SetMorality(40);
    SetListen("She has a very gruff voice.");
    AddCurrency("electrum", random(200));
    // the room where she stores stuff to sell
    SetStorageRoom("/domains/Ylsrim"+ "/room/weaponry_storage");
    // How good is she at being a vendor? Should be 100+
    SetSkill("bargaining", 150);
    // This vendor belongs in a particular shop, don't bump her
    SetProperty("no bump", 1);
    // She takes electrum coins
    SetLocalCurrency("electrum");
    // She buys weapons
    SetVendorType(VT_WEAPON);
}
Ejemplo n.º 7
0
uint32 CScreenPlayerSkills::OnCommand(uint32 dwCommand, uint32 dwParam1, uint32 dwParam2)
{
	switch(dwCommand)
	{
	case CMD_SKILLS:
	{
		for (int i = 0; i < kNumSkills; i++)
		{
			eSkill skl = (eSkill)i;
			if (g_pSkillsButeMgr->IsAvailable(skl) )
			{
				SetSkill(i,0);
			}
		}
		UpdateData(LTFALSE);

	} break;

	default:
		return CBaseScreen::OnCommand(dwCommand,dwParam1,dwParam2);
	}

	return 1;
};
Ejemplo n.º 8
0
void isdf07Mission::Execute(void) {

	
/* The following is needed for editing cineractives. */	
	if (BeginCin == true) {
		BeginCin = PlayMove();
	}

	if (BeginSeq == true) {
		char temp[20] = "***";
		BeginSeq = PlayMovie(temp);
	}
	if (IFace_GetFloat("script.cin.edit") == 1.0) {
//		cinToolSetup();
		IFace_SetFloat("script.cin.edit", 0.0);
	}
/* The above is needed for editing cineractives. */



	
	player = GetPlayerHandle();

	//This section evaluates what has happened.
	checkWing(shabayev, player); //Did we hurt our friendly instructor.
	switch (missionState) {
		case 0: //This will do the setup for the mission.
			spawn1 = GetHandle("spawn_1");
			spawn2 = GetHandle("spawn_2");
			spawn3 = GetHandle("spawn_3");
			creature1=BuildObject("mcjak01",0,"creature1");
			creature2=BuildObject("mcjak01",0,"creature2");
			creature3=BuildObject("mcjak01",0,"creature3");
			creature4=BuildObject("mcjak01",0,"creature4");

			shabayev = BuildObject("ivtank",3,"spawn_shab");
			recy = GetHandle("recycler");
			ruins = GetHandle("ruins");
			SetScrap(1, 40);
//			playerEnemy1 = BuildObject("fvtank", 2, spawn3);
//			Attack(playerEnemy1, player, 1);
			CommandShab();
			AudioMessage("isdf0701.wav");
			AudioMessage("isdf0740.wav");
			AudioMessage("isdf0702.wav");
			AudioMessage("isdf0703.wav");
			SetSkill(shabayev,3);
			SendEnemies(0,player);
			{
				// brad added
				int poolHandle = GetHandle(288);
				SpawnBirds(1, 5, "mcwing01", 0, poolHandle, poolHandle);
			}
			missionState++;
			break;
		case 1: //Check to see if the player has deployed their recycler.
			if (!getNewOrder) {
				ClearObjectives();
				AudioMessage("isdf0704.wav");
				AddObjective("isdf0701.otf", WHITE);
				reminderTimer = (GetTime() + 60.0f);
				if (!IsAlive(animal1)) {
					animal1 = BuildObject("mcjak01", 2, spawn3); //This will be changed to the animal
					Goto(animal1, recy);
					SetIndependence(animal1, 0);
				}
				getNewOrder = true;
			}

			//	recyDeployed = IsDeployed(recy);
			if (recyDeployed) {
				AudioMessage("isdf0706.wav");
				missionState++;
				getNewOrder = false;
			}
			if ((IsAlive(playerEnemy1)) && (!enemy1deployed) &&
				(GetDistance(recy,playerEnemy1)<100.0f))
			{
				enemy1deployed=true;
			}
			if ((!IsAlive(playerEnemy1)) && (!IsAlive(enemy1))) {
				playerEnemy1 = BuildObject("fvtank", comp_team, spawn3);
				Attack(playerEnemy1, player, 1);
			}
			break;
		case 2: //Check to see if the player has built a scavenger.
			if (!getNewOrder) {
				ClearObjectives();
				AddObjective("isdf0702.otf", WHITE);
				reminderTimer = (GetTime() + 60.0f);
				AudioMessage("isdf0708.wav");
				getNewOrder = true;
			}
			if (scavBuilt) {
				AudioMessage("isdf0707.wav");
				reminderTimer = (GetTime() + 30.0f);
				missionState++;
				getNewOrder = false;
			}
			if ((IsAlive(playerEnemy1)) && (!enemy1deployed) &&
				(GetDistance(recy,playerEnemy1)<100.0f))
			{
				enemy1deployed=true;
			}
			if ((!IsAlive(playerEnemy1)) && (!IsAlive(enemy1))) {
				playerEnemy1 = BuildObject("fvtank", 2, spawn3);
				Attack(playerEnemy1, player, 1);
			}

			break;
		case 3: //Check to see if the player has built a construction rig.
			if (!getNewOrder) {
				ClearObjectives();
				AddObjective("isdf0703.otf", WHITE);
				AudioMessage("isdf0710.wav");
				reminderTimer = (GetTime() + 60.0f);
				getNewOrder = true;
			}
			if ((IsAlive(playerEnemy1)) && (!enemy1deployed) &&
				(GetDistance(recy,playerEnemy1)<100.0f))
			{
				enemy1deployed=true;
			}
			if (constBuilt) {
				missionState++;
				getNewOrder = false;
			}
			break;
		case 4: //Check to see if the player has built a power plant.
			if (!getNewOrder) {
				ClearObjectives();
				AddObjective("isdf0704.otf", WHITE);
				AudioMessage("isdf0714.wav");
				reminderTimer = (GetTime() + 60.0f);
				getNewOrder = true;
			}
			if (powerBuilt) {
				missionState++;
				getNewOrder = false;
			}
			if ((!IsAlive(playerEnemy1)) && (!IsAlive(enemy1))) {
				playerEnemy1 = BuildObject("fvtank", 2, spawn3);
				Attack(playerEnemy1, player, 1);

			}

			break;
		case 5:  // check to see if the player has built a relay bunker
			if (!getNewOrder) {
				ClearObjectives();
				AddObjective("isdf0705.otf", WHITE);
				AudioMessage("isdf0716.wav");
				reminderTimer = (GetTime() + 60.0f);
				getNewOrder = true;
			}
			if (relayBuilt) {
				missionState++;
				getNewOrder = false;
			}

			break;
		case 6: //Check to see if the player has built a gun tower
			if (!getNewOrder) {
				ClearObjectives();
				AddObjective("isdf0706.otf", WHITE);
				AudioMessage("isdf0719.wav");
				reminderTimer = (GetTime() + 60.0f);
				getNewOrder = true;
			}
			if (gunTowBuilt) 
			{
				missionState++;
				artil=BuildObject("fvartl",2,"artil");
				Goto(artil,"artillery");
				Handle temp=BuildObject("fvscout",2,spawn2);
				Follow(temp,artil);
				BuildObject("fvscout",2,spawn3);
				Follow(temp,artil);
				artil_counter=0;
				getNewOrder = false;
			}
			break;
		case 7:  // now they will use artillery
			artil_counter++;
			if (artil_counter==300)
			{
				Attack(artil,gtow);
		//		CameraReady();
			}
			if ((artil_counter>300) & (artil_counter<355))
			{
		//		CameraObject(artil,12,8,3,artil);
			}
			if (artil_counter==355)
			{
		//		CameraFinish();
				missionState++;
			}
			// cheesy code but I am tired
			break;
		case 8:
			if (!IsAlive(artil))
			{
				missionState++;
			}
			break;
	
	}
	float currentTime = GetTime();
	if ((reminderTimer < currentTime) && (getNewOrder)) { //This checks to see if we should remind the player of his order.
		getNewOrder = false;
	}
	harrass_count++;
	if (harrass_count%701==0)
	{
		SendEnemies(1,player);
	}
	CommandShab();
	handlePlayerMistakes();
	if (shabState<3) {
		if ((!IsAlive(shabayev) && (!shab_dead)))	
		{
			AudioMessage("isdf0732.wav");
			ClearObjectives();
			AddObjective("isdf05l1.otf",RED,15.0f);
			FailMission(GetTime()+5.0f,"isdf05l1.otf");
			shab_dead=true;
		}
	}

	if ((!IsAround(recy)) && (!shab_dead))
	{
		FailMission(GetTime()+5.0f,"isdf05l1.otf");
		shab_dead=true;
	}


}
Ejemplo n.º 9
0
void Client::ProcessOP_Beg(APPLAYER* pApp)
{
/*	if(pApp->size != sizeof(Beg_Struct))
	{
		cout << "Wrong size on OP_Beg. Got: " << pApp->size << ", Expected: " << sizeof(Beg_Struct) << endl;
		return;
	}*/
	if(pApp->size = sizeof(Beg_Struct))
	{
		Beg_Struct* beg_info = (Beg_Struct*)pApp->pBuffer;
		Message(BLACK,"Begging makes zone a sad panda :( (Our struct is wrong)");
		beg_info->success = 0;
		QueuePacket(pApp);
	}
	else 
	{
	//Yeahlight: Purge client's invisibility
	CancelAllInvisibility();
	
	Beg_Struct* beg_info = (Beg_Struct*)pApp->pBuffer;
	
	Mob* target = entity_list.GetMob(beg_info->target);
	Mob* player = entity_list.GetMob(beg_info->begger);
	
	//Beg_Struct* beg_info = (Beg_Struct*)pApp->pBuffer;
	// Validate Player
	// Added this check to keep people from fudging packets to make
	// mobs attack other through begging.  Flag as a hack also.
	if(this->GetID() != player->GetID())
	{
		cout << "[ hack ]" << this->GetName() << " is begging for another player: ";
		cout << player->GetName() << endl;
		
		// This will make the client not able to beg anymore.
		// Could we send qa packet back with 'beg_info->success = 0?
		// Nah, I'd rather just leave the hackers with a broken client. -neorab

		return;
	}

	// Validate Time
	// Should not be able to send two beg requests within 10 seconds.
	// Flag beg spammers as hackers.  Drop the packet and move on.
	int32 time_to_beg = beg_timer->GetRemainingTime();
	if(time_to_beg != 0) 
	{
		cout << "[ hack ]" << player->GetName() << " is begging to fast. ";
		cout << 10000 - time_to_beg << "ms since last beg." << endl;
		
		// This will make the client not able to beg anymore.
		return;
	}
	beg_timer->Start(10000);

	// Validate Target
	// Should not be able to beg from other players, corpses or pets.
	// Basiclly, the client will have to have the same thing targeted
	// as the packet says they do.  If they target a pet and send a beg
	// packet with the pet as the target, this won't catch it.  But it'll
	// stop the average dumbass forging packets.
	Mob* tmptar = this->GetTarget();
	if((tmptar->GetID() != target->GetID()) || target->IsNPC() != true)
	{
		cout << "[ hack ]" << player->GetName() << " is begging from: " << target->GetName();
		cout << "but has [" << tmptar->GetName() << "] targeted." << endl;
		
		// This will make the client not able to beg anymore.
		return;
	}
	
	// Validate Skill
	// Look the skill up, flag the account for hacks if they don't match.
	int8 beg_skill = this->GetSkill(BEGGING);
	if(beg_skill != beg_info->skill)
	{
		cout << "[ hack ]" << player->GetName() << " is trying to beg at " << beg_info->skill;
		cout << "but is [" << beg_skill << "] skill." << endl;
		
		// This will make the client not able to beg anymore.
		return;
	}


	// Pets.
	// You cannot succeed or crit fail on pets.
	if(target->CastToNPC()->GetOwner() == 0)
	{

		// Roll The Dice for Success
		// the threshold is the number you have to be under to have begged successfully
		//   skill level / 8000 (0 - 4% liner based on skill)
		// + Charisma Modifier (same as skill level) *  active charisma % (20% for ever 51 levels)
		double success_threshold = ((double)beg_skill / 8000) 
			+ (( (int)((double)beg_skill / 51) * 0.20) * ((double)player->GetCHA() / 8500));
		double the_dice = MakeRandomFloat(0.000, 1.000);
		
		if(the_dice <= success_threshold)
		{
			char message[255];
			sprintf(message, "%s says, \"Here %s, take this and LEAVE ME ALONE!\"", target->GetName(), player->GetName());
			Message(WHITE, message);
			beg_info->success = 4;
			if(the_dice == success_threshold)
			{
				beg_info->coins = 2;
			}
			else
			{
				beg_info->coins = 1;
			}
		}

		// Critical Failure =)
		else
		{
			beg_info->success = 0;
			// Random Attack (5% @ 0skill 1% @ 200 skill)
			the_dice = MakeRandomFloat(0.000, 1.000);
			if(the_dice <= (0.05 - (int)((double)beg_skill / 50) * 0.01))
			{
				char message[255];
				sprintf(message, "%s says, \"Beggers like you always bring out the worst in me.\"", target->GetName());
				target->CastToNPC()->AddToHateList(player);
				Message(DARK_RED, message);
			}
		}
	}

	// This is a pet, never allow them to succeed.
	else
	{
		beg_info->success = 0;
	}
	

	// Random Skill-Up
	// This was a bitch skill to learn.  Let's do ~1/2% change to skill up.
	// I'm not using the CheckAddSkill function here because that does not
	// let us control it quite like this.  I really don't believe every
	// skill uses the same formula. -neorab
	int dice = MakeRandomInt(0, 200);
	if(dice <= 1)
	{
		if(GetSkill(BEGGING) < CheckMaxSkill(BEGGING, this->race, this->class_, this->level))
		{
			SetSkill(BEGGING, GetSkill(BEGGING)+1);
		}
	}


	// Save Player Profile
	// The return told the client they got more money, we should save that
	// server side to reflect the extra cash.
	if(beg_info->success != 0)
	{
		AddMoneyToPP(beg_info->coins, 0, 0, 0, false);
	}
	
	QueuePacket(pApp);
}
}
Ejemplo n.º 10
0
void isdf20Mission::Execute(void)
{
/*
	Here is where you put what happens every frame.  
*/


	/*
		LANDSLIDE INFO
		- .bzn has file reslida1.odf
		- Don't forget to delete bin data before you try this
		- Run animation on reslid01.odf
		- Replace it with reslidea1.odf
	*/
	player = GetPlayerHandle();
	char tempstr[128]; 
	Ally(1,3);
	switch (mission_state)
	{
		case 0:
				    // build this stuff at start
		/*	
				Handle recy=BuildObject("ivrecy",1,"Recycler");
				int grp=GetFirstEmptyGroup();
			SetGroup(recy,grp);			
			SetScrap(1,30);
			*/
			// deleted for Nathan
			  /*
			mbike_1=BuildObject("ivmbike",3,"mbike1");
			mbike_2=BuildObject("ivmbike",3,"mbike2");
		    mbike_3=BuildObject("ivmbike",3,"mbike3");
			*/
		    tank_1=BuildObject("ivatank",1,"tank1");  // was atank
			SetGroup(tank_1,0);
			tank_2=BuildObject("ivrckt",1,"tank2");  // was atank
			SetGroup(tank_2,1);
			// serv= BuildObject("ivserv",1,"serv");
			// Set
			//    scav_1=BuildObject("ivscav",1,"scav1");
			//    scav_2=BuildObject("ivscav",1,"scav2");
//			rckt_1=BuildObject("ivrckt",1,"rckt1");
//			rckt_2=BuildObject("ivrckt",1,"rckt2");
			SetGroup(rckt_1,1);
			SetGroup(rckt_2,1);
			serv_1=BuildObject("ivserv",1,"scav1");
			SetGroup(serv_1,2);

			espir_2=BuildObject("ibgtow",comp_team,"base_here");
			esent_1=BuildObject("ivmisl",comp_team,"esentpath1");
			esent_2=BuildObject("ivmisl",comp_team,"esentpath1");
			espir_1=BuildObject("ibgtow",comp_team,"espir1");
			base_1=BuildObject("ibfact",comp_team,"estro1");
			base_2=BuildObject("ibpgen",comp_team,"ekiln1");

			base_3=BuildObject("ibpgen",comp_team,"power_x");  // was eforg1
			base_4=BuildObject("ibcbun",comp_team,"bunker_x");
			espir_3=BuildObject("ibgtow",comp_team,"espir3");
			esent_3=BuildObject("ivscout",comp_team,"esent3");
			esent_4=BuildObject("ivscout",comp_team,"esent4");
			ClearObjectives();
			AddObjective("isdf20a.otf",WHITE,10.0f);
			Patrol(esent_1,"esentpath1");
			Follow(esent_2,esent_1);
			after_briefing= GetTime()+20.0f;
			slide1=GetHandle("unnamed_reslida1");
			//Vector temp=GetPosition(slide1);
			RemoveObject(slide1);

			nav=BuildObject("ibnav",1,"lung2");
			SetObjectiveOn(nav);
			TranslateString2(tempstr, sizeof(tempstr), "Mission2002");  // Rebel Base
			SetObjectiveName(nav,tempstr);
			// SetPosition(slide2??

			/*
				So the mission isn't too slow. 
			*/
			AddHealth(espir_1,-3000);
			AddHealth(espir_2,-3000);
			mission_state++;
			audio=AudioMessage("isdf2021.wav");
			CameraReady();
			break;
		case 1:
			CameraPath("camera1",200,200,player);

//			CameraObject(espir_1,30,20,20,espir_1);
			if (IsAudioMessageDone(audio))
			{
				audio=AudioMessage("isdf2022.wav");
				mission_state++;	
			}
			break;
		case 2 :
			CameraPath("camera2",200,200,espir_2);
			if (IsAudioMessageDone(audio))
			{	
				AudioMessage("isdf2001.wav");
				CameraFinish();
				mission_state++;
			}
			break;
		case 3:  //the attack begins
			
				// after the opening briefing, AI squadron drives to fight sentry units on their own
				if (GetTime() > after_briefing)
				{
				//	Goto(mbike_1,"front_ambush");
				//	Goto(mbike_2,"front_ambush");
				//	Goto(mbike_3,"front_ambush");
				//	Goto(rckt_1,"front_ambush");
				//	Goto(rckt_2,"front_ambush");
					Handle temp=BuildObject("ivscout",comp_team,"lung2");
					Attack(temp,player);
					mission_state++;
				}
			
			break;
		case 4: // Kill the sentries

  			// AI squadron engages sentry units
			if ((GetDistance(tank_1,"front_ambush")<200.0f)  ||
			      (GetDistance(tank_2,"front_ambush")<200.0f)  ||
					(GetDistance(rckt_1,"front_ambush")<200.0f)  ||
					(GetDistance(rckt_2,"front_ambush")<200.0f)  ||
					(GetDistance(player,"front_ambush")<200.0f) )
			{
				/*
				Attack(mbike_1,esent_1);
				Attack(mbike_2,esent_2);
				Attack(mbike_3,esent_1);
				*/
				SetObjectiveOn(esent_1);

				TranslateString2(tempstr, sizeof(tempstr), "Mission2001");  // Rebel
				SetObjectiveName(esent_1,tempstr);
				SetObjectiveOn(esent_2);
				SetObjectiveName(esent_2,tempstr);
		//		Attack(rckt_1,esent_2);
		//		Attack(rckt_2,esent_1);
			}
// once the sentrys are destroyed, AI squadron heads to enemy gun tower and stops
			if ((!IsAlive(esent_1))  &&  (!IsAlive(esent_2)))
			{
				/*
				Goto(mbike_1,"front_ambush");
				Goto(mbike_2,"front_ambush");
				Goto(mbike_3,"front_ambush");
				*/
		//		Goto(rckt_1,"front_ambush");
		//		Goto(rckt_2,"front_ambush");
		//		temp=BuildObject("ivscout",2,"lung2");
		//		Attack(temp,serv_1);
				mission_state++;
			}
			break;
		case 5:  // wait till they get to the tower
			if ((
				(GetDistance(tank_1,"front_ambush")<75.0f)  ||
				(GetDistance(rckt_2,"front_ambush")<75.0f)  ||
				(GetDistance(player,"front_ambush")<75.0f)))
				{
					Handle temp=BuildObject("ivscout",comp_team,"lung2");
					Attack(temp,player);
					AudioMessage("isdf2002.wav"); // use your assault tanks
					ClearObjectives();
					AddObjective("isdf2002.otf",WHITE,20.0f);
					SetObjectiveOn(espir_1);
				TranslateString2(tempstr, sizeof(tempstr), "Mission2003");  // Gun Tower
					SetObjectiveName(espir_1,tempstr);
					//temp=BuildObject("ivscout",2,"lung2");
					//Attack(temp,player);
					mission_state++;
				}
			break;
		case 6: // destroy the tower
// once you destroy the gun tower, AI squadron heads to next gun tower and stops
				if (!IsAlive(espir_1))  
				{
					Goto(mbike_1,"exit1");
					Goto(mbike_2,"exit1");
					Goto(mbike_3,"exit1");
		//			AudioMessage("isdf2003.wav"); // now let's press on to the base
		//			Goto(rckt_1,"exit1");
		//			Goto(rckt_2,"exit1");
		//			temp=BuildObject("ivscout",2,"lung2");
		//			Attack(temp,serv_1);
					mission_state++;
  
				}			
			break;
		case 7:  // now go to the next tower
			if (((GetDistance(tank_1,"exit1")<50.0f)  ||
				(GetDistance(rckt_1,"exit1")<50.0f)  ||
				(GetDistance(player,"exit1")<50.0f))) 
			{
				ClearObjectives();
				AddObjective("isdf2003.otf",WHITE,20.0f);
				AudioMessage("isdf2003.wav");
				mission_state++;
			}
			break;
		case 8:  // until enemy spire is dead
			if (!IsAlive(espir_2))	
			{
//				Attack(mbike_1,base_1);
//				Attack(mbike_2,base_1);
//				Attack(mbike_3,base_1);
				Attack(rckt_1,base_1,0);
				Attack(rckt_2,base_1,0);
				mission_state++;
			}
			break;
		case 9:
			if (!IsAlive(base_1)) 
			{
//				Attack(mbike_1,base_2);
//				Attack(mbike_2,base_2);
//				Attack(mbike_3,base_2);
				AudioMessage("isdf2004.wav");
				Attack(rckt_1,base_2,0);
				Attack(rckt_2,base_2,0);
				mission_state++;
			}

			break;
		case 10:
			if (!IsAlive(base_2))
			{
//				Attack(mbike_1,base_3);
//				Attack(mbike_2,base_3);
//				Attack(mbike_3,base_3);
				Attack(rckt_1,base_3,0);
				Attack(rckt_2,base_3,0);
				mission_state++;
			}
			break;
		case 11:// is the third base dead?
			if (!IsAlive(base_3))  
			{
/*
				Goto(mbike_1,"homebase");
				Goto(mbike_2,"homebase");
				Goto(mbike_3,"homebase");
*/
				Goto(rckt_1,"homebase",0);
				Goto(rckt_2,"homebase",0);
				// keep the player bunched up
				Follow(tank_1,player,0);
				Follow(tank_2,player,0);

				ClearObjectives();
				AddObjective("isdf2004.otf",WHITE,20.0f);
				SetObjectiveOff(nav);
				nav=BuildObject("ibnav",1,"scav2");
				TranslateString2(tempstr, sizeof(tempstr), "Mission2004");  // Rencezvous
				SetObjectiveName(nav,tempstr);
				SetObjectiveOn(nav);
				AudioMessage("isdf2005.wav");
				mission_state++;
			}
			break;
		case 12:
// first ambush launches as soon as you exit enemy base after destroying it
// second ambush comes in from behind
			if  (GetDistance(player,"exit1")<125.0f)
			{		
	  
				  ambush_delay=GetTime()+15.0f;
				  mission_state++;
			}
			break;
		case 13:
			if (GetTime()>ambush_delay) 
			{
				eatank_1=BuildObject("ivtank",comp_team,"eatank1");
				eatank_2=BuildObject("ivtank",comp_team,"eatank2");
				eatank_3=BuildObject("ivmbike",comp_team,"eatank3");
				SetSkill(eatank_1,2);
				SetSkill(eatank_2,2);
				SetSkill(eatank_3,2);
				Attack(eatank_1,player);
				Attack(eatank_2,player);
				Attack(eatank_3,player);
				etank_1=BuildObject("ivtank",comp_team,"etank1");
				etank_2=BuildObject("ivtank",comp_team,"etank2");
				etank_3=BuildObject("ivmbike",comp_team,"etank3");
				earch_1=BuildObject("ivtank",comp_team,"earch1");
				earch_2=BuildObject("ivtank",comp_team,"earch2");
				earch_3=BuildObject("ivmisl",comp_team,"earch3");
				manson= BuildObject("ivatank",comp_team,"manson");
				Attack(etank_1,player);
				Attack(etank_2,player);
				Attack(etank_3,player);
				Attack(earch_1,player);
				Attack(earch_2,player);
				Attack(earch_3,player);
				Attack(manson,player);
				uhoh= GetTime()+20.0f;
				mission_state++;
			}
			break;			
		case 14:
			if (GetTime() > uhoh) 
			{
				AudioMessage("isdf2006.wav");
				AudioMessage("isdf2007.wav");
				ClearObjectives();
				AddObjective("isdf2005.otf",WHITE,20.0f);
				Handle temp=BuildObject("ivapc",comp_team,"lung2");  // now you are screwed
				Attack(temp,player);
//				temp=BuildObject("ivapc",2,"lung2");
//				Attack(temp,player);
				mission_state++;
			}
			break;
		case 15:
			// how do you win??
			if ((!seen_manson) && (GetDistance(player,manson)<200.0f))
			{
				seen_manson=true;
				SetObjectiveOn(manson);
			}
			if (!IsAlive(manson))
			{
				AudioMessage("isdf2010.wav");	
				SucceedMission(GetTime()+10.0f,"isdf20w1.txt");
				mission_state++;
			}

			break;
	}  // switch (mission_state)
	PeriodicAttack();











// once you destroy the second gun tower, AI squadron enters enemy base and levels it

// infinite health and ammo
//    SetCurAmmo(player, 1200);
//    SetCurHealth(player, 3000);

// tells player to head back to base
//  if ((!IsAlive(enemybase))  &&  (!go_home))
//  {
//    AudioMessage("wahoo.wav");
//    go_home=true;
//  }

 

}
Ejemplo n.º 11
0
void Object::DynamicInit1() { // Dwarven mine
  const char* names[] = {"An Entrance to a Large Mining Tunnel",
                         "A Large Mining Tunnel",
                         "A Large Mining Tunnel with a Small Tunnel to One Side",
                         "A Large Mining Tunnel",
                         "A Large Open Chamber",
                         "A Small Mining Tunnel",
                         "A Bend in a Small Mining Tunnel",
                         "A Fork in a Small Mining Tunnel",
                         "A Small Alcove"};
  const char* descs[] = {
      "This tunnel looks to have been carved centuries ago.  It is so well "
      "crafted\n"
      "that you think it will stand as-is for another millenia.\n",
      "This tunnel looks to have been carved centuries ago.  It is so well "
      "crafted\n"
      "that you think it will stand as-is for another millenia.\n",
      "This tunnel looks to have been carved centuries ago.  It is so well "
      "crafted\n"
      "that you think it will stand as-is for another millenia.  Another less\n"
      "well-supported tunnel leads off in another direction.\n",
      "This tunnel looks to have been carved centuries ago.  It is so well "
      "crafted\n"
      "that you think it will stand as-is for another millenia.\n",
      "This is a large natural-looking opening.  Perhaps this is where some of "
      "the\n"
      "miners removed a large vein of ore, or maybe this cavern was just here "
      "due\n"
      "to natural forces before they even got here.  It seems the dwarves have "
      "used\n"
      "this tunnel for more than just mining work - a large cage here looks "
      "well\n"
      "used.\n",
      "This tunnel looks to have been carved quickly.  It looks like it might\n"
      "collapse at any moment.\n",
      "This bend in the tunnel looks to have been carved quickly.  It looks "
      "like it\n"
      "might collapse at any moment.\n",
      "This tunnel fork looks to have been carved quickly.  It looks like it\n"
      "might collapse at any moment.\n",
      "The tunnel comes to an end in a rough opening here.\n"};

  static MOBType* dwarf_miner;
  static MOBType* dwarf_engineer;
  static MOBType* dwarf_guard;
  static MOBType* dwarf_explorer;
  static MOBType* elf_prisoner;
  if (!dwarf_miner) {
    WeaponType* weap;
    ArmorType* arm;

    dwarf_miner = new MOBType(
        "a dwarf miner",
        "{He} looks pissed.",
        "",
        "M",
        7,
        7,
        4,
        5,
        6,
        7,
        2,
        2,
        4,
        3,
        8,
        7,
        500,
        2001);
    dwarf_miner->Skill("Two-Handed Cleaves", 100, 4);
    weap = new WeaponType(
        "a dwarven mining pickaxe",
        "A super-strong, super-sharp, super-heavy pickaxe.",
        "",
        "Two-Handed Cleaves",
        2,
        2,
        7,
        3,
        3,
        20000,
        50,
        2000);
    dwarf_miner->Arm(weap);
    arm = new ArmorType(
        "a dwarven leather jerkin",
        "A heavy dwarven leather jerkin.  It'll probably stop an arrow.",
        "",
        3,
        2,
        2,
        2,
        0,
        0,
        1,
        0,
        10000,
        10,
        150,
        ACT_WEAR_CHEST,
        ACT_WEAR_BACK);
    dwarf_miner->Armor(arm);

    dwarf_engineer = new MOBType(
        "a dwarf engineer",
        "She looks pissed.",
        "",
        "F",
        5,
        7,
        4,
        5,
        5,
        7,
        3,
        2,
        5,
        3,
        8,
        7,
        2000,
        8001);
    dwarf_engineer->Skill("Long Cleaves", 100, 2);
    weap = new WeaponType(
        "a dwarven combat axe",
        "A super-strong, super-sharp combat axe.",
        "",
        "Long Cleaves",
        1,
        2,
        7,
        2,
        2,
        4000,
        10,
        1000);
    dwarf_engineer->Arm(weap);
    arm = new ArmorType(
        "a dwarven leather jerkin",
        "A heavy dwarven leather jerkin.  It'll probably stop an arrow.",
        "",
        3,
        2,
        2,
        2,
        0,
        0,
        1,
        0,
        10000,
        10,
        150,
        ACT_WEAR_CHEST,
        ACT_WEAR_BACK);
    dwarf_engineer->Armor(arm);

    dwarf_guard = new MOBType(
        "a dwarf guard",
        "{He} looks pissed.",
        "",
        "MF",
        9,
        4,
        6,
        4,
        9,
        4,
        1,
        3,
        5,
        4,
        9,
        4,
        100,
        401);
    dwarf_guard->Skill("Two-Handed Cleaves", 100, 4);
    weap = new WeaponType(
        "a dwarven war axe",
        "A super-strong, super-sharp, super-heavy, high-quality war axe.",
        "",
        "Two-Handed Cleaves",
        2,
        4,
        6,
        4,
        2,
        20000,
        40,
        5000);
    dwarf_guard->Arm(weap);
    arm = new ArmorType(
        "a dwarven heavy breastplate",
        "A heavy dwarven breastplate.  It'll probably stop a warhammer.",
        "",
        8,
        4,
        6,
        2,
        4,
        2,
        10,
        5,
        200000,
        100,
        15000,
        ACT_WEAR_CHEST,
        ACT_WEAR_BACK);
    dwarf_guard->Armor(arm);
    arm = new ArmorType(
        "a dwarven great helm",
        "A heavy dwarven great helm.  It'll probably stop a warhammer.",
        "",
        8,
        4,
        6,
        2,
        4,
        2,
        10,
        5,
        50000,
        70,
        5000,
        ACT_WEAR_HEAD);
    dwarf_guard->Armor(arm);
    arm = new ArmorType(
        "a dwarven arm plate (right)",
        "A heavy dwarven arm plate.  It'll probably stop a warhammer.",
        "",
        8,
        4,
        6,
        2,
        4,
        2,
        10,
        5,
        50000,
        60,
        5000,
        ACT_WEAR_RARM);
    dwarf_guard->Armor(arm);
    arm = new ArmorType(
        "a dwarven arm plate (left)",
        "A heavy dwarven arm plate.  It'll probably stop a warhammer.",
        "",
        8,
        4,
        6,
        2,
        4,
        2,
        10,
        5,
        50000,
        60,
        5000,
        ACT_WEAR_LARM);
    dwarf_guard->Armor(arm);
    arm = new ArmorType(
        "a dwarven battle skirt",
        "A heavy dwarven battle skirt.  It'll probably stop a warhammer.",
        "",
        8,
        4,
        6,
        2,
        4,
        2,
        10,
        5,
        100000,
        80,
        10000,
        ACT_WEAR_RLEG,
        ACT_WEAR_LLEG);
    dwarf_guard->Armor(arm);

    dwarf_explorer = new MOBType(
        "a dwarf explorer",
        "{He} looks pissed.",
        "",
        "MF",
        5,
        4,
        5,
        4,
        6,
        4,
        3,
        2,
        6,
        4,
        9,
        5,
        1000,
        4001);
    dwarf_explorer->Skill("Long Cleaves", 100, 4);
    weap = new WeaponType(
        "a dwarven climbing pick",
        "A super-sharp, lightweight pick.",
        "",
        "Long Cleaves",
        1,
        1,
        3,
        3,
        1,
        2000,
        10,
        500);
    dwarf_explorer->Arm(weap);
    arm = new ArmorType(
        "a dwarven leather jerkin",
        "A heavy dwarven leather jerkin.  It'll probably stop an arrow.",
        "",
        3,
        2,
        2,
        2,
        0,
        0,
        1,
        0,
        10000,
        10,
        150,
        ACT_WEAR_CHEST,
        ACT_WEAR_BACK);
    dwarf_explorer->Armor(arm);

    elf_prisoner = new MOBType(
        "an elf slave",
        "This elf looks like {he}'s been a "
        "prisoner longer than you've been alive.",
        "",
        "MF",
        4,
        2,
        8,
        4,
        5,
        2,
        8,
        2,
        7,
        4,
        4,
        4,
        0,
        0);
    elf_prisoner->Skill("Carromeleg - Tier I", 2);
    elf_prisoner->Skill("Carromeleg - Tier II", 2);
    elf_prisoner->Skill("Carromeleg - Tier III", 2);
    elf_prisoner->Skill("Carromeleg - Tier IV", 2);
    elf_prisoner->Skill("Carromeleg - Tier V", 2);
    elf_prisoner->Skill("Carromeleg - Tier VI", 2);
  }

  int mojo = Skill("DynamicMojo");
  SetSkill("DynamicMojo", 0);

  // Tree structure, start with one door - dir of travel is opposite it.
  const char* dirb = "south";
  const char* dir = "north";
  const char* dir2 = "west";
  const char* dir3 = "east";

  if (PickObject("north", LOC_INTERNAL) != NULL) {
    dirb = "north";
    dir = "south";
    dir2 = "east";
    dir3 = "west";
  } else if (PickObject("east", LOC_INTERNAL) != NULL) {
    dirb = "east";
    dir = "west";
    dir2 = "south";
    dir3 = "north";
  } else if (PickObject("west", LOC_INTERNAL) != NULL) {
    dirb = "west";
    dir = "east";
    dir2 = "north";
    dir3 = "south";
  }
  // Up and Down shafts are handled specially.

  switch (Skill("DynamicPhase")) {
    case (0): { // Entrance
      if (mojo == 0)
        mojo = 100000;

      Object* next = new Object(parent);
      next->SetShortDesc(names[1]);
      next->SetDesc(descs[1]);
      next->SetSkill("DynamicInit", 1);
      next->SetSkill("DynamicPhase", 1); // Major Shaft
      next->SetSkill("DynamicMojo", mojo - 1000);

      Object* door1 = new Object(this);
      Object* door2 = new Object(next);
      door1->SetShortDesc(dir);
      door2->SetShortDesc(dirb);
      door1->SetDesc((string("You see a solid passage leading ") + dir + ".\n").c_str());
      door2->SetDesc((string("You see a solid passage leading ") + dirb + ".\n").c_str());
      door1->AddAct(ACT_SPECIAL_LINKED, door2);
      door1->AddAct(ACT_SPECIAL_MASTER, door2);
      door1->SetSkill("Open", 1000);
      door1->SetSkill("Enterable", 1);
      door2->AddAct(ACT_SPECIAL_LINKED, door1);
      door2->AddAct(ACT_SPECIAL_MASTER, door1);
      door2->SetSkill("Open", 1000);
      door2->SetSkill("Enterable", 1);

    } break;
    case (1): { // Major Shaft
      if ((rand() % 100) < 30) {
        mojo -= 500;
        AddMOB(dwarf_miner);
      }
      if ((rand() % 100) < 10) {
        mojo -= 500;
        AddMOB(dwarf_engineer);
      }
      if ((rand() % 100) < 20) {
        mojo -= 500;
        AddMOB(dwarf_guard);
      }
      if ((rand() % 100) < 20) {
        mojo -= 500;
        AddMOB(dwarf_guard);
      }

      if (mojo <= 0)
        break; // End of Tunnel

      int ntypes[] = {1, 1, 1, 1, 1, 1, 1, 2, 2, 3, 4};
      int ntype = ntypes[rand() % (sizeof(ntypes) / sizeof(int))];

      Object* next = new Object(parent);
      next->SetShortDesc(names[ntype]);
      next->SetDesc(descs[ntype]);
      next->SetSkill("DynamicInit", 1);
      next->SetSkill("DynamicPhase", ntype);
      next->SetSkill("DynamicMojo", mojo - 1000);

      Object* door1 = new Object(this);
      Object* door2 = new Object(next);
      door1->SetShortDesc(dir);
      door2->SetShortDesc(dirb);
      door1->SetDesc((string("You see a solid passage leading ") + dir + ".\n").c_str());
      door2->SetDesc((string("You see a solid passage leading ") + dirb + ".\n").c_str());
      door1->AddAct(ACT_SPECIAL_LINKED, door2);
      door1->AddAct(ACT_SPECIAL_MASTER, door2);
      door1->SetSkill("Open", 1000);
      door1->SetSkill("Enterable", 1);
      door2->AddAct(ACT_SPECIAL_LINKED, door1);
      door2->AddAct(ACT_SPECIAL_MASTER, door1);
      door2->SetSkill("Open", 1000);
      door2->SetSkill("Enterable", 1);
    } break;
    case (2): { // Major Shaft w/ Minor Offshoot
      if ((rand() % 100) < 30) {
        mojo -= 500;
        AddMOB(dwarf_miner);
      }
      if ((rand() % 100) < 10) {
        mojo -= 500;
        AddMOB(dwarf_engineer);
      }
      if ((rand() % 100) < 20) {
        mojo -= 500;
        AddMOB(dwarf_guard);
      }
      if ((rand() % 100) < 20) {
        mojo -= 500;
        AddMOB(dwarf_guard);
      }

      if (mojo <= 0)
        break; // End of Tunnel

      int ntypes[] = {1, 1, 1, 1, 1, 1, 1, 2, 2, 3, 4};
      int ntype = ntypes[rand() % (sizeof(ntypes) / sizeof(int))];

      Object* next = new Object(parent);
      next->SetShortDesc(names[ntype]);
      next->SetDesc(descs[ntype]);
      next->SetSkill("DynamicInit", 1);
      next->SetSkill("DynamicPhase", ntype);
      next->SetSkill("DynamicMojo", (mojo - 1000) * 9 / 10);

      Object* door1 = new Object(this);
      Object* door2 = new Object(next);
      door1->SetShortDesc(dir);
      door2->SetShortDesc(dirb);
      door1->SetDesc((string("You see a solid passage leading ") + dir + ".\n").c_str());
      door2->SetDesc((string("You see a solid passage leading ") + dirb + ".\n").c_str());
      door1->AddAct(ACT_SPECIAL_LINKED, door2);
      door1->AddAct(ACT_SPECIAL_MASTER, door2);
      door1->SetSkill("Open", 1000);
      door1->SetSkill("Enterable", 1);
      door2->AddAct(ACT_SPECIAL_LINKED, door1);
      door2->AddAct(ACT_SPECIAL_MASTER, door1);
      door2->SetSkill("Open", 1000);
      door2->SetSkill("Enterable", 1);

      if (rand() % 2)
        swap(dir2, dir3); // Half left, half right
      next = new Object(parent);
      next->SetShortDesc(names[5]);
      next->SetDesc(descs[5]);
      next->SetSkill("DynamicInit", 1);
      next->SetSkill("DynamicPhase", 5); // Minor Shaft
      next->SetSkill("DynamicMojo", (mojo - 1000) / 10);

      door1 = new Object(this);
      door2 = new Object(next);
      door1->SetShortDesc(dir2);
      door2->SetShortDesc(dir3);
      door1->SetDesc((string("You see a crumbling passage leading ") + dir2 + ".\n").c_str());
      door2->SetDesc((string("You see a crumbling passage leading ") + dir3 + ".\n").c_str());
      door1->AddAct(ACT_SPECIAL_LINKED, door2);
      door1->AddAct(ACT_SPECIAL_MASTER, door2);
      door1->SetSkill("Open", 1000);
      door1->SetSkill("Enterable", 1);
      door2->AddAct(ACT_SPECIAL_LINKED, door1);
      door2->AddAct(ACT_SPECIAL_MASTER, door1);
      door2->SetSkill("Open", 1000);
      door2->SetSkill("Enterable", 1);
    } break;
    case (3): { // Major Shaft w/ Secret Minor Offshoot
      if ((rand() % 100) < 30) {
        mojo -= 500;
        AddMOB(dwarf_miner);
      }
      if ((rand() % 100) < 10) {
        mojo -= 500;
        AddMOB(dwarf_engineer);
      }
      if ((rand() % 100) < 20) {
        mojo -= 500;
        AddMOB(dwarf_guard);
      }
      if ((rand() % 100) < 20) {
        mojo -= 500;
        AddMOB(dwarf_guard);
      }

      if (mojo <= 0)
        break; // End of Tunnel

      int ntypes[] = {1, 1, 1, 1, 1, 1, 1, 2, 2, 3, 4};
      int ntype = ntypes[rand() % (sizeof(ntypes) / sizeof(int))];

      Object* next = new Object(parent);
      next->SetShortDesc(names[ntype]);
      next->SetDesc(descs[ntype]);
      next->SetSkill("DynamicInit", 1);
      next->SetSkill("DynamicPhase", ntype);
      next->SetSkill("DynamicMojo", (mojo - 1000) * 3 / 4);

      Object* door1 = new Object(this);
      Object* door2 = new Object(next);
      door1->SetShortDesc(dir);
      door2->SetShortDesc(dirb);
      door1->SetDesc((string("You see a solid passage leading ") + dir + ".\n").c_str());
      door2->SetDesc((string("You see a solid passage leading ") + dirb + ".\n").c_str());
      door1->AddAct(ACT_SPECIAL_LINKED, door2);
      door1->AddAct(ACT_SPECIAL_MASTER, door2);
      door1->SetSkill("Open", 1000);
      door1->SetSkill("Enterable", 1);
      door2->AddAct(ACT_SPECIAL_LINKED, door1);
      door2->AddAct(ACT_SPECIAL_MASTER, door1);
      door2->SetSkill("Open", 1000);
      door2->SetSkill("Enterable", 1);

      if (rand() % 2)
        swap(dir2, dir3); // Half left, half right
      next = new Object(parent);
      next->SetShortDesc(names[5]);
      next->SetDesc(descs[5]);
      next->SetSkill("DynamicInit", 1);
      next->SetSkill("DynamicPhase", 5); // Minor Shaft
      next->SetSkill("DynamicMojo", (mojo - 1000) / 4);

      door1 = new Object(this);
      door2 = new Object(next);
      door1->SetShortDesc(dir2);
      door2->SetShortDesc(dir3);
      door1->SetDesc((string("You see a crumbling passage leading ") + dir2 + ".\n").c_str());
      door2->SetDesc((string("You see a crumbling passage leading ") + dir3 + ".\n").c_str());
      door1->AddAct(ACT_SPECIAL_LINKED, door2);
      door1->AddAct(ACT_SPECIAL_MASTER, door2);
      door1->SetSkill("Open", 1000);
      door1->SetSkill("Enterable", 1);
      door2->AddAct(ACT_SPECIAL_LINKED, door1);
      door2->AddAct(ACT_SPECIAL_MASTER, door1);
      door2->SetSkill("Open", 1000);
      door2->SetSkill("Enterable", 1);
      door1->SetSkill("Hidden", 4 + rand() % 13);
    } break;
    case (4): { // Major Chamber
      if ((rand() % 100) < 30) {
        mojo -= 500;
        AddMOB(dwarf_miner);
      }
      if ((rand() % 100) < 30) {
        mojo -= 500;
        AddMOB(dwarf_miner);
      }
      if ((rand() % 100) < 30) {
        mojo -= 500;
        AddMOB(dwarf_miner);
      }
      if ((rand() % 100) < 30) {
        mojo -= 500;
        AddMOB(dwarf_miner);
      }
      if ((rand() % 100) < 10) {
        mojo -= 500;
        AddMOB(dwarf_engineer);
      }
      if ((rand() % 100) < 10) {
        mojo -= 500;
        AddMOB(dwarf_engineer);
      }
      if ((rand() % 100) < 20) {
        mojo -= 500;
        AddMOB(dwarf_guard);
      }
      if ((rand() % 100) < 20) {
        mojo -= 500;
        AddMOB(dwarf_guard);
      }
      if ((rand() % 100) < 20) {
        mojo -= 500;
        AddMOB(dwarf_guard);
      }
      if ((rand() % 100) < 20) {
        mojo -= 500;
        AddMOB(dwarf_guard);
      }

      Object* cage = new Object(this);
      cage->SetShortDesc("an old strong cage");
      cage->SetDesc(
          "This is a very old, large, rugged cage - probably built by "
          "dwarves.\n");
      cage->SetSkill("Transparent", 900);
      cage->SetSkill("Container", 100000);
      cage->SetSkill("Locked", 1);
      cage->SetSkill("Closeable", 1);

      if ((rand() % 100) < 20) {
        mojo -= 500;
        cage->AddMOB(elf_prisoner);
      }
      if ((rand() % 100) < 20) {
        mojo -= 500;
        cage->AddMOB(elf_prisoner);
      }

      if (mojo <= 0)
        break; // End of Tunnel

      int ntypes[] = {1, 1, 1, 1, 1, 1, 1, 2, 2, 3};
      int ntype = ntypes[rand() % (sizeof(ntypes) / sizeof(int))];

      Object* next = new Object(parent);
      next->SetShortDesc(names[ntype]);
      next->SetDesc(descs[ntype]);
      next->SetSkill("DynamicInit", 1);
      next->SetSkill("DynamicPhase", ntype);
      next->SetSkill("DynamicMojo", mojo - 1000);

      Object* door1 = new Object(this);
      Object* door2 = new Object(next);
      door1->SetShortDesc(dir);
      door2->SetShortDesc(dirb);
      door1->SetDesc((string("You see a solid passage leading ") + dir + ".\n").c_str());
      door2->SetDesc((string("You see a solid passage leading ") + dirb + ".\n").c_str());
      door1->AddAct(ACT_SPECIAL_LINKED, door2);
      door1->AddAct(ACT_SPECIAL_MASTER, door2);
      door1->SetSkill("Open", 1000);
      door1->SetSkill("Enterable", 1);
      door2->AddAct(ACT_SPECIAL_LINKED, door1);
      door2->AddAct(ACT_SPECIAL_MASTER, door1);
      door2->SetSkill("Open", 1000);
      door2->SetSkill("Enterable", 1);
    } break;
    case (5): { // Minor Shaft
      if ((rand() % 100) < 30) {
        mojo -= 500;
        AddMOB(dwarf_miner);
      }
      if ((rand() % 100) < 30) {
        mojo -= 500;
        AddMOB(dwarf_miner);
      }
      if ((rand() % 100) < 10) {
        mojo -= 500;
        AddMOB(dwarf_engineer);
      }
      if ((rand() % 100) < 20) {
        mojo -= 500;
        AddMOB(dwarf_explorer);
      }

      if (mojo <= 0)
        break; // End of Tunnel

      //      int ntypes[] = { 5, 5, 5, 5, 6, 6, 6, 7, 7, 8, 9 };
      int ntypes[] = {5, 5, 5, 5, 5, 6, 6, 7, 7, 8};
      int ntype = ntypes[rand() % (sizeof(ntypes) / sizeof(int))];

      Object* next = new Object(parent);
      next->SetShortDesc(names[ntype]);
      next->SetDesc(descs[ntype]);
      next->SetSkill("DynamicInit", 1);
      next->SetSkill("DynamicPhase", ntype);
      next->SetSkill("DynamicMojo", mojo - 100);

      Object* door1 = new Object(this);
      Object* door2 = new Object(next);
      door1->SetShortDesc(dir);
      door2->SetShortDesc(dirb);
      door1->SetDesc((string("You see a crumbling passage leading ") + dir + ".\n").c_str());
      door2->SetDesc((string("You see a crumbling passage leading ") + dirb + ".\n").c_str());
      door1->AddAct(ACT_SPECIAL_LINKED, door2);
      door1->AddAct(ACT_SPECIAL_MASTER, door2);
      door1->SetSkill("Open", 1000);
      door1->SetSkill("Enterable", 1);
      door2->AddAct(ACT_SPECIAL_LINKED, door1);
      door2->AddAct(ACT_SPECIAL_MASTER, door1);
      door2->SetSkill("Open", 1000);
      door2->SetSkill("Enterable", 1);
    } break;
    case (6): { // Minor Shaft (Bend)
      if ((rand() % 100) < 30) {
        mojo -= 500;
        AddMOB(dwarf_miner);
      }
      if ((rand() % 100) < 30) {
        mojo -= 500;
        AddMOB(dwarf_miner);
      }
      if ((rand() % 100) < 10) {
        mojo -= 500;
        AddMOB(dwarf_engineer);
      }
      if ((rand() % 100) < 20) {
        mojo -= 500;
        AddMOB(dwarf_explorer);
      }

      //      int ntypes[] = { 5, 5, 5, 5, 5, 6, 6, 7, 7, 8, 9 };
      int ntypes[] = {5, 5, 5, 5, 5, 6, 6, 7, 7, 8};
      int ntype = ntypes[rand() % (sizeof(ntypes) / sizeof(int))];

      if (rand() % 2)
        swap(dir2, dir3); // Half left, half right
      Object* next = new Object(parent);
      next->SetShortDesc(names[ntype]);
      next->SetDesc(descs[ntype]);
      next->SetSkill("DynamicInit", 1);
      next->SetSkill("DynamicPhase", ntype);
      next->SetSkill("DynamicMojo", mojo - 100);

      Object* door1 = new Object(this);
      Object* door2 = new Object(next);
      door1->SetShortDesc(dir2);
      door2->SetShortDesc(dir3);
      door1->SetDesc((string("You see a crumbling passage leading ") + dir2 + ".\n").c_str());
      door2->SetDesc((string("You see a crumbling passage leading ") + dir3 + ".\n").c_str());
      door1->AddAct(ACT_SPECIAL_LINKED, door2);
      door1->AddAct(ACT_SPECIAL_MASTER, door2);
      door1->SetSkill("Open", 1000);
      door1->SetSkill("Enterable", 1);
      door2->AddAct(ACT_SPECIAL_LINKED, door1);
      door2->AddAct(ACT_SPECIAL_MASTER, door1);
      door2->SetSkill("Open", 1000);
      door2->SetSkill("Enterable", 1);
    } break;
    case (7): { // Minor Shaft Fork
      if ((rand() % 100) < 30) {
        mojo -= 500;
        AddMOB(dwarf_miner);
      }
      if ((rand() % 100) < 30) {
        mojo -= 500;
        AddMOB(dwarf_miner);
      }
      if ((rand() % 100) < 10) {
        mojo -= 500;
        AddMOB(dwarf_engineer);
      }
      if ((rand() % 100) < 20) {
        mojo -= 500;
        AddMOB(dwarf_explorer);
      }

      //      int ntypes[] = { 5, 5, 5, 5, 5, 6, 6, 7, 7, 8, 9 };
      int ntypes[] = {5, 5, 5, 5, 5, 6, 6, 7, 7, 8};
      int ntype = ntypes[rand() % (sizeof(ntypes) / sizeof(int))];

      Object* next = new Object(parent);
      next->SetShortDesc(names[ntype]);
      next->SetDesc(descs[ntype]);
      next->SetSkill("DynamicInit", 1);
      next->SetSkill("DynamicPhase", ntype);
      next->SetSkill("DynamicMojo", (mojo - 100) / 2);

      Object* door1 = new Object(this);
      Object* door2 = new Object(next);
      door1->SetShortDesc(dir2);
      door2->SetShortDesc(dir3);
      door1->SetDesc((string("You see a crumbling passage leading ") + dir2 + ".\n").c_str());
      door2->SetDesc((string("You see a crumbling passage leading ") + dir3 + ".\n").c_str());
      door1->AddAct(ACT_SPECIAL_LINKED, door2);
      door1->AddAct(ACT_SPECIAL_MASTER, door2);
      door1->SetSkill("Open", 1000);
      door1->SetSkill("Enterable", 1);
      door2->AddAct(ACT_SPECIAL_LINKED, door1);
      door2->AddAct(ACT_SPECIAL_MASTER, door1);
      door2->SetSkill("Open", 1000);
      door2->SetSkill("Enterable", 1);

      ntype = ntypes[rand() % (sizeof(ntypes) / sizeof(int))];
      swap(dir2, dir3); // Same code, opposite dir.
      next = new Object(parent);
      next->SetShortDesc(names[ntype]);
      next->SetDesc(descs[ntype]);
      next->SetSkill("DynamicInit", 1);
      next->SetSkill("DynamicPhase", ntype);
      next->SetSkill("DynamicMojo", (mojo - 100) / 2);

      door1 = new Object(this);
      door2 = new Object(next);
      door1->SetShortDesc(dir2);
      door2->SetShortDesc(dir3);
      door1->SetDesc((string("You see a crumbling passage leading ") + dir2 + ".\n").c_str());
      door2->SetDesc((string("You see a crumbling passage leading ") + dir3 + ".\n").c_str());
      door1->AddAct(ACT_SPECIAL_LINKED, door2);
      door1->AddAct(ACT_SPECIAL_MASTER, door2);
      door1->SetSkill("Open", 1000);
      door1->SetSkill("Enterable", 1);
      door2->AddAct(ACT_SPECIAL_LINKED, door1);
      door2->AddAct(ACT_SPECIAL_MASTER, door1);
      door2->SetSkill("Open", 1000);
      door2->SetSkill("Enterable", 1);
    } break;
    case (8): { // Minor Shaft Alcove
      if ((rand() % 100) < 30) {
        mojo -= 500;
        AddMOB(dwarf_miner);
      }
      if ((rand() % 100) < 30) {
        mojo -= 500;
        AddMOB(dwarf_miner);
      }
      if ((rand() % 100) < 10) {
        mojo -= 500;
        AddMOB(dwarf_engineer);
      }
      if ((rand() % 100) < 20) {
        mojo -= 500;
        AddMOB(dwarf_explorer);
      }

      if (mojo <= 0)
        break; // End of Tunnel

      if (mojo > 10000 && (rand() % 100) < 20) {
        mojo -= 5000;
        int option = rand() % 100;
        if (option >= 70) {
          swap(dir, dir2);
          swap(dirb, dir3);
        } else if (option >= 70) {
          swap(dir, dir3);
          swap(dirb, dir2);
        }
      } else { // No secret tunnels here!
        break;
      }

      int ntype = 5;

      Object* next = new Object(parent);
      next->SetShortDesc(names[ntype]);
      next->SetDesc(descs[ntype]);
      next->SetSkill("DynamicInit", 1);
      next->SetSkill("DynamicPhase", ntype);
      next->SetSkill("DynamicMojo", mojo - 500);

      Object* door1 = new Object(this);
      Object* door2 = new Object(next);
      door1->SetShortDesc(dir);
      door2->SetShortDesc(dirb);
      door1->SetDesc((string("You see a crumbling passage leading ") + dir + ".\n").c_str());
      door2->SetDesc((string("You see a crumbling passage leading ") + dirb + ".\n").c_str());
      door1->AddAct(ACT_SPECIAL_LINKED, door2);
      door1->AddAct(ACT_SPECIAL_MASTER, door2);
      door1->SetSkill("Open", 1000);
      door1->SetSkill("Enterable", 1);
      door2->AddAct(ACT_SPECIAL_LINKED, door1);
      door2->AddAct(ACT_SPECIAL_MASTER, door1);
      door2->SetSkill("Open", 1000);
      door2->SetSkill("Enterable", 1);
      door1->SetSkill("Hidden", 4 + rand() % 13);
    } break;
    default: {
      fprintf(
          stderr,
          "Unknown dynamic-phase-type (%d-%d) init requested!\n",
          Skill("DynamicInit"),
          Skill("DynamicPhase"));
    } break;
  }
  SetSkill("DynamicPhase", 0);
}
Ejemplo n.º 12
0
Skill::Secondary::Secondary(u8 skill, u8 level) : std::pair<u8, u8>(UNKNOWN, Level::NONE)
{
    SetSkill(skill);
    SetLevel(level);
}
Ejemplo n.º 13
0
void isdf06Mission::Execute(void)
{

    /*
    	Stuff in 6
    	You are responsible for
    	the northern aproach to the base
    	Alien units approach from the south
    	and you battle them.

    	Shabayev discovers a scrap pool.
    	She highlights it.
    	You must go to it and destroy a
    	scion scavenger.

    	You are given control of
    	constructor.  Your job is to build
    	a bunker and a gun tower around it
    	to protect it.

    	Once the bunker is built
    	you are told to go on the
    	offensive.


    	At the first place
    	you go you find the
    	voyager probe.

    	The second is the
    	climatic battle.
    */

    player = GetPlayerHandle();

    if (!start_done)
    {
        start_done=true;
        /*
        	This is one of our three
        	key bases on the Planet
        	You must defend this approach.
        */
        ClearObjectives();
        AddObjective("isdf0601.otf",WHITE,20.0f);
        AudioMessage("isdf0601.wav");
        // Manson:
        // Prepare for enemy attacks
        // You are a reserve for a counter attack
        // or in case they break through.
        attack_wave_time=GetTime()+10.0f;
        wave_launched=false;
        SetScrap(1,20);
        SetIndependence(escav,0);
        escav=BuildObject("fvscav",2,"pool");
        Goto(escav,scrap_pool,0);
        Handle temp=GetHandle("gtow1");
        AddHealth(temp,-2500);
        temp=GetHandle("gtow2");
        AddHealth(temp,-2500);
        GiveWeapon(player, "gshadow_c");
        /*
        turret1=BuildObject("ivturr",3,"turret1");
        turret2=BuildObject("ivturr",3,"turret2");
        Deploy(turret1);
        Deploy(turret2);
        */
    }

    if ((!IsAlive(constructor)) && (mission_state>1) && (mission_state!=99))
    {
        // you loose
        AudioMessage("isdf0607.wav");
        // Manson:
        // That constructor was vital
        // to our effort.  I'm pulling
        // back immeadiately.
        FailMission(GetTime()+15.0f,"isdf06l2.txt");
        mission_state=99;  // out of the loop
    }

    switch (mission_state)
    {
    case 0: // attack starts
        if ((!warning) &&
                (GetDistance(atk1,turret1)<250.0f))
        {
            AudioMessage("isdf0602.wav");
            warning=true;
        }
        if ((!wave_launched) && (GetTime()>attack_wave_time))
        {
            atk1=BuildObject("fvtank",2,"attack_start1");
            Goto(atk1,"attack_path1");
            SetSkill(atk1,3);
            atk2=BuildObject("fvtank",2,"attack_start1");
            Goto(atk2,"attack_path1");
            SetSkill(atk2,3);
            atk3=BuildObject("fvsent",2,"attack_start1");
            Goto(atk3,"attack_path1");
            SetSkill(atk3,3);
            atk4=BuildObject("fvsent",2,"attack_start1");
            Goto(atk4,"attack_path1");
            SetSkill(atk4,3);
            atk5=BuildObject("fvtank",2,"attack_start2");
            Goto(atk5,"attack_path2");
            SetSkill(atk5,3);
            atk6=BuildObject("fvtank",2,"attack_start2");
            Goto(atk6,"attack_path2");
            SetSkill(atk6,3);
            atk7=BuildObject("fvsent",2,"attack_start2");
            Goto(atk7,"attack_path2");
            SetSkill(atk7,3);
            //		atk8=BuildObject("fvsent",2,"attack_start2");
            //		Goto(atk8,"attack_path2");
            //		SetSkill(atk8,3);
            wave_launched=true;
        }
        if ((wave_launched) && (!IsAlive(atk1))
                && (!IsAlive(atk2))
                && (!IsAlive(atk3))
                && (!IsAlive(atk4))
                && (!IsAlive(atk5))
                && (!IsAlive(atk6))
                && (!IsAlive(atk7))
                && (!IsAlive(atk8)))
        {
            warning=false;
            wave_launched=false;
            wave_count++;
            if (!repair_hint)
            {
                repair_hint=true;
                AudioMessage("isdf0612.wav");
                /*
                	MANSON
                	Take advantage of the
                	breaks between attacks
                	to repair your forces at the service
                	bay.
                */
            }
            if (wave_count==2)
            {
                back1=BuildObject("fvarch",2,"back1");
                Goto(back1,"back_door");
                back2=BuildObject("fvarch",2,"back2");
                Goto(back2,"back_door");
                back3=BuildObject("fvsent",2,"back3");
                Goto(back3,"back_door");
                SetObjectiveOn(back1);
                AudioMessage("isdf0614.wav");
            }
            if (wave_count>(2)) //was 2
            {
                if ((!IsAlive(back1))
                        && (!IsAlive(back2))
                        && (!IsAlive(back3)))
                {

                    mission_state++;
                    SetObjectiveOn(escav);
                    ClearObjectives();
                    AddObjective("isdf0602.otf",WHITE,10.0f);
                    AudioMessage("isdf0603.wav");
                    // Shabayev
                    // I have detected the scavenger
                    // which is supplying the enemy.
                    // Its time to counter attack.
                    // Manson
                    // Alright, Cooke, you heard
                    // the lieutenant.  Get that
                    // scavenger
                    AudioMessage("isdf0604.wav");
                }
            }
            else attack_wave_time=GetTime()+5.0f;
            // hold back your forces
            if ((GetDistance(turret1,mbike1)<50.0f) && (!defend_warning))
            {
                AudioMessage("isdf0610.wav");
                // MansoN:
                // Cooke, hold back your forces.
                defend_warning=true;

            }
        }
        break;
    case 1: // shabayev highlights the scavenger
        /*
        */
        if (scav_count<3)
        {
            FailMission(GetTime()+5.0f,"isdf06l1.txt");
            mission_state=99;
        }
        else
        {

            if ((GetDistance(player,escav)<150.0f)
                    && (!got_to_scav))
            {
                AudioMessage("isdf0605.wav");
                // Shabayev: Attack!
                got_to_scav=true;

            }
            if (!IsAlive(escav))
            {
                ClearObjectives();
                AddObjective("isdf0603.otf",WHITE,10.0f);

                constructor=BuildObject("ivcon6",1,"constructor_spawn");
                int grp=GetFirstEmptyGroup();
                SetGroup(constructor,grp);
                Goto(constructor,"pool",0);

                mission_state++;
                AudioMessage("isdf0606.wav");
                // Manson:
                // Cooke, I'm sending you a
                // constructor to fortify your
                // position.  Use the constructor
                // to build defenses around that
                // scrap pool.
            }
        }
        break;
    case 2:	 // you get a constructor
        if (GetDistance(constructor,"pool")<250.0f)
        {
            AudioMessage("isdf0611.wav");
            // Shabayev
            // Build a communications bunker to
            // anchor the base.
            // Once you have a communications bunker
            // build two adjacent
            // gun towers
            // The gun towers will be powered from
            // the surplus power of the main base.
            // Good luck.

            ConstructionMessage();
            // spawn in attackers
            scout1=BuildObject("fvscout",2,"patrol_spawn");
            scout2=BuildObject("fvscout",2,"patrol_spawn");
            if (IsAlive(mbike1))
            {
                Attack(scout1,player);
            }
            else
            {
                Attack(scout1,player);
            }
            if (IsAlive(mbike2))
            {
                Attack(scout2,player);
            }
            else Attack(scout2,mbike2);
            mission_state++;
        }

        break;
    case 3:
        if ((!IsAlive(scout1)) && (!IsAlive(scout2)))
        {
            scout1=BuildObject("fvscout",2,"patrol_spawn");
            scout2=BuildObject("fvscout",2,"patrol_spawn");
            if (IsAlive(mbike1))
            {
                Attack(scout1,mbike1);
            }
            else Attack(scout1,player);
            if (IsAlive(mbike2))
            {
                Attack(scout2,mbike2);
            }
            else	Attack(scout2,player);
        }
        if ((cbunker!=NULL) && (guntow1!=NULL)
                && (guntow2!=NULL))
        {
            AudioMessage("isdf0608.wav");
            /*
            	Manson:
            	Great!
            	I'm sending a scavenger to secure
            	that pool.
            	Prepare for further orders.

            */
            // more cannon foder to get pulverized
            atk1=BuildObject("fvtank",2,"patrol_spawn1");
            Attack(atk1,guntow1);  // cannon foder
            atk2=BuildObject("fvtank",2,"patrol_spawn2");
            Attack(atk2,guntow2);  // cannon foder

            // FraKTal says this scav doesn't want to deploy on its
            // own. So, put it under 100% human control - NM 6/27/03
#if 0
            // was
            scav=BuildObject("ivscav",3,"constructor_spawn");
#else
            // now
            scav=BuildObject("ivscav",1,"constructor_spawn");
#endif

            Goto(scav,"pool");
            ClearObjectives();
            AddObjective("isdf0607.otf",WHITE,10.0f);
            mission_state++;
        }
        break;
    case 4:  // when the scavenger gets there-- attack!!
        if (GetDistance(scav,"pool")<100.0f)
        {
            AudioMessage("isdf0609.wav");
            AudioMessage("isdf0613.wav");
            // Shabayev:
            // Its time we finish them off.
            // All forces, converge on the enemy base!
            SetObjectiveOn(goal);
            mission_state++;
            // spawn in patrols
            atk1=BuildObject("fvtank",2,"patrol_spawn2");
            atk2=BuildObject("fvtank",2,"patrol_spawn2");
            atk3=BuildObject("fvsent",2,"patrol_spawn");
            atk4=BuildObject("fvsent",2,"patrol_spawn");
            Patrol(atk1,"patrol");
            Patrol(atk2,"patrol");
            Patrol(atk3,"patrol");
            Patrol(atk4,"patrol");
            // spawn in attackers
            atk1=BuildObject("ivtank",3,"constructor_spawn");
            atk2=BuildObject("ivtank",3,"constructor_spawn");
            Goto(atk1,goal);
            Goto(atk2,goal);
            BuildObject("ibbomb",1,"bomber");  // you get a bomber
//					BuildObject("ivbomb",1,"bomber");
            ClearObjectives();
            AddObjective("isdf0608.otf",WHITE,10.0f);
        }
        break;
    case 5:  // test to destroy base
        time_counter++;
        if (time_counter%1200==0) // every minute 1/2
        {
            atk1=BuildObject("fvtank",2,"patrol_spawn2");
            atk2=BuildObject("fvtank",2,"patrol_spawn2");
            Patrol(atk1,"patrol");
            Patrol(atk2,"patrol");
        }
        if (!IsAlive(goal))
        {
            // you win
            SucceedMission(GetTime()+20.0f,"isdf06w1.txt");
            mission_state++;
            ClearObjectives();
            AddObjective("isdf0609.otf",WHITE,10.0f);
        }
        break;
    case 6:
        // cineractive
        // Through the worm hole
        break;

    } // switch
}
Ejemplo n.º 14
0
void isdf05Mission::Execute(void)
{

	/*
	a) The player is asked to patrol around the base

	(through steps b-d sent & scouts attack)

	b) Once the base is secure, the player is supposed
	to look for scrap veins and send a scavenger (twice)

	c)Eventually you get to some turrets.  
	Shebayev detaches some mortar bikes to help you take 
	out the turrets.  

	d) Once the turrets are destroyed you need to
	deploy

	e) Follow Manson to the teleporter?  Drop off a bomb
	*/
	char tempstr[128];
	Handle nearguy = 0;
	// this is the start of the mission
	if (!start_done)
	{

		/*
		Alright Sgt Cooke, this looks like
		a good place to establish a base.  
		Patrol the area around this recycler.  
		If it looks safe, deploy the recycler.  
		*/
		shabayev = BuildObject("ivtan5",1,"shab_start");//"patrol_east");
		constructor = BuildObject("ivcons",1,"spawn_constructor");
		Stop(constructor,1);
		scav_comp= GetHandle("scav3");
		SetGroup(scav_comp,-1);
		Handle temppool=GetHandle("poolx");
		Goto(scav_comp,temppool,1);
		//	SetPlan("isdf05.aip",3);  // build stuff
		AudioMessage("isdf0500.wav");
		SetObjectiveOn(shabayev);
		SetObjectiveName(shabayev,"Cmdr. Shabayev");


		audmsg=AudioMessage("isdf0501.wav");
		patrol_phase=true;
		start_done = true;

		Handle tempscav=GetHandle("ivscav1");
		KillPilot(tempscav);
		tempscav=GetHandle("ivscav2");
		KillPilot(tempscav);
		//		Handle fv=BuildObject("fvarch",2,"scrap_field1");
		//		SetSkill(fv,3);
		SetSkill(shabayev,3);
		//		Patrol(shabayev,"patrol1",1);
		//		Attack(shabayev,fv,1);
		recy=BuildObject("ivrec5",1,"recy_start");
		//		Goto(recy,"recy_deploy");
		Dropoff(recy, "recy_deploy");
		Follow(shabayev,recy,1);
		SetScrap(1,40);
		SetScrap(3,40);  // allied resources
	}

	/*
	Here is where you put what happens every frame.  
	*/

	player = GetPlayerHandle();
	if ((!IsAlive(shabayev) && (!shab_dead)))
	{
		AudioMessage("isdf0732.wav");
		ClearObjectives();
		AddObjective("isdf05l1.otf",RED,15.0f);
		FailMission(GetTime()+5.0f,"isdf05l1.otf");
		shab_dead=true;
	}

	// determining if the player is out of his ship
	if (IsOdf(player,"isuser"))
	{
		if (!out_of_ship) GiveWeapon(player, "igsatc");
		out_of_ship = true;
	}
	else
	{
		out_of_ship = false;
	}

	if ((GetDistance(player,"spawn2")<150.f) && (!warning_message))
	{
		AudioMessage("isdf0520.wav");
		/*
		Stay away from those alien structures
		they aren't 
		vital to our mission-
		but they may be dangerous. 
		*/
		warning_message=true;
	}
	// this is checking to make sure the player does not attack his wingman /////////
	if ((!in_combat) && (!fire_message))
	{
		if ((IsAlive(shabayev)) && (IsAlive(player)))
		{
			if (GetTime() - GetLastFriendShot(shabayev) < .2f)
			{
				AudioMessage("ff01.wav"); // (shab) watch your firing!
				fire_reset = GetTime() + 2.f;
				fire_message = true;
			}
		}

		if ((IsAlive(manson)) && (IsAlive(player)))
		{
			if (GetTime() - GetLastFriendShot(manson) < .2f)
			{
				AudioMessage("isdf0555.wav"); // (manson) watch your firing!
				fire_reset = GetTime() + 2.f;
				fire_message = true;
			}
		}
	}

	if ((fire_message) && (fire_reset < GetTime()))
	{
		fire_reset = GetTime() + 999999.9f;
		fire_message = false;
	}
	if ((!IsAlive(constructor)) && (mission_state<10))
	{
		// the constructor is dead, you lose
		mission_state=12;
	}

	switch (mission_state)
	{
	case 0:

		// Shabayev starts the base
		if (GetDistance(recy,"recy_deploy") < 25.0)
		{
			//				Dropoff(recy,"recy_deploy");
			Patrol(shabayev,"patrol1",1);
			SetIndependence(shabayev,1);
			ClearObjectives();
			AddObjective("isdf0501.otf", WHITE, 10.0f);
			patrol_reminder_time=GetTime()+30.0f;
			MoviePlaying=true;
			CameraReady();
			// but danger looms..
			atk1=BuildObject("fvscout",2,"spawn1");
			wasDead1=false;
			Attack(atk1,player);
			mission_state++;
		}
		break;

	case 1:
		if (MoviePlaying)
		{
			//CameraObject(recycler,5,5,5,recycler);
			MoviePlaying = PlayMovie("isdf0501.cin");	
			//		if (IsAudioMessageDone(audmsg)) {
			if (!MoviePlaying)
			{
				//	MoviePlaying=false;
				CameraFinish();
				Build(constructor,"ibpge5",1);
				drop_off=true;
				Attack(shabayev,atk1);
				mission_state++;
			}
		}
		ReallyKillCineractive = 0;
		break;

	case 2: // patrol_phase

		// Kick this out a few extra times.
		if((ReallyKillCineractive == 0) || (ReallyKillCineractive == 10) || 
			(ReallyKillCineractive == 20))
			CameraFinish();
		ReallyKillCineractive++;

		if (drop_off)
		{
			Dropoff(constructor,"pgen1",1);
			drop_off=false;
			Handle temp=GetHandle("unnamed_ivdrop");
			Attack(shabayev,atk1,1);
			RemoveObject(temp);
		}

		if (!IsAlive(atk1))
		{
			wait_count++;
			if (wait_count==250)
			{
				wasDead1=false;
				wasDead2=false;
				raid1=BuildObject("fvsent",2,"raid1");
				Goto(raid1,recy);
				raid2=BuildObject("fvtank",2,"raid2");
				Goto(raid2,recy);
				//				raid3=BuildObject("fvsent",2,"raid3");
				//				Goto(raid3,recy);
				//				raid4=BuildObject("fvtank",2,"raid4");
				//				Goto(raid4,recy);
				ClearObjectives();
				AddObjective("isdf0517.otf",WHITE,10.0f);
				Goto(shabayev,constructor);
				AudioMessage("isdf0543.wav");
				mission_state++;
				wait_count=0;
			}
		}
		break;

	case 3:
		if (power2)
		{
			Dropoff(constructor,"pgen2",1);
			power2=false;
		}
		if (com1)
		{
			Dropoff(constructor,"rbunker1",1);
			com1=false;
		}
		if (!IsAliveAndPilot(raid1)) {
			wasDead1=true;	
		}
		if (!IsAliveAndPilot(raid2)) {
			wasDead2=true;
		}
		if ((wasDead1) && (wasDead2))
		{
			if (raid_count==1)  // should be 2
			{
				/*
				Now look for scrap veins
				around the base.  
				If you find one mark it with 
				a nav beacon.  
				*/
				scout_phase=true;
				ClearObjectives();
				AddObjective("isdf0507.otf",WHITE,5.0f);
				SetObjectiveOff(shabayev);
				nav1=BuildObject("ibnav",1,"scrap_field1");
				TranslateString2(tempstr, sizeof(tempstr), "Mission0501");  // tempstr
				SetObjectiveName(nav1,tempstr);
				SetObjectiveOn(nav1);
				//					SetObjectiveName(pool1,"bio-metal");
				//					SetObjectiveOn(pool1);

				AudioMessage("isdf0507.wav");	
				// Add an attacked for spice
				Handle atk1=BuildObject("fvscout",2,"spawn1");
				Goto(atk1,"attack1");
				Patrol(shabayev,"patrol1",1);
				SetIndependence(shabayev,1);
				// AudioMessage(
				// You go on John, I'll guard the base
				mission_state++;
			}
			else
			{
				wait_count++;
				if (wait_count==400)
				{
					if  (pgen2==NULL)
					{	
						// was follow
						Goto(shabayev,constructor,1);
						Build(constructor,"ibpge5");
						power2=true;
					}
					else 
					{
						//was Follow
						Goto(shabayev,constructor,1);
						Build(constructor,"ibcbu5");
						com1=true;
					}
					raid_count++;
					AddHealth(constructor,500);
					AddHealth(shabayev,500);
					raid1=BuildObject("fvtank",2,"raid1");
					Goto(raid1,recy);
					raid2=BuildObject("fvtank",2,"raid2");
					Goto(raid2,recy);
					wasDead1=false;
					wasDead2=false;
					//					raid3=BuildObject("fvsent",2,"raid3");
					//					Goto(raid3,recy);
					//					raid4=BuildObject("fvtank",2,"raid4");
					//					Goto(raid4,recy);
					wait_count=0;
				}
			}
		}

		break;

	case 4: 	
		// there is one, mark it with the geyser
		// mark that with a power up
		// good, now find another.  
		if ((GetDistance(player,pool1)<75.0f) && (!found_field1))
		{
			// there is a field, deploy the scavenger

			AudioMessage("isdf0508.wav");
			found_field1=true;
		}
		if (scav2_deployed) // any scav is deployed
		{
			mission_state++;
			scav1_deployed=true;
			ClearObjectives();
			AddObjective("isdf0508.otf",WHITE,10.0f);
			/*
			SetObjectiveOff(pool1);
			SetObjectiveName(pool2,"bio-metal 1");
			SetObjectiveOn(pool2);
			*/
			nav2=BuildObject("ibnav",1,"scrap_field3");
			TranslateString2(tempstr, sizeof(tempstr), "Mission0502");  // Bio-Metal 2
			SetObjectiveName(nav2,tempstr);
			SetObjectiveOff(nav1);
			SetObjectiveOn(nav2);
			AudioMessage("isdf0509.wav");  // good job
			if (!found_field1)
			{
				AudioMessage("isdf0519.wav");
				/*
				Don't send out scavengers unescorted.  
				Be sure to stay with them.
				*/
			}
		}
		break;

	case 5:
		if ((scav2_deployed) && (!found_field3) && (GetDistance(player,"scrap_field3")<225.0f))
		{
			found_field3=true;
			/*
			Watch out!
			That field looks hot.  
			*/
			AudioMessage("isdf0512.wav");
			ClearObjectives();
			AddObjective("isdf0511.otf",RED,10.0f);
			mortar_delay=GetTime()+15.0f;
		}
		nearguy=GetNearestEnemy(player);
		if ((found_field3) && (GetTime()>mortar_delay)
			&& (GetDistance(player,nearguy)>150.0f))
		{
			/*
			Cineractive
			Cooke, I'm sending you
			force to help 
			you take out those turrets!
			Here are some mortar bikes.  
			*/

			Build(constructor,"ibfact5",1);
			factory=true;

			audmsg=AudioMessage("isdf0527.wav");
			//was AudioMessage("isdf0513.wav");
			ClearObjectives();
			AddObjective("isdf0516.otf",WHITE,10.0f);
			/*
			int grp=GetFirstEmptyGroup();			
			mbike1=BuildObject("ivmbike",1,"patrol_south");
			SetGroup(mbike1,grp);
			Follow(mbike1,player,0);
			Handle mb=BuildObject("ivmbike",1,"patrol_east");
			SetGroup(mb,grp);
			Follow(mb,player,0);
			mb=BuildObject("ivmbike",1,"patrol_west");
			SetGroup(mb,grp);
			Follow(mb,player,0);
			mb=BuildObject("ivmbike",1,"patrol_north");
			SetGroup(mb,grp);
			Follow(mb,player,0);
			*/
			mission_state++;
			CameraReady();
			MoviePlaying=true;
		}
		break;

	case 6:// attack phase 
		/*
		First check to see if you blew up
		sturret1-4
		then create Manson
		at manson_start
		"Good job Cooke, you show promise"
		Then follow Manson (he's an objective)
		into the base
		When you get close
		lets run past those towers

		when you get there
		hop out and use your demolition charge

		Then run away.  Everything blows up.  
		*/
		if (factory)
		{
			Dropoff(constructor,"fact");
			factory=false;
		}
		if (MoviePlaying)
		{
			CameraObject(constructor,1,11,22,constructor);
			if (IsAudioMessageDone(audmsg))
			{
				MoviePlaying=false;
				CameraFinish();
			}
		}

		if ((!killed_turrets) &&
			(!IsAlive(sturret1)) && 
			(!IsAlive(sturret2)) &&
			(!IsAlive(sturret3)) && (!IsAlive(sturret4))
			&&
			(!IsAlive(sturret5)) && (!IsAlive(sturret6)))
		{
			AudioMessage("isdf0514.wav"); // you show promise
			killed_turrets=true;
			ClearObjectives();
			AddObjective("isdf0512.otf",WHITE,10.0f);
			manson_shows=GetTime()+10.0f;
			manson=BuildObject("ivtank",3,"manson_start");
			SetObjectiveName(manson, "Maj. Manson");
			Handle minion=BuildObject("ivtank",3,"manson_escort1");
			SetObjectiveName(minion, "Sgt. Zdarko");
			Follow(minion,manson);
			minion=BuildObject("ivtank",3,"manson_escort2");
			SetObjectiveName(minion, "Sgt. Masiker");
			Follow(minion,manson);
		}
		if ((killed_turrets) && (!manson_message) && 
			(GetTime()>manson_shows))
		{
			/*
			We found the objective, 
			follow me
			*/
			AudioMessage("isdf0515.wav");
			SetObjectiveOff(nav2);
			SetObjectiveOn(manson);
			ClearObjectives();
			AddObjective("isdf0518.otf",WHITE,10.0f);
			manson_message=true;
			mission_state++;
		}
		break;

	case 7:
		if (GetDistance(player,manson)<50.0f)
		{
			ClearObjectives();
			AddObjective("isdf0513.otf",WHITE,10.0f);
			SetIndependence(manson,0);
			SetAvoidType(manson,0);
			AudioMessage("isdf0539a.wav");
			Goto(manson,"manson_path1");				
			mission_state++;
		}	
		break;

	case 8:
		AddHealth(manson,100); // we don't want him to die here
		if ((wait_up) && (GetDistance(player,manson)<100.0f))
		{
			// right now this goes off too 
			// soon.   You go on to path 2 before 1 is doen
			// But at least it makes sure
			// you are close once.  
			wait_up=false;
			Goto(manson,"manson_path2");
		}
		if ((!gun_tower_message) && (GetDistance(manson,"guntower2")<200.0f))
		{
			/*
			There are gun towers ahead
			let's try to go past fast.  
			*/
			AudioMessage("isdf0516.wav");
			gun_tower_message=true;
			ClearObjectives();
			AddObjective("isdf0514.otf",WHITE,10.0f);
			gun_tower_counter=0;
		}
		if (gun_tower_message) 
		{
			gun_tower_counter++;
			if (gun_tower_counter>450)  // you are on a timer
			{
				AudioMessage("isdf0529.wav");
				ClearObjectives();
				AddObjective("isdf0520.otf",RED,10.0f);
				FailMission(GetTime()+10.0f,"isdf0520.otf");
				mission_state=12;
			}
			if (gun_tower_counter==300)
			{
				AudioMessage("isdf0528.wav");
			}
		}
		if ((gun_tower_message) && (!hop_out_message) &&
			(GetDistance(player,teleportal)<100.0f))
		{
			/* 
			Get out and use your
			demolition charge on
			that building
			*/
			AudioMessage("isdf0173.wav");  // that looks like one of ours?
			AudioMessage("isdf0517.wav");
			hop_out_message=true;
			SetObjectiveOff(manson);
			SetObjectiveOn(teleportal);
			TranslateString2(tempstr, sizeof(tempstr), "Mission0503");  // Excavator
			SetObjectiveName(teleportal,tempstr);
			ClearObjectives();
			AddObjective("isdf0515.otf",WHITE,10.0f);
			SetIndependence(manson,1);
			mission_state++;
		}
		break;

	case 9:
		if ((!out_of_ship_ever) && (out_of_ship)) {
			out_of_ship_ever=true;
			ClearObjectives();
			AddObjective("isdf0521.otf",WHITE,5.0f);
		}
		if (!IsAlive(teleportal))
		{
			if (out_of_ship_ever)
			{
				AudioMessage("isdf0518.wav");
				SucceedMission(GetTime()+10.0f,"isdf05w1.txt");
				mission_state++;
			}
			else
			{
				AudioMessage("isdf0521.wav");
				/*
				I said use your
				demolition charge
				*/
				FailMission(GetTime()+10.0f,"isdfl1.txt");
				mission_state++;
			}
		}
		break;

	case 12:
		/*
		If you lose the constructor
		this condition occurs.  
		*/
		AudioMessage("isdf0522.wav");
		ClearObjectives();
		AddObjective("isdf0519.otf",RED,10.0f);
		FailMission(GetTime()+10.0f,"isdf0519.otf");
		mission_state++;
		break;
	case 13:
		// waiting for the end of the world.  
		break;
	}



	/*
	the lurkers
	*/
	if ((lurker1==NULL) && (GetDistance(player,"lurker1")<150.0f))
	{
		lurker1=BuildObject("fvsent",2,"lurker1");
	}
	if ((lurker2==NULL) && (GetDistance(player,"lurker2")<150.0f))
	{
		lurker2=BuildObject("fvsent",2,"lurker1");
	}
	if ((lurker3==NULL) && (GetDistance(player,"lurker3")<150.0f))
	{
		lurker3=BuildObject("fvsent",2,"lurker3");
	}
	if ((lurker4==NULL) && (GetDistance(player,"lurker4")<150.0f))
	{
		lurker4=BuildObject("fvsent",2,"lurker4");
	}
}