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; } }
void PlayerBullet::onLoad() { PlayerEntity* player = GameGlobals::get()->player; assert(player); sf::Color color; bulletStance = player->getStance(); switch(bulletStance) { case PlayerEntity::Stance::Agile: color = sf::Color(140, 255, 50); break; case PlayerEntity::Stance::Defensive: color = sf::Color(40, 120, 250); break; case PlayerEntity::Stance::Offensive: color = sf::Color(255, 80, 50); break; } getComponent<sz::Renderer>()->setColor(color); }
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; }
void SausageEntity::readCollidingEntity(CollidingSpriteEntity* entity) { if (!isDying && !isAgonising && collideWithEntity(entity)) { if (entity->getType() == ENTITY_PLAYER || entity->getType() == ENTITY_BOLT ) { PlayerEntity* playerEntity = dynamic_cast<PlayerEntity*>(entity); BoltEntity* boltEntity = dynamic_cast<BoltEntity*>(entity); if (playerEntity != NULL && !playerEntity->isDead()) dying(); else if (boltEntity != NULL && !boltEntity->getDying() && boltEntity->getAge() > 0.05f) collideWithBolt(boltEntity); } else // collision with other enemy ? { if (entity->getType() >= ENTITY_ENEMY && entity->getType() <= ENTITY_ENEMY_MAX) { if (this != entity) { EnemyEntity* enemyEntity = static_cast<EnemyEntity*>(entity); if (enemyEntity->canCollide()) collideWithEnemy(enemyEntity); } } } } }
void BulletEntity::onPreSolveEvent(b2Contact * contact, const b2Manifold * oldManifold) { ContactInfo ci(getBody(), contact); Entity * ent = (Entity*)ci.toucher->GetUserData(); if (ent->getType() == EntityType::PlayerEntity) { PlayerEntity * ceEnt = (PlayerEntity*)ent; if (ceEnt == owner.getPlayerEntity().lock().get()) { //Samego siebie nie krzywdzimy contact->SetEnabled(false); return; } else { //Innego gracza owszem if (ceEnt->getHealth() > 0.0) { ceEnt->takeDamage(damage); if (ceEnt->getHealth() == 0.0) owner.reportKill(); } } } //Przy uderzeniu w cokolwiek innego niż gracz, //który nas wystrzelił, giniemy markForDeletion(); }
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; } }
//测试用 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); }
void ItemEntity::readCollidingEntity(CollidingSpriteEntity* entity) { if (itemType == ItemBossHeart && !game().getCurrentMap()->isCleared()) return; PlayerEntity* playerEntity = dynamic_cast<PlayerEntity*>(entity); if (collideWithEntity(entity)) { if (playerEntity != NULL && !playerEntity->isDead()) { if (isMerchandise) { playerEntity->setItemToBuy(this); } else if (canBePickedUp()) { playerEntity->acquireItem(itemType); if (isMerchandise) playerEntity->pay(getPrice()); dying(); if (!items[itemType].generatesStance) new MagnetEntity(x, y, playerEntity, itemType); } } } }
void SnakeEntity::readCollidingEntity(CollidingSpriteEntity* entity) { if (!isDying && !isAgonising && collideWithEntity(entity)) { if (entity->getType() == ENTITY_PLAYER || entity->getType() == ENTITY_BOLT ) { PlayerEntity* playerEntity = dynamic_cast<PlayerEntity*>(entity); BoltEntity* boltEntity = dynamic_cast<BoltEntity*>(entity); if (playerEntity != NULL && !playerEntity->isDead()) { int meleeLevel = 0; if (snakeType == SnakeTypeBlood) { if (rand() % 3 == 0) { meleeType = ShotTypePoison; meleeDamages = 4; meleeLevel = 1; } else { meleeType = ShotTypeStandard; meleeDamages = 8; } } if (playerEntity->hurt(getHurtParams(meleeDamages, meleeType, meleeLevel, false, SourceTypeMelee, enemyType, false))) { float xs = (x + playerEntity->getX()) / 2; float ys = (y + playerEntity->getY()) / 2; SpriteEntity* star = new SpriteEntity(ImageManager::getInstance().getImage(IMAGE_HURT_IMPACT), xs, ys); star->setFading(true); star->setZ(y+ 100); star->setLifetime(0.7f); star->setType(ENTITY_EFFECT); star->setSpin(400.0f); } inflictsRecoilTo(playerEntity); } else if (boltEntity != NULL && !boltEntity->getDying() && boltEntity->getAge() > 0.05f) { collideWithBolt(boltEntity); } } else // collision with other enemy ? { if (entity->getType() >= ENTITY_ENEMY && entity->getType() <= ENTITY_ENEMY_MAX_COUNT) { if (this != entity) { EnemyEntity* enemyEntity = static_cast<EnemyEntity*>(entity); if (enemyEntity->canCollide()) collideWithEnemy(enemyEntity); } } } } }
void BodyIterator (const NewtonBody* body, void* userData) { //Undvik att hantera kollision med sig själv if(NewtonBodyGetUserData(body)!=userData) { PlayerEntity* player = (PlayerEntity*)userData; player->UpdateCollision((NewtonBody*)body); } }
void PlayerEntity::NewtonUpdate (float dt) { // get the entity associated with this rigid body PlayerEntity* ent = PlayerEntity::player; ent->UpdatePhysics(SceneHandler::world,dt); ent->prevPosition = ent->curPosition; ent->curPosition = ent->matrix[3]; }
void RockMissileEntity::inflictsRecoilTo(BaseCreatureEntity* targetEntity) { PlayerEntity* playerEntity = dynamic_cast<PlayerEntity*>(targetEntity); if (playerEntity != NULL && !playerEntity->isDead()) { Vector2D recoilVector = Vector2D(0, 0).vectorTo(getVelocity(), 600.0f ); targetEntity->giveRecoil(true, recoilVector, 0.5f); } }
int GeDou::NianDan(int step, int playerID) { int ret; if(playerID != id || token[0] == tokenMax[0]){ return GE_SUCCESS; } //满足发动条件,询问客户端是否发动 CommandRequest cmd_req; Coder::askForSkill(id, NIAN_DAN, 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; //发动 if(respond->args(0)==1) { int dstID = respond->dst_ids(0); PlayerEntity * dstPlayer = engine->getPlayerEntity(dstID); network::SkillMsg skill; Coder::skillNotice(id, dstID, NIAN_DAN, skill); engine->sendMessage(-1, MSG_SKILL, skill); setToken(0, token[0]+1); GameInfo game_info; Coder::tokenNotice(id, 0, token[0], game_info); engine->sendMessage(-1, MSG_GAME, game_info); if(dstPlayer->getCrossNum()==0) { HARM selfHarm; selfHarm.srcID = id; selfHarm.point = token[0]; selfHarm.type = HARM_MAGIC; selfHarm.cause = NIAN_DAN; engine->setStateTimeline3(id, selfHarm); } HARM harm; harm.srcID = id; harm.point = 1; harm.type = HARM_MAGIC; harm.cause = NIAN_DAN; engine->setStateTimeline3(dstID, harm); return GE_URGENT; } //没发动技能 return GE_SUCCESS; } return ret; } else{ //超时啥都不用做 return GE_TIMEOUT; } }
void CyclopsEntity::inflictsRecoilTo(BaseCreatureEntity* targetEntity) { PlayerEntity* playerEntity = dynamic_cast<PlayerEntity*>(targetEntity); if (playerEntity != NULL && !playerEntity->isDead()) { //Vector2D recoilVector = Vector2D(targetEntity->getX(), targetEntity->getY()).vectorTo(Vector2D(x, y), 450.0f); Vector2D recoilVector = Vector2D(x, y).vectorTo(Vector2D(targetEntity->getX(), targetEntity->getY()), 450.0f); targetEntity->giveRecoil(true, recoilVector, 0.5f); } }
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; } }
//查找对应ID的玩家 PlayerEntity* BackgroundEngine::getPlayerByID(int ID) { PlayerEntity* one; //待修改,i应该小于实际玩家数 for(int i = 0;i < this->playerNum;i++) { one = this->playerList.at(i); if(ID == one->getID()) return one; } return NULL; }
void ChestEntity::readCollidingEntity(CollidingSpriteEntity* entity) { PlayerEntity* playerEntity = dynamic_cast<PlayerEntity*>(entity); if (collideWithEntity(entity)) { if (!isOpen && playerEntity != NULL && !playerEntity->isDead()) { open(); frame += 1; } } }
PlayerEntity* Controller::createPlayer(Sea::Player player, SeaView* view, ChatWidget* chat, const QString& nick) { if (m_ui) { qDebug() << "Cannot create more than one human player"; return 0; } PlayerEntity* entity = new PlayerEntity(player, m_sea, view, chat); entity->setNick(nick); m_ui = entity; setupEntity(m_ui); return entity; }
//【充盈】 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 MoQiang::ChongYing_Effect(int playerID, int howMany, vector<int> cards, HARM & harm) { if(0 != howMany) { int cardID = cards[0]; PlayerEntity* player =engine->getPlayerEntity(playerID); CardEntity* card = getCardByID(cardID); if((TYPE_MAGIC == card->getType() || ELEMENT_THUNDER == player->getCardElement(cardID)) && playerID != id) { //harm.point++; cardCount++; } } return GE_SUCCESS; }
void ChestEntity::readCollidingEntity(CollidingSpriteEntity* entity) { if (isOpen || appearTimer > 0.5f) return; PlayerEntity* playerEntity = dynamic_cast<PlayerEntity*>(entity); if (collideWithEntity(entity)) { if (playerEntity != NULL && !playerEntity->isDead()) { open(); frame += 1; if (frame > ChestFairy * imagesProLine + 1) frame = ChestFairy * imagesProLine + 1; } } }
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; } }
void KingRatEntity::inflictsRecoilTo(BaseCreatureEntity* targetEntity) { if (state == 4 || state == 6) { Vector2D recoilVector = Vector2D(x, y).vectorTo(Vector2D(targetEntity->getX(), targetEntity->getY()), KING_RAT_RUNNING_RECOIL ); targetEntity->giveRecoil(true, recoilVector, 1.0f); } if (state == 6) { PlayerEntity* playerEntity = dynamic_cast<PlayerEntity*>(targetEntity); if (playerEntity != NULL && !playerEntity->isDead()) { Vector2D recoilVector = Vector2D(targetEntity->getX(), targetEntity->getY()).vectorTo(Vector2D(x, y), KING_RAT_RUNNING_RECOIL); giveRecoil(true, recoilVector, 1.0f); } } }
int HongLian::XingHongShengYue(CONTEXT_TIMELINE_1 *con) { int ret; int srcID = con->attack.srcID; int dstID = con->attack.dstID; PlayerEntity * srcPlayer = engine->getPlayerEntity(srcID); //非红莲攻击||非主动攻击||满治疗||回合限定发动过 if(srcID != id || !con->attack.isActive || this->getCrossNum() >=4 || used_XingHongShengYue) { return GE_SUCCESS; } CommandRequest cmd_req; Coder::askForSkill(id, XING_HONG_SHENG_YUE, cmd_req); //有限等待,由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){ this->addCrossNum(1); GameInfo update_info; Coder::crossNotice(srcID, srcPlayer->getCrossNum(), update_info); engine->sendMessage(-1, MSG_GAME, update_info); network::SkillMsg skill; Coder::skillNotice(id, dstID, XING_HONG_SHENG_YUE, skill); engine->sendMessage(-1, MSG_SKILL, skill); used_XingHongShengYue = true; } } return ret; } else{ //超时啥都不用做 return GE_TIMEOUT; } }
SDL_bool WormEntity::canMove(int i, int j) { if(i<0||i>=20||j<0||j>=15) return SDL_FALSE; if(_dying) return SDL_FALSE; Overworld& overworld = Overworld::getRef(); WorldNode* node = overworld.getCurNode(); PlayerEntity* player = node->getPlayer(); int pi = player->getI(); int pj = player->getJ(); return (SDL_bool) ( ( node->getTile(i,j)==SpriteID::GRASS00 || node->getTile(i,j)==SpriteID::SAND00 || node->getTile(i,j)==SpriteID::SEA00 || node->getTile(i,j)==SpriteID::BRICK00 ) &&!(i==pi&&j==pj) ); }
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; }
void StaminaPotionEntity::OnCollision(const CollisionEvent &event) { if (event.GetType() == CollisionEventType::OnEnter) { Log("On collided with health potion"); Entity *other = event.GetOtherEntity(); if ((other != nullptr && other->GetClassName() == "OptimistPlayer") || (other != nullptr && other->GetClassName() == "RealistPlayer") || (other != nullptr && other->GetClassName() == "PessimistPlayer")) { PlayerEntity *player = static_cast<PlayerEntity *>(other); // Disable item this->pSprite->SetVisible(false); this->clSensor.Disable(); //Collect Item player->OnCollect(ItemTypes::StaminaPotion, this->iAmount); } } }
void SpiderWebEntity::readCollidingEntity(CollidingSpriteEntity* entity) { if (!isDying && !isAgonising && collideWithEntity(entity)) { if (entity->getType() == ENTITY_PLAYER || entity->getType() == ENTITY_BOLT ) { PlayerEntity* playerEntity = dynamic_cast<PlayerEntity*>(entity); BoltEntity* boltEntity = dynamic_cast<BoltEntity*>(entity); if (!isFromPlayer && playerEntity != NULL && !playerEntity->isDead()) { if (!playerEntity->isSpecialStateActive(SpecialStateSlow)) { playerEntity->setSpecialState(SpecialStateSlow, true, 0.1f, 0.33f, 0.0f); // TODO hurt(getHurtParams(2, ShotTypeStandard, 0, false, SourceTypeMelee, EnemyTypeNone, false)); } } else if (!isFromPlayer && boltEntity != NULL && !boltEntity->getDying() && boltEntity->getAge() > 0.05f) { EnemyEntity::collideWithBolt(boltEntity); } } else // collision with other enemy ? { if (entity->getType() >= ENTITY_ENEMY && entity->getType() <= ENTITY_ENEMY_MAX) { if (this != entity) { EnemyEntity* enemyEntity = static_cast<EnemyEntity*>(entity); if (enemyEntity->canCollide()) collideWithEnemy(enemyEntity); } } } } }
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; } }