亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? battle.cpp

?? S.C.O.U.R.G.E.是一款類似Rogue的游戲
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
/***************************************************************************                          battle.cpp  -  description                             -------------------    begin                : Sat May 3 2003    copyright            : (C) 2003 by Gabor Torok    email                : cctorok@yahoo.com ***************************************************************************//*************************************************************************** *                                                                         * *   This program is free software; you can redistribute it and/or modify  * *   it under the terms of the GNU General Public License as published by  * *   the Free Software Foundation; either version 2 of the License, or     * *   (at your option) any later version.                                   * *                                                                         * ***************************************************************************/#include "battle.h"//#define DEBUG_BATTLE#define GOD_MODE 0#define MONSTER_IMORTALITY 0enum {  NO_ACTION = 0,  LOITER,  ATTACK,  MOVE,  NO_TARGET,  WAIT,};char *actionName[] = { "NO ACTION", "LOITER", "ATTACK", "MOVE", "NO_TARGET", "WAIT"};Battle::Battle() {  this->creature = NULL;}Battle::Battle(Scourge *scourge, Creature *creature) {  this->scourge = scourge;  this->creature = creature;  this->item = NULL;  this->creatureInitiative = 0;  this->initiativeCheck = false;  this->speed = 0;  this->dist = creature->getDistanceToTarget();  this->spell = NULL;  this->empty = false;}Battle::~Battle() {}void Battle::setupBattles(Scourge *scourge, Battle *battle[], int count, vector<Battle *> *turns) {  if(count == 0) return;  bool battleStarted = false;  int battleCount = count;    int initiative = -10;//char message[200];  int turn = 0;#ifdef DEBUG_BATTLE  cerr << "==================================================" << endl;  cerr << "battleCount=" << battleCount << endl;  for(int i = 0; i < battleCount; i++) {    cerr << "\t(" << battle[i]->creature->getName() <<     "->" << (battle[i]->creature->getTargetCreature() ?              battle[i]->creature->getTargetCreature()->getName() :             "NULL") <<     ")" << endl;  }#endif// this is O(n^2) unfortunately... maybe we could use a linked list or something here  while(battleCount > 0) {    bool creatureFound = false;     for(int i = 0; i < battleCount; i++) {      int action = NO_ACTION;      battle[i]->empty = false;      battle[i]->projectileHit = false;      if(!battle[i]->creature->hasTarget()) {        // remove creatures with no target creature from this round        action = NO_TARGET;      } else if(!battle[i]->creature->isTargetValid()) {        // if someone already killed this target, skip it        battle[i]->creature->cancelTarget();        if(battle[i]->creature->isMonster()) {          //battle[i]->creature->setMotion(Constants::MOTION_LOITER);               action = LOITER;        } else {          // if party member re-join the battle          Creature *c = battle[i]->creature;          c->setTargetCreature(scourge->getClosestVisibleMonster(c->getX(),                                                                  c->getY(),                                                                  c->getShape()->getWidth(),                                                                 c->getShape()->getDepth(),                                                                 20));        }      } else {        GLint t = SDL_GetTicks();        // get the best weapon given the distance from the target        battle[i]->initTurn();        // check the creature's initiative        if(!battle[i]->initiativeCheck ||            battle[i]->creatureInitiative < initiative) {          // remember that it passed (creature can attack next time if timing (below) is good)          battle[i]->initiativeCheck = true;          creatureFound = true;          // this is to slow down battle, depending on your weapon          // getLastTurn is 0 when an action is decided to be executed          // this way it's two trips through this method forcing a spell (e.g.)          // to use the clock.          bool initialActionTurn = (battle[i]->creature->getLastTurn() == 0);#ifdef DEBUG_BATTLE                                                                             cerr << "speed=" << battle[i]->speed << " last=" << battle[i]->creature->getLastTurn() <<           " diff=" << (t - battle[i]->creature->getLastTurn()) << endl;#endif                                                                                                  if(initialActionTurn ||             battle[i]->speed < t - battle[i]->creature->getLastTurn()) {            // remember the last active turn			            battle[i]->creature->setLastTurn(t);            if(!battleStarted) {              scourge->getMap()->addDescription("A round of battle begins...", 1, 1, 1);              battleStarted = true;            }            if(initialActionTurn) {              // add a waiting term              battle[i]->empty = true;              action = WAIT;              turns->push_back(battle[i]);            } else {              // save this turn              turns->push_back(battle[i]);              action = ATTACK;            }          } else {            // add a waiting term            battle[i]->empty = true;            action = WAIT;            turns->push_back(battle[i]);          }        }      }      if(action != NO_ACTION) {#ifdef DEBUG_BATTLE                         cerr << "Turn: " << turn << " " << actionName[action] << ", " <<        battle[i]->creature->getName() << "(" << battle[i]->creatureInitiative << ")" <<        "->" << (battle[i]->creature->getTargetCreature() ?                  battle[i]->creature->getTargetCreature()->getName() :                  "<no target>") <<        endl;#endif                                                            // remove this battle from the turn        Battle *tmp = battle[i];        for(int t = i; t < battleCount - 1; t++) {          battle[t] = battle[t + 1];        }        // move current one to the end of the list so we don't loose it        battle[battleCount - 1] = tmp;        battleCount--;        i--;        turn++;      }    }    // if there are no creatures for this initiative slot, go to the next one    if(!creatureFound) initiative++;  }}                 void Battle::fightTurn() {  // waiting to cast a spell?  if(creature->getAction() == Constants::ACTION_CAST_SPELL) {    creature->startEffect(Constants::EFFECT_CAST_SPELL,                           Constants::DAMAGE_DURATION * 4);  }  // waiting to attack?  if(isEmpty()) return;  // target killed?  if(!creature->hasTarget()) return;  // if there was no 'item' selected it's because we're too far from the target  // (getBestWeapon returned NULL) and we're not casting a spell, follow the target  //  // If it's an empty-handed attack, follow the target  //  // If it's a ranged attack and we're not in range, follow the target (will move away from target)  //  // This sure is confusing code...  /*  cerr << "projectileHit=" << projectileHit <<        " dist=" << dist <<        " creature->isInRange()=" << creature->isInRange() <<        " item=" << item <<        " creature->getActionSpell()=" << creature->getActionSpell() <<        " spell=" << spell << endl;        */  if(!projectileHit &&     ((dist > Constants::MIN_DISTANCE && !item && !creature->getActionSpell() && !spell) ||        !creature->isInRange())) {     //cerr << "\tfollowing..." << endl;    creature->followTarget();    return;  }  //cerr << "\tcontinuing" << endl;  // handle action: eat/drink items  if(creature->getAction() == Constants::ACTION_EAT_DRINK) {    executeEatDrinkAction();    return;  }  // the attacked target may get upset  creature->decideMonsterAction();  // handle the action  if(!projectileHit && item && item->getRpgItem()->isRangedWeapon()) {    launchProjectile();  } else if(spell) {    // a spell projectile hit    SpellCaster *sc = new SpellCaster(this, spell, true);     sc->spellSucceeded();    delete sc;  } else if(creature->getActionSpell()) {    // casting a spell for the first time    castSpell();  } else {    hitWithItem();  }}void Battle::castSpell() {  // use up some MP (not when using a scroll)  if(!creature->getActionItem()) {    int n = creature->getMp() - creature->getActionSpell()->getMp();    if(n < 0) n = 0;    creature->setMp( n );  } else {    // try to destroy the scroll    int itemIndex = creature->findInInventory(creature->getActionItem());    if(itemIndex > -1) {      creature->removeInventory(itemIndex);      sprintf(message, "%s crumbles into dust.", creature->getActionItem()->getItemName());

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产欧美日韩视频在线观看| 在线不卡免费av| 久久先锋资源网| 国产精品一卡二卡| 精品国产亚洲在线| 91亚洲精华国产精华精华液| 亚洲亚洲精品在线观看| 色嗨嗨av一区二区三区| 丝袜美腿亚洲一区| 久久精品男人天堂av| 欧美性猛交xxxxxxxx| 国产美女精品在线| 亚洲第四色夜色| 国产精品久久久久久久久免费桃花| 91在线视频播放地址| 蓝色福利精品导航| 亚洲精品国产a| 久久久久久电影| 欧美精品乱人伦久久久久久| 欧美一区二区三区在| 成人午夜av电影| 日韩av不卡一区二区| 一区精品在线播放| 2024国产精品视频| 亚洲欧洲精品一区二区精品久久久| 亚洲欧美日韩国产综合| 国产亚洲欧美在线| 一区二区三区蜜桃| 亚洲一区二区成人在线观看| 中文字幕电影一区| 久久精子c满五个校花| 亚洲精品亚洲人成人网在线播放| 五月婷婷激情综合| 五月婷婷综合激情| 国产成人精品亚洲午夜麻豆| 黄色日韩网站视频| 久久99国产精品成人| 日本亚洲一区二区| 不卡免费追剧大全电视剧网站| 国产精一品亚洲二区在线视频| 91美女在线视频| 日韩一区二区影院| 欧美一区二区三区人| 亚洲欧洲日韩女同| 精品一区二区在线免费观看| 在线国产电影不卡| 91麻豆精品国产自产在线| 3d动漫精品啪啪一区二区竹菊 | jvid福利写真一区二区三区| 国产suv精品一区二区三区| 国产一区二区伦理| 欧美日韩高清一区二区不卡| 欧美日韩一区二区三区视频| 欧美日韩成人一区| 亚洲日穴在线视频| 亚洲综合偷拍欧美一区色| 国产精品一品视频| 久久在线观看免费| 久久精品国产**网站演员| 欧美色精品天天在线观看视频| 国产精品国产自产拍在线| 国产综合色精品一区二区三区| 欧美视频三区在线播放| 亚洲欧美一区二区三区孕妇| 国产成人精品影院| 久久精品欧美日韩| 国产成人精品一区二区三区四区 | 久久国产福利国产秒拍| 欧美二区乱c少妇| 婷婷夜色潮精品综合在线| 欧美三级一区二区| 亚洲1区2区3区4区| 欧美理论在线播放| 毛片av一区二区| 99视频在线观看一区三区| 欧美激情在线观看视频免费| 国产乱码精品一区二区三区忘忧草 | 久久久久国产精品麻豆| 精品无人码麻豆乱码1区2区| 日韩精品一区二区三区老鸭窝| 中文字幕av一区二区三区| 国产成a人亚洲精| 中国色在线观看另类| 日韩电影在线一区二区| 91精品国产综合久久精品| 久久91精品久久久久久秒播| 精品国产sm最大网站免费看| 韩国精品免费视频| 国产精品色眯眯| 欧美在线啊v一区| 天天综合色天天综合色h| 日韩丝袜情趣美女图片| 国产精品一区二区男女羞羞无遮挡| 国产欧美一区二区精品秋霞影院| 成人h动漫精品一区二| 一区二区三区四区视频精品免费 | 欧美精品久久99| 极品少妇xxxx偷拍精品少妇| 亚洲国产精品av| 欧美三区免费完整视频在线观看| 免费人成精品欧美精品| 欧美亚洲尤物久久| 蜜臀av在线播放一区二区三区| 久久久久久麻豆| 欧美三级韩国三级日本三斤| 久久精品国产成人一区二区三区| 国产免费久久精品| 欧美日本一区二区三区四区 | 中文字幕一区在线观看| 欧美日韩另类国产亚洲欧美一级| 精久久久久久久久久久| 亚洲日本一区二区三区| 日韩视频123| 91美女片黄在线| 激情综合网最新| 亚洲国产一区二区三区青草影视| 精品国产伦理网| 欧美色网一区二区| 成人免费视频一区| 免费欧美在线视频| 亚洲激情综合网| 国产欧美日韩三区| 日韩区在线观看| 欧美色视频一区| 91天堂素人约啪| 国产电影一区二区三区| 日韩成人一区二区三区在线观看| 国产精品成人在线观看| 26uuu另类欧美| 日韩亚洲欧美中文三级| 日本精品视频一区二区| 99久精品国产| 成人一道本在线| 国产在线国偷精品产拍免费yy| 亚洲一区电影777| 亚洲欧美激情在线| 亚洲人成在线观看一区二区| 国产无人区一区二区三区| 精品卡一卡二卡三卡四在线| 成人永久看片免费视频天堂| 奇米色777欧美一区二区| 亚洲综合在线电影| 最好看的中文字幕久久| 国产精品视频在线看| 国产欧美日韩中文久久| 国产欧美日韩久久| 国产日产亚洲精品系列| www久久精品| 久久免费看少妇高潮| 国产清纯白嫩初高生在线观看91| wwwwww.欧美系列| 国产三级一区二区| 亚洲国产电影在线观看| 国产免费观看久久| 中文字幕亚洲在| 亚洲三级小视频| 亚洲综合av网| 日日夜夜精品视频免费| 天堂蜜桃91精品| 麻豆精品在线观看| 国产精品资源在线| 成人性色生活片免费看爆迷你毛片| 国产伦精品一区二区三区免费| 国产成人精品免费| kk眼镜猥琐国模调教系列一区二区| 不卡一区二区中文字幕| 色综合天天综合在线视频| 人妖欧美一区二区| 国产一区日韩二区欧美三区| 国产99久久久久久免费看农村| 成人成人成人在线视频| 在线观看91精品国产入口| 337p亚洲精品色噜噜噜| 欧美精品一区二区高清在线观看| 国产午夜亚洲精品午夜鲁丝片 | 日本一区二区久久| ㊣最新国产の精品bt伙计久久| 一区二区三区在线播| 久久超碰97人人做人人爱| 国产成人h网站| 欧美四级电影在线观看| 精品国产制服丝袜高跟| 亚洲国产激情av| 日韩高清欧美激情| 国产黑丝在线一区二区三区| 日本精品视频一区二区| 日韩一级片在线观看| 中文字幕一区二区三中文字幕| 亚洲国产成人精品视频| 国产麻豆视频精品| 欧美精选一区二区| 国产精品视频九色porn| 日韩黄色小视频| av亚洲产国偷v产偷v自拍| 91精品国产入口| 一区二区三区四区乱视频| 国产一区二区视频在线播放| 欧美三级在线看| 亚洲色图制服丝袜| 国产精品系列在线播放|