Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Boss Attributes on MakeBoss #380

Open
shadow93 opened this issue Apr 9, 2016 · 0 comments
Open

Boss Attributes on MakeBoss #380

shadow93 opened this issue Apr 9, 2016 · 0 comments

Comments

@shadow93
Copy link
Contributor

shadow93 commented Apr 9, 2016

    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];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant