Combat CheckBackStab

From Dragon Age Toolset Wiki
Jump to: navigation, search

Called by:

Calls:

Parameters:

Variables:

Returns:

Used for:

// -----------------------------------------------------------------------------
// Check if backstab conditions are true
// -----------------------------------------------------------------------------
int Combat_CheckBackstab(object oAttacker, object oTarget, object oWeapon, float fFlankingBonus)
{
 
    // -------------------------------------------------------------------------
    // If we we are a rogue
    // -------------------------------------------------------------------------
    if (!HasAbility(oAttacker, ABILITY_TALENT_HIDDEN_ROGUE))
    {
        return FALSE;
    }
 
    if (!IsHumanoid(oAttacker))
    {
        return FALSE;
    }
 
    // -------------------------------------------------------------------------
    // And target is not immune
    // -------------------------------------------------------------------------
    if (HasAbility(oTarget, ABILITY_TRAIT_CRITICAL_HIT_IMMUNITY))
    {
        return FALSE;
    }
 
    // -------------------------------------------------------------------------
    // And attacker does not use double strike mode
    // -------------------------------------------------------------------------
    if (IsModalAbilityActive(oAttacker, ABILITY_TALENT_DUAL_WEAPON_DOUBLE_STRIKE))
    {
        return FALSE;
    }
 
 
     // -------------------------------------------------------------------------
    // We can only backstab if we are flanking.
    // -------------------------------------------------------------------------
    if (fFlankingBonus>0.0)
    {
        return TRUE;
    }
    else
    {
         /* Coup de grace*/
        if (HasAbility(oAttacker, ABILITY_TALENT_BACKSTAB))
        {
            if (GetHasEffects(oTarget, EFFECT_TYPE_STUN))
            {
                return TRUE;
            }
            else if (GetHasEffects(oTarget, EFFECT_TYPE_PARALYZE))
            {
                return TRUE;
            }
        }
 
    }
 
    return FALSE;
}