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


C++ PlayerEntity::getHandCardNum方法代码示例

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


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

示例1: showTest

//测试用
void BackgroundEngine::showTest()
{
    PlayerEntity* player;
    char temp[500];
    QString tempStr;
    for(int i = 0;i < this->getPlayerNum();i++)
    {
        player = this->playerList.at(i);
        sprintf(temp,"player%d:\n",player->getID());
        tempStr.append(temp);

        for(int j = 0;j < player->getHandCardNum();j++)
        {

            tempStr.append(player->getHandCards().at(j)->getName());
            tempStr += QString::number(player->getHandCards().at(j)->getID());
            tempStr += " ";
        }
        tempStr += "\n";
    }

    sprintf(temp,"red team:%d\n",teamArea.getMorale(RED));
    tempStr.append(temp);
    sprintf(temp,"blue team:%d\n",teamArea.getMorale(BLUE));
    tempStr.append(temp);
    emit this->toInforDisplay(tempStr);
}
开发者ID:dreamStar,项目名称:Asteriated_Grail,代码行数:28,代码来源:BackGroundEngine.cpp

示例2: FengXing

int LingFu::FengXing(Action *action)
{
	int cardID = action->card_ids(0);
	int dst1ID = action->dst_ids(0);
	int dst2ID = action->dst_ids(1);
	list<int> dstIDs;
	dstIDs.push_back(dst1ID);
	dstIDs.push_back(dst2ID);
	//宣告技能
	network::SkillMsg skill;
	Coder::skillNotice(id, dstIDs, FENG_XING, skill);
	engine->sendMessage(-1, MSG_SKILL, skill);
    //所有移牌操作都要用setStateMoveXXXX,ToHand的话要填好HARM,就算不是伤害
	
	HARM fengXing;
	fengXing.cause = FENG_XING;
	fengXing.point = 1;
	fengXing.srcID = id;
	fengXing.type = HARM_NONE;
	//先进后出,所以逆出牌顺序压,由自己开始明弃牌
	PlayerEntity* start = this->getPre();
	PlayerEntity* it = start;
	do{
		//没有手牌就不用弃
		if(it->getHandCardNum() > 0 && (it->getID() == dst1ID || it->getID() == dst2ID)){
			engine->pushGameState(new StateRequestHand(it->getID(), fengXing, -1, DECK_DISCARD, false, false));
		}
		it = it->getPre();
	}while(it != start);
	NianZhou();
	CardMsg show_card;
	Coder::showCardNotice(id, 1, cardID, show_card);
	engine->sendMessage(-1, MSG_CARD, show_card);
	engine->setStateMoveOneCardNotToHand(id, DECK_HAND, -1, DECK_DISCARD, cardID, id, FENG_XING, true);
	//插入了新状态,请return GE_URGENT
	return GE_URGENT;
}
开发者ID:GaelClichy,项目名称:CodfiyAsteriatedGrailServer,代码行数:37,代码来源:LingFu.cpp


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