//【充盈】 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; }
int LingFu::BaiGuiYeXing_Effect() { HARM baiGui; baiGui.cause = BAI_GUI_YE_XING; baiGui.point = using_LingLiBengJie ? 2 : 1; baiGui.srcID = id; baiGui.type = HARM_MAGIC; if(isExposed){ PlayerEntity* it = this->getPre(); //先进后出,所以逆出牌顺序压 do{ if(it->getID() != dstIDs[0] && it->getID() != dstIDs[1]){ engine->setStateTimeline3(it->getID(), baiGui); } it = it->getPre(); }while(it != this->getPre()); } else{ engine->setStateTimeline3(dstIDs[0], baiGui); } return GE_URGENT; }
int LingFu::LeiMing_Effect(Action *action) { int dst1ID = action->dst_ids(0); int dst2ID = action->dst_ids(1); //填写伤害结构 HARM leiMing; leiMing.cause = LEI_MING; leiMing.point = using_LingLiBengJie ? 2 : 1; leiMing.srcID = id; leiMing.type = HARM_MAGIC; //先进后出,所以逆出牌顺序压 PlayerEntity* start = this->getPre(); PlayerEntity* it = start; do{ if(it->getID() == dst1ID || it->getID() == dst2ID){ engine->setStateTimeline3(it->getID(), leiMing); } it = it->getPre(); }while(it != start); //插入了新状态,请return GE_URGENT return GE_URGENT; }
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; }