青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

天行健 君子當(dāng)自強(qiáng)而不息

Controlling Players and Characters(27)

 

Spells in Combat

Now, you can put all the neat spells that your game has to offer to good use. You
know how spells work, but you need to know how the spells affect the characters.
Remember that the spell controller tracks only the meshes that create the visual
side of spells; the character controller determines the effects of the spells.

Spells in combat are used mainly to damage an opponent. A spell uses a series of
calculations to determine the outcome of the spell’s effects, just as physical attacks
do. Spells have a chance of failing, which is determined by the spell’s chance value
in the spell definition.

The chance of a spell working is increased by the caster’s mental ability, which uses
the following calculation to determine the multiplier to apply to the chance value:

// Chance = spell’s chance of working
// Mental = caster’s mental ability
Chance = (long)(((float)Mental / 100.0f + 1.0f) * (float)Chance);

The last line shows that the mental value can range from 0 and up. A value of 150
means to increase the chance by 50 percent, whereas a value of 200 means to double
the chances. To aid victims of a spell, the target characters have their associated
resistance abilities factored in as well:

// Resistance = target’s resistance ability
Chance = (long)((1.0f - (float)GetResistance(Target) / 100.0f) * (float)Chance);

When it is determined that the spell took effect, the appropriate actions can be
taken to handle the results. The only spell effect you want to contend with at this
time is damage. Whenever damage is dealt to a victim, the victim’s resistance ability
is used to reduce the amount of damage. Resistance is a percentage value, which
means that a value of 0 does not reduce spell damage, whereas a value of 100 completely
dispels damage.

Status ailments also work their way into spell casting. An ailment of Silenced means a
character can’t even cast magic spells, whereas an ailment of Dumbfounded reduces
a character’s mental ability by half. Finally, the Enchanted and Barrier ailments
reduce the victim’s resistance by half or increase the resistance by 50 percent, respectively.

You can use the following code to determine whether a spell affects the victim and
just how much damage is dealt:

// Chance = Magic spell’s chance of working
// Mental = Spell caster’s mental ability
// Resistance = victim character’s resistance amount
// Amount = base damage amount spell causes
// Apply status ailments to mental and resistance

if(Ailments & AILMENT_DUMBFOUNDED)
  Mental /= 2;

if(Ailments & AILMENT_ENCHANTED)
  Resistance = (long)((float)Resistance * 0.5f);

if(Ailments & AILMENT_BARRIER)
  Resistance = (long)((float)Resistance * 1.5f);

// Check chance of working and calculate damage
Chance=(long)(((float)Mental / 100.0f + 1.0f) * (float)Chance);

if((rand() % 100) < Chance) {
  float Resist = 1.0f - ((float)Resistance / 100.0f);
  long DmgAmount = (long)((float)Amount * Resist);

  // Apply extra class damage or cure-class amounts here
}

After a spell has hit its target, the proper amount of damage to apply is calculated.
Remember that certain classes of spells can cause twice as much damage as the spell
normally would to a character, whereas other spells can cure half the damage dealt.
 

Intelligence in Combat

Although your game’s players are completely capable of controlling their player
characters, it’s up to you to control the NPCs. In order to make your game worthy,
the NPCs’ artificial intelligence needs to be up to par for combating. Their actions
need to mimic yours, from choosing to attack, healing themselves, or casting a spell.

Characters are given a rudimentary intelligence when it comes to combat. If a character
has lost over half of his health or is under the effects of a status ailment, that
character will attempt to heal himself or dispel the ailments. This means it will
search through its list of known spells (if any) and cast the appropriate spell for aid.

If, on the other hand, a PC comes into another character’s range, a hostile charac-
ter then chooses to either perform a physical attack or a magical attack (if any
spells are known). You need to assign the chances that a character will perform
either type of attack. Note that attacks are based on the built-up charge of the
attacking creature—the charge must be full in order for the creature to attack.

When the decision is made to attack a nearby character, either the attack is performed
or a magic spell is chosen. Only spells that hurt other characters are cast. If a character
does not have a viable target character in range, the game randomly decides that
the character in question will attempt to enhance itself by using a status ailment-causing
spell, in this way raising its strength, agility, or other beneficial ailment.

The specifics on performing the preceding actions come into play when you create
a character controller that will make such decisions for your characters.

posted on 2007-12-03 21:00 lovedday 閱讀(151) 評(píng)論(0)  編輯 收藏 引用


只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。
網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


公告

導(dǎo)航

統(tǒng)計(jì)

常用鏈接

隨筆分類(178)

3D游戲編程相關(guān)鏈接

搜索

