当前位置: 首页>>代码示例>>C++>>正文


C++ Battle类代码示例

本文整理汇总了C++中Battle的典型用法代码示例。如果您正苦于以下问题:C++ Battle类的具体用法?C++ Battle怎么用?C++ Battle使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Battle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: wxLogWarning

void BattleListTab::OnHost( wxCommandEvent& /*unused*/ )
{
	if ( !ui().IsConnected() )
	{
		wxLogWarning( _T( "Trying to host while offline" ) );
		customMessageBoxNoModal( SL_MAIN_ICON, _( "You cannot host a game while being offline. Please connect to a lobby server." ), _( "Not Online." ), wxOK );
		ui().ShowConnectWindow();
		return;
	}
	if ( !ui().IsSpringCompatible() )
	{
		wxLogWarning( _T( "Hosting is disabled due to the incompatible version " ) );
		customMessageBoxNoModal( SL_MAIN_ICON, _( "Hosting is disabled due to the incompatible version you're using" ), _( "Spring error" ), wxICON_EXCLAMATION | wxOK );
		return;
	}
	Battle* battle = ui().mw().GetJoinTab().GetCurrentBattle();
	if ( battle != 0 )
	{
		if ( ui().Ask( _( "Already in a battle" ), _( "You are already in a battle.\n\nDo you want to leave current battle to start a new?" ) ) ) {
			battle->Leave();
			ui().mw().GetJoinTab().LeaveCurrentBattle();
		}
		else
		{
			return;
		}
	}

	SL::RunHostBattleDialog( this );
}
开发者ID:hoijui,项目名称:springlobby,代码行数:30,代码来源:battlelisttab.cpp

示例2: wxLogDebugFunc

void ServerEvents::OnUserQuit( const wxString& nick )
{
    wxLogDebugFunc( _T("") );
    try
    {
        User &user=m_serv.GetUser( nick );
				Battle* userbattle = user.GetBattle();
				if ( userbattle )
				{
					int battleid = userbattle->GetID();
					try
					{
						if ( &userbattle->GetFounder() == &user )
						{
							for ( int i = 0; i < int(userbattle->GetNumUsers()); i ++ )
							{
								User& battleuser = userbattle->GetUser( i );
								OnUserLeftBattle( battleid, battleuser.GetNick() );
							}
							 OnBattleClosed( battleid );
						}
						else OnUserLeftBattle( battleid, user.GetNick() );
					}catch(...){}
				}
        ui().OnUserOffline( user );
        m_serv._RemoveUser( nick );
        if ( useractions().DoActionOnUser( UserActions::ActNotifLogin, nick ) )
            actNotifBox( SL_MAIN_ICON, nick + _(" just went offline") );
    }
    catch (std::runtime_error &except)
    {
    }
}
开发者ID:mallyvai,项目名称:springlobby,代码行数:33,代码来源:serverevents.cpp

示例3: wxLogDebugFunc

void SimpleServerEvents::OnUserQuit( const wxString& nick )
{
    wxLogDebugFunc( _T("") );
    try
    {
        User &user=m_serv.GetUser( nick );
				Battle* userbattle = user.GetBattle();
				if ( userbattle )
				{
					int battleid = userbattle->GetID();
					try
					{
						if ( &userbattle->GetFounder() == &user )
						{
							for ( int i = 0; i < int(userbattle->GetNumUsers()); i ++ )
							{
								User& battleuser = userbattle->GetUser( i );
								OnUserLeftBattle( battleid, battleuser.GetNick() );
							}
							 OnBattleClosed( battleid );
						}
						else OnUserLeftBattle( battleid, user.GetNick() );
					}catch(...){}
				}
//        ui().OnUserOffline( user );
        m_serv._RemoveUser( nick );
    }
    catch (std::runtime_error &except)
	{ }
}
开发者ID:SpliFF,项目名称:springlobby,代码行数:30,代码来源:simpleserverevents.cpp

示例4: judge_dragon_ship_btl_over

bool  judge_dragon_ship_btl_over(Player * player) {
	Battle * btl = player->btl;
	if (btl->pvp_lv() == pvp_dragon_ship && !btl->is_battle_ended()) {
		//failed 
		Player * player_1 = btl->get_one_player();

		if (player_1 && player_1->my_summon) {
			if (player_1->pos().x() + 10 >= player_1->my_summon->pos().x() &&
					player_1->my_summon->i_ai->common_flag1_) {
				end_pvp_on_player_dead(btl, player_1, player_1->team);
				return true;
			}
		}

		Player* player_2 =  btl->get_one_other_player(player_1);
		if (player_2 && player_2->my_summon) {
			if (player_2->pos().x() + 10 >= player_2->my_summon->pos().x() && 
					player_2->my_summon->i_ai->common_flag1_) {
				end_pvp_on_player_dead(btl, player_2, player_2->team);
				return true;
			}
		}
	}
	return false;
}
开发者ID:Zhanyin,项目名称:taomee,代码行数:25,代码来源:SummonMonAI.cpp

示例5:

bool    battle_mgr::is_battle_exist(uint32_t battle_id)
{
	std::list<Battle*>::iterator pItr = btl_list.begin();
	for(; pItr != btl_list.end(); ++pItr)
	{
		Battle* btl = *pItr;
		if(btl->get_battle_id() == battle_id)return true;
	}
	return false;
}
开发者ID:Zhanyin,项目名称:taomee,代码行数:10,代码来源:battle_manager.cpp

示例6: setViewString

void BattleEvent::start() {
	setViewString("A monster has appeared!");
	Battle *nb = new Battle();
	MonsterManager &mm = MonsterManager::getInstance();
	//Monster *mon = mm.getMonster("centaur"); //mm.randomMonster();
	Monster* mon = mm.randomMonster();

	rewardval = mon->getReward();
	nb->addMonster(mon);
	SceneManager::getInstance().push(nb);
}
开发者ID:bpeake13,项目名称:IMGD3000,代码行数:11,代码来源:BattleEvent.cpp

示例7: battleChanged

void BattleInfo::battleChanged(const Battle & battle)
{
    if (battle.id() == battleId_)
    {
        if (currentMapImage_ != battle.mapName())
        {
            setMapImage(battle);
        }
        setHeaderText(battle);
    }
}
开发者ID:nodenstuff,项目名称:flobby,代码行数:11,代码来源:BattleInfo.cpp

示例8: centerOnMonsterInTB

void ScourgeView::centerOnMonsterInTB() {
    scourge->getMap()->setMapCenterCreature( NULL );
    if ( scourge->inTurnBasedCombat() ) {
        Battle *battle = scourge->getCurrentBattle();
        Creature *c = battle->getCreature();
        if ( !c->isPartyMember() || c->getStateMod( StateMod::possessed ) ) {
            scourge->getMap()->setMapCenterCreature( c );
            scourge->getMap()->center( toint( c->getX() ), toint( c->getY() ), true );
        }
    }
}
开发者ID:q4a,项目名称:scourge,代码行数:11,代码来源:scourgeview.cpp

示例9: main

void main(int argc, char** argv) {
	/* TODO: Parsing and options */
	Battle battle;
	battle.initBattle();
	Game game;
	game.setBattle();
	while(!game.isFinished()) {
		game.limitFPS();
		game.step();
	}
	
	return 0;
};
开发者ID:Valguris,项目名称:Victory-Battle,代码行数:13,代码来源:main.cpp

示例10: Battle

size_t AmbushEvent::failure() {
  Battle* battle = new Battle(_storage, _raid_participants, _raid_slaves, _raid_resources, _raid_loot);
  battle->generate_enemies(FS_MEDIUM);
  size_t battle_outcome = battle->play();
  delete battle;
  if (battle_outcome == BO_RAIDERS_WON) {
    increase_misc_stat(MI_MORALE, BATTLE_MORALE_BOOST);
    return EO_SUCCESS;
  } else {
    decrease_misc_stat(MI_MORALE, BATTLE_MORALE_BOOST);
    return EO_FAILURE;
  }
}
开发者ID:KCherkasov,项目名称:Vikings_village,代码行数:13,代码来源:AmbushEvent.cpp

示例11: get_battle_by_id

Battle*  battle_mgr::get_battle_by_id(uint32_t battle_id)
{
	std::list<Battle*>::iterator pItr = btl_list.begin();
	for(; pItr != btl_list.end(); ++pItr)
	{
		Battle* btl = *pItr;
		if(btl->get_battle_id() == battle_id)
		{
			return btl;
		}
	}
	return NULL;
}
开发者ID:Zhanyin,项目名称:taomee,代码行数:13,代码来源:battle_manager.cpp

示例12: player_roll_item_cmd

int player_roll_item_cmd(Player* p, uint8_t* body, uint32_t bodylen)
{
	CHECK_VAL_EQ(bodylen, (uint32_t)sizeof(player_roll_item_t));
	player_roll_item_t* pRoll = reinterpret_cast<player_roll_item_t*>(body);	
	int32_t roll_point = 0;	
	bool ret = set_player_roll_point(p, pRoll->battle_id, pRoll->roll_id, pRoll->roll_flag, roll_point);
	if( !ret){
		return send_header_to_player(p, p->waitcmd, cli_err_roll_item_fail, 1); 
	}
	Battle *btl = p->btl;
	//notify the other team player execpt myself and not clear waitcmd
	btl->notify_team_roll_point(pRoll->roll_id, p->id, roll_point, p->id);
	//notify myself and clear waitcmd
	return send_roll_point(p, pRoll->roll_id, roll_point);
}
开发者ID:Zhanyin,项目名称:taomee,代码行数:15,代码来源:roll.cpp

示例13: Battle

bool EnemyCard::encounter(Character* character, Game* game)
{
  game->getUI()->announce("You have encountered a " + this->title() + "!");
  Battle * battle = new Battle();
  int results = battle->cardFight(character, this, game);
  if (results == 1) {
    //Player won! Card is added to trophies and removed from the tile.
    character->addTrophy(this);
    return true;
  }
  else {
    //Stand-off or player has lost. Do not remove card from the tile.
    return false;
  }
}
开发者ID:pmlt,项目名称:talisman,代码行数:15,代码来源:AdventureCard.cpp

示例14: AutoCheckCommandSpam

void SimpleServerEvents::AutoCheckCommandSpam( Battle& battle, User& user )
{
    wxString nick = user.GetNick();
    MessageSpamCheck info = m_spam_check[nick];
    time_t now = time( 0 );
    if ( info.lastmessage == now ) info.count++;
    else info.count = 0;
    info.lastmessage = now;
    m_spam_check[nick] = info;
    if ( info.count == 7 )
    {
			battle.DoAction( _T("is autokicking ") + nick + _T(" due to command spam.") );
			battle.KickPlayer( user );
    }
}
开发者ID:SpliFF,项目名称:springlobby,代码行数:15,代码来源:simpleserverevents.cpp

示例15: battle

void BattleInfo::battle(Battle const & battle)
{
    battleId_ = battle.id();

    setMapImage(battle);
    setHeaderText(battle);
}
开发者ID:nodenstuff,项目名称:flobby,代码行数:7,代码来源:BattleInfo.cpp


注:本文中的Battle类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。