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

天行健 君子當自強而不息

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 閱讀(269) 評論(0)  編輯 收藏 引用

公告

導航

統計

常用鏈接

隨筆分類(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>
            美女网站在线免费欧美精品| 午夜精品久久久久久久白皮肤| 久久精品视频在线播放| 亚洲欧美日韩天堂| 韩国自拍一区| 亚洲国产99精品国自产| 欧美二区不卡| 欧美一区二区三区久久精品茉莉花| 亚洲一区二区在线看| 韩日精品视频| 亚洲精品一区在线观看香蕉| 国产精品久久久久7777婷婷| 久久久久久尹人网香蕉| 嫩草影视亚洲| 久久国产精品亚洲77777| 久久中文字幕一区| 亚洲影院在线观看| 久久精品99久久香蕉国产色戒| 亚洲欧洲在线一区| 亚洲尤物视频网| 亚洲国产成人久久综合| 在线综合欧美| 亚洲激情电影在线| 欧美一级一区| 国产精品99久久久久久人| 久久狠狠婷婷| 亚洲综合视频网| 欧美成年人视频网站| 久久精品99国产精品日本| 欧美超级免费视 在线| 欧美在线地址| 欧美日韩免费看| 欧美成年人网站| 国产日韩一区| 亚洲天堂av综合网| 亚洲美女精品久久| 国外成人性视频| 亚洲一区二区视频| 一区二区三区导航| 男同欧美伦乱| 欧美成人a视频| 国产亚洲欧美一区二区| 一区二区av| 一区二区三区精品视频| 欧美成人午夜77777| 麻豆91精品91久久久的内涵| 国产精品美女xx| 一区二区三区日韩在线观看| 亚洲精品一区二区三区不| 久久五月天婷婷| 久久免费视频观看| 国产视频久久久久久久| 亚洲欧美日本在线| 亚洲欧美一区二区三区极速播放 | 欧美亚洲综合在线| 欧美日韩在线不卡一区| 亚洲精品午夜精品| 亚洲最新视频在线播放| 欧美成年人视频| 亚洲国产精品久久久| 亚洲高清三级视频| 老色鬼久久亚洲一区二区| 美女国产精品| 亚洲电影有码| 欧美黄色aaaa| 亚洲免费黄色| 亚洲欧美日韩高清| 国产午夜亚洲精品理论片色戒| 亚洲欧美日韩电影| 久久久久久噜噜噜久久久精品| 国产亚洲激情视频在线| 久久久精品国产99久久精品芒果| 久久久国产一区二区| 在线观看的日韩av| 嫩草伊人久久精品少妇av杨幂| 亚洲国产精品悠悠久久琪琪| 亚洲精品久久久蜜桃| 欧美区日韩区| 亚洲一区尤物| 久热爱精品视频线路一| 亚洲精品女人| 国产精品久久一级| 久久精品五月婷婷| 亚洲国产精品久久久久| 亚洲一区欧美| 在线日本成人| 欧美色视频日本高清在线观看| 先锋a资源在线看亚洲| 欧美福利网址| 午夜精品久久久久久久久久久久久| 国产欧美一区二区三区另类精品 | 久久影院午夜论| 99精品国产99久久久久久福利| 性色av一区二区三区在线观看| 影音先锋另类| 欧美网站在线观看| 久久亚洲综合色一区二区三区| 亚洲精品国久久99热| 久久精品国产第一区二区三区最新章节 | 欧美 日韩 国产 一区| 一本在线高清不卡dvd| 免费观看在线综合| 亚洲一区二区三区四区中文 | 亚洲激情啪啪| 国产情人节一区| 欧美日韩国产一区精品一区| 欧美中文字幕精品| 一区二区三区高清| 亚洲二区视频在线| 久久久夜夜夜| 亚洲欧美中文另类| 99精品国产在热久久| 激情欧美丁香| 国产精品视频久久一区| 欧美日韩国产不卡在线看| 久久久水蜜桃av免费网站| 一本一本大道香蕉久在线精品| 免费在线亚洲| 久久se精品一区精品二区| 一本色道久久加勒比88综合| 亚洲国产精品美女| 国产中文一区二区| 国产精品一区二区久激情瑜伽| 欧美激情精品久久久久久蜜臀 | 久久综合九色| 久久久久九九视频| 欧美一级片久久久久久久| 亚洲视频在线观看视频| 99精品视频免费全部在线| 亚洲全部视频| 亚洲欧洲一区| 亚洲国产精品成人综合| 亚洲缚视频在线观看| 欧美aa在线视频| 免费黄网站欧美| 欧美电影在线播放| 欧美风情在线观看| 亚洲国产精品va在线看黑人| 亚洲成色999久久网站| 欧美成人免费全部观看天天性色| 可以看av的网站久久看| 另类春色校园亚洲| 欧美成人日韩| 亚洲欧洲综合另类在线| 亚洲精品黄色| 这里只有精品丝袜| 亚洲一区欧美二区| 欧美亚洲免费在线| 久久精品人人做人人综合| 久久久久国产精品厨房| 久久精品国产清自在天天线| 久久久久在线观看| 欧美成人四级电影| 欧美性猛交xxxx乱大交蜜桃| 国产精品免费网站| 狠狠色狠色综合曰曰| 亚洲国产精品久久久久秋霞蜜臀 | 亚洲三级性片| 亚洲香蕉伊综合在人在线视看| 羞羞色国产精品| 玖玖精品视频| 欧美视频四区| 国产在线精品二区| 在线观看国产日韩| 一区二区欧美亚洲| 久久精品人人做人人爽| 欧美国内亚洲| 亚洲一区二区在线免费观看视频| 欧美在线啊v一区| 欧美久久久久久久| 国产日韩亚洲欧美精品| 亚洲精品视频一区| 欧美在线播放| 亚洲国产成人精品久久| 亚洲一区二区伦理| 嫩草成人www欧美| 国产欧美日韩综合一区在线观看| 韩日成人av| 亚洲曰本av电影| 欧美高清视频| 性感少妇一区| 欧美日韩精品综合| 精品成人一区| 午夜在线a亚洲v天堂网2018| 欧美成人精品在线观看| 亚洲综合欧美日韩| 欧美黄在线观看| 激情六月婷婷综合| 欧美一二三区精品| 99视频+国产日韩欧美| 久久中文字幕导航| 国产亚洲一区在线播放| 亚洲一区二区三区乱码aⅴ| 欧美aⅴ99久久黑人专区| 午夜精品久久久| 国产精品成人一区二区网站软件 | 午夜亚洲激情| 99精品国产福利在线观看免费| 久热re这里精品视频在线6| 国产日韩精品一区二区三区|