CheckForDeathblow
From Dragon Age Toolset Wiki
Revision as of 05:40, 1 August 2011 by Mouser9169 (Talk | contribs)
Called by:
Parameters:
Variables:
Used for:
/** * @brief Check if a deathblow should occur. * * Examine a number of parameters to see whether or not we can play a deathblow * without interrupting the flow of combat. * * @author Georg Zoeller **/ int CheckForDeathblow(object oAttacker, object oTarget) { int nRank = GetCreatureRank(oTarget); int nLevel = GetLevel(oAttacker); float fChance = GetM2DAFloat(TABLE_CREATURERANKS,"fDeathblow", nRank); // ------------------------------------------------------------------------- // Any rank flagged 1.0 or higher triggers a deathblow. // ------------------------------------------------------------------------- if (fChance >= 1.0f) { return TRUE; } // ------------------------------------------------------------------------- // If we perceive more than 1 creature, then half the chance of triggering // a deathblow with each perceived hostile. // ------------------------------------------------------------------------- int nCount = GetArraySize(GetPerceivedCreatureList(oAttacker, TRUE)); if (nCount > 1) { fChance *= (2.0/IntToFloat(nCount)); } //Increase chance of death blow in origin stories (level 1 and 2) //1.5 times the chance if ( nLevel < 3 ) { fChance *= 1.5; } return (RandomFloat()<fChance); }
Category: Combat_H