Difference between revisions of "Combat GetFlankingBonus"
From Dragon Age Toolset Wiki
Mouser9169 (Talk | contribs) m |
m (Fixing category) |
||
Line 80: | Line 80: | ||
} | } | ||
</dascript> | </dascript> | ||
− | + | [[Category:Functions from combat_h]] |
Latest revision as of 15:26, 7 August 2011
Called by:
Calls:
Parameters:
Variables:
Returns:
Used for:
float Combat_GetFlankingBonus(object oAttacker, object oTarget) { if (HasAbility(oTarget, ABILITY_TALENT_SHIELD_TACTICS)) { if (IsUsingShield(oTarget)) return 0.0; } if (GetHasEffects(oTarget, EFFECT_TYPE_FLANK_IMMUNITY)) { return 0.0; } float fAngle = GetAngleBetweenObjects(oTarget, oAttacker); float fFactor = 0.0; float fMaxModifier = 15.0; // The attackers ability to flank is stored in a creature property float fFlankingAngle = GetCreatureProperty(oAttacker, PROPERTY_ATTRIBUTE_FLANKING_ANGLE); if (fFlankingAngle <= 10.0 ) /*old savegames have this at 10*/ { fFlankingAngle = 60.0; // old savegames need this to avoid divby0 later } else if (fFlankingAngle>180.0) { fFlankingAngle = 180.0; } // ------------------------------------------------------------------------- if (HasAbility(oAttacker, ABILITY_TALENT_COMBAT_MOVEMENT)) { fMaxModifier = 20.0; } if ( fMaxModifier <= 0.0 ) { return 0.0; } if ( (fAngle>= (180.0 - fFlankingAngle) && fAngle<=(180.0 + fFlankingAngle ))) { // Shield block negats flanking on the left. int bShieldBlock = HasAbility(oTarget,ABILITY_TALENT_SHIELD_BLOCK); int bUsingShield = IsUsingShield(oTarget); if (!bShieldBlock || fAngle < 180.0 || (bShieldBlock && !bUsingShield) ) { fFactor = (fFlankingAngle - fabs( 180.0 - fAngle))/fFlankingAngle; } } // Only rogues get the full positional benefits on the battlefield, // everyone else gets halfa float fClassModifier = GetCreatureCoreClass(oAttacker) == CLASS_ROGUE?1.0f:0.5f; return fFactor * fMaxModifier * fClassModifier; }