本文整理汇总了C++中PlayerEntity::getColor方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerEntity::getColor方法的具体用法?C++ PlayerEntity::getColor怎么用?C++ PlayerEntity::getColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerEntity
的用法示例。
在下文中一共展示了PlayerEntity::getColor方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: missilePass
//魔弹传递
void BackgroundEngine::missilePass(bool rightOrder,int dst,int src,bool* passed,int missilePoint)
{
int i;
PlayerEntity* srcPlayer = getPlayerByID(src);
PlayerEntity* dstPlayer = getPlayerByID(dst);
PlayerEntity* next = dstPlayer;
passed[srcPlayer->getSeatNum()] = true;
for(i = 0;i < this->playerList.size();i++)
{
if(!*(passed+i) && (i != dstPlayer->getSeatNum()))
break;
}
if(i == this->playerList.size())
{
for(int j = 0;j < this->playerList.size();j++)
*(passed + j) = false;
}
if(rightOrder)
{
while((next->getColor() == dstPlayer->getColor()) || *(passed + next->getSeatNum()))
next = next->getNext();
coder.askForMissile(dst,src,missilePoint,next->getID());
}
else
{
while((next->getColor() == dstPlayer->getColor()) || passed[next->getSeatNum()])
next = this->getFront(next);
coder.askForMissile(dst,src,missilePoint,next->getID());
}
}
示例2: ChongYing
//【充盈】
int MoQiang::ChongYing(Action* action)
{
//检查客户端返回的是否为魔法牌&&雷系牌
int cardID = action->card_ids(0);
CardEntity* card = getCardByID(cardID);
if( card->getType() != TYPE_MAGIC&&card->getElement()!=ELEMENT_THUNDER ){
return GE_SUCCESS;
}
cardCount=0;
used_ChongYing=true;
SkillMsg skill_msg;
//丢弃魔法牌&&雷系牌
Coder::skillNotice(id, id, CHONG_YING, skill_msg);
engine->sendMessage(-1, MSG_SKILL, skill_msg);
CardMsg show_card;
Coder::showCardNotice(id, 1, cardID, show_card);
engine->sendMessage(-1, MSG_CARD, show_card);
//所有移牌操作都要用setStateMoveXXXX,ToHand的话要填好HARM,就算不是伤害
PlayerEntity* it = this->getPre();
HARM chongying;
chongying.cause =CHONG_YING;
chongying.point = 1;
chongying.srcID = id;
chongying.type = HARM_NONE;
HARM chongying_discard;
chongying_discard.cause =CHONG_YING_DISCARD;
chongying_discard.point = 1;
chongying_discard.srcID = id;
chongying_discard.type = HARM_NONE;
//先进后出,所以逆出牌顺序压,最后才是魔枪自己明弃法牌
while(it != this){
//bool isShown = false, bool canGiveUp = false
if(it->getColor()!=color)
engine->pushGameState(new StateRequestHand(it->getID(),chongying, -1, DECK_DISCARD, true, false)); //不能不弃牌
else
engine->pushGameState(new StateRequestHand(it->getID(),chongying_discard, -1, DECK_DISCARD, true, true));
it = it->getPre();
}
engine->pushGameState(new StateRequestHand(this->getID(),chongying_discard, -1, DECK_DISCARD, true, true));
engine->setStateMoveOneCardNotToHand(id, DECK_HAND, -1, DECK_DISCARD, cardID, id, CHONG_YING, true);
addAction(ACTION_ATTACK,CHONG_YING);
return GE_URGENT;
}
示例3: missileProcess
//魔弹处理
void BackgroundEngine::missileProcess(CardEntity* card,int src,int dst)
{
bool rightOrder;
BatInfor reply;
PlayerEntity* nextOpponent;
//确定传递方向
nextOpponent = this->getCurrentPlayer()->getNext();
while(nextOpponent->getColor() == this->currentPlayer->getColor())
nextOpponent = nextOpponent->getNext();
if(nextOpponent->getID() == dst)
rightOrder = true;
else
rightOrder = false;
bool passed[6];
for(int i = 0;i < this->playerList.size();i++)
{
passed[i] = false;
}
int missilePoint = 2;
QList<CardEntity*> cards;
do
{
cards.clear();
//魔弹传递到下家
missilePass(rightOrder,dst,src,passed,missilePoint);
//读取用户回复
reply = messageBuffer::readBatInfor();
if(reply.reply == 0)
{
//继续传递
src = dst;
dst = reply.dstID;
missilePoint++;
cards << getCardByID(reply.CardID);
this->useCard(cards,getPlayerByID(src),getPlayerByID(dst),false);
continue;
}
else if(reply.reply == 1)
{
//圣光
cards << getCardByID(reply.CardID);
this->useCard(cards,getPlayerByID(dst));
break;
}
else if(reply.reply == 2)
{
//无应对
PlayerEntity* dstPlayer = getPlayerByID(dst);
bool shieldBlocked = false;
//检查圣盾
for(int i = 0;i < dstPlayer->getBasicEffect().size();i++)
{
if(dstPlayer->getBasicEffect()[i]->getMagicName() == SHIELDCARD||dstPlayer->getBasicEffect().at(i)->getSpecialityList().contains(tr("天使之墙")))
{
coder.shieldNotic(dst);
dstPlayer->removeBasicEffect(dstPlayer->getBasicEffect()[i]);
shieldBlocked = true;
break;
}
}
if(shieldBlocked)
break;
Harm missileHurt;
missileHurt.harmPoint = missilePoint;
missileHurt.type = MAGIC;
//无圣盾,造成伤害
this->timeLine3(missileHurt,getPlayerByID(src),dstPlayer,"魔弹");
break;
}
else if(reply.reply == 802)
{
//继续传递
src = dst;
dst = reply.dstID;
missilePoint++;
cards << getCardByID(reply.CardID);
useCard(cards,getPlayerByID(src),getPlayerByID(dst));
coder.notice("魔导师发动【魔弹融合】");
continue;
}
}while(1);
}
示例4: v_magic_skill
int ShenGuan::v_magic_skill(Action *action)
{
int actionID = action->action_id();
int cardID;
int playerID = action->src_id();
CardEntity* card;
PlayerEntity* dst;
if(playerID != id){
return GE_INVALID_PLAYERID;
}
switch(actionID)
{
case SHEN_SHENG_QI_FU:
if(action->card_ids_size() != 2)
{
return GE_INVALID_ACTION;
}
for(int i =0;i<action->card_ids_size();i++)
{
cardID = action->card_ids(i);
card = getCardByID(cardID);
if(TYPE_MAGIC != card->getType() || GE_SUCCESS != checkOneHandCard(cardID))
{
return GE_INVALID_ACTION;
}
}
break;
case SHUI_ZHI_SHEN_LI:
cardID = action->card_ids(0);
card = getCardByID(cardID);
dst = engine->getPlayerEntity(action->dst_ids(0));
if(GE_SUCCESS != checkOneHandCard(cardID) || card->getElement() != ELEMENT_WATER || color != dst->getColor() || action->dst_ids_size() != 1){
return GE_INVALID_ACTION;
}
break;
case SHEN_SHENG_LING_YU:
dst = engine->getPlayerEntity(action->dst_ids(0));
if(this->getHandCardNum()>2){
if (action->card_ids_size()!=2){
return GE_INVALID_ACTION;
}
}
else if( getHandCardNum() != action->card_ids_size()){
return GE_INVALID_ACTION;
}
if(action->args(0) == 1){
if (getEnergy() < 1 || crossNum < 1){
return GE_INVALID_ACTION;
}
}
else if(getEnergy() < 1 || dst->getColor() != color){
return GE_INVALID_ACTION;
}
break;
default:
return GE_INVALID_ACTION;
}
return GE_SUCCESS;
}