struct Room *get_hated_room_for_quick_attack(struct Computer2 *comp, long min_hate) { struct THate hates[PLAYERS_COUNT]; long i; SYNCDBG(8,"Starting for player %d",(int)comp->dungeon->owner); get_opponent(comp, hates); // note that 'i' is not player index, player index is inside THate struct for (i=0; i < PLAYERS_COUNT; i++) { struct THate *hate; hate = &hates[i]; if (players_are_enemies(comp->dungeon->owner, hate->plyr_idx)) { if ((hate->pos_near != NULL) && (hate->amount > min_hate)) { struct Room *room; room = get_opponent_room(comp, hate->plyr_idx); if (!room_is_invalid(room)) { return room; } } } } return INVALID_ROOM; }
void Game_Utils::asynchronous_battle_reset_data() { UI::Actor* actor = get_primary_actor(); actor->set_is_dead(false); reset_character(actor->sprite_id()); actor = get_opponent(); actor->set_is_dead(false); reset_character(actor->sprite_id()); }
void Game_Utils::send_Real_Time_pk_press_key( int key ) { // CCLOG("Game_Utils::send_Real_Time_pk_press_key( int key = %d )",key); int target_id = get_opponent()->sprite_id(); vector<uint64> para; para.push_back(target_id); para.push_back(key); Game_Logic::Game_Content_Interface::instance()->exec_interface("send_online_fight_use_skill",para); }
void Game_Utils::send_Real_Time_pk_joystick_velocity( int x, int y ) { int target_id = get_opponent()->sprite_id(); vector<uint64> para; para.push_back(target_id); para.push_back(x); para.push_back(y); Game_Logic::Game_Content_Interface::instance()->exec_interface("send_online_fight_move",para); }
void Game_Utils::start_asynchronous_battle() { get_opponent()->set_is_hosting(true); set_operator_is_disable(false); UI::Game_UI_Delegate * gl = get_Game_UI_layer(); if(gl){ gl->updateCountdownCallback(); } }
void Game_Utils::send_Real_Time_PK_result( bool bWin ) { CCLOG("send Real Time PK Result %s", bWin?"win":"fail"); int target_id = get_opponent()->sprite_id(); vector<uint64> para; para.push_back(target_id); para.push_back(bWin); Game_Logic::Game_Content_Interface::instance()->exec_interface("send_online_fight_result",para); }
bool MatchPool::pop(int size_type, std::vector<MatchEntity*> &camps) { if (camps.size() != size_t(_camp_size)) { return false; } // find entity for first camp MatchEntity *ent = camps[0]; if (!top(*ent, size_type)) { return false; } // find others' camp members with size_type for (size_t i = 1;i < camps.size(); i++) { MatchEntity *opp = camps[i]; if (!get_opponent(ent, opp, ent->size)) { return false; } } // find left members int size = ent->get_size(); while (size < _team_size) { // find buddies if (!get_buddy(_team_size - size, camps[0])) { return false; } // find oppoents for (size_t i = 1;i < camps.size(); i++) { if (!get_opponent(camps[0], camps[i], _team_size - size)) { return false; } } size += camps[0]->get_size(); } return true; }
void Game_Utils::asynchronous_battle_fail() { set_operator_is_disable(true); int cur_rank = OFFLINE_FIGHT_MGR::instance()->get_self_cur_rank(); Game_Data::offline_fight_challenge_reward_config* config = FIGHT_CONFIG_MGR::instance()->get_offline_fight_challenge_reward_config(cur_rank); if (config) { UI::Game_UI_Delegate * gl = get_Game_UI_layer(); if(gl){ gl->showResult(false, config->lose_gold_, config->lose_prestige_); } } OFFLINE_FIGHT_LOGIC::instance()->offline_fight_finish(get_opponent()->sprite_id(),0); }
void Game_Utils::Real_Time_PK_reset_data() { CCLOG("Real_Time_PK_reset_data"); reset_character(get_primary_actor_id()); reset_character(get_opponent()->sprite_id()); }