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

天行健 君子當(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>
            欧美激情国产日韩| 久久另类ts人妖一区二区| 亚洲国产精品久久久久秋霞不卡| 久久大逼视频| 在线观看一区视频| 亚洲第一久久影院| 欧美日本高清视频| 亚洲影院色在线观看免费| 亚洲一级黄色av| 国产一区二区三区久久精品| 蜜臀久久99精品久久久久久9| 欧美jizzhd精品欧美巨大免费| 亚洲精品乱码视频| 亚洲永久免费精品| 亚洲高清一区二| 99国内精品| 激情综合在线| 亚洲人成人一区二区在线观看| 欧美日韩中文在线| 久久久久青草大香线综合精品| 免费视频一区二区三区在线观看| aa国产精品| 久久国产福利| 亚洲午夜精品久久| 久久婷婷综合激情| 亚洲在线观看免费| 玖玖国产精品视频| 午夜日韩av| 欧美激情91| 免费观看一区| 国产精品一区久久久| 欧美国产大片| 国产一区二区三区观看| 99精品热6080yy久久| 亚洲国产91色在线| 欧美伊久线香蕉线新在线| 99精品国产在热久久婷婷| 久久精品男女| 亚欧美中日韩视频| 欧美三区美女| 91久久在线播放| 亚洲成人自拍视频| 欧美影院午夜播放| 欧美一级一区| 国产精品电影观看| 日韩香蕉视频| 99在线精品视频| 你懂的网址国产 欧美| 久久亚洲精选| 国产有码一区二区| 午夜电影亚洲| 欧美专区18| 国产九九精品视频| 亚洲女性裸体视频| 亚洲欧美久久久久一区二区三区| 欧美另类人妖| 亚洲美女中文字幕| 一本一道久久综合狠狠老精东影业| 六月婷婷一区| 亚洲二区免费| 亚洲精品视频免费观看| 久久这里有精品视频| 蜜臀久久久99精品久久久久久| 好吊妞**欧美| 蜜臀av性久久久久蜜臀aⅴ四虎 | 在线日韩精品视频| 久久久精品一品道一区| 久久综合成人精品亚洲另类欧美| 国产精自产拍久久久久久| 亚洲欧美清纯在线制服| 久久国产毛片| 狠狠久久五月精品中文字幕| 久久成人免费网| 欧美阿v一级看视频| 亚洲激情成人网| 欧美日韩mv| 亚洲午夜激情网页| 久久久久久午夜| 亚洲韩国青草视频| 欧美啪啪一区| 午夜精品久久久久久久蜜桃app| 久久久久久九九九九| 亚洲国产精品va在线观看黑人 | 亚洲欧洲精品一区二区三区| 一区二区成人精品| 国产精品视频在线观看| 欧美在线精品免播放器视频| 欧美成人一区二区三区| 一区二区动漫| 国产亚洲一区二区在线观看| 可以免费看不卡的av网站| 亚洲国产日韩欧美在线图片| 亚洲一区二区三| 一区二区三区我不卡| 欧美日本在线一区| 亚洲免费小视频| 亚洲第一级黄色片| 欧美一区久久| 亚洲美女视频在线免费观看| 国产精品亚洲综合久久| 蜜臀va亚洲va欧美va天堂| 亚洲深夜影院| 欧美激情精品久久久久| 欧美一区二区高清| 亚洲精品久久久久久久久久久久久 | 先锋a资源在线看亚洲| 曰韩精品一区二区| 国产精品美女主播| 农村妇女精品| 欧美一区二区免费| 一区二区三区欧美| 亚洲第一搞黄网站| 久久久久www| 亚洲一二三区在线| 亚洲美女电影在线| 国内成+人亚洲+欧美+综合在线| 欧美日韩免费观看一区三区 | 亚洲综合色激情五月| 亚洲高清免费在线| 麻豆免费精品视频| 久久国产一区二区| 亚洲欧美一区二区三区在线| 日韩视频一区二区在线观看| 在线观看日韩av先锋影音电影院| 国产精品久久久久久久久久直播| 欧美激情综合色| 免费日韩成人| 美女国产一区| 久久蜜桃资源一区二区老牛| 小黄鸭精品密入口导航| 亚洲午夜av在线| 在线视频亚洲一区| 一区二区福利| 一区二区冒白浆视频| 亚洲乱码国产乱码精品精| 亚洲国产日韩一级| 亚洲成色777777女色窝| 欧美刺激性大交免费视频 | 99在线热播精品免费| 亚洲欧洲三级电影| 亚洲人成人一区二区在线观看| 亚洲第一网站| 亚洲精品乱码久久久久久蜜桃91| 亚洲大片在线| 日韩亚洲欧美成人| 国产精品99久久久久久久女警| 一区二区三区三区在线| 中文有码久久| 午夜日韩激情| 久久久久久网址| 免费看的黄色欧美网站| 亚洲成人在线视频播放| 欧美成人久久| 亚洲另类春色国产| 亚洲性线免费观看视频成熟| 亚洲欧美日韩网| 久久精品国产一区二区三| 噜噜噜在线观看免费视频日韩| 欧美肥婆在线| 国产精品一区二区黑丝| 国产一区二区三区久久| 91久久久久久久久久久久久| 亚洲人久久久| 亚洲欧美日韩在线一区| 久久久久久久综合色一本| 欧美顶级少妇做爰| 日韩视频―中文字幕| 亚洲欧美另类国产| 久久综合激情| 欧美日韩亚洲不卡| 国产一区二区毛片| 亚洲日本精品国产第一区| 亚洲欧美福利一区二区| 免费h精品视频在线播放| 亚洲日本成人| 性欧美1819sex性高清| 欧美成人国产| 国产一区二区成人久久免费影院| 亚洲国产精品一区二区www| 亚洲网站在线播放| 久久亚洲精品一区二区| 日韩一级精品| 久久久久久久网| 国产精品久久9| 亚洲丁香婷深爱综合| 亚洲欧美日韩一区二区三区在线观看| 浪潮色综合久久天堂| 在线一区二区三区四区五区| 久久视频在线视频| 国产美女精品视频| 一本不卡影院| 欧美黄色小视频| 欧美一区二区三区四区在线观看| 欧美日本一区二区三区| 亚洲黄色小视频| 久久久久高清| 亚洲欧美日韩一区| 国产精品久久久久aaaa| 亚洲美女毛片| 欧美不卡视频一区|