<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://www.datoolset.net/mw/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Georg+Zoeller</id>
		<title>Dragon Age Toolset Wiki - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="http://www.datoolset.net/mw/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Georg+Zoeller"/>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/wiki/Special:Contributions/Georg_Zoeller"/>
		<updated>2026-04-16T05:19:02Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.25.6</generator>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=Attribute&amp;diff=7345</id>
		<title>Attribute</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=Attribute&amp;diff=7345"/>
				<updated>2009-10-30T17:07:41Z</updated>
		
		<summary type="html">&lt;p&gt;Georg Zoeller: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Overview ===&lt;br /&gt;
&lt;br /&gt;
Description of the attributes used by the game from a design perspective, with a focus on information needed by content and gameplay designers, such as how to incorporate attributes with ability, skill and campaign design.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Primary Attributes ===&lt;br /&gt;
&lt;br /&gt;
The primary attributes in Dragon Age's rules system are&lt;br /&gt;
&lt;br /&gt;
==== Strength ====&lt;br /&gt;
&lt;br /&gt;
===== Effects =====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Dexterity ====&lt;br /&gt;
&lt;br /&gt;
===== Effects  =====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Cunning ====&lt;br /&gt;
&lt;br /&gt;
===== Effects =====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Willpower ====&lt;br /&gt;
&lt;br /&gt;
===== Effects =====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Constitution ====&lt;br /&gt;
&lt;br /&gt;
===== Effects =====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Magic ====&lt;br /&gt;
&lt;br /&gt;
===== Effects =====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Scripts]]&lt;br /&gt;
[[Category: Rules]]&lt;/div&gt;</summary>
		<author><name>Georg Zoeller</name></author>	</entry>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=Attribute&amp;diff=7344</id>
		<title>Attribute</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=Attribute&amp;diff=7344"/>
				<updated>2009-10-30T17:06:01Z</updated>
		
		<summary type="html">&lt;p&gt;Georg Zoeller: /* Overview */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Overview ===&lt;br /&gt;
&lt;br /&gt;
The creature property system is the heart of the rules engine and defines all the numerical values that make up a character in Dragon Age.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Primary Attributes ===&lt;br /&gt;
&lt;br /&gt;
The primary attributes in Dragon Age's rules system are&lt;br /&gt;
&lt;br /&gt;
==== Strength ====&lt;br /&gt;
&lt;br /&gt;
===== Effects =====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Dexterity ====&lt;br /&gt;
&lt;br /&gt;
===== Effects  =====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Cunning ====&lt;br /&gt;
&lt;br /&gt;
===== Effects =====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Willpower ====&lt;br /&gt;
&lt;br /&gt;
===== Effects =====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Constitution ====&lt;br /&gt;
&lt;br /&gt;
===== Effects =====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Magic ====&lt;br /&gt;
&lt;br /&gt;
===== Effects =====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Scripts]]&lt;br /&gt;
[[Category: Rules]]&lt;/div&gt;</summary>
		<author><name>Georg Zoeller</name></author>	</entry>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=Attribute&amp;diff=7343</id>
		<title>Attribute</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=Attribute&amp;diff=7343"/>
				<updated>2009-10-30T17:05:20Z</updated>
		
		<summary type="html">&lt;p&gt;Georg Zoeller: /* Detailed Description */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Overview ===&lt;br /&gt;
&lt;br /&gt;
The creature property system is the heart of the rules engine and defines all the numerical values that make up a character in Dragon Age.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Primary Attributes ===&lt;br /&gt;
&lt;br /&gt;
The primary attributes in Dragon Age's rules system are&lt;br /&gt;
&lt;br /&gt;
==== Strength ====&lt;br /&gt;
&lt;br /&gt;
===== Effects ======&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Dexterity ====&lt;br /&gt;
&lt;br /&gt;
===== Effects ======&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Cunning ====&lt;br /&gt;
&lt;br /&gt;
===== Effects ======&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Willpower ====&lt;br /&gt;
&lt;br /&gt;
===== Effects ======&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Constitution ====&lt;br /&gt;
&lt;br /&gt;
===== Effects ======&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Magic ====&lt;br /&gt;
&lt;br /&gt;
===== Effects ======&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Scripts]]&lt;br /&gt;
[[Category: Rules]]&lt;/div&gt;</summary>
		<author><name>Georg Zoeller</name></author>	</entry>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=Attribute&amp;diff=7342</id>
		<title>Attribute</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=Attribute&amp;diff=7342"/>
				<updated>2009-10-30T16:52:59Z</updated>
		
		<summary type="html">&lt;p&gt;Georg Zoeller: Created page with '=== Overview ===  The creature property system is the heart of the rules engine and defines all the numerical values that make up a character in Dragon Age.  === Detailed Descrip...'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Overview ===&lt;br /&gt;
&lt;br /&gt;
The creature property system is the heart of the rules engine and defines all the numerical values that make up a character in Dragon Age.&lt;br /&gt;
&lt;br /&gt;
=== Detailed Description ===&lt;br /&gt;
&lt;br /&gt;
Properties are 32-bit floating point values associated with every combat capable creature in the game (Creature Type field in the toolset). They are used by engine, scripting and UI to make up and display the RPG ruleset of the game.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Scripts]]&lt;br /&gt;
[[Category: Rules]]&lt;/div&gt;</summary>
		<author><name>Georg Zoeller</name></author>	</entry>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=Creature_Properties&amp;diff=7341</id>
		<title>Creature Properties</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=Creature_Properties&amp;diff=7341"/>
				<updated>2009-10-30T16:52:36Z</updated>
		
		<summary type="html">&lt;p&gt;Georg Zoeller: /* Property Definitions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Overview ===&lt;br /&gt;
&lt;br /&gt;
The creature property system is the heart of the rules engine and defines all the numerical values that make up a character in Dragon Age.&lt;br /&gt;
&lt;br /&gt;
=== Detailed Description ===&lt;br /&gt;
&lt;br /&gt;
Properties are 32-bit floating point values associated with every combat capable creature in the game (Creature Type field in the toolset). They are used by engine, scripting and UI to make up and display the RPG ruleset of the game.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Property Types ====&lt;br /&gt;
&lt;br /&gt;
There are 3 types of properties that abstract the most common types of statistics found in an RPG:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== PROPERTY_TYPE_SIMPLE =====&lt;br /&gt;
&lt;br /&gt;
Simple properties are 32 bit floats that can hold a single value and that generally are not modified or influenced by other properties. Examples include Experience, Level or the number of unspent talent points a character has.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== PROPERTY_TYPE_ATTRIBUTE =====&lt;br /&gt;
&lt;br /&gt;
[[Attribute]]s are a moderately complex set of values encapsulating a single character stat. They have three fields that are independently tracked in the engine and are accessible from scripting: &lt;br /&gt;
&lt;br /&gt;
* Base - A character's unmodified base value, usually only modified during level up and character creation. This number is displayed as a white number the character sheet.&lt;br /&gt;
&lt;br /&gt;
* Modifier - A float32 that holds the sum of all effect based modifications to the property. This number is shown as a red (if negative) or green (if positive) number on the character sheet.&lt;br /&gt;
&lt;br /&gt;
* Total - The sum of the base and modifier fields along with any in engine modifications done to the property in C++ (for speed reasons) as defined by the engine link field. When reading this field, the engine will always clamp the return values between Min and Max, even through it stores the full, unmodified number internally.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;margin:0; background:#f5fffa; border:1px solid #a3bfb1; text-align:left; color:#000; padding:0.2em 0.4em; height:100%&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|'''Example:'''&lt;br /&gt;
A level 1 warrior with 15 strength, a buff that grants +2 strength and a shield that has a +1 strength enhancement would be stored as as:&lt;br /&gt;
* Base: 15&lt;br /&gt;
* Modifiers: 3&lt;br /&gt;
* Total 18&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== PROPERTY_TYPE_DEPLETABLE =====&lt;br /&gt;
Depletables represent the most complex type of stats usually found in an RPG, used for Health and Mana. In addition to all fields present on an Attribute, they have an additional 'Current' field. &lt;br /&gt;
&lt;br /&gt;
* Current - This is the character's current value in this stat, which can be between Min and Max and can exceed Total. &lt;br /&gt;
&lt;br /&gt;
Additionally, just like attributes, the EngineLink field defines some hardcoded behavior in the engine such as creating the link between the 'rengeration rate' properties.&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;margin:0; background:#f5fffa; border:1px solid #a3bfb1; text-align:left; color:#000; padding:0.2em 0.4em; height:100%&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|'''Example:'''&lt;br /&gt;
A level 1 warrior with 14 Con and 100 base health and a +5 health ring would store health who was at full health before getting hit for 20 points of damage:&lt;br /&gt;
* Base: 100&lt;br /&gt;
* Modifiers: +5&lt;br /&gt;
* Hidden Engine Modifiers: +20 (5 points for each point in CON after 10). &lt;br /&gt;
* Total: 125&lt;br /&gt;
* Current: 105&lt;br /&gt;
&lt;br /&gt;
Hidden Engine modifiers can not be modified (obviously, they're in C++), but can be disabled by setting the EngineLink field to 0. They exist purely to speed up stats accessed with high frequency (DAScript has a 7-15x overhead per instruction compared to native code).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Property Definitions ====&lt;br /&gt;
&lt;br /&gt;
The two dimensional data array defined in [[Properties.xls]] defines numerical values that exist on every creature in the game. All properties are float32 and all rules logic of the game is based on with floating point math. This dynamic data driven approach to rules relevant stats is new to Dragon Age: Origins and makes the engine extremely flexible for Designers. It enables the game to have a rules logic that is almost completely softcoded in script and data.&lt;br /&gt;
&lt;br /&gt;
The following is an excerpt from the 2da that lists all rows present in the initial ship version of Dragon Age: Origins but only shows the most important columns. Note that DLC or expansion content may be overriding individual lines in the 2da.&lt;br /&gt;
&lt;br /&gt;
{| valign=&amp;quot;top&amp;quot; border=&amp;quot;1&amp;quot; width=&amp;quot;100%&amp;quot;&lt;br /&gt;
|-| &lt;br /&gt;
| '''ID''' || '''Stat''' || '''Type''' || '''Min''' || '''Max''' || '''Comment'''&lt;br /&gt;
|-|&lt;br /&gt;
|  ''int'' || ''string'' || ''string'' || ''float'' || ''float'' || ''comment''&lt;br /&gt;
|-|&lt;br /&gt;
|  0 || INVALID || INVALID || 0 || 0 || &lt;br /&gt;
|-|&lt;br /&gt;
|  1 || Strength || ATTRIBUTE || 0 || 1000 || STR [[Attribute]]&lt;br /&gt;
|-|&lt;br /&gt;
|  2 || Dexterity || ATTRIBUTE || 0 || 1000 || DEX [[Attribute]]&lt;br /&gt;
|-|&lt;br /&gt;
|  3 || Willpower || ATTRIBUTE || 0 || 1000 || WIL [[Attribute]]&lt;br /&gt;
|-|&lt;br /&gt;
|  4 || Magic || ATTRIBUTE || 0 || 1000 || MAG [[Attribute]]&lt;br /&gt;
|-|&lt;br /&gt;
|  5 || Cunning || ATTRIBUTE || 0 || 1000 || CUN [[Attribute]]&lt;br /&gt;
|-|&lt;br /&gt;
|  6 || Constitution || ATTRIBUTE || 0 || 1000 || CON [[Attribute]]&lt;br /&gt;
|-|&lt;br /&gt;
|  7 || Health || DEPLETABLE || 1 || 9999 || Hit Points&lt;br /&gt;
|-|&lt;br /&gt;
|  8 || Mana_Stamina || DEPLETABLE || 0 || 9999 || Mana or Stamina, based on class&lt;br /&gt;
|-|&lt;br /&gt;
|  9 || Attack || ATTRIBUTE || 0 || 1000 || Attack Power&lt;br /&gt;
|-|&lt;br /&gt;
|  10 || Defense || ATTRIBUTE || 0 || 1000 || Defense&lt;br /&gt;
|-|&lt;br /&gt;
|  11 || Armor || ATTRIBUTE || 0 || 1000 || Armor Mitigation Potential&lt;br /&gt;
|-|&lt;br /&gt;
|  12 || DamageScale || ATTRIBUTE || 1 || 10 || Based Damage Scaling (for difficulty settings and ranks)&lt;br /&gt;
|-|&lt;br /&gt;
|  13 || SpellPower || ATTRIBUTE || 0 || 1000 || Spellpower (Max(MAG-10,0)+Effects)&lt;br /&gt;
|-|&lt;br /&gt;
|  14 || Regeneration_Health || ATTRIBUTE || 0 || 50 || Health Regeneration Rate (Explore Mode) per tick.&lt;br /&gt;
|-|&lt;br /&gt;
|  15 || Level || SIMPLE || 0 || 99 || Current Character Level. &lt;br /&gt;
|-|&lt;br /&gt;
|  16 || Displacement || ATTRIBUTE || 0 || 100 ||  Chance to outright evade any physical attach attempt (aka Dodge)&lt;br /&gt;
|-|&lt;br /&gt;
|  17 || Inventory_Size || SIMPLE || 0 || 1000 || Inventory Slot size (on party)&lt;br /&gt;
|-|&lt;br /&gt;
|  18 || AI_BEHAVIOR || SIMPLE || 0 || 1000 || Selected AI Behavior &lt;br /&gt;
|-|&lt;br /&gt;
|  19 || Experience || SIMPLE || 0 || 186001 || Experience Points&lt;br /&gt;
|-|&lt;br /&gt;
|  20 || Flanking_Angle || ATTRIBUTE || 0 || 180 || The angle at which this creature is able to flank an enemy (default is 90)&lt;br /&gt;
|-|&lt;br /&gt;
|  21 || Melee_Crit_Modifier || ATTRIBUTE || -100 || 200 || The +melee crit modifier&lt;br /&gt;
|-|&lt;br /&gt;
|  22 || Missile_Shield || ATTRIBUTE || 0 || 100 || Chance to avoid missiles (shields and some spells increase this)&lt;br /&gt;
|-|&lt;br /&gt;
|  23 || Ranged_Crit_Modifier || ATTRIBUTE || -100 || 200 || The +ranged crit modifier&lt;br /&gt;
|-|&lt;br /&gt;
|  24 || Ranged_Aim_Speed || ATTRIBUTE || -3 || 6 || The character's speed bonus or penality when aiming with ranged weapons&lt;br /&gt;
|-|&lt;br /&gt;
|  25 || BaseAttackRating || SIMPLE || 0 || 1000 || The creature's cached base attack rating&lt;br /&gt;
|-|&lt;br /&gt;
|  26 || BaseDefenseRating || SIMPLE || 0 || 1000 || The creature's cached base defense rating&lt;br /&gt;
|-|&lt;br /&gt;
|  27 || CurrentClass || SIMPLE || 0 || 31 || The creature class (index into cla_base.xls)&lt;br /&gt;
|-|&lt;br /&gt;
|  28 || Regeneration_Health_Combat || ATTRIBUTE || 0 || 20 || The creature's health regeneration rate (per tick) in combat.&lt;br /&gt;
|-|&lt;br /&gt;
|  29 || Regeneration_Stamina || ATTRIBUTE || -20 || 50 || The creature's stamina regeneration rate (per tick) in explore mode.&lt;br /&gt;
|-|&lt;br /&gt;
|  30 || Regeneration_Stamina_Combat || ATTRIBUTE || -20 || 20 || The creature's stamina regeneration rate (per tick) in combat mode.&lt;br /&gt;
|-|&lt;br /&gt;
|  31 || AttackSpeedModifier || ATTRIBUTE || 0 || 1.5 || The creature's universal melee attack speed modifiers (used by haste, momentum, etc.)&lt;br /&gt;
|-|&lt;br /&gt;
|  32 || Resistance_Mind || ATTRIBUTE || -100 || 100 || Mental Resistance.&lt;br /&gt;
|-|&lt;br /&gt;
|  33 || Resistance_Physical || ATTRIBUTE || -100 || 100 || Physical Resistance.&lt;br /&gt;
|-|&lt;br /&gt;
|  34 || Attribute_points || SIMPLE || 0 || 100 || Holds any unspent attribute points the creature has. If this is != 0, the UI shows the levelup button.&lt;br /&gt;
|-|&lt;br /&gt;
|  35 || Skill_points || SIMPLE || 0 || 100 || Holds any unspent skill points the creature has. If this is != 0, the UI shows the levelup button.&lt;br /&gt;
|-|&lt;br /&gt;
|  36 || talent_spell_points || SIMPLE || 0 || 100 ||Holds any unspent talent points the creature has. If this is != 0, the UI shows the levelup button.&lt;br /&gt;
|-|&lt;br /&gt;
|  37 || Background || SIMPLE || 0 || 10 || The character's origin (index into backgrounds.xls).&lt;br /&gt;
|-|&lt;br /&gt;
|  38 || specialization_points || SIMPLE || 0 || 2 || Holds any unspent specialization points the creature has. &lt;br /&gt;
|-|&lt;br /&gt;
|  39 || DamageBonus || ATTRIBUTE || -100 || 100 || Universal physical attack damage bonus on the creature.&lt;br /&gt;
|-|&lt;br /&gt;
|  40 || Threat_Decrease_Rate || SIMPLE || -1000 || 1000 || The rate at which the creature's threat rating decays.&lt;br /&gt;
|-|&lt;br /&gt;
|  41 || Fatique || ATTRIBUTE || -25 || 250 || The creature's current [[Fatigue]] (% increase of ability cost).&lt;br /&gt;
|-|&lt;br /&gt;
|  42 || Damage_Resistance_Fire || ATTRIBUTE || -100 || 75 || The creature's damage resistance to fire. All fire damage is reduce by %.&lt;br /&gt;
|-|&lt;br /&gt;
|  43 || Damage_Resistance_Cold || ATTRIBUTE || -100 || 75 || The creature's damage resistance to cold. All cold damage is reduce by %.&lt;br /&gt;
|-|&lt;br /&gt;
|  44 || Damage_Resistance_Electricity || ATTRIBUTE || -100 || 75 || The creature's damage resistance to lightning. All lightning damage is reduce by %.&lt;br /&gt;
|-|&lt;br /&gt;
|  45 || Damage_Resistance_Nature || ATTRIBUTE || -100 || 75|| The creature's damage resistance to nature. All nature damage is reduce by %.&lt;br /&gt;
|-|&lt;br /&gt;
|  46 || Damage_Resistance_Spirit || ATTRIBUTE || -100 || 75 || The creature's damage resistance to spirit. All spirit damage is reduce by %.&lt;br /&gt;
|-|&lt;br /&gt;
|  47 || Damage_Shield_points || ATTRIBUTE || 0 || 9999 || Magical, damage mitigating shield (all damage types) on the creature. Creature immune to damage until the shield is depleted.&lt;br /&gt;
|-|&lt;br /&gt;
|  48 || Damage_Shield_strength || ATTRIBUTE || 0 || 100 || The maximum amount of damage the creature's magical shields can absorb (not used yet.)&lt;br /&gt;
|-|&lt;br /&gt;
|  49 || Damage_OffHand || ATTRIBUTE || 0 || 9999 || Display only cache of creature's weapon damage potential. This value is only used to marshal data into the UI, it does not have any rules implications.&lt;br /&gt;
|-|&lt;br /&gt;
|  50 || Damage_MainHand || ATTRIBUTE || 0 || 9999  || Display only cache of creature's weapon damage potential. This value is only used to marshal data into the UI, it does not have any rules implications.&lt;br /&gt;
|-|&lt;br /&gt;
|  51 || Healing_Effect_Factor || ATTRIBUTE || 100 || 200 || Percentage modifier of how effective healing is on the creature. Blood magic does NOT use this field, it is coded in effect_heal_h instead.&lt;br /&gt;
|-|&lt;br /&gt;
|  52 || Spell_resistance || ATTRIBUTE || 0 || 100 || Creature 'hostile magic resistance'. % Chance to avoid any hostile magic.&lt;br /&gt;
|-|&lt;br /&gt;
|  53 || AP_BONUS || ATTRIBUTE || -100 || 100 || Armor Penetration bonuses  are stored her.&lt;br /&gt;
|-|&lt;br /&gt;
|  54 || CriticalRange || ATTRIBUTE || 0 || 200 || The 'range' which critical hits use. 150 would mean up to 150% of normal damage.&lt;br /&gt;
|-|&lt;br /&gt;
|  55 || Fire_Damage_Bonus || ATTRIBUTE || 0 || 30 || Percentage bonus to all fire damage dealt by the user (spells, staves, etc.)&lt;br /&gt;
|-|&lt;br /&gt;
|  56 || Spirit_Damage_Bonus || ATTRIBUTE || 0 || 30 || Percentage bonus to all spirit damage dealt by the user (spells, staves, etc.)&lt;br /&gt;
|-|&lt;br /&gt;
|  57 || Cold_Damage_Bonus || ATTRIBUTE || 0 || 30 || Percentage bonus to all cold damage dealt by the user (spells, staves, etc.)&lt;br /&gt;
|-|&lt;br /&gt;
|  58 || Nature_Damage_Bonus || ATTRIBUTE || 0 || 30 || Percentage bonus to all nature damage dealt by the user (spells, staves, etc.)&lt;br /&gt;
|-|&lt;br /&gt;
|  59 || Electricity_Damage_Bonus || ATTRIBUTE || 0 || 30 || Percentage bonus to all lightning damage dealt by the user (spells, staves, etc.)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;margin:0; background:#f5fffa; border:1px solid #a3bfb1; text-align:left; color:#000; padding:0.2em 0.4em; width:100%;  height:100%&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| valign=&amp;quot;top&amp;quot;|&lt;br /&gt;
&amp;lt;h2 style=&amp;quot;margin:0; background:red; font-size:150%; font-weight:bold; border:1px solid #a3bfb1; text-align:left; color:#fff; padding:0.2em 0.4em;&amp;quot;&amp;gt;Words of Caution&amp;lt;/h2&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Properties.xls is the most integral and powerful 2da in the game. Any changes to it have profound implications on the game and the chance of breaking existing savegames and introducing unwanted behavior.&lt;br /&gt;
&lt;br /&gt;
'''Removing Rows'''&lt;br /&gt;
It is referenced from many other rules and UI related 2das and removing existing data can have severe consequences, including the invalidation of existing characters. You can NEVER remove rows from this 2da!&lt;br /&gt;
&lt;br /&gt;
'''Changing Rows'''&lt;br /&gt;
Changing rows is not as dangerous as removing them, but still can have severe implications. The m2da system should be utilized to modify individual rows instead of overwriting the entire 2da. Especially the Min, Max and EngineLink columns hold a lot of rules relevant data that might not be obvious on the first glance (e.g. the Max value on 'Experience' defines the maximum XP the game will allow on a character. Any attempt to award more XP from script will silently fail.)&lt;br /&gt;
&lt;br /&gt;
'''Adding rows''':&lt;br /&gt;
Every row added to this file will reserve several Float32 data fields on every combat capable creature in the game. While a few floats might not sound like a lot, the impact on runtime area memory, savegame size and associated load times can not be overstated. While these issues are more pressing for the console versions of the game, they still do affect the PC version and I strongly advise not to add to this file unless absolutely necessary.&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Q&amp;amp;A ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Q: Why use Floats instead of integers? ===&lt;br /&gt;
&lt;br /&gt;
We had initially investigated a structure that would allow creation of typed properties but found the associated overhead and complexity in such a frequently accessed system to be too high to be worth it.&lt;br /&gt;
&lt;br /&gt;
Since much of our system requires floating point values and floats can be easily rounded for display purposes, we decided to use floating point across the board.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Q: Won't floating point math lead to imprecision? ===&lt;br /&gt;
&lt;br /&gt;
Yes, it can. Certain mathematical operations promote imprecision in floating point values. DA script, like NWScript is only precise for a limited number of digits and any existing imprecision can be magnified by consecutive divisions and other operations.&lt;br /&gt;
&lt;br /&gt;
However, there are mitigating circumstances that make this much less of a problem than it might appear on paper (or fresh from university :)&lt;br /&gt;
&lt;br /&gt;
* Most frequent calculations retrieve an existing floating point value cached in a property, run a bunch of calculations and then execute the result (e.g. calculating damage). The resulting values are rarely stored so imprecision has little opportunity to build up over time.&lt;br /&gt;
&lt;br /&gt;
* When writing to values that are displayed as integers on the UI or used as integers in the combat math, we are casting back to integer before storing or computation (e.g. to avoid health from going into the gray realm between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
* Some engine commands have added security to prevent rounding errors from propagating from script into engine stored values.&lt;br /&gt;
&lt;br /&gt;
* If you happen to do .004 points damage more during an attack, the gameplay impact is virtually zero, so even if imprecision manages to propagate up to the 3rd decimal, it is still not visible in the game.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Q: Is there anything absolutely hardcoded? ===&lt;br /&gt;
&lt;br /&gt;
Yes. While nearly all C++ implemented aspects of the rules system can be turned off by removing the associated EngineLink from properties.xls, a few behaviors are not easy to modify or replace by script:&lt;br /&gt;
&lt;br /&gt;
* Regeneration. While it is technically possible to turn off regeneration by setting all rates to 0, the system can not be modified. One would have to replace it with a scripted, heartbeat like construct to make changes. The reason for this is simple: Regeneration ticks at a high frequency on all combat capable creatures and the cpu time consumed by running this entirely in script is completely unacceptable.&lt;br /&gt;
&lt;br /&gt;
* Some UI rules are currently hardcoded and although it is possible to control some of the UI through various 2das, replacing the entire UI with a new framework is impossible at this point.&lt;/div&gt;</summary>
		<author><name>Georg Zoeller</name></author>	</entry>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=Creature_Properties&amp;diff=7340</id>
		<title>Creature Properties</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=Creature_Properties&amp;diff=7340"/>
				<updated>2009-10-30T16:52:15Z</updated>
		
		<summary type="html">&lt;p&gt;Georg Zoeller: /* PROPERTY_TYPE_ATTRIBUTE */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Overview ===&lt;br /&gt;
&lt;br /&gt;
The creature property system is the heart of the rules engine and defines all the numerical values that make up a character in Dragon Age.&lt;br /&gt;
&lt;br /&gt;
=== Detailed Description ===&lt;br /&gt;
&lt;br /&gt;
Properties are 32-bit floating point values associated with every combat capable creature in the game (Creature Type field in the toolset). They are used by engine, scripting and UI to make up and display the RPG ruleset of the game.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Property Types ====&lt;br /&gt;
&lt;br /&gt;
There are 3 types of properties that abstract the most common types of statistics found in an RPG:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== PROPERTY_TYPE_SIMPLE =====&lt;br /&gt;
&lt;br /&gt;
Simple properties are 32 bit floats that can hold a single value and that generally are not modified or influenced by other properties. Examples include Experience, Level or the number of unspent talent points a character has.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== PROPERTY_TYPE_ATTRIBUTE =====&lt;br /&gt;
&lt;br /&gt;
[[Attribute]]s are a moderately complex set of values encapsulating a single character stat. They have three fields that are independently tracked in the engine and are accessible from scripting: &lt;br /&gt;
&lt;br /&gt;
* Base - A character's unmodified base value, usually only modified during level up and character creation. This number is displayed as a white number the character sheet.&lt;br /&gt;
&lt;br /&gt;
* Modifier - A float32 that holds the sum of all effect based modifications to the property. This number is shown as a red (if negative) or green (if positive) number on the character sheet.&lt;br /&gt;
&lt;br /&gt;
* Total - The sum of the base and modifier fields along with any in engine modifications done to the property in C++ (for speed reasons) as defined by the engine link field. When reading this field, the engine will always clamp the return values between Min and Max, even through it stores the full, unmodified number internally.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;margin:0; background:#f5fffa; border:1px solid #a3bfb1; text-align:left; color:#000; padding:0.2em 0.4em; height:100%&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|'''Example:'''&lt;br /&gt;
A level 1 warrior with 15 strength, a buff that grants +2 strength and a shield that has a +1 strength enhancement would be stored as as:&lt;br /&gt;
* Base: 15&lt;br /&gt;
* Modifiers: 3&lt;br /&gt;
* Total 18&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== PROPERTY_TYPE_DEPLETABLE =====&lt;br /&gt;
Depletables represent the most complex type of stats usually found in an RPG, used for Health and Mana. In addition to all fields present on an Attribute, they have an additional 'Current' field. &lt;br /&gt;
&lt;br /&gt;
* Current - This is the character's current value in this stat, which can be between Min and Max and can exceed Total. &lt;br /&gt;
&lt;br /&gt;
Additionally, just like attributes, the EngineLink field defines some hardcoded behavior in the engine such as creating the link between the 'rengeration rate' properties.&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;margin:0; background:#f5fffa; border:1px solid #a3bfb1; text-align:left; color:#000; padding:0.2em 0.4em; height:100%&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|'''Example:'''&lt;br /&gt;
A level 1 warrior with 14 Con and 100 base health and a +5 health ring would store health who was at full health before getting hit for 20 points of damage:&lt;br /&gt;
* Base: 100&lt;br /&gt;
* Modifiers: +5&lt;br /&gt;
* Hidden Engine Modifiers: +20 (5 points for each point in CON after 10). &lt;br /&gt;
* Total: 125&lt;br /&gt;
* Current: 105&lt;br /&gt;
&lt;br /&gt;
Hidden Engine modifiers can not be modified (obviously, they're in C++), but can be disabled by setting the EngineLink field to 0. They exist purely to speed up stats accessed with high frequency (DAScript has a 7-15x overhead per instruction compared to native code).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Property Definitions ====&lt;br /&gt;
&lt;br /&gt;
The two dimensional data array defined in [[Properties.xls]] defines numerical values that exist on every creature in the game. All properties are float32 and all rules logic of the game is based on with floating point math. This dynamic data driven approach to rules relevant stats is new to Dragon Age: Origins and makes the engine extremely flexible for Designers. It enables the game to have a rules logic that is almost completely softcoded in script and data.&lt;br /&gt;
&lt;br /&gt;
The following is an excerpt from the 2da that lists all rows present in the initial ship version of Dragon Age: Origins but only shows the most important columns. Note that DLC or expansion content may be overriding individual lines in the 2da.&lt;br /&gt;
&lt;br /&gt;
{| valign=&amp;quot;top&amp;quot; border=&amp;quot;1&amp;quot; width=&amp;quot;100%&amp;quot;&lt;br /&gt;
|-| &lt;br /&gt;
| '''ID''' || '''Stat''' || '''Type''' || '''Min''' || '''Max''' || '''Comment'''&lt;br /&gt;
|-|&lt;br /&gt;
|  ''int'' || ''string'' || ''string'' || ''float'' || ''float'' || ''comment''&lt;br /&gt;
|-|&lt;br /&gt;
|  0 || INVALID || INVALID || 0 || 0 || &lt;br /&gt;
|-|&lt;br /&gt;
|  1 || Strength || ATTRIBUTE || 0 || 1000 || STR &lt;br /&gt;
|-|&lt;br /&gt;
|  2 || Dexterity || ATTRIBUTE || 0 || 1000 || DEX&lt;br /&gt;
|-|&lt;br /&gt;
|  3 || Willpower || ATTRIBUTE || 0 || 1000 || WIL&lt;br /&gt;
|-|&lt;br /&gt;
|  4 || Magic || ATTRIBUTE || 0 || 1000 || MAG&lt;br /&gt;
|-|&lt;br /&gt;
|  5 || Cunning || ATTRIBUTE || 0 || 1000 || CUN&lt;br /&gt;
|-|&lt;br /&gt;
|  6 || Constitution || ATTRIBUTE || 0 || 1000 || CON&lt;br /&gt;
|-|&lt;br /&gt;
|  7 || Health || DEPLETABLE || 1 || 9999 || Hit Points&lt;br /&gt;
|-|&lt;br /&gt;
|  8 || Mana_Stamina || DEPLETABLE || 0 || 9999 || Mana or Stamina, based on class&lt;br /&gt;
|-|&lt;br /&gt;
|  9 || Attack || ATTRIBUTE || 0 || 1000 || Attack Power&lt;br /&gt;
|-|&lt;br /&gt;
|  10 || Defense || ATTRIBUTE || 0 || 1000 || Defense&lt;br /&gt;
|-|&lt;br /&gt;
|  11 || Armor || ATTRIBUTE || 0 || 1000 || Armor Mitigation Potential&lt;br /&gt;
|-|&lt;br /&gt;
|  12 || DamageScale || ATTRIBUTE || 1 || 10 || Based Damage Scaling (for difficulty settings and ranks)&lt;br /&gt;
|-|&lt;br /&gt;
|  13 || SpellPower || ATTRIBUTE || 0 || 1000 || Spellpower (Max(MAG-10,0)+Effects)&lt;br /&gt;
|-|&lt;br /&gt;
|  14 || Regeneration_Health || ATTRIBUTE || 0 || 50 || Health Regeneration Rate (Explore Mode) per tick.&lt;br /&gt;
|-|&lt;br /&gt;
|  15 || Level || SIMPLE || 0 || 99 || Current Character Level. &lt;br /&gt;
|-|&lt;br /&gt;
|  16 || Displacement || ATTRIBUTE || 0 || 100 ||  Chance to outright evade any physical attach attempt (aka Dodge)&lt;br /&gt;
|-|&lt;br /&gt;
|  17 || Inventory_Size || SIMPLE || 0 || 1000 || Inventory Slot size (on party)&lt;br /&gt;
|-|&lt;br /&gt;
|  18 || AI_BEHAVIOR || SIMPLE || 0 || 1000 || Selected AI Behavior &lt;br /&gt;
|-|&lt;br /&gt;
|  19 || Experience || SIMPLE || 0 || 186001 || Experience Points&lt;br /&gt;
|-|&lt;br /&gt;
|  20 || Flanking_Angle || ATTRIBUTE || 0 || 180 || The angle at which this creature is able to flank an enemy (default is 90)&lt;br /&gt;
|-|&lt;br /&gt;
|  21 || Melee_Crit_Modifier || ATTRIBUTE || -100 || 200 || The +melee crit modifier&lt;br /&gt;
|-|&lt;br /&gt;
|  22 || Missile_Shield || ATTRIBUTE || 0 || 100 || Chance to avoid missiles (shields and some spells increase this)&lt;br /&gt;
|-|&lt;br /&gt;
|  23 || Ranged_Crit_Modifier || ATTRIBUTE || -100 || 200 || The +ranged crit modifier&lt;br /&gt;
|-|&lt;br /&gt;
|  24 || Ranged_Aim_Speed || ATTRIBUTE || -3 || 6 || The character's speed bonus or penality when aiming with ranged weapons&lt;br /&gt;
|-|&lt;br /&gt;
|  25 || BaseAttackRating || SIMPLE || 0 || 1000 || The creature's cached base attack rating&lt;br /&gt;
|-|&lt;br /&gt;
|  26 || BaseDefenseRating || SIMPLE || 0 || 1000 || The creature's cached base defense rating&lt;br /&gt;
|-|&lt;br /&gt;
|  27 || CurrentClass || SIMPLE || 0 || 31 || The creature class (index into cla_base.xls)&lt;br /&gt;
|-|&lt;br /&gt;
|  28 || Regeneration_Health_Combat || ATTRIBUTE || 0 || 20 || The creature's health regeneration rate (per tick) in combat.&lt;br /&gt;
|-|&lt;br /&gt;
|  29 || Regeneration_Stamina || ATTRIBUTE || -20 || 50 || The creature's stamina regeneration rate (per tick) in explore mode.&lt;br /&gt;
|-|&lt;br /&gt;
|  30 || Regeneration_Stamina_Combat || ATTRIBUTE || -20 || 20 || The creature's stamina regeneration rate (per tick) in combat mode.&lt;br /&gt;
|-|&lt;br /&gt;
|  31 || AttackSpeedModifier || ATTRIBUTE || 0 || 1.5 || The creature's universal melee attack speed modifiers (used by haste, momentum, etc.)&lt;br /&gt;
|-|&lt;br /&gt;
|  32 || Resistance_Mind || ATTRIBUTE || -100 || 100 || Mental Resistance.&lt;br /&gt;
|-|&lt;br /&gt;
|  33 || Resistance_Physical || ATTRIBUTE || -100 || 100 || Physical Resistance.&lt;br /&gt;
|-|&lt;br /&gt;
|  34 || Attribute_points || SIMPLE || 0 || 100 || Holds any unspent attribute points the creature has. If this is != 0, the UI shows the levelup button.&lt;br /&gt;
|-|&lt;br /&gt;
|  35 || Skill_points || SIMPLE || 0 || 100 || Holds any unspent skill points the creature has. If this is != 0, the UI shows the levelup button.&lt;br /&gt;
|-|&lt;br /&gt;
|  36 || talent_spell_points || SIMPLE || 0 || 100 ||Holds any unspent talent points the creature has. If this is != 0, the UI shows the levelup button.&lt;br /&gt;
|-|&lt;br /&gt;
|  37 || Background || SIMPLE || 0 || 10 || The character's origin (index into backgrounds.xls).&lt;br /&gt;
|-|&lt;br /&gt;
|  38 || specialization_points || SIMPLE || 0 || 2 || Holds any unspent specialization points the creature has. &lt;br /&gt;
|-|&lt;br /&gt;
|  39 || DamageBonus || ATTRIBUTE || -100 || 100 || Universal physical attack damage bonus on the creature.&lt;br /&gt;
|-|&lt;br /&gt;
|  40 || Threat_Decrease_Rate || SIMPLE || -1000 || 1000 || The rate at which the creature's threat rating decays.&lt;br /&gt;
|-|&lt;br /&gt;
|  41 || Fatique || ATTRIBUTE || -25 || 250 || The creature's current [[Fatigue]] (% increase of ability cost).&lt;br /&gt;
|-|&lt;br /&gt;
|  42 || Damage_Resistance_Fire || ATTRIBUTE || -100 || 75 || The creature's damage resistance to fire. All fire damage is reduce by %.&lt;br /&gt;
|-|&lt;br /&gt;
|  43 || Damage_Resistance_Cold || ATTRIBUTE || -100 || 75 || The creature's damage resistance to cold. All cold damage is reduce by %.&lt;br /&gt;
|-|&lt;br /&gt;
|  44 || Damage_Resistance_Electricity || ATTRIBUTE || -100 || 75 || The creature's damage resistance to lightning. All lightning damage is reduce by %.&lt;br /&gt;
|-|&lt;br /&gt;
|  45 || Damage_Resistance_Nature || ATTRIBUTE || -100 || 75|| The creature's damage resistance to nature. All nature damage is reduce by %.&lt;br /&gt;
|-|&lt;br /&gt;
|  46 || Damage_Resistance_Spirit || ATTRIBUTE || -100 || 75 || The creature's damage resistance to spirit. All spirit damage is reduce by %.&lt;br /&gt;
|-|&lt;br /&gt;
|  47 || Damage_Shield_points || ATTRIBUTE || 0 || 9999 || Magical, damage mitigating shield (all damage types) on the creature. Creature immune to damage until the shield is depleted.&lt;br /&gt;
|-|&lt;br /&gt;
|  48 || Damage_Shield_strength || ATTRIBUTE || 0 || 100 || The maximum amount of damage the creature's magical shields can absorb (not used yet.)&lt;br /&gt;
|-|&lt;br /&gt;
|  49 || Damage_OffHand || ATTRIBUTE || 0 || 9999 || Display only cache of creature's weapon damage potential. This value is only used to marshal data into the UI, it does not have any rules implications.&lt;br /&gt;
|-|&lt;br /&gt;
|  50 || Damage_MainHand || ATTRIBUTE || 0 || 9999  || Display only cache of creature's weapon damage potential. This value is only used to marshal data into the UI, it does not have any rules implications.&lt;br /&gt;
|-|&lt;br /&gt;
|  51 || Healing_Effect_Factor || ATTRIBUTE || 100 || 200 || Percentage modifier of how effective healing is on the creature. Blood magic does NOT use this field, it is coded in effect_heal_h instead.&lt;br /&gt;
|-|&lt;br /&gt;
|  52 || Spell_resistance || ATTRIBUTE || 0 || 100 || Creature 'hostile magic resistance'. % Chance to avoid any hostile magic.&lt;br /&gt;
|-|&lt;br /&gt;
|  53 || AP_BONUS || ATTRIBUTE || -100 || 100 || Armor Penetration bonuses  are stored her.&lt;br /&gt;
|-|&lt;br /&gt;
|  54 || CriticalRange || ATTRIBUTE || 0 || 200 || The 'range' which critical hits use. 150 would mean up to 150% of normal damage.&lt;br /&gt;
|-|&lt;br /&gt;
|  55 || Fire_Damage_Bonus || ATTRIBUTE || 0 || 30 || Percentage bonus to all fire damage dealt by the user (spells, staves, etc.)&lt;br /&gt;
|-|&lt;br /&gt;
|  56 || Spirit_Damage_Bonus || ATTRIBUTE || 0 || 30 || Percentage bonus to all spirit damage dealt by the user (spells, staves, etc.)&lt;br /&gt;
|-|&lt;br /&gt;
|  57 || Cold_Damage_Bonus || ATTRIBUTE || 0 || 30 || Percentage bonus to all cold damage dealt by the user (spells, staves, etc.)&lt;br /&gt;
|-|&lt;br /&gt;
|  58 || Nature_Damage_Bonus || ATTRIBUTE || 0 || 30 || Percentage bonus to all nature damage dealt by the user (spells, staves, etc.)&lt;br /&gt;
|-|&lt;br /&gt;
|  59 || Electricity_Damage_Bonus || ATTRIBUTE || 0 || 30 || Percentage bonus to all lightning damage dealt by the user (spells, staves, etc.)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;margin:0; background:#f5fffa; border:1px solid #a3bfb1; text-align:left; color:#000; padding:0.2em 0.4em; width:100%;  height:100%&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| valign=&amp;quot;top&amp;quot;|&lt;br /&gt;
&amp;lt;h2 style=&amp;quot;margin:0; background:red; font-size:150%; font-weight:bold; border:1px solid #a3bfb1; text-align:left; color:#fff; padding:0.2em 0.4em;&amp;quot;&amp;gt;Words of Caution&amp;lt;/h2&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Properties.xls is the most integral and powerful 2da in the game. Any changes to it have profound implications on the game and the chance of breaking existing savegames and introducing unwanted behavior.&lt;br /&gt;
&lt;br /&gt;
'''Removing Rows'''&lt;br /&gt;
It is referenced from many other rules and UI related 2das and removing existing data can have severe consequences, including the invalidation of existing characters. You can NEVER remove rows from this 2da!&lt;br /&gt;
&lt;br /&gt;
'''Changing Rows'''&lt;br /&gt;
Changing rows is not as dangerous as removing them, but still can have severe implications. The m2da system should be utilized to modify individual rows instead of overwriting the entire 2da. Especially the Min, Max and EngineLink columns hold a lot of rules relevant data that might not be obvious on the first glance (e.g. the Max value on 'Experience' defines the maximum XP the game will allow on a character. Any attempt to award more XP from script will silently fail.)&lt;br /&gt;
&lt;br /&gt;
'''Adding rows''':&lt;br /&gt;
Every row added to this file will reserve several Float32 data fields on every combat capable creature in the game. While a few floats might not sound like a lot, the impact on runtime area memory, savegame size and associated load times can not be overstated. While these issues are more pressing for the console versions of the game, they still do affect the PC version and I strongly advise not to add to this file unless absolutely necessary.&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Q&amp;amp;A ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Q: Why use Floats instead of integers? ===&lt;br /&gt;
&lt;br /&gt;
We had initially investigated a structure that would allow creation of typed properties but found the associated overhead and complexity in such a frequently accessed system to be too high to be worth it.&lt;br /&gt;
&lt;br /&gt;
Since much of our system requires floating point values and floats can be easily rounded for display purposes, we decided to use floating point across the board.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Q: Won't floating point math lead to imprecision? ===&lt;br /&gt;
&lt;br /&gt;
Yes, it can. Certain mathematical operations promote imprecision in floating point values. DA script, like NWScript is only precise for a limited number of digits and any existing imprecision can be magnified by consecutive divisions and other operations.&lt;br /&gt;
&lt;br /&gt;
However, there are mitigating circumstances that make this much less of a problem than it might appear on paper (or fresh from university :)&lt;br /&gt;
&lt;br /&gt;
* Most frequent calculations retrieve an existing floating point value cached in a property, run a bunch of calculations and then execute the result (e.g. calculating damage). The resulting values are rarely stored so imprecision has little opportunity to build up over time.&lt;br /&gt;
&lt;br /&gt;
* When writing to values that are displayed as integers on the UI or used as integers in the combat math, we are casting back to integer before storing or computation (e.g. to avoid health from going into the gray realm between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
* Some engine commands have added security to prevent rounding errors from propagating from script into engine stored values.&lt;br /&gt;
&lt;br /&gt;
* If you happen to do .004 points damage more during an attack, the gameplay impact is virtually zero, so even if imprecision manages to propagate up to the 3rd decimal, it is still not visible in the game.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Q: Is there anything absolutely hardcoded? ===&lt;br /&gt;
&lt;br /&gt;
Yes. While nearly all C++ implemented aspects of the rules system can be turned off by removing the associated EngineLink from properties.xls, a few behaviors are not easy to modify or replace by script:&lt;br /&gt;
&lt;br /&gt;
* Regeneration. While it is technically possible to turn off regeneration by setting all rates to 0, the system can not be modified. One would have to replace it with a scripted, heartbeat like construct to make changes. The reason for this is simple: Regeneration ticks at a high frequency on all combat capable creatures and the cpu time consumed by running this entirely in script is completely unacceptable.&lt;br /&gt;
&lt;br /&gt;
* Some UI rules are currently hardcoded and although it is possible to control some of the UI through various 2das, replacing the entire UI with a new framework is impossible at this point.&lt;/div&gt;</summary>
		<author><name>Georg Zoeller</name></author>	</entry>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=Rules&amp;diff=7339</id>
		<title>Rules</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=Rules&amp;diff=7339"/>
				<updated>2009-10-30T16:51:56Z</updated>
		
		<summary type="html">&lt;p&gt;Georg Zoeller: /* Overview */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Overview ===&lt;br /&gt;
&lt;br /&gt;
The Core Game rules of Dragon Age are implemented mostly in the Scripting Language and Data. This page details the organization of the rules system, design principles, technical implementation details and limitations.&lt;br /&gt;
&lt;br /&gt;
{| width=&amp;quot;100%&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; height=&amp;quot;100%&amp;quot; |&lt;br /&gt;
&amp;lt;!-- GREEN PANEL --&amp;gt;&lt;br /&gt;
{| style=&amp;quot;margin:0; background:#f5fffa; border:1px solid #a3bfb1; text-align:left; color:#000; padding:0.2em 0.4em; width:100%;  height:100%&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| valign=&amp;quot;top&amp;quot;|&lt;br /&gt;
&amp;lt;h2 style=&amp;quot;margin:0; background:#cef2e0; font-size:150%; font-weight:bold; border:1px solid #a3bfb1; text-align:left; color:#000; padding:0.2em 0.4em;&amp;quot;&amp;gt; Categories &amp;lt;/h2&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* [[Creature Properties]] - Attributes, Stats and other numbers that make up a character.&lt;br /&gt;
** [[Attribute]]s - Details about attributes.&lt;br /&gt;
* [[Classes]] - Technical information on the implementation of character classes.&lt;br /&gt;
* [[Combat Rules]] - The rules of conflict resolution. Who hits. When. For how much.&lt;br /&gt;
* [[Ability|Abilities]] - Spells, Skills, Talents and Item Abilities.&lt;br /&gt;
|}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Detailed Description ===&lt;br /&gt;
&lt;br /&gt;
[[Category:Scripts]]&lt;/div&gt;</summary>
		<author><name>Georg Zoeller</name></author>	</entry>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=Rules&amp;diff=7338</id>
		<title>Rules</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=Rules&amp;diff=7338"/>
				<updated>2009-10-30T16:51:28Z</updated>
		
		<summary type="html">&lt;p&gt;Georg Zoeller: /* Overview */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Overview ===&lt;br /&gt;
&lt;br /&gt;
The Core Game rules of Dragon Age are implemented mostly in the Scripting Language and Data. This page details the organization of the rules system, design principles, technical implementation details and limitations.&lt;br /&gt;
&lt;br /&gt;
{| width=&amp;quot;100%&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; height=&amp;quot;100%&amp;quot; |&lt;br /&gt;
&amp;lt;!-- GREEN PANEL --&amp;gt;&lt;br /&gt;
{| style=&amp;quot;margin:0; background:#f5fffa; border:1px solid #a3bfb1; text-align:left; color:#000; padding:0.2em 0.4em; width:100%;  height:100%&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| valign=&amp;quot;top&amp;quot;|&lt;br /&gt;
&amp;lt;h2 style=&amp;quot;margin:0; background:#cef2e0; font-size:150%; font-weight:bold; border:1px solid #a3bfb1; text-align:left; color:#000; padding:0.2em 0.4em;&amp;quot;&amp;gt; Categories &amp;lt;/h2&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* [[Creature Properties]] - Attributes, Stats and other numbers that make up a character.&lt;br /&gt;
** [[Attributes]] - Details about attributes.&lt;br /&gt;
* [[Classes]] - Technical information on the implementation of character classes.&lt;br /&gt;
* [[Combat Rules]] - The rules of conflict resolution. Who hits. When. For how much.&lt;br /&gt;
* [[Ability|Abilities]] - Spells, Skills, Talents and Item Abilities.&lt;br /&gt;
|}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Detailed Description ===&lt;br /&gt;
&lt;br /&gt;
[[Category:Scripts]]&lt;/div&gt;</summary>
		<author><name>Georg Zoeller</name></author>	</entry>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=Talk:Combat_Rules&amp;diff=7337</id>
		<title>Talk:Combat Rules</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=Talk:Combat_Rules&amp;diff=7337"/>
				<updated>2009-10-30T16:43:12Z</updated>
		
		<summary type="html">&lt;p&gt;Georg Zoeller: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Dom&amp;gt; Sunjammer, are you sure we want to wikifi in script function declaration? That'd generate like half a million pages. We should probably stick to file level and make your tool write out an anchor for each function&lt;br /&gt;
: That was our original plan (Byran being a co-conspirator) but I'm happy to look at alternatives if they would be better for the end user.&lt;br /&gt;
:--[[User:Sunjammer|Sunjammer]] 01:16, 28 October 2009 (UTC)&lt;br /&gt;
::Dom&amp;gt; I did some test implementation on the page, we can automate this later.&lt;br /&gt;
:::Looking at the examples I don't see this approach as being particularly beneficial to the end user. They can get whole definition (i.e. function body) in the script editor so all we really want is an abstraction, explanation  and/or notes on usage: reproducing the function body here seems somewhat redundant.  Also this approach prevents us from including the functions in the '''GeSHi''' config file (which automatically links defined functions in snippets wrapped with the '''dascript''' tags). &lt;br /&gt;
:::--[[User:Sunjammer|Sunjammer]] 18:33, 28 October 2009 (UTC)&lt;br /&gt;
::::Dom&amp;gt; I kind of like the ability of people being able to discuss certain parts of the code (which you can't do in the toolset). There's a lot of obscure stuff in there that profoundly affects how combat resolution works out. The other option might be to spin off a seperate wiki like the good old NWN Lexicon...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Georg&amp;gt; Regarding questions of why backstabs get demoted by misdirection hexes while critical hits do not: This is intentional to ensure misdirection hex is effective against high level rogues. Misdirection hex is a very powerful curse and one of the few options an AI mage has of ridding himself of a rogue who got close. The code could be structured to make this clearer, but yes, this is intentional.&lt;/div&gt;</summary>
		<author><name>Georg Zoeller</name></author>	</entry>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=Talk:Combat_Rules&amp;diff=7336</id>
		<title>Talk:Combat Rules</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=Talk:Combat_Rules&amp;diff=7336"/>
				<updated>2009-10-30T16:41:58Z</updated>
		
		<summary type="html">&lt;p&gt;Georg Zoeller: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Dom&amp;gt; Sunjammer, are you sure we want to wikifi in script function declaration? That'd generate like half a million pages. We should probably stick to file level and make your tool write out an anchor for each function&lt;br /&gt;
: That was our original plan (Byran being a co-conspirator) but I'm happy to look at alternatives if they would be better for the end user.&lt;br /&gt;
:--[[User:Sunjammer|Sunjammer]] 01:16, 28 October 2009 (UTC)&lt;br /&gt;
::Dom&amp;gt; I did some test implementation on the page, we can automate this later.&lt;br /&gt;
:::Looking at the examples I don't see this approach as being particularly beneficial to the end user. They can get whole definition (i.e. function body) in the script editor so all we really want is an abstraction, explanation  and/or notes on usage: reproducing the function body here seems somewhat redundant.  Also this approach prevents us from including the functions in the '''GeSHi''' config file (which automatically links defined functions in snippets wrapped with the '''dascript''' tags). &lt;br /&gt;
:::--[[User:Sunjammer|Sunjammer]] 18:33, 28 October 2009 (UTC)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Georg&amp;gt; Regarding questions of why backstabs get demoted by misdirection hexes while critical hits do not: This is intentional to ensure misdirection hex is effective against high level rogues. Misdirection hex is a very powerful curse and one of the few options an AI mage has of ridding himself of a rogue who got close. The code could be structured to make this clearer, but yes, this is intentional.&lt;/div&gt;</summary>
		<author><name>Georg Zoeller</name></author>	</entry>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=Combat_Rules&amp;diff=7305</id>
		<title>Combat Rules</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=Combat_Rules&amp;diff=7305"/>
				<updated>2009-10-28T18:41:32Z</updated>
		
		<summary type="html">&lt;p&gt;Georg Zoeller: /* Critical Hit Damage Modification */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''This page is work in progress'''&lt;br /&gt;
&lt;br /&gt;
=== Overview ===&lt;br /&gt;
&lt;br /&gt;
This page describes the technical implementation and flow of combat logic in the game scripts.&lt;br /&gt;
It deals mostly with weapon based combat, for spells and abilities, please see [[Ability|Abilities]].&lt;br /&gt;
&lt;br /&gt;
Note: The term 'property' used on this page refers to [[Creature Properties]].&lt;br /&gt;
&lt;br /&gt;
=== Detailed Description ===&lt;br /&gt;
&lt;br /&gt;
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'.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Hit Resolution  ====&lt;br /&gt;
&lt;br /&gt;
Hit resolution is implemented in the function [[combat_h.nss#Combat_GetAttackResult|Combat_GetAttackResult]] in the script library [[combat_h.nss]], which is invoked from the [[creature_core.nss]] script whenever an attack event is received. The function returns one of several [[COMBAT_RESULT|COMBAT_RESULT_*]] constants and handles messaging to the game engine which animation to play.&lt;br /&gt;
&lt;br /&gt;
Overall, Dragon Age: Origin's combat system is 'hit heavy' as a targets armor does not modify it's chance of getting hit.&lt;br /&gt;
&lt;br /&gt;
The simplified decision tree for to hit resolution is as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if Target Is Placeable Object&lt;br /&gt;
  return COMBAT_RESULT_HIT&lt;br /&gt;
&lt;br /&gt;
if Target Displacement/Dodge &amp;lt; RandomF(100.0)&lt;br /&gt;
  return COMBAT_RESULT_MISS  &lt;br /&gt;
&lt;br /&gt;
if Attacker Is Using BASE_ITEM_TYPE_STAFF&lt;br /&gt;
  return COMBAT_RESULT_HIT&lt;br /&gt;
&lt;br /&gt;
bHit = RandomF(100.0) &amp;lt; AttackRating - DefenseRating&lt;br /&gt;
bCrit = CheckCricital()&lt;br /&gt;
bBackstab = CheckBackstab()&lt;br /&gt;
&lt;br /&gt;
if bHit&lt;br /&gt;
  if  HasEffect(attacker, EFFECT_TYPE_MISDIRECTION_HEX)&lt;br /&gt;
    if bCrit &lt;br /&gt;
      return COMBAT_RESULT_HIT&lt;br /&gt;
    else&lt;br /&gt;
      return COMBAT_RESULT_MISS&lt;br /&gt;
&lt;br /&gt;
 if bBackstab&lt;br /&gt;
    return COMBAT_RESULT_BACKSTAB&lt;br /&gt;
  else&lt;br /&gt;
     if bCrit&lt;br /&gt;
       return COMBAT_RESULT_CRITICAL_HIT&lt;br /&gt;
     else&lt;br /&gt;
       return  COMBAT_RESULT_HIT&lt;br /&gt;
&lt;br /&gt;
  else&lt;br /&gt;
   return COMBAT_RESULT_MISS&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Attack Rating =====&lt;br /&gt;
&lt;br /&gt;
Attack rating includes:&lt;br /&gt;
&lt;br /&gt;
* Base attack value (54.0f)&lt;br /&gt;
* + [[#Flanking Bonus Determination|Flanking Bonus]] (position based, modified by attacker and enemy talents and effects as well as shields. Rogues have a bonus here).&lt;br /&gt;
* + Distance based penalties (for ranged attacks)&lt;br /&gt;
* + Attacker's attack property value (this includes modifiers from buffs, etc.)&lt;br /&gt;
* + Any +attack item bonuses on the weapon that performs the attack.&lt;br /&gt;
* + Any external bonuses or penalties passed into the function (from talent scripts, etc.)&lt;br /&gt;
* + Difficulty setting based modifications&lt;br /&gt;
&lt;br /&gt;
===== Defense Rating =====&lt;br /&gt;
&lt;br /&gt;
Defense rating includes:&lt;br /&gt;
&lt;br /&gt;
* Defender defense value and (missile deflection if attack was ranged). This includes items, effects and magical bonus.&lt;br /&gt;
* Difficulty setting based modifications&lt;br /&gt;
&lt;br /&gt;
===== Flanking Bonus Determination =====&lt;br /&gt;
&lt;br /&gt;
* Flanking bonus is a floating point value that applies to both AttackRating and to the chance to score a critical hit.&lt;br /&gt;
* It is essentially a representation of close the character is to the best position when attacking the enemy (directly in the back)&lt;br /&gt;
* Various shield abilities on the target reduce or prevent the attacker from getting the bonus.&lt;br /&gt;
* The further away the character is from that position, the more the bonus is diluted.&lt;br /&gt;
* The magnitude of 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.&lt;br /&gt;
* Most characters only flank 60 degrees in each direction, combat movement allows an increase to 90 degrees (the full back 180).&lt;br /&gt;
* Only rogues get the full flanking bonus, everyone else still gets half.&lt;br /&gt;
* The full logic is implemented in the function [[combat_h.nss#Combat_GetFlankingBonus|Combat_GetFlankingBonus]] in [[combat_h.nss]].&lt;br /&gt;
&lt;br /&gt;
===== Backstab Determination =====&lt;br /&gt;
&lt;br /&gt;
* Backstab is determined for each melee attack only.&lt;br /&gt;
* Backstab requires the attacker to have a flanking bonus &amp;gt; 0 (some talents waive this restriction)&lt;br /&gt;
* Only creatures with the Rogue [[Classes|Character Class]] may backstab. This is a class benefit.&lt;br /&gt;
* Only humanoid attackers can backstab (this includes darkspawn)&lt;br /&gt;
* The full logic is implemented in the function [[combat_h.nss#Combat_CheckBackstab|Combat_CheckBackstab]] in [[combat_h.nss]].&lt;br /&gt;
* The damage logic is implemented in [[combat_damage_h.nss#Combat_Damage_GetBackstabDamage|Combat_Damage_GetBackstabDamage]].&lt;br /&gt;
&lt;br /&gt;
===== Critical Hit Determination =====&lt;br /&gt;
&lt;br /&gt;
* Critical Hit Chance uses the attackers Melee or Ranged critical hit modifier based on attack type.&lt;br /&gt;
* + the attacking weapon's critical hit modifier stat.&lt;br /&gt;
* + 1.20x (1.1x for non rogues) the attacker's [[#Flanking Bonus Determination|Flanking Bonus]] in the current situation.&lt;br /&gt;
* + 3.5 for each enemy past the 2nd that is fighting a warriors with the bravery talent.&lt;br /&gt;
* A critical hit occurs when the resulting CriticalHitChance is smaller than RandomFloat()*100.0f.&lt;br /&gt;
* Certain effects and spells (e.g. Death Hex) can always override the result, as will attacking from stealth (always hits critical).&lt;br /&gt;
* The logic is  implemented in the function [[combat_h.nss#Combat_GetAttackResult|Combat_GetAttackResult]] in the script library [[combat_h.nss]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Damage Resolution ====&lt;br /&gt;
&lt;br /&gt;
Damage resolution logic is implemented in the script [[combat_damage_h.nss]].&lt;br /&gt;
&lt;br /&gt;
===== Critical Hit Damage Modification =====&lt;br /&gt;
&lt;br /&gt;
* Critical hits increase the amount of damage done by an attack by a fixed multiplier.&lt;br /&gt;
* The magnitude of the multiplier can be affected by items and effects, but is not affected by of the character's attributes.&lt;br /&gt;
* Historical Note: Critical damage used to be variable 'up to...', but was changed to constant to provide a more predictable flow of damage.&lt;br /&gt;
* The logic for critical damage is implemented in [[combat_damage_h.nss#GetCriticalDamageModifier]].&lt;br /&gt;
&lt;br /&gt;
===== Backstab Damage Modification =====&lt;br /&gt;
&lt;br /&gt;
* Backstab damage is essentially identical to critical damage, but modified by certain rogue talents.&lt;br /&gt;
* The full logic is implemented [[combat_damage_h.nss#Combat_Damage_GetBackstabDamage|Combat_Damage_GetBackstabDamage]] in [[combat_damage_h.nss]].&lt;br /&gt;
&lt;br /&gt;
[[Category: Scripts]]&lt;/div&gt;</summary>
		<author><name>Georg Zoeller</name></author>	</entry>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=Combat_damage_h.nss&amp;diff=7304</id>
		<title>Combat damage h.nss</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=Combat_damage_h.nss&amp;diff=7304"/>
				<updated>2009-10-28T18:38:32Z</updated>
		
		<summary type="html">&lt;p&gt;Georg Zoeller: /* GetCriticalDamageModifier */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Overview ===&lt;br /&gt;
&lt;br /&gt;
combat_damage_h.nss handles the core rule resolution logic for non-spell damage.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Notable Functions ===&lt;br /&gt;
&lt;br /&gt;
==== GetCriticalDamageModifier ====&lt;br /&gt;
&lt;br /&gt;
Returns the multiplier for critical hit damage.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
const float COMBAT_CRITICAL_DAMAGE_MODIFIER = 1.5f; // critical hits increase damage increase.&lt;br /&gt;
&lt;br /&gt;
float GetCriticalDamageModifier(object oAttacker)&lt;br /&gt;
{&lt;br /&gt;
    return COMBAT_CRITICAL_DAMAGE_MODIFIER + (GetCreatureProperty(oAttacker, 54 /*PROPERTY_ATTRIBUTE_CRITICAL_RANGE*/) / 100.0);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Combat_Damage_GetBackstabDamage ====&lt;br /&gt;
&lt;br /&gt;
Determines the backstab damage given attacker and attack damage. (weapon is passed in for future use)&lt;br /&gt;
Note: This function was slightly modified from the toolset version to remove some non-essential elements for clarity.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
float Combat_Damage_GetBackstabDamage(object oAttacker, object oWeapon, float fDamage)&lt;br /&gt;
{&lt;br /&gt;
    //  ------------------------------------------------------------------------&lt;br /&gt;
    // Each backstab is an auto crit.&lt;br /&gt;
    //  ------------------------------------------------------------------------&lt;br /&gt;
    fDamage *= GetCriticalDamageModifier(oAttacker);&lt;br /&gt;
&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    // Exploit Weakness:  Backstab Damage + max(CUN-10,0) / 3.0&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    if (HasAbility(oAttacker,ABILITY_TALENT_EXPLOIT_WEAKNESS))&lt;br /&gt;
    {&lt;br /&gt;
        float fBase = MaxF(0.0,(GetAttributeModifier(oAttacker,PROPERTY_ATTRIBUTE_CUNNING)/3.0)) ;&lt;br /&gt;
        float fMod = MaxF(0.2,RandomFloat());&lt;br /&gt;
        fDamage += (fBase * fMod);&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    return fDamage;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;/div&gt;</summary>
		<author><name>Georg Zoeller</name></author>	</entry>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=Combat_damage_h.nss&amp;diff=7303</id>
		<title>Combat damage h.nss</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=Combat_damage_h.nss&amp;diff=7303"/>
				<updated>2009-10-28T18:37:53Z</updated>
		
		<summary type="html">&lt;p&gt;Georg Zoeller: /* Notable Functions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Overview ===&lt;br /&gt;
&lt;br /&gt;
combat_damage_h.nss handles the core rule resolution logic for non-spell damage.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Notable Functions ===&lt;br /&gt;
&lt;br /&gt;
==== GetCriticalDamageModifier ====&lt;br /&gt;
&lt;br /&gt;
Returns the multiplier for critical hit damage.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
const float COMBAT_CRITICAL_DAMAGE_MODIFIER = 1.5f; // critical hits increase damage by up to this factor.&lt;br /&gt;
&lt;br /&gt;
float GetCriticalDamageModifier(object oAttacker)&lt;br /&gt;
{&lt;br /&gt;
    return COMBAT_CRITICAL_DAMAGE_MODIFIER + (GetCreatureProperty(oAttacker, 54 /*PROPERTY_ATTRIBUTE_CRITICAL_RANGE*/) / 100.0);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Combat_Damage_GetBackstabDamage ====&lt;br /&gt;
&lt;br /&gt;
Determines the backstab damage given attacker and attack damage. (weapon is passed in for future use)&lt;br /&gt;
Note: This function was slightly modified from the toolset version to remove some non-essential elements for clarity.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
float Combat_Damage_GetBackstabDamage(object oAttacker, object oWeapon, float fDamage)&lt;br /&gt;
{&lt;br /&gt;
    //  ------------------------------------------------------------------------&lt;br /&gt;
    // Each backstab is an auto crit.&lt;br /&gt;
    //  ------------------------------------------------------------------------&lt;br /&gt;
    fDamage *= GetCriticalDamageModifier(oAttacker);&lt;br /&gt;
&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    // Exploit Weakness:  Backstab Damage + max(CUN-10,0) / 3.0&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    if (HasAbility(oAttacker,ABILITY_TALENT_EXPLOIT_WEAKNESS))&lt;br /&gt;
    {&lt;br /&gt;
        float fBase = MaxF(0.0,(GetAttributeModifier(oAttacker,PROPERTY_ATTRIBUTE_CUNNING)/3.0)) ;&lt;br /&gt;
        float fMod = MaxF(0.2,RandomFloat());&lt;br /&gt;
        fDamage += (fBase * fMod);&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    return fDamage;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;/div&gt;</summary>
		<author><name>Georg Zoeller</name></author>	</entry>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=Combat_Rules&amp;diff=7301</id>
		<title>Combat Rules</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=Combat_Rules&amp;diff=7301"/>
				<updated>2009-10-28T18:30:57Z</updated>
		
		<summary type="html">&lt;p&gt;Georg Zoeller: /* Damage Resolution */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''This page is work in progress'''&lt;br /&gt;
&lt;br /&gt;
=== Overview ===&lt;br /&gt;
&lt;br /&gt;
This page describes the technical implementation and flow of combat logic in the game scripts.&lt;br /&gt;
It deals mostly with weapon based combat, for spells and abilities, please see [[Ability|Abilities]].&lt;br /&gt;
&lt;br /&gt;
Note: The term 'property' used on this page refers to [[Creature Properties]].&lt;br /&gt;
&lt;br /&gt;
=== Detailed Description ===&lt;br /&gt;
&lt;br /&gt;
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'.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Hit Resolution  ====&lt;br /&gt;
&lt;br /&gt;
Hit resolution is implemented in the function [[combat_h.nss#Combat_GetAttackResult|Combat_GetAttackResult]] in the script library [[combat_h.nss]], which is invoked from the [[creature_core.nss]] script whenever an attack event is received. The function returns one of several [[COMBAT_RESULT|COMBAT_RESULT_*]] constants and handles messaging to the game engine which animation to play.&lt;br /&gt;
&lt;br /&gt;
Overall, Dragon Age: Origin's combat system is 'hit heavy' as a targets armor does not modify it's chance of getting hit.&lt;br /&gt;
&lt;br /&gt;
The simplified decision tree for to hit resolution is as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if Target Is Placeable Object&lt;br /&gt;
  return COMBAT_RESULT_HIT&lt;br /&gt;
&lt;br /&gt;
if Target Displacement/Dodge &amp;lt; RandomF(100.0)&lt;br /&gt;
  return COMBAT_RESULT_MISS  &lt;br /&gt;
&lt;br /&gt;
if Attacker Is Using BASE_ITEM_TYPE_STAFF&lt;br /&gt;
  return COMBAT_RESULT_HIT&lt;br /&gt;
&lt;br /&gt;
bHit = RandomF(100.0) &amp;lt; AttackRating - DefenseRating&lt;br /&gt;
bCrit = CheckCricital()&lt;br /&gt;
bBackstab = CheckBackstab()&lt;br /&gt;
&lt;br /&gt;
if bHit&lt;br /&gt;
  if  HasEffect(attacker, EFFECT_TYPE_MISDIRECTION_HEX)&lt;br /&gt;
    if bCrit &lt;br /&gt;
      return COMBAT_RESULT_HIT&lt;br /&gt;
    else&lt;br /&gt;
      return COMBAT_RESULT_MISS&lt;br /&gt;
&lt;br /&gt;
 if bBackstab&lt;br /&gt;
    return COMBAT_RESULT_BACKSTAB&lt;br /&gt;
  else&lt;br /&gt;
     if bCrit&lt;br /&gt;
       return COMBAT_RESULT_CRITICAL_HIT&lt;br /&gt;
     else&lt;br /&gt;
       return  COMBAT_RESULT_HIT&lt;br /&gt;
&lt;br /&gt;
  else&lt;br /&gt;
   return COMBAT_RESULT_MISS&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Attack Rating =====&lt;br /&gt;
&lt;br /&gt;
Attack rating includes:&lt;br /&gt;
&lt;br /&gt;
* Base attack value (54.0f)&lt;br /&gt;
* + [[#Flanking Bonus Determination|Flanking Bonus]] (position based, modified by attacker and enemy talents and effects as well as shields. Rogues have a bonus here).&lt;br /&gt;
* + Distance based penalties (for ranged attacks)&lt;br /&gt;
* + Attacker's attack property value (this includes modifiers from buffs, etc.)&lt;br /&gt;
* + Any +attack item bonuses on the weapon that performs the attack.&lt;br /&gt;
* + Any external bonuses or penalties passed into the function (from talent scripts, etc.)&lt;br /&gt;
* + Difficulty setting based modifications&lt;br /&gt;
&lt;br /&gt;
===== Defense Rating =====&lt;br /&gt;
&lt;br /&gt;
Defense rating includes:&lt;br /&gt;
&lt;br /&gt;
* Defender defense value and (missile deflection if attack was ranged). This includes items, effects and magical bonus.&lt;br /&gt;
* Difficulty setting based modifications&lt;br /&gt;
&lt;br /&gt;
===== Flanking Bonus Determination =====&lt;br /&gt;
&lt;br /&gt;
* Flanking bonus is a floating point value that applies to both AttackRating and to the chance to score a critical hit.&lt;br /&gt;
* It is essentially a representation of close the character is to the best position when attacking the enemy (directly in the back)&lt;br /&gt;
* Various shield abilities on the target reduce or prevent the attacker from getting the bonus.&lt;br /&gt;
* The further away the character is from that position, the more the bonus is diluted.&lt;br /&gt;
* The magnitude of 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.&lt;br /&gt;
* Most characters only flank 60 degrees in each direction, combat movement allows an increase to 90 degrees (the full back 180).&lt;br /&gt;
* Only rogues get the full flanking bonus, everyone else still gets half.&lt;br /&gt;
* The full logic is implemented in the function [[combat_h.nss#Combat_GetFlankingBonus|Combat_GetFlankingBonus]] in [[combat_h.nss]].&lt;br /&gt;
&lt;br /&gt;
===== Backstab Determination =====&lt;br /&gt;
&lt;br /&gt;
* Backstab is determined for each melee attack only.&lt;br /&gt;
* Backstab requires the attacker to have a flanking bonus &amp;gt; 0 (some talents waive this restriction)&lt;br /&gt;
* Only creatures with the Rogue [[Classes|Character Class]] may backstab. This is a class benefit.&lt;br /&gt;
* Only humanoid attackers can backstab (this includes darkspawn)&lt;br /&gt;
* The full logic is implemented in the function [[combat_h.nss#Combat_CheckBackstab|Combat_CheckBackstab]] in [[combat_h.nss]].&lt;br /&gt;
* The damage logic is implemented in [[combat_damage_h.nss#Combat_Damage_GetBackstabDamage|Combat_Damage_GetBackstabDamage]].&lt;br /&gt;
&lt;br /&gt;
===== Critical Hit Determination =====&lt;br /&gt;
&lt;br /&gt;
* Critical Hit Chance uses the attackers Melee or Ranged critical hit modifier based on attack type.&lt;br /&gt;
* + the attacking weapon's critical hit modifier stat.&lt;br /&gt;
* + 1.20x (1.1x for non rogues) the attacker's [[#Flanking Bonus Determination|Flanking Bonus]] in the current situation.&lt;br /&gt;
* + 3.5 for each enemy past the 2nd that is fighting a warriors with the bravery talent.&lt;br /&gt;
* A critical hit occurs when the resulting CriticalHitChance is smaller than RandomFloat()*100.0f.&lt;br /&gt;
* Certain effects and spells (e.g. Death Hex) can always override the result, as will attacking from stealth (always hits critical).&lt;br /&gt;
* The logic is  implemented in the function [[combat_h.nss#Combat_GetAttackResult|Combat_GetAttackResult]] in the script library [[combat_h.nss]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Damage Resolution ====&lt;br /&gt;
&lt;br /&gt;
Damage resolution logic is implemented in the script [[combat_damage_h.nss]].&lt;br /&gt;
&lt;br /&gt;
===== Critical Hit Damage Modification =====&lt;br /&gt;
&lt;br /&gt;
* Critical hits increase the amount of damage done by an attack by a fixed multiplier.&lt;br /&gt;
* The magnitude of the multiplier can be affected by items and effects, but is not affected by stats.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== Backstab Damage Modification =====&lt;br /&gt;
&lt;br /&gt;
* Backstab damage is essentially identical to critical damage, but modified by certain rogue talents.&lt;br /&gt;
* The full logic is implemented [[combat_damage_h.nss#Combat_Damage_GetBackstabDamage|Combat_Damage_GetBackstabDamage]] in [[combat_damage_h.nss]].&lt;br /&gt;
&lt;br /&gt;
[[Category: Scripts]]&lt;/div&gt;</summary>
		<author><name>Georg Zoeller</name></author>	</entry>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=Combat_Rules&amp;diff=7300</id>
		<title>Combat Rules</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=Combat_Rules&amp;diff=7300"/>
				<updated>2009-10-28T18:22:44Z</updated>
		
		<summary type="html">&lt;p&gt;Georg Zoeller: /* Damage Resolution */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''This page is work in progress'''&lt;br /&gt;
&lt;br /&gt;
=== Overview ===&lt;br /&gt;
&lt;br /&gt;
This page describes the technical implementation and flow of combat logic in the game scripts.&lt;br /&gt;
It deals mostly with weapon based combat, for spells and abilities, please see [[Ability|Abilities]].&lt;br /&gt;
&lt;br /&gt;
Note: The term 'property' used on this page refers to [[Creature Properties]].&lt;br /&gt;
&lt;br /&gt;
=== Detailed Description ===&lt;br /&gt;
&lt;br /&gt;
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'.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Hit Resolution  ====&lt;br /&gt;
&lt;br /&gt;
Hit resolution is implemented in the function [[combat_h.nss#Combat_GetAttackResult|Combat_GetAttackResult]] in the script library [[combat_h.nss]], which is invoked from the [[creature_core.nss]] script whenever an attack event is received. The function returns one of several [[COMBAT_RESULT|COMBAT_RESULT_*]] constants and handles messaging to the game engine which animation to play.&lt;br /&gt;
&lt;br /&gt;
Overall, Dragon Age: Origin's combat system is 'hit heavy' as a targets armor does not modify it's chance of getting hit.&lt;br /&gt;
&lt;br /&gt;
The simplified decision tree for to hit resolution is as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if Target Is Placeable Object&lt;br /&gt;
  return COMBAT_RESULT_HIT&lt;br /&gt;
&lt;br /&gt;
if Target Displacement/Dodge &amp;lt; RandomF(100.0)&lt;br /&gt;
  return COMBAT_RESULT_MISS  &lt;br /&gt;
&lt;br /&gt;
if Attacker Is Using BASE_ITEM_TYPE_STAFF&lt;br /&gt;
  return COMBAT_RESULT_HIT&lt;br /&gt;
&lt;br /&gt;
bHit = RandomF(100.0) &amp;lt; AttackRating - DefenseRating&lt;br /&gt;
bCrit = CheckCricital()&lt;br /&gt;
bBackstab = CheckBackstab()&lt;br /&gt;
&lt;br /&gt;
if bHit&lt;br /&gt;
  if  HasEffect(attacker, EFFECT_TYPE_MISDIRECTION_HEX)&lt;br /&gt;
    if bCrit &lt;br /&gt;
      return COMBAT_RESULT_HIT&lt;br /&gt;
    else&lt;br /&gt;
      return COMBAT_RESULT_MISS&lt;br /&gt;
&lt;br /&gt;
 if bBackstab&lt;br /&gt;
    return COMBAT_RESULT_BACKSTAB&lt;br /&gt;
  else&lt;br /&gt;
     if bCrit&lt;br /&gt;
       return COMBAT_RESULT_CRITICAL_HIT&lt;br /&gt;
     else&lt;br /&gt;
       return  COMBAT_RESULT_HIT&lt;br /&gt;
&lt;br /&gt;
  else&lt;br /&gt;
   return COMBAT_RESULT_MISS&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Attack Rating =====&lt;br /&gt;
&lt;br /&gt;
Attack rating includes:&lt;br /&gt;
&lt;br /&gt;
* Base attack value (54.0f)&lt;br /&gt;
* + [[#Flanking Bonus Determination|Flanking Bonus]] (position based, modified by attacker and enemy talents and effects as well as shields. Rogues have a bonus here).&lt;br /&gt;
* + Distance based penalties (for ranged attacks)&lt;br /&gt;
* + Attacker's attack property value (this includes modifiers from buffs, etc.)&lt;br /&gt;
* + Any +attack item bonuses on the weapon that performs the attack.&lt;br /&gt;
* + Any external bonuses or penalties passed into the function (from talent scripts, etc.)&lt;br /&gt;
* + Difficulty setting based modifications&lt;br /&gt;
&lt;br /&gt;
===== Defense Rating =====&lt;br /&gt;
&lt;br /&gt;
Defense rating includes:&lt;br /&gt;
&lt;br /&gt;
* Defender defense value and (missile deflection if attack was ranged). This includes items, effects and magical bonus.&lt;br /&gt;
* Difficulty setting based modifications&lt;br /&gt;
&lt;br /&gt;
===== Flanking Bonus Determination =====&lt;br /&gt;
&lt;br /&gt;
* Flanking bonus is a floating point value that applies to both AttackRating and to the chance to score a critical hit.&lt;br /&gt;
* It is essentially a representation of close the character is to the best position when attacking the enemy (directly in the back)&lt;br /&gt;
* Various shield abilities on the target reduce or prevent the attacker from getting the bonus.&lt;br /&gt;
* The further away the character is from that position, the more the bonus is diluted.&lt;br /&gt;
* The magnitude of 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.&lt;br /&gt;
* Most characters only flank 60 degrees in each direction, combat movement allows an increase to 90 degrees (the full back 180).&lt;br /&gt;
* Only rogues get the full flanking bonus, everyone else still gets half.&lt;br /&gt;
* The full logic is implemented in the function [[combat_h.nss#Combat_GetFlankingBonus|Combat_GetFlankingBonus]] in [[combat_h.nss]].&lt;br /&gt;
&lt;br /&gt;
===== Backstab Determination =====&lt;br /&gt;
&lt;br /&gt;
* Backstab is determined for each melee attack only.&lt;br /&gt;
* Backstab requires the attacker to have a flanking bonus &amp;gt; 0 (some talents waive this restriction)&lt;br /&gt;
* Only creatures with the Rogue [[Classes|Character Class]] may backstab. This is a class benefit.&lt;br /&gt;
* Only humanoid attackers can backstab (this includes darkspawn)&lt;br /&gt;
* The full logic is implemented in the function [[combat_h.nss#Combat_CheckBackstab|Combat_CheckBackstab]] in [[combat_h.nss]].&lt;br /&gt;
* The damage logic is implemented in [[combat_damage_h.nss#Combat_Damage_GetBackstabDamage|Combat_Damage_GetBackstabDamage]].&lt;br /&gt;
&lt;br /&gt;
===== Critical Hit Determination =====&lt;br /&gt;
&lt;br /&gt;
* Critical Hit Chance uses the attackers Melee or Ranged critical hit modifier based on attack type.&lt;br /&gt;
* + the attacking weapon's critical hit modifier stat.&lt;br /&gt;
* + 1.20x (1.1x for non rogues) the attacker's [[#Flanking Bonus Determination|Flanking Bonus]] in the current situation.&lt;br /&gt;
* + 3.5 for each enemy past the 2nd that is fighting a warriors with the bravery talent.&lt;br /&gt;
* A critical hit occurs when the resulting CriticalHitChance is smaller than RandomFloat()*100.0f.&lt;br /&gt;
* Certain effects and spells (e.g. Death Hex) can always override the result, as will attacking from stealth (always hits critical).&lt;br /&gt;
* The logic is  implemented in the function [[combat_h.nss#Combat_GetAttackResult|Combat_GetAttackResult]] in the script library [[combat_h.nss]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Damage Resolution ====&lt;br /&gt;
&lt;br /&gt;
Damage resolution logic is implemented in the script [[combat_damage_h.nss]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== Backstab Damage Modifications =====&lt;br /&gt;
&lt;br /&gt;
* Backstab damage is essentially identical to critical damage, but modified by certain rogue talents.&lt;br /&gt;
* The full logic is implemented [[combat_damage_h.nss#Combat_Damage_GetBackstabDamage|Combat_Damage_GetBackstabDamage]] in [[combat_damage_h.nss]].&lt;br /&gt;
&lt;br /&gt;
[[Category: Scripts]]&lt;/div&gt;</summary>
		<author><name>Georg Zoeller</name></author>	</entry>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=Combat_Rules&amp;diff=7298</id>
		<title>Combat Rules</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=Combat_Rules&amp;diff=7298"/>
				<updated>2009-10-28T18:19:54Z</updated>
		
		<summary type="html">&lt;p&gt;Georg Zoeller: /* Backstab Determination */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''This page is work in progress'''&lt;br /&gt;
&lt;br /&gt;
=== Overview ===&lt;br /&gt;
&lt;br /&gt;
This page describes the technical implementation and flow of combat logic in the game scripts.&lt;br /&gt;
It deals mostly with weapon based combat, for spells and abilities, please see [[Ability|Abilities]].&lt;br /&gt;
&lt;br /&gt;
Note: The term 'property' used on this page refers to [[Creature Properties]].&lt;br /&gt;
&lt;br /&gt;
=== Detailed Description ===&lt;br /&gt;
&lt;br /&gt;
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'.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Hit Resolution  ====&lt;br /&gt;
&lt;br /&gt;
Hit resolution is implemented in the function [[combat_h.nss#Combat_GetAttackResult|Combat_GetAttackResult]] in the script library [[combat_h.nss]], which is invoked from the [[creature_core.nss]] script whenever an attack event is received. The function returns one of several [[COMBAT_RESULT|COMBAT_RESULT_*]] constants and handles messaging to the game engine which animation to play.&lt;br /&gt;
&lt;br /&gt;
Overall, Dragon Age: Origin's combat system is 'hit heavy' as a targets armor does not modify it's chance of getting hit.&lt;br /&gt;
&lt;br /&gt;
The simplified decision tree for to hit resolution is as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if Target Is Placeable Object&lt;br /&gt;
  return COMBAT_RESULT_HIT&lt;br /&gt;
&lt;br /&gt;
if Target Displacement/Dodge &amp;lt; RandomF(100.0)&lt;br /&gt;
  return COMBAT_RESULT_MISS  &lt;br /&gt;
&lt;br /&gt;
if Attacker Is Using BASE_ITEM_TYPE_STAFF&lt;br /&gt;
  return COMBAT_RESULT_HIT&lt;br /&gt;
&lt;br /&gt;
bHit = RandomF(100.0) &amp;lt; AttackRating - DefenseRating&lt;br /&gt;
bCrit = CheckCricital()&lt;br /&gt;
bBackstab = CheckBackstab()&lt;br /&gt;
&lt;br /&gt;
if bHit&lt;br /&gt;
  if  HasEffect(attacker, EFFECT_TYPE_MISDIRECTION_HEX)&lt;br /&gt;
    if bCrit &lt;br /&gt;
      return COMBAT_RESULT_HIT&lt;br /&gt;
    else&lt;br /&gt;
      return COMBAT_RESULT_MISS&lt;br /&gt;
&lt;br /&gt;
 if bBackstab&lt;br /&gt;
    return COMBAT_RESULT_BACKSTAB&lt;br /&gt;
  else&lt;br /&gt;
     if bCrit&lt;br /&gt;
       return COMBAT_RESULT_CRITICAL_HIT&lt;br /&gt;
     else&lt;br /&gt;
       return  COMBAT_RESULT_HIT&lt;br /&gt;
&lt;br /&gt;
  else&lt;br /&gt;
   return COMBAT_RESULT_MISS&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Attack Rating =====&lt;br /&gt;
&lt;br /&gt;
Attack rating includes:&lt;br /&gt;
&lt;br /&gt;
* Base attack value (54.0f)&lt;br /&gt;
* + [[#Flanking Bonus Determination|Flanking Bonus]] (position based, modified by attacker and enemy talents and effects as well as shields. Rogues have a bonus here).&lt;br /&gt;
* + Distance based penalties (for ranged attacks)&lt;br /&gt;
* + Attacker's attack property value (this includes modifiers from buffs, etc.)&lt;br /&gt;
* + Any +attack item bonuses on the weapon that performs the attack.&lt;br /&gt;
* + Any external bonuses or penalties passed into the function (from talent scripts, etc.)&lt;br /&gt;
* + Difficulty setting based modifications&lt;br /&gt;
&lt;br /&gt;
===== Defense Rating =====&lt;br /&gt;
&lt;br /&gt;
Defense rating includes:&lt;br /&gt;
&lt;br /&gt;
* Defender defense value and (missile deflection if attack was ranged). This includes items, effects and magical bonus.&lt;br /&gt;
* Difficulty setting based modifications&lt;br /&gt;
&lt;br /&gt;
===== Flanking Bonus Determination =====&lt;br /&gt;
&lt;br /&gt;
* Flanking bonus is a floating point value that applies to both AttackRating and to the chance to score a critical hit.&lt;br /&gt;
* It is essentially a representation of close the character is to the best position when attacking the enemy (directly in the back)&lt;br /&gt;
* Various shield abilities on the target reduce or prevent the attacker from getting the bonus.&lt;br /&gt;
* The further away the character is from that position, the more the bonus is diluted.&lt;br /&gt;
* The magnitude of 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.&lt;br /&gt;
* Most characters only flank 60 degrees in each direction, combat movement allows an increase to 90 degrees (the full back 180).&lt;br /&gt;
* Only rogues get the full flanking bonus, everyone else still gets half.&lt;br /&gt;
* The full logic is implemented in the function [[combat_h.nss#Combat_GetFlankingBonus|Combat_GetFlankingBonus]] in [[combat_h.nss]].&lt;br /&gt;
&lt;br /&gt;
===== Backstab Determination =====&lt;br /&gt;
&lt;br /&gt;
* Backstab is determined for each melee attack only.&lt;br /&gt;
* Backstab requires the attacker to have a flanking bonus &amp;gt; 0 (some talents waive this restriction)&lt;br /&gt;
* Only creatures with the Rogue [[Classes|Character Class]] may backstab. This is a class benefit.&lt;br /&gt;
* Only humanoid attackers can backstab (this includes darkspawn)&lt;br /&gt;
* The full logic is implemented in the function [[combat_h.nss#Combat_CheckBackstab|Combat_CheckBackstab]] in [[combat_h.nss]].&lt;br /&gt;
* The damage logic is implemented in [[combat_damage_h.nss#Combat_Damage_GetBackstabDamage|Combat_Damage_GetBackstabDamage]].&lt;br /&gt;
&lt;br /&gt;
===== Critical Hit Determination =====&lt;br /&gt;
&lt;br /&gt;
* Critical Hit Chance uses the attackers Melee or Ranged critical hit modifier based on attack type.&lt;br /&gt;
* + the attacking weapon's critical hit modifier stat.&lt;br /&gt;
* + 1.20x (1.1x for non rogues) the attacker's [[#Flanking Bonus Determination|Flanking Bonus]] in the current situation.&lt;br /&gt;
* + 3.5 for each enemy past the 2nd that is fighting a warriors with the bravery talent.&lt;br /&gt;
* A critical hit occurs when the resulting CriticalHitChance is smaller than RandomFloat()*100.0f.&lt;br /&gt;
* Certain effects and spells (e.g. Death Hex) can always override the result, as will attacking from stealth (always hits critical).&lt;br /&gt;
* The logic is  implemented in the function [[combat_h.nss#Combat_GetAttackResult|Combat_GetAttackResult]] in the script library [[combat_h.nss]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Damage Resolution ====&lt;br /&gt;
&lt;br /&gt;
Damage resolution logic is implemented in the script [[combat_damage_h.nss]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Scripts]]&lt;/div&gt;</summary>
		<author><name>Georg Zoeller</name></author>	</entry>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=Combat_damage_h.nss&amp;diff=7297</id>
		<title>Combat damage h.nss</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=Combat_damage_h.nss&amp;diff=7297"/>
				<updated>2009-10-28T18:19:14Z</updated>
		
		<summary type="html">&lt;p&gt;Georg Zoeller: /* Combat_Damage_GetBackstabDamage */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Overview ===&lt;br /&gt;
&lt;br /&gt;
combat_damage_h.nss handles the core rule resolution logic for non-spell damage.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Notable Functions ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Combat_Damage_GetBackstabDamage ====&lt;br /&gt;
&lt;br /&gt;
Determines the backstab damage given attacker, weapon and attack damage.&lt;br /&gt;
Note: This function was slightly modified from the toolset version to remove some non-essential elements for clarity.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
float Combat_Damage_GetBackstabDamage(object oAttacker, object oWeapon, float fDamage)&lt;br /&gt;
{&lt;br /&gt;
    //  ------------------------------------------------------------------------&lt;br /&gt;
    // Each backstab is an auto crit.&lt;br /&gt;
    //  ------------------------------------------------------------------------&lt;br /&gt;
    fDamage *= GetCriticalDamageModifier(oAttacker);&lt;br /&gt;
&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    // Exploit Weakness:  Backstab Damage + max(CUN-10,0) / 3.0&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    if (HasAbility(oAttacker,ABILITY_TALENT_EXPLOIT_WEAKNESS))&lt;br /&gt;
    {&lt;br /&gt;
        float fBase = MaxF(0.0,(GetAttributeModifier(oAttacker,PROPERTY_ATTRIBUTE_CUNNING)/3.0)) ;&lt;br /&gt;
        float fMod = MaxF(0.2,RandomFloat());&lt;br /&gt;
        fDamage += (fBase * fMod);&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    return fDamage;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;/div&gt;</summary>
		<author><name>Georg Zoeller</name></author>	</entry>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=Combat_damage_h.nss&amp;diff=7296</id>
		<title>Combat damage h.nss</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=Combat_damage_h.nss&amp;diff=7296"/>
				<updated>2009-10-28T18:18:40Z</updated>
		
		<summary type="html">&lt;p&gt;Georg Zoeller: Created page with '=== Overview ===  combat_damage_h.nss handles the core rule resolution logic for non-spell damage.   === Notable Functions ===   ==== Combat_Damage_GetBackstabDamage ====  Determ...'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Overview ===&lt;br /&gt;
&lt;br /&gt;
combat_damage_h.nss handles the core rule resolution logic for non-spell damage.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Notable Functions ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Combat_Damage_GetBackstabDamage ====&lt;br /&gt;
&lt;br /&gt;
Determines the backstab damage given attacker, weapon and attack damage.&lt;br /&gt;
Note: This function was slightly modified from the toolset version to remove some non-essential elements for clarity.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
float Combat_Damage_GetBackstabDamage(object oAttacker, object oWeapon, float fDamage)&lt;br /&gt;
{&lt;br /&gt;
    //  ------------------------------------------------------------------------&lt;br /&gt;
    // Each backstab is an auto crit.&lt;br /&gt;
    //  ------------------------------------------------------------------------&lt;br /&gt;
    fDamage *= GetCriticalDamageModifier(oAttacker);&lt;br /&gt;
&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    // Exploit Weakness:  Backstab Damage = max(CUN-10,0) / 3.0&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    if (HasAbility(oAttacker,ABILITY_TALENT_EXPLOIT_WEAKNESS))&lt;br /&gt;
    {&lt;br /&gt;
        float fBase = MaxF(0.0,(GetAttributeModifier(oAttacker,PROPERTY_ATTRIBUTE_CUNNING)/3.0)) ;&lt;br /&gt;
        float fMod = MaxF(0.2,RandomFloat());&lt;br /&gt;
        fDamage += (fBase * fMod);&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    return fDamage;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;/div&gt;</summary>
		<author><name>Georg Zoeller</name></author>	</entry>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=Combat_Rules&amp;diff=7294</id>
		<title>Combat Rules</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=Combat_Rules&amp;diff=7294"/>
				<updated>2009-10-28T18:14:11Z</updated>
		
		<summary type="html">&lt;p&gt;Georg Zoeller: /* Damage Resolution */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''This page is work in progress'''&lt;br /&gt;
&lt;br /&gt;
=== Overview ===&lt;br /&gt;
&lt;br /&gt;
This page describes the technical implementation and flow of combat logic in the game scripts.&lt;br /&gt;
It deals mostly with weapon based combat, for spells and abilities, please see [[Ability|Abilities]].&lt;br /&gt;
&lt;br /&gt;
Note: The term 'property' used on this page refers to [[Creature Properties]].&lt;br /&gt;
&lt;br /&gt;
=== Detailed Description ===&lt;br /&gt;
&lt;br /&gt;
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'.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Hit Resolution  ====&lt;br /&gt;
&lt;br /&gt;
Hit resolution is implemented in the function [[combat_h.nss#Combat_GetAttackResult|Combat_GetAttackResult]] in the script library [[combat_h.nss]], which is invoked from the [[creature_core.nss]] script whenever an attack event is received. The function returns one of several [[COMBAT_RESULT|COMBAT_RESULT_*]] constants and handles messaging to the game engine which animation to play.&lt;br /&gt;
&lt;br /&gt;
Overall, Dragon Age: Origin's combat system is 'hit heavy' as a targets armor does not modify it's chance of getting hit.&lt;br /&gt;
&lt;br /&gt;
The simplified decision tree for to hit resolution is as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if Target Is Placeable Object&lt;br /&gt;
  return COMBAT_RESULT_HIT&lt;br /&gt;
&lt;br /&gt;
if Target Displacement/Dodge &amp;lt; RandomF(100.0)&lt;br /&gt;
  return COMBAT_RESULT_MISS  &lt;br /&gt;
&lt;br /&gt;
if Attacker Is Using BASE_ITEM_TYPE_STAFF&lt;br /&gt;
  return COMBAT_RESULT_HIT&lt;br /&gt;
&lt;br /&gt;
bHit = RandomF(100.0) &amp;lt; AttackRating - DefenseRating&lt;br /&gt;
bCrit = CheckCricital()&lt;br /&gt;
bBackstab = CheckBackstab()&lt;br /&gt;
&lt;br /&gt;
if bHit&lt;br /&gt;
  if  HasEffect(attacker, EFFECT_TYPE_MISDIRECTION_HEX)&lt;br /&gt;
    if bCrit &lt;br /&gt;
      return COMBAT_RESULT_HIT&lt;br /&gt;
    else&lt;br /&gt;
      return COMBAT_RESULT_MISS&lt;br /&gt;
&lt;br /&gt;
 if bBackstab&lt;br /&gt;
    return COMBAT_RESULT_BACKSTAB&lt;br /&gt;
  else&lt;br /&gt;
     if bCrit&lt;br /&gt;
       return COMBAT_RESULT_CRITICAL_HIT&lt;br /&gt;
     else&lt;br /&gt;
       return  COMBAT_RESULT_HIT&lt;br /&gt;
&lt;br /&gt;
  else&lt;br /&gt;
   return COMBAT_RESULT_MISS&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Attack Rating =====&lt;br /&gt;
&lt;br /&gt;
Attack rating includes:&lt;br /&gt;
&lt;br /&gt;
* Base attack value (54.0f)&lt;br /&gt;
* + [[#Flanking Bonus Determination|Flanking Bonus]] (position based, modified by attacker and enemy talents and effects as well as shields. Rogues have a bonus here).&lt;br /&gt;
* + Distance based penalties (for ranged attacks)&lt;br /&gt;
* + Attacker's attack property value (this includes modifiers from buffs, etc.)&lt;br /&gt;
* + Any +attack item bonuses on the weapon that performs the attack.&lt;br /&gt;
* + Any external bonuses or penalties passed into the function (from talent scripts, etc.)&lt;br /&gt;
* + Difficulty setting based modifications&lt;br /&gt;
&lt;br /&gt;
===== Defense Rating =====&lt;br /&gt;
&lt;br /&gt;
Defense rating includes:&lt;br /&gt;
&lt;br /&gt;
* Defender defense value and (missile deflection if attack was ranged). This includes items, effects and magical bonus.&lt;br /&gt;
* Difficulty setting based modifications&lt;br /&gt;
&lt;br /&gt;
===== Flanking Bonus Determination =====&lt;br /&gt;
&lt;br /&gt;
* Flanking bonus is a floating point value that applies to both AttackRating and to the chance to score a critical hit.&lt;br /&gt;
* It is essentially a representation of close the character is to the best position when attacking the enemy (directly in the back)&lt;br /&gt;
* Various shield abilities on the target reduce or prevent the attacker from getting the bonus.&lt;br /&gt;
* The further away the character is from that position, the more the bonus is diluted.&lt;br /&gt;
* The magnitude of 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.&lt;br /&gt;
* Most characters only flank 60 degrees in each direction, combat movement allows an increase to 90 degrees (the full back 180).&lt;br /&gt;
* Only rogues get the full flanking bonus, everyone else still gets half.&lt;br /&gt;
* The full logic is implemented in the function [[combat_h.nss#Combat_GetFlankingBonus|Combat_GetFlankingBonus]] in [[combat_h.nss]].&lt;br /&gt;
&lt;br /&gt;
===== Backstab Determination =====&lt;br /&gt;
&lt;br /&gt;
* Backstab is determined for each melee attack only.&lt;br /&gt;
* Backstab requires the attacker to have a flanking bonus &amp;gt; 0 (some talents waive this restriction)&lt;br /&gt;
* Only creatures with the Rogue [[Classes|Character Class]] may backstab. This is a class benefit.&lt;br /&gt;
* Only humanoid attackers can backstab (this includes darkspawn)&lt;br /&gt;
* The full logic is implemented in the function [[combat_h.nss#Combat_CheckBackstab|Combat_CheckBackstab]] in [[combat_h.nss]].&lt;br /&gt;
&lt;br /&gt;
===== Critical Hit Determination =====&lt;br /&gt;
&lt;br /&gt;
* Critical Hit Chance uses the attackers Melee or Ranged critical hit modifier based on attack type.&lt;br /&gt;
* + the attacking weapon's critical hit modifier stat.&lt;br /&gt;
* + 1.20x (1.1x for non rogues) the attacker's [[#Flanking Bonus Determination|Flanking Bonus]] in the current situation.&lt;br /&gt;
* + 3.5 for each enemy past the 2nd that is fighting a warriors with the bravery talent.&lt;br /&gt;
* A critical hit occurs when the resulting CriticalHitChance is smaller than RandomFloat()*100.0f.&lt;br /&gt;
* Certain effects and spells (e.g. Death Hex) can always override the result, as will attacking from stealth (always hits critical).&lt;br /&gt;
* The logic is  implemented in the function [[combat_h.nss#Combat_GetAttackResult|Combat_GetAttackResult]] in the script library [[combat_h.nss]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Damage Resolution ====&lt;br /&gt;
&lt;br /&gt;
Damage resolution logic is implemented in the script [[combat_damage_h.nss]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Scripts]]&lt;/div&gt;</summary>
		<author><name>Georg Zoeller</name></author>	</entry>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=Combat_Rules&amp;diff=7292</id>
		<title>Combat Rules</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=Combat_Rules&amp;diff=7292"/>
				<updated>2009-10-28T16:52:24Z</updated>
		
		<summary type="html">&lt;p&gt;Georg Zoeller: /* Defense Rating */  clarified.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''This page is work in progress'''&lt;br /&gt;
&lt;br /&gt;
=== Overview ===&lt;br /&gt;
&lt;br /&gt;
This page describes the technical implementation and flow of combat logic in the game scripts.&lt;br /&gt;
It deals mostly with weapon based combat, for spells and abilities, please see [[Ability|Abilities]].&lt;br /&gt;
&lt;br /&gt;
Note: The term 'property' used on this page refers to [[Creature Properties]].&lt;br /&gt;
&lt;br /&gt;
=== Detailed Description ===&lt;br /&gt;
&lt;br /&gt;
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'.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Hit Resolution  ====&lt;br /&gt;
&lt;br /&gt;
Hit resolution is implemented in the function [[combat_h.nss#Combat_GetAttackResult|Combat_GetAttackResult]] in the script library [[combat_h.nss]], which is invoked from the [[creature_core.nss]] script whenever an attack event is received. The function returns one of several [[COMBAT_RESULT|COMBAT_RESULT_*]] constants and handles messaging to the game engine which animation to play.&lt;br /&gt;
&lt;br /&gt;
Overall, Dragon Age: Origin's combat system is 'hit heavy' as a targets armor does not modify it's chance of getting hit.&lt;br /&gt;
&lt;br /&gt;
The simplified decision tree for to hit resolution is as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if Target Is Placeable Object&lt;br /&gt;
  return COMBAT_RESULT_HIT&lt;br /&gt;
&lt;br /&gt;
if Target Displacement/Dodge &amp;lt; RandomF(100.0)&lt;br /&gt;
  return COMBAT_RESULT_MISS  &lt;br /&gt;
&lt;br /&gt;
if Attacker Is Using BASE_ITEM_TYPE_STAFF&lt;br /&gt;
  return COMBAT_RESULT_HIT&lt;br /&gt;
&lt;br /&gt;
bHit = RandomF(100.0) &amp;lt; AttackRating - DefenseRating&lt;br /&gt;
bCrit = CheckCricital()&lt;br /&gt;
bBackstab = CheckBackstab()&lt;br /&gt;
&lt;br /&gt;
if bHit&lt;br /&gt;
  if  HasEffect(attacker, EFFECT_TYPE_MISDIRECTION_HEX)&lt;br /&gt;
    if bCrit &lt;br /&gt;
      return COMBAT_RESULT_HIT&lt;br /&gt;
    else&lt;br /&gt;
      return COMBAT_RESULT_MISS&lt;br /&gt;
&lt;br /&gt;
 if bBackstab&lt;br /&gt;
    return COMBAT_RESULT_BACKSTAB&lt;br /&gt;
  else&lt;br /&gt;
     if bCrit&lt;br /&gt;
       return COMBAT_RESULT_CRITICAL_HIT&lt;br /&gt;
     else&lt;br /&gt;
       return  COMBAT_RESULT_HIT&lt;br /&gt;
&lt;br /&gt;
  else&lt;br /&gt;
   return COMBAT_RESULT_MISS&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Attack Rating =====&lt;br /&gt;
&lt;br /&gt;
Attack rating includes:&lt;br /&gt;
&lt;br /&gt;
* Base attack value (54.0f)&lt;br /&gt;
* + [[#Flanking Bonus Determination|Flanking Bonus]] (position based, modified by attacker and enemy talents and effects as well as shields. Rogues have a bonus here).&lt;br /&gt;
* + Distance based penalties (for ranged attacks)&lt;br /&gt;
* + Attacker's attack property value (this includes modifiers from buffs, etc.)&lt;br /&gt;
* + Any +attack item bonuses on the weapon that performs the attack.&lt;br /&gt;
* + Any external bonuses or penalties passed into the function (from talent scripts, etc.)&lt;br /&gt;
* + Difficulty setting based modifications&lt;br /&gt;
&lt;br /&gt;
===== Defense Rating =====&lt;br /&gt;
&lt;br /&gt;
Defense rating includes:&lt;br /&gt;
&lt;br /&gt;
* Defender defense value and (missile deflection if attack was ranged). This includes items, effects and magical bonus.&lt;br /&gt;
* Difficulty setting based modifications&lt;br /&gt;
&lt;br /&gt;
===== Flanking Bonus Determination =====&lt;br /&gt;
&lt;br /&gt;
* Flanking bonus is a floating point value that applies to both AttackRating and to the chance to score a critical hit.&lt;br /&gt;
* It is essentially a representation of close the character is to the best position when attacking the enemy (directly in the back)&lt;br /&gt;
* Various shield abilities on the target reduce or prevent the attacker from getting the bonus.&lt;br /&gt;
* The further away the character is from that position, the more the bonus is diluted.&lt;br /&gt;
* The magnitude of 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.&lt;br /&gt;
* Most characters only flank 60 degrees in each direction, combat movement allows an increase to 90 degrees (the full back 180).&lt;br /&gt;
* Only rogues get the full flanking bonus, everyone else still gets half.&lt;br /&gt;
* The full logic is implemented in the function [[combat_h.nss#Combat_GetFlankingBonus|Combat_GetFlankingBonus]] in [[combat_h.nss]].&lt;br /&gt;
&lt;br /&gt;
===== Backstab Determination =====&lt;br /&gt;
&lt;br /&gt;
* Backstab is determined for each melee attack only.&lt;br /&gt;
* Backstab requires the attacker to have a flanking bonus &amp;gt; 0 (some talents waive this restriction)&lt;br /&gt;
* Only creatures with the Rogue [[Classes|Character Class]] may backstab. This is a class benefit.&lt;br /&gt;
* Only humanoid attackers can backstab (this includes darkspawn)&lt;br /&gt;
* The full logic is implemented in the function [[combat_h.nss#Combat_CheckBackstab|Combat_CheckBackstab]] in [[combat_h.nss]].&lt;br /&gt;
&lt;br /&gt;
===== Critical Hit Determination =====&lt;br /&gt;
&lt;br /&gt;
* Critical Hit Chance uses the attackers Melee or Ranged critical hit modifier based on attack type.&lt;br /&gt;
* + the attacking weapon's critical hit modifier stat.&lt;br /&gt;
* + 1.20x (1.1x for non rogues) the attacker's [[#Flanking Bonus Determination|Flanking Bonus]] in the current situation.&lt;br /&gt;
* + 3.5 for each enemy past the 2nd that is fighting a warriors with the bravery talent.&lt;br /&gt;
* A critical hit occurs when the resulting CriticalHitChance is smaller than RandomFloat()*100.0f.&lt;br /&gt;
* Certain effects and spells (e.g. Death Hex) can always override the result, as will attacking from stealth (always hits critical).&lt;br /&gt;
* The logic is  implemented in the function [[combat_h.nss#Combat_GetAttackResult|Combat_GetAttackResult]] in the script library [[combat_h.nss]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Damage Resolution ====&lt;br /&gt;
&lt;br /&gt;
[[Category: Scripts]]&lt;/div&gt;</summary>
		<author><name>Georg Zoeller</name></author>	</entry>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=Combat_Rules&amp;diff=7286</id>
		<title>Combat Rules</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=Combat_Rules&amp;diff=7286"/>
				<updated>2009-10-28T03:41:11Z</updated>
		
		<summary type="html">&lt;p&gt;Georg Zoeller: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''This page is work in progress'''&lt;br /&gt;
&lt;br /&gt;
=== Overview ===&lt;br /&gt;
&lt;br /&gt;
This page describes the technical implementation and flow of combat logic in the game scripts.&lt;br /&gt;
It deals mostly with weapon based combat, for spells and abilities, please see [[Ability|Abilities]].&lt;br /&gt;
&lt;br /&gt;
Note: The term 'property' used on this page refers to [[Creature Properties]].&lt;br /&gt;
&lt;br /&gt;
=== Detailed Description ===&lt;br /&gt;
&lt;br /&gt;
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'.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Hit Resolution  ====&lt;br /&gt;
&lt;br /&gt;
Hit resolution is implemented in the function [[combat_h.nss#Combat_GetAttackResult|Combat_GetAttackResult]] in the script library [[combat_h.nss]], which is invoked from the [[creature_core.nss]] script whenever an attack event is received. The function returns one of several [[COMBAT_RESULT|COMBAT_RESULT_*]] constants and handles messaging to the game engine which animation to play.&lt;br /&gt;
&lt;br /&gt;
Overall, Dragon Age: Origin's combat system is 'hit heavy' as a targets armor does not modify it's chance of getting hit.&lt;br /&gt;
&lt;br /&gt;
The simplified decision tree for to hit resolution is as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if Target Is Placeable Object&lt;br /&gt;
  return COMBAT_RESULT_HIT&lt;br /&gt;
&lt;br /&gt;
if Target Displacement/Dodge &amp;lt; RandomF(100.0)&lt;br /&gt;
  return COMBAT_RESULT_MISS  &lt;br /&gt;
&lt;br /&gt;
if Attacker Is Using BASE_ITEM_TYPE_STAFF&lt;br /&gt;
  return COMBAT_RESULT_HIT&lt;br /&gt;
&lt;br /&gt;
bHit = RandomF(100.0) &amp;lt; AttackRating - DefenseRating&lt;br /&gt;
bCrit = CheckCricital()&lt;br /&gt;
bBackstab = CheckBackstab()&lt;br /&gt;
&lt;br /&gt;
if bHit&lt;br /&gt;
  if  HasEffect(attacker, EFFECT_TYPE_MISDIRECTION_HEX)&lt;br /&gt;
    if bCrit &lt;br /&gt;
      return COMBAT_RESULT_HIT&lt;br /&gt;
    else&lt;br /&gt;
      return COMBAT_RESULT_MISS&lt;br /&gt;
&lt;br /&gt;
 if bBackstab&lt;br /&gt;
    return COMBAT_RESULT_BACKSTAB&lt;br /&gt;
  else&lt;br /&gt;
     if bCrit&lt;br /&gt;
       return COMBAT_RESULT_CRITICAL_HIT&lt;br /&gt;
     else&lt;br /&gt;
       return  COMBAT_RESULT_HIT&lt;br /&gt;
&lt;br /&gt;
  else&lt;br /&gt;
   return COMBAT_RESULT_MISS&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Attack Rating =====&lt;br /&gt;
&lt;br /&gt;
Attack rating includes:&lt;br /&gt;
&lt;br /&gt;
* Base attack value (54.0f)&lt;br /&gt;
* + [[#Flanking Bonus Determination|Flanking Bonus]] (position based, modified by attacker and enemy talents and effects as well as shields. Rogues have a bonus here).&lt;br /&gt;
* + Distance based penalties (for ranged attacks)&lt;br /&gt;
* + Attacker's attack property value (this includes modifiers from buffs, etc.)&lt;br /&gt;
* + Any +attack item bonuses on the weapon that performs the attack.&lt;br /&gt;
* + Any external bonuses or penalties passed into the function (from talent scripts, etc.)&lt;br /&gt;
* + Difficulty setting based modifications&lt;br /&gt;
&lt;br /&gt;
===== Defense Rating =====&lt;br /&gt;
&lt;br /&gt;
Defense rating includes:&lt;br /&gt;
&lt;br /&gt;
* Defender defense value or missile deflection if attack was ranged. This includes items, effects and magical bonus.&lt;br /&gt;
* Yes, this means that avoiding archers is hard for characters without a shield.&lt;br /&gt;
* Difficulty setting based modifications&lt;br /&gt;
&lt;br /&gt;
===== Flanking Bonus Determination =====&lt;br /&gt;
&lt;br /&gt;
* Flanking bonus is a floating point value that applies to both AttackRating and to the chance to score a critical hit.&lt;br /&gt;
* It is essentially a representation of close the character is to the best position when attacking the enemy (directly in the back)&lt;br /&gt;
* Various shield abilities on the target reduce or prevent the attacker from getting the bonus.&lt;br /&gt;
* The further away the character is from that position, the more the bonus is diluted.&lt;br /&gt;
* The magnitude of 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.&lt;br /&gt;
* Most characters only flank 60 degrees in each direction, combat movement allows an increase to 90 degrees (the full back 180).&lt;br /&gt;
* Only rogues get the full flanking bonus, everyone else still gets half.&lt;br /&gt;
* The full logic is implemented in the function [[combat_h.nss#Combat_GetFlankingBonus|Combat_GetFlankingBonus]] in [[combat_h.nss]].&lt;br /&gt;
&lt;br /&gt;
===== Backstab Determination =====&lt;br /&gt;
&lt;br /&gt;
* Backstab is determined for each melee attack only.&lt;br /&gt;
* Backstab requires the attacker to have a flanking bonus &amp;gt; 0 (some talents waive this restriction)&lt;br /&gt;
* Only creatures with the Rogue [[Classes|Character Class]] may backstab. This is a class benefit.&lt;br /&gt;
* Only humanoid attackers can backstab (this includes darkspawn)&lt;br /&gt;
* The full logic is implemented in the function [[combat_h.nss#Combat_CheckBackstab|Combat_CheckBackstab]] in [[combat_h.nss]].&lt;br /&gt;
&lt;br /&gt;
===== Critical Hit Determination =====&lt;br /&gt;
&lt;br /&gt;
* Critical Hit Chance uses the attackers Melee or Ranged critical hit modifier based on attack type.&lt;br /&gt;
* + the attacking weapon's critical hit modifier stat.&lt;br /&gt;
* + 1.20x (1.1x for non rogues) the attacker's [[#Flanking Bonus Determination|Flanking Bonus]] in the current situation.&lt;br /&gt;
* + 3.5 for each enemy past the 2nd that is fighting a warriors with the bravery talent.&lt;br /&gt;
* A critical hit occurs when the resulting CriticalHitChance is smaller than RandomFloat()*100.0f.&lt;br /&gt;
* Certain effects and spells (e.g. Death Hex) can always override the result, as will attacking from stealth (always hits critical).&lt;br /&gt;
* The logic is  implemented in the function [[combat_h.nss#Combat_GetAttackResult|Combat_GetAttackResult]] in the script library [[combat_h.nss]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Damage Resolution ====&lt;br /&gt;
&lt;br /&gt;
[[Category: Scripts]]&lt;/div&gt;</summary>
		<author><name>Georg Zoeller</name></author>	</entry>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=Combat_Rules&amp;diff=7285</id>
		<title>Combat Rules</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=Combat_Rules&amp;diff=7285"/>
				<updated>2009-10-28T03:40:52Z</updated>
		
		<summary type="html">&lt;p&gt;Georg Zoeller: Critical hit details and link to the full GetCombatResult code.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''This page is work in progress'''&lt;br /&gt;
&lt;br /&gt;
=== Overview ===&lt;br /&gt;
&lt;br /&gt;
This page describes the technical implementation and flow of combat logic in the game scripts.&lt;br /&gt;
It deals mostly with weapon based combat, for spells and abilities, please see [[Ability|Abilities]].&lt;br /&gt;
&lt;br /&gt;
Note: The term 'property' used on this page refers to [[Creature Properties]].&lt;br /&gt;
&lt;br /&gt;
=== Detailed Description ===&lt;br /&gt;
&lt;br /&gt;
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'.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Hit Resolution  ====&lt;br /&gt;
&lt;br /&gt;
Hit resolution is implemented in the function [[combat_h.nss#Combat_GetAttackResult|Combat_GetAttackResult]] in the script library [[combat_h.nss]], which is invoked from the [[creature_core.nss]] script whenever an attack event is received. The function returns one of several [[COMBAT_RESULT|COMBAT_RESULT_*]] constants and handles messaging to the game engine which animation to play.&lt;br /&gt;
&lt;br /&gt;
Overall, Dragon Age: Origin's combat system is 'hit heavy' as a targets armor does not modify it's chance of getting hit.&lt;br /&gt;
&lt;br /&gt;
The simplified decision tree for to hit resolution is as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if Target Is Placeable Object&lt;br /&gt;
  return COMBAT_RESULT_HIT&lt;br /&gt;
&lt;br /&gt;
if Target Displacement/Dodge &amp;lt; RandomF(100.0)&lt;br /&gt;
  return COMBAT_RESULT_MISS  &lt;br /&gt;
&lt;br /&gt;
if Attacker Is Using BASE_ITEM_TYPE_STAFF&lt;br /&gt;
  return COMBAT_RESULT_HIT&lt;br /&gt;
&lt;br /&gt;
bHit = RandomF(100.0) &amp;lt; AttackRating - DefenseRating&lt;br /&gt;
bCrit = CheckCricital()&lt;br /&gt;
bBackstab = CheckBackstab()&lt;br /&gt;
&lt;br /&gt;
if bHit&lt;br /&gt;
  if  HasEffect(attacker, EFFECT_TYPE_MISDIRECTION_HEX)&lt;br /&gt;
    if bCrit &lt;br /&gt;
      return COMBAT_RESULT_HIT&lt;br /&gt;
    else&lt;br /&gt;
      return COMBAT_RESULT_MISS&lt;br /&gt;
&lt;br /&gt;
 if bBackstab&lt;br /&gt;
    return COMBAT_RESULT_BACKSTAB&lt;br /&gt;
  else&lt;br /&gt;
     if bCrit&lt;br /&gt;
       return COMBAT_RESULT_CRITICAL_HIT&lt;br /&gt;
     else&lt;br /&gt;
       return  COMBAT_RESULT_HIT&lt;br /&gt;
&lt;br /&gt;
  else&lt;br /&gt;
   return COMBAT_RESULT_MISS&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Attack Rating =====&lt;br /&gt;
&lt;br /&gt;
Attack rating includes:&lt;br /&gt;
&lt;br /&gt;
* Base attack value (54.0f)&lt;br /&gt;
* + [[#Flanking Bonus Determination|Flanking Bonus]] (position based, modified by attacker and enemy talents and effects as well as shields. Rogues have a bonus here).&lt;br /&gt;
* + Distance based penalties (for ranged attacks)&lt;br /&gt;
* + Attacker's attack property value (this includes modifiers from buffs, etc.)&lt;br /&gt;
* + Any +attack item bonuses on the weapon that performs the attack.&lt;br /&gt;
* + Any external bonuses or penalties passed into the function (from talent scripts, etc.)&lt;br /&gt;
* + Difficulty setting based modifications&lt;br /&gt;
&lt;br /&gt;
===== Defense Rating =====&lt;br /&gt;
&lt;br /&gt;
Defense rating includes:&lt;br /&gt;
&lt;br /&gt;
* Defender defense value or missile deflection if attack was ranged. This includes items, effects and magical bonus.&lt;br /&gt;
* Yes, this means that avoiding archers is hard for characters without a shield.&lt;br /&gt;
* Difficulty setting based modifications&lt;br /&gt;
&lt;br /&gt;
===== Flanking Bonus Determination =====&lt;br /&gt;
&lt;br /&gt;
* Flanking bonus is a floating point value that applies to both AttackRating and to the chance to score a critical hit.&lt;br /&gt;
* It is essentially a representation of close the character is to the best position when attacking the enemy (directly in the back)&lt;br /&gt;
* Various shield abilities on the target reduce or prevent the attacker from getting the bonus.&lt;br /&gt;
* The further away the character is from that position, the more the bonus is diluted.&lt;br /&gt;
* The magnitude of 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.&lt;br /&gt;
* Most characters only flank 60 degrees in each direction, combat movement allows an increase to 90 degrees (the full back 180).&lt;br /&gt;
* Only rogues get the full flanking bonus, everyone else still gets half.&lt;br /&gt;
* The full logic is implemented in the function [[combat_h.nss#Combat_GetFlankingBonus|Combat_GetFlankingBonus]] in [[combat_h.nss]].&lt;br /&gt;
&lt;br /&gt;
===== Backstab Determination =====&lt;br /&gt;
&lt;br /&gt;
* Backstab is determined for each melee attack only.&lt;br /&gt;
* Backstab requires the attacker to have a flanking bonus &amp;gt; 0 (some talents waive this restriction)&lt;br /&gt;
* Only creatures with the Rogue [[Classes|Character Class]] may backstab. This is a class benefit.&lt;br /&gt;
* Only humanoid attackers can backstab (this includes darkspawn)&lt;br /&gt;
* The full logic is implemented in the function [[combat_h.nss#Combat_CheckBackstab|Combat_CheckBackstab]] in [[combat_h.nss]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== Critical Hit Determination =====&lt;br /&gt;
&lt;br /&gt;
* Critical Hit Chance uses the attackers Melee or Ranged critical hit modifier based on attack type.&lt;br /&gt;
* + the attacking weapon's critical hit modifier stat.&lt;br /&gt;
* + 1.20x (1.1x for non rogues) the attacker's [[#Flanking Bonus Determination|Flanking Bonus]] in the current situation.&lt;br /&gt;
* + 3.5 for each enemy past the 2nd that is fighting a warriors with the bravery talent.&lt;br /&gt;
* A critical hit occurs when the resulting CriticalHitChance is smaller than RandomFloat()*100.0f.&lt;br /&gt;
* Certain effects and spells (e.g. Death Hex) can always override the result, as will attacking from stealth (always hits critical).&lt;br /&gt;
* The logic is  implemented in the function [[combat_h.nss#Combat_GetAttackResult|Combat_GetAttackResult]] in the script library [[combat_h.nss]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Damage Resolution ====&lt;br /&gt;
&lt;br /&gt;
[[Category: Scripts]]&lt;/div&gt;</summary>
		<author><name>Georg Zoeller</name></author>	</entry>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=Combat_h.nss&amp;diff=7284</id>
		<title>Combat h.nss</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=Combat_h.nss&amp;diff=7284"/>
				<updated>2009-10-28T03:30:04Z</updated>
		
		<summary type="html">&lt;p&gt;Georg Zoeller: /* Combat_GetAttackResult */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Overview ===&lt;br /&gt;
&lt;br /&gt;
Combat_h.nss handles the core rule resolution logic for non-talent combat interaction.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Notable Functions ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Combat_GetAttackResult ====&lt;br /&gt;
&lt;br /&gt;
This function is determines whether or not a weapon/unarmed attack hits and determines substates such as critical hit or backstab.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
* @brief Determine whether or not an attack hits a target.&lt;br /&gt;
*&lt;br /&gt;
* Note that this function only calculates to hit and crits, death blows are&lt;br /&gt;
* determined in Combat_PerformAttack&lt;br /&gt;
*&lt;br /&gt;
* @param oAttacker  The attacker&lt;br /&gt;
* @param oTarget    The target that is being attacked&lt;br /&gt;
* @param nAbility   If != 0, it won't trigger backstabs and deathblows.&lt;br /&gt;
*&lt;br /&gt;
* @returns  COMBAT_RESULT_HIT, COMBAT_RESULT_CRITICALHIT or COMBAT_RESULT_MISS&lt;br /&gt;
*&lt;br /&gt;
* @author Georg Zoeller&lt;br /&gt;
*&lt;br /&gt;
**/&lt;br /&gt;
int Combat_GetAttackResult(object oAttacker, object oTarget, object oWeapon, float fBonus = 0.0f, int nAbility = 0);&lt;br /&gt;
int Combat_GetAttackResult(object oAttacker, object oTarget, object oWeapon, float fBonus = 0.0f, int nAbility = 0)&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    // Debug&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    int nForcedCombatResult = GetForcedCombatResult(oAttacker);&lt;br /&gt;
    if (nForcedCombatResult != -1)&lt;br /&gt;
    {&lt;br /&gt;
        #ifdef DEBUG&lt;br /&gt;
        Log_Trace_Combat(&amp;quot;combat_h.GetAttackResult&amp;quot;,&amp;quot; Skipped rules, FORCED RESULT IS:&amp;quot; + ToString(nForcedCombatResult), oTarget);&lt;br /&gt;
        #endif&lt;br /&gt;
        return nForcedCombatResult;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    // Placeables are always hit&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    if (GetObjectType(oTarget) == OBJECT_TYPE_PLACEABLE)&lt;br /&gt;
    {&lt;br /&gt;
        #ifdef DEBUG&lt;br /&gt;
        Log_Trace_Combat(&amp;quot;combat_h.GetAttackResult&amp;quot;,&amp;quot; Placeable, automatic result : COMBAT_RESULT_HIT&amp;quot;, oTarget);&lt;br /&gt;
        #endif&lt;br /&gt;
        return COMBAT_RESULT_HIT;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    // Displacement / Dodge&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    float fDisplace = GetCreatureProperty(oTarget, PROPERTY_ATTRIBUTE_DISPLACEMENT);&lt;br /&gt;
    float fRand = RandomFloat()*100.0;&lt;br /&gt;
    if ( fRand &amp;lt; fDisplace)&lt;br /&gt;
    {&lt;br /&gt;
        #ifdef DEBUG&lt;br /&gt;
        Log_Trace_Combat(&amp;quot;combat_h.GetAttackResult&amp;quot;,&amp;quot; Displacement effect kciked in, automatic result : COMBAT_RESULT_MISS&amp;quot;, oTarget);&lt;br /&gt;
        #endif&lt;br /&gt;
&lt;br /&gt;
        // ---------------------------------------------------------------------&lt;br /&gt;
        // if the target has the evasion talent, attribute this miss to the talent&lt;br /&gt;
        // (random 50% because the anim is interrupting)&lt;br /&gt;
        // ---------------------------------------------------------------------&lt;br /&gt;
        if (HasAbility(oTarget, ABILITY_TALENT_EVASION) &amp;amp;&amp;amp; fRand &amp;lt; (20.0f - (RandomFloat()*10.0f)  ))&lt;br /&gt;
        {&lt;br /&gt;
                command currentCmd = GetCurrentCommand(oTarget);&lt;br /&gt;
                int nCmdType = GetCommandType(currentCmd);&lt;br /&gt;
&lt;br /&gt;
                // Evasion only plays during attack and wait commands.&lt;br /&gt;
                if ( nCmdType == COMMAND_TYPE_WAIT || nCmdType == COMMAND_TYPE_ATTACK || nCmdType == COMMAND_TYPE_INVALID )&lt;br /&gt;
                {&lt;br /&gt;
                    ApplyEffectOnObject(EFFECT_DURATION_TYPE_INSTANT, Effect(1055), oTarget, 0.0f, oTarget, ABILITY_TALENT_EVASION);&lt;br /&gt;
                }&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        return COMBAT_RESULT_MISS;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    int  nAttackType = Combat_GetAttackType(oAttacker, oWeapon);&lt;br /&gt;
    int nRet;&lt;br /&gt;
&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    // Get the attackers attack rating (includes effects and equipment stats)&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    float   fAttackRating;&lt;br /&gt;
&lt;br /&gt;
    if (GetBaseItemType(oWeapon) == BASE_ITEM_TYPE_STAFF)&lt;br /&gt;
    {&lt;br /&gt;
        // ---------------------------------------------------------------------&lt;br /&gt;
        // Staves always hit&lt;br /&gt;
        // ---------------------------------------------------------------------&lt;br /&gt;
        return COMBAT_RESULT_HIT;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    fAttackRating =  GetCreatureAttackRating (oAttacker);&lt;br /&gt;
&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    // Add item stat (usually 0) along with scripted boni and attack bias.&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
    fAttackRating += GetItemStat(oWeapon,   ITEM_STAT_ATTACK) + fBonus + ATTACK_HIT_BIAS;&lt;br /&gt;
&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    // Easier difficulties grant the player a bonus.&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    fAttackRating += Diff_GetRulesAttackBonus(oAttacker);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    // This section deals with figuring out which critical hit modifier (melee, ranged, etc)&lt;br /&gt;
    // to use for this attack.&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    float   fCriticalHitModifier;&lt;br /&gt;
    int     nCriticalHitModifier  = (nAttackType == ATTACK_TYPE_RANGED) ?  CRITICAL_MODIFIER_RANGED : CRITICAL_MODIFIER_MELEE;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    fCriticalHitModifier = GetCreatureCriticalHitModifier(oAttacker, nCriticalHitModifier);&lt;br /&gt;
    fCriticalHitModifier += GetItemStat(oWeapon, ITEM_STAT_CRIT_CHANCE_MODIFIER);&lt;br /&gt;
&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    //  Bravery grants +3.5 critical hit per enemy past the first 2&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    if (HasAbility(oAttacker, ABILITY_TALENT_BRAVERY))&lt;br /&gt;
    {&lt;br /&gt;
&lt;br /&gt;
        int nEnemies = Max(0,GetArraySize(GetCreaturesInMeleeRing(oAttacker,0.0, 359.99f,TRUE,0))-2);&lt;br /&gt;
        fCriticalHitModifier +=  nEnemies * 3.5f;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    // Calculate Flanking Bonus&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    float fFlanking = Combat_GetFlankingBonus(oAttacker, oTarget);&lt;br /&gt;
    if (fFlanking &amp;gt; 0.0 )&lt;br /&gt;
    {&lt;br /&gt;
        // ---------------------------------------------------------------------&lt;br /&gt;
        // Also increase chance for critical hits by 1/5th of the flanking bonus&lt;br /&gt;
        // ---------------------------------------------------------------------&lt;br /&gt;
        fCriticalHitModifier *=  (1.0 + (fFlanking/5.0));&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    // Range plays a role too.&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    float fDistance =  GetDistanceBetween(oAttacker, oTarget);&lt;br /&gt;
    float fNoPenaltyDistance = MaxF(POINT_BLANK_RANGE,GetItemStat(oWeapon, ITEM_STAT_OPTIMUM_RANGE));&lt;br /&gt;
    fDistance = MaxF(fDistance-fNoPenaltyDistance,0.0f);&lt;br /&gt;
&lt;br /&gt;
    float fAttackRoll = 50.0;&lt;br /&gt;
    float fPenalties = fDistance; // every meter distance past the free range is -1!&lt;br /&gt;
    float fAttack = fAttackRating  + fAttackRoll + fFlanking - fPenalties;&lt;br /&gt;
&lt;br /&gt;
    // &amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
    // BEGIN SECTION CRITICAL HITS&lt;br /&gt;
    // &amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        int bThreatenCritical = (RandomFloat()*100.0f   &amp;lt; fCriticalHitModifier  );&lt;br /&gt;
&lt;br /&gt;
        if (!bThreatenCritical)&lt;br /&gt;
        {&lt;br /&gt;
            // ---------------------------------------------------------------------&lt;br /&gt;
            // Attacking out of stealth always threatens crit.&lt;br /&gt;
            // ---------------------------------------------------------------------&lt;br /&gt;
            if (IsModalAbilityActive(oAttacker, ABILITY_SKILL_STEALTH_1))&lt;br /&gt;
            {&lt;br /&gt;
                bThreatenCritical = TRUE;&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
            // -----------------------------------------------------------------&lt;br /&gt;
            // Death hex effect ... all hits are auto crit&lt;br /&gt;
            // -----------------------------------------------------------------&lt;br /&gt;
            if (GetHasEffects(oTarget, EFFECT_TYPE_DEATH_HEX))&lt;br /&gt;
            {&lt;br /&gt;
                bThreatenCritical = TRUE;&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
            // -----------------------------------------------------------------&lt;br /&gt;
            // Autocrit effect&lt;br /&gt;
            // -----------------------------------------------------------------&lt;br /&gt;
            if (GetHasEffects(oAttacker, EFFECT_TYPE_AUTOCRIT))&lt;br /&gt;
            {&lt;br /&gt;
                bThreatenCritical = TRUE;&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        else&lt;br /&gt;
        {&lt;br /&gt;
            // ---------------------------------------------------------------------&lt;br /&gt;
            // Double strike does not allow crits&lt;br /&gt;
            // ---------------------------------------------------------------------&lt;br /&gt;
            if (IsModalAbilityActive(oAttacker, ABILITY_TALENT_DUAL_WEAPON_DOUBLE_STRIKE))&lt;br /&gt;
            {&lt;br /&gt;
                bThreatenCritical = FALSE;&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
            // rapid shot doesn't allow critical strikes&lt;br /&gt;
            if (IsModalAbilityActive(oAttacker, ABILITY_TALENT_RAPIDSHOT))&lt;br /&gt;
            {&lt;br /&gt;
                bThreatenCritical = FALSE;&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        // ---------------------------------------------------------------------&lt;br /&gt;
        // Targets that have critical hit immunity can not be crit...&lt;br /&gt;
        // ---------------------------------------------------------------------&lt;br /&gt;
        if (bThreatenCritical)&lt;br /&gt;
        {            &lt;br /&gt;
            bThreatenCritical = !HasAbility(oTarget, ABILITY_TRAIT_CRITICAL_HIT_IMMUNITY);&lt;br /&gt;
&lt;br /&gt;
            if (!bThreatenCritical)&lt;br /&gt;
              Log_Trace_Combat(&amp;quot;combat_h.GetAttackResult&amp;quot;,&amp;quot; Critical hit averted, target has critical hit immunity&amp;quot;, oTarget);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
    // &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&lt;br /&gt;
    // END SECTION CRITICAL HITS&lt;br /&gt;
    // &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&lt;br /&gt;
&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    // This section deals with calculating the defense values of the attack target&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    float fDefenseRating =  GetCreatureDefense(oTarget) + ((nAttackType == ATTACK_TYPE_RANGED) ? GetCreatureProperty(oTarget,PROPERTY_ATTRIBUTE_MISSILE_SHIELD):0.0f);&lt;br /&gt;
&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    // Easier difficulties grant the player a bonus.&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    fDefenseRating += Diff_GetRulesDefenseBonus(oTarget);&lt;br /&gt;
&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    // A hit is successful if the attack rating exceeds the defense rating&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    if (RandomFloat()*100.0f &amp;lt;  fAttack - fDefenseRating)&lt;br /&gt;
    {&lt;br /&gt;
&lt;br /&gt;
        // ---------------------------------------------------------------------&lt;br /&gt;
        // If we threatened a critical, we crit here, otherwise just report normal hit&lt;br /&gt;
        // ---------------------------------------------------------------------&lt;br /&gt;
        nRet =  ( (bThreatenCritical) ? COMBAT_RESULT_CRITICALHIT : COMBAT_RESULT_HIT  );&lt;br /&gt;
&lt;br /&gt;
        if ( nAttackType == ATTACK_TYPE_MELEE)&lt;br /&gt;
        {&lt;br /&gt;
            // -----------------------------------------------------------------&lt;br /&gt;
            // If we are backstabbing, we change the result here if it&lt;br /&gt;
            // was a crit. Abilities never bs (anim priority)&lt;br /&gt;
            // -----------------------------------------------------------------&lt;br /&gt;
            if ( nAbility == 0 &amp;amp;&amp;amp; Combat_CheckBackstab(oAttacker, oTarget, oWeapon,fFlanking))&lt;br /&gt;
            {&lt;br /&gt;
                    nRet =  COMBAT_RESULT_BACKSTAB;&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    // Miss...&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    else&lt;br /&gt;
    {&lt;br /&gt;
        nRet = COMBAT_RESULT_MISS;&lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    // Misdirection Hex&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    if (GetHasEffects(oAttacker, EFFECT_TYPE_MISDIRECTION_HEX))&lt;br /&gt;
    {&lt;br /&gt;
        #ifdef DEBUG&lt;br /&gt;
        Log_Trace_Combat(&amp;quot;combat_h.GetAttackResult&amp;quot;,&amp;quot; Attacker under misdirection hex: Hits are misses, crits are hits.&amp;quot;, oTarget);&lt;br /&gt;
        #endif&lt;br /&gt;
&lt;br /&gt;
        if (nRet == COMBAT_RESULT_HIT || nRet == COMBAT_RESULT_BACKSTAB)&lt;br /&gt;
        {&lt;br /&gt;
            nRet = COMBAT_RESULT_MISS;&lt;br /&gt;
        }&lt;br /&gt;
        else if (nRet == COMBAT_RESULT_CRITICALHIT)&lt;br /&gt;
        {&lt;br /&gt;
            nRet = COMBAT_RESULT_HIT;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    #ifdef DEBUG&lt;br /&gt;
    Log_Trace_Combat(&amp;quot;combat_h.GetAttackResult&amp;quot;,&amp;quot; ToHit Calculation: &amp;quot; +&lt;br /&gt;
                     &amp;quot; fAttack:&amp;quot;  + ToString(fAttack) +&lt;br /&gt;
                     &amp;quot; = (fAttackRating: &amp;quot; + ToString(fAttackRating) +&lt;br /&gt;
                     &amp;quot; fAttackRoll:&amp;quot; + ToString(fAttackRoll) +&lt;br /&gt;
                     &amp;quot; (range penalty:&amp;quot; + ToString(fPenalties) + &amp;quot;)&amp;quot;+&lt;br /&gt;
                     &amp;quot; fFlanking: &amp;quot; + ToString(fFlanking) +&lt;br /&gt;
                     &amp;quot; fBonus(script): &amp;quot; + ToString(fBonus) +&lt;br /&gt;
                     &amp;quot;)&amp;quot; , oAttacker, oTarget, LOG_CHANNEL_COMBAT_TOHIT );&lt;br /&gt;
&lt;br /&gt;
    Log_Trace_Combat(&amp;quot;combat_h.GetAttackResult&amp;quot;,&amp;quot; ToHit Calculation (2):  &amp;quot; +&lt;br /&gt;
                     &amp;quot; fDefenseRating: &amp;quot; + ToString(fDefenseRating) +&lt;br /&gt;
                     &amp;quot; fCriticalHitModifier: &amp;quot; + ToString(fCriticalHitModifier) +&lt;br /&gt;
                     &amp;quot; bThreatenCritical: &amp;quot; + ToString(bThreatenCritical), oAttacker, oTarget, LOG_CHANNEL_COMBAT_TOHIT );&lt;br /&gt;
&lt;br /&gt;
    #endif&lt;br /&gt;
&lt;br /&gt;
    return nRet;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Combat_CheckBackstab ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
// -----------------------------------------------------------------------------&lt;br /&gt;
// Check if backstab conditions are true&lt;br /&gt;
// -----------------------------------------------------------------------------&lt;br /&gt;
int Combat_CheckBackstab(object oAttacker, object oTarget, object oWeapon, float fFlankingBonus)&lt;br /&gt;
{&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    // If we we are a rogue&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    if (!HasAbility(oAttacker, ABILITY_TALENT_HIDDEN_ROGUE))&lt;br /&gt;
    {&lt;br /&gt;
        return FALSE;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    // Only humanoid rigs have the backstab anim &lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    if (!IsHumanoid(oAttacker))&lt;br /&gt;
    {&lt;br /&gt;
        return FALSE;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    // And target is not immune&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    if (HasAbility(oTarget, ABILITY_TRAIT_CRITICAL_HIT_IMMUNITY))&lt;br /&gt;
    {&lt;br /&gt;
        return FALSE;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    // And attacker does not use double strike mode&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    if (IsModalAbilityActive(oAttacker, ABILITY_TALENT_DUAL_WEAPON_DOUBLE_STRIKE))&lt;br /&gt;
    {&lt;br /&gt;
        return FALSE;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    // We can only backstab if we are flanking.&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    if (fFlankingBonus&amp;gt;0.0)&lt;br /&gt;
    {&lt;br /&gt;
        return TRUE;&lt;br /&gt;
    }&lt;br /&gt;
    else&lt;br /&gt;
    {&lt;br /&gt;
         /* Coup de grace*/&lt;br /&gt;
        if (HasAbility(oAttacker, ABILITY_TALENT_BACKSTAB))&lt;br /&gt;
        {&lt;br /&gt;
            if (GetHasEffects(oTarget, EFFECT_TYPE_STUN))&lt;br /&gt;
            {&lt;br /&gt;
                return TRUE;&lt;br /&gt;
            }&lt;br /&gt;
            else if (GetHasEffects(oTarget, EFFECT_TYPE_PARALYZE))&lt;br /&gt;
            {&lt;br /&gt;
                return TRUE;&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    return FALSE;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Combat_GetFlankingBonus ====&lt;br /&gt;
&lt;br /&gt;
This function is invoked during to hit determination and returns the magnitude &lt;br /&gt;
of the benefit the attacker may receive due to his facing and location relative to &lt;br /&gt;
the target.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
// -----------------------------------------------------------------------------&lt;br /&gt;
// Determine the magnitude of positional bonuses for the attacker&lt;br /&gt;
// -----------------------------------------------------------------------------&lt;br /&gt;
float Combat_GetFlankingBonus(object oAttacker, object oTarget)&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    if (HasAbility(oTarget, ABILITY_TALENT_SHIELD_TACTICS))&lt;br /&gt;
    {&lt;br /&gt;
        if (IsUsingShield(oTarget))&lt;br /&gt;
            return 0.0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    if (GetHasEffects(oTarget, EFFECT_TYPE_FLANK_IMMUNITY))&lt;br /&gt;
    {&lt;br /&gt;
        return 0.0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    float fAngle = GetAngleBetweenObjects(oTarget, oAttacker);&lt;br /&gt;
    float fFactor = 0.0;&lt;br /&gt;
&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    // The maximum bonus from position is +15&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    float fMaxModifier = 15.0;&lt;br /&gt;
&lt;br /&gt;
    // The attackers ability to flank is stored in a creature property&lt;br /&gt;
    float fFlankingAngle = GetCreatureProperty(oAttacker, PROPERTY_ATTRIBUTE_FLANKING_ANGLE);&lt;br /&gt;
&lt;br /&gt;
    if (fFlankingAngle &amp;lt;= 10.0 ) /*old savegames have this at 10*/&lt;br /&gt;
    {&lt;br /&gt;
        fFlankingAngle = 60.0; // old savegames need this to avoid divby0 later&lt;br /&gt;
    }&lt;br /&gt;
    else if (fFlankingAngle&amp;gt;180.0)&lt;br /&gt;
    {&lt;br /&gt;
        fFlankingAngle = 180.0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    // Combat movement expands the maximum bonus to +20&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    if (HasAbility(oAttacker, ABILITY_TALENT_COMBAT_MOVEMENT))&lt;br /&gt;
    {&lt;br /&gt;
        fMaxModifier = 20.0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    if ( fMaxModifier &amp;lt;= 0.0 )&lt;br /&gt;
    {&lt;br /&gt;
        return 0.0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    if ( (fAngle&amp;gt;= (180.0 - fFlankingAngle) &amp;amp;&amp;amp; fAngle&amp;lt;=(180.0 + fFlankingAngle )))&lt;br /&gt;
    {&lt;br /&gt;
        // Shield block negates flanking on the left.&lt;br /&gt;
&lt;br /&gt;
        int bShieldBlock =  HasAbility(oTarget,ABILITY_TALENT_SHIELD_BLOCK);&lt;br /&gt;
        int bUsingShield = IsUsingShield(oTarget);&lt;br /&gt;
&lt;br /&gt;
        if (!bShieldBlock || fAngle &amp;lt; 180.0 || (bShieldBlock &amp;amp;&amp;amp; !bUsingShield) )&lt;br /&gt;
        {&lt;br /&gt;
            fFactor = (fFlankingAngle -  fabs( 180.0 - fAngle))/fFlankingAngle;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // Only rogues get the full positional benefits on the battlefield,&lt;br /&gt;
    // everyone else gets half&lt;br /&gt;
    float fClassModifier = GetCreatureCoreClass(oAttacker) == CLASS_ROGUE?1.0f:0.5f;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    return fFactor * fMaxModifier * fClassModifier;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Scripts]]&lt;/div&gt;</summary>
		<author><name>Georg Zoeller</name></author>	</entry>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=Combat_Rules&amp;diff=7283</id>
		<title>Combat Rules</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=Combat_Rules&amp;diff=7283"/>
				<updated>2009-10-28T03:28:03Z</updated>
		
		<summary type="html">&lt;p&gt;Georg Zoeller: /* Hit Resolution */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''This page is work in progress'''&lt;br /&gt;
&lt;br /&gt;
=== Overview ===&lt;br /&gt;
&lt;br /&gt;
This page describes the technical implementation and flow of combat logic in the game scripts.&lt;br /&gt;
It deals mostly with weapon based combat, for spells and abilities, please see [[Ability|Abilities]].&lt;br /&gt;
&lt;br /&gt;
Note: The term 'property' used on this page refers to [[Creature Properties]].&lt;br /&gt;
&lt;br /&gt;
=== Detailed Description ===&lt;br /&gt;
&lt;br /&gt;
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'.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Hit Resolution  ====&lt;br /&gt;
&lt;br /&gt;
Hit resolution is implemented in the function [[combat_h.nss#Combat_GetAttackResult|Combat_GetAttackResult]] in the script library [[combat_h.nss]], which is invoked from the [[creature_core.nss]] script whenever an attack event is received. The function returns one of several [[COMBAT_RESULT|COMBAT_RESULT_*]] constants and handles messaging to the game engine which animation to play.&lt;br /&gt;
&lt;br /&gt;
Overall, Dragon Age: Origin's combat system is 'hit heavy' as a targets armor does not modify it's chance of getting hit.&lt;br /&gt;
&lt;br /&gt;
The simplified decision tree for to hit resolution is as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if Target Is Placeable Object&lt;br /&gt;
  return COMBAT_RESULT_HIT&lt;br /&gt;
&lt;br /&gt;
if Target Displacement/Dodge &amp;lt; RandomF(100.0)&lt;br /&gt;
  return COMBAT_RESULT_MISS  &lt;br /&gt;
&lt;br /&gt;
if Attacker Is Using BASE_ITEM_TYPE_STAFF&lt;br /&gt;
  return COMBAT_RESULT_HIT&lt;br /&gt;
&lt;br /&gt;
bHit = RandomF(100.0) &amp;lt; AttackRating - DefenseRating&lt;br /&gt;
bCrit = CheckCricital()&lt;br /&gt;
bBackstab = CheckBackstab()&lt;br /&gt;
&lt;br /&gt;
if bHit&lt;br /&gt;
  if  HasEffect(attacker, EFFECT_TYPE_MISDIRECTION_HEX)&lt;br /&gt;
    if bCrit &lt;br /&gt;
      return COMBAT_RESULT_HIT&lt;br /&gt;
    else&lt;br /&gt;
      return COMBAT_RESULT_MISS&lt;br /&gt;
&lt;br /&gt;
 if bBackstab&lt;br /&gt;
    return COMBAT_RESULT_BACKSTAB&lt;br /&gt;
  else&lt;br /&gt;
     if bCrit&lt;br /&gt;
       return COMBAT_RESULT_CRITICAL_HIT&lt;br /&gt;
     else&lt;br /&gt;
       return  COMBAT_RESULT_HIT&lt;br /&gt;
&lt;br /&gt;
  else&lt;br /&gt;
   return COMBAT_RESULT_MISS&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Attack Rating =====&lt;br /&gt;
&lt;br /&gt;
Attack rating includes:&lt;br /&gt;
&lt;br /&gt;
* Base attack value (54.0f)&lt;br /&gt;
* + [[#Flanking Bonus Determination|Flanking Bonus]] (position based, modified by attacker and enemy talents and effects as well as shields. Rogues have a bonus here).&lt;br /&gt;
* + Distance based penalties (for ranged attacks)&lt;br /&gt;
* + Attacker's attack property value (this includes modifiers from buffs, etc.)&lt;br /&gt;
* + Any +attack item bonuses on the weapon that performs the attack.&lt;br /&gt;
* + Any external bonuses or penalties passed into the function (from talent scripts, etc.)&lt;br /&gt;
* + Difficulty setting based modifications&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== Defense Rating =====&lt;br /&gt;
&lt;br /&gt;
Defense rating includes:&lt;br /&gt;
&lt;br /&gt;
* Defender defense value or missile deflection if attack was ranged. This includes items, effects and magical bonus.&lt;br /&gt;
* Yes, this means that avoiding archers is hard for characters without a shield.&lt;br /&gt;
* Difficulty setting based modifications&lt;br /&gt;
&lt;br /&gt;
===== Flanking Bonus Determination =====&lt;br /&gt;
&lt;br /&gt;
* Flanking bonus is a floating point value that applies to both AttackRating and to the chance to score a critical hit.&lt;br /&gt;
* It is essentially a representation of close the character is to the best position when attacking the enemy (directly in the back)&lt;br /&gt;
* Various shield abilities on the target reduce or prevent the attacker from getting the bonus.&lt;br /&gt;
* The further away the character is from that position, the more the bonus is diluted.&lt;br /&gt;
* The magnitude of 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.&lt;br /&gt;
* Most characters only flank 60 degrees in each direction, combat movement allows an increase to 90 degrees (the full back 180).&lt;br /&gt;
* Only rogues get the full flanking bonus, everyone else still gets half.&lt;br /&gt;
* The full logic is implemented in the function [[combat_h.nss#Combat_GetFlankingBonus|Combat_GetFlankingBonus]] in [[combat_h.nss]].&lt;br /&gt;
&lt;br /&gt;
===== Backstab Determination =====&lt;br /&gt;
&lt;br /&gt;
* Backstab is determined for each melee attack only.&lt;br /&gt;
* Backstab requires the attacker to have a flanking bonus &amp;gt; 0 (some talents waive this restriction)&lt;br /&gt;
* Only creatures with the Rogue [[Classes|Character Class]] may backstab. This is a class benefit.&lt;br /&gt;
* Only humanoid attackers can backstab (this includes darkspawn)&lt;br /&gt;
* The full logic is implemented in the function [[combat_h.nss#Combat_CheckBackstab|Combat_CheckBackstab]] in [[combat_h.nss]].&lt;br /&gt;
&lt;br /&gt;
==== Damage Resolution ====&lt;br /&gt;
&lt;br /&gt;
[[Category: Scripts]]&lt;/div&gt;</summary>
		<author><name>Georg Zoeller</name></author>	</entry>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=Combat_h.nss&amp;diff=7282</id>
		<title>Combat h.nss</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=Combat_h.nss&amp;diff=7282"/>
				<updated>2009-10-28T03:27:19Z</updated>
		
		<summary type="html">&lt;p&gt;Georg Zoeller: Added code for combat_getattackresult&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Overview ===&lt;br /&gt;
&lt;br /&gt;
Combat_h.nss handles the core rule resolution logic for non-talent combat interaction.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Notable Functions ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Combat_GetAttackResult ====&lt;br /&gt;
&lt;br /&gt;
This function is determines whether or not a weapon/unarmed attack hits and determines substates such as critical hit or backstab.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
* @brief Determine whether or not an attack hits a target.&lt;br /&gt;
*&lt;br /&gt;
* Note that this function only calculates to hit and crits, death blows are&lt;br /&gt;
* determined in Combat_PerformAttack&lt;br /&gt;
*&lt;br /&gt;
* @param oAttacker  The attacker&lt;br /&gt;
* @param oTarget    The target that is being attacked&lt;br /&gt;
* @param nAbility   If != 0, it won't trigger backstabs and deathblows.&lt;br /&gt;
*&lt;br /&gt;
* @returns  COMBAT_RESULT_HIT, COMBAT_RESULT_CRITICALHIT or COMBAT_RESULT_MISS&lt;br /&gt;
*&lt;br /&gt;
* @author Georg Zoeller&lt;br /&gt;
*&lt;br /&gt;
**/&lt;br /&gt;
int Combat_GetAttackResult(object oAttacker, object oTarget, object oWeapon, float fBonus = 0.0f, int nAbility = 0);&lt;br /&gt;
int Combat_GetAttackResult(object oAttacker, object oTarget, object oWeapon, float fBonus = 0.0f, int nAbility = 0)&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    // Debug&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    int nForcedCombatResult = GetForcedCombatResult(oAttacker);&lt;br /&gt;
    if (nForcedCombatResult != -1)&lt;br /&gt;
    {&lt;br /&gt;
        #ifdef DEBUG&lt;br /&gt;
        Log_Trace_Combat(&amp;quot;combat_h.GetAttackResult&amp;quot;,&amp;quot; Skipped rules, FORCED RESULT IS:&amp;quot; + ToString(nForcedCombatResult), oTarget);&lt;br /&gt;
        #endif&lt;br /&gt;
        return nForcedCombatResult;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    // Placeables are always hit&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    if (GetObjectType(oTarget) == OBJECT_TYPE_PLACEABLE)&lt;br /&gt;
    {&lt;br /&gt;
        #ifdef DEBUG&lt;br /&gt;
        Log_Trace_Combat(&amp;quot;combat_h.GetAttackResult&amp;quot;,&amp;quot; Placeable, automatic result : COMBAT_RESULT_HIT&amp;quot;, oTarget);&lt;br /&gt;
        #endif&lt;br /&gt;
        return COMBAT_RESULT_HIT;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    // Displacement / Dodge&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    float fDisplace = GetCreatureProperty(oTarget, PROPERTY_ATTRIBUTE_DISPLACEMENT);&lt;br /&gt;
    float fRand = RandomFloat()*100.0;&lt;br /&gt;
    if ( fRand &amp;lt; fDisplace)&lt;br /&gt;
    {&lt;br /&gt;
        #ifdef DEBUG&lt;br /&gt;
        Log_Trace_Combat(&amp;quot;combat_h.GetAttackResult&amp;quot;,&amp;quot; Displacement effect kciked in, automatic result : COMBAT_RESULT_MISS&amp;quot;, oTarget);&lt;br /&gt;
        #endif&lt;br /&gt;
&lt;br /&gt;
        // ---------------------------------------------------------------------&lt;br /&gt;
        // if the target has the evasion talent, attribute this miss to the talent&lt;br /&gt;
        // (random 50% because the anim is interrupting)&lt;br /&gt;
        // ---------------------------------------------------------------------&lt;br /&gt;
        if (HasAbility(oTarget, ABILITY_TALENT_EVASION) &amp;amp;&amp;amp; fRand &amp;lt; (20.0f - (RandomFloat()*10.0f)  ))&lt;br /&gt;
        {&lt;br /&gt;
                command currentCmd = GetCurrentCommand(oTarget);&lt;br /&gt;
                int nCmdType = GetCommandType(currentCmd);&lt;br /&gt;
&lt;br /&gt;
                // Evasion only plays during attack and wait commands.&lt;br /&gt;
                if ( nCmdType == COMMAND_TYPE_WAIT || nCmdType == COMMAND_TYPE_ATTACK || nCmdType == COMMAND_TYPE_INVALID )&lt;br /&gt;
                {&lt;br /&gt;
                    ApplyEffectOnObject(EFFECT_DURATION_TYPE_INSTANT, Effect(1055), oTarget, 0.0f, oTarget, ABILITY_TALENT_EVASION);&lt;br /&gt;
                }&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        return COMBAT_RESULT_MISS;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    int  nAttackType = Combat_GetAttackType(oAttacker, oWeapon);&lt;br /&gt;
    int nRet;&lt;br /&gt;
&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    // Get the attackers attack rating (includes effects and equipment stats)&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    float   fAttackRating;&lt;br /&gt;
&lt;br /&gt;
    if (GetBaseItemType(oWeapon) == BASE_ITEM_TYPE_STAFF)&lt;br /&gt;
    {&lt;br /&gt;
        // ---------------------------------------------------------------------&lt;br /&gt;
        // Staves always hit&lt;br /&gt;
        // ---------------------------------------------------------------------&lt;br /&gt;
        return COMBAT_RESULT_HIT;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    fAttackRating =  GetCreatureAttackRating (oAttacker);&lt;br /&gt;
&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    // Add item stat (usually 0) along with scripted boni and attack bias.&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
    fAttackRating += GetItemStat(oWeapon,   ITEM_STAT_ATTACK) + fBonus + ATTACK_HIT_BIAS;&lt;br /&gt;
&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    // Easier difficulties grant the player a bonus.&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    fAttackRating += Diff_GetRulesAttackBonus(oAttacker);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    // This section deals with figuring out which critical hit modifier (melee, ranged, etc)&lt;br /&gt;
    // to use for this attack.&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    float   fCriticalHitModifier;&lt;br /&gt;
    int     nCriticalHitModifier  = (nAttackType == ATTACK_TYPE_RANGED) ?  CRITICAL_MODIFIER_RANGED : CRITICAL_MODIFIER_MELEE;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    fCriticalHitModifier = GetCreatureCriticalHitModifier(oAttacker, nCriticalHitModifier);&lt;br /&gt;
    fCriticalHitModifier += GetItemStat(oWeapon, ITEM_STAT_CRIT_CHANCE_MODIFIER);&lt;br /&gt;
&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    //  Bravery grants +3.5 critical hit per enemy past the first 2&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    if (HasAbility(oAttacker, ABILITY_TALENT_BRAVERY))&lt;br /&gt;
    {&lt;br /&gt;
&lt;br /&gt;
        int nEnemies = Max(0,GetArraySize(GetCreaturesInMeleeRing(oAttacker,0.0, 359.99f,TRUE,0))-2);&lt;br /&gt;
        fCriticalHitModifier +=  nEnemies * 3.5f;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    // Calculate Flanking Bonus&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    float fFlanking = Combat_GetFlankingBonus(oAttacker, oTarget);&lt;br /&gt;
    if (fFlanking &amp;gt; 0.0 )&lt;br /&gt;
    {&lt;br /&gt;
        // ---------------------------------------------------------------------&lt;br /&gt;
        // Also increase chance for critical hits by 1/5th of the flanking bonus&lt;br /&gt;
        // ---------------------------------------------------------------------&lt;br /&gt;
        fCriticalHitModifier *=  (1.0 + (fFlanking/5.0));&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    // Range plays a role too.&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    float fDistance =  GetDistanceBetween(oAttacker, oTarget);&lt;br /&gt;
    float fNoPenaltyDistance = MaxF(POINT_BLANK_RANGE,GetItemStat(oWeapon, ITEM_STAT_OPTIMUM_RANGE));&lt;br /&gt;
    fDistance = MaxF(fDistance-fNoPenaltyDistance,0.0f);&lt;br /&gt;
&lt;br /&gt;
    float fAttackRoll = 50.0;&lt;br /&gt;
    float fPenalties = fDistance; // every meter distance past the free range is -1!&lt;br /&gt;
    float fAttack = fAttackRating  + fAttackRoll + fFlanking - fPenalties;&lt;br /&gt;
&lt;br /&gt;
    // &amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
    // BEGIN SECTION CRITICAL HITS&lt;br /&gt;
    // &amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        int bThreatenCritical = (RandomFloat()*100.0f   &amp;lt; fCriticalHitModifier  );&lt;br /&gt;
&lt;br /&gt;
        if (!bThreatenCritical)&lt;br /&gt;
        {&lt;br /&gt;
            // ---------------------------------------------------------------------&lt;br /&gt;
            // Attacking out of stealth always threatens crit.&lt;br /&gt;
            // ---------------------------------------------------------------------&lt;br /&gt;
            if (IsModalAbilityActive(oAttacker, ABILITY_SKILL_STEALTH_1))&lt;br /&gt;
            {&lt;br /&gt;
                bThreatenCritical = TRUE;&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
            // -----------------------------------------------------------------&lt;br /&gt;
            // Death hex effect ... all hits are auto crit&lt;br /&gt;
            // -----------------------------------------------------------------&lt;br /&gt;
            if (GetHasEffects(oTarget, EFFECT_TYPE_DEATH_HEX))&lt;br /&gt;
            {&lt;br /&gt;
                bThreatenCritical = TRUE;&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
            // -----------------------------------------------------------------&lt;br /&gt;
            // Autocrit effect&lt;br /&gt;
            // -----------------------------------------------------------------&lt;br /&gt;
            if (GetHasEffects(oAttacker, EFFECT_TYPE_AUTOCRIT))&lt;br /&gt;
            {&lt;br /&gt;
                bThreatenCritical = TRUE;&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        else&lt;br /&gt;
        {&lt;br /&gt;
            // ---------------------------------------------------------------------&lt;br /&gt;
            // Double strike does not allow crits&lt;br /&gt;
            // ---------------------------------------------------------------------&lt;br /&gt;
            if (IsModalAbilityActive(oAttacker, ABILITY_TALENT_DUAL_WEAPON_DOUBLE_STRIKE))&lt;br /&gt;
            {&lt;br /&gt;
                bThreatenCritical = FALSE;&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
            // rapid shot doesn't allow critical strikes&lt;br /&gt;
            if (IsModalAbilityActive(oAttacker, ABILITY_TALENT_RAPIDSHOT))&lt;br /&gt;
            {&lt;br /&gt;
                bThreatenCritical = FALSE;&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        // ---------------------------------------------------------------------&lt;br /&gt;
        // Targets that have critical hit immunity can not be crit...&lt;br /&gt;
        // ---------------------------------------------------------------------&lt;br /&gt;
        if (bThreatenCritical)&lt;br /&gt;
        {&lt;br /&gt;
            Log_Trace_Combat(&amp;quot;combat_h.GetAttackResult&amp;quot;,&amp;quot; Critical hit averted, target has critical hit immunity&amp;quot;, oTarget);&lt;br /&gt;
            bThreatenCritical = !HasAbility(oTarget, ABILITY_TRAIT_CRITICAL_HIT_IMMUNITY);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
    // &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&lt;br /&gt;
    // END SECTION CRITICAL HITS&lt;br /&gt;
    // &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&lt;br /&gt;
&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    // This section deals with calculating the defense values of the attack target&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    float fDefenseRating =  GetCreatureDefense(oTarget) + ((nAttackType == ATTACK_TYPE_RANGED) ? GetCreatureProperty(oTarget,PROPERTY_ATTRIBUTE_MISSILE_SHIELD):0.0f);&lt;br /&gt;
&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    // Easier difficulties grant the player a bonus.&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    fDefenseRating += Diff_GetRulesDefenseBonus(oTarget);&lt;br /&gt;
&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    // A hit is successful if the attack rating exceeds the defense rating&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    if (RandomFloat()*100.0f &amp;lt;  fAttack - fDefenseRating)&lt;br /&gt;
    {&lt;br /&gt;
&lt;br /&gt;
        // ---------------------------------------------------------------------&lt;br /&gt;
        // If we threatened a critical, we crit here, otherwise just report normal hit&lt;br /&gt;
        // ---------------------------------------------------------------------&lt;br /&gt;
        nRet =  ( (bThreatenCritical) ? COMBAT_RESULT_CRITICALHIT : COMBAT_RESULT_HIT  );&lt;br /&gt;
&lt;br /&gt;
        if ( nAttackType == ATTACK_TYPE_MELEE)&lt;br /&gt;
        {&lt;br /&gt;
            // -----------------------------------------------------------------&lt;br /&gt;
            // If we are backstabbing, we change the result here if it&lt;br /&gt;
            // was a crit. Abilities never bs (anim priority)&lt;br /&gt;
            // -----------------------------------------------------------------&lt;br /&gt;
            if ( nAbility == 0 &amp;amp;&amp;amp; Combat_CheckBackstab(oAttacker, oTarget, oWeapon,fFlanking))&lt;br /&gt;
            {&lt;br /&gt;
                    nRet =  COMBAT_RESULT_BACKSTAB;&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    // Miss...&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    else&lt;br /&gt;
    {&lt;br /&gt;
        nRet = COMBAT_RESULT_MISS;&lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    // Misdirection Hex&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    if (GetHasEffects(oAttacker, EFFECT_TYPE_MISDIRECTION_HEX))&lt;br /&gt;
    {&lt;br /&gt;
        #ifdef DEBUG&lt;br /&gt;
        Log_Trace_Combat(&amp;quot;combat_h.GetAttackResult&amp;quot;,&amp;quot; Attacker under misdirection hex: Hits are misses, crits are hits.&amp;quot;, oTarget);&lt;br /&gt;
        #endif&lt;br /&gt;
&lt;br /&gt;
        if (nRet == COMBAT_RESULT_HIT || nRet == COMBAT_RESULT_BACKSTAB)&lt;br /&gt;
        {&lt;br /&gt;
            nRet = COMBAT_RESULT_MISS;&lt;br /&gt;
        }&lt;br /&gt;
        else if (nRet == COMBAT_RESULT_CRITICALHIT)&lt;br /&gt;
        {&lt;br /&gt;
            nRet = COMBAT_RESULT_HIT;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    #ifdef DEBUG&lt;br /&gt;
    Log_Trace_Combat(&amp;quot;combat_h.GetAttackResult&amp;quot;,&amp;quot; ToHit Calculation: &amp;quot; +&lt;br /&gt;
                     &amp;quot; fAttack:&amp;quot;  + ToString(fAttack) +&lt;br /&gt;
                     &amp;quot; = (fAttackRating: &amp;quot; + ToString(fAttackRating) +&lt;br /&gt;
                     &amp;quot; fAttackRoll:&amp;quot; + ToString(fAttackRoll) +&lt;br /&gt;
                     &amp;quot; (range penalty:&amp;quot; + ToString(fPenalties) + &amp;quot;)&amp;quot;+&lt;br /&gt;
                     &amp;quot; fFlanking: &amp;quot; + ToString(fFlanking) +&lt;br /&gt;
                     &amp;quot; fBonus(script): &amp;quot; + ToString(fBonus) +&lt;br /&gt;
                     &amp;quot;)&amp;quot; , oAttacker, oTarget, LOG_CHANNEL_COMBAT_TOHIT );&lt;br /&gt;
&lt;br /&gt;
    Log_Trace_Combat(&amp;quot;combat_h.GetAttackResult&amp;quot;,&amp;quot; ToHit Calculation (2):  &amp;quot; +&lt;br /&gt;
                     &amp;quot; fDefenseRating: &amp;quot; + ToString(fDefenseRating) +&lt;br /&gt;
                     &amp;quot; fCriticalHitModifier: &amp;quot; + ToString(fCriticalHitModifier) +&lt;br /&gt;
                     &amp;quot; bThreatenCritical: &amp;quot; + ToString(bThreatenCritical), oAttacker, oTarget, LOG_CHANNEL_COMBAT_TOHIT );&lt;br /&gt;
&lt;br /&gt;
    #endif&lt;br /&gt;
&lt;br /&gt;
    return nRet;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Combat_CheckBackstab ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
// -----------------------------------------------------------------------------&lt;br /&gt;
// Check if backstab conditions are true&lt;br /&gt;
// -----------------------------------------------------------------------------&lt;br /&gt;
int Combat_CheckBackstab(object oAttacker, object oTarget, object oWeapon, float fFlankingBonus)&lt;br /&gt;
{&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    // If we we are a rogue&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    if (!HasAbility(oAttacker, ABILITY_TALENT_HIDDEN_ROGUE))&lt;br /&gt;
    {&lt;br /&gt;
        return FALSE;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    // Only humanoid rigs have the backstab anim &lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    if (!IsHumanoid(oAttacker))&lt;br /&gt;
    {&lt;br /&gt;
        return FALSE;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    // And target is not immune&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    if (HasAbility(oTarget, ABILITY_TRAIT_CRITICAL_HIT_IMMUNITY))&lt;br /&gt;
    {&lt;br /&gt;
        return FALSE;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    // And attacker does not use double strike mode&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    if (IsModalAbilityActive(oAttacker, ABILITY_TALENT_DUAL_WEAPON_DOUBLE_STRIKE))&lt;br /&gt;
    {&lt;br /&gt;
        return FALSE;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    // We can only backstab if we are flanking.&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    if (fFlankingBonus&amp;gt;0.0)&lt;br /&gt;
    {&lt;br /&gt;
        return TRUE;&lt;br /&gt;
    }&lt;br /&gt;
    else&lt;br /&gt;
    {&lt;br /&gt;
         /* Coup de grace*/&lt;br /&gt;
        if (HasAbility(oAttacker, ABILITY_TALENT_BACKSTAB))&lt;br /&gt;
        {&lt;br /&gt;
            if (GetHasEffects(oTarget, EFFECT_TYPE_STUN))&lt;br /&gt;
            {&lt;br /&gt;
                return TRUE;&lt;br /&gt;
            }&lt;br /&gt;
            else if (GetHasEffects(oTarget, EFFECT_TYPE_PARALYZE))&lt;br /&gt;
            {&lt;br /&gt;
                return TRUE;&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    return FALSE;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Combat_GetFlankingBonus ====&lt;br /&gt;
&lt;br /&gt;
This function is invoked during to hit determination and returns the magnitude &lt;br /&gt;
of the benefit the attacker may receive due to his facing and location relative to &lt;br /&gt;
the target.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
// -----------------------------------------------------------------------------&lt;br /&gt;
// Determine the magnitude of positional bonuses for the attacker&lt;br /&gt;
// -----------------------------------------------------------------------------&lt;br /&gt;
float Combat_GetFlankingBonus(object oAttacker, object oTarget)&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    if (HasAbility(oTarget, ABILITY_TALENT_SHIELD_TACTICS))&lt;br /&gt;
    {&lt;br /&gt;
        if (IsUsingShield(oTarget))&lt;br /&gt;
            return 0.0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    if (GetHasEffects(oTarget, EFFECT_TYPE_FLANK_IMMUNITY))&lt;br /&gt;
    {&lt;br /&gt;
        return 0.0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    float fAngle = GetAngleBetweenObjects(oTarget, oAttacker);&lt;br /&gt;
    float fFactor = 0.0;&lt;br /&gt;
&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    // The maximum bonus from position is +15&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    float fMaxModifier = 15.0;&lt;br /&gt;
&lt;br /&gt;
    // The attackers ability to flank is stored in a creature property&lt;br /&gt;
    float fFlankingAngle = GetCreatureProperty(oAttacker, PROPERTY_ATTRIBUTE_FLANKING_ANGLE);&lt;br /&gt;
&lt;br /&gt;
    if (fFlankingAngle &amp;lt;= 10.0 ) /*old savegames have this at 10*/&lt;br /&gt;
    {&lt;br /&gt;
        fFlankingAngle = 60.0; // old savegames need this to avoid divby0 later&lt;br /&gt;
    }&lt;br /&gt;
    else if (fFlankingAngle&amp;gt;180.0)&lt;br /&gt;
    {&lt;br /&gt;
        fFlankingAngle = 180.0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    // Combat movement expands the maximum bonus to +20&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    if (HasAbility(oAttacker, ABILITY_TALENT_COMBAT_MOVEMENT))&lt;br /&gt;
    {&lt;br /&gt;
        fMaxModifier = 20.0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    if ( fMaxModifier &amp;lt;= 0.0 )&lt;br /&gt;
    {&lt;br /&gt;
        return 0.0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    if ( (fAngle&amp;gt;= (180.0 - fFlankingAngle) &amp;amp;&amp;amp; fAngle&amp;lt;=(180.0 + fFlankingAngle )))&lt;br /&gt;
    {&lt;br /&gt;
        // Shield block negates flanking on the left.&lt;br /&gt;
&lt;br /&gt;
        int bShieldBlock =  HasAbility(oTarget,ABILITY_TALENT_SHIELD_BLOCK);&lt;br /&gt;
        int bUsingShield = IsUsingShield(oTarget);&lt;br /&gt;
&lt;br /&gt;
        if (!bShieldBlock || fAngle &amp;lt; 180.0 || (bShieldBlock &amp;amp;&amp;amp; !bUsingShield) )&lt;br /&gt;
        {&lt;br /&gt;
            fFactor = (fFlankingAngle -  fabs( 180.0 - fAngle))/fFlankingAngle;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // Only rogues get the full positional benefits on the battlefield,&lt;br /&gt;
    // everyone else gets half&lt;br /&gt;
    float fClassModifier = GetCreatureCoreClass(oAttacker) == CLASS_ROGUE?1.0f:0.5f;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    return fFactor * fMaxModifier * fClassModifier;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Scripts]]&lt;/div&gt;</summary>
		<author><name>Georg Zoeller</name></author>	</entry>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=Combat_Rules&amp;diff=7280</id>
		<title>Combat Rules</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=Combat_Rules&amp;diff=7280"/>
				<updated>2009-10-28T02:36:28Z</updated>
		
		<summary type="html">&lt;p&gt;Georg Zoeller: /* Backstab Determination */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''This page is work in progress'''&lt;br /&gt;
&lt;br /&gt;
=== Overview ===&lt;br /&gt;
&lt;br /&gt;
This page describes the technical implementation and flow of combat logic in the game scripts.&lt;br /&gt;
It deals mostly with weapon based combat, for spells and abilities, please see [[Ability|Abilities]].&lt;br /&gt;
&lt;br /&gt;
Note: The term 'property' used on this page refers to [[Creature Properties]].&lt;br /&gt;
&lt;br /&gt;
=== Detailed Description ===&lt;br /&gt;
&lt;br /&gt;
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'.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Hit Resolution  ====&lt;br /&gt;
&lt;br /&gt;
Hit resolution is implemented in the function [[combat_h.nss#Combat_GetAttackResult|Combat_GetAttackResult]] in the script library [[combat_h.nss]], which is invoked from the [[creature_core.nss]] script whenever an attack event is received. The function returns one of several [[COMBAT_RESULT|COMBAT_RESULT_*]] constants and handles messaging to the game engine which animation to play.&lt;br /&gt;
&lt;br /&gt;
Overall, Dragon Age: Origin's combat system is 'hit heavy' as a targets armor does not modify it's chance of getting hit.&lt;br /&gt;
&lt;br /&gt;
The simplified decision tree for to hit resolution is as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if Target Is Placeable Object&lt;br /&gt;
  return COMBAT_RESULT_HIT&lt;br /&gt;
&lt;br /&gt;
if Target Displacement/Dodge &amp;lt; RandomF(100.0)&lt;br /&gt;
  return COMBAT_RESULT_MISS  &lt;br /&gt;
&lt;br /&gt;
if Attacker Is Using BASE_ITEM_TYPE_STAFF&lt;br /&gt;
  return COMBAT_RESULT_HIT&lt;br /&gt;
&lt;br /&gt;
bHit = RandomF(100.0) &amp;lt; AttackRating - DefenseRating&lt;br /&gt;
bCrit = CheckCricital()&lt;br /&gt;
bBackstab = CheckBackstab()&lt;br /&gt;
&lt;br /&gt;
if bHit&lt;br /&gt;
  if  HasEffect(attacker, EFFECT_TYPE_MISDIRECTION_HEX)&lt;br /&gt;
    if bCrit OR bBackstab&lt;br /&gt;
      return COMBAT_RESULT_HIT&lt;br /&gt;
    else&lt;br /&gt;
      return COMBAT_RESULT_MISS&lt;br /&gt;
&lt;br /&gt;
 if bBackstab&lt;br /&gt;
    return COMBAT_RESULT_BACKSTAB&lt;br /&gt;
  else&lt;br /&gt;
     if bCrit&lt;br /&gt;
       return COMBAT_RESULT_CRITICAL_HIT&lt;br /&gt;
     else&lt;br /&gt;
       return  COMBAT_RESULT_HIT&lt;br /&gt;
&lt;br /&gt;
  else&lt;br /&gt;
   return COMBAT_RESULT_MISS&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Attack Rating =====&lt;br /&gt;
&lt;br /&gt;
Attack rating includes:&lt;br /&gt;
&lt;br /&gt;
* Base attack value (54.0f)&lt;br /&gt;
* + [[#Flanking Bonus Determination|Flanking Bonus]] (position based, modified by attacker and enemy talents and effects as well as shields. Rogues have a bonus here).&lt;br /&gt;
* + Distance based penalties (for ranged attacks)&lt;br /&gt;
* + Attacker's attack property value (this includes modifiers from buffs, etc.)&lt;br /&gt;
* + Any +attack item bonuses on the weapon that performs the attack.&lt;br /&gt;
* + Any external bonuses or penalties passed into the function (from talent scripts, etc.)&lt;br /&gt;
* + Difficulty setting based modifications&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== Defense Rating =====&lt;br /&gt;
&lt;br /&gt;
Defense rating includes:&lt;br /&gt;
&lt;br /&gt;
* Defender defense value or missile deflection if attack was ranged. This includes items, effects and magical bonus.&lt;br /&gt;
* Yes, this means that avoiding archers is hard for characters without a shield.&lt;br /&gt;
* Difficulty setting based modifications&lt;br /&gt;
&lt;br /&gt;
===== Flanking Bonus Determination =====&lt;br /&gt;
&lt;br /&gt;
* Flanking bonus is a floating point value that applies to both AttackRating and to the chance to score a critical hit.&lt;br /&gt;
* It is essentially a representation of close the character is to the best position when attacking the enemy (directly in the back)&lt;br /&gt;
* Various shield abilities on the target reduce or prevent the attacker from getting the bonus.&lt;br /&gt;
* The further away the character is from that position, the more the bonus is diluted.&lt;br /&gt;
* The magnitude of 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.&lt;br /&gt;
* Most characters only flank 60 degrees in each direction, combat movement allows an increase to 90 degrees (the full back 180).&lt;br /&gt;
* Only rogues get the full flanking bonus, everyone else still gets half.&lt;br /&gt;
* The full logic is implemented in the function [[combat_h.nss#Combat_GetFlankingBonus|Combat_GetFlankingBonus]] in [[combat_h.nss]].&lt;br /&gt;
&lt;br /&gt;
===== Backstab Determination =====&lt;br /&gt;
&lt;br /&gt;
* Backstab is determined for each melee attack only.&lt;br /&gt;
* Backstab requires the attacker to have a flanking bonus &amp;gt; 0 (some talents waive this restriction)&lt;br /&gt;
* Only creatures with the Rogue [[Classes|Character Class]] may backstab. This is a class benefit.&lt;br /&gt;
* Only humanoid attackers can backstab (this includes darkspawn)&lt;br /&gt;
* The full logic is implemented in the function [[combat_h.nss#Combat_CheckBackstab|Combat_CheckBackstab]] in [[combat_h.nss]].&lt;br /&gt;
&lt;br /&gt;
==== Damage Resolution ====&lt;br /&gt;
&lt;br /&gt;
[[Category: Scripts]]&lt;/div&gt;</summary>
		<author><name>Georg Zoeller</name></author>	</entry>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=Console&amp;diff=7279</id>
		<title>Console</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=Console&amp;diff=7279"/>
				<updated>2009-10-28T02:16:59Z</updated>
		
		<summary type="html">&lt;p&gt;Georg Zoeller: /* Using the console in-game */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Up in the View Menu other windows you will see one called &amp;quot;Console&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
This is where you would enter console commands that allow the toolset to interact with the game engine. It is mostly (if not always) used when you have an area open in the Area Editor.&lt;br /&gt;
&lt;br /&gt;
The console commands were built to work with the game not the toolset but some of them do work with the toolset alone.&lt;br /&gt;
&lt;br /&gt;
Your toolset will crash when using some of them so make sure you save your work before trying them.&lt;br /&gt;
&lt;br /&gt;
== Using the console in-game ==&lt;br /&gt;
&lt;br /&gt;
The in-game console is normally not accessible. To enable it run the game with a command line parameter &amp;quot;enabledeveloperconsole&amp;quot;. Then, when the game is running, press the tilde key (~) to bring up the console. This is a prompt in the upper left corner of the screen. The console was used extensively in development for debugging and testing purposes, but in the finished version of the game there's only one console command available; &amp;quot;runscript&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The runscript command does exactly as it says - it runs a script, given as a name typed after a space. So for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;gt;runscript killallhostiles&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
will cause the script named &amp;quot;killallhostiles&amp;quot; to be run.&lt;br /&gt;
&lt;br /&gt;
You can pass the script additional parameters if you like. These parameters will be stored in the [[module]] variable RUNSCRIPT_VAR. RUNSCRIPT_VAR is a simple string, your script will need to parse it itself.&lt;br /&gt;
&lt;br /&gt;
'''Caution:''' Using scripts like killallhostiles may break scripted plot situations, so you should avoid using it outside of custom content testing.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For example,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;gt;runscript usespecificobject demo100pl_lever&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
calls the script &amp;quot;usespecificobject&amp;quot; and puts &amp;quot;demo100pl_lever&amp;quot; into the module RUNSCRIPT_VAR. The script can then call&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
    string sParam = GetLocalString(GetModule(),&amp;quot;RUNSCRIPT_VAR&amp;quot;);&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to retrieve it.&lt;br /&gt;
&lt;br /&gt;
If you need more than one parameter, pick a separator (a space is usually most appropriate) and split up the string in RUNSCRIPT_VAR appropriately. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
    //parse out first parameter - the object to use.&lt;br /&gt;
    nSpaceLoc = FindSubString(sParam,&amp;quot; &amp;quot;);&lt;br /&gt;
    sTemp = SubString(sParam,0,nSpaceLoc);&lt;br /&gt;
    oDestination = GetObjectByTag(sTemp);&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;/div&gt;</summary>
		<author><name>Georg Zoeller</name></author>	</entry>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=Combat_Rules&amp;diff=7278</id>
		<title>Combat Rules</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=Combat_Rules&amp;diff=7278"/>
				<updated>2009-10-28T02:07:17Z</updated>
		
		<summary type="html">&lt;p&gt;Georg Zoeller: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''This page is work in progress'''&lt;br /&gt;
&lt;br /&gt;
=== Overview ===&lt;br /&gt;
&lt;br /&gt;
This page describes the technical implementation and flow of combat logic in the game scripts.&lt;br /&gt;
It deals mostly with weapon based combat, for spells and abilities, please see [[Ability|Abilities]].&lt;br /&gt;
&lt;br /&gt;
Note: The term 'property' used on this page refers to [[Creature Properties]].&lt;br /&gt;
&lt;br /&gt;
=== Detailed Description ===&lt;br /&gt;
&lt;br /&gt;
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'.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Hit Resolution  ====&lt;br /&gt;
&lt;br /&gt;
Hit resolution is implemented in the function [[combat_h.nss#Combat_GetAttackResult|Combat_GetAttackResult]] in the script library [[combat_h.nss]], which is invoked from the [[creature_core.nss]] script whenever an attack event is received. The function returns one of several [[COMBAT_RESULT|COMBAT_RESULT_*]] constants and handles messaging to the game engine which animation to play.&lt;br /&gt;
&lt;br /&gt;
Overall, Dragon Age: Origin's combat system is 'hit heavy' as a targets armor does not modify it's chance of getting hit.&lt;br /&gt;
&lt;br /&gt;
The simplified decision tree for to hit resolution is as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if Target Is Placeable Object&lt;br /&gt;
  return COMBAT_RESULT_HIT&lt;br /&gt;
&lt;br /&gt;
if Target Displacement/Dodge &amp;lt; RandomF(100.0)&lt;br /&gt;
  return COMBAT_RESULT_MISS  &lt;br /&gt;
&lt;br /&gt;
if Attacker Is Using BASE_ITEM_TYPE_STAFF&lt;br /&gt;
  return COMBAT_RESULT_HIT&lt;br /&gt;
&lt;br /&gt;
bHit = RandomF(100.0) &amp;lt; AttackRating - DefenseRating&lt;br /&gt;
bCrit = CheckCricital()&lt;br /&gt;
bBackstab = CheckBackstab()&lt;br /&gt;
&lt;br /&gt;
if bHit&lt;br /&gt;
  if  HasEffect(attacker, EFFECT_TYPE_MISDIRECTION_HEX)&lt;br /&gt;
    if bCrit OR bBackstab&lt;br /&gt;
      return COMBAT_RESULT_HIT&lt;br /&gt;
    else&lt;br /&gt;
      return COMBAT_RESULT_MISS&lt;br /&gt;
&lt;br /&gt;
 if bBackstab&lt;br /&gt;
    return COMBAT_RESULT_BACKSTAB&lt;br /&gt;
  else&lt;br /&gt;
     if bCrit&lt;br /&gt;
       return COMBAT_RESULT_CRITICAL_HIT&lt;br /&gt;
     else&lt;br /&gt;
       return  COMBAT_RESULT_HIT&lt;br /&gt;
&lt;br /&gt;
  else&lt;br /&gt;
   return COMBAT_RESULT_MISS&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Attack Rating =====&lt;br /&gt;
&lt;br /&gt;
Attack rating includes:&lt;br /&gt;
&lt;br /&gt;
* Base attack value (54.0f)&lt;br /&gt;
* + [[#Flanking Bonus Determination|Flanking Bonus]] (position based, modified by attacker and enemy talents and effects as well as shields. Rogues have a bonus here).&lt;br /&gt;
* + Distance based penalties (for ranged attacks)&lt;br /&gt;
* + Attacker's attack property value (this includes modifiers from buffs, etc.)&lt;br /&gt;
* + Any +attack item bonuses on the weapon that performs the attack.&lt;br /&gt;
* + Any external bonuses or penalties passed into the function (from talent scripts, etc.)&lt;br /&gt;
* + Difficulty setting based modifications&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== Defense Rating =====&lt;br /&gt;
&lt;br /&gt;
Defense rating includes:&lt;br /&gt;
&lt;br /&gt;
* Defender defense value or missile deflection if attack was ranged. This includes items, effects and magical bonus.&lt;br /&gt;
* Yes, this means that avoiding archers is hard for characters without a shield.&lt;br /&gt;
* Difficulty setting based modifications&lt;br /&gt;
&lt;br /&gt;
===== Flanking Bonus Determination =====&lt;br /&gt;
&lt;br /&gt;
* Flanking bonus is a floating point value that applies to both AttackRating and to the chance to score a critical hit.&lt;br /&gt;
* It is essentially a representation of close the character is to the best position when attacking the enemy (directly in the back)&lt;br /&gt;
* Various shield abilities on the target reduce or prevent the attacker from getting the bonus.&lt;br /&gt;
* The further away the character is from that position, the more the bonus is diluted.&lt;br /&gt;
* The magnitude of 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.&lt;br /&gt;
* Most characters only flank 60 degrees in each direction, combat movement allows an increase to 90 degrees (the full back 180).&lt;br /&gt;
* Only rogues get the full flanking bonus, everyone else still gets half.&lt;br /&gt;
* The full logic is implemented in the function [[combat_h.nss#Combat_GetFlankingBonus|Combat_GetFlankingBonus]] in [[combat_h.nss]].&lt;br /&gt;
&lt;br /&gt;
===== Backstab Determination =====&lt;br /&gt;
&lt;br /&gt;
* Backstab is determined for each melee attack only.&lt;br /&gt;
* Only creatures with the Rogue [[Classes|Character Class]] may backstab. This is a class benefit.&lt;br /&gt;
* Only humanoid attackers can backstab (this includes darkspawn)&lt;br /&gt;
* The full logic is implemented in the function [[combat_h.nss#Combat_CheckBackstab|Combat_CheckBackstab]] in [[combat_h.nss]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Damage Resolution ====&lt;br /&gt;
&lt;br /&gt;
[[Category: Scripts]]&lt;/div&gt;</summary>
		<author><name>Georg Zoeller</name></author>	</entry>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=Combat_Rules&amp;diff=7251</id>
		<title>Combat Rules</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=Combat_Rules&amp;diff=7251"/>
				<updated>2009-10-28T00:24:26Z</updated>
		
		<summary type="html">&lt;p&gt;Georg Zoeller: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''This page is work in progress'''&lt;br /&gt;
&lt;br /&gt;
=== Overview ===&lt;br /&gt;
&lt;br /&gt;
This page describes the technical implementation and flow of combat logic in the game scripts.&lt;br /&gt;
It deals mostly with weapon based combat, for spells and abilities, please see [[Ability|Abilities]].&lt;br /&gt;
&lt;br /&gt;
Note: The term 'property' used on this page refers to [[Creature Properties]].&lt;br /&gt;
&lt;br /&gt;
=== Detailed Description ===&lt;br /&gt;
&lt;br /&gt;
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'.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Hit Resolution  ====&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
Overall, Dragon Age: Origin's combat system is 'hit heavy' as a targets armor does not modify it's chance of getting hit.&lt;br /&gt;
&lt;br /&gt;
The simplified decision tree for to hit resolution is as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if Target Is Placeable Object&lt;br /&gt;
  return COMBAT_RESULT_HIT&lt;br /&gt;
&lt;br /&gt;
if Target Displacement/Dodge &amp;lt; RandomF(100.0)&lt;br /&gt;
  return COMBAT_RESULT_MISS  &lt;br /&gt;
&lt;br /&gt;
if Attacker Is Using BASE_ITEM_TYPE_STAFF&lt;br /&gt;
  return COMBAT_RESULT_HIT&lt;br /&gt;
&lt;br /&gt;
bHit = RandomF(100.0) &amp;lt; AttackRating - DefenseRating&lt;br /&gt;
bCrit = CheckCricital()&lt;br /&gt;
bBackstab = CheckBackstab()&lt;br /&gt;
&lt;br /&gt;
if bHit&lt;br /&gt;
  if  HasEffect(attacker, EFFECT_TYPE_MISDIRECTION_HEX)&lt;br /&gt;
    if bCrit OR bBackstab&lt;br /&gt;
      return COMBAT_RESULT_MISS&lt;br /&gt;
    else&lt;br /&gt;
      return COMBAT_RESULT_HIT&lt;br /&gt;
&lt;br /&gt;
 if bBackstab&lt;br /&gt;
    return COMBAT_RESULT_BACKSTAB&lt;br /&gt;
  else&lt;br /&gt;
     if bCrit&lt;br /&gt;
       return COMBAT_RESULT_CRITICAL_HIT&lt;br /&gt;
     else&lt;br /&gt;
       return  COMBAT_RESULT_HIT&lt;br /&gt;
&lt;br /&gt;
  else&lt;br /&gt;
   return COMBAT_RESULT_MISS&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
AttackRating includes: &lt;br /&gt;
* Base attack value (54.0f)&lt;br /&gt;
* Flanking bonus (position based, modified by attacker and enemy talents and effects as well as shields. Rogues have a bonus here).&lt;br /&gt;
* Distance based penalties (for ranged attacks)&lt;br /&gt;
* Attacker's attack property value (this includes modifiers from buffs, etc.)&lt;br /&gt;
* Any +attack item bonuses on the weapon that performs the attack.&lt;br /&gt;
* Any external bonuses or penalties passed into the function (from talent scripts, etc.)&lt;br /&gt;
* Difficulty setting based modifications&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
DefenseRating includes:&lt;br /&gt;
* Defender defense value or missile deflection if attack was ranged. This includes items, effects and magical boni.&lt;br /&gt;
* Difficulty setting based modifications&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Damage Resolution ====&lt;/div&gt;</summary>
		<author><name>Georg Zoeller</name></author>	</entry>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=Combat_Rules&amp;diff=7250</id>
		<title>Combat Rules</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=Combat_Rules&amp;diff=7250"/>
				<updated>2009-10-28T00:22:19Z</updated>
		
		<summary type="html">&lt;p&gt;Georg Zoeller: /* Damage Resolution */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''This page is work in progress'''&lt;br /&gt;
&lt;br /&gt;
=== Overview ===&lt;br /&gt;
&lt;br /&gt;
This page describes the technical implementation and flow of combat logic in the game scripts.&lt;br /&gt;
It deals mostly with weapon based combat, for spells and abilities, please see [[Ability|Abilities]].&lt;br /&gt;
&lt;br /&gt;
Note: The term 'property' used on this page refers to [[Creature Properties]].&lt;br /&gt;
&lt;br /&gt;
=== Detailed Description ===&lt;br /&gt;
&lt;br /&gt;
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'.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Hit Resolution  ====&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The simplified decision tree for to hit resolution is as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if Target Is Placeable Object&lt;br /&gt;
  return COMBAT_RESULT_HIT&lt;br /&gt;
&lt;br /&gt;
if Target Displacement &amp;lt; RandomF(100.0)&lt;br /&gt;
  return COMBAT_RESULT_MISS  &lt;br /&gt;
&lt;br /&gt;
if Attacker Is Using BASE_ITEM_TYPE_STAFF&lt;br /&gt;
  return COMBAT_RESULT_HIT&lt;br /&gt;
&lt;br /&gt;
bHit = RandomF(100.0) &amp;lt; AttackRating - DefenseRating&lt;br /&gt;
bCrit = CheckCricital()&lt;br /&gt;
bBackstab = CheckBackstab()&lt;br /&gt;
&lt;br /&gt;
if bHit&lt;br /&gt;
  if  HasEffect(attacker, EFFECT_TYPE_MISDIRECTION_HEX)&lt;br /&gt;
    if bCrit OR bBackstab&lt;br /&gt;
      return COMBAT_RESULT_MISS&lt;br /&gt;
    else&lt;br /&gt;
      return COMBAT_RESULT_HIT&lt;br /&gt;
&lt;br /&gt;
 if bBackstab&lt;br /&gt;
    return COMBAT_RESULT_BACKSTAB&lt;br /&gt;
  else&lt;br /&gt;
     if bCrit&lt;br /&gt;
       return COMBAT_RESULT_CRITICAL_HIT&lt;br /&gt;
     else&lt;br /&gt;
       return  COMBAT_RESULT_HIT&lt;br /&gt;
&lt;br /&gt;
  else&lt;br /&gt;
   return COMBAT_RESULT_MISS&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
AttackRating includes: &lt;br /&gt;
* Base attack value (54.0f)&lt;br /&gt;
* Flanking bonus (position based, modified by attacker and enemy talents and effects as well as shields. Rogues have a bonus here).&lt;br /&gt;
* Distance based penalties (for ranged attacks)&lt;br /&gt;
* Attacker's attack property value (this includes modifiers from buffs, etc.)&lt;br /&gt;
* Any +attack item bonuses on the weapon that performs the attack.&lt;br /&gt;
* Any external bonuses or penalties passed into the function (from talent scripts, etc.)&lt;br /&gt;
* Difficulty setting based modifications&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
DefenseRating includes:&lt;br /&gt;
* Defender defense value or missile deflection if attack was ranged. This includes items, effects and magical boni.&lt;br /&gt;
* Difficulty setting based modifications&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Damage Resolution ====&lt;/div&gt;</summary>
		<author><name>Georg Zoeller</name></author>	</entry>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=Combat_Rules&amp;diff=7249</id>
		<title>Combat Rules</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=Combat_Rules&amp;diff=7249"/>
				<updated>2009-10-28T00:22:12Z</updated>
		
		<summary type="html">&lt;p&gt;Georg Zoeller: /* Hit Resolution */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''This page is work in progress'''&lt;br /&gt;
&lt;br /&gt;
=== Overview ===&lt;br /&gt;
&lt;br /&gt;
This page describes the technical implementation and flow of combat logic in the game scripts.&lt;br /&gt;
It deals mostly with weapon based combat, for spells and abilities, please see [[Ability|Abilities]].&lt;br /&gt;
&lt;br /&gt;
Note: The term 'property' used on this page refers to [[Creature Properties]].&lt;br /&gt;
&lt;br /&gt;
=== Detailed Description ===&lt;br /&gt;
&lt;br /&gt;
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'.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Hit Resolution  ====&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The simplified decision tree for to hit resolution is as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if Target Is Placeable Object&lt;br /&gt;
  return COMBAT_RESULT_HIT&lt;br /&gt;
&lt;br /&gt;
if Target Displacement &amp;lt; RandomF(100.0)&lt;br /&gt;
  return COMBAT_RESULT_MISS  &lt;br /&gt;
&lt;br /&gt;
if Attacker Is Using BASE_ITEM_TYPE_STAFF&lt;br /&gt;
  return COMBAT_RESULT_HIT&lt;br /&gt;
&lt;br /&gt;
bHit = RandomF(100.0) &amp;lt; AttackRating - DefenseRating&lt;br /&gt;
bCrit = CheckCricital()&lt;br /&gt;
bBackstab = CheckBackstab()&lt;br /&gt;
&lt;br /&gt;
if bHit&lt;br /&gt;
  if  HasEffect(attacker, EFFECT_TYPE_MISDIRECTION_HEX)&lt;br /&gt;
    if bCrit OR bBackstab&lt;br /&gt;
      return COMBAT_RESULT_MISS&lt;br /&gt;
    else&lt;br /&gt;
      return COMBAT_RESULT_HIT&lt;br /&gt;
&lt;br /&gt;
 if bBackstab&lt;br /&gt;
    return COMBAT_RESULT_BACKSTAB&lt;br /&gt;
  else&lt;br /&gt;
     if bCrit&lt;br /&gt;
       return COMBAT_RESULT_CRITICAL_HIT&lt;br /&gt;
     else&lt;br /&gt;
       return  COMBAT_RESULT_HIT&lt;br /&gt;
&lt;br /&gt;
  else&lt;br /&gt;
   return COMBAT_RESULT_MISS&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
AttackRating includes: &lt;br /&gt;
* Base attack value (54.0f)&lt;br /&gt;
* Flanking bonus (position based, modified by attacker and enemy talents and effects as well as shields. Rogues have a bonus here).&lt;br /&gt;
* Distance based penalties (for ranged attacks)&lt;br /&gt;
* Attacker's attack property value (this includes modifiers from buffs, etc.)&lt;br /&gt;
* Any +attack item bonuses on the weapon that performs the attack.&lt;br /&gt;
* Any external bonuses or penalties passed into the function (from talent scripts, etc.)&lt;br /&gt;
* Difficulty setting based modifications&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
DefenseRating includes:&lt;br /&gt;
* Defender defense value or missile deflection if attack was ranged. This includes items, effects and magical boni.&lt;br /&gt;
* Difficulty setting based modifications&lt;br /&gt;
&lt;br /&gt;
==== Damage Resolution ====&lt;/div&gt;</summary>
		<author><name>Georg Zoeller</name></author>	</entry>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=Combat_Rules&amp;diff=7248</id>
		<title>Combat Rules</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=Combat_Rules&amp;diff=7248"/>
				<updated>2009-10-28T00:21:50Z</updated>
		
		<summary type="html">&lt;p&gt;Georg Zoeller: Combat resolution formulas&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''This page is work in progress'''&lt;br /&gt;
&lt;br /&gt;
=== Overview ===&lt;br /&gt;
&lt;br /&gt;
This page describes the technical implementation and flow of combat logic in the game scripts.&lt;br /&gt;
It deals mostly with weapon based combat, for spells and abilities, please see [[Ability|Abilities]].&lt;br /&gt;
&lt;br /&gt;
Note: The term 'property' used on this page refers to [[Creature Properties]].&lt;br /&gt;
&lt;br /&gt;
=== Detailed Description ===&lt;br /&gt;
&lt;br /&gt;
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'.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Hit Resolution  ====&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The simplified decision tree for to hit resolution is as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if Target Is Placeable Object&lt;br /&gt;
  return COMBAT_RESULT_HIT&lt;br /&gt;
&lt;br /&gt;
if Target Displacement &amp;lt; RandomF(100.0)&lt;br /&gt;
  return COMBAT_RESULT_MISS  &lt;br /&gt;
&lt;br /&gt;
if Attacker Is Using BASE_ITEM_TYPE_STAFF&lt;br /&gt;
  return COMBAT_RESULT_HIT&lt;br /&gt;
&lt;br /&gt;
bHit = RandomF(100.0) &amp;lt; AttackRating - DefenseRating&lt;br /&gt;
bCrit = CheckCricital()&lt;br /&gt;
bBackstab = CheckBackstab()&lt;br /&gt;
&lt;br /&gt;
if bHit&lt;br /&gt;
  if  HasEffect(attacker, EFFECT_TYPE_MISDIRECTION_HEX)&lt;br /&gt;
    if bCrit OR bBackstab&lt;br /&gt;
      return COMBAT_RESULT_MISS&lt;br /&gt;
    else&lt;br /&gt;
      return COMBAT_RESULT_HIT&lt;br /&gt;
&lt;br /&gt;
 if bBackstab&lt;br /&gt;
    return COMBAT_RESULT_BACKSTAB&lt;br /&gt;
  else&lt;br /&gt;
     if bCrit&lt;br /&gt;
       return COMBAT_RESULT_CRITICAL_HIT&lt;br /&gt;
     else&lt;br /&gt;
       return  COMBAT_RESULT_HIT&lt;br /&gt;
&lt;br /&gt;
  else&lt;br /&gt;
   return COMBAT_RESULT_MISS&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
AttackRating includes: &lt;br /&gt;
* Base attack value (54.0f)&lt;br /&gt;
* Flanking bonus (position based, modified by attacker and enemy talents and effects as well as shields. Rogues have a bonus here).&lt;br /&gt;
* Distance based penalties (for ranged attacks)&lt;br /&gt;
* Attacker's attack property value (this includes modifiers from buffs, etc.)&lt;br /&gt;
* Any +attack item bonuses on the weapon that performs the attack.&lt;br /&gt;
* Any external bonuses or penalties passed into the function (from talent scripts, etc.)&lt;br /&gt;
* Difficulty setting based modifications&lt;br /&gt;
&lt;br /&gt;
DefenseRating includes:&lt;br /&gt;
* Defender defense value or missile deflection if attack was ranged. This includes items, effects and magical boni.&lt;br /&gt;
* Difficulty setting based modifications&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Damage Resolution ====&lt;/div&gt;</summary>
		<author><name>Georg Zoeller</name></author>	</entry>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=Script.ldf&amp;diff=7247</id>
		<title>Script.ldf</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=Script.ldf&amp;diff=7247"/>
				<updated>2009-10-27T23:21:48Z</updated>
		
		<summary type="html">&lt;p&gt;Georg Zoeller: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Script.ldf is a header file that contains the engine-defined functions of the Dragon Age scripting language. These functions represent the lowest &amp;quot;level&amp;quot; that scripting has access to and many of them are only routinely accessed via wrapper functions defined in core include files.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;margin:0; background:#f5fffa; border:1px solid #a3bfb1; text-align:left; color:#000; padding:0.2em 0.4em; width:100%;  height:100%&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| valign=&amp;quot;top&amp;quot;|&lt;br /&gt;
&amp;lt;h2 style=&amp;quot;margin:0; background:red; font-size:150%; font-weight:bold; border:1px solid #a3bfb1; text-align:left; color:#fff; padding:0.2em 0.4em;&amp;quot;&amp;gt;Caution&amp;lt;/h2&amp;gt;&lt;br /&gt;
This file should never be modified by content creators.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:Scripts]]&lt;/div&gt;</summary>
		<author><name>Georg Zoeller</name></author>	</entry>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=Classes&amp;diff=7246</id>
		<title>Classes</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=Classes&amp;diff=7246"/>
				<updated>2009-10-27T23:16:17Z</updated>
		
		<summary type="html">&lt;p&gt;Georg Zoeller: /* Description */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Work in progress''&lt;br /&gt;
&lt;br /&gt;
=== Overview ===&lt;br /&gt;
&lt;br /&gt;
Dragon Age: Origins is a strongly class based RPG featuring 3 distinct character classes with exclusive abilities and progressions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Description ===&lt;br /&gt;
&lt;br /&gt;
This page explains the technical implementation and role of character classes in Dragon Age: Origins and is aimed at people wishing to create new content, modifications or adventures using the Dragon Age ruleset.&lt;br /&gt;
&lt;br /&gt;
The classes of the game are defined in '''[[CLA_base.xls]]'''.  &lt;br /&gt;
The following is an excerpt of the game rules and systems relevant columns in the file and illustrates how data relating to character class is stored.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; width=&amp;quot;100%&amp;quot; style=&amp;quot;font-size:xx-small&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|'''ID'''||'''Label'''||'''BaseHealth'''||'''BaseManaStamina'''||'''DepletableProgression'''||'''StrAdjust'''||'''ConAdjust'''||'''WillAdjust'''||'''MagAdjust'''||'''IntAdjust'''||'''DexAdjust'''||'''BaseAttack'''||'''BaseDefense'''||'''DefensePerLevel'''||'''HealthPerLevel'''||'''LevelsPerAbility'''||'''LevelsPerSkill'''||'''DamagePerLevel'''&lt;br /&gt;
|-&lt;br /&gt;
|0||INVALID||****||****||****||****||****||****||****||****||****||****||****||****||****||****||****||****|&lt;br /&gt;
|-&lt;br /&gt;
|1||Warrior||100||100||5||4||3||0||0||0||3||60||45||1||6||1||3||0.4&lt;br /&gt;
|-&lt;br /&gt;
|2||Wizard||85||115||6||0||0||4||5||1||0||50||40||1||4||1||3||0.1&lt;br /&gt;
|-&lt;br /&gt;
|3||Rogue||90||90||4||0||0||2||0||4||4||55||50||1||5||1||2||0.2&lt;br /&gt;
|-|&lt;br /&gt;
|}&lt;br /&gt;
For details on the meaning of each column, please refer to '''[[CLA_base.xls]]'''.&lt;br /&gt;
&lt;br /&gt;
=== Character Creation Scripting === &lt;br /&gt;
&lt;br /&gt;
Dragon Age characters are 'blank' when the game starts, with all their [[Creature Properties]] initialized to default values. &lt;br /&gt;
&lt;br /&gt;
The character generation scripts, through interaction through the Character Creation UIs, use the data in [[CLA_base.xls]] to construct the character based on the player's choices and are also responsible for any modification to the character's base stats during the Levelup process.&lt;br /&gt;
&lt;br /&gt;
Note that major party members will use the character creation scripts, hostile enemies use a speed optimized and abreviated algorithm to determine their attributes based on rank, AI package and level. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Scripts ====&lt;br /&gt;
&lt;br /&gt;
The scripts that handle most of character creation and levelup are:&lt;br /&gt;
&lt;br /&gt;
* sys_chargen - Entry point for all character creation based [[Event]]s that get routed into this file from module_core.nss. &lt;br /&gt;
* sys_chargen_h - Library containing most of the underlying logic for modifying [[Creature Properties]] based on the game rules.&lt;br /&gt;
* sys_chargen_engine - Include defining a few constants and containing some snippets of relevant engine code for reference.&lt;br /&gt;
* sys_autolevelup_h - File defining the logic used by Party Member NPCs to level up when they are hired. After that, they use normal levelup.&lt;br /&gt;
* sys_autoscale_h - Contains shared logic used for determining levelup condition and code for creature autoscaling.&lt;br /&gt;
* sys_rewards_h - File containing XP reward entry point and levelup checks.&lt;br /&gt;
&lt;br /&gt;
[[Category: Scripting]]&lt;/div&gt;</summary>
		<author><name>Georg Zoeller</name></author>	</entry>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=CLA_base.xls&amp;diff=7245</id>
		<title>CLA base.xls</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=CLA_base.xls&amp;diff=7245"/>
				<updated>2009-10-27T23:11:13Z</updated>
		
		<summary type="html">&lt;p&gt;Georg Zoeller: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This 2da file is used to define the [[Classes|Character Classes]] available in Dragon Age: Origins.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== CLA_data worksheet ==&lt;br /&gt;
&lt;br /&gt;
{{2da start|CLA_data}}&lt;br /&gt;
{{2da column| Label | string | }}&lt;br /&gt;
{{2da column| NameStrref |int| the reference ID number of a string in the string table that has this class' name in it. Use the [[String Editor]] to view strings by ID.}}&lt;br /&gt;
{{2da column| PluralStrref | int | a string in the string table with the class' name, pluralized}}&lt;br /&gt;
{{2da column| LowerStrref | int | }}&lt;br /&gt;
{{2da column| DescStrref| int | A short description of the class.}}&lt;br /&gt;
{{2da column| TooltipStrref |int| Tooltip text for the class.}}&lt;br /&gt;
{{2da column| Icon | resource | Icon used to represent this class in character generation.}}&lt;br /&gt;
{{2da column| Constant | string|  The name of the constant used in scripts to refer to this class. eg, &amp;quot;CLASS_Warrior&amp;quot;.}}&lt;br /&gt;
{{2da column| Package | int | }}&lt;br /&gt;
{{2da column| BaseHealth | float | Start health }}&lt;br /&gt;
{{2da column| bUsesMana |int| 0 sets this class to use stamina for its abilities, 1 sets it to use mana.}}&lt;br /&gt;
{{2da column| BaseManaStamina | float | Start mana / stamina }}&lt;br /&gt;
{{2da column| DepletableProgression | float | How much stamina/mana the class gets every level after 1. }}&lt;br /&gt;
{{2da column| StrAdjust |float| a bonus this class gets to starting strength attribute }}&lt;br /&gt;
{{2da column| ConAdjust |float| a bonus this class gets to starting constitution attribute }}&lt;br /&gt;
{{2da column| WillAdjust |float| a bonus this class gets to starting willpower attribute }}&lt;br /&gt;
{{2da column| MagAdjust |float| a bonus this class gets to starting magic attribute }}&lt;br /&gt;
{{2da column| IntAdjust |float| a bonus this class gets to starting cunning attribute }}&lt;br /&gt;
{{2da column| DexAdjust |float| a bonus this class gets to starting dexterity attribute }}&lt;br /&gt;
{{2da column| MinLevel |int| The prerequesite level a character must be to take this class. If it's greater than zero, it's an advanced class. '''Note: this column is a remnant of when specialization classes were included in the base class 2DA; this approach is no longer used.'''}}&lt;br /&gt;
{{2da column| BaseClass |int| For advanced classes, this sets which base class it is an advanced class of. The number here refers to the ID of the row that it's a advanced class for. '''Note: this column is a remnant of when specialization classes were included in the base class 2DA; this approach is no longer used.'''}}&lt;br /&gt;
{{2da column| BaseAttack | float | }}&lt;br /&gt;
{{2da column| BaseDefense | float | }}&lt;br /&gt;
{{2da column| DefensePerLevel | float | }}&lt;br /&gt;
{{2da column| HealthPerLevel | float | }}&lt;br /&gt;
{{2da column| LevelsPerAbility | int | How many levels before gaining an ability. Example. If a 3 is here, it means you get an ability on every level divisible by 3}}&lt;br /&gt;
{{2da column| LevelsPerSkill | int | How many levels before gaining a skill. Example. If a 3 is here, it means you get an ability on every level divisible by 3}}&lt;br /&gt;
{{2da column| DamagePerLevel | float | This was a fudge added to the rule system to diminish the power that Strength's bonus damage had. Basically, this is just added to the base damage bonus of the character.}}&lt;br /&gt;
{{2da column| StartingAbility1 | int | This is an index into the ABI 2da. If its valid it will add that ability to the character when you first take a level with the class. This is used for the hidden talent that all classes get. This talent is used in subsequent prereq checks}}&lt;br /&gt;
{{2da column| StartingAbility2 | int | This is an index into the ABI 2da. If its valid it will add that ability to the character when you first take a level with the class.}}&lt;br /&gt;
{{2da column| PlayerClass |int| Determines whether this class can be taken by a player.}}&lt;br /&gt;
{{2da column| CharGenLabel| string| }}&lt;br /&gt;
{{2da column| Achievement | string| Required Achievement to unlock this class permanently}}&lt;br /&gt;
{{2da end}}&lt;br /&gt;
[[Category:2DAs]]&lt;/div&gt;</summary>
		<author><name>Georg Zoeller</name></author>	</entry>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=Event_keyword&amp;diff=7243</id>
		<title>Event keyword</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=Event_keyword&amp;diff=7243"/>
				<updated>2009-10-27T22:52:11Z</updated>
		
		<summary type="html">&lt;p&gt;Georg Zoeller: /* Persistence */  Removed section, these scripting functions are not used.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
The '''event''' type represents a package of information that can be passed around in the game to trigger some behaviour.&lt;br /&gt;
&lt;br /&gt;
== Constructor ==&lt;br /&gt;
&lt;br /&gt;
A constructor is a function that creates an instance of a [[DAScript_types|dascript type]].&lt;br /&gt;
&lt;br /&gt;
The constructor for an event is [[Event]].&lt;br /&gt;
&lt;br /&gt;
== Literals ==&lt;br /&gt;
&lt;br /&gt;
A literal is a textual representation of a particular value of a type. &lt;br /&gt;
&lt;br /&gt;
There is no literal for an event.&lt;br /&gt;
&lt;br /&gt;
== Conversion ==&lt;br /&gt;
&lt;br /&gt;
There is no explicit or implicit conversion to or from an event.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
    // uninitialised&lt;br /&gt;
    event evDefault;&lt;br /&gt;
 &lt;br /&gt;
    // initialised using the constructor&lt;br /&gt;
    event evConstructed = Event(EVENT_TYPE_USE);&lt;br /&gt;
&lt;br /&gt;
    // initialised using a function&lt;br /&gt;
    event evCurrent = GetCurrentEvent();    &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Remarks ==&lt;br /&gt;
&lt;br /&gt;
Events are usually passed off to an [[object (dascript type)|object's]] [[event script]] for handling, but there are a few engine-only event types that are not exposed to the end-users. &lt;br /&gt;
&lt;br /&gt;
Scripting Events have an integer type, target object, a time delay and a package of parameters (arbitrary number of [[int (dascript type)|ints]], [[object (dascript type)|objects]], [[float (dascript type)|floats]] and [[string (dascript type)|strings]]).  Certain event types will be defined by the engine and referenced as #defines in the scripts.&lt;br /&gt;
&lt;br /&gt;
Events are handled in the scripting language with the following types of commands:&lt;br /&gt;
* Event() Constructor —  Scripters can create events of any type and signal them to other objects&lt;br /&gt;
* Signal Event commands —  Events can be signalled to a single object, by proximity or to all objects with a certain group id&lt;br /&gt;
* Parameter access —  All of the parameters on an event can be get and set through scripting.&lt;br /&gt;
* Event handling —  Events can be passed to other script files through the HandleEvent command.  This command will be run inline so that hierarchies of event-handling behaviour can be built.&lt;br /&gt;
&lt;br /&gt;
A typical event-handling script would have the form&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
    event ev = GetCurrentEvent();&lt;br /&gt;
    int nEventType = GetEventType(ev); //extract event type from current event&lt;br /&gt;
    int nEventHandled = FALSE; //keep track of whether the event has been handled&lt;br /&gt;
    switch(nEventType)&lt;br /&gt;
    {&lt;br /&gt;
         case EVENT_TYPE_AREALOAD_SPECIAL:&lt;br /&gt;
         {&lt;br /&gt;
             ...&lt;br /&gt;
             nEventHandled = TRUE; //set this if no further action is required for this event&lt;br /&gt;
             break;&lt;br /&gt;
         }&lt;br /&gt;
    }&lt;br /&gt;
    if (!nEventHandled) //If this event wasn't handled by this script, let the core script try&lt;br /&gt;
    {&lt;br /&gt;
        HandleEvent(ev, RESOURCE_SCRIPT_AREA_CORE);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the event that you want to intercept some events but leave others to be handled by a default script (for example if you're overriding one aspect of a creature's event response but the rest of the default creature_core responses responses are fine) you can pass execution to the default script with the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
    HandleEvent(ev, RESOURCE_SCRIPT_CREATURE_CORE);&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(constants for referencing core script resources are available in the &amp;quot;global_objects_h&amp;quot; include file)&lt;br /&gt;
&lt;br /&gt;
Below is a list of the event types that are defined within the core resources:&lt;br /&gt;
&lt;br /&gt;
* '''Perception'''&lt;br /&gt;
** [[EVENT_TYPE_PERCEPTION_APPEAR]] - A creature enters the perception area of creature receiving the event &lt;br /&gt;
** [[EVENT_TYPE_PERCEPTION_DISAPPEAR]] - A creature exits the perception area of creature receiving the event&lt;br /&gt;
* '''Effects'''&lt;br /&gt;
**[[EVENT_TYPE_APPLY_EFFECT]] - an effect is applied to the receiving object&lt;br /&gt;
**[[EVENT_TYPE_REMOVE_EFFECT]] - an effect is removed from the receiving object&lt;br /&gt;
* '''Combat'''&lt;br /&gt;
**[[ EVENT_TYPE_COMBAT_INITIATED ]] - Fires whenever the attack command is added into the command queue. Used to set combat mode and combat camera/music. Also fires by scripting to trigger combat after being attacked or an ally is attack. &lt;br /&gt;
**[[ EVENT_TYPE_COMBAT_END ]] - a creature doesn't perceive any more hostiles. &lt;br /&gt;
**[[ EVENT_TYPE_MELEE_ATTACK_START ]] - {{undocumented}}&lt;br /&gt;
**[[ EVENT_TYPE_COMMAND_PENDING ]] - Fires at the beginning of the attack part of the attack command OR at the beginning of an ability execution. &lt;br /&gt;
**[[ EVENT_TYPE_COMMAND_COMPLETE ]] - creature finishes doing a command(attack, special ability, spell, conversation, etc) &lt;br /&gt;
**[[ EVENT_TYPE_ATTACK_IMPACT ]] -- An attack has impacted the target. This can be melee (sword hit), ranged (arrow hit) or spell (fireball explodes). Used for applying damage, and handling abilities that function on hit (Berserk etc'). &lt;br /&gt;
**[[ EVENT_TYPE_ATTACKED ]] - another object tried attacking this creature using melee/ranged weapons (hit or miss), talents or spells. &lt;br /&gt;
**[[ EVENT_TYPE_ALLY_ATTACKED ]] - an ally has received the ATTACKED event. An ally is an object with the same group ID. &lt;br /&gt;
* '''Damage and death'''&lt;br /&gt;
**[[ EVENT_TYPE_DAMAGED ]] - an object loses 1 hit point or more&lt;br /&gt;
**[[ EVENT_TYPE_DOT_TICK ]] - Damage over time tick event.&lt;br /&gt;
**[[ EVENT_TYPE_DYING ]] - a creature received the killing blow.&lt;br /&gt;
**[[ EVENT_TYPE_DEATH ]] - creature or placeable have the death effect applied (regardless of hitpoints)&lt;br /&gt;
**[[ EVENT_TYPE_RESURRECTION ]] - Creature resurrected.&lt;br /&gt;
**[[ EVENT_TYPE_TEAM_DESTROYED ]] - Fires when an entire team of creatures is destroyed. &lt;br /&gt;
* '''Inventory '''&lt;br /&gt;
**[[ EVENT_TYPE_INVENTORY_ADDED ]] - An item is added to the personal inventory of the object receiving the event or the party inventory.&lt;br /&gt;
**[[ EVENT_TYPE_INVENTORY_REMOVED ]] - An item is removed from the personal inventory of the object receiving the event or the party inventory.&lt;br /&gt;
**[[ EVENT_TYPE_EQUIP ]] - The current creature has equipped an item&lt;br /&gt;
**[[ EVENT_TYPE_UNEQUIP ]] - The current creature has unequipped an item&lt;br /&gt;
**[[ EVENT_TYPE_CAMPAIGN_ITEM_ACQUIRED ]] - items with the ITEM_ACQUIRED_EVENT_ID variable set are picked up.&lt;br /&gt;
**[[ EVENT_TYPE_INVENTORY_FULL ]] - {{undocumented}}&lt;br /&gt;
**[[ EVENT_TYPE_OUT_OF_AMMO ]] - {{undocumented}}&lt;br /&gt;
* '''Movement'''&lt;br /&gt;
**[[ EVENT_TYPE_BLOCKED ]] - The current creature's path has been blocked while moving by a creature or door. This event will NOT fire when blocked by placeables who can not change the walk mesh or terrain.&lt;br /&gt;
**[[ EVENT_TYPE_ENTER ]] - A creature enters the object receiving the event&lt;br /&gt;
**[[ EVENT_TYPE_EXIT ]] - A creature exits the object receiving the event&lt;br /&gt;
**[[ EVENT_TYPE_REACHED_WAYPOINT ]] - {{undocumented}}&lt;br /&gt;
* '''Traps'''&lt;br /&gt;
**[[ EVENT_TYPE_APPROACH_TRAP ]] - Trap triggered and the creature receiving this event should approach the trap&lt;br /&gt;
**[[ EVENT_TYPE_TRAP_ARM ]] Sent by script to request that a trap arm itself.&lt;br /&gt;
**[[ EVENT_TYPE_TRAP_TRIGGER_ENTER ]] - {{undocumented}}&lt;br /&gt;
**[[ EVENT_TYPE_TRAP_DISARMED ]] - {{undocumented}}&lt;br /&gt;
**[[ EVENT_TYPE_TRAP_TRIGGER_ARMED ]] - {{undocumented}}&lt;br /&gt;
**[[ EVENT_TYPE_TRAP_TRIGGER_EXIT ]] - {{undocumented}}&lt;br /&gt;
**[[ EVENT_TYPE_TRAP_TRIGGERED ]] - {{undocumented}}&lt;br /&gt;
* '''Game state events'''&lt;br /&gt;
**[[ EVENT_TYPE_SPAWN ]] - an object spawns into the game. This event can fire only once per game for each object, regardless of save games.&lt;br /&gt;
**[[ EVENT_TYPE_MODULE_START ]] - The module starts. This can happen only once for a single game instance.&lt;br /&gt;
**[[ EVENT_TYPE_MODULE_LOAD ]] - The module loads from a save game. This event can fire more than once for a single module or game instance.&lt;br /&gt;
**[[ EVENT_TYPE_AREALOAD_SPECIAL ]]- for playing things like cutscenes and movies when you enter an area, things that do not involve AI or actual game play&lt;br /&gt;
**[[ EVENT_TYPE_AREALOAD_PRELOADEXIT ]] - for things you want to happen while the load screen is still up, things like moving creatures around&lt;br /&gt;
**[[ EVENT_TYPE_AREALOAD_POSTLOADEXIT ]] - fires at the same time that the load screen is going away, and can be used for things that you want to make sure the player sees.&lt;br /&gt;
**[[ EVENT_TYPE_AREALOADSAVE_POSTLOADEXIT ]] - fires at the same time that the load screen is going away, but only when loading a savegame.&lt;br /&gt;
**[[ EVENT_TYPE_GAMEMODE_CHANGE ]]&lt;br /&gt;
**[[ EVENT_TYPE_DELAYED_GM_CHANGE ]]&lt;br /&gt;
**[[ EVENT_TYPE_SET_GAME_MODE ]]&lt;br /&gt;
*'''Plots'''&lt;br /&gt;
**[[ EVENT_TYPE_SET_PLOT ]] - A plot is setting a plot flag&lt;br /&gt;
**[[ EVENT_TYPE_GET_PLOT ]] - A plot is setting a plot flag&lt;br /&gt;
*''' Dialogue'''&lt;br /&gt;
**[[ EVENT_TYPE_DIALOGUE ]] - An object tries to initiate dialog with the object receiving the event, either by clicking or by scripting&lt;br /&gt;
**[[ EVENT_TYPE_DELAYED_SHOUT ]] - Used to fire a dialog shout every few seconds.&lt;br /&gt;
**[[ EVENT_TYPE_AMBIENT_CONTINUE ]] - conversation ends or player is nearby to resume ambient behaviour &lt;br /&gt;
*'''Party management'''&lt;br /&gt;
**[[ EVENT_TYPE_PARTYMEMBER_ADDED ]] - Party member added to active party using the party GUI &lt;br /&gt;
**[[ EVENT_TYPE_PARTYMEMBER_DROPPED ]] - Party member removed from active party using the party GUI &lt;br /&gt;
**[[ EVENT_TYPE_PARTYPICKER_CLOSED ]] - {{undocumented}}&lt;br /&gt;
**[[ EVENT_TYPE_PARTY_MEMBER_HIRED ]] - Fires first time a party member is added to the party. For plot followers: follower recruited (added to pool). For other followers: UT_Hire called&lt;br /&gt;
**[[ EVENT_TYPE_PARTY_MEMBER_FIRED ]] - Fires when an active or locked-active party member is removed from the active party&lt;br /&gt;
**[[ EVENT_TYPE_PARTY_MEMBER_RES_TIMER ]] - Resurrection timer used if a creature dies in explore mode.&lt;br /&gt;
**[[ EVENT_TYPE_GIFT_ITEM ]]- {{undocumented}}&lt;br /&gt;
**[[ EVENT_TYPE_MODULE_HANDLE_FOLLOWER_DEATH ]] - {{undocumented}}&lt;br /&gt;
**[[ EVENT_TYPE_MODULE_HANDLE_GIFT ]] - {{undocumented}}&lt;br /&gt;
**[[ EVENT_TYPE_SUMMON_DIED ]] - {{undocumented}}&lt;br /&gt;
* '''Character generation and level advancement '''&lt;br /&gt;
**[[EVENT_TYPE_CHARGEN_START]] and [[EVENT_TYPE_CHARGEN_END ]] - A range of event constants (nEvent &amp;gt;= EVENT_TYPE_CHARGEN_START &amp;amp;&amp;amp; nEvent &amp;lt;= EVENT_TYPE_CHARGEN_END) that occur during character generation.&lt;br /&gt;
**[[ EVENT_TYPE_PLAYER_LEVELUP ]] Fired by sys_rewards_h.RewardXP (the levelup system)&lt;br /&gt;
**[[ EVENT_TYPE_PLAYERLEVELUP ]]&lt;br /&gt;
**[[ EVENT_TYPE_CHARGEN_AUTOLEVEL ]]&lt;br /&gt;
**[[ EVENT_TYPE_MODULE_CHARGEN_DONE ]]&lt;br /&gt;
**[[ EVENT_TYPE_GUI_OPENED ]] - GUI tutorial calls&lt;br /&gt;
* '''World map'''&lt;br /&gt;
**[[ EVENT_TYPE_TRANSITION_TO_WORLD_MAP ]] - Player uses the generic transition system to open the world map&lt;br /&gt;
**[[ EVENT_TYPE_WORLD_MAP_CLOSED ]]&lt;br /&gt;
**[[ EVENT_TYPE_WORLD_MAP_USED ]] - the player clicks on a destination in the world map&lt;br /&gt;
** [[ EVENT_TYPE_BEGIN_TRAVEL ]]&lt;br /&gt;
** [[ EVENT_TYPE_WORLDMAP_PRETRANSITION ]]&lt;br /&gt;
**[[ EVENT_TYPE_WORLDMAP_POSTTRANSITION ]]&lt;br /&gt;
**[[ EVENT_TYPE_FINISH_TRAVEL ]]&lt;br /&gt;
*''' Found in placeable_core '''&lt;br /&gt;
**[[ EVENT_TYPE_PLACEABLE_ONCLICK ]] player clicks on object.&lt;br /&gt;
**[[ EVENT_TYPE_USE ]]&lt;br /&gt;
**[[ EVENT_TYPE_UNLOCKED ]] Sent by script when placeable is unlocked.&lt;br /&gt;
**[[ EVENT_TYPE_SET_OBJECT_ACTIVE ]] Sent by script to change active state. Needed since CommandDoFunction was removed and we're using CommandDoEvent&lt;br /&gt;
**[[ EVENT_TYPE_PLACEABLE_COLLISION ]] player collides with object (if EnableCollisionEvent column in placeables.xls is non-zero).&lt;br /&gt;
**[[ EVENT_TYPE_POPUP_RESULT ]]&lt;br /&gt;
* '''Found in rules_core'''&lt;br /&gt;
**[[ EVENT_TYPE_ITEM_ONHIT ]]&lt;br /&gt;
**[[ EVENT_TYPE_CONFUSION_CALLBACK ]]&lt;br /&gt;
**[[ EVENT_TYPE_DESTROY_OBJECT ]]&lt;br /&gt;
* '''Found in player_core'''&lt;br /&gt;
**[[ EVENT_TYPE_HEARTBEAT ]]&lt;br /&gt;
**[[ EVENT_TYPE_LOAD_TACTICS_PRESET ]]&lt;br /&gt;
*'''Spellcasting'''&lt;br /&gt;
**[[ EVENT_TYPE_ABILITY_CAST_START ]]&lt;br /&gt;
**[[ EVENT_TYPE_ABILITY_CAST_IMPACT ]]&lt;br /&gt;
**[[ EVENT_TYPE_CAST_AT ]]&lt;br /&gt;
**[[ EVENT_TYPE_COMBO_IGNITE ]]&lt;br /&gt;
**[[ EVENT_TYPE_SPELLCASTAT ]]&lt;br /&gt;
**[[ EVENT_TYPE_SPELLSCRIPT_CAST ]]&lt;br /&gt;
**[[ EVENT_TYPE_SPELLSCRIPT_DEACTIVATE ]]&lt;br /&gt;
**[[ EVENT_TYPE_SPELLSCRIPT_IMPACT ]]&lt;br /&gt;
**[[ EVENT_TYPE_SPELLSCRIPT_PENDING ]]&lt;br /&gt;
* '''Proving events'''&lt;br /&gt;
**[[ EVENT_TYPE_PROVING_ENTER ]]&lt;br /&gt;
**[[ EVENT_TYPE_PROVING_EXIT ]]&lt;br /&gt;
**[[ EVENT_TYPE_PROVING_LOSE ]]&lt;br /&gt;
**[[ EVENT_TYPE_PROVING_START ]]&lt;br /&gt;
**[[ EVENT_TYPE_PROVING_WIN ]]&lt;br /&gt;
* '''Debugging'''&lt;br /&gt;
** [[ EVENT_TYPE_DEBUG_KICKSTART_AI ]]&lt;br /&gt;
**[[ EVENT_TYPE_DEATH_RES_PARTY ]]&lt;br /&gt;
**[[ EVENT_TYPE_DEBUG_RESURRECTION ]]&lt;br /&gt;
* '''Stats'''&lt;br /&gt;
**[[ EVENT_TYPE_STAT_REGEN ]]&lt;br /&gt;
**[[ EVENT_TYPE_MANA_STAM_DEPLETED ]]&lt;br /&gt;
* '''Miscellaney'''&lt;br /&gt;
**[[ EVENT_TYPE_CLICK ]]&lt;br /&gt;
**[[ EVENT_TYPE_CUSTOM_COMMAND_COMPLETE ]]&lt;br /&gt;
**[[ EVENT_TYPE_FAILTOOPEN ]]&lt;br /&gt;
**[[ EVENT_TYPE_HANDLE_CUSTOM_AI ]]&lt;br /&gt;
**[[ EVENT_TYPE_INVALID ]]&lt;br /&gt;
**[[ EVENT_TYPE_LISTENER ]]&lt;br /&gt;
**[[ EVENT_TYPE_LOCKED ]]&lt;br /&gt;
**[[ EVENT_TYPE_QA_EVENT ]]&lt;br /&gt;
**[[ EVENT_TYPE_QA_EVENT_BLA ]]&lt;br /&gt;
**[[ EVENT_TYPE_STEALING_FAILURE ]]&lt;br /&gt;
**[[ EVENT_TYPE_STEALING_SUCCESS ]]&lt;br /&gt;
**[[ EVENT_TYPE_UNIQUE_POWER ]]&lt;br /&gt;
&lt;br /&gt;
== Shouts ==&lt;br /&gt;
&lt;br /&gt;
Shouts (events) are used to make creatures communicate with one another. This is a list of all the shouts referenced in the AI documentation. &lt;br /&gt;
&lt;br /&gt;
[[ Creature Shouts ]]&lt;br /&gt;
&lt;br /&gt;
*SHOUT_TYPE_WASATTACKED When I am attacked, signal this event for all allies. What do the allies do? They will go into combat round, not specifically targeting this attacker but becoming combat ready. &lt;br /&gt;
*SHOUT_TYPE_SAWENEMY Attack enemy. &lt;br /&gt;
*SHOUT_TYPE_KILLEDME Attack enemy. &lt;br /&gt;
*SHOUT_TYPE_SWITCH_MELEE Will switch to melee weapons, useful for certain plot situations &lt;br /&gt;
*SHOUT_TYPE_WAKE_UP Any creature that hears this shout will wake up, if sleeping. This shout needs to be manually called. &lt;br /&gt;
*SHOUT_TYPE_FOUND_SOMEONE (YaronToDo) a scout sees someone they broadcasts this event. Allies go here. (NOT DONE)&lt;br /&gt;
&lt;br /&gt;
[[ Commander-Specific Orders ]]&lt;br /&gt;
&lt;br /&gt;
*SHOUT_TYPE_FINISHHIM Attacks a specified enemy till they are dead. A Commander issues order generally. &lt;br /&gt;
*SHOUT_TYPE_ATTACK_WIZARD (YaronToDo) Starting targeting wizard class enemies instead of others. &lt;br /&gt;
*SHOUT_TYPE_FLANK Rogues will get into a flanking position to an appropriate enemy &lt;br /&gt;
*SHOUT_TYPE_SWITCH_RANGED Will randomly choose one ally and ask them to switch to a ranged weapon. This is mostly done to even out the number of participants in melee battle for animation purposes (closer to even the sides are, the better things look)&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
[[IsEventValid]], [[HandleEvent]], [[SignalEvent]]&lt;br /&gt;
&lt;br /&gt;
[[Category: DAScript types]]&lt;/div&gt;</summary>
		<author><name>Georg Zoeller</name></author>	</entry>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=Ability&amp;diff=7242</id>
		<title>Ability</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=Ability&amp;diff=7242"/>
				<updated>2009-10-27T22:48:03Z</updated>
		
		<summary type="html">&lt;p&gt;Georg Zoeller: /* Q: What does 'asymmetric rules system' mean ? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Overview ===&lt;br /&gt;
The Ability System is used to handle Spells, Talents, Skills, and Item Abilities in Dragon Age.&lt;br /&gt;
&lt;br /&gt;
=== Detailed Description ===&lt;br /&gt;
&lt;br /&gt;
Spells, Talents, Skills and item abilities all use the same backend in the game, a mostly script implemented system relying heavily on two dimensional data arrays. &lt;br /&gt;
&lt;br /&gt;
The most important 2da file for abilities is '''[[ABI_base.xls]]''', as it defines each ability and all aspects of execution and handling in both scripting and engine code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;margin:0; background:#f5faff; border:1px solid #a3b0bf; text-align:left; color:#000; padding:0.2em 0.4em; width:100%; height:100%&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|'''Ability Design Notes''' &lt;br /&gt;
&lt;br /&gt;
When creating an ability in Dragon Age: Origins, we generally stick to the following guidelines&lt;br /&gt;
&lt;br /&gt;
* Keep it useful. &lt;br /&gt;
Some constant benefits (such as an increase in Attack or Defense) stay useful for the duration of the game as the progression of the related properties are slow. &lt;br /&gt;
For other effects, such as damage, a constant value would mean that the ability will become progressively worse through the game as damage needed to drop enemies increases from level to level. In such cases, the ability should be tied in some fashion to a Spellpower (for spells) or another relevant (such as cunning for rogues) to ensure they stay useful throughout the game. &lt;br /&gt;
&lt;br /&gt;
* No repetition. &lt;br /&gt;
Each ability in Dragon Age: Origins is unique. No incremental abilities such as 'fireball I, fireball II, etc.'. Skills are exempt from this rule. Remember that the Damage Types dramatically alter the actual effect of an ability (such as lightning always draining stamina alongside doing damage), so having similar damaging abilities in different trees is usually fine.&lt;br /&gt;
&lt;br /&gt;
* Thematic matching.&lt;br /&gt;
Abilities within the same chain should follow a common theme. &lt;br /&gt;
&lt;br /&gt;
* Avoid binary abilities. Design hit heavy.&lt;br /&gt;
Avoid abilities that are hit-or-miss. Generally, abilities should hit whenever possible and use target side mitigation of effects (resistance checks, damage mitigation) instead of 'hit or miss' mechanics. Melee abilities may use the normal attack resolution routines but should always perform their attacks at a bonus. Use rank based mitigation and resistances to allow for very powerful effects that do not trivialize boss battles. &lt;br /&gt;
&lt;br /&gt;
* Use meaningful effects&lt;br /&gt;
Abilities should always be worth it. Don't do minor effects (+1 attack). The player should always be able to see the effect of the ability in game (not necessarily visually, but at least through increased damage, etc.). The first ability in a chain should, whenever possible, be active. The fourth ability in a chain should always have the biggest 'bang-for-the-buck' factor. Abilities lower in the chain should have shorter cooldowns. Do not allow instant death on bosses and elite bosses.&lt;br /&gt;
&lt;br /&gt;
* Avoid 'zero-sum' abilities&lt;br /&gt;
When possible, avoid 'zero-sum' abilities that trade a penalty for a benefit (e.g. increase defense but decrease attack). There are a number of these abilities that are valid (such as aim), but balancing them and keeping them useful is hard and requires a lot of work. This obviously does not apply to drastic abilities such as blood magic.&lt;br /&gt;
&lt;br /&gt;
* No emulation of defining class capabilities&lt;br /&gt;
Never ever grant a basic class capability from one class to another class via abilities. This means no invisibilityor magical unlock spells for mages, as these are defining capabilities of the rogue class. No weapon talents for mages. No magic spells or large, targeted area of effects for warriors or rogues. Items might blur this line if the cost is balanced properly (e.g. grenades).&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Basic Ability Types ====&lt;br /&gt;
&lt;br /&gt;
Abilities are divided into 4 subtypes, as defined in the 'abilitytype' column in abi_base.xls:&lt;br /&gt;
&lt;br /&gt;
* Talents - Abilities used by warriors and rogues, usually non magical in nature. (abilitytype=1)&lt;br /&gt;
* Spells - Abilities used by mages, either spell or passive abilities.  (abilitytype=2)&lt;br /&gt;
* Skills - Abilities usable by all classes, such as Survival and Combat training (abilitytype=3).&lt;br /&gt;
* Items  - Abilities present on an item that are triggered when the item is used on the quickbar. (ability_type=4)&lt;br /&gt;
&lt;br /&gt;
Note: Talents do not show up on mages and spells do not show up on rogue or warrior characters, so to create abilities that can be used by all classes, abilitytype 3 (Skill) must be used. To define under which heading an ability shows up on the character's talent/spell page, the field 'guitype' is used. It resolves against guitype.xls which lists all known headings.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There are 3 basic ability types in the game, defined by the field 'use_type' in [[ABI_base.xls]].&lt;br /&gt;
&lt;br /&gt;
'''Passive Abilities''' &lt;br /&gt;
&lt;br /&gt;
Passive abilities (use_type = 3) grant persistent or conditionally persistent bonuses or penalties to the creature that has the ability. &lt;br /&gt;
&lt;br /&gt;
A passive ability may grant up to 3 modifications to creature properties (properties.xls). Those modifications are defined in the passive_abilities worksheet of abi_base.xls and linked to the ability through the passive_id column in abi_base.xls.&lt;br /&gt;
&lt;br /&gt;
Additionally, the bonuses of an ability can be made conditional on the character's current 'wield mode' (2-handed, dual, weapon &amp;amp; shield, or universal) through the conditional integer field on the passive_abilities worksheet.&lt;br /&gt;
&lt;br /&gt;
Finally, a number of passive abilities do not define any property modifications in passive_abilites but instead have checks coded against their Ids (e.g. HasAbility(oCreature, ABILITY_TALENT_LETHALITY)) directly in the combat resolution scripts. The mere presence of the ability on a creature causes a different code path to be taken in the scripts in those cases.&lt;br /&gt;
&lt;br /&gt;
Note that passive_ability benefits are not limited to abilities with use_type 3. Some active abilities also grant additional property modifying benefits to the owner.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Sustained Abilities'''&lt;br /&gt;
&lt;br /&gt;
Sustained abilities (use_type = 2) are turned on and off per character and, while turned on, grant effects or property modifications to the user. &lt;br /&gt;
Most 'buffs' are implemented this way.&lt;br /&gt;
&lt;br /&gt;
Only members of the player's party are using sustained ability as the code overhead required to track them is too expensive to be used on monsters that only exist to die in an encounter with the player's party. (These creatures use duration based effects to emulate similar abilities instead).&lt;br /&gt;
&lt;br /&gt;
Most sustained abilities follow the same pattern:&lt;br /&gt;
* They do not have any activation cost, encouraging tactical use of buffs.&lt;br /&gt;
* They increase the users [[Fatigue]] property, therefore increasing the activation cost of all other abilities.&lt;br /&gt;
* They reduce the users maximum available mana or stamina by a constant value.&lt;br /&gt;
* They use cooldown to prevent the user from being too opportunistic with their use.&lt;br /&gt;
* Some abilities shut down when the user reaches 0 mana/stamina. Very powerful abilities (such as Momentum) have an associated stamina/mana drain effect to limit their use to a short or medium period of time. Creative item / buff use can be used to increase the length such an ability can be sustained.&lt;br /&gt;
&lt;br /&gt;
The benefits from sustained abilities are calculated when the ability is activated, so if a character levels up or otherwise changes stats that influence the magnitude of a sustained ability will not update until the ability is reactivated the next time.&lt;br /&gt;
&lt;br /&gt;
Some sustained abilities (such as Flaming Weapons) are active 'party-wide' - the caster not only sustains the ability on himself but on all his party members as well. This is controlled by the 'bPartyWide' flag in abi_base.xls. Due to implementation limitations, party members who die or otherwise enter/exit the current party will not be affected by these abilities until they are recast. (we put low cooldown times on these abilities for that very reason).&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;margin:0; background:#f5faff; border:1px solid #a3b0bf; text-align:left; color:#000; padding:0.2em 0.4em; width:100%; height:100%&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|'''Gameplay Design Note''' &lt;br /&gt;
* Unlike in games like Baldur's Gate, the system in DA: Origins is designed to encourage tactical use of buffs over strategical. We wanted to put an emphasis on the player making smart choices during an encounter vs. the player guessing which buffs might be useful ahead of time or having to employ save-die-reload to find out. &lt;br /&gt;
&lt;br /&gt;
* It is generally wise to run only one or two buffs all around and activate additional buffs only when needed. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Activated Abilities'''&lt;br /&gt;
&lt;br /&gt;
Activated abilities (use_type = 4) are abilities that instantly execute their effect (see Targeting Behavior below). Most melee talents or targeted spells fall in this category. There are several sub-types of activated abilies, such as&lt;br /&gt;
&lt;br /&gt;
* Targeted, single target spells and talents (such as Winter's Grasp or Flurry)&lt;br /&gt;
* Ground targeted abilities (such as Blizzard or various Glyphs)&lt;br /&gt;
* Self targeted activated abilities.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Targeting Behavior ====&lt;br /&gt;
&lt;br /&gt;
An abilities targeting behavior is controlled by several settings in abi_base.xls&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''AutoTarget''' is a boolean field that defines how the UI resolves targeting.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-  &lt;br /&gt;
| 0 || The UI will always bring up a targeting cursor. &lt;br /&gt;
|-&lt;br /&gt;
| 1 || The UI will only produce a targeting cursor if no suitable target is currently selected. e.g if the player currently has a hostile creature targeted and if the spells TargetType includes 0x4 (hostile), the ability will trigger immediately, not producing a targeting cursor. Most single target spells and talents use this setting.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Regardless of AutoTarget setting, the UI will never produce a targeting cursor if an ability is type 0x1 (self) -&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''TargetType''' is a bit mask derived from the following table and controls the behavior of the UI's targeting cursor.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-  &lt;br /&gt;
|'''Bitmask''' || '''Effect'''&lt;br /&gt;
|-&lt;br /&gt;
| 0x1  ||  Self&lt;br /&gt;
|-&lt;br /&gt;
| 0x2 || Friendly Creature&lt;br /&gt;
|-&lt;br /&gt;
| 0x4 || Hostile Creature&lt;br /&gt;
|-&lt;br /&gt;
| 0x8 || Placeable Object&lt;br /&gt;
|-&lt;br /&gt;
| 0x10 || Area of Effect Object (deprecated)&lt;br /&gt;
|-&lt;br /&gt;
| 0x20 || Ground (see details)&lt;br /&gt;
|-&lt;br /&gt;
| 0x40 || Dead Body (deprecated)&lt;br /&gt;
|-&lt;br /&gt;
| 0x80 || Party Member&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''AutoDraw''' is an integer boolean field that defines how a character's weapons are handled when the ability is triggered.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-  &lt;br /&gt;
| 0 || The ability will not affect the player's weapon sheath status.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || The engine will force the player to draw/unsheathe his weapon before executing the ability. This is used for most bow and melee weapon abilities. &lt;br /&gt;
|-&lt;br /&gt;
| 2 || The engine will force the player to stow away any non staff melee weapons before executing the ability. This is used to ensure that no inappropriate animations play with weapons drawn (e.g. the player conjuring with a sword clipping through his body) and to discourage switching between melee and spellcasting on the fly.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Balancing (Cost, Cooldown, etc) ====&lt;br /&gt;
&lt;br /&gt;
Abilities in Dragon Age are balanced along several vectors, most of which boil down to simple 'use frequency'. As a general rule of thumb, the more specialized and limited the effect of an ability is, the more outrageously powerful an ability can be.&lt;br /&gt;
&lt;br /&gt;
Use frequency of abilities can be adjusted by modifying the following field in abi_base.xls&lt;br /&gt;
&lt;br /&gt;
* Cost: This is the simple mana (spells) or stamina (talents) activation cost of an ability. It is subtracted when the conjure phase of the spell has succesfully completed (e.g. no cost for spell interruptions). Without sufficient resources to cover activation cost, the UI will not allow the player to execute the ability. The value is a constant integer and is multiplied with 1+(Current Fatigue) of the caster. &lt;br /&gt;
&lt;br /&gt;
* Cooldown: Cooldown is a constant float in seconds that defines how long the player has to wait after the successful activation of an ability until he can use it again. For abilities that apply duration based debuffs or effects to a target, cooldown is usually set slightly higher than the duration of the effect to avoid stacking by the same caster.&lt;br /&gt;
&lt;br /&gt;
* Upkeep: Defines how much mana or stamina is removed from the casters overall pool while a sustained ability is active. This naturally limits the number of sustained abilities present on a creature and ensures that the more beneficial buffs are active on the caster, the less mana is available for immediate use.&lt;br /&gt;
&lt;br /&gt;
* [[Fatigue]]: Fatigue affects use frequency only indirectly, but it prevents characters from stacking too many buffs on each other, as each sustained ability active usually adds around 5-10% fatigue to the caster.&lt;br /&gt;
&lt;br /&gt;
* Mana/Stamina drain: By reducing the mana/stamina regeneration rate on a creature, the duration for which a sustained ability can be used can be restricted. This mechanic is used only for the most powerful sustained abilities in the game, which are flagged to turn off when the caster sustaining them reaches 0 mana/stamina.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Other balancing vectors:&lt;br /&gt;
&lt;br /&gt;
* AoESize and AoeShape: Area of effect spells that deal friendly fire are location and situation restricted on normal+ difficulty (hard+ on the consoles). Since dropping an Inferno on your own party members is hardly a good idea in most cases, the usefulness of the spell becomes restricted to careful positioning and the earlier stages of combat. &lt;br /&gt;
&lt;br /&gt;
* Threat Generation: Abilities apply threat not just by damage but often by activation. Higher activation threat of an ability can balance out outrageously powerful effects by making it harder for the player to use the spell. The prime example is the Walking Bomb kind of spells which deal excellent damage, but, on higher difficulties, also make the targets very very angry at the caster.  Using these spells effectively often requires a tactical approach by the player, thus limiting their universal usefulness and offsetting their very powerful effects.&lt;br /&gt;
&lt;br /&gt;
* Threat Removal: Some abilities are designed to only provide a short term benefit (Such as 3s stun on Mindblast) but offset their weakness by removing threat from the caster, often by reinitializing the threat tables on the target, causing enemies to randomly seek new targets.&lt;br /&gt;
&lt;br /&gt;
* Conjure time: Spells with a conjure time of 1+ (Speed in abi_base.xls) can be interrupted by damage, limiting their usefulness in melee situations or when only one party member remains on the battlefield. Many of the very powerful Area of Effect type spells use this feature. Most activated spells have a conjure time of 0, making them instant cast.&lt;br /&gt;
&lt;br /&gt;
* Range: Lower ranges force the ability user into potentially more dangerous situations, adding additional risk to the use of an ability.&lt;br /&gt;
&lt;br /&gt;
=== Q&amp;amp;A ===&lt;br /&gt;
&lt;br /&gt;
==== Q: Where do we find the exact formula for abilities ? ====&lt;br /&gt;
&lt;br /&gt;
A: Due to most abilities being unique, the only place to find the exact details on each spell is in the scripts. While a lot of data can be glanced from abi_base.xls, a lot of the detailed mechanics are very different between abilities and can only be found in the appropriate spellscript. The *_constant.nss files hold some basic values, but often get further modified in the scripts. &lt;br /&gt;
&lt;br /&gt;
This is also one of the reasons why some elements of a talent are not displayed in the UI description in game. While we can calculate cost and cooldown based on the casting character and his fatigue and other properties (and consequently display it), we can usually not calculate damage or duration as they are mitigated on the target creature: &lt;br /&gt;
&lt;br /&gt;
Displaying those values results in very misleading information (e.g. while damage seems to be higher on one ability, the mitigation mechanisms and unique side effects of another ability will make it just as good or better - in certain situations) and it turned out to be better to provide the player with general guidance than the misleading information.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Q: What is Spellpower and how does it interact with abilities ====&lt;br /&gt;
&lt;br /&gt;
Spellpower is probably the most important stat for a mage character (and only exists on mage characters). It is calculated as max(Magic - 10,0) and therefore increases by one point for every point a mage spends on his Magic attribute.&lt;br /&gt;
&lt;br /&gt;
Most mage spells benefit directly from higher spellpower by increased damage, effect magnitude and duration. It also plays a role in a mages ability to overcome mental or physical resistance on a target (where applicable). The actual impact of spellpower on an ability varies from spell to spell but the most common construct equates to something like 1% increase in spell potency per point of Spellpower. Thus, items and spells that increase spellpower are very powerful as they increase the potency of every spell the mage can cast.&lt;br /&gt;
&lt;br /&gt;
Spellpower is the only factor that causes an increase of a spells potency over time, so a level 20 mage with neglected the Magic attribute would be much less powerful than a mage that didn't neglect Magic.&lt;br /&gt;
&lt;br /&gt;
Some examples:&lt;br /&gt;
&lt;br /&gt;
* The damage potential for Winter's Grasp is calculated as (100.0f + GetCreatureSpellPower(stEvent.oCaster)) * 0.36f;&lt;br /&gt;
* The healing potential for the heal spell is calculated as (100.0f + GetCreatureSpellPower(stEvent.oCaster)) * 0.40f;&lt;br /&gt;
* The damage over time component of blizzard is executed as ApplyEffectDamageOverTime(a[i], oCreator, ABILITY_SPELL_BLIZZARD,  (100.0f + GetCreatureSpellPower(oCreator)) * 0.1, (BLIZZARD_INTERVAL_DURATION - 0.5f), DAMAGE_TYPE_COLD);&lt;br /&gt;
&lt;br /&gt;
Note that these formulas only list the raw damage potential and do not take into account the effects of damage types, difficulty, rank, resistances, magical shields and any other mitigating factors on the target or enhancing factors on the caster. This means that just comparing the numbers will not give you an idea which spell is better or worse.&lt;br /&gt;
&lt;br /&gt;
For non-mage spells and abilities, spellpower is often substituted by an appropriate other construct (such as max(Cunning-10,0) for rogue abilities).&lt;br /&gt;
&lt;br /&gt;
==== Q: Can we have the damage formula for abilities ? ====&lt;br /&gt;
&lt;br /&gt;
A: There is no damage formula for abilities, as mentioned before, each ability follows their own rules.&lt;br /&gt;
&lt;br /&gt;
In general, talent damage is based on the weapon being used (e.g. Assault does 3 melee attacks that deal weapon damage with some additional bonuses) and are modified by external cirumstances such as location, critical chance and ability to deliver a backstab and are mitigated by armor on the target.&lt;br /&gt;
&lt;br /&gt;
Spells deal damage of different damage types following a rough rule of (Constant * (Spellpower / Variable)) / [Variables] ) + Modifiers but this only tells part of the story as actual damage is dependent on the target, it's resistances, rank and a number of other factors.&lt;br /&gt;
&lt;br /&gt;
Some additional factors affecting spell damage are:&lt;br /&gt;
&lt;br /&gt;
* damage resistance.&lt;br /&gt;
* magical shields.&lt;br /&gt;
* difficulty level.&lt;br /&gt;
* elemental damage bonuses from spells or items &lt;br /&gt;
* Environmental conditions (frozen targets take less damage from fire, etc.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Q: What are the differences between damage types? ====&lt;br /&gt;
&lt;br /&gt;
A: Creatures have variable damage resistances based on their type and rank. Dragons might get 60% less damage from fire (60% fire resistance), other creatures will have different immunities. Additional effects are:&lt;br /&gt;
&lt;br /&gt;
* Electricity: In addition to normal damage, these also reduce the targets stamina (but not mana) by the same amount, making them very effective boss killers.&lt;br /&gt;
&lt;br /&gt;
* Fire: Cancels Cold based damage over time effects and applies damage over time.&lt;br /&gt;
&lt;br /&gt;
* Cold: Cancel Fire based damage over time effects and often is accompanied by slow or slipping effects.&lt;br /&gt;
&lt;br /&gt;
* Spirit: There are very few ways of increasing spirit resistance in the game, so spells dealing spirit damage are universally useful...&lt;br /&gt;
&lt;br /&gt;
* Nature: Rarely found on spells. Many creatures are resistant to this.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(This should probably go on its own wiki page)&lt;br /&gt;
&lt;br /&gt;
==== Q: Are sustained abilities mutually exclusive ? ====&lt;br /&gt;
&lt;br /&gt;
A: There is a very limited number of sustained abilities that are mutually exclusive, usually because it makes sense. Mutually exclusive abilities cancel each other upon activation.&lt;br /&gt;
&lt;br /&gt;
* Shield stances (Shield Wall, Shield Cover, Shield Defense) are mutually exclusive.&lt;br /&gt;
* Archery stances (Aim, Rapid Fire, Defensive Fire) are mutually exclusive.&lt;br /&gt;
* Shapeshifting forms are (Sorry, no Bear-Wolfspider) are mutually exclusive.&lt;br /&gt;
* Weapon Enhancement spells are too, but only for the same caster (so two mages can run two different weapon enhancements if they want to).&lt;br /&gt;
* Bard Songs are mutually exclusive.&lt;br /&gt;
* The Death Syphon and Death Magic spells are mutually exclusive.&lt;br /&gt;
&lt;br /&gt;
Technically, all abilities in abi_base.xls that share the same 'condition_group' value are mutually exclusive.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Q: What are the rules for stacking effects and damage ? ====&lt;br /&gt;
&lt;br /&gt;
A: The general rules of stacking for abilities are:&lt;br /&gt;
&lt;br /&gt;
* Identical effect from different abilities stack (e.g. getting +10 attack from one ability and +10 attack from another nets +20 attack).&lt;br /&gt;
* The effects of identical abilities stack as long as they are from different caster. (Same caster usually does not apply as cooldown often exceeds duration).&lt;br /&gt;
* Weapon enhancement spells of the same type (e.g. 2 mages with flame weapons) do not stack. The sword does not get more flaming, sorry :)&lt;br /&gt;
* Animation based effects (knockdown, stun, etc.) stack, but only the one with the highest priority is played. This is defined in the priority column in effects.xls. &lt;br /&gt;
* Glyphs do stack but there is a limit of 5 active glyphs per caster.&lt;br /&gt;
* Fire and Cold DoT effects do not stack, the spell cast last will cancel any existing spell of the opposite type.&lt;br /&gt;
* Fire and Cold AoEs cancel each other, other AoEs might interact rather violently, handle with care :)&lt;br /&gt;
&lt;br /&gt;
For equipment and item based effects, the game usually stacks within the minumum and maximum clamp values of a property (properties.xls). This means that you can accumulate a lot of +damage or +critical critical chance effects, but for some type of stats there is a point where you are no longer gaining any benefits (e.g. speed modification - animations can only be sped up to a certain point before breaking, so stacking momentum, haste and a weapon with a speed based effect will not result in a -3.0s attack time, sorry :p)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For almost all effects, the total result of all property modifications on a creature are visible on the main character UI by hovering over the individual stats.&lt;br /&gt;
&lt;br /&gt;
==== Q: How does game difficulty affect abilities ? ====&lt;br /&gt;
&lt;br /&gt;
A: Our approach to game difficulty dictates that the effect of your chosen setting are&lt;br /&gt;
&lt;br /&gt;
a) non punishing - You do not get less XP for chosing a lower difficulty mode, etc.&lt;br /&gt;
b) challenge scaling - Higher difficulty will reward you with greater obstacles to overcome.&lt;br /&gt;
c) fair - Lower difficulties grant benefits that gradually get removed. (This does not mean the rules are symmetric and is not true on nightmare at all. Nightmare is evil. And unfair.)&lt;br /&gt;
d) non persistent - Difficulty changes are possible on the fly, at any time and take immediate effect.&lt;br /&gt;
&lt;br /&gt;
The game is balanced so that Hard mode is challenging for a Baldur's gate veteran.&lt;br /&gt;
&lt;br /&gt;
Based on these guidelines, you can expect the following ability behaviors in game:&lt;br /&gt;
&lt;br /&gt;
* The lower the difficulty, the longer your hostile effects such as stuns will last on enemies and the shorter they will last on you.&lt;br /&gt;
* The lower the difficulty, the more damage your abilities will do.&lt;br /&gt;
* The lower the difficulty, the less likely the enemy AI will use devastating special abilities (Note: less likely does not mean 'does not use').&lt;br /&gt;
* Casual and Normal have reduced friendly or nullified fire damage damage from area effect spells. Hard and Nightmare require careful positioning and tactical use of spells.&lt;br /&gt;
* The higher the difficulty, the more careful you need to manage threat when using spells and abilities (The AI becomes smarter about picking targets).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Q: What is spell affinity ? ====&lt;br /&gt;
&lt;br /&gt;
A: Spell Affinity was a design we toyed with for a while during development but decided not to implement.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Q: How does Rank Based Mitigation Work ? ====&lt;br /&gt;
&lt;br /&gt;
A: In line with Dragon Age: Origin's asymmetric approach to rules, the game uses creature ranks (instead of levels) in addition to stats and resistances to define how creatures get affected by abilities. In short: Boss monsters get affected differently by abilities and effects than Lieutenants or Critters. &lt;br /&gt;
&lt;br /&gt;
The rank system is the primary balancing vector for the games difficulty levels and profoundly affects all aspects of combat. The gory details of this system are defined in creature_ranks.xls and difficulty.xls.&lt;br /&gt;
&lt;br /&gt;
Rank mitigation affects not just damage in- and output of a creature, but also the duration that hostile effects persist on it and is different for each difficulty level of the game. Note that party members have their own rank in this system and are handled differently from other creatures in some cases. &lt;br /&gt;
&lt;br /&gt;
Below is the formula used for rank based effect duration mitigation: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
// sys_resistances_h&lt;br /&gt;
// @brief Returns an effect duration scaled by rank of oCreature and game difficulty&lt;br /&gt;
// @author Georg&lt;br /&gt;
float GetRankAdjustedEffectDuration(object oCreature, float fDur)&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    // Georg: This deserves some explanation:&lt;br /&gt;
    //&lt;br /&gt;
    //        One of the core issues when designing the combat system was always&lt;br /&gt;
    //        the fact that the story called for sequences during the game in which&lt;br /&gt;
    //        your main character acts solo.&lt;br /&gt;
    //&lt;br /&gt;
    //        Characters reliant on special abilities, such as rogues, would require&lt;br /&gt;
    //        them to be very effective in order to beat enemies that a standard tank&lt;br /&gt;
    //        can plow through. However, if these abilities would maintain the same&lt;br /&gt;
    //        effectiveness in a full party, most encounters would turn into a stunfest.&lt;br /&gt;
    //&lt;br /&gt;
    //        The solution is to add 1 second flat to each detrimental effect duration&lt;br /&gt;
    //        lasting at least 1 second for each unoccupied slot in the party - before applying&lt;br /&gt;
    //        rank and difficulty modifiers. This also makes solo play a bit more viable.&lt;br /&gt;
    //&lt;br /&gt;
    //        This is in addition to the diminishing returns on quickly successive stuns.&lt;br /&gt;
    //&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    if (!IsPartyMember(oCreature))&lt;br /&gt;
    {&lt;br /&gt;
        float fPartySizeModifier = IntToFloat(Max(0,4 - GetArraySize(GetPartyList())));&lt;br /&gt;
&lt;br /&gt;
        if (fDur &amp;gt;= 1.0f)&lt;br /&gt;
        {&lt;br /&gt;
            fDur += fPartySizeModifier;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    float fRankDurMod = Diff_GetDurationModifier(oCreature);&lt;br /&gt;
    if (fRankDurMod &amp;gt;0.0f)&lt;br /&gt;
    {&lt;br /&gt;
        return (fDur * fRankDurMod);&lt;br /&gt;
    }&lt;br /&gt;
    else&lt;br /&gt;
    {&lt;br /&gt;
     return fDur;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Scripts]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Q: What does 'asymmetric rules system' mean ? ====&lt;br /&gt;
&lt;br /&gt;
The goal behind Dragon Age: Origin's rule system was to create a fun and challenging video game experience first and foremost. &lt;br /&gt;
&lt;br /&gt;
We describe the rules as 'asymmetric' because a subset of the game rules treats player controlled characters and monsters differently, which is a deviation from pen and paper rule design that often require player and opponents to be treated exactly the same. &lt;br /&gt;
&lt;br /&gt;
Notable Examples:&lt;br /&gt;
* Party members never die permanently (get shattered, etc.)&lt;br /&gt;
* Differently ranked creatures (including party members) get affected for different durations by effects&lt;br /&gt;
* In limited situations in the game, we apply benefits to the player to overcome greater odds than they would usually be able to. &lt;br /&gt;
* Some abilities will work diferently when deployed against the party (although the visual results might be identical).&lt;br /&gt;
* Elimination of instant death situations (not fun!) against players but not against monsters (fun!).&lt;br /&gt;
* Sustained abilities only work for players (the overhead is not justified for monsters that won't ever reappear after they die).&lt;/div&gt;</summary>
		<author><name>Georg Zoeller</name></author>	</entry>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=Ability&amp;diff=7241</id>
		<title>Ability</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=Ability&amp;diff=7241"/>
				<updated>2009-10-27T22:47:02Z</updated>
		
		<summary type="html">&lt;p&gt;Georg Zoeller: /* Q: How does Rank Based Mitigation Work ? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Overview ===&lt;br /&gt;
The Ability System is used to handle Spells, Talents, Skills, and Item Abilities in Dragon Age.&lt;br /&gt;
&lt;br /&gt;
=== Detailed Description ===&lt;br /&gt;
&lt;br /&gt;
Spells, Talents, Skills and item abilities all use the same backend in the game, a mostly script implemented system relying heavily on two dimensional data arrays. &lt;br /&gt;
&lt;br /&gt;
The most important 2da file for abilities is '''[[ABI_base.xls]]''', as it defines each ability and all aspects of execution and handling in both scripting and engine code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;margin:0; background:#f5faff; border:1px solid #a3b0bf; text-align:left; color:#000; padding:0.2em 0.4em; width:100%; height:100%&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|'''Ability Design Notes''' &lt;br /&gt;
&lt;br /&gt;
When creating an ability in Dragon Age: Origins, we generally stick to the following guidelines&lt;br /&gt;
&lt;br /&gt;
* Keep it useful. &lt;br /&gt;
Some constant benefits (such as an increase in Attack or Defense) stay useful for the duration of the game as the progression of the related properties are slow. &lt;br /&gt;
For other effects, such as damage, a constant value would mean that the ability will become progressively worse through the game as damage needed to drop enemies increases from level to level. In such cases, the ability should be tied in some fashion to a Spellpower (for spells) or another relevant (such as cunning for rogues) to ensure they stay useful throughout the game. &lt;br /&gt;
&lt;br /&gt;
* No repetition. &lt;br /&gt;
Each ability in Dragon Age: Origins is unique. No incremental abilities such as 'fireball I, fireball II, etc.'. Skills are exempt from this rule. Remember that the Damage Types dramatically alter the actual effect of an ability (such as lightning always draining stamina alongside doing damage), so having similar damaging abilities in different trees is usually fine.&lt;br /&gt;
&lt;br /&gt;
* Thematic matching.&lt;br /&gt;
Abilities within the same chain should follow a common theme. &lt;br /&gt;
&lt;br /&gt;
* Avoid binary abilities. Design hit heavy.&lt;br /&gt;
Avoid abilities that are hit-or-miss. Generally, abilities should hit whenever possible and use target side mitigation of effects (resistance checks, damage mitigation) instead of 'hit or miss' mechanics. Melee abilities may use the normal attack resolution routines but should always perform their attacks at a bonus. Use rank based mitigation and resistances to allow for very powerful effects that do not trivialize boss battles. &lt;br /&gt;
&lt;br /&gt;
* Use meaningful effects&lt;br /&gt;
Abilities should always be worth it. Don't do minor effects (+1 attack). The player should always be able to see the effect of the ability in game (not necessarily visually, but at least through increased damage, etc.). The first ability in a chain should, whenever possible, be active. The fourth ability in a chain should always have the biggest 'bang-for-the-buck' factor. Abilities lower in the chain should have shorter cooldowns. Do not allow instant death on bosses and elite bosses.&lt;br /&gt;
&lt;br /&gt;
* Avoid 'zero-sum' abilities&lt;br /&gt;
When possible, avoid 'zero-sum' abilities that trade a penalty for a benefit (e.g. increase defense but decrease attack). There are a number of these abilities that are valid (such as aim), but balancing them and keeping them useful is hard and requires a lot of work. This obviously does not apply to drastic abilities such as blood magic.&lt;br /&gt;
&lt;br /&gt;
* No emulation of defining class capabilities&lt;br /&gt;
Never ever grant a basic class capability from one class to another class via abilities. This means no invisibilityor magical unlock spells for mages, as these are defining capabilities of the rogue class. No weapon talents for mages. No magic spells or large, targeted area of effects for warriors or rogues. Items might blur this line if the cost is balanced properly (e.g. grenades).&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Basic Ability Types ====&lt;br /&gt;
&lt;br /&gt;
Abilities are divided into 4 subtypes, as defined in the 'abilitytype' column in abi_base.xls:&lt;br /&gt;
&lt;br /&gt;
* Talents - Abilities used by warriors and rogues, usually non magical in nature. (abilitytype=1)&lt;br /&gt;
* Spells - Abilities used by mages, either spell or passive abilities.  (abilitytype=2)&lt;br /&gt;
* Skills - Abilities usable by all classes, such as Survival and Combat training (abilitytype=3).&lt;br /&gt;
* Items  - Abilities present on an item that are triggered when the item is used on the quickbar. (ability_type=4)&lt;br /&gt;
&lt;br /&gt;
Note: Talents do not show up on mages and spells do not show up on rogue or warrior characters, so to create abilities that can be used by all classes, abilitytype 3 (Skill) must be used. To define under which heading an ability shows up on the character's talent/spell page, the field 'guitype' is used. It resolves against guitype.xls which lists all known headings.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There are 3 basic ability types in the game, defined by the field 'use_type' in [[ABI_base.xls]].&lt;br /&gt;
&lt;br /&gt;
'''Passive Abilities''' &lt;br /&gt;
&lt;br /&gt;
Passive abilities (use_type = 3) grant persistent or conditionally persistent bonuses or penalties to the creature that has the ability. &lt;br /&gt;
&lt;br /&gt;
A passive ability may grant up to 3 modifications to creature properties (properties.xls). Those modifications are defined in the passive_abilities worksheet of abi_base.xls and linked to the ability through the passive_id column in abi_base.xls.&lt;br /&gt;
&lt;br /&gt;
Additionally, the bonuses of an ability can be made conditional on the character's current 'wield mode' (2-handed, dual, weapon &amp;amp; shield, or universal) through the conditional integer field on the passive_abilities worksheet.&lt;br /&gt;
&lt;br /&gt;
Finally, a number of passive abilities do not define any property modifications in passive_abilites but instead have checks coded against their Ids (e.g. HasAbility(oCreature, ABILITY_TALENT_LETHALITY)) directly in the combat resolution scripts. The mere presence of the ability on a creature causes a different code path to be taken in the scripts in those cases.&lt;br /&gt;
&lt;br /&gt;
Note that passive_ability benefits are not limited to abilities with use_type 3. Some active abilities also grant additional property modifying benefits to the owner.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Sustained Abilities'''&lt;br /&gt;
&lt;br /&gt;
Sustained abilities (use_type = 2) are turned on and off per character and, while turned on, grant effects or property modifications to the user. &lt;br /&gt;
Most 'buffs' are implemented this way.&lt;br /&gt;
&lt;br /&gt;
Only members of the player's party are using sustained ability as the code overhead required to track them is too expensive to be used on monsters that only exist to die in an encounter with the player's party. (These creatures use duration based effects to emulate similar abilities instead).&lt;br /&gt;
&lt;br /&gt;
Most sustained abilities follow the same pattern:&lt;br /&gt;
* They do not have any activation cost, encouraging tactical use of buffs.&lt;br /&gt;
* They increase the users [[Fatigue]] property, therefore increasing the activation cost of all other abilities.&lt;br /&gt;
* They reduce the users maximum available mana or stamina by a constant value.&lt;br /&gt;
* They use cooldown to prevent the user from being too opportunistic with their use.&lt;br /&gt;
* Some abilities shut down when the user reaches 0 mana/stamina. Very powerful abilities (such as Momentum) have an associated stamina/mana drain effect to limit their use to a short or medium period of time. Creative item / buff use can be used to increase the length such an ability can be sustained.&lt;br /&gt;
&lt;br /&gt;
The benefits from sustained abilities are calculated when the ability is activated, so if a character levels up or otherwise changes stats that influence the magnitude of a sustained ability will not update until the ability is reactivated the next time.&lt;br /&gt;
&lt;br /&gt;
Some sustained abilities (such as Flaming Weapons) are active 'party-wide' - the caster not only sustains the ability on himself but on all his party members as well. This is controlled by the 'bPartyWide' flag in abi_base.xls. Due to implementation limitations, party members who die or otherwise enter/exit the current party will not be affected by these abilities until they are recast. (we put low cooldown times on these abilities for that very reason).&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;margin:0; background:#f5faff; border:1px solid #a3b0bf; text-align:left; color:#000; padding:0.2em 0.4em; width:100%; height:100%&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|'''Gameplay Design Note''' &lt;br /&gt;
* Unlike in games like Baldur's Gate, the system in DA: Origins is designed to encourage tactical use of buffs over strategical. We wanted to put an emphasis on the player making smart choices during an encounter vs. the player guessing which buffs might be useful ahead of time or having to employ save-die-reload to find out. &lt;br /&gt;
&lt;br /&gt;
* It is generally wise to run only one or two buffs all around and activate additional buffs only when needed. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Activated Abilities'''&lt;br /&gt;
&lt;br /&gt;
Activated abilities (use_type = 4) are abilities that instantly execute their effect (see Targeting Behavior below). Most melee talents or targeted spells fall in this category. There are several sub-types of activated abilies, such as&lt;br /&gt;
&lt;br /&gt;
* Targeted, single target spells and talents (such as Winter's Grasp or Flurry)&lt;br /&gt;
* Ground targeted abilities (such as Blizzard or various Glyphs)&lt;br /&gt;
* Self targeted activated abilities.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Targeting Behavior ====&lt;br /&gt;
&lt;br /&gt;
An abilities targeting behavior is controlled by several settings in abi_base.xls&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''AutoTarget''' is a boolean field that defines how the UI resolves targeting.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-  &lt;br /&gt;
| 0 || The UI will always bring up a targeting cursor. &lt;br /&gt;
|-&lt;br /&gt;
| 1 || The UI will only produce a targeting cursor if no suitable target is currently selected. e.g if the player currently has a hostile creature targeted and if the spells TargetType includes 0x4 (hostile), the ability will trigger immediately, not producing a targeting cursor. Most single target spells and talents use this setting.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Regardless of AutoTarget setting, the UI will never produce a targeting cursor if an ability is type 0x1 (self) -&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''TargetType''' is a bit mask derived from the following table and controls the behavior of the UI's targeting cursor.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-  &lt;br /&gt;
|'''Bitmask''' || '''Effect'''&lt;br /&gt;
|-&lt;br /&gt;
| 0x1  ||  Self&lt;br /&gt;
|-&lt;br /&gt;
| 0x2 || Friendly Creature&lt;br /&gt;
|-&lt;br /&gt;
| 0x4 || Hostile Creature&lt;br /&gt;
|-&lt;br /&gt;
| 0x8 || Placeable Object&lt;br /&gt;
|-&lt;br /&gt;
| 0x10 || Area of Effect Object (deprecated)&lt;br /&gt;
|-&lt;br /&gt;
| 0x20 || Ground (see details)&lt;br /&gt;
|-&lt;br /&gt;
| 0x40 || Dead Body (deprecated)&lt;br /&gt;
|-&lt;br /&gt;
| 0x80 || Party Member&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''AutoDraw''' is an integer boolean field that defines how a character's weapons are handled when the ability is triggered.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-  &lt;br /&gt;
| 0 || The ability will not affect the player's weapon sheath status.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || The engine will force the player to draw/unsheathe his weapon before executing the ability. This is used for most bow and melee weapon abilities. &lt;br /&gt;
|-&lt;br /&gt;
| 2 || The engine will force the player to stow away any non staff melee weapons before executing the ability. This is used to ensure that no inappropriate animations play with weapons drawn (e.g. the player conjuring with a sword clipping through his body) and to discourage switching between melee and spellcasting on the fly.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Balancing (Cost, Cooldown, etc) ====&lt;br /&gt;
&lt;br /&gt;
Abilities in Dragon Age are balanced along several vectors, most of which boil down to simple 'use frequency'. As a general rule of thumb, the more specialized and limited the effect of an ability is, the more outrageously powerful an ability can be.&lt;br /&gt;
&lt;br /&gt;
Use frequency of abilities can be adjusted by modifying the following field in abi_base.xls&lt;br /&gt;
&lt;br /&gt;
* Cost: This is the simple mana (spells) or stamina (talents) activation cost of an ability. It is subtracted when the conjure phase of the spell has succesfully completed (e.g. no cost for spell interruptions). Without sufficient resources to cover activation cost, the UI will not allow the player to execute the ability. The value is a constant integer and is multiplied with 1+(Current Fatigue) of the caster. &lt;br /&gt;
&lt;br /&gt;
* Cooldown: Cooldown is a constant float in seconds that defines how long the player has to wait after the successful activation of an ability until he can use it again. For abilities that apply duration based debuffs or effects to a target, cooldown is usually set slightly higher than the duration of the effect to avoid stacking by the same caster.&lt;br /&gt;
&lt;br /&gt;
* Upkeep: Defines how much mana or stamina is removed from the casters overall pool while a sustained ability is active. This naturally limits the number of sustained abilities present on a creature and ensures that the more beneficial buffs are active on the caster, the less mana is available for immediate use.&lt;br /&gt;
&lt;br /&gt;
* [[Fatigue]]: Fatigue affects use frequency only indirectly, but it prevents characters from stacking too many buffs on each other, as each sustained ability active usually adds around 5-10% fatigue to the caster.&lt;br /&gt;
&lt;br /&gt;
* Mana/Stamina drain: By reducing the mana/stamina regeneration rate on a creature, the duration for which a sustained ability can be used can be restricted. This mechanic is used only for the most powerful sustained abilities in the game, which are flagged to turn off when the caster sustaining them reaches 0 mana/stamina.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Other balancing vectors:&lt;br /&gt;
&lt;br /&gt;
* AoESize and AoeShape: Area of effect spells that deal friendly fire are location and situation restricted on normal+ difficulty (hard+ on the consoles). Since dropping an Inferno on your own party members is hardly a good idea in most cases, the usefulness of the spell becomes restricted to careful positioning and the earlier stages of combat. &lt;br /&gt;
&lt;br /&gt;
* Threat Generation: Abilities apply threat not just by damage but often by activation. Higher activation threat of an ability can balance out outrageously powerful effects by making it harder for the player to use the spell. The prime example is the Walking Bomb kind of spells which deal excellent damage, but, on higher difficulties, also make the targets very very angry at the caster.  Using these spells effectively often requires a tactical approach by the player, thus limiting their universal usefulness and offsetting their very powerful effects.&lt;br /&gt;
&lt;br /&gt;
* Threat Removal: Some abilities are designed to only provide a short term benefit (Such as 3s stun on Mindblast) but offset their weakness by removing threat from the caster, often by reinitializing the threat tables on the target, causing enemies to randomly seek new targets.&lt;br /&gt;
&lt;br /&gt;
* Conjure time: Spells with a conjure time of 1+ (Speed in abi_base.xls) can be interrupted by damage, limiting their usefulness in melee situations or when only one party member remains on the battlefield. Many of the very powerful Area of Effect type spells use this feature. Most activated spells have a conjure time of 0, making them instant cast.&lt;br /&gt;
&lt;br /&gt;
* Range: Lower ranges force the ability user into potentially more dangerous situations, adding additional risk to the use of an ability.&lt;br /&gt;
&lt;br /&gt;
=== Q&amp;amp;A ===&lt;br /&gt;
&lt;br /&gt;
==== Q: Where do we find the exact formula for abilities ? ====&lt;br /&gt;
&lt;br /&gt;
A: Due to most abilities being unique, the only place to find the exact details on each spell is in the scripts. While a lot of data can be glanced from abi_base.xls, a lot of the detailed mechanics are very different between abilities and can only be found in the appropriate spellscript. The *_constant.nss files hold some basic values, but often get further modified in the scripts. &lt;br /&gt;
&lt;br /&gt;
This is also one of the reasons why some elements of a talent are not displayed in the UI description in game. While we can calculate cost and cooldown based on the casting character and his fatigue and other properties (and consequently display it), we can usually not calculate damage or duration as they are mitigated on the target creature: &lt;br /&gt;
&lt;br /&gt;
Displaying those values results in very misleading information (e.g. while damage seems to be higher on one ability, the mitigation mechanisms and unique side effects of another ability will make it just as good or better - in certain situations) and it turned out to be better to provide the player with general guidance than the misleading information.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Q: What is Spellpower and how does it interact with abilities ====&lt;br /&gt;
&lt;br /&gt;
Spellpower is probably the most important stat for a mage character (and only exists on mage characters). It is calculated as max(Magic - 10,0) and therefore increases by one point for every point a mage spends on his Magic attribute.&lt;br /&gt;
&lt;br /&gt;
Most mage spells benefit directly from higher spellpower by increased damage, effect magnitude and duration. It also plays a role in a mages ability to overcome mental or physical resistance on a target (where applicable). The actual impact of spellpower on an ability varies from spell to spell but the most common construct equates to something like 1% increase in spell potency per point of Spellpower. Thus, items and spells that increase spellpower are very powerful as they increase the potency of every spell the mage can cast.&lt;br /&gt;
&lt;br /&gt;
Spellpower is the only factor that causes an increase of a spells potency over time, so a level 20 mage with neglected the Magic attribute would be much less powerful than a mage that didn't neglect Magic.&lt;br /&gt;
&lt;br /&gt;
Some examples:&lt;br /&gt;
&lt;br /&gt;
* The damage potential for Winter's Grasp is calculated as (100.0f + GetCreatureSpellPower(stEvent.oCaster)) * 0.36f;&lt;br /&gt;
* The healing potential for the heal spell is calculated as (100.0f + GetCreatureSpellPower(stEvent.oCaster)) * 0.40f;&lt;br /&gt;
* The damage over time component of blizzard is executed as ApplyEffectDamageOverTime(a[i], oCreator, ABILITY_SPELL_BLIZZARD,  (100.0f + GetCreatureSpellPower(oCreator)) * 0.1, (BLIZZARD_INTERVAL_DURATION - 0.5f), DAMAGE_TYPE_COLD);&lt;br /&gt;
&lt;br /&gt;
Note that these formulas only list the raw damage potential and do not take into account the effects of damage types, difficulty, rank, resistances, magical shields and any other mitigating factors on the target or enhancing factors on the caster. This means that just comparing the numbers will not give you an idea which spell is better or worse.&lt;br /&gt;
&lt;br /&gt;
For non-mage spells and abilities, spellpower is often substituted by an appropriate other construct (such as max(Cunning-10,0) for rogue abilities).&lt;br /&gt;
&lt;br /&gt;
==== Q: Can we have the damage formula for abilities ? ====&lt;br /&gt;
&lt;br /&gt;
A: There is no damage formula for abilities, as mentioned before, each ability follows their own rules.&lt;br /&gt;
&lt;br /&gt;
In general, talent damage is based on the weapon being used (e.g. Assault does 3 melee attacks that deal weapon damage with some additional bonuses) and are modified by external cirumstances such as location, critical chance and ability to deliver a backstab and are mitigated by armor on the target.&lt;br /&gt;
&lt;br /&gt;
Spells deal damage of different damage types following a rough rule of (Constant * (Spellpower / Variable)) / [Variables] ) + Modifiers but this only tells part of the story as actual damage is dependent on the target, it's resistances, rank and a number of other factors.&lt;br /&gt;
&lt;br /&gt;
Some additional factors affecting spell damage are:&lt;br /&gt;
&lt;br /&gt;
* damage resistance.&lt;br /&gt;
* magical shields.&lt;br /&gt;
* difficulty level.&lt;br /&gt;
* elemental damage bonuses from spells or items &lt;br /&gt;
* Environmental conditions (frozen targets take less damage from fire, etc.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Q: What are the differences between damage types? ====&lt;br /&gt;
&lt;br /&gt;
A: Creatures have variable damage resistances based on their type and rank. Dragons might get 60% less damage from fire (60% fire resistance), other creatures will have different immunities. Additional effects are:&lt;br /&gt;
&lt;br /&gt;
* Electricity: In addition to normal damage, these also reduce the targets stamina (but not mana) by the same amount, making them very effective boss killers.&lt;br /&gt;
&lt;br /&gt;
* Fire: Cancels Cold based damage over time effects and applies damage over time.&lt;br /&gt;
&lt;br /&gt;
* Cold: Cancel Fire based damage over time effects and often is accompanied by slow or slipping effects.&lt;br /&gt;
&lt;br /&gt;
* Spirit: There are very few ways of increasing spirit resistance in the game, so spells dealing spirit damage are universally useful...&lt;br /&gt;
&lt;br /&gt;
* Nature: Rarely found on spells. Many creatures are resistant to this.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(This should probably go on its own wiki page)&lt;br /&gt;
&lt;br /&gt;
==== Q: Are sustained abilities mutually exclusive ? ====&lt;br /&gt;
&lt;br /&gt;
A: There is a very limited number of sustained abilities that are mutually exclusive, usually because it makes sense. Mutually exclusive abilities cancel each other upon activation.&lt;br /&gt;
&lt;br /&gt;
* Shield stances (Shield Wall, Shield Cover, Shield Defense) are mutually exclusive.&lt;br /&gt;
* Archery stances (Aim, Rapid Fire, Defensive Fire) are mutually exclusive.&lt;br /&gt;
* Shapeshifting forms are (Sorry, no Bear-Wolfspider) are mutually exclusive.&lt;br /&gt;
* Weapon Enhancement spells are too, but only for the same caster (so two mages can run two different weapon enhancements if they want to).&lt;br /&gt;
* Bard Songs are mutually exclusive.&lt;br /&gt;
* The Death Syphon and Death Magic spells are mutually exclusive.&lt;br /&gt;
&lt;br /&gt;
Technically, all abilities in abi_base.xls that share the same 'condition_group' value are mutually exclusive.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Q: What are the rules for stacking effects and damage ? ====&lt;br /&gt;
&lt;br /&gt;
A: The general rules of stacking for abilities are:&lt;br /&gt;
&lt;br /&gt;
* Identical effect from different abilities stack (e.g. getting +10 attack from one ability and +10 attack from another nets +20 attack).&lt;br /&gt;
* The effects of identical abilities stack as long as they are from different caster. (Same caster usually does not apply as cooldown often exceeds duration).&lt;br /&gt;
* Weapon enhancement spells of the same type (e.g. 2 mages with flame weapons) do not stack. The sword does not get more flaming, sorry :)&lt;br /&gt;
* Animation based effects (knockdown, stun, etc.) stack, but only the one with the highest priority is played. This is defined in the priority column in effects.xls. &lt;br /&gt;
* Glyphs do stack but there is a limit of 5 active glyphs per caster.&lt;br /&gt;
* Fire and Cold DoT effects do not stack, the spell cast last will cancel any existing spell of the opposite type.&lt;br /&gt;
* Fire and Cold AoEs cancel each other, other AoEs might interact rather violently, handle with care :)&lt;br /&gt;
&lt;br /&gt;
For equipment and item based effects, the game usually stacks within the minumum and maximum clamp values of a property (properties.xls). This means that you can accumulate a lot of +damage or +critical critical chance effects, but for some type of stats there is a point where you are no longer gaining any benefits (e.g. speed modification - animations can only be sped up to a certain point before breaking, so stacking momentum, haste and a weapon with a speed based effect will not result in a -3.0s attack time, sorry :p)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For almost all effects, the total result of all property modifications on a creature are visible on the main character UI by hovering over the individual stats.&lt;br /&gt;
&lt;br /&gt;
==== Q: How does game difficulty affect abilities ? ====&lt;br /&gt;
&lt;br /&gt;
A: Our approach to game difficulty dictates that the effect of your chosen setting are&lt;br /&gt;
&lt;br /&gt;
a) non punishing - You do not get less XP for chosing a lower difficulty mode, etc.&lt;br /&gt;
b) challenge scaling - Higher difficulty will reward you with greater obstacles to overcome.&lt;br /&gt;
c) fair - Lower difficulties grant benefits that gradually get removed. (This does not mean the rules are symmetric and is not true on nightmare at all. Nightmare is evil. And unfair.)&lt;br /&gt;
d) non persistent - Difficulty changes are possible on the fly, at any time and take immediate effect.&lt;br /&gt;
&lt;br /&gt;
The game is balanced so that Hard mode is challenging for a Baldur's gate veteran.&lt;br /&gt;
&lt;br /&gt;
Based on these guidelines, you can expect the following ability behaviors in game:&lt;br /&gt;
&lt;br /&gt;
* The lower the difficulty, the longer your hostile effects such as stuns will last on enemies and the shorter they will last on you.&lt;br /&gt;
* The lower the difficulty, the more damage your abilities will do.&lt;br /&gt;
* The lower the difficulty, the less likely the enemy AI will use devastating special abilities (Note: less likely does not mean 'does not use').&lt;br /&gt;
* Casual and Normal have reduced friendly or nullified fire damage damage from area effect spells. Hard and Nightmare require careful positioning and tactical use of spells.&lt;br /&gt;
* The higher the difficulty, the more careful you need to manage threat when using spells and abilities (The AI becomes smarter about picking targets).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Q: What is spell affinity ? ====&lt;br /&gt;
&lt;br /&gt;
A: Spell Affinity was a design we toyed with for a while during development but decided not to implement.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Q: How does Rank Based Mitigation Work ? ====&lt;br /&gt;
&lt;br /&gt;
A: In line with Dragon Age: Origin's asymmetric approach to rules, the game uses creature ranks (instead of levels) in addition to stats and resistances to define how creatures get affected by abilities. In short: Boss monsters get affected differently by abilities and effects than Lieutenants or Critters. &lt;br /&gt;
&lt;br /&gt;
The rank system is the primary balancing vector for the games difficulty levels and profoundly affects all aspects of combat. The gory details of this system are defined in creature_ranks.xls and difficulty.xls.&lt;br /&gt;
&lt;br /&gt;
Rank mitigation affects not just damage in- and output of a creature, but also the duration that hostile effects persist on it and is different for each difficulty level of the game. Note that party members have their own rank in this system and are handled differently from other creatures in some cases. &lt;br /&gt;
&lt;br /&gt;
Below is the formula used for rank based effect duration mitigation: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
// sys_resistances_h&lt;br /&gt;
// @brief Returns an effect duration scaled by rank of oCreature and game difficulty&lt;br /&gt;
// @author Georg&lt;br /&gt;
float GetRankAdjustedEffectDuration(object oCreature, float fDur)&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    // Georg: This deserves some explanation:&lt;br /&gt;
    //&lt;br /&gt;
    //        One of the core issues when designing the combat system was always&lt;br /&gt;
    //        the fact that the story called for sequences during the game in which&lt;br /&gt;
    //        your main character acts solo.&lt;br /&gt;
    //&lt;br /&gt;
    //        Characters reliant on special abilities, such as rogues, would require&lt;br /&gt;
    //        them to be very effective in order to beat enemies that a standard tank&lt;br /&gt;
    //        can plow through. However, if these abilities would maintain the same&lt;br /&gt;
    //        effectiveness in a full party, most encounters would turn into a stunfest.&lt;br /&gt;
    //&lt;br /&gt;
    //        The solution is to add 1 second flat to each detrimental effect duration&lt;br /&gt;
    //        lasting at least 1 second for each unoccupied slot in the party - before applying&lt;br /&gt;
    //        rank and difficulty modifiers. This also makes solo play a bit more viable.&lt;br /&gt;
    //&lt;br /&gt;
    //        This is in addition to the diminishing returns on quickly successive stuns.&lt;br /&gt;
    //&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    if (!IsPartyMember(oCreature))&lt;br /&gt;
    {&lt;br /&gt;
        float fPartySizeModifier = IntToFloat(Max(0,4 - GetArraySize(GetPartyList())));&lt;br /&gt;
&lt;br /&gt;
        if (fDur &amp;gt;= 1.0f)&lt;br /&gt;
        {&lt;br /&gt;
            fDur += fPartySizeModifier;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    float fRankDurMod = Diff_GetDurationModifier(oCreature);&lt;br /&gt;
    if (fRankDurMod &amp;gt;0.0f)&lt;br /&gt;
    {&lt;br /&gt;
        return (fDur * fRankDurMod);&lt;br /&gt;
    }&lt;br /&gt;
    else&lt;br /&gt;
    {&lt;br /&gt;
     return fDur;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Scripts]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Q: What does 'asymmetric rules system' mean ? ====&lt;br /&gt;
&lt;br /&gt;
The goal behind Dragon Age: Origin's rule system was to create a fun and challenging video game experience first and foremost. &lt;br /&gt;
&lt;br /&gt;
We describe the rules as 'asymmetric' because a subset of the game rules treats player controlled characters and monsters differently, which is a deviation from pen and paper rule design that often require player and opponents to be treated exactly the same. &lt;br /&gt;
&lt;br /&gt;
Notable Examples:&lt;br /&gt;
* Party members never die permanently (get shattered, etc.)&lt;br /&gt;
* Differently ranked creatures (including party members) get affected for different durations by effects&lt;br /&gt;
* In limited situations in the game, we apply benefits to the player to overcome greater odds than they would usually be able to. &lt;br /&gt;
* Some abilities will work diferently when deployed against the party (although the visual results might be identical).&lt;br /&gt;
* Elimination of instant death situations (not fun!) against players but not against monsters (fun!).&lt;/div&gt;</summary>
		<author><name>Georg Zoeller</name></author>	</entry>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=Classes&amp;diff=7238</id>
		<title>Classes</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=Classes&amp;diff=7238"/>
				<updated>2009-10-27T22:21:46Z</updated>
		
		<summary type="html">&lt;p&gt;Georg Zoeller: /* Character Creation Scripting */  Added list of relevant scripts&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Work in progress''&lt;br /&gt;
&lt;br /&gt;
=== Overview ===&lt;br /&gt;
&lt;br /&gt;
Dragon Age: Origins is a strongly class based RPG featuring 3 distinct character classes with exclusive abilities and progressions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Description ===&lt;br /&gt;
&lt;br /&gt;
This page explains the technical implementation and role of character classes in Dragon Age: Origins and is aimed at people wishing to create new content, modifications or adventures using the Dragon Age ruleset.&lt;br /&gt;
&lt;br /&gt;
The classes of the game are defined in '''[[CLA_base.xls]]'''.  &lt;br /&gt;
The following is an excerpt of the game rules and systems relevant columns in the file and illustrates how data relating to character class is stored.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; width=&amp;quot;100%&amp;quot; style=&amp;quot;font-size:xx-small&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|'''ID'''||'''Label'''||'''BaseHealth'''||'''BaseManaStamina'''||'''DepletableProgression'''||'''StrAdjust'''||'''ConAdjust'''||'''WillAdjust'''||'''MagAdjust'''||'''IntAdjust'''||'''DexAdjust'''||'''BaseAttack'''||'''BaseDefense'''||'''DefensePerLevel'''||'''HealthPerLevel'''||'''LevelsPerAbility'''||'''LevelsPerSkill'''||'''DamagePerLevel'''&lt;br /&gt;
|-&lt;br /&gt;
|0||INVALID||****||****||****||****||****||****||****||****||****||****||****||****||****||****||****||****|&lt;br /&gt;
|-&lt;br /&gt;
|1||Warrior||100||100||5||4||3||0||0||0||3||60||45||1||6||1||3||0.4&lt;br /&gt;
|-&lt;br /&gt;
|2||Wizard||85||115||6||0||0||4||5||1||0||50||40||1||4||1||3||0.1&lt;br /&gt;
|-&lt;br /&gt;
|3||Rogue||90||90||4||0||0||2||0||4||4||55||50||1||5||1||2||0.2&lt;br /&gt;
|-|&lt;br /&gt;
|}&lt;br /&gt;
For details on the meaning and of each column, please refer to '''[[CLA_base.xls]]'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Character Creation Scripting === &lt;br /&gt;
&lt;br /&gt;
Dragon Age characters are 'blank' when the game starts, with all their [[Creature Properties]] initialized to default values. &lt;br /&gt;
&lt;br /&gt;
The character generation scripts, through interaction through the Character Creation UIs, use the data in [[CLA_base.xls]] to construct the character based on the player's choices and are also responsible for any modification to the character's base stats during the Levelup process.&lt;br /&gt;
&lt;br /&gt;
Note that major party members will use the character creation scripts, hostile enemies use a speed optimized and abreviated algorithm to determine their attributes based on rank, AI package and level. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Scripts ====&lt;br /&gt;
&lt;br /&gt;
The scripts that handle most of character creation and levelup are:&lt;br /&gt;
&lt;br /&gt;
* sys_chargen - Entry point for all character creation based [[Event]]s that get routed into this file from module_core.nss. &lt;br /&gt;
* sys_chargen_h - Library containing most of the underlying logic for modifying [[Creature Properties]] based on the game rules.&lt;br /&gt;
* sys_chargen_engine - Include defining a few constants and containing some snippets of relevant engine code for reference.&lt;br /&gt;
* sys_autolevelup_h - File defining the logic used by Party Member NPCs to level up when they are hired. After that, they use normal levelup.&lt;br /&gt;
* sys_autoscale_h - Contains shared logic used for determining levelup condition and code for creature autoscaling.&lt;br /&gt;
* sys_rewards_h - File containing XP reward entry point and levelup checks.&lt;br /&gt;
&lt;br /&gt;
[[Category: Scripting]]&lt;/div&gt;</summary>
		<author><name>Georg Zoeller</name></author>	</entry>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=CLA_base.xls&amp;diff=7237</id>
		<title>CLA base.xls</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=CLA_base.xls&amp;diff=7237"/>
				<updated>2009-10-27T22:11:56Z</updated>
		
		<summary type="html">&lt;p&gt;Georg Zoeller: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This 2da file is used to define the [[Classes|Character Classes]] available in Dragon Age: Origins.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== CLA_data worksheet ==&lt;br /&gt;
&lt;br /&gt;
{{2da start|CLA_data}}&lt;br /&gt;
{{2da column| Label | string | }}&lt;br /&gt;
{{2da column| NameStrref |int| the reference ID number of a string in the string table that has this class' name in it. Use the [[String Editor]] to view strings by ID.}}&lt;br /&gt;
{{2da column| PluralStrref | int | a string in the string table with the class' name, pluralized}}&lt;br /&gt;
{{2da column| LowerStrref | int | }}&lt;br /&gt;
{{2da column| DescStrref| int | A short description of the class.}}&lt;br /&gt;
{{2da column| TooltipStrref |int| Tooltip text for the class.}}&lt;br /&gt;
{{2da column| Icon | resource | Icon used to represent this class in character generation.}}&lt;br /&gt;
{{2da column| Constant | string|  The name of the constant used in scripts to refer to this class. eg, &amp;quot;CLASS_Warrior&amp;quot;.}}&lt;br /&gt;
{{2da column| Package | int | }}&lt;br /&gt;
{{2da column| BaseHealth | float | }}&lt;br /&gt;
{{2da column| bUsesMana |int| 0 sets this class to use stamina for its abilities, 1 sets it to use mana.}}&lt;br /&gt;
{{2da column| BaseManaStamina | float | }}&lt;br /&gt;
{{2da column| DepletableProgression | float | }}&lt;br /&gt;
{{2da column| StrAdjust |float| a bonus this class gets to starting strength attribute }}&lt;br /&gt;
{{2da column| ConAdjust |float| a bonus this class gets to starting constitution attribute }}&lt;br /&gt;
{{2da column| WillAdjust |float| a bonus this class gets to starting willpower attribute }}&lt;br /&gt;
{{2da column| MagAdjust |float| a bonus this class gets to starting magic attribute }}&lt;br /&gt;
{{2da column| IntAdjust |float| a bonus this class gets to starting cunning attribute }}&lt;br /&gt;
{{2da column| DexAdjust |float| a bonus this class gets to starting dexterity attribute }}&lt;br /&gt;
{{2da column| MinLevel |int| The prerequesite level a character must be to take this class. If it's greater than zero, it's an advanced class. '''Note: this column is a remnant of when specialization classes were included in the base class 2DA; this approach is no longer used.'''}}&lt;br /&gt;
{{2da column| BaseClass |int| For advanced classes, this sets which base class it is an advanced class of. The number here refers to the ID of the row that it's a advanced class for. '''Note: this column is a remnant of when specialization classes were included in the base class 2DA; this approach is no longer used.'''}}&lt;br /&gt;
{{2da column| BaseAttack | float | }}&lt;br /&gt;
{{2da column| BaseDefense | float | }}&lt;br /&gt;
{{2da column| DefensePerLevel | float | }}&lt;br /&gt;
{{2da column| HealthPerLevel | float | }}&lt;br /&gt;
{{2da column| LevelsPerAbility | int | How many levels before gaining an ability. Example. If a 3 is here, it means you get an ability on every level divisible by 3}}&lt;br /&gt;
{{2da column| LevelsPerSkill | int | How many levels before gaining a skill. Example. If a 3 is here, it means you get an ability on every level divisible by 3}}&lt;br /&gt;
{{2da column| DamagePerLevel | float | This was a fudge added to the rule system to diminish the power that Strength's bonus damage had. Basically, this is just added to the base damage bonus of the character.}}&lt;br /&gt;
{{2da column| StartingAbility1 | int | This is an index into the ABI 2da. If its valid it will add that ability to the character when you first take a level with the class. This is used for the hidden talent that all classes get. This talent is used in subsequent prereq checks}}&lt;br /&gt;
{{2da column| StartingAbility2 | int | This is an index into the ABI 2da. If its valid it will add that ability to the character when you first take a level with the class.}}&lt;br /&gt;
{{2da column| PlayerClass |int| Determines whether this class can be taken by a player.}}&lt;br /&gt;
{{2da column| CharGenLabel| string| }}&lt;br /&gt;
{{2da column| Achievement | string| Required Achievement to unlock this class permanently}}&lt;br /&gt;
{{2da end}}&lt;br /&gt;
[[Category:2DAs]]&lt;/div&gt;</summary>
		<author><name>Georg Zoeller</name></author>	</entry>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=CLA_base.xls&amp;diff=7236</id>
		<title>CLA base.xls</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=CLA_base.xls&amp;diff=7236"/>
				<updated>2009-10-27T22:10:01Z</updated>
		
		<summary type="html">&lt;p&gt;Georg Zoeller: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== CLA_data worksheet ==&lt;br /&gt;
&lt;br /&gt;
{{2da start|CLA_data}}&lt;br /&gt;
{{2da column| Label | string | }}&lt;br /&gt;
{{2da column| NameStrref |int| the reference ID number of a string in the string table that has this class' name in it. Use the [[String Editor]] to view strings by ID.}}&lt;br /&gt;
{{2da column| PluralStrref | int | a string in the string table with the class' name, pluralized}}&lt;br /&gt;
{{2da column| LowerStrref | int | }}&lt;br /&gt;
{{2da column| DescStrref| int | A short description of the class.}}&lt;br /&gt;
{{2da column| TooltipStrref |int| Tooltip text for the class.}}&lt;br /&gt;
{{2da column| Icon | resource | Icon used to represent this class in character generation.}}&lt;br /&gt;
{{2da column| Constant | string|  The name of the constant used in scripts to refer to this class. eg, &amp;quot;CLASS_Warrior&amp;quot;.}}&lt;br /&gt;
{{2da column| Package | int | }}&lt;br /&gt;
{{2da column| BaseHealth | float | }}&lt;br /&gt;
{{2da column| bUsesMana |int| 0 sets this class to use stamina for its abilities, 1 sets it to use mana.}}&lt;br /&gt;
{{2da column| BaseManaStamina | float | }}&lt;br /&gt;
{{2da column| DepletableProgression | float | }}&lt;br /&gt;
{{2da column| StrAdjust |float| a bonus this class gets to starting strength attribute }}&lt;br /&gt;
{{2da column| ConAdjust |float| a bonus this class gets to starting constitution attribute }}&lt;br /&gt;
{{2da column| WillAdjust |float| a bonus this class gets to starting willpower attribute }}&lt;br /&gt;
{{2da column| MagAdjust |float| a bonus this class gets to starting magic attribute }}&lt;br /&gt;
{{2da column| IntAdjust |float| a bonus this class gets to starting cunning attribute }}&lt;br /&gt;
{{2da column| DexAdjust |float| a bonus this class gets to starting dexterity attribute }}&lt;br /&gt;
{{2da column| MinLevel |int| The prerequesite level a character must be to take this class. If it's greater than zero, it's an advanced class. '''Note: this column is a remnant of when specialization classes were included in the base class 2DA; this approach is no longer used.'''}}&lt;br /&gt;
{{2da column| BaseClass |int| For advanced classes, this sets which base class it is an advanced class of. The number here refers to the ID of the row that it's a advanced class for. '''Note: this column is a remnant of when specialization classes were included in the base class 2DA; this approach is no longer used.'''}}&lt;br /&gt;
{{2da column| BaseAttack | float | }}&lt;br /&gt;
{{2da column| BaseDefense | float | }}&lt;br /&gt;
{{2da column| DefensePerLevel | float | }}&lt;br /&gt;
{{2da column| HealthPerLevel | float | }}&lt;br /&gt;
{{2da column| LevelsPerAbility | int | How many levels before gaining an ability. Example. If a 3 is here, it means you get an ability on every level divisible by 3}}&lt;br /&gt;
{{2da column| LevelsPerSkill | int | How many levels before gaining a skill. Example. If a 3 is here, it means you get an ability on every level divisible by 3}}&lt;br /&gt;
{{2da column| DamagePerLevel | float | This was a fudge added to the rule system to diminish the power that Strength's bonus damage had. Basically, this is just added to the base damage bonus of the character.}}&lt;br /&gt;
{{2da column| StartingAbility1 | int | This is an index into the ABI 2da. If its valid it will add that ability to the character when you first take a level with the class. This is used for the hidden talent that all classes get. This talent is used in subsequent prereq checks}}&lt;br /&gt;
{{2da column| StartingAbility2 | int | This is an index into the ABI 2da. If its valid it will add that ability to the character when you first take a level with the class.}}&lt;br /&gt;
{{2da column| PlayerClass |int| Determines whether this class can be taken by a player.}}&lt;br /&gt;
{{2da column| CharGenLabel| string| }}&lt;br /&gt;
{{2da column| Achievement | string| Required Achievement to unlock this class permanently}}&lt;br /&gt;
{{2da end}}&lt;br /&gt;
[[Category:2DAs]]&lt;/div&gt;</summary>
		<author><name>Georg Zoeller</name></author>	</entry>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=Classes&amp;diff=7235</id>
		<title>Classes</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=Classes&amp;diff=7235"/>
				<updated>2009-10-27T22:02:43Z</updated>
		
		<summary type="html">&lt;p&gt;Georg Zoeller: /* Character Creation Scripting */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Work in progress''&lt;br /&gt;
&lt;br /&gt;
=== Overview ===&lt;br /&gt;
&lt;br /&gt;
Dragon Age: Origins is a strongly class based RPG featuring 3 distinct character classes with exclusive abilities and progressions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Description ===&lt;br /&gt;
&lt;br /&gt;
This page explains the technical implementation and role of character classes in Dragon Age: Origins and is aimed at people wishing to create new content, modifications or adventures using the Dragon Age ruleset.&lt;br /&gt;
&lt;br /&gt;
The classes of the game are defined in '''[[CLA_base.xls]]'''.  &lt;br /&gt;
The following is an excerpt of the game rules and systems relevant columns in the file and illustrates how data relating to character class is stored.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; width=&amp;quot;100%&amp;quot; style=&amp;quot;font-size:xx-small&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|'''ID'''||'''Label'''||'''BaseHealth'''||'''BaseManaStamina'''||'''DepletableProgression'''||'''StrAdjust'''||'''ConAdjust'''||'''WillAdjust'''||'''MagAdjust'''||'''IntAdjust'''||'''DexAdjust'''||'''BaseAttack'''||'''BaseDefense'''||'''DefensePerLevel'''||'''HealthPerLevel'''||'''LevelsPerAbility'''||'''LevelsPerSkill'''||'''DamagePerLevel'''&lt;br /&gt;
|-&lt;br /&gt;
|0||INVALID||****||****||****||****||****||****||****||****||****||****||****||****||****||****||****||****|&lt;br /&gt;
|-&lt;br /&gt;
|1||Warrior||100||100||5||4||3||0||0||0||3||60||45||1||6||1||3||0.4&lt;br /&gt;
|-&lt;br /&gt;
|2||Wizard||85||115||6||0||0||4||5||1||0||50||40||1||4||1||3||0.1&lt;br /&gt;
|-&lt;br /&gt;
|3||Rogue||90||90||4||0||0||2||0||4||4||55||50||1||5||1||2||0.2&lt;br /&gt;
|-|&lt;br /&gt;
|}&lt;br /&gt;
For details on the meaning and of each column, please refer to '''[[CLA_base.xls]]'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Character Creation Scripting === &lt;br /&gt;
&lt;br /&gt;
Dragon Age characters are 'blank' when the game starts, with all their [[Creature Properties]] initialized to default values. &lt;br /&gt;
&lt;br /&gt;
The character generation scripts, through interaction through the Character Creation UIs, use the data in [[CLA_base.xls]] to construct the character based on the player's choices and are also responsible for any modification to the character's base stats during the Levelup process.&lt;/div&gt;</summary>
		<author><name>Georg Zoeller</name></author>	</entry>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=Classes&amp;diff=7234</id>
		<title>Classes</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=Classes&amp;diff=7234"/>
				<updated>2009-10-27T22:02:33Z</updated>
		
		<summary type="html">&lt;p&gt;Georg Zoeller: /* Description */  Shrunk fonts to fit table on page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Work in progress''&lt;br /&gt;
&lt;br /&gt;
=== Overview ===&lt;br /&gt;
&lt;br /&gt;
Dragon Age: Origins is a strongly class based RPG featuring 3 distinct character classes with exclusive abilities and progressions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Description ===&lt;br /&gt;
&lt;br /&gt;
This page explains the technical implementation and role of character classes in Dragon Age: Origins and is aimed at people wishing to create new content, modifications or adventures using the Dragon Age ruleset.&lt;br /&gt;
&lt;br /&gt;
The classes of the game are defined in '''[[CLA_base.xls]]'''.  &lt;br /&gt;
The following is an excerpt of the game rules and systems relevant columns in the file and illustrates how data relating to character class is stored.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; width=&amp;quot;100%&amp;quot; style=&amp;quot;font-size:xx-small&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|'''ID'''||'''Label'''||'''BaseHealth'''||'''BaseManaStamina'''||'''DepletableProgression'''||'''StrAdjust'''||'''ConAdjust'''||'''WillAdjust'''||'''MagAdjust'''||'''IntAdjust'''||'''DexAdjust'''||'''BaseAttack'''||'''BaseDefense'''||'''DefensePerLevel'''||'''HealthPerLevel'''||'''LevelsPerAbility'''||'''LevelsPerSkill'''||'''DamagePerLevel'''&lt;br /&gt;
|-&lt;br /&gt;
|0||INVALID||****||****||****||****||****||****||****||****||****||****||****||****||****||****||****||****|&lt;br /&gt;
|-&lt;br /&gt;
|1||Warrior||100||100||5||4||3||0||0||0||3||60||45||1||6||1||3||0.4&lt;br /&gt;
|-&lt;br /&gt;
|2||Wizard||85||115||6||0||0||4||5||1||0||50||40||1||4||1||3||0.1&lt;br /&gt;
|-&lt;br /&gt;
|3||Rogue||90||90||4||0||0||2||0||4||4||55||50||1||5||1||2||0.2&lt;br /&gt;
|-|&lt;br /&gt;
|}&lt;br /&gt;
For details on the meaning and of each column, please refer to '''[[CLA_base.xls]]'''.&lt;br /&gt;
&lt;br /&gt;
=== Character Creation Scripting === &lt;br /&gt;
&lt;br /&gt;
Dragon Age characters are 'blank' when the game starts, with all their [[Creature Properties]] initialized to default values. &lt;br /&gt;
&lt;br /&gt;
The character generation scripts, through interaction through the Character Creation UIs, use the data in [[CLA_base.xls]] to construct the character based on the player's choices and are also responsible for any modification to the character's base stats during the Levelup process.&lt;/div&gt;</summary>
		<author><name>Georg Zoeller</name></author>	</entry>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=Classes&amp;diff=7233</id>
		<title>Classes</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=Classes&amp;diff=7233"/>
				<updated>2009-10-27T22:01:16Z</updated>
		
		<summary type="html">&lt;p&gt;Georg Zoeller: /* Detailed Description */  Added 2da sample, links to CLA_Base and started writing documentation on how character creation scripting works.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Work in progress''&lt;br /&gt;
&lt;br /&gt;
=== Overview ===&lt;br /&gt;
&lt;br /&gt;
Dragon Age: Origins is a strongly class based RPG featuring 3 distinct character classes with exclusive abilities and progressions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Description ===&lt;br /&gt;
&lt;br /&gt;
This page explains the technical implementation and role of character classes in Dragon Age: Origins and is aimed at people wishing to create new content, modifications or adventures using the Dragon Age ruleset.&lt;br /&gt;
&lt;br /&gt;
The classes of the game are defined in '''[[CLA_base.xls]]'''.  &lt;br /&gt;
The following is an excerpt of the game rules and systems relevant columns in the file and illustrates how data relating to character class is stored.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; width=&amp;quot;100%&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|'''ID'''||'''Label'''||'''BaseHealth'''||'''BaseManaStamina'''||'''DepletableProgression'''||'''StrAdjust'''||'''ConAdjust'''||'''WillAdjust'''||'''MagAdjust'''||'''IntAdjust'''||'''DexAdjust'''||'''BaseAttack'''||'''BaseDefense'''||'''DefensePerLevel'''||'''HealthPerLevel'''||'''LevelsPerAbility'''||'''LevelsPerSkill'''||'''DamagePerLevel'''&lt;br /&gt;
||&lt;br /&gt;
|-&lt;br /&gt;
|0||INVALID||****||****||****||****||****||****||****||****||****||****||****||****||****||****||****||****|&lt;br /&gt;
|-&lt;br /&gt;
|1||Warrior||100||100||5||4||3||0||0||0||3||60||45||1||6||1||3||0.4&lt;br /&gt;
|-&lt;br /&gt;
|2||Wizard||85||115||6||0||0||4||5||1||0||50||40||1||4||1||3||0.1&lt;br /&gt;
|-&lt;br /&gt;
|3||Rogue||90||90||4||0||0||2||0||4||4||55||50||1||5||1||2||0.2&lt;br /&gt;
|-|&lt;br /&gt;
|}&lt;br /&gt;
For details on the meaning and of each column, please refer to '''[[CLA_base.xls]]'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Character Creation Scripting === &lt;br /&gt;
&lt;br /&gt;
Dragon Age characters are 'blank' when the game starts, with all their [[Creature Properties]] initialized to default values. &lt;br /&gt;
&lt;br /&gt;
The character generation scripts, through interaction through the Character Creation UIs, use the data in [[CLA_base.xls]] to construct the character based on the player's choices and are also responsible for any modification to the character's base stats during the Levelup process.&lt;/div&gt;</summary>
		<author><name>Georg Zoeller</name></author>	</entry>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=Classes&amp;diff=7232</id>
		<title>Classes</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=Classes&amp;diff=7232"/>
				<updated>2009-10-27T21:44:02Z</updated>
		
		<summary type="html">&lt;p&gt;Georg Zoeller: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Work in progress''&lt;br /&gt;
&lt;br /&gt;
=== Overview ===&lt;br /&gt;
&lt;br /&gt;
Dragon Age: Origins is a strongly class based RPG featuring 3 distinct character classes with exclusive abilities and progressions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Detailed Description ===&lt;br /&gt;
&lt;br /&gt;
The detailed rules implications of a class are defined in [[CLA_base.xls]]. &lt;br /&gt;
&lt;br /&gt;
In addition to the three base classes&lt;br /&gt;
&lt;br /&gt;
* Mage&lt;br /&gt;
* Warrior&lt;br /&gt;
* Rogue&lt;br /&gt;
&lt;br /&gt;
the 2da defines several additional classes used by creatures in the game as well as special NPCs such as &lt;br /&gt;
&lt;br /&gt;
* Dog&lt;br /&gt;
* Shale&lt;/div&gt;</summary>
		<author><name>Georg Zoeller</name></author>	</entry>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=Classes&amp;diff=7230</id>
		<title>Classes</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=Classes&amp;diff=7230"/>
				<updated>2009-10-27T20:16:32Z</updated>
		
		<summary type="html">&lt;p&gt;Georg Zoeller: Created page with '''Work in progress''  === Overview ===  Dragon Age: Origins is a strongly class based RPG featuring 3 distinct character classes with exclusive abilities and progressions.   === ...'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''Work in progress''&lt;br /&gt;
&lt;br /&gt;
=== Overview ===&lt;br /&gt;
&lt;br /&gt;
Dragon Age: Origins is a strongly class based RPG featuring 3 distinct character classes with exclusive abilities and progressions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Detailed Description ===&lt;br /&gt;
&lt;br /&gt;
The detailed rules implications of a class are defined in [[CLA_BASE.xls]]. &lt;br /&gt;
&lt;br /&gt;
In addition to the three base classes&lt;br /&gt;
&lt;br /&gt;
* Mage&lt;br /&gt;
* Warrior&lt;br /&gt;
* Rogue&lt;br /&gt;
&lt;br /&gt;
the 2da defines several additional classes used by creatures in the game as well as special NPCs such as &lt;br /&gt;
&lt;br /&gt;
* Dog&lt;br /&gt;
* Shale&lt;/div&gt;</summary>
		<author><name>Georg Zoeller</name></author>	</entry>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=Properties.xls&amp;diff=7228</id>
		<title>Properties.xls</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=Properties.xls&amp;diff=7228"/>
				<updated>2009-10-27T19:40:24Z</updated>
		
		<summary type="html">&lt;p&gt;Georg Zoeller: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Depletable properties will be updated by their &amp;quot;combat&amp;quot; every 2 seconds and their &amp;quot;non-combat&amp;quot; values every 5 seconds.&lt;br /&gt;
&lt;br /&gt;
EngineLink:&lt;br /&gt;
* 00 - DerivedDefault : No modification of stats&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
  return 0; // Nothing&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* 01 - DerivedAttack: Each point of STR and DEX above 10 adds + 0.5 attack&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
 return (FLOAT32) ( max( (cPropertiesList.GetValue(PROPERTY_ATTRIBUTE_STRENGTH) -10.0f)/2.0f   , 0.0) +&lt;br /&gt;
                       max( (cPropertiesList.GetValue(PROPERTY_ATTRIBUTE_DEXTERITY) -10.0f)/2.0f   , 0.0));&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* 02 - DerivedDefense: Each point of DEX above 10 adds +1.0 defense&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
  return (FLOAT32) max( (cPropertiesList.GetValue(PROPERTY_ATTRIBUTE_DEXTERITY) -10)   , 0.0) ;&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* 03 - DerivedArmor: No special interaction&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
  return 0; // Nothing&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* 04 - DerivedAP: Each point of CUN above 10 adds +(1/7) points of AP&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
    return (FLOAT32) max( (cPropertiesList.GetValue(PROPERTY_ATTRIBUTE_CUNNING)-10),0.0)/7;&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* 05 - DerivedSpellPower: Each point of MAG above 10 adds +1.0 Spellpower&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
   return (FLOAT32) max( (cPropertiesList.GetValue(PROPERTY_ATTRIBUTE_MAGIC) -10)   , 0.0);&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* 06 - DerivedHealth: Each point of CON above 10 adds 5 points of health.&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
    return (FLOAT32) max( (cPropertiesList.GetValue(PROPERTY_ATTRIBUTE_CONSTITUTION) -10)   , 0.0)*5;&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* 07 - DerivedManaStamina: Each point of WIL above 10 adds 5 points of Mana/Stamina&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
    return (FLOAT32) 	max( (cPropertiesList.GetValue(PROPERTY_ATTRIBUTE_WILLPOWER) -10)   , 0.0)*5;&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* 08 - DerivedResistanceMental: Each mental attribute point above 10 adds 0.5 Mental Resistance.&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
return (FLOAT32)  ( (cPropertiesList.GetValue(PROPERTY_ATTRIBUTE_MAGIC)          -10) +&lt;br /&gt;
                       (cPropertiesList.GetValue(PROPERTY_ATTRIBUTE_WILLPOWER)       -10) + &lt;br /&gt;
                       (cPropertiesList.GetValue(PROPERTY_ATTRIBUTE_INTELLIGENCE))    -10)  / 2.0f;          &lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* 09 - DerivedResistancePhysical: Each physical attribute above 10 adds 0.5 Physical Resistance.&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
    return (FLOAT32)  ( (cPropertiesList.GetValue(PROPERTY_ATTRIBUTE_STRENGTH)       -10) +&lt;br /&gt;
                       (cPropertiesList.GetValue(PROPERTY_ATTRIBUTE_CONSTITUTION)    -10) + &lt;br /&gt;
                       (cPropertiesList.GetValue(PROPERTY_ATTRIBUTE_DEXTERITY)       -10)) / 2.0f;          &lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{2da start|Properties}}&lt;br /&gt;
{{2da column|Stat|string|Human Readable statname. Spaces are not allowed in these strings}}&lt;br /&gt;
{{2da column|Type|string|SIMPLE, ATTRIBUTE, DEPLETABLE}}&lt;br /&gt;
{{2da column|Min|float|Minimum value possible}}&lt;br /&gt;
{{2da column|Max|float|Maximum value possible}}&lt;br /&gt;
{{2da column|UIMapping|int|&lt;br /&gt;
*1: Base resistances&lt;br /&gt;
*2: Deprecated&lt;br /&gt;
*3: Elemental (%) resistances}}&lt;br /&gt;
{{2da column|NameStrId|int|}}&lt;br /&gt;
{{2da column|NameLowerStrId|int|}}&lt;br /&gt;
{{2da column|DescStrId|int|}}&lt;br /&gt;
{{2da column|Desc2StrId|int|Necessary for rows 4 - 9 ONLY. When hovering over the numerical values of the attributes in the character sheet, there should be detailed and technical text written that explains the effects of these stats. Need writing for: Strength, Dexterity, Willpower, Magic, Cunning, Constitution}}&lt;br /&gt;
{{2da column|NonCombatEffect|int|}}&lt;br /&gt;
{{2da column|CombatEffect|int|}}&lt;br /&gt;
{{2da column|EngineLink|int|See above}}&lt;br /&gt;
{{2da column|ToolsetName|string|}}&lt;br /&gt;
{{2da column|bShowInToolset|int|}}&lt;br /&gt;
{{2da column|Constant|comment|}}&lt;br /&gt;
{{2da column|bShowInPartyPicker|int|}}&lt;br /&gt;
{{2da column|Precision|int|Number of digits to display after the decimal place.}}&lt;br /&gt;
{{2da end}}&lt;br /&gt;
&lt;br /&gt;
{{2da start|HeroicStats}}&lt;br /&gt;
{{2da column|Stat|string|Human Readable statname. Spaces are not allowed in these strings}}&lt;br /&gt;
{{2da column|Type|string|SIMPLE, ATTRIBUTE, DEPLETABLE}}&lt;br /&gt;
{{2da column|Min|float|Minimum value possible}}&lt;br /&gt;
{{2da column|Max|float|Maximum value possible}}&lt;br /&gt;
{{2da column|UIMapping|int|}}&lt;br /&gt;
{{2da column|NameStrId|int|}}&lt;br /&gt;
{{2da column|DescStrId|int|}}&lt;br /&gt;
{{2da column|NonCombatEffect|int|}}&lt;br /&gt;
{{2da column|CombatEffect|int|}}&lt;br /&gt;
{{2da column|EngineLink|int|See above}}&lt;br /&gt;
{{2da column|ToolsetName|string|}}&lt;br /&gt;
{{2da column|bShowInToolset|int|}}&lt;br /&gt;
{{2da column|Constant|comment|}}&lt;br /&gt;
{{2da column|bShowInPartyPicker|int|}}&lt;br /&gt;
{{2da column|SortOrder|int|Sorts ascending, negative values allowed}}&lt;br /&gt;
{{2da end}}&lt;br /&gt;
&lt;br /&gt;
{{2da start|HeroicPartyStats}}&lt;br /&gt;
{{2da column|Stat|string|Human Readable statname}}&lt;br /&gt;
{{2da column|Type|string|SIMPLE, ATTRIBUTE, DEPLETABLE}}&lt;br /&gt;
{{2da column|Min|float|Minimum value possible}}&lt;br /&gt;
{{2da column|Max|float|Maximum value possible}}&lt;br /&gt;
{{2da column|UIMapping|int|}}&lt;br /&gt;
{{2da column|NameStrId|int|}}&lt;br /&gt;
{{2da column|DescStrId|int|}}&lt;br /&gt;
{{2da column|NonCombatEffect|int|}}&lt;br /&gt;
{{2da column|CombatEffect|int|}}&lt;br /&gt;
{{2da column|EngineLink|int|See above}}&lt;br /&gt;
{{2da column|ToolsetName|string|}}&lt;br /&gt;
{{2da column|bShowInToolset|int|}}&lt;br /&gt;
{{2da column|Constant|comment|}}&lt;br /&gt;
{{2da column|bShowInPartyPicker|int|}}&lt;br /&gt;
{{2da column|SortOrder|int|Sorts ascending, negative values allowed}}&lt;br /&gt;
{{2da end}}&lt;br /&gt;
&lt;br /&gt;
[[Category:2DAs]]&lt;/div&gt;</summary>
		<author><name>Georg Zoeller</name></author>	</entry>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=Properties.xls&amp;diff=7227</id>
		<title>Properties.xls</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=Properties.xls&amp;diff=7227"/>
				<updated>2009-10-27T19:39:44Z</updated>
		
		<summary type="html">&lt;p&gt;Georg Zoeller: Added some information on the hardcoded engine link functionality.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Depletable properties will be updated by their &amp;quot;combat&amp;quot; every 2 seconds and their &amp;quot;non-combat&amp;quot; values every 5 seconds.&lt;br /&gt;
&lt;br /&gt;
EngineLink:&lt;br /&gt;
* 00 - DerivedDefault : No modification of stats&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
  return 0; // Nothing&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* 01 - DerivedAttack: Each point of STR and DEX above 10 adds + 0.5 attack&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
 return (FLOAT32) ( max( (cPropertiesList.GetValue(PROPERTY_ATTRIBUTE_STRENGTH) -10.0f)/2.0f   , 0.0) +&lt;br /&gt;
                       max( (cPropertiesList.GetValue(PROPERTY_ATTRIBUTE_DEXTERITY) -10.0f)/2.0f   , 0.0));&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* 02 - DerivedDefense: Each point of DEX above 10 adds +1.0 defense&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
  FLOAT32 fDexBonus = (FLOAT32) max( (cPropertiesList.GetValue(PROPERTY_ATTRIBUTE_DEXTERITY) -10)   , 0.0) ;&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* 03 - DerivedArmor: No special interaction&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
  return 0; // Nothing&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* 04 - DerivedAP: Each point of CUN above 10 adds +(1/7) points of AP&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
    return (FLOAT32) max( (cPropertiesList.GetValue(PROPERTY_ATTRIBUTE_CUNNING)-10),0.0)/7;&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* 05 - DerivedSpellPower: Each point of MAG above 10 adds +1.0 Spellpower&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
   return (FLOAT32) max( (cPropertiesList.GetValue(PROPERTY_ATTRIBUTE_MAGIC) -10)   , 0.0);&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* 06 - DerivedHealth: Each point of CON above 10 adds 5 points of health.&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
    return (FLOAT32) max( (cPropertiesList.GetValue(PROPERTY_ATTRIBUTE_CONSTITUTION) -10)   , 0.0)*5;&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* 07 - DerivedManaStamina: Each point of WIL above 10 adds 5 points of Mana/Stamina&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
    return (FLOAT32) 	max( (cPropertiesList.GetValue(PROPERTY_ATTRIBUTE_WILLPOWER) -10)   , 0.0)*5;&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* 08 - DerivedResistanceMental: Each mental attribute point above 10 adds 0.5 Mental Resistance.&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
return (FLOAT32)  ( (cPropertiesList.GetValue(PROPERTY_ATTRIBUTE_MAGIC)          -10) +&lt;br /&gt;
                       (cPropertiesList.GetValue(PROPERTY_ATTRIBUTE_WILLPOWER)       -10) + &lt;br /&gt;
                       (cPropertiesList.GetValue(PROPERTY_ATTRIBUTE_INTELLIGENCE))    -10)  / 2.0f;          &lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* 09 - DerivedResistancePhysical: Each physical attribute above 10 adds 0.5 Physical Resistance.&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
    return (FLOAT32)  ( (cPropertiesList.GetValue(PROPERTY_ATTRIBUTE_STRENGTH)       -10) +&lt;br /&gt;
                       (cPropertiesList.GetValue(PROPERTY_ATTRIBUTE_CONSTITUTION)    -10) + &lt;br /&gt;
                       (cPropertiesList.GetValue(PROPERTY_ATTRIBUTE_DEXTERITY)       -10)) / 2.0f;          &lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{2da start|Properties}}&lt;br /&gt;
{{2da column|Stat|string|Human Readable statname. Spaces are not allowed in these strings}}&lt;br /&gt;
{{2da column|Type|string|SIMPLE, ATTRIBUTE, DEPLETABLE}}&lt;br /&gt;
{{2da column|Min|float|Minimum value possible}}&lt;br /&gt;
{{2da column|Max|float|Maximum value possible}}&lt;br /&gt;
{{2da column|UIMapping|int|&lt;br /&gt;
*1: Base resistances&lt;br /&gt;
*2: Deprecated&lt;br /&gt;
*3: Elemental (%) resistances}}&lt;br /&gt;
{{2da column|NameStrId|int|}}&lt;br /&gt;
{{2da column|NameLowerStrId|int|}}&lt;br /&gt;
{{2da column|DescStrId|int|}}&lt;br /&gt;
{{2da column|Desc2StrId|int|Necessary for rows 4 - 9 ONLY. When hovering over the numerical values of the attributes in the character sheet, there should be detailed and technical text written that explains the effects of these stats. Need writing for: Strength, Dexterity, Willpower, Magic, Cunning, Constitution}}&lt;br /&gt;
{{2da column|NonCombatEffect|int|}}&lt;br /&gt;
{{2da column|CombatEffect|int|}}&lt;br /&gt;
{{2da column|EngineLink|int|See above}}&lt;br /&gt;
{{2da column|ToolsetName|string|}}&lt;br /&gt;
{{2da column|bShowInToolset|int|}}&lt;br /&gt;
{{2da column|Constant|comment|}}&lt;br /&gt;
{{2da column|bShowInPartyPicker|int|}}&lt;br /&gt;
{{2da column|Precision|int|Number of digits to display after the decimal place.}}&lt;br /&gt;
{{2da end}}&lt;br /&gt;
&lt;br /&gt;
{{2da start|HeroicStats}}&lt;br /&gt;
{{2da column|Stat|string|Human Readable statname. Spaces are not allowed in these strings}}&lt;br /&gt;
{{2da column|Type|string|SIMPLE, ATTRIBUTE, DEPLETABLE}}&lt;br /&gt;
{{2da column|Min|float|Minimum value possible}}&lt;br /&gt;
{{2da column|Max|float|Maximum value possible}}&lt;br /&gt;
{{2da column|UIMapping|int|}}&lt;br /&gt;
{{2da column|NameStrId|int|}}&lt;br /&gt;
{{2da column|DescStrId|int|}}&lt;br /&gt;
{{2da column|NonCombatEffect|int|}}&lt;br /&gt;
{{2da column|CombatEffect|int|}}&lt;br /&gt;
{{2da column|EngineLink|int|See above}}&lt;br /&gt;
{{2da column|ToolsetName|string|}}&lt;br /&gt;
{{2da column|bShowInToolset|int|}}&lt;br /&gt;
{{2da column|Constant|comment|}}&lt;br /&gt;
{{2da column|bShowInPartyPicker|int|}}&lt;br /&gt;
{{2da column|SortOrder|int|Sorts ascending, negative values allowed}}&lt;br /&gt;
{{2da end}}&lt;br /&gt;
&lt;br /&gt;
{{2da start|HeroicPartyStats}}&lt;br /&gt;
{{2da column|Stat|string|Human Readable statname}}&lt;br /&gt;
{{2da column|Type|string|SIMPLE, ATTRIBUTE, DEPLETABLE}}&lt;br /&gt;
{{2da column|Min|float|Minimum value possible}}&lt;br /&gt;
{{2da column|Max|float|Maximum value possible}}&lt;br /&gt;
{{2da column|UIMapping|int|}}&lt;br /&gt;
{{2da column|NameStrId|int|}}&lt;br /&gt;
{{2da column|DescStrId|int|}}&lt;br /&gt;
{{2da column|NonCombatEffect|int|}}&lt;br /&gt;
{{2da column|CombatEffect|int|}}&lt;br /&gt;
{{2da column|EngineLink|int|See above}}&lt;br /&gt;
{{2da column|ToolsetName|string|}}&lt;br /&gt;
{{2da column|bShowInToolset|int|}}&lt;br /&gt;
{{2da column|Constant|comment|}}&lt;br /&gt;
{{2da column|bShowInPartyPicker|int|}}&lt;br /&gt;
{{2da column|SortOrder|int|Sorts ascending, negative values allowed}}&lt;br /&gt;
{{2da end}}&lt;br /&gt;
&lt;br /&gt;
[[Category:2DAs]]&lt;/div&gt;</summary>
		<author><name>Georg Zoeller</name></author>	</entry>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=Rules&amp;diff=7225</id>
		<title>Rules</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=Rules&amp;diff=7225"/>
				<updated>2009-10-27T19:03:38Z</updated>
		
		<summary type="html">&lt;p&gt;Georg Zoeller: /* Overview */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Overview ===&lt;br /&gt;
&lt;br /&gt;
The Core Game rules of Dragon Age are implemented mostly in the Scripting Language and Data. This page details the organization of the rules system, design principles, technical implementation details and limitations.&lt;br /&gt;
&lt;br /&gt;
{| width=&amp;quot;100%&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; height=&amp;quot;100%&amp;quot; |&lt;br /&gt;
&amp;lt;!-- GREEN PANEL --&amp;gt;&lt;br /&gt;
{| style=&amp;quot;margin:0; background:#f5fffa; border:1px solid #a3bfb1; text-align:left; color:#000; padding:0.2em 0.4em; width:100%;  height:100%&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| valign=&amp;quot;top&amp;quot;|&lt;br /&gt;
&amp;lt;h2 style=&amp;quot;margin:0; background:#cef2e0; font-size:150%; font-weight:bold; border:1px solid #a3bfb1; text-align:left; color:#000; padding:0.2em 0.4em;&amp;quot;&amp;gt; Categories &amp;lt;/h2&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* [[Creature Properties]] - Attributes, Stats and other numbers that make up a character.&lt;br /&gt;
* [[Classes]] - Technical information on the implementation of character classes.&lt;br /&gt;
* [[Combat Rules]] - The rules of conflict resolution. Who hits. When. For how much.&lt;br /&gt;
* [[Ability|Abilities]] - Spells, Skills, Talents and Item Abilities.&lt;br /&gt;
|}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Detailed Description ===&lt;br /&gt;
&lt;br /&gt;
[[Category:Scripts]]&lt;/div&gt;</summary>
		<author><name>Georg Zoeller</name></author>	</entry>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=Ability&amp;diff=7224</id>
		<title>Ability</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=Ability&amp;diff=7224"/>
				<updated>2009-10-27T19:00:48Z</updated>
		
		<summary type="html">&lt;p&gt;Georg Zoeller: linkified&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Overview ===&lt;br /&gt;
The Ability System is used to handle Spells, Talents, Skills, and Item Abilities in Dragon Age.&lt;br /&gt;
&lt;br /&gt;
=== Detailed Description ===&lt;br /&gt;
&lt;br /&gt;
Spells, Talents, Skills and item abilities all use the same backend in the game, a mostly script implemented system relying heavily on two dimensional data arrays. &lt;br /&gt;
&lt;br /&gt;
The most important 2da file for abilities is '''[[ABI_base.xls]]''', as it defines each ability and all aspects of execution and handling in both scripting and engine code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;margin:0; background:#f5faff; border:1px solid #a3b0bf; text-align:left; color:#000; padding:0.2em 0.4em; width:100%; height:100%&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|'''Ability Design Notes''' &lt;br /&gt;
&lt;br /&gt;
When creating an ability in Dragon Age: Origins, we generally stick to the following guidelines&lt;br /&gt;
&lt;br /&gt;
* Keep it useful. &lt;br /&gt;
Some constant benefits (such as an increase in Attack or Defense) stay useful for the duration of the game as the progression of the related properties are slow. &lt;br /&gt;
For other effects, such as damage, a constant value would mean that the ability will become progressively worse through the game as damage needed to drop enemies increases from level to level. In such cases, the ability should be tied in some fashion to a Spellpower (for spells) or another relevant (such as cunning for rogues) to ensure they stay useful throughout the game. &lt;br /&gt;
&lt;br /&gt;
* No repetition. &lt;br /&gt;
Each ability in Dragon Age: Origins is unique. No incremental abilities such as 'fireball I, fireball II, etc.'. Skills are exempt from this rule. Remember that the Damage Types dramatically alter the actual effect of an ability (such as lightning always draining stamina alongside doing damage), so having similar damaging abilities in different trees is usually fine.&lt;br /&gt;
&lt;br /&gt;
* Thematic matching.&lt;br /&gt;
Abilities within the same chain should follow a common theme. &lt;br /&gt;
&lt;br /&gt;
* Avoid binary abilities. Design hit heavy.&lt;br /&gt;
Avoid abilities that are hit-or-miss. Generally, abilities should hit whenever possible and use target side mitigation of effects (resistance checks, damage mitigation) instead of 'hit or miss' mechanics. Melee abilities may use the normal attack resolution routines but should always perform their attacks at a bonus. Use rank based mitigation and resistances to allow for very powerful effects that do not trivialize boss battles. &lt;br /&gt;
&lt;br /&gt;
* Use meaningful effects&lt;br /&gt;
Abilities should always be worth it. Don't do minor effects (+1 attack). The player should always be able to see the effect of the ability in game (not necessarily visually, but at least through increased damage, etc.). The first ability in a chain should, whenever possible, be active. The fourth ability in a chain should always have the biggest 'bang-for-the-buck' factor. Abilities lower in the chain should have shorter cooldowns. Do not allow instant death on bosses and elite bosses.&lt;br /&gt;
&lt;br /&gt;
* Avoid 'zero-sum' abilities&lt;br /&gt;
When possible, avoid 'zero-sum' abilities that trade a penalty for a benefit (e.g. increase defense but decrease attack). There are a number of these abilities that are valid (such as aim), but balancing them and keeping them useful is hard and requires a lot of work. This obviously does not apply to drastic abilities such as blood magic.&lt;br /&gt;
&lt;br /&gt;
* No emulation of defining class capabilities&lt;br /&gt;
Never ever grant a basic class capability from one class to another class via abilities. This means no invisibilityor magical unlock spells for mages, as these are defining capabilities of the rogue class. No weapon talents for mages. No magic spells or large, targeted area of effects for warriors or rogues. Items might blur this line if the cost is balanced properly (e.g. grenades).&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Basic Ability Types ====&lt;br /&gt;
&lt;br /&gt;
Abilities are divided into 4 subtypes, as defined in the 'abilitytype' column in abi_base.xls:&lt;br /&gt;
&lt;br /&gt;
* Talents - Abilities used by warriors and rogues, usually non magical in nature. (abilitytype=1)&lt;br /&gt;
* Spells - Abilities used by mages, either spell or passive abilities.  (abilitytype=2)&lt;br /&gt;
* Skills - Abilities usable by all classes, such as Survival and Combat training (abilitytype=3).&lt;br /&gt;
* Items  - Abilities present on an item that are triggered when the item is used on the quickbar. (ability_type=4)&lt;br /&gt;
&lt;br /&gt;
Note: Talents do not show up on mages and spells do not show up on rogue or warrior characters, so to create abilities that can be used by all classes, abilitytype 3 (Skill) must be used. To define under which heading an ability shows up on the character's talent/spell page, the field 'guitype' is used. It resolves against guitype.xls which lists all known headings.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There are 3 basic ability types in the game, defined by the field 'use_type' in [[ABI_base.xls]].&lt;br /&gt;
&lt;br /&gt;
'''Passive Abilities''' &lt;br /&gt;
&lt;br /&gt;
Passive abilities (use_type = 3) grant persistent or conditionally persistent bonuses or penalties to the creature that has the ability. &lt;br /&gt;
&lt;br /&gt;
A passive ability may grant up to 3 modifications to creature properties (properties.xls). Those modifications are defined in the passive_abilities worksheet of abi_base.xls and linked to the ability through the passive_id column in abi_base.xls.&lt;br /&gt;
&lt;br /&gt;
Additionally, the bonuses of an ability can be made conditional on the character's current 'wield mode' (2-handed, dual, weapon &amp;amp; shield, or universal) through the conditional integer field on the passive_abilities worksheet.&lt;br /&gt;
&lt;br /&gt;
Finally, a number of passive abilities do not define any property modifications in passive_abilites but instead have checks coded against their Ids (e.g. HasAbility(oCreature, ABILITY_TALENT_LETHALITY)) directly in the combat resolution scripts. The mere presence of the ability on a creature causes a different code path to be taken in the scripts in those cases.&lt;br /&gt;
&lt;br /&gt;
Note that passive_ability benefits are not limited to abilities with use_type 3. Some active abilities also grant additional property modifying benefits to the owner.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Sustained Abilities'''&lt;br /&gt;
&lt;br /&gt;
Sustained abilities (use_type = 2) are turned on and off per character and, while turned on, grant effects or property modifications to the user. &lt;br /&gt;
Most 'buffs' are implemented this way.&lt;br /&gt;
&lt;br /&gt;
Only members of the player's party are using sustained ability as the code overhead required to track them is too expensive to be used on monsters that only exist to die in an encounter with the player's party. (These creatures use duration based effects to emulate similar abilities instead).&lt;br /&gt;
&lt;br /&gt;
Most sustained abilities follow the same pattern:&lt;br /&gt;
* They do not have any activation cost, encouraging tactical use of buffs.&lt;br /&gt;
* They increase the users [[Fatigue]] property, therefore increasing the activation cost of all other abilities.&lt;br /&gt;
* They reduce the users maximum available mana or stamina by a constant value.&lt;br /&gt;
* They use cooldown to prevent the user from being too opportunistic with their use.&lt;br /&gt;
* Some abilities shut down when the user reaches 0 mana/stamina. Very powerful abilities (such as Momentum) have an associated stamina/mana drain effect to limit their use to a short or medium period of time. Creative item / buff use can be used to increase the length such an ability can be sustained.&lt;br /&gt;
&lt;br /&gt;
The benefits from sustained abilities are calculated when the ability is activated, so if a character levels up or otherwise changes stats that influence the magnitude of a sustained ability will not update until the ability is reactivated the next time.&lt;br /&gt;
&lt;br /&gt;
Some sustained abilities (such as Flaming Weapons) are active 'party-wide' - the caster not only sustains the ability on himself but on all his party members as well. This is controlled by the 'bPartyWide' flag in abi_base.xls. Due to implementation limitations, party members who die or otherwise enter/exit the current party will not be affected by these abilities until they are recast. (we put low cooldown times on these abilities for that very reason).&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;margin:0; background:#f5faff; border:1px solid #a3b0bf; text-align:left; color:#000; padding:0.2em 0.4em; width:100%; height:100%&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|'''Gameplay Design Note''' &lt;br /&gt;
* Unlike in games like Baldur's Gate, the system in DA: Origins is designed to encourage tactical use of buffs over strategical. We wanted to put an emphasis on the player making smart choices during an encounter vs. the player guessing which buffs might be useful ahead of time or having to employ save-die-reload to find out. &lt;br /&gt;
&lt;br /&gt;
* It is generally wise to run only one or two buffs all around and activate additional buffs only when needed. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Activated Abilities'''&lt;br /&gt;
&lt;br /&gt;
Activated abilities (use_type = 4) are abilities that instantly execute their effect (see Targeting Behavior below). Most melee talents or targeted spells fall in this category. There are several sub-types of activated abilies, such as&lt;br /&gt;
&lt;br /&gt;
* Targeted, single target spells and talents (such as Winter's Grasp or Flurry)&lt;br /&gt;
* Ground targeted abilities (such as Blizzard or various Glyphs)&lt;br /&gt;
* Self targeted activated abilities.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Targeting Behavior ====&lt;br /&gt;
&lt;br /&gt;
An abilities targeting behavior is controlled by several settings in abi_base.xls&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''AutoTarget''' is a boolean field that defines how the UI resolves targeting.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-  &lt;br /&gt;
| 0 || The UI will always bring up a targeting cursor. &lt;br /&gt;
|-&lt;br /&gt;
| 1 || The UI will only produce a targeting cursor if no suitable target is currently selected. e.g if the player currently has a hostile creature targeted and if the spells TargetType includes 0x4 (hostile), the ability will trigger immediately, not producing a targeting cursor. Most single target spells and talents use this setting.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Regardless of AutoTarget setting, the UI will never produce a targeting cursor if an ability is type 0x1 (self) -&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''TargetType''' is a bit mask derived from the following table and controls the behavior of the UI's targeting cursor.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-  &lt;br /&gt;
|'''Bitmask''' || '''Effect'''&lt;br /&gt;
|-&lt;br /&gt;
| 0x1  ||  Self&lt;br /&gt;
|-&lt;br /&gt;
| 0x2 || Friendly Creature&lt;br /&gt;
|-&lt;br /&gt;
| 0x4 || Hostile Creature&lt;br /&gt;
|-&lt;br /&gt;
| 0x8 || Placeable Object&lt;br /&gt;
|-&lt;br /&gt;
| 0x10 || Area of Effect Object (deprecated)&lt;br /&gt;
|-&lt;br /&gt;
| 0x20 || Ground (see details)&lt;br /&gt;
|-&lt;br /&gt;
| 0x40 || Dead Body (deprecated)&lt;br /&gt;
|-&lt;br /&gt;
| 0x80 || Party Member&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''AutoDraw''' is an integer boolean field that defines how a character's weapons are handled when the ability is triggered.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-  &lt;br /&gt;
| 0 || The ability will not affect the player's weapon sheath status.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || The engine will force the player to draw/unsheathe his weapon before executing the ability. This is used for most bow and melee weapon abilities. &lt;br /&gt;
|-&lt;br /&gt;
| 2 || The engine will force the player to stow away any non staff melee weapons before executing the ability. This is used to ensure that no inappropriate animations play with weapons drawn (e.g. the player conjuring with a sword clipping through his body) and to discourage switching between melee and spellcasting on the fly.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Balancing (Cost, Cooldown, etc) ====&lt;br /&gt;
&lt;br /&gt;
Abilities in Dragon Age are balanced along several vectors, most of which boil down to simple 'use frequency'. As a general rule of thumb, the more specialized and limited the effect of an ability is, the more outrageously powerful an ability can be.&lt;br /&gt;
&lt;br /&gt;
Use frequency of abilities can be adjusted by modifying the following field in abi_base.xls&lt;br /&gt;
&lt;br /&gt;
* Cost: This is the simple mana (spells) or stamina (talents) activation cost of an ability. It is subtracted when the conjure phase of the spell has succesfully completed (e.g. no cost for spell interruptions). Without sufficient resources to cover activation cost, the UI will not allow the player to execute the ability. The value is a constant integer and is multiplied with 1+(Current Fatigue) of the caster. &lt;br /&gt;
&lt;br /&gt;
* Cooldown: Cooldown is a constant float in seconds that defines how long the player has to wait after the successful activation of an ability until he can use it again. For abilities that apply duration based debuffs or effects to a target, cooldown is usually set slightly higher than the duration of the effect to avoid stacking by the same caster.&lt;br /&gt;
&lt;br /&gt;
* Upkeep: Defines how much mana or stamina is removed from the casters overall pool while a sustained ability is active. This naturally limits the number of sustained abilities present on a creature and ensures that the more beneficial buffs are active on the caster, the less mana is available for immediate use.&lt;br /&gt;
&lt;br /&gt;
* [[Fatigue]]: Fatigue affects use frequency only indirectly, but it prevents characters from stacking too many buffs on each other, as each sustained ability active usually adds around 5-10% fatigue to the caster.&lt;br /&gt;
&lt;br /&gt;
* Mana/Stamina drain: By reducing the mana/stamina regeneration rate on a creature, the duration for which a sustained ability can be used can be restricted. This mechanic is used only for the most powerful sustained abilities in the game, which are flagged to turn off when the caster sustaining them reaches 0 mana/stamina.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Other balancing vectors:&lt;br /&gt;
&lt;br /&gt;
* AoESize and AoeShape: Area of effect spells that deal friendly fire are location and situation restricted on normal+ difficulty (hard+ on the consoles). Since dropping an Inferno on your own party members is hardly a good idea in most cases, the usefulness of the spell becomes restricted to careful positioning and the earlier stages of combat. &lt;br /&gt;
&lt;br /&gt;
* Threat Generation: Abilities apply threat not just by damage but often by activation. Higher activation threat of an ability can balance out outrageously powerful effects by making it harder for the player to use the spell. The prime example is the Walking Bomb kind of spells which deal excellent damage, but, on higher difficulties, also make the targets very very angry at the caster.  Using these spells effectively often requires a tactical approach by the player, thus limiting their universal usefulness and offsetting their very powerful effects.&lt;br /&gt;
&lt;br /&gt;
* Threat Removal: Some abilities are designed to only provide a short term benefit (Such as 3s stun on Mindblast) but offset their weakness by removing threat from the caster, often by reinitializing the threat tables on the target, causing enemies to randomly seek new targets.&lt;br /&gt;
&lt;br /&gt;
* Conjure time: Spells with a conjure time of 1+ (Speed in abi_base.xls) can be interrupted by damage, limiting their usefulness in melee situations or when only one party member remains on the battlefield. Many of the very powerful Area of Effect type spells use this feature. Most activated spells have a conjure time of 0, making them instant cast.&lt;br /&gt;
&lt;br /&gt;
* Range: Lower ranges force the ability user into potentially more dangerous situations, adding additional risk to the use of an ability.&lt;br /&gt;
&lt;br /&gt;
=== Q&amp;amp;A ===&lt;br /&gt;
&lt;br /&gt;
==== Q: Where do we find the exact formula for abilities ? ====&lt;br /&gt;
&lt;br /&gt;
A: Due to most abilities being unique, the only place to find the exact details on each spell is in the scripts. While a lot of data can be glanced from abi_base.xls, a lot of the detailed mechanics are very different between abilities and can only be found in the appropriate spellscript. The *_constant.nss files hold some basic values, but often get further modified in the scripts. &lt;br /&gt;
&lt;br /&gt;
This is also one of the reasons why some elements of a talent are not displayed in the UI description in game. While we can calculate cost and cooldown based on the casting character and his fatigue and other properties (and consequently display it), we can usually not calculate damage or duration as they are mitigated on the target creature: &lt;br /&gt;
&lt;br /&gt;
Displaying those values results in very misleading information (e.g. while damage seems to be higher on one ability, the mitigation mechanisms and unique side effects of another ability will make it just as good or better - in certain situations) and it turned out to be better to provide the player with general guidance than the misleading information.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Q: What is Spellpower and how does it interact with abilities ====&lt;br /&gt;
&lt;br /&gt;
Spellpower is probably the most important stat for a mage character (and only exists on mage characters). It is calculated as max(Magic - 10,0) and therefore increases by one point for every point a mage spends on his Magic attribute.&lt;br /&gt;
&lt;br /&gt;
Most mage spells benefit directly from higher spellpower by increased damage, effect magnitude and duration. It also plays a role in a mages ability to overcome mental or physical resistance on a target (where applicable). The actual impact of spellpower on an ability varies from spell to spell but the most common construct equates to something like 1% increase in spell potency per point of Spellpower. Thus, items and spells that increase spellpower are very powerful as they increase the potency of every spell the mage can cast.&lt;br /&gt;
&lt;br /&gt;
Spellpower is the only factor that causes an increase of a spells potency over time, so a level 20 mage with neglected the Magic attribute would be much less powerful than a mage that didn't neglect Magic.&lt;br /&gt;
&lt;br /&gt;
Some examples:&lt;br /&gt;
&lt;br /&gt;
* The damage potential for Winter's Grasp is calculated as (100.0f + GetCreatureSpellPower(stEvent.oCaster)) * 0.36f;&lt;br /&gt;
* The healing potential for the heal spell is calculated as (100.0f + GetCreatureSpellPower(stEvent.oCaster)) * 0.40f;&lt;br /&gt;
* The damage over time component of blizzard is executed as ApplyEffectDamageOverTime(a[i], oCreator, ABILITY_SPELL_BLIZZARD,  (100.0f + GetCreatureSpellPower(oCreator)) * 0.1, (BLIZZARD_INTERVAL_DURATION - 0.5f), DAMAGE_TYPE_COLD);&lt;br /&gt;
&lt;br /&gt;
Note that these formulas only list the raw damage potential and do not take into account the effects of damage types, difficulty, rank, resistances, magical shields and any other mitigating factors on the target or enhancing factors on the caster. This means that just comparing the numbers will not give you an idea which spell is better or worse.&lt;br /&gt;
&lt;br /&gt;
For non-mage spells and abilities, spellpower is often substituted by an appropriate other construct (such as max(Cunning-10,0) for rogue abilities).&lt;br /&gt;
&lt;br /&gt;
==== Q: Can we have the damage formula for abilities ? ====&lt;br /&gt;
&lt;br /&gt;
A: There is no damage formula for abilities, as mentioned before, each ability follows their own rules.&lt;br /&gt;
&lt;br /&gt;
In general, talent damage is based on the weapon being used (e.g. Assault does 3 melee attacks that deal weapon damage with some additional bonuses) and are modified by external cirumstances such as location, critical chance and ability to deliver a backstab and are mitigated by armor on the target.&lt;br /&gt;
&lt;br /&gt;
Spells deal damage of different damage types following a rough rule of (Constant * (Spellpower / Variable)) / [Variables] ) + Modifiers but this only tells part of the story as actual damage is dependent on the target, it's resistances, rank and a number of other factors.&lt;br /&gt;
&lt;br /&gt;
Some additional factors affecting spell damage are:&lt;br /&gt;
&lt;br /&gt;
* damage resistance.&lt;br /&gt;
* magical shields.&lt;br /&gt;
* difficulty level.&lt;br /&gt;
* elemental damage bonuses from spells or items &lt;br /&gt;
* Environmental conditions (frozen targets take less damage from fire, etc.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Q: What are the differences between damage types? ====&lt;br /&gt;
&lt;br /&gt;
A: Creatures have variable damage resistances based on their type and rank. Dragons might get 60% less damage from fire (60% fire resistance), other creatures will have different immunities. Additional effects are:&lt;br /&gt;
&lt;br /&gt;
* Electricity: In addition to normal damage, these also reduce the targets stamina (but not mana) by the same amount, making them very effective boss killers.&lt;br /&gt;
&lt;br /&gt;
* Fire: Cancels Cold based damage over time effects and applies damage over time.&lt;br /&gt;
&lt;br /&gt;
* Cold: Cancel Fire based damage over time effects and often is accompanied by slow or slipping effects.&lt;br /&gt;
&lt;br /&gt;
* Spirit: There are very few ways of increasing spirit resistance in the game, so spells dealing spirit damage are universally useful...&lt;br /&gt;
&lt;br /&gt;
* Nature: Rarely found on spells. Many creatures are resistant to this.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(This should probably go on its own wiki page)&lt;br /&gt;
&lt;br /&gt;
==== Q: Are sustained abilities mutually exclusive ? ====&lt;br /&gt;
&lt;br /&gt;
A: There is a very limited number of sustained abilities that are mutually exclusive, usually because it makes sense. Mutually exclusive abilities cancel each other upon activation.&lt;br /&gt;
&lt;br /&gt;
* Shield stances (Shield Wall, Shield Cover, Shield Defense) are mutually exclusive.&lt;br /&gt;
* Archery stances (Aim, Rapid Fire, Defensive Fire) are mutually exclusive.&lt;br /&gt;
* Shapeshifting forms are (Sorry, no Bear-Wolfspider) are mutually exclusive.&lt;br /&gt;
* Weapon Enhancement spells are too, but only for the same caster (so two mages can run two different weapon enhancements if they want to).&lt;br /&gt;
* Bard Songs are mutually exclusive.&lt;br /&gt;
* The Death Syphon and Death Magic spells are mutually exclusive.&lt;br /&gt;
&lt;br /&gt;
Technically, all abilities in abi_base.xls that share the same 'condition_group' value are mutually exclusive.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Q: What are the rules for stacking effects and damage ? ====&lt;br /&gt;
&lt;br /&gt;
A: The general rules of stacking for abilities are:&lt;br /&gt;
&lt;br /&gt;
* Identical effect from different abilities stack (e.g. getting +10 attack from one ability and +10 attack from another nets +20 attack).&lt;br /&gt;
* The effects of identical abilities stack as long as they are from different caster. (Same caster usually does not apply as cooldown often exceeds duration).&lt;br /&gt;
* Weapon enhancement spells of the same type (e.g. 2 mages with flame weapons) do not stack. The sword does not get more flaming, sorry :)&lt;br /&gt;
* Animation based effects (knockdown, stun, etc.) stack, but only the one with the highest priority is played. This is defined in the priority column in effects.xls. &lt;br /&gt;
* Glyphs do stack but there is a limit of 5 active glyphs per caster.&lt;br /&gt;
* Fire and Cold DoT effects do not stack, the spell cast last will cancel any existing spell of the opposite type.&lt;br /&gt;
* Fire and Cold AoEs cancel each other, other AoEs might interact rather violently, handle with care :)&lt;br /&gt;
&lt;br /&gt;
For equipment and item based effects, the game usually stacks within the minumum and maximum clamp values of a property (properties.xls). This means that you can accumulate a lot of +damage or +critical critical chance effects, but for some type of stats there is a point where you are no longer gaining any benefits (e.g. speed modification - animations can only be sped up to a certain point before breaking, so stacking momentum, haste and a weapon with a speed based effect will not result in a -3.0s attack time, sorry :p)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For almost all effects, the total result of all property modifications on a creature are visible on the main character UI by hovering over the individual stats.&lt;br /&gt;
&lt;br /&gt;
==== Q: How does game difficulty affect abilities ? ====&lt;br /&gt;
&lt;br /&gt;
A: Our approach to game difficulty dictates that the effect of your chosen setting are&lt;br /&gt;
&lt;br /&gt;
a) non punishing - You do not get less XP for chosing a lower difficulty mode, etc.&lt;br /&gt;
b) challenge scaling - Higher difficulty will reward you with greater obstacles to overcome.&lt;br /&gt;
c) fair - Lower difficulties grant benefits that gradually get removed. (This does not mean the rules are symmetric and is not true on nightmare at all. Nightmare is evil. And unfair.)&lt;br /&gt;
d) non persistent - Difficulty changes are possible on the fly, at any time and take immediate effect.&lt;br /&gt;
&lt;br /&gt;
The game is balanced so that Hard mode is challenging for a Baldur's gate veteran.&lt;br /&gt;
&lt;br /&gt;
Based on these guidelines, you can expect the following ability behaviors in game:&lt;br /&gt;
&lt;br /&gt;
* The lower the difficulty, the longer your hostile effects such as stuns will last on enemies and the shorter they will last on you.&lt;br /&gt;
* The lower the difficulty, the more damage your abilities will do.&lt;br /&gt;
* The lower the difficulty, the less likely the enemy AI will use devastating special abilities (Note: less likely does not mean 'does not use').&lt;br /&gt;
* Casual and Normal have reduced friendly or nullified fire damage damage from area effect spells. Hard and Nightmare require careful positioning and tactical use of spells.&lt;br /&gt;
* The higher the difficulty, the more careful you need to manage threat when using spells and abilities (The AI becomes smarter about picking targets).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Q: What is spell affinity ? ====&lt;br /&gt;
&lt;br /&gt;
A: Spell Affinity was a design we toyed with for a while during development but decided not to implement.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Q: How does Rank Based Mitigation Work ? ====&lt;br /&gt;
&lt;br /&gt;
A: In line with Dragon Age: Origin's asymmetric approach to rules, the game uses creature ranks (instead of levels) in addition to stats and resistances to define how creatures get affected by abilities. In short: Boss monsters get affected differently by abilities and effects than Lieutenants or Critters. &lt;br /&gt;
&lt;br /&gt;
The rank system is the primary balancing vector for the games difficulty levels and profoundly affects all aspects of combat. The gory details of this system are defined in creature_ranks.xls and difficulty.xls.&lt;br /&gt;
&lt;br /&gt;
Rank mitigation affects not just damage in- and output of a creature, but also the duration that hostile effects persist on it and is different for each difficulty level of the game. Note that party members have their own rank in this system and are handled differently from other creatures in some cases. &lt;br /&gt;
&lt;br /&gt;
Below is the formula used for rank based effect duration mitigation: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
// sys_resistances_h&lt;br /&gt;
// @brief Returns an effect duration scaled by rank of oCreature and game difficulty&lt;br /&gt;
// @author Georg&lt;br /&gt;
float GetRankAdjustedEffectDuration(object oCreature, float fDur)&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    // Georg: This deserves some explanation:&lt;br /&gt;
    //&lt;br /&gt;
    //        One of the core issues when designing the combat system was always&lt;br /&gt;
    //        the fact that the story called for sequences during the game in which&lt;br /&gt;
    //        your main character acts solo.&lt;br /&gt;
    //&lt;br /&gt;
    //        Characters reliant on special abilities, such as rogues, would require&lt;br /&gt;
    //        them to be very effective in order to beat enemies that a standard tank&lt;br /&gt;
    //        can plow through. However, if these abilities would maintain the same&lt;br /&gt;
    //        effectiveness in a full party, most encounters would turn into a stunfest.&lt;br /&gt;
    //&lt;br /&gt;
    //        The solution is to add 1 second flat to each detrimental effect duration&lt;br /&gt;
    //        lasting at least 1 second for each unoccupied slot in the party - before applying&lt;br /&gt;
    //        rank and difficulty modifiers. This also makes solo play a bit more viable.&lt;br /&gt;
    //&lt;br /&gt;
    //        This is in addition to the diminishing returns on quickly successive stuns.&lt;br /&gt;
    //&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    if (!IsPartyMember(oCreature))&lt;br /&gt;
    {&lt;br /&gt;
        float fPartySizeModifier = IntToFloat(Max(0,4 - GetArraySize(GetPartyList())));&lt;br /&gt;
&lt;br /&gt;
        if (fDur &amp;gt;= 1.0f)&lt;br /&gt;
        {&lt;br /&gt;
            fDur += fPartySizeModifier;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    float fRankDurMod = Diff_GetDurationModifier(oCreature);&lt;br /&gt;
    if (fRankDurMod &amp;gt;0.0f)&lt;br /&gt;
    {&lt;br /&gt;
        return (fDur * fRankDurMod);&lt;br /&gt;
    }&lt;br /&gt;
    else&lt;br /&gt;
    {&lt;br /&gt;
     return fDur;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Scripts]]&lt;/div&gt;</summary>
		<author><name>Georg Zoeller</name></author>	</entry>

	</feed>