//::///////////////////////////////////////////////
//:: Dragon Breath Paralyze
//:: NW_S1_DragParal
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
    Calculates the proper DC Save for the
    breath weapon based on the HD of the dragon.
*/
//:://////////////////////////////////////////////
//:: Created By: Preston Watamaniuk
//:: Created On: May 9, 2001
//:://////////////////////////////////////////////

const string DRAGBREATHLOCK = "DragonBreathLock";


//modified to use the breath include - Fox
#include "prc_inc_spells"
#include "prc_inc_breath"

void main()
{
    // Check the dragon breath delay lock
    if(GetLocalInt(OBJECT_SELF, DRAGBREATHLOCK))
    {
        SendMessageToPC(OBJECT_SELF, "You cannot use your breath weapon again so soon");
        return;
    }
    
    //Declare major variables
    int nAge = GetHitDice(OBJECT_SELF);
    int nDCBoost = nAge / 2;
    int nCount = d6();
    struct breath ParalBreath;
    
    //Determine save DC and duration of effect
    if (nAge <= 6) //Wyrmling
    {
        nCount += 1;
    }
    else if (nAge >= 7 && nAge <= 9) //Very Young
    {
        nCount += 2;
    }
    else if (nAge >= 10 && nAge <= 12) //Young
    {
        nCount += 3;
    }
    else if (nAge >= 13 && nAge <= 15) //Juvenile
    {
        nCount += 4;
    }
    else if (nAge >= 16 && nAge <= 18) //Young Adult
    {
        nCount += 5;
    }
    else if (nAge >= 19 && nAge <= 21) //Adult
    {
        nCount += 6;
    }
    else if (nAge >= 22 && nAge <= 24) //Mature Adult
    {
        nCount += 7;
    }
    else if (nAge >= 25 && nAge <= 27) //Old
    {
        nCount += 8;
    }
    else if (nAge >= 28 && nAge <= 30) //Very Old
    {
        nCount += 9;
    }
    else if (nAge >= 31 && nAge <= 33) //Ancient
    {
        nCount += 10;
    }
    else if (nAge >= 34 && nAge <= 37) //Wyrm
    {
        nCount += 11;
    }
else if (nAge >= 38 && nAge <= 41) //Great Wyrm
    {
        nCount += 12;
    }
	    else if (nAge >= 42 && nAge <= 45) //Great Wyrm
    {
        nCount += 13;
    }
	    else if (nAge >= 46 && nAge <= 49) //Great Wyrm
    {
        nCount += 14;
    }
	
	    else if (nAge >= 50 && nAge <= 53) //Great Wyrm
    {
        nCount += 15;
    }
	    else if (nAge >= 54 && nAge <= 57) //Great Wyrm
    {
        nCount += 16;
    }
	    else if (nAge >= 58 && nAge <= 61) //Great Wyrm
    {
        nCount += 17;
    }
	    else if (nAge >= 62 && nAge <= 65) //Great Wyrm
    {
        nCount += 18;
    }
	    else if (nAge >= 66 && nAge <= 69) //Great Wyrm
    {
        nCount += 19;
    }
	    else if (nAge >= 70 && nAge <= 73) //Great Wyrm
    {
        nCount += 20;
    }
	    else if (nAge >= 74 && nAge <= 77) //Great Wyrm
    {
        nCount += 21;
    }
	    else if (nAge >= 78 && nAge <= 81) //Great Wyrm
    {
        nCount += 22;
    }
	    else if (nAge >= 82 && nAge <= 85) //Great Wyrm
    {
        nCount += 23;
    }
	
		else if (nAge >= 86 && nAge <= 89) //Great Wyrm
    {
        nCount += 24;
    }

	    else if (nAge >= 90 && nAge <= 93) //Great Wyrm
    {
        nCount += 25;
    }

	    else if (nAge >= 94 && nAge <= 97) //Great Wyrm
    {
        nCount += 26;
    } 

	    else if (nAge >= 98 && nAge <= 101) //Great Wyrm
    {
        nCount += 27;
    } 
	    else if (nAge >= 102 && nAge <= 105) //Great Wyrm
    {
        nCount += 28;
    } 
	    else if (nAge >= 106 && nAge <= 109) //Great Wyrm
    {
        nCount += 29;
    } 
	    else if (nAge >= 110 && nAge <= 113) //Great Wyrm
    {
        nCount += 30;
    } 
	    else if (nAge >= 114 && nAge <= 117) //Great Wyrm
    {
        nCount += 31;
    } 
	    else if (nAge >= 118 && nAge <= 121) //Great Wyrm
    {
        nCount += 32;
    } 
	    else if (nAge >= 122 && nAge <= 125) //Great Wyrm
    {
        nCount += 33;
    } 
	    else if (nAge >= 126 && nAge <= 129) //Great Wyrm
    {
        nCount += 34;
    } 
	    else if (nAge >= 130 && nAge <= 133) //Great Wyrm
    {
        nCount += 35;
    } 
	    else if (nAge >= 134 && nAge <= 137) //Great Wyrm
    {
        nCount += 36;
    } 
        else if (nAge >= 138 && nAge <= 141) //Great Wyrm
    {
        nCount += 37;
    } 
	    else if (nAge >= 142 && nAge <= 145) //Great Wyrm
    {
        nCount += 38;
    } 	
	    else if (nAge >= 146 && nAge <= 149) //Great Wyrm
    {
        nCount += 39;
    } 	
	    else if (nAge >= 150 && nAge <= 153) //Great Wyrm
    {
        nCount += 40;
    } 	
	    else if (nAge >= 154 && nAge <= 157) //Great Wyrm
    {
        nCount += 41;
    }

	    else if (nAge >= 158 && nAge <= 161) //Great Wyrm
    {
        nCount += 42;
    } 
	    else if (nAge >= 162 && nAge <= 165) //Great Wyrm
    {
        nCount += 43;
    } 
	    else if (nAge >= 166 && nAge <= 169) //Great Wyrm
    {
        nCount += 44;
    } 

	    else if (nAge >= 170 && nAge <= 173) //Great Wyrm
    {
        nCount += 45;
    } 
	    else if (nAge >= 174 && nAge <= 177) //Great Wyrm
    {
        nCount += 46;
    }  	
	    else if (nAge > 178 ) //Great Wyrm
    {
        nCount += 47;
    } 	    
    //create the breath - 40' ~ 14m? - should set it based on size later
    ParalBreath = CreateBreath(OBJECT_SELF, FALSE, 40.0, -1, 10, nCount, ABILITY_CONSTITUTION, nDCBoost, BREATH_PARALYZE);
    
    //Apply the breath
    PRCPlayDragonBattleCry();
    ApplyBreath(ParalBreath, PRCGetSpellTargetLocation());
    
    //Apply the recharge lock
    SetLocalInt(OBJECT_SELF, DRAGBREATHLOCK, TRUE);

    // Schedule opening the delay lock
    float fDelay = RoundsToSeconds(ParalBreath.nRoundsUntilRecharge);
    SendMessageToPC(OBJECT_SELF, "Your breath weapon will be ready again in " + IntToString(ParalBreath.nRoundsUntilRecharge) + " rounds.");

    DelayCommand(fDelay, DeleteLocalInt(OBJECT_SELF, DRAGBREATHLOCK));
    DelayCommand(fDelay, SendMessageToPC(OBJECT_SELF, "Your breath weapon is ready now"));
}


