本文整理汇总了C++中PlayerEntity::addCrossNum方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerEntity::addCrossNum方法的具体用法?C++ PlayerEntity::addCrossNum怎么用?C++ PlayerEntity::addCrossNum使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerEntity
的用法示例。
在下文中一共展示了PlayerEntity::addCrossNum方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ShuiZhiShenLi
int ShenGuan::ShuiZhiShenLi(int &step, Action* action)
{
int cardID = action->card_ids(0);
int dstID = action->dst_ids(0);
PlayerEntity *dstPlayer = engine->getPlayerEntity(dstID);
if(step == SHUI_ZHI_SHEN_LI)
{
SkillMsg skill_msg;
Coder::skillNotice(id, dstID, SHUI_ZHI_SHEN_LI, 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);
engine->setStateMoveOneCardNotToHand(id, DECK_HAND, -1, DECK_DISCARD, cardID, id, SHUI_ZHI_SHEN_LI, true);
step = SHUI_ZHI_SHEN_LI_GIVE;
return GE_URGENT;
}
if(step == SHUI_ZHI_SHEN_LI_GIVE)
{
if(this->getHandCardNum() == 0)
{
addCrossNum(1);
dstPlayer->addCrossNum(1);
GameInfo update_info;
Coder::crossNotice(id, getCrossNum(), update_info);
Coder::crossNotice(dstID, dstPlayer->getCrossNum(), update_info);
engine->sendMessage(-1, MSG_GAME, update_info);
step = STEP_DONE;
return GE_SUCCESS;
}
else
{
HARM shuishen;
shuishen.cause = SHUI_ZHI_SHEN_LI;
shuishen.point = 1;
shuishen.srcID = id;
shuishen.type = HARM_NONE;
engine->pushGameState(new StateRequestHand(id, shuishen, dstID, DECK_HAND));
step = SHUI_ZHI_SHEN_LI_CROSS;
return GE_URGENT;
}
}
if(step == SHUI_ZHI_SHEN_LI_CROSS)
{
addCrossNum(1);
dstPlayer->addCrossNum(1);
GameInfo update_info;
Coder::crossNotice(id, getCrossNum(), update_info);
Coder::crossNotice(dstID, dstPlayer->getCrossNum(), update_info);
engine->sendMessage(-1, MSG_GAME, update_info);
step = STEP_DONE;
return GE_SUCCESS;
}
}
示例2: ShengLiao
int ShengNv::ShengLiao(Action* action)
{
SkillMsg skill_msg;
list<int> dsts;
int dstID;
PlayerEntity * dstPlayer;
for(int i=0; i < action->dst_ids_size(); i ++)
{
dsts.push_back(action->dst_ids(i));
}
Coder::skillNotice(id, dsts, SHENG_LIAO, skill_msg);
engine->sendMessage(-1, MSG_SKILL, skill_msg);
//更新能量
GameInfo update_info;
if(crystal>0){
setCrystal(--crystal);
}
else{
setGem(--gem);
}
Coder::energyNotice(id, gem, crystal, update_info);
engine->sendMessage(-1, MSG_GAME, update_info);
for(int i=0; i < action->dst_ids_size(); i ++)
{
dstID = action->dst_ids(i);
dstPlayer = engine->getPlayerEntity(dstID);
dstPlayer->addCrossNum(action->args(i));
GameInfo update_info;
Coder::crossNotice(dstID, dstPlayer->getCrossNum(), update_info);
engine->sendMessage(-1, MSG_GAME, update_info);
}
used_ShengLiao = true;
addAction(ACTION_ATTACK_MAGIC, SHENG_LIAO);
return GE_SUCCESS;
}
示例3: ZhiLiaoShu
int ShengNv::ZhiLiaoShu(int &step, Action* action)
{
int dstID = action->dst_ids(0);
int cardID = action->card_ids(0);
PlayerEntity * dstPlayer = engine->getPlayerEntity(dstID);
if(step != ZHI_LIAO_SHU)
{
SkillMsg skill_msg;
Coder::skillNotice(id, dstID, ZHI_LIAO_SHU, 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);
engine->setStateMoveOneCardNotToHand(id, DECK_HAND, -1, DECK_DISCARD, cardID, id, ZHI_LIAO_SHU, true);
//插入了新状态,请return GE_URGENT
return GE_URGENT;
}
else
{
dstPlayer->addCrossNum(2);
GameInfo update_info;
Coder::crossNotice(dstID, dstPlayer->getCrossNum(), update_info);
engine->sendMessage(-1, MSG_GAME, update_info);
return GE_SUCCESS;
}
}
示例4: ShenShengQiShi
int ShenGuan::ShenShengQiShi(int &step, int srcID)
{
if(srcID != id){
return GE_SUCCESS;
}
CommandRequest cmd_req;
Coder::askForSkill(id, SHEN_SHENG_QI_SHI, cmd_req);
int ret;
//有限等待,由UserTask调用tryNotify唤醒
if(engine->waitForOne(id, network::MSG_CMD_REQ, cmd_req))
{
void* reply;
if (GE_SUCCESS == (ret = engine->getReply(srcID, reply)))
{
Respond* respond = (Respond*) reply;
//发动
if(respond->args(0) == 1){
network::SkillMsg skill;
Coder::skillNotice(id, id, SHEN_SHENG_QI_SHI, skill);
engine->sendMessage(-1, MSG_SKILL, skill);
int dstID = id;
PlayerEntity * dstPlayer = engine->getPlayerEntity(dstID);
dstPlayer->addCrossNum(1);
GameInfo update_info;
Coder::crossNotice(dstID, dstPlayer->getCrossNum(), update_info);
engine->sendMessage(-1, MSG_GAME, update_info);
}
}
return ret;
}
else{
//超时啥都不用做
return GE_TIMEOUT;
}
}
示例5: BingShuangDaoYan
int ShengNv::BingShuangDaoYan(CONTEXT_TIMELINE_1 *con)
{
int srcID = con->attack.srcID;
int cardID = con->attack.cardID;
CardEntity* card = getCardByID(cardID);
if (srcID != id || card->getElement() != ELEMENT_WATER){
return GE_SUCCESS;
}
CommandRequest cmd_req;
int ret;
Coder::askForSkill(id, BING_SHUANG_DAO_YAN, cmd_req);
//有限等待,由UserTask调用tryNotify唤醒
if(engine->waitForOne(id, network::MSG_CMD_REQ, cmd_req))
{
void* reply;
if (GE_SUCCESS == (ret = engine->getReply(id, reply)))
{
Respond* respond = (Respond*) reply;
int dstID = respond->dst_ids(0);
PlayerEntity * dstPlayer = engine->getPlayerEntity(dstID);
SkillMsg skill_msg;
Coder::skillNotice(id, id, BING_SHUANG_DAO_YAN, skill_msg);
engine->sendMessage(-1, MSG_SKILL, skill_msg);
dstPlayer->addCrossNum(1);
GameInfo update_info;
Coder::crossNotice(dstID, dstPlayer->getCrossNum(), update_info);
engine->sendMessage(-1, MSG_GAME, update_info);
}
return ret;
}
else{
//超时为自己加治疗
int dstID = id;
PlayerEntity * dstPlayer = engine->getPlayerEntity(dstID);
SkillMsg skill_msg;
Coder::skillNotice(id, id, BING_SHUANG_DAO_YAN, skill_msg);
engine->sendMessage(-1, MSG_SKILL, skill_msg);
dstPlayer->addCrossNum(1);
GameInfo update_info;
Coder::crossNotice(dstID, dstPlayer->getCrossNum(), update_info);
engine->sendMessage(-1, MSG_GAME, update_info);
return GE_TIMEOUT;
}
}
示例6: ShenShengQiYue
int ShenGuan::ShenShengQiYue()
{
if(this->getHandCardNum() == 0 && this->getEnergy() == 1)
return GE_SUCCESS;
if(this->getEnergy() == 1 && this->getHandCardNum() == 1 && getCardByID(*this->getHandCards().begin())->getElement() == ELEMENT_LIGHT)
return GE_SUCCESS;
CommandRequest cmd_req;
Coder::askForSkill(id, SHEN_SHENG_QI_YUE, cmd_req);
//有限等待,由UserTask调用tryNotify唤醒
if(engine->waitForOne(id, network::MSG_CMD_REQ, cmd_req))
{
void* reply;
int ret;
if (GE_SUCCESS == (ret = engine->getReply(id, reply)))
{
Respond* respond = (Respond*) reply;
//发动
int crossNum = respond->args(0);
if (crossNum > 0)
{
int dstID = respond->dst_ids(0);
PlayerEntity *dstPlayer = engine->getPlayerEntity(dstID);
network::SkillMsg skill_msg;
Coder::skillNotice(id, dstID, SHEN_SHENG_QI_YUE, skill_msg);
engine->sendMessage(-1, MSG_SKILL, skill_msg);
if(crystal>0){
setCrystal(--crystal);
}
else{
setGem(--gem);
}
subCrossNum(crossNum);
dstPlayer->addCrossNum(crossNum, 4);
GameInfo game_info;
Coder::energyNotice(id, gem, crystal, game_info);
Coder::crossNotice(id, getCrossNum(), game_info);
Coder::crossNotice(dstID, dstPlayer->getCrossNum(), game_info);
engine->sendMessage(-1, MSG_GAME, game_info);
return GE_SUCCESS;
}
}
return ret;
}
else{
//超时啥都不用做
return GE_TIMEOUT;
}
}
示例7: ZhiYuZhiGuang
int ShengNv::ZhiYuZhiGuang(int &step, Action* action)
{
int cardID = action->card_ids(0);
SkillMsg skill_msg;
list<int> dsts;
int dstID;
PlayerEntity * dstPlayer;
for(int i=0; i < action->dst_ids_size(); i ++)
{
dsts.push_back(action->dst_ids(i));
}
if(step!=ZHI_YU_ZHI_GUANG)
{
Coder::skillNotice(id, dsts, ZHI_YU_ZHI_GUANG, 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);
engine->setStateMoveOneCardNotToHand(id, DECK_HAND, -1, DECK_DISCARD, cardID, id, ZHI_YU_ZHI_GUANG, true);
//插入了新状态,请return GE_URGENT
return GE_URGENT;
}
else
{
for(int i=0; i < action->dst_ids_size(); i ++)
{
dstID = action->dst_ids(i);
dstPlayer = engine->getPlayerEntity(dstID);
dstPlayer->addCrossNum(1);
GameInfo update_info;
Coder::crossNotice(dstID, dstPlayer->getCrossNum(), update_info);
engine->sendMessage(-1, MSG_GAME, update_info);
}
return GE_SUCCESS;
}
}
示例8: ShenShengLingYu
int ShenGuan::ShenShengLingYu(int &step, Action *action)
{
int dstID = action->dst_ids(0);
vector<int> cardIDs;
PlayerEntity *dstPlayer = engine->getPlayerEntity(dstID);
if(step != SHEN_SHENG_LING_YU)
{
SkillMsg skill_msg;
Coder::skillNotice(id, dstID, SHEN_SHENG_LING_YU, skill_msg);
engine->sendMessage(-1, MSG_SKILL, skill_msg);
if(crystal>0){
setCrystal(--crystal);
}
else{
setGem(--gem);
}
GameInfo game_info;
Coder::energyNotice(id, gem, crystal, game_info);
engine->sendMessage(-1, MSG_GAME, game_info);
int cardNum = (getHandCardNum()>2)? 2:getHandCardNum();
for(int i = 0; i < cardNum; i ++)
{
cardIDs.push_back(action->card_ids(i));
}
if(cardNum > 0)
{
engine->setStateMoveCardsNotToHand(id, DECK_HAND, -1, DECK_DISCARD, cardNum, cardIDs, id, SHEN_SHENG_LING_YU, false);
step = SHEN_SHENG_LING_YU;
return GE_URGENT;
}
else
{
if(action->args(0) == 1)
{
subCrossNum(1);
GameInfo update_info;
Coder::crossNotice(id, getCrossNum(), update_info);
engine->sendMessage(-1, MSG_GAME, update_info);
HARM harm;
harm.point = 2;
harm.srcID = id;
harm.type = HARM_MAGIC;
harm.cause = SHEN_SHENG_LING_YU;
engine->setStateTimeline3(dstID, harm);
step = STEP_DONE;
return GE_URGENT;
}
else
{
addCrossNum(2);
dstPlayer->addCrossNum(1);
GameInfo update_info;
Coder::crossNotice(id, getCrossNum(), update_info);
Coder::crossNotice(dstID, dstPlayer->getCrossNum(), update_info);
engine->sendMessage(-1, MSG_GAME, update_info);
step = STEP_DONE;
return GE_SUCCESS;
}
}
}
else
{
if(action->args(0) == 1)
{
subCrossNum(1);
GameInfo update_info;
Coder::crossNotice(id, getCrossNum(), update_info);
engine->sendMessage(-1, MSG_GAME, update_info);
HARM harm;
harm.point = 2;
harm.srcID = id;
harm.type = HARM_MAGIC;
harm.cause = SHEN_SHENG_LING_YU;
engine->setStateTimeline3(dstID, harm);
step = STEP_DONE;
return GE_URGENT;
}
else
{
addCrossNum(2);
dstPlayer->addCrossNum(1);
GameInfo update_info;
Coder::crossNotice(id, getCrossNum(), update_info);
Coder::crossNotice(dstID, dstPlayer->getCrossNum(), update_info);
engine->sendMessage(-1, MSG_GAME, update_info);
step = STEP_DONE;
return GE_SUCCESS;
}
}
}