最新評(píng)論

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            一级日韩一区在线观看| 91久久在线播放| 欧美日韩成人精品| 欧美www视频在线观看| 久久久亚洲人| 免费高清在线视频一区·| 久久精品一二三区| 久久一区二区精品| 另类图片国产| 欧美欧美全黄| 国产精品久久久久久久久借妻| 欧美视频在线观看一区| 国产精品视频| 亚洲第一网站免费视频| 亚洲精品美女在线| 亚洲欧美日韩成人| 老司机午夜精品视频在线观看| 麻豆精品一区二区av白丝在线| 免费国产自线拍一欧美视频| 亚洲国产成人一区| 99av国产精品欲麻豆| 亚洲永久在线观看| 久久综合成人精品亚洲另类欧美 | 午夜精品国产更新| 久久成人18免费观看| 欧美r片在线| 一区二区三区久久网| 久久国产婷婷国产香蕉| 欧美精品色网| 国内成人在线| 一区二区日韩免费看| 久久精品国产一区二区三区免费看 | 欧美日韩精品一二三区| 亚洲小说欧美另类婷婷| 在线不卡中文字幕| 99re6热在线精品视频播放速度| 午夜日韩电影| 亚洲激情另类| 亚洲美女精品久久| 亚洲性色视频| 欧美日韩mv| 亚洲激情在线观看| 久久在精品线影院精品国产| 国产精品99久久久久久宅男| 欧美大片免费久久精品三p | 99国产精品久久久久久久久久 | 久久午夜视频| 国产精品资源在线观看| 一区二区三区|亚洲午夜| 蜜臀久久久99精品久久久久久| 一区二区高清在线观看| 欧美精品一区二区三区高清aⅴ| 狠狠色狠色综合曰曰| 欧美一级久久| 一道本一区二区| 欧美精品1区2区3区| 亚洲国产一二三| 久久夜色精品一区| 欧美亚洲在线| 久久激情综合| 国产在线精品成人一区二区三区| 亚洲在线观看免费视频| 亚洲精品视频在线看| 欧美大尺度在线| 欧美日韩不卡合集视频| aa成人免费视频| 欧美国产欧美亚州国产日韩mv天天看完整| 欧美在线观看天堂一区二区三区 | 欧美一区高清| 国产日韩在线不卡| 久久激情五月激情| 久久aⅴ乱码一区二区三区| 国产精品夜夜夜| 亚洲欧美日韩在线高清直播| 亚洲伊人伊色伊影伊综合网| 国产精品视频第一区| 欧美一区综合| 久久高清一区| 亚洲国产精品t66y| 亚洲经典在线看| 欧美日韩久久精品| 午夜视频久久久久久| 久久国产一区二区| 亚洲理论电影网| 国产日韩欧美中文在线播放| 欧美一区二区三区四区在线观看地址 | 欧美日韩一区二区在线观看| 欧美高清视频一二三区| 黑丝一区二区三区| 久久爱www.| 久久久午夜精品| 国产午夜亚洲精品不卡| 亚洲一区二区在线看| 亚洲男女毛片无遮挡| 欧美日韩一区二区三区在线看 | 欧美—级在线免费片| 亚洲国产精品久久| 亚洲国产一区视频| 免费成人av资源网| 欧美激情亚洲综合一区| 亚洲国产精品精华液2区45| 久久一区二区三区av| 亚洲第一中文字幕在线观看| 亚洲国产99| 欧美激情性爽国产精品17p| 亚洲激情综合| 亚洲一区三区视频在线观看| 国产精品欧美久久| 午夜精品网站| 久久亚洲午夜电影| 亚洲电影中文字幕| 欧美激情精品久久久久久| 亚洲人成人77777线观看| 一区二区三区精品国产| 国产精品久久久久久av下载红粉| 亚洲女女女同性video| 久久久久免费观看| 亚洲电影第1页| 欧美片在线观看| 亚洲综合色婷婷| 久色成人在线| 99精品国产在热久久婷婷| 国产精品ⅴa在线观看h| 午夜一区在线| 亚洲第一视频| 午夜精品视频网站| 亚洲第一网站| 国产精品久久久久影院亚瑟 | 国产精品视频不卡| 久久免费视频在线| 亚洲免费精品| 久久久久久亚洲综合影院红桃 | 日韩一级在线观看| 久久艳片www.17c.com| 欧美一二三区精品| 国产精品国产一区二区| 久久精品成人| 亚洲精品网站在线播放gif| 性欧美1819性猛交| 精品不卡一区二区三区| 欧美日韩午夜在线| 久久成人资源| 中文在线一区| 欧美激情第3页| 久久久久久高潮国产精品视| 99re这里只有精品6| 韩国一区二区在线观看| 欧美日韩在线播放一区| 久久久精品免费视频| 一区二区动漫| 亚洲国产日韩欧美一区二区三区| 欧美综合国产| 亚洲午夜未删减在线观看| 亚洲高清免费视频| 国产日产高清欧美一区二区三区| 欧美久久综合| 久久中文精品| 欧美亚洲一区二区三区| 亚洲一区二区三区四区中文| 亚洲精品久久久久久久久久久| 久久精品综合网| 午夜精品久久久久久| 夜夜嗨av一区二区三区四季av| 亚洲高清在线视频| 韩国成人理伦片免费播放| 国产精品一区=区| 欧美日韩在线直播| 欧美精品日韩一区| 欧美国产精品v| 免费成人高清| 欧美阿v一级看视频| 狼人社综合社区| 久久精品亚洲一区| 欧美一区二区免费| 午夜国产精品影院在线观看| 在线视频免费在线观看一区二区| 亚洲精品免费观看| 日韩一级精品视频在线观看| 亚洲精品国产欧美| 99在线热播精品免费99热| 亚洲精品久久久蜜桃| 亚洲欧洲精品成人久久奇米网 | 老司机免费视频一区二区三区| 久久久噜噜噜久久| 久久久久国产精品www| 久久久91精品| 猫咪成人在线观看| 欧美韩日视频| 亚洲精品免费网站| 在线亚洲成人| 亚洲欧美伊人| 久久久高清一区二区三区| 久久午夜av| 欧美精品一区二区三区很污很色的 | 在线亚洲观看| 亚洲欧美另类国产| 欧美在线观看视频一区二区| 久久精品亚洲| 欧美精品午夜视频| 国产精品久久久久久一区二区三区|