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

天行健 君子當自強而不息

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农村| 亚洲在线一区二区| 国产一区二区电影在线观看 | 国产日韩精品久久久| 欧美资源在线观看| 久久久久久久久久看片| 亚洲国产一区二区a毛片| 亚洲国产一区视频| 国产精品国产一区二区| 欧美主播一区二区三区| 久久久噜噜噜久久中文字幕色伊伊| 亚洲第一区色| 99www免费人成精品| 国产一区二区三区丝袜| 欧美国产大片| 国产精品日韩精品欧美在线| 久久青青草原一区二区| 欧美日本一区| 久久久999| 欧美日韩视频在线一区二区| 午夜亚洲性色视频| 亚洲国产视频直播| 国产精品入口日韩视频大尺度| 久久免费视频在线观看| 欧美日韩的一区二区| 久久xxxx精品视频| 欧美日本一区二区三区| 久久一二三区| 国产精品久久久久久久一区探花| 麻豆精品视频在线观看| 国产精品久久久爽爽爽麻豆色哟哟| 久久综合九色综合网站| 欧美午夜不卡在线观看免费| 女人色偷偷aa久久天堂| 久久国产免费| 亚洲主播在线播放| 欧美不卡在线视频| 久久中文字幕一区二区三区| 国产精品成人在线| 91久久精品国产91性色tv| 国产欧美一二三区| 一区二区动漫| 日韩一级免费观看| 老鸭窝亚洲一区二区三区| 久久爱www久久做| 国产精品qvod| 日韩网站免费观看| 日韩午夜免费| 欧美激情欧美狂野欧美精品| 日韩视频专区| 欧美+日本+国产+在线a∨观看| 久久久99国产精品免费| 国产精品人人做人人爽人人添| 亚洲美女视频| 日韩一级免费观看| 欧美精品一区二区久久婷婷| 欧美成人一品| 亚洲精品一区久久久久久| 牛夜精品久久久久久久99黑人| 久久综合久久久久88| 国产一区清纯| 久久精品在线| 免费av成人在线| 亚洲国产精品成人综合| 免费中文日韩| 亚洲精品色图| 亚洲网友自拍| 国产精品视频yy9299一区| 亚洲在线观看免费| 久久精品国产欧美激情| 好男人免费精品视频| 久久久国产精彩视频美女艺术照福利| 久久久精品性| 在线免费观看一区二区三区| 美日韩在线观看| 亚洲激情在线| 亚洲一区尤物| 国产一区高清视频| 卡通动漫国产精品| 亚洲人精品午夜| 亚洲小少妇裸体bbw| 国产精品―色哟哟| 久久久www免费人成黑人精品| 欧美电影电视剧在线观看| 亚洲伦伦在线| 国产精品每日更新| 久久亚洲风情| 99av国产精品欲麻豆| 欧美中文字幕| 亚洲美女av网站| 国产美女精品一区二区三区| 久久九九免费| 日韩视频在线一区| 久久婷婷色综合| 一本色道久久加勒比88综合| 国产麻豆91精品| 欧美 日韩 国产在线| 亚洲亚洲精品在线观看 | 欧美黄色一区| 亚洲在线免费| 亚洲国产精品久久久久久女王| 欧美日韩精品伦理作品在线免费观看| 亚洲一区视频在线观看视频| 欧美高清免费| 久久国产66| 亚洲调教视频在线观看| 一区二区在线观看视频在线观看| 欧美三级视频在线观看| 久久久免费精品视频| 亚洲视频在线观看视频| 亚洲国产精品99久久久久久久久| 午夜欧美精品久久久久久久| 亚洲精品国产无天堂网2021| 国产综合香蕉五月婷在线| 欧美视频你懂的| 欧美大片免费看| 久久精品人人爽| 亚洲欧美日韩综合aⅴ视频| 亚洲欧洲在线播放| 免费h精品视频在线播放| 久久国产精彩视频| 亚洲一区日本| 久久精品国产第一区二区三区最新章节| 激情综合久久| 国产精品网站在线观看| 欧美精品一区二区三区在线播放 | 美女亚洲精品| 欧美一区二区三区视频免费播放| 亚洲精品裸体| 亚洲第一久久影院| 免费看精品久久片| 久久午夜电影网| 久久香蕉国产线看观看网| 久久精品国产第一区二区三区| 亚洲欧美日韩国产成人| 亚洲在线一区二区| 亚洲一二三区在线观看| 999在线观看精品免费不卡网站| 亚洲国产成人av好男人在线观看| 国内精品一区二区| 一区精品久久| 亚洲大片一区二区三区| 亚洲电影在线免费观看| 在线观看视频欧美| 1024国产精品| 亚洲精品视频啊美女在线直播| 亚洲区中文字幕| 野花国产精品入口| 一区二区高清在线| 亚洲影院免费| 欧美一区二区在线视频| 久久精品99国产精品日本| 久久久久成人精品| 欧美电影美腿模特1979在线看| 欧美大尺度在线观看| 亚洲黄色大片| 在线视频精品一| 久久精品国产91精品亚洲| 久久久www成人免费精品| 久久阴道视频| 91久久中文| 中文日韩在线视频| 欧美在线一二三区| 免费国产自线拍一欧美视频| 欧美人与禽性xxxxx杂性| 国产精品久久7| 樱花yy私人影院亚洲| 亚洲美女啪啪| 久久国产精品久久久久久| 两个人的视频www国产精品| 91久久国产综合久久蜜月精品 | 久久国产精品99国产精| 免费不卡欧美自拍视频| 亚洲毛片一区| 久久久精品一品道一区| 欧美午夜精品久久久| 精品福利电影| 中文国产一区| 欧美r片在线| 亚洲图片激情小说| 免费在线观看日韩欧美| 国产精品一卡二| 日韩视频国产视频| 久久精品国语| 99国产精品久久久久久久| 久久精品首页| 国产精品视频xxx| 日韩一本二本av| 两个人的视频www国产精品| a4yy欧美一区二区三区| 久久天天躁狠狠躁夜夜爽蜜月| 国产精品久久久久久久久久免费| 亚洲国产高潮在线观看| 欧美一区激情| 一区二区三区日韩欧美精品| 欧美大片va欧美在线播放| 国产自产v一区二区三区c|