//------- Begin of function UnitGod::pre_process -------// // void UnitGod::pre_process() { Unit::pre_process(); if( game.game_mode == GAME_TEST ) return; //---- set force_move_flag to 1 if the god does not have the ability to attack ----// if( god_id != GOD_CHINESE && god_id != GOD_NORMAN ) // only Chinese and Norman dragon can attack force_move_flag = 1; //-*********** simulate aat ************-// #ifdef DEBUG if(debug_sim_game_type) return; #endif //-*********** simulate aat ************-// //--- if the seat of power supporting this unit is destroyed, this unit dies ---// if( firm_array.is_deleted(base_firm_recno) ) { hit_points=(float)0; set_die(); return; } //---- this unit consume pray points as it exists ----// FirmBase* firmBase = (FirmBase*) firm_array[base_firm_recno]; err_when( firmBase->firm_id != FIRM_BASE ); firmBase->pray_points -= (float) god_res[god_id]->exist_pray_points / 200; if( firmBase->pray_points < 0 ) firmBase->pray_points = (float) 0; //--------- update hit points --------// hit_points = (short) firmBase->pray_points; if( hit_points == 0 ) set_die(); }
void create() { ::create(); set_property("no corpse", 1); set_undead(1); set_die("%^BOLD%^%^WHITE%^The ghost vanishes.%^RESET%^"); set_name("ghost"); set_short("a pale ghost"); set_long("The ghost is translucent, but the body that's visible " "looks more like a tattered sheet. It flaps in a breeze you cannot feel."); set_gender(({"male","female"})[random(2)]);
//--------- Begin of function Unit::pre_process ---------// // void Unit::pre_process() { //--- if the unit's hit point drops to 0, it dies now ---// if( hit_points <= 0 ) { set_die(); return; } //------- process fog of war ----------// visit_area(); //------ process unit_mode -------// #ifdef DEBUG long startTime; #endif switch( unit_mode ) { case UNIT_MODE_TOWN_DEFENDER: #ifdef DEBUG startTime = m.get_time(); #endif process_mode_town_defender(); #ifdef DEBUG unit_process_town_defender_profile_time += m.get_time() - startTime; #endif break; case UNIT_MODE_CAMP_DEFENDER: #ifdef DEBUG startTime = m.get_time(); #endif process_mode_camp_defender(); #ifdef DEBUG unit_process_camp_defender_profile_time += m.get_time() - startTime; #endif break; case UNIT_MODE_REBEL: #ifdef DEBUG startTime = m.get_time(); #endif process_mode_rebel(); #ifdef DEBUG unit_process_rebel_profile_time += m.get_time() - startTime; #endif break; } //--- if the current order has been reset and there is a pushed order, pop the order ---// if( cur_order.mode==0 && has_pushed_order() ) pop_order(); //-------- process unit order now -------// switch( cur_order.mode ) { case UNIT_MOVE: // nothing to do with move mode, as UnitB already takes care of it #ifdef DEBUG startTime = m.get_time(); #endif execute_move(); #ifdef DEBUG unit_execute_move_profile_time += m.get_time() - startTime; #endif break; case UNIT_ATTACK: #ifdef DEBUG startTime = m.get_time(); #endif execute_attack(); #ifdef DEBUG unit_execute_attack_profile_time += m.get_time() - startTime; #endif break; case UNIT_BUILD_FIRM: #ifdef DEBUG startTime = m.get_time(); #endif execute_build_firm(); #ifdef DEBUG unit_execute_build_firm_profile_time += m.get_time() - startTime; #endif break; case UNIT_SETTLE_TOWN: #ifdef DEBUG startTime = m.get_time(); #endif execute_settle_town(); #ifdef DEBUG unit_execute_settle_town_profile_time += m.get_time() - startTime; #endif break; case UNIT_ASSIGN: #ifdef DEBUG startTime = m.get_time(); #endif execute_assign(); #ifdef DEBUG unit_execute_assign_profile_time += m.get_time() - startTime; #endif break; case UNIT_GO_CAST_POWER: #ifdef DEBUG startTime = m.get_time(); #endif execute_go_cast_power(); #ifdef DEBUG unit_cast_power_profile_time += m.get_time() - startTime; #endif break; case UNIT_TRANSFORM_FORTRESS: #ifdef DEBUG startTime = m.get_time(); #endif execute_transform_fortress(); #ifdef DEBUG unit_transform_fortress_profile_time += m.get_time() - startTime; #endif break; } }
skills_bag( const std::string& s, dice_e d ) : skills_bag() { set_die( s, d ); }