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

天行健 君子當自強而不息

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>
            一区二区高清视频在线观看| 欧美视频官网| 亚洲免费久久| av成人免费在线观看| 一本久久综合亚洲鲁鲁| 99视频日韩| 香蕉久久一区二区不卡无毒影院 | 久久精品二区三区| 韩国v欧美v日本v亚洲v| a91a精品视频在线观看| 亚洲视频在线看| 久久精品视频播放| 欧美顶级少妇做爰| 欧美性做爰毛片| 狠狠干成人综合网| 一区二区三区 在线观看视| 亚洲女同精品视频| 欧美va亚洲va香蕉在线| 99亚洲伊人久久精品影院红桃| 亚洲欧美日韩电影| 欧美jizz19性欧美| 国产午夜亚洲精品理论片色戒| 亚洲经典自拍| 欧美一区三区三区高中清蜜桃| 欧美电影免费观看大全| 亚洲欧美精品在线观看| 免费在线欧美黄色| 国产在线观看一区| 亚洲永久精品大片| 亚洲国产mv| 一区二区三区四区五区精品| 久久综合狠狠综合久久综青草 | 欧美日韩亚洲综合一区| 国产综合色产| 亚洲欧美视频在线观看视频| 亚洲福利国产| 久久久久久日产精品| 国产精品任我爽爆在线播放| 日韩亚洲欧美一区| 亚洲第一黄色网| 久久精品女人的天堂av| 国产精品一区二区你懂得| 一本在线高清不卡dvd| 欧美高清视频www夜色资源网| 亚洲欧美日韩在线综合| 欧美午夜激情小视频| 日韩亚洲国产欧美| 欧美激情一区二区三区在线视频观看| 一本色道久久综合亚洲精品不| 欧美成人免费小视频| 亚洲成人资源| 欧美第十八页| 欧美www在线| 亚洲精品一区二区三区婷婷月 | 欧美一区成人| 亚洲一区二区三区激情| 国产精品乱子乱xxxx| 亚洲一区综合| 久久综合九色综合网站| 欧美第一黄色网| 亚洲激情综合| 亚洲黄色精品| 欧美日韩mp4| 亚洲一区二区毛片| 一区二区欧美激情| 国产精品一区久久| 欧美中文字幕久久| 欧美在线网址| 在线日本欧美| 亚洲精品亚洲人成人网| 欧美日韩高清区| 午夜视频一区在线观看| 欧美一区日本一区韩国一区| 激情成人亚洲| 91久久精品日日躁夜夜躁欧美| 欧美久久九九| 午夜一级久久| 噜噜噜91成人网| 在线午夜精品自拍| 午夜激情一区| 亚洲精品久久7777| 亚洲素人一区二区| 尤物yw午夜国产精品视频明星| 亚洲激情自拍| 国产九九精品视频| 美女视频一区免费观看| 欧美日韩色婷婷| 久久久精品午夜少妇| 欧美激情网站在线观看| 欧美一区二区视频在线观看2020| 久久久精品国产99久久精品芒果| 日韩午夜视频在线观看| 校园春色国产精品| 日韩五码在线| 久久久久国产精品人| 一区二区高清在线| 久久久蜜桃一区二区人| 亚洲午夜精品久久久久久浪潮| 欧美一区二区三区男人的天堂| 亚洲欧洲精品天堂一级| 午夜精品视频网站| 正在播放亚洲一区| 久久综合色婷婷| 欧美一区二区三区在线观看视频| 麻豆精品精华液| 久久久99免费视频| 国产精品欧美精品| 99精品久久久| 日韩一级精品| 免费在线日韩av| 欧美freesex8一10精品| 国产情人节一区| 亚洲毛片av| 日韩西西人体444www| 久久婷婷丁香| 久久视频在线免费观看| 国产精品视频免费| 99国产精品| 在线中文字幕不卡| 欧美成人精品福利| 欧美成人精品影院| 在线观看欧美激情| 久久久www| 亚洲激情偷拍| 欧美在线观看一区二区| 欧美日韩天堂| 亚洲国产美国国产综合一区二区| 国产一区二区三区久久| 亚洲一区二区久久| 一区二区三区欧美在线| 欧美激情综合色| 亚洲欧洲久久| 99国产精品一区| 欧美精品三级| 亚洲精品小视频| av不卡在线看| 欧美三区美女| 亚洲男人的天堂在线观看| 亚洲欧美在线一区二区| 国产精品一区二区三区久久| 宅男噜噜噜66一区二区 | 午夜日韩在线| 国产午夜精品全部视频在线播放| 午夜精品久久久久| 久久久亚洲欧洲日产国码αv | 亚洲精品久久| 欧美人在线视频| 亚洲手机视频| 久久久午夜精品| 亚洲黄色在线看| 欧美日韩一区二区三区免费看| 99伊人成综合| 久久久精品一区| 91久久黄色| 欧美三级特黄| 欧美一区二区私人影院日本 | 亚洲欧洲一区二区三区在线观看 | 亚洲精选视频在线| 亚洲欧美在线视频观看| 国产原创一区二区| 欧美精品国产精品| 午夜精品美女自拍福到在线| 久久久久成人精品| 亚洲精品在线免费| 国产精品亚洲精品| 麻豆国产va免费精品高清在线| 亚洲精品社区| 久久精品综合一区| 日韩亚洲国产精品| 国产亚洲欧美一区二区三区| 美女精品视频一区| 亚洲欧美国产日韩中文字幕| 欧美大片免费观看在线观看网站推荐| 99天天综合性| 亚洲第一网站| 国产精品私房写真福利视频| 狂野欧美性猛交xxxx巴西| 在线一区二区三区四区| 欧美刺激午夜性久久久久久久| 亚洲一区二区三区四区中文 | 国产欧美一区二区在线观看| 久久蜜桃香蕉精品一区二区三区| 一本不卡影院| 欧美激情一区二区三区全黄 | 一区二区三区四区五区精品视频 | 国产区精品在线观看| 欧美成人午夜剧场免费观看| 亚洲欧美日韩精品综合在线观看| 亚洲第一精品在线| 久久人人看视频| 亚洲欧美视频一区二区三区| 亚洲精品国产视频| 亚洲高清免费视频| 韩国女主播一区| 国产毛片一区| 国产精品普通话对白| 欧美午夜精品久久久久免费视| 欧美激情一区| 欧美精品一区二区三区久久久竹菊| 久久天堂成人|