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

天行健 君子當自強而不息

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>
            亚洲国产精品综合| 欧美国产欧美综合| 国产亚洲毛片| 久久午夜色播影院免费高清| 久久精品观看| 亚洲国产1区| 亚洲美女网站| 国产日韩一区二区三区在线| 久久尤物视频| 欧美大片一区| 亚洲欧美综合| 欧美99久久| 亚洲欧美日韩天堂| 久久精品中文字幕一区二区三区 | 99av国产精品欲麻豆| 欧美日韩四区| 久久青草欧美一区二区三区| 你懂的国产精品| 亚洲视频日本| 久久久久久亚洲综合影院红桃 | 日韩午夜中文字幕| 亚洲欧美在线播放| 亚洲黑丝在线| 亚洲欧美日韩综合一区| 亚洲日本中文| 午夜精品影院在线观看| 99re8这里有精品热视频免费 | 日韩视频一区二区三区| 国产在线精品一区二区夜色| 91久久精品日日躁夜夜躁国产| 国产精品啊啊啊| 免费永久网站黄欧美| 国产精品毛片| 亚洲欧洲免费视频| 一区二区在线观看视频| 亚洲午夜国产成人av电影男同| 亚洲大黄网站| 午夜日韩在线| 亚洲一区二区三| 欧美h视频在线| 久久综合给合| 国产丝袜一区二区| 一区二区国产日产| 日韩网站在线| 久热这里只精品99re8久| 欧美在线免费观看| 欧美视频在线播放| 亚洲人在线视频| 亚洲黄色影片| 麻豆91精品91久久久的内涵| 久久久91精品国产| 国产视频一区二区三区在线观看| 亚洲免费观看在线观看| 亚洲精品视频在线观看网站| 久久一区视频| 男人的天堂成人在线| 黑人巨大精品欧美黑白配亚洲| 亚洲欧美在线磁力| 欧美在线亚洲综合一区| 国产精品欧美一区二区三区奶水| 日韩视频在线观看国产| 在线中文字幕一区| 欧美日韩精品三区| 亚洲精品一区二区网址| 一区二区免费在线播放| 欧美日韩一区在线| 亚洲视频在线一区| 欧美一二三区在线观看| 国产三级欧美三级日产三级99| 亚洲欧美日韩视频一区| 久久精品官网| 亚洲电影网站| 欧美成人黑人xx视频免费观看| 亚洲国产精品激情在线观看| 亚洲毛片av在线| 欧美日韩播放| 亚洲一区二区毛片| 久久精品国产亚洲一区二区三区| 国产在线乱码一区二区三区| 久久婷婷蜜乳一本欲蜜臀| 久久亚洲捆绑美女| 亚洲国产专区校园欧美| 欧美久久久久久| 亚洲校园激情| 欧美va天堂va视频va在线| 亚洲日韩欧美视频一区| 国产精品黄色| 久久久久99| 亚洲精品欧美激情| 欧美综合二区| 亚洲精品国产精品国自产观看| 欧美日本亚洲韩国国产| 午夜精品视频在线观看| 欧美国产综合视频| 亚洲一区二区三区乱码aⅴ蜜桃女| 国产精品一区=区| 免费视频亚洲| 午夜精品久久久久久久久久久久久 | 欧美亚洲综合另类| 亚洲国产成人久久综合一区| 欧美日韩视频在线一区二区| 久久精品国产精品亚洲精品| 日韩视频在线观看一区二区| 久久久久久夜| 亚洲视频一区在线观看| 黄色一区二区三区| 欧美性做爰猛烈叫床潮| 久久男女视频| 午夜精品一区二区三区电影天堂| 欧美成va人片在线观看| 欧美一区二区视频在线观看| 日韩一区二区免费高清| 国内成人在线| 国产精品有限公司| 欧美精品在线极品| 久久九九热re6这里有精品| 国产精品99久久久久久白浆小说| 免费观看亚洲视频大全| 欧美伊人久久| 亚洲天堂av电影| 亚洲精品久久久久久久久久久久| 国产欧美日本一区二区三区| 欧美三级电影精品| 欧美a级大片| 久久亚洲图片| 久久精品一区二区三区不卡| 亚洲欧美伊人| 亚洲欧美成aⅴ人在线观看| 日韩视频在线免费| 亚洲精品乱码久久久久久蜜桃麻豆| 蜜臀av国产精品久久久久| 久久精品日韩一区二区三区| 翔田千里一区二区| 午夜伦理片一区| 亚洲免费人成在线视频观看| 亚洲视频在线观看免费| 一区二区三区欧美激情| 一区二区三区.www| 亚洲天天影视| 中国日韩欧美久久久久久久久| 99国产精品视频免费观看| 亚洲精品三级| 洋洋av久久久久久久一区| 亚洲免费av网站| 99国产精品视频免费观看| 99这里只有精品| 一本一本久久a久久精品综合妖精| 日韩一级在线| 亚洲一区二区欧美日韩| 午夜精品久久久久久久久久久久| 亚洲影院污污.| 香蕉久久精品日日躁夜夜躁| 久久精品亚洲一区二区| 狼人社综合社区| 欧美高清视频在线 | 久久免费一区| 欧美jizzhd精品欧美喷水| 亚洲成人资源网| 亚洲另类黄色| 午夜久久资源| 久久夜色精品国产噜噜av| 欧美黄色一区| 国产精品久久久久9999| 国产亚洲精品一区二555| 在线免费不卡视频| 亚洲婷婷在线| 久久久999精品视频| 亚洲电影自拍| 亚洲婷婷综合久久一本伊一区| 午夜在线观看欧美| 你懂的视频欧美| 国产精品日韩精品欧美精品| 韩国女主播一区| 99国内精品久久| 久久精品一级爱片| 亚洲国产一区二区三区青草影视 | 久久精品日产第一区二区三区| 久久在线精品| 国产精品狠色婷| 亚洲国产视频一区| 欧美亚洲一级片| 亚洲国产高清自拍| 午夜精品电影| 欧美日韩成人综合天天影院| 国产亚洲精品资源在线26u| 日韩午夜在线播放| 久久手机精品视频| 在线一区二区日韩| 欧美成人免费网站| 国产日韩精品久久| 亚洲午夜久久久久久久久电影网| 免费不卡在线观看| 亚洲综合日韩| 欧美揉bbbbb揉bbbbb| 最新国产精品拍自在线播放| 久久不见久久见免费视频1| 日韩视频一区二区在线观看| 男人的天堂亚洲在线| 国产一区二区精品久久99| 亚洲影院色在线观看免费|