//Function calledfrom the trackTimePassageEVT to track if it's time to increase player health
    private void TrackTimePassage(EVTData data_)
    {
        //Checking to see if this time advancement goes to the next day
        if (this.currentDaysPassed != TimePanelUI.globalReference.daysTaken)
        {
            //Updating the current number of days passed
            this.currentDaysPassed = TimePanelUI.globalReference.daysTaken;

            //If the current number of days that have passed is divisible by the number that need to pass before health increase, we increase player health
            if (TimePanelUI.globalReference.daysTaken % this.daysBeforeHPIncrease == 0)
            {
                //Looping through each player character to give them more health
                for (int p = 0; p < PartyGroup.globalReference.charactersInParty.Count; ++p)
                {
                    //If the current character slot isn't null, we add health
                    if (PartyGroup.globalReference.charactersInParty[p] != null)
                    {
                        //Int to hold the current character's health stage
                        //int healthStage = PartyGroup.group1.charactersInParty[p].charPhysState.healthCurveStagesSum;

                        //Int to hold the amount of bonus health added
                        int bonusHealthAdded = 0;

                        //Looping through the character's perks to see if they have any health boost perks
                        foreach (Perk charPerk in PartyGroup.globalReference.charactersInParty[p].charPerks.allPerks)
                        {
                            //If the current perk is a health boost perk, then we can give the player character more health
                            if (charPerk.GetType() == typeof(HealthBoostPerk))
                            {
                                HealthBoostPerk hpBoostPerk = charPerk.GetComponent <HealthBoostPerk>();
                                //Increasing the health stage
                                //healthStage += hpBoostPerk.healthStageBoost;

                                //Adding the amount of bonus health to give
                                bonusHealthAdded += hpBoostPerk.GetHealthBoostAmount();
                            }
                        }

                        //Finding the amount of health based on the character's health curve
                        //HealthProgressionTypes type = this.FindCharacterHealthProgression(healthStage);
                        //int healthToGiveCharacter = this.GetHealthToAdd(type);

                        //Adding the health to the character's current and maximum values
                        //PartyGroup.group1.charactersInParty[p].charPhysState.maxHealth += healthToGiveCharacter + bonusHealthAdded;
                        //PartyGroup.group1.charactersInParty[p].charPhysState.currentHealth += healthToGiveCharacter + bonusHealthAdded;
                    }
                }
            }
        }
    }
Пример #2
0
    //Function called from TrackTimePassage to calculate a given character's current health curve and any bonus health to add
    private int[] FindCharacterHealthCurve(Character character_)
    {
        //Getting the modifier for this character's health curve from their physical state
        int physStateMod = this.FindHealthCurveModFromPhysState(character_.charPhysState);

        //Int to hold the amount of bonus health added
        int bonusHealthAdded = 0;

        //Looping through the character's perks to see if they have any health boost perks
        foreach (Perk charPerk in character_.charPerks.allPerks)
        {
            //If the current perk is a health boost perk, then we can give the player character more health
            if (charPerk.GetType() == typeof(HealthBoostPerk))
            {
                HealthBoostPerk hpBoostPerk = charPerk.GetComponent <HealthBoostPerk>();
                //Increasing the health curve
                physStateMod += hpBoostPerk.healthStageBoost;

                //Adding the amount of bonus health to give
                bonusHealthAdded += hpBoostPerk.GetHealthBoostAmount();
            }
        }

        //Making sure the health curve is within reasonable bounds (between 1(feeble) and 7(strong))
        if (physStateMod > 7)
        {
            physStateMod = 7;
        }
        else if (physStateMod < 1)
        {
            physStateMod = 1;
        }

        //Returning the health cuve and bonus health values
        int[] healthCurveAndBonus = new int[2] {
            physStateMod, bonusHealthAdded
        };
        return(healthCurveAndBonus);
    }
Пример #3
0
    //Function called externally from PartyCreator.cs to generate this character's starting hit dice
    //They get a few levels worth of max health rolls and 1 random health roll on top
    public void GenerateStartingHitDice()
    {
        //Int to hold the amount of health for this character's starting health curve
        int hitDie = 0;

        //Int to hold the random die roll based on the starting health curve
        int hitRoll = 0;

        //Switch for this character's starting health curve to get the max roll value
        switch (this.startingHealthCurve)
        {
        case HealthCurveTypes.Strong:
            hitDie  = 12;
            hitRoll = Random.Range(1, 13);
            //Rolling again to see if the second roll is higher
            int strongRoll2 = Random.Range(1, 13);
            if (strongRoll2 > hitRoll)
            {
                hitRoll = strongRoll2;
            }
            break;

        case HealthCurveTypes.Sturdy:
            hitDie  = 12;
            hitRoll = Random.Range(1, 13);
            break;

        case HealthCurveTypes.Healthy:
            hitDie  = 10;
            hitRoll = Random.Range(1, 11);
            break;

        case HealthCurveTypes.Average:
            hitDie  = 8;
            hitRoll = Random.Range(1, 9);
            break;

        case HealthCurveTypes.Weak:
            hitDie  = 6;
            hitRoll = Random.Range(1, 7);
            break;

        case HealthCurveTypes.Sickly:
            hitDie  = 4;
            hitRoll = Random.Range(1, 5);
            break;

        case HealthCurveTypes.Feeble:
            hitDie  = 4;
            hitRoll = Random.Range(1, 5);
            //Rolling again to see if the second roll is lower
            int feebleRoll2 = Random.Range(1, 5);
            if (feebleRoll2 < hitRoll)
            {
                hitRoll = feebleRoll2;
            }
            break;
        }

        //Looping through the character's perks to see if they have any health boost perks
        int perkBonus = 0;

        foreach (Perk charPerk in this.GetComponent <Character>().charPerks.allPerks)
        {
            //If the current perk is a health boost perk, then we can give the character more health
            if (charPerk.GetType() == typeof(HealthBoostPerk))
            {
                HealthBoostPerk hpBoostPerk = charPerk.GetComponent <HealthBoostPerk>();
                //Adding the amount of bonus health to give
                perkBonus += hpBoostPerk.GetHealthBoostAmount();
            }
        }

        //Adding the perk bonus to the total hit die
        hitDie += perkBonus;

        //Multiplying the total amount by the number of starting dice allocated by the PartyCreator.cs
        hitDie = hitDie * PartyCreator.startingHitDice;

        //Adding the random roll value to the total hit die value as well as the perk bonus again
        hitDie += (hitRoll + perkBonus);

        //Setting this character's health to this hit die roll
        this.maxHealth     = hitDie;
        this.currentHealth = hitDie;
    }