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

天行健 君子當(dāng)自強(qiáng)而不息

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) 評(píng)論(0)  編輯 收藏 引用


只有注冊(cè)用戶(hù)登錄后才能發(fā)表評(píng)論。
網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問(wèn)   Chat2DB   管理


公告

導(dǎo)航

統(tǒng)計(jì)

常用鏈接

隨筆分類(lèi)(178)

3D游戲編程相關(guān)鏈接

搜索

最新評(píng)論

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <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>
            久久久欧美精品sm网站| 久久久人成影片一区二区三区观看| 久久综合久久综合九色| 麻豆国产精品777777在线 | 欧美日本亚洲视频| 亚洲欧美三级在线| 另类亚洲自拍| 亚洲欧美日韩网| 免费观看日韩av| 亚洲一区亚洲二区| 欧美高清视频| 久久国产成人| 国产精品入口夜色视频大尺度| 久久手机免费观看| 欧美日韩亚洲国产一区| 欧美+日本+国产+在线a∨观看| 欧美精品偷拍| 亚洲精品国产精品乱码不99按摩 | 亚洲自拍偷拍色片视频| 欧美国产欧美综合| 欧美国产视频在线| 影视先锋久久| 久久综合九色| 欧美激情精品久久久久久免费印度| 国产精品日韩久久久| 一本久久a久久免费精品不卡| 洋洋av久久久久久久一区| 欧美激情日韩| 亚洲影院免费观看| 欧美一区二区在线| 在线播放精品| 欧美国产高潮xxxx1819| 亚洲精品一区二区在线观看| 亚洲视频福利| 国产一区二区三区久久久久久久久| 午夜在线视频一区二区区别| 久久精品一区二区国产| 国外成人在线| 欧美日韩美女在线观看| 日韩一级免费| 久久嫩草精品久久久久| 亚洲乱码国产乱码精品精| 国产精品九九久久久久久久| 国产视频亚洲精品| 久久福利毛片| 亚洲精品免费在线观看| 久久精品国产亚洲aⅴ| 亚洲级视频在线观看免费1级| 国产精品成人播放| 欧美电影美腿模特1979在线看| av不卡在线观看| 欧美成人一区二区| 久久视频一区二区| 亚洲视频国产视频| 亚洲区国产区| 亚洲精品乱码久久久久久蜜桃麻豆 | 亚洲精品乱码久久久久久日本蜜臀 | 欧美高清日韩| 久久精品在线| 免费不卡在线观看av| 亚洲一区欧美激情| 99视频精品全国免费| 亚洲国产日韩欧美在线99| 美女视频黄免费的久久| 久久精品视频导航| 久久久久网址| 久久午夜视频| 欧美激情视频一区二区三区免费| 欧美一区二区播放| 久久免费一区| 亚洲国产91精品在线观看| 欧美激情亚洲激情| 99在线观看免费视频精品观看| 亚洲欧洲一区二区在线观看| 亚洲九九精品| 亚洲女人天堂成人av在线| 欧美在线精品免播放器视频| 久久亚洲风情| 国产精品国产三级国产aⅴ浪潮| 欧美性猛交xxxx乱大交蜜桃| 国产精品久久久久久久9999| 黄色一区二区三区| 亚洲一区二区在线播放| 久久成人资源| 一区二区电影免费观看| 久久久久综合| 国产亚洲aⅴaaaaaa毛片| 亚洲激情中文1区| 久久国产精品电影| 亚洲美女在线观看| 麻豆视频一区二区| 狠狠久久五月精品中文字幕| 亚洲视频日本| 91久久香蕉国产日韩欧美9色| 欧美在线你懂的| 国产精品乱子久久久久| 这里是久久伊人| 91久久精品国产91久久性色| 久久久噜噜噜久噜久久| 国产美女精品一区二区三区 | 亚洲美女精品久久| 欧美精品xxxxbbbb| 妖精成人www高清在线观看| 欧美刺激午夜性久久久久久久| 欧美一区二区三区视频在线| 国产精品免费一区二区三区观看| 亚洲欧洲久久| 这里是久久伊人| 国产精品免费aⅴ片在线观看| 亚洲欧美日韩精品在线| 亚洲婷婷在线| 影音先锋国产精品| 亚洲毛片播放| 国产精品一香蕉国产线看观看| 欧美一区二区网站| 欧美成人69av| 午夜精彩视频在线观看不卡| 午夜精品久久久久久99热软件 | 亚洲电影自拍| 欧美日韩在线视频观看| 久久夜色精品国产欧美乱极品 | 亚洲你懂的在线视频| 欧美一区二区精品久久911| 永久久久久久| 亚洲小说欧美另类社区| 一区精品在线播放| 亚洲视频导航| 亚洲精品欧洲| 久久国产精品久久久久久电车| 亚洲国内精品在线| 欧美在线亚洲综合一区| 亚洲免费在线观看| 欧美日本韩国一区二区三区| 老司机精品福利视频| 国产精品高清在线观看| 亚洲国产欧洲综合997久久| 国产在线高清精品| 亚洲欧美美女| 久久成人人人人精品欧| 国产精品对白刺激久久久| 欧美大片一区| 亚洲精品中文字| 欧美精品一区二区高清在线观看| 久久综合色影院| 亚洲国产va精品久久久不卡综合| 欧美一区二区三区在线免费观看 | 久久免费99精品久久久久久| 久久久www成人免费无遮挡大片| 国产精品一二三四区| 亚洲欧美影院| 久久亚洲欧美| 99精品视频一区| 国产精品红桃| 久久人人爽人人爽| 91久久久久久久久| 欧美一区二区高清| 在线电影国产精品| 国产精品www色诱视频| 午夜精彩国产免费不卡不顿大片| 久久久久久亚洲精品不卡4k岛国| 一区二区亚洲精品| 欧美性猛交xxxx乱大交蜜桃| 久久久中精品2020中文| 99re在线精品| 亚洲高清123| 久久久久久精| 亚洲一二三四区| 在线观看免费视频综合| 国产精品成人一区二区艾草| 久久蜜桃香蕉精品一区二区三区| 日韩视频精品| 欧美国产在线电影| 免费观看成人鲁鲁鲁鲁鲁视频| 一本色道久久综合一区| 亚洲国产日韩欧美综合久久 | 狂野欧美一区| 久久www成人_看片免费不卡| 亚洲制服av| 亚洲综合欧美日韩| 亚洲免费视频网站| 一区二区日本视频| 99re国产精品| 一区二区精品| 欧美亚洲一区| 久久成人在线| 免费亚洲一区| 亚洲精品免费看| 一本色道久久综合亚洲精品高清| 99国产精品久久久久久久久久| 亚洲精品网站在线播放gif| 日韩网站在线| 午夜欧美不卡精品aaaaa| 久久黄色网页| 欧美精品在线播放| 国产精品黄视频| 一区二区三区中文在线观看 | 含羞草久久爱69一区| 亚洲国产美女精品久久久久∴| 日韩一级裸体免费视频| 欧美一区二区三区四区在线观看 |