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

天行健 君子當自強而不息

Controlling Players and Characters(26)

 

Taking a Swing

When a character takes a swing at another character, this action triggers the
process that determines whether the blow hit the target. Determining whether the
attack hit involves an attacking character’s to-hit ability and a defending character’s
agility ability. Remember that the higher the ability values, the better the chance to
hit or dodge the attack.

The to-hit ability can range from 0 (always misses) to 999 (always hits). By taking
a random number and comparing it to the to-hit value, you can quickly determine
whether a hit was accomplished. If the random number is equal to or less than the
to-hit attribute, the blow lands. The following code illustrates how to determine
whether a hit is successful:

// ToHit = character’s to-hit attribute value
long RandomValue = rand() % 1000;
BOOL HitFlag = (RandomValue <= ToHit) ? TRUE : FALSE;

In the preceding code, HitFlag is set to TRUE if the blow lands, or rather if the blow
should land. In order to improve the chances of hitting a target, the attacker can
have specific status ailments that decrease or increase the to-hit value. Two status
ailments in use that affect the attacker’s to-hit ability are Blind and Hawkeye. The
Blind status ailment reduces the to-hit chance ability by 25 percent, whereas
Hawkeye increases the chances to hit by 50 percent.

To apply either status ailment modifiers, multiply the determined to-hit value:

if(Ailments & AILMENT_BLIND)
  ToHit = (long)((float)ToHit * 0.75f);

if(Ailments & AILMENT_HAWKEYE)
  ToHit = (long)((float)ToHit * 1.5f);

long RandomValue = rand() % 999;
BOOL HitFlag = (RandomValue <= ToHit) ? TRUE : FALSE;

 

Dodging an Attack

Remember that a victim’s agility ability comes into play when being attacked. The
greater the defender’s agility, the greater the chance the victim dodges the attack.
You calculate whether the defender dodges the attack in the same way that you
check whether the attacker makes a hit:

// Agility = character’s agility ability
RandomValue = rand() % 999;
BOOL DodgeFlag = (RandomValue <= Agility) ? TRUE : FALSE;

In order to decrease or increase the chances of dodging an attack, you
can use the Clumsy and Surefooted status ailments. Clumsy decreases
the chances of dodging and attack by 25 percent, whereas Surefooted
increases the chances by 50 percent (meaning that characters that are
affected by both the Clumsy and Surefooted ailments have their
chances of dodging an attack increased by 25%):

CAUTION
You can determine from the agility dodging calculations that the higher the
agility, the higher the chance of dodging the attack. For that reason, you generally
don’t set a character’s agility too high because they can become untouchable.

if(Ailments & AILMENT_CLUMSY)
  Agility = (long)((float)Agility * 0.75f);

if(Ailments & AILMENT_SUREFOOTED)
  Agility = (long)((float)Agility * 1.5f);

long RandomValue = rand() % 999;
BOOL DodgeFlag = (RandomValue <= Agility) ? TRUE : FALSE;

 

Dealing Damage

When it is determined that the blow hit the victim, it’s time to calculate how much
damage was done, which is where the character’s attack and defense abilities come
into play. Damage is usually variable, which means that rarely does the same attack
do the same damage each time. Again, you use a little randomness.

To keep things simple, you can take the attacker’s attack ability value (or at least 90
percent to 110 percent of it) and subtract the victim’s defense value (at least 80
percent to 100 percent of it). Note that status ailments are an issue here as well,
along with the use of items to increase the attack and defense abilities.

That’s right. Equipped items add a multiplier to the attack and defense abilities.
The item modifier value is the key. The value represents a value from 0 and up
that, when divided by 100 and increased by one, gives you a multiplier value to use
in conjunction with the ability value. For example, a weapon with a modifier value
of 150 increases the attack ability by 50 percent:

// Attack = character’s attack ability value
// Item[] = master item list array
long Attack = (long)((float)Attack * (((float)Item[Weapon].Value / 100.0f) + 1.0f));

Getting back to status ailments, two affect both attack and defense—Weak and Strong.
Weak reduces attack and defense by half whereas Strong increases the values by 50 percent.
Here’s how everything works to determine the amount of damage to apply:

// Attack = attacker’s attack ability value
// Defense = defenders defense ability value
// Item[] = master item list array
// Weapon = weapon # in item list (or -1 if none)
// Armor = armor # in item list (or -1 if none)
// Shield = shield # in item list (or -1 if none)
// Determine attack amount
// Start with adding equipping weapon modifier

