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

天行健 君子當自強而不息

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 閱讀(272) 評論(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>
            亚洲午夜精品视频| 亚洲欧美久久久| 欧美国产精品久久| 日韩亚洲在线| aⅴ色国产欧美| 国产精品一区一区| 久久精品一本| 免费一区视频| 中文在线不卡视频| 亚洲性视频h| 激情小说亚洲一区| 亚洲第一在线| 欧美日本不卡| 欧美影院视频| 老司机午夜精品视频| 一本色道久久88亚洲综合88| 黄色精品一区二区| 免费美女久久99| 欧美日韩精品| 久久久蜜桃精品| 欧美国内亚洲| 久久gogo国模裸体人体| 久久夜色精品国产欧美乱| 日韩视频专区| 欧美一区二区三区四区在线| 在线日韩视频| 亚洲图片欧美一区| 亚洲高清二区| 亚洲免费在线观看| 亚洲日本视频| 欧美在线视频全部完| 一区二区三区高清在线| 欧美怡红院视频一区二区三区| 亚洲国产影院| 午夜精品久久| 一区二区三区精密机械公司| 久久aⅴ国产紧身牛仔裤| 99精品国产热久久91蜜凸| 欧美一区不卡| 亚洲你懂的在线视频| 老司机一区二区三区| 欧美亚洲一区二区在线| 欧美激情视频网站| 久久免费高清视频| 国产精品日韩欧美一区二区| 亚洲国产黄色片| 狠狠色综合日日| 亚洲欧美经典视频| 一本一本a久久| 免费久久99精品国产自| 久久视频免费观看| 国产精品日本一区二区| 亚洲精品1区2区| 在线欧美一区| 久久天天躁狠狠躁夜夜爽蜜月| 欧美在线观看一区二区| 国产精品成人一区二区网站软件 | 免费短视频成人日韩| 国产精品色午夜在线观看| 亚洲精品一区在线| 亚洲免费观看高清在线观看 | 久久精品视频在线| 欧美资源在线| 国产视频不卡| 欧美综合二区| 久久免费精品视频| 黄色亚洲免费| 久久男人av资源网站| 久热精品视频在线| 在线观看不卡| 欧美不卡高清| 亚洲精品视频在线观看网站| 99国产精品99久久久久久| 欧美激情视频网站| 日韩一级黄色大片| 亚洲一区在线直播| 国产日韩亚洲欧美综合| 欧美伊久线香蕉线新在线| 久久婷婷人人澡人人喊人人爽| 国内激情久久| 亚洲欧洲一区二区三区| 亚洲精品影院在线观看| 欧美日本国产视频| 一本色道久久综合亚洲精品按摩 | 性色av香蕉一区二区| 国产精品一区二区久久国产| 午夜精品久久久久久久99黑人| 久久精品二区三区| 在线观看免费视频综合| 欧美激情视频一区二区三区在线播放| 亚洲精品老司机| 欧美有码在线视频| 亚洲二区精品| 国产精品二区在线| 久久久久久久综合狠狠综合| 亚洲国产高清一区| 亚洲欧美日韩天堂| 在线播放日韩欧美| 欧美日韩一区二区精品| 欧美一区三区三区高中清蜜桃 | 亚洲免费在线视频一区 二区| 国产色视频一区| 欧美不卡高清| 欧美在线观看视频一区二区| 欧美激情精品久久久久久免费印度| 99精品视频免费观看| 国产精品一区二区你懂的| 美女精品在线| 午夜国产一区| 日韩天堂在线视频| 免费在线观看日韩欧美| 亚洲影院免费| 亚洲精品一区二区三区不| 国产精品一区在线观看| 欧美丰满高潮xxxx喷水动漫| 亚洲欧美日韩区| 亚洲毛片在线看| 欧美福利一区二区| 久久精品首页| 亚洲欧美美女| 亚洲视屏在线播放| 亚洲国产天堂久久国产91| 国产午夜精品在线| 欧美午夜理伦三级在线观看| 欧美成人精精品一区二区频| 欧美亚洲一区二区在线观看| av成人国产| 亚洲精品老司机| 欧美激情国产日韩| 久久综合色天天久久综合图片| 午夜亚洲一区| 亚洲欧美成aⅴ人在线观看| 日韩亚洲在线| 99re热精品| 亚洲三级免费| 亚洲韩日在线| 亚洲国产精品成人一区二区 | 欧美激情亚洲另类| 欧美mv日韩mv国产网站| 久久中文字幕一区二区三区| 欧美一区影院| 久久激情网站| 久久免费视频这里只有精品| 欧美亚洲免费电影| 欧美一区二区大片| 久久精品72免费观看| 欧美综合二区| 久久久久99| 蜜桃av综合| 欧美激情视频一区二区三区免费| 免费欧美在线视频| 欧美高清视频一二三区| 欧美日韩 国产精品| 欧美天天视频| 国产精品无码永久免费888| 国产精品乱码人人做人人爱| 国产精品久久久久久久久婷婷| 国产精品乱码久久久久久| 国产酒店精品激情| 狠狠爱www人成狠狠爱综合网| 尤物在线观看一区| 亚洲欧洲在线一区| 亚洲视频在线视频| 久久成人国产精品| 欧美大色视频| 一区二区高清在线| 欧美在线免费播放| 欧美韩日高清| 国产女人aaa级久久久级| 黄色日韩网站视频| 日韩一级黄色片| 欧美在线短视频| 欧美激情91| 亚洲午夜精品17c| 久久久久久久综合色一本| 欧美精品三级在线观看| 国产精品免费视频xxxx| 国内精品一区二区| 一区二区三区偷拍| 久久天天躁夜夜躁狠狠躁2022| 亚洲缚视频在线观看| 亚洲自拍都市欧美小说| 鲁大师成人一区二区三区 | 久久夜色精品亚洲噜噜国产mv| 欧美好吊妞视频| 国产三级欧美三级日产三级99| 亚洲黄色有码视频| 欧美在线二区| 亚洲精品韩国| 久久久久久久综合日本| 国产精品国产三级国产| 亚洲国产精品999| 香港成人在线视频| 最近中文字幕日韩精品| 久久成年人视频| 国产精品久久久一本精品| 亚洲精品国产日韩| 麻豆精品在线播放| 性做久久久久久免费观看欧美 | 久久经典综合|