//测试用 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); }
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; }