if(Weapon != -1)
  long Attack = (long)((float)Attack * (((float)Item[Weapon].Value / 100.0f) + 1.0f));

// Adjust by status ailments
if(Ailments & AILMENT_WEAK)
  Attack = (long)((float)Attack * 0.5f);

if(Ailments & AILMENT_STRONG)
  Attack = (long)((float)Attack * 1.5f);

// Determine defense amount
// Apply armor and shield modifiers
if(Armor != -1)
  Defense = (long)((float)Defense * (((float)Item[Armor].Value / 100.0f) + 1.0f);

if(Shield != -1)
  Defense = (long)((float)Defense * (((float)Item[Shield].Value / 100.0f) + 1.0f);

// Apply status ailments
if(Ailments & AILMENT_WEAK)
  Defense = (long)((float)Defense * 0.5f);

if(Ailments & AILMENT_STRONG)
  Defense = (long)((float)Defense * 1.5f);

float DamagePercent = ((float)(rand() % 70) + 50.0f) / 100.0f;
long DamageAmount = (long)((float)Attack * DamagePercent);

// Determine damage amount (use some randomness in there)
float Range = (float)((rand() % 20) + 90) / 100.0f;
long DmgAmount = (long)((float)Attack * Range);
Range = (float)((rand() % 20) + 80) / 100.0f;
DmgAmount -= (long)((float)Defense * Range);

At long last, the DmgAmount variable will contain the amount of damage that is dealt.
You’re not done at this point, however, because now character class comes into
play. If an attack is strong against the character’s class type, damage is doubled.
If the victim is of the same class as the attack, that attack cures the
victim for half the amount of damage dealt! I’ll let you work those into the calculations.

CAUTION
Again, the defense ability of a character shouldn’t be so high that the defending
character rarely takes any damage when an attack hits.

posted on 2007-12-03 20:31 lovedday 閱讀(271) 評論(0)  編輯 收藏 引用


只有注冊用戶登錄后才能發表評論。
網站導航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


公告

導航

統計

常用鏈接

隨筆分類(178)

3D游戲編程相關鏈接

搜索

最新評論

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <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>
            午夜精品网站| 免费欧美在线| 国产三区二区一区久久| 欧美一区二区三区男人的天堂| aa级大片欧美| 国产精品第三页| 久久成人精品一区二区三区| 久久激五月天综合精品| 在线观看亚洲一区| 91久久久一线二线三线品牌| 欧美成人免费在线观看| 亚洲视频999| 亚洲欧美日韩综合| 一区二区亚洲欧洲国产日韩| 欧美成人免费全部| 欧美日韩亚洲综合| 久久成人免费电影| 免费日韩精品中文字幕视频在线| 日韩午夜视频在线观看| 亚洲一区在线播放| 在线免费不卡视频| 亚洲精品日韩一| 国产日韩欧美视频在线| 欧美好骚综合网| 欧美午夜不卡视频| 久久免费视频在线| 欧美日韩国产专区| 久久精品国产精品| 欧美激情成人在线| 欧美在线视频全部完| 美女脱光内衣内裤视频久久影院 | 国产欧美日韩一区二区三区在线| 久久久久久伊人| 欧美日韩久久不卡| 免费看亚洲片| 国产乱人伦精品一区二区| 欧美激情性爽国产精品17p| 国产精品久久国产精品99gif| 久久久久久久久综合| 欧美粗暴jizz性欧美20| 久久成人免费| 欧美日韩一级黄| 欧美成人a视频| 国产日本欧美在线观看| 91久久久久久久久| 精品二区视频| 午夜亚洲福利| 亚洲欧美日韩综合aⅴ视频| 欧美成人精品一区二区三区| 久久亚洲高清| 国产性做久久久久久| 在线天堂一区av电影| 日韩视频在线播放| 久久综合色播五月| 麻豆91精品91久久久的内涵| 国产精品一区一区| 亚洲一级黄色av| 亚洲自拍另类| 国产精品久久二区| 亚洲性夜色噜噜噜7777| 制服丝袜亚洲播放| 欧美日韩a区| 日韩视频专区| 亚洲一区二区三区四区在线观看 | 欧美另类在线观看| 亚洲电影下载| 亚洲黄色免费电影| 老司机精品视频网站| 久久综合久久综合九色| 一区免费在线| 久久先锋影音| 欧美成人午夜激情视频| 亚洲国产精品一区制服丝袜 | 久久综合电影| 欧美成熟视频| 99re亚洲国产精品| 欧美另类一区| 亚洲少妇最新在线视频| 午夜精品久久久久久久99樱桃 | 国产精品一区二区女厕厕| 亚洲午夜国产成人av电影男同| 亚洲字幕一区二区| 国产欧美精品一区aⅴ影院| 欧美在线播放| 欧美成人三级在线| av成人福利| 国产精品一区二区久久国产| 欧美一区二区三区免费大片| 老色鬼久久亚洲一区二区| 亚洲欧洲精品一区二区三区不卡 | 久久激情综合| 亚洲高清免费视频| 欧美日本在线看| 亚洲欧美日韩精品一区二区| 久久久xxx| 亚洲欧洲精品一区二区| 欧美日韩精品系列| 欧美在线观看视频在线| 亚洲国产成人精品久久| 亚洲午夜久久久| 韩国v欧美v日本v亚洲v| 欧美激情一级片一区二区| 亚洲性视频h| 欧美成人一区二区三区在线观看 | 欧美一区二区| 亚洲国产一区在线| 国产精品久久久久久久午夜| 久久久亚洲高清| 亚洲最新视频在线播放| 美女国内精品自产拍在线播放| 日韩视频在线一区| 国内视频一区| 欧美视频日韩视频在线观看| 久久精品在线| 亚洲一区三区视频在线观看| 欧美成人黄色小视频| 午夜一区不卡| 99精品福利视频| 在线欧美日韩国产| 国产日韩在线一区二区三区| 欧美精品在线一区二区| 久久美女性网| 欧美一区二区高清| 一区二区三区 在线观看视频| 欧美成人午夜激情| 久久精品免费电影| 先锋影音一区二区三区| 在线亚洲免费| 日韩网站在线观看| 亚洲国产精品一区在线观看不卡| 国产日韩精品久久| 国产精品社区| 国产精品日韩在线| 欧美亚州韩日在线看免费版国语版| 免费欧美日韩| 麻豆成人综合网| 可以免费看不卡的av网站| 久久精品国产亚洲高清剧情介绍| 亚洲主播在线| 亚洲一区3d动漫同人无遮挡| 99视频一区二区三区| 亚洲精品综合| 日韩亚洲精品视频| 99视频在线精品国自产拍免费观看| 亚洲福利视频三区| 亚洲国产专区| 亚洲美女黄网| 国产精品99久久久久久久vr| 一区二区三区视频在线| 亚洲视频在线播放| 亚洲午夜羞羞片| 亚洲欧美另类在线观看| 亚洲男人的天堂在线aⅴ视频| 亚洲一区二区三区在线| 亚洲一区日韩| 久久国产视频网站| 久久亚洲精品一区| 欧美大胆人体视频| 欧美三级午夜理伦三级中视频| 欧美性事在线| 国产亚洲一区二区精品| 在线国产精品播放| 99精品免费| 香蕉久久国产| 欧美sm视频| 99精品久久久| 欧美一级免费视频| 麻豆精品视频在线观看视频| 欧美激情亚洲国产| 国产精品人人做人人爽| 狠狠色狠狠色综合日日五| 91久久精品国产91性色| 亚洲私拍自拍| 久久亚洲精品一区二区| 亚洲二区免费| 亚洲在线黄色| 女女同性女同一区二区三区91| 欧美日韩黄色一区二区| 国产一区二区三区自拍| 亚洲精品综合| 久久久欧美精品| 91久久在线| 久久激情视频免费观看| 欧美高清视频www夜色资源网| 国产精品视频大全| 亚洲精品久久久久久一区二区| 亚洲欧美成人| 欧美激情91| 欧美制服丝袜第一页| 欧美日韩一区二区三区高清| 国内精品写真在线观看| 亚洲小说春色综合另类电影| 免费成人av在线看| 亚洲一区影院| 欧美日本免费一区二区三区| 一区二区在线视频播放| 欧美一区二区三区的| 日韩亚洲精品电影| 嫩模写真一区二区三区三州| 国产欧美日韩精品a在线观看|