FF2-Official icon indicating copy to clipboard operation
FF2-Official copied to clipboard

Boss Attributes on MakeBoss

Open shadow93 opened this issue 8 years ago • 0 comments

    BossRageDamage[boss]=KvGetNum(BossKV[Special[boss]], "ragedamage", 1900);
    if(BossRageDamage[boss]<=0)
    {
        decl String:bossName[64];
        KvGetString(BossKV[Special[boss]], "name", bossName, sizeof(bossName));
        PrintToServer("[FF2 Bosses] Warning: Boss %s's rage damage is 0 or below, setting to 1900", bossName);
        BossRageDamage[boss]=1900;
    }

    BossLivesMax[boss]=KvGetNum(BossKV[Special[boss]], "lives", 1);
    if(BossLivesMax[boss]<=0)
    {
        decl String:bossName[64];
        KvGetString(BossKV[Special[boss]], "name", bossName, sizeof(bossName));
        PrintToServer("[FF2 Bosses] Warning: Boss %s has an invalid amount of lives, setting to 1", bossName);
        BossLivesMax[boss]=1;
    }

    BossHealthMax[boss]=ParseFormula(boss, "health_formula", "(((760.8+n)*(n-1))^1.0341)+2046", RoundFloat(Pow((760.8+float(playing))*(float(playing)-1.0), 1.0341)+2046.0));
    BossLives[boss]=BossLivesMax[boss];
    BossHealth[boss]=BossHealthMax[boss]*BossLivesMax[boss];
    BossHealthLast[boss]=BossHealth[boss];

Should add a if(!CheckRoundState()) so that in case third party plugins or subplugins use TF2_RespawnPlayer or TF2_RegeneratePlayer on the boss, it would prevent either from accidentally resetting the boss HP to its starting HP.

if(!CheckRoundState())
{
    BossRageDamage[boss]=KvGetNum(BossKV[Special[boss]], "ragedamage", 1900);
    if(BossRageDamage[boss]<=0)
    {
        decl String:bossName[64];
        KvGetString(BossKV[Special[boss]], "name", bossName, sizeof(bossName));
        PrintToServer("[FF2 Bosses] Warning: Boss %s's rage damage is 0 or below, setting to 1900", bossName);
        BossRageDamage[boss]=1900;
    }

    BossLivesMax[boss]=KvGetNum(BossKV[Special[boss]], "lives", 1);
    if(BossLivesMax[boss]<=0)
    {
        decl String:bossName[64];
        KvGetString(BossKV[Special[boss]], "name", bossName, sizeof(bossName));
        PrintToServer("[FF2 Bosses] Warning: Boss %s has an invalid amount of lives, setting to 1", bossName);
        BossLivesMax[boss]=1;
    }

    BossHealthMax[boss]=ParseFormula(boss, "health_formula", "(((760.8+n)*(n-1))^1.0341)+2046", RoundFloat(Pow((760.8+float(playing))*(float(playing)-1.0), 1.0341)+2046.0));
    BossLives[boss]=BossLivesMax[boss];
    BossHealth[boss]=BossHealthMax[boss]*BossLivesMax[boss];
    BossHealthLast[boss]=BossHealth[boss];
}

shadow93 avatar Apr 09 '16 02:04 shadow93