Difference between revisions of "Combat Rules"

From Dragon Age Toolset Wiki
Jump to: navigation, search
(Flanking Bonus Determination: Added Section)
(Flanking Bonus Determination)
Line 74: Line 74:
  
 
* Flanking bonus is a floating point value that applies to both AttackRating and to the chance to score a critical hit.
 
* Flanking bonus is a floating point value that applies to both AttackRating and to the chance to score a critical hit.
 +
* The bonus ranges from +0 to +15 (+20 with combat_movement) and is applied to AttackRating and partially (1+(FlankingBonus/5)) to critical hit chance.
 
* The full logic is implemented in the function [[combat_h.nss#Combat_GetFlankingBonus|Combat_GetFlankingBonus]] in [[combat_h.nss]].
 
* The full logic is implemented in the function [[combat_h.nss#Combat_GetFlankingBonus|Combat_GetFlankingBonus]] in [[combat_h.nss]].
 
  
 
===== Backstab Determination =====
 
===== Backstab Determination =====

Revision as of 02:45, 28 October 2009

This page is work in progress

Overview

This page describes the technical implementation and flow of combat logic in the game scripts. It deals mostly with weapon based combat, for spells and abilities, please see Abilities.

Note: The term 'property' used on this page refers to Creature Properties.

Detailed Description

Combat in Dragon Age: Origin is handled mainly through scripts - the game engine itself has little knowledge of rule concepts such as 'Strength', 'Damage Modifier' or 'Armor Penetration'.


Hit Resolution

Hit resolution is implemented in the function Combat_GetAttackResult in the script library combat_h, which is invoked from the creature_core script whenever an attack event is received. The function returns one of several COMBAT_RESULT_* constants and handles messaging to the game engine which animation to play.

Overall, Dragon Age: Origin's combat system is 'hit heavy' as a targets armor does not modify it's chance of getting hit.

The simplified decision tree for to hit resolution is as follows:

if Target Is Placeable Object
  return COMBAT_RESULT_HIT
 
if Target Displacement/Dodge < RandomF(100.0)
  return COMBAT_RESULT_MISS  
 
if Attacker Is Using BASE_ITEM_TYPE_STAFF
  return COMBAT_RESULT_HIT
 
bHit = RandomF(100.0) < AttackRating - DefenseRating
bCrit = CheckCricital()
bBackstab = CheckBackstab()
 
if bHit
  if  HasEffect(attacker, EFFECT_TYPE_MISDIRECTION_HEX)
    if bCrit OR bBackstab
      return COMBAT_RESULT_HIT
    else
      return COMBAT_RESULT_MISS
 
 if bBackstab
    return COMBAT_RESULT_BACKSTAB
  else
     if bCrit
       return COMBAT_RESULT_CRITICAL_HIT
     else
       return  COMBAT_RESULT_HIT
 
  else
   return COMBAT_RESULT_MISS

AttackRating includes:

  • Base attack value (54.0f)
  • Flanking bonus (position based, modified by attacker and enemy talents and effects as well as shields. Rogues have a bonus here).
  • Distance based penalties (for ranged attacks)
  • Attacker's attack property value (this includes modifiers from buffs, etc.)
  • Any +attack item bonuses on the weapon that performs the attack.
  • Any external bonuses or penalties passed into the function (from talent scripts, etc.)
  • Difficulty setting based modifications


DefenseRating includes:

  • Defender defense value or missile deflection if attack was ranged. This includes items, effects and magical boni.
  • Difficulty setting based modifications


Flanking Bonus Determination
  • Flanking bonus is a floating point value that applies to both AttackRating and to the chance to score a critical hit.
  • The bonus ranges from +0 to +15 (+20 with combat_movement) and is applied to AttackRating and partially (1+(FlankingBonus/5)) to critical hit chance.
  • The full logic is implemented in the function Combat_GetFlankingBonus in combat_h.nss.
Backstab Determination
  • Backstab is determined for each melee attack only.
  • Only creatures with the Rogue Character Class may backstab. This is a class benefit.
  • Only humanoid attackers can backstab (this includes darkspawn)
  • The full logic is implemented in the function Combat_CheckBackstab in combat_h.nss.

Damage Resolution