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

天行健 君子當自強而不息

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>
            亚洲欧洲日本国产| 日韩一级片网址| 久久精品国产99精品国产亚洲性色 | 亚洲成人资源| 女生裸体视频一区二区三区| 在线观看亚洲a| 欧美激情2020午夜免费观看| 老司机aⅴ在线精品导航| 亚洲人精品午夜| 亚洲欧洲综合另类| 欧美亚洲成人免费| 亚洲欧美国产77777| 欧美亚洲免费高清在线观看| 国内精品久久久久影院色| 美女精品自拍一二三四| 欧美va天堂在线| 亚洲视频在线观看网站| 亚洲影院免费观看| 在线观看欧美成人| 亚洲精品久久久久久下一站| 国产精品激情| 免费成人黄色| 国产精品国产| 免费在线成人av| 欧美日本国产精品| 久久久www成人免费无遮挡大片 | 日韩亚洲欧美精品| 国产精品普通话对白| 久久久久久久综合狠狠综合| 欧美成人免费小视频| 亚洲一区二区三区视频| 久久精品国产清高在天天线| aⅴ色国产欧美| 久久成人一区| 亚洲视频欧美视频| 久久久视频精品| 午夜精品国产精品大乳美女| 久久婷婷影院| 欧美夜福利tv在线| 欧美精品在线观看播放| 久久深夜福利| 国产精品久久一卡二卡| 亚洲电影免费在线| 黑人操亚洲美女惩罚| 亚洲午夜免费视频| 日韩一区二区精品视频| 久久久噜噜噜久噜久久| 欧美一级午夜免费电影| 欧美日韩免费网站| 亚洲国产成人在线视频| 激情成人av在线| 亚洲欧美在线视频观看| 一级日韩一区在线观看| 美女爽到呻吟久久久久| 久久夜精品va视频免费观看| 国产精品永久在线| 亚洲一二三四区| 这里只有精品视频| 欧美精品日韩综合在线| 欧美jizz19性欧美| 国内自拍亚洲| 欧美亚洲一区| 久久久久看片| 红桃视频国产一区| 久久久av毛片精品| 麻豆精品一区二区综合av| 国产色综合网| 久久精品视频免费播放| 久久久www成人免费无遮挡大片| 国产精品一二| 欧美亚洲免费| 久久久午夜视频| 狠狠干综合网| 久久久久综合网| 亚洲第一福利在线观看| 亚洲精品在线观| 欧美日韩一区二区免费视频| 一本色道久久88亚洲综合88| 亚洲综合激情| 国产日韩精品一区二区三区| 久久gogo国模裸体人体| 欧美不卡视频一区| 亚洲巨乳在线| 欧美性感一类影片在线播放 | 91久久久亚洲精品| 这里是久久伊人| 国产精品亚洲一区| 久久国产精品高清| 亚洲国产欧美一区二区三区久久| 99热精品在线| 国产日本欧美在线观看| 久久三级福利| 夜夜嗨一区二区三区| 久久高清福利视频| 91久久精品视频| 国产精品久久久久久久9999 | 亚洲精品小视频在线观看| 亚洲一区免费看| 黄色一区二区在线| 欧美精品一区二区三区蜜桃| 亚洲影视在线| 亚洲国产美女精品久久久久∴| 亚洲一区二区三区中文字幕| 国内综合精品午夜久久资源| 欧美黄色aa电影| 午夜欧美大片免费观看| 欧美大片在线观看一区二区| 亚洲无玛一区| 亚洲国产精品久久人人爱蜜臀 | 国产欧美在线观看| 欧美成人免费全部| 亚洲欧美日韩一区二区三区在线| 亚洲成人自拍视频| 久久精品首页| 一个色综合av| 亚洲国产一区在线观看| 国产伦精品一区| 欧美区高清在线| 久久久亚洲精品一区二区三区| 一本色道久久综合亚洲二区三区| 免费成人小视频| 欧美一区二视频| 一区二区三区视频观看| 在线日韩中文字幕| 国产一区二区三区视频在线观看| 欧美视频在线不卡| 欧美激情国产日韩精品一区18| 欧美中文在线视频| 午夜精品免费视频| 一区二区高清视频| 亚洲美女淫视频| 亚洲国产日韩精品| 欧美国产日韩一区| 久久综合伊人77777蜜臀| 久久se精品一区二区| 亚洲一区在线免费| 亚洲免费影视第一页| 亚洲性色视频| 正在播放日韩| 99热在线精品观看| 一区二区国产日产| 一本色道久久综合亚洲精品不| 亚洲美女视频网| 99精品99| 亚洲在线电影| 欧美一区二区三区另类| 香蕉av777xxx色综合一区| 亚洲欧美国产毛片在线| 亚洲欧美日韩国产综合在线| 亚洲欧美第一页| 欧美一区二区三区电影在线观看| 亚洲欧美日本伦理| 午夜精品久久久久久久99黑人| 欧美一区二区三区四区在线| 欧美专区中文字幕| 久久久福利视频| 欧美刺激午夜性久久久久久久| 牛牛精品成人免费视频| 亚洲高清免费视频| 一区二区三区你懂的| 亚洲免费网站| 久久精品国产一区二区三区免费看 | 午夜精品久久| 久久久久久久精| 美日韩精品视频| 91久久夜色精品国产网站| 日韩一级成人av| 欧美一区免费视频| 免费不卡视频| 国产精品超碰97尤物18| 国产一二精品视频| 亚洲国产精品第一区二区| 亚洲免费黄色| 欧美一区二区三区在线播放| 蜜臀99久久精品久久久久久软件| 亚洲青涩在线| 欧美伊人久久| 欧美日本一区| 国产一区二区三区四区在线观看| 亚洲精品欧美日韩| 欧美在线视频一区二区| 亚洲电影免费观看高清| 亚洲校园激情| 欧美成在线视频| 国产视频丨精品|在线观看| 亚洲精品久久久久久下一站 | 亚洲免费成人av电影| 欧美一级大片在线免费观看| 欧美va天堂va视频va在线| 一本高清dvd不卡在线观看| 久久久人成影片一区二区三区| 欧美日韩中文字幕在线| 激情综合网激情| 翔田千里一区二区| 亚洲国产精品国自产拍av秋霞 | 美女视频一区免费观看| 亚洲视频你懂的| 欧美成人激情视频| 伊人久久综合97精品| 性欧美video另类hd性玩具|