Example #1
0
//---- Begin of function CampaignEastWest::stage_28_create_game ----//
//
// Vars defined in event functions before calling this function:
//
// None
//
int CampaignEastWest::stage_28_create_game()
{
	init_random_plot(0);		// no plot

	//------- create objects and vars --------//

	if( !stage_28_create_nation() )
		return 0;

	//----- create independent towns ------//

	Battle::create_independent_town(5+misc.random(3));

	//---- create the player force and peasants ----//

	create_troop(PLAYER_NATION_RECNO, 16, 50 ); 		// 50-average combat level

	Nation* playerNation = nation_array[PLAYER_NATION_RECNO];

	Unit* kingUnit = unit_array[ playerNation->king_unit_recno ];

	//---- create a group of peasants with the player's nationality ---//

	int unitId = race_res[playerNation->race_id]->civilian_unit_id;
	int peasantCount = 25 + misc.random(6);

	for( int i=0 ; i<peasantCount ; i++ )
	{
		create_unit( PLAYER_NATION_RECNO, unitId, RANK_SOLDIER,
						 kingUnit->next_x_loc(), kingUnit->next_y_loc(),
						 kingUnit->next_x_loc(), kingUnit->next_y_loc() );
	}

	//------ init stage 1 vars -------//

	stage_28_init_vars();

	//---- generate plants and other objects on the map -----//

	world.gen_rocks();		// generate mountains

	world.generate_map2();

	//------- create additional raw sites ----------//

	create_raw_site();

	// ----- create royal units ------//

	create_royal_units(CAMPAIGN_PLAYER_NATION_RECNO);

	//------ plot create game --------//

	(this->*plot_create_game_FP)();

	return 1;
}
Example #2
0
//---- Begin of function CampaignEastWest::stage_19_create_game ----//
//
// Vars defined in event functions before calling this function:
//
// -eastern_nation_recno
// -attack_state_recno
// -target_state_recno
//
int CampaignEastWest::stage_19_create_game()
{
	// ###### begin Gilbert 1/4 ########//
	init_random_plot('C');
	// ###### end Gilbert 1/4 ########//

	if( !stage_19_create_nation() )
		return 0;

	if( !stage_19_create_town() )
		return 0;

	if( !stage_19_create_firm() )
		return 0;

	//----- create offensive structures ---------//

	if( m.random(2)==0 )
		create_offensive_structure( STAGE_19_EASTERN_NATION_RECNO, 1 + campaign_difficulty/2 );		// build 2 structures if the difficulty > 3

	//------ create the player troop -------//

	create_troop(PLAYER_NATION_RECNO, 86-campaign_difficulty*6);

	//------ init stage 1 vars -------//

	stage_19_init_vars();

	//---- generate plants and other objects on the map -----//

	world.gen_rocks();

	world.generate_map2();

	//------- create additional raw sites ----------//

	create_raw_site();

	//------- init relationship -------//

	stage_19_init_relation();

	// ####### begin Gilbert 9/4 ########//
	// ----- create royal units ------//

	create_royal_units(CAMPAIGN_PLAYER_NATION_RECNO);
	// ####### end Gilbert 9/4 ########//

	// ###### begin Gilbert 1/4 ########//
	(this->*plot_create_game_FP)();
	// ###### end Gilbert 1/4 ########//

	return 1;
}
Example #3
0
//---- Begin of function CampaignEastWest::stage_12_create_game ----//
//
// Vars defined in event functions before calling this function:
//
// -cur_monster_nation_recno    - the attacking monster nation recno
// -attacker_state_recno	     - the monster attacking state
// -target_state_recno			  - the player target state
//
int CampaignEastWest::stage_12_create_game()
{
	init_random_plot('D');

	//--- randomly init the current situation -----//

	set_cur_situation( m.random(CAMPAIGN_SITUATION_COUNT)+1 );

	//------- create objects and vars --------//

	if( !stage_12_create_nation() )
		return 0;

	if( !stage_12_create_town() )
		return 0;

	if( !stage_12_create_firm() )
		return 0;

	//------ create monsters ---------//

	create_troop(STAGE_12_MONSTER_NATION_RECNO, campaign_difficulty*15);

	//------ init stage 1 vars -------//

	stage_12_init_vars();

	//---- generate plants and other objects on the map -----//

	world.gen_rocks();		// generate mountains

	world.generate_map2();

	//------- create additional raw sites ----------//

	create_raw_site();

	//------- init relationship -------//

	stage_12_init_relation();

	// ####### begin Gilbert 9/4 ########//
	// ----- create royal units ------//

	create_royal_units(CAMPAIGN_PLAYER_NATION_RECNO);
	// ####### end Gilbert 9/4 ########//

	//------ plot create game --------//

	(this->*plot_create_game_FP)();

	return 1;
}
Example #4
0
//---- Begin of function CampaignEastWest::stage_24_create_game ----//
//
// Vars defined in event functions before calling this function:
//
// -cur_monster_nation_recno    - the target monster nation recno
// -attacker_state_recno	     - the player attacking state
// -attacker_state_recno2 		  - the eastern empire attacking state
// -target_state_recno			  - the monster target state
//
int CampaignEastWest::stage_24_create_game()
{
	init_random_plot('A');

	plot_enemy_nation_recno = STAGE_24_MONSTER_NATION_RECNO;

	//---- create game objects and vars ----//

	if( !stage_24_create_nation() )
		return 0;

	//------- init relationship -------//

	stage_24_init_relation();		// must init relationship first so that allied units are visible on the map

	//------ create lairs --------//

	if( !stage_24_create_lair() )
		return 0;

	//---- create the player force ----//

	create_troop(PLAYER_NATION_RECNO, 60-campaign_difficulty*6 );

	//---- create the eastern empire force ----//

	create_troop(STAGE_24_EASTERN_NATION_RECNO, 60-campaign_difficulty*6, 0, 0, 1 );		// last 1-create new units on the location next to the last bunch units created

	//------ init stage 1 vars -------//

	stage_24_init_vars();

	//---- generate plants and other objects on the map -----//

	world.gen_rocks();		// generate mountains

	world.generate_map2();

	//------- create additional raw sites ----------//

	create_raw_site();

	// ----- create royal units ------//

	create_royal_units(CAMPAIGN_PLAYER_NATION_RECNO);

	//------ plot create game --------//

	(this->*plot_create_game_FP)();

	return 1;
}
Example #5
0
//---- Begin of function CampaignEastWest::stage_9_create_game ----//
//
// Vars defined in event functions before calling this function:
//
// -cur_monster_nation_recno
// -attack_state_recno
// -target_state_recno
//
int CampaignEastWest::stage_9_create_game()
{
	init_random_plot('D');

	if( !stage_9_create_nation() )
		return 0;

	if( !stage_9_create_town() )
		return 0;

	if( !stage_9_create_firm() )
		return 0;

	//---- create the invading force from the eastern empire ----//

	create_troop(STAGE_9_EASTERN_NATION_RECNO, 10+campaign_difficulty*12);

	create_wagon(STAGE_9_EASTERN_NATION_RECNO, 10+campaign_difficulty*15+misc.random(10), 1);		// 1-useLastLocation

	//------ init stage 9 vars -------//

	stage_9_init_vars();

	//---- generate plants and other objects on the map -----//

	world.gen_rocks();		// generate mountains

	world.generate_map2();

	//------- create additional raw sites ----------//

	create_raw_site();

	//------- init relationship -------//

	stage_9_init_relation();

	// ####### begin Gilbert 9/4 ########//
	// ----- create royal units ------//

	create_royal_units(CAMPAIGN_PLAYER_NATION_RECNO);

	//------ plot create game --------//

	(this->*plot_create_game_FP)();
	// ####### end Gilbert 9/4 ########//

	return 1;
}
Example #6
0
//---- Begin of function CampaignEastWest::stage_10_create_game ----//
//
// Vars defined in event functions before calling this function:
//
// -cur_monster_nation_recno
// -attack_state_recno
// -target_state_recno
//
int CampaignEastWest::stage_10_create_game()
{
	init_random_plot('A');

	plot_enemy_nation_recno = STAGE_10_MONSTER_NATION_RECNO;

	//---- create game objects and vars ----//

	if( !stage_10_create_nation() )
		return 0;

	if( !stage_10_create_lair() )
		return 0;

	//---- create the player force ----//

	create_troop(PLAYER_NATION_RECNO, 65-campaign_difficulty*5, 75 );		// 70 - average combat level, an elite force

	//------ init stage 1 vars -------//

	stage_10_init_vars();

	//---- generate plants and other objects on the map -----//

	world.gen_rocks();		// generate mountains

	world.generate_map2();

	//------- create additional raw sites ----------//

	create_raw_site();

	//------- init relationship -------//

	stage_10_init_relation();

	// ####### begin Gilbert 9/4 ########//
	// ----- create royal units ------//

	create_royal_units(CAMPAIGN_PLAYER_NATION_RECNO);
	// ####### end Gilbert 9/4 ########//

	//------ plot create game --------//

	(this->*plot_create_game_FP)();

	return 1;
}
Example #7
0
//---- Begin of function CampaignEastWest::stage_4_create_game ----//
//
// Vars defined in event functions before calling this function:
//
// -eastern_nation_recno
// -target_state_recno
//
int CampaignEastWest::stage_4_create_game()
{
	init_random_plot('C');

   //----------------------------------//

	if( !stage_4_create_nation() )
		return 0;

	if( !stage_4_create_town() )
		return 0;

	if( !stage_4_create_firm() )
		return 0;

	//------ create the player troop -------//

	create_troop(PLAYER_NATION_RECNO, 65-campaign_difficulty*10, 65-campaign_difficulty*5);

	//------ init stage 1 vars -------//

	stage_4_init_vars();

	//---- generate plants and other objects on the map -----//

	world.gen_rocks();

	world.generate_map2();

	//------- create additional raw sites ----------//

	create_raw_site();

	//------- init relationship -------//

	stage_4_init_relation();

	// ----- create royal units ------//

	create_royal_units(CAMPAIGN_PLAYER_NATION_RECNO);

	//------ plot create game --------//

	(this->*plot_create_game_FP)();

	//---- randomly unveil the locations of some of the Eastern Empire's towns ----//

	for( int i=town_array.size() ; i>0 ; i-- )
	{
		if( town_array.is_deleted(i) )
			continue;

		Town* townPtr = town_array[i];

		if( townPtr->nation_recno == STAGE_4_EASTERN_NATION_RECNO &&
			 misc.random(2)==0 )
		{
			world.unveil( townPtr->loc_x1, townPtr->loc_y1, townPtr->loc_x2, townPtr->loc_y2 );
			world.visit( townPtr->loc_x1, townPtr->loc_y1, townPtr->loc_x2, townPtr->loc_y2, EXPLORE_RANGE-1 );
		}
	}

	return 1;
}
Example #8
0
File: oc_east1.cpp Project: 7k2/7k2
//---- Begin of function CampaignEastWest::stage_1_create_game ----//
//
// Vars defined in event functions before calling this function:
//
// None
//
int CampaignEastWest::stage_1_create_game()
{
    // ###### begin Gilbert 9/4 ########//
    init_random_plot(0);		// no plot
    // ###### end Gilbert 9/4 ########//

    if( !stage_1_create_nation() )
        return 0;

    if( !stage_1_create_town() )
        return 0;

    if( !stage_1_create_firm() )
        return 0;

    //------ create monsters ---------//

    int unitCountArray[MAX_CAMPAIGN_DIFFICULTY] = { 6, 10, 22, 31, 42 };

    create_troop(STAGE_1_MONSTER_NATION_RECNO, unitCountArray[campaign_difficulty-1] );

    if( unit_group.size() > 0 )		// when a troop is created successfully in create_troop(), unit_group will keep the created units
    {
        //--- create a unit for building

        Unit* unitPtr = unit_group.get_unit(1);
        int   xLoc = unitPtr->cur_x_loc();
        int   yLoc = unitPtr->cur_y_loc();

        int unitRecno = create_unit( STAGE_1_MONSTER_NATION_RECNO,
                                     unitPtr->unit_id, RANK_SOLDIER, xLoc, yLoc, xLoc, yLoc );
    }

    //------ init stage 1 vars -------//

    stage_1_init_vars();

    //---- generate plants and other objects on the map -----//

    world.gen_rocks();		// generate mountains

    world.generate_map2();

    //------- create additional raw sites ----------//

    create_raw_site();

    //------- init relationship -------//

    stage_1_init_relation();

    // ####### begin Gilbert 9/4 ########//
    // ----- create royal units ------//

    create_royal_units(CAMPAIGN_PLAYER_NATION_RECNO);
    // ####### end Gilbert 9/4 ########//

    //------ plot create game --------//

    // ###### begin Gilbert 28/3 ########//
    (this->*plot_create_game_FP)();
    // ###### end Gilbert 28/3 ########//

    return 1;
}