コード例 #1
0
    private void DeterminePlayerVitals()
    {
        Debug.Log("Have to remove TestPlayer!");
        //TestPlayer(); //comment out when the game exist
        for (byte i = 0; i < BattleStateMachine.numPlayers; i++)
        {
            BattleStateMachine.players.Add(new BaseCharacterClass());
            Debug.Log("Before creatureName: " + GameInformation.PlayerName);
            BattleStateMachine.players[i].CreatureName = GameInformation.PlayerName;
            Debug.Log("after creatureName: " + BattleStateMachine.players[i].CreatureName);
            BattleStateMachine.players[i].CharacterClassEnum = GameInformation.PlayerClass;
            BattleStateMachine.players[i].Agility            = GameInformation.Agility;
            BattleStateMachine.players[i].Strength           = GameInformation.Strength;
            BattleStateMachine.players[i].Stamina            = GameInformation.Stamina;
            BattleStateMachine.players[i].Spirit             = GameInformation.Spirit;
            BattleStateMachine.players[i].Vitality           = GameInformation.Vitality;
            BattleStateMachine.players[i].Intelect           = GameInformation.Intelect;
            BattleStateMachine.playerAttPow[i] = statDerivedOther.CalculateDerivedStatByte(BattleStateMachine.players[i].Strength, 0, StatCalculations.DerivedStatTypes.AttackPower);
            BattleStateMachine.playerMagPow[i] = statDerivedOther.CalculateDerivedStatByte(BattleStateMachine.players[i].Intelect, 0, StatCalculations.DerivedStatTypes.MagicPower);
            BattleStateMachine.playerSpeed[i]  = statDerivedOther.CalculateDerivedStatByte(BattleStateMachine.players[i].Agility, 0, StatCalculations.DerivedStatTypes.Speed);
            BattleStateMachine.playerPhyDef[i] = statDerivedOther.CalculateDerivedStatByte(BattleStateMachine.players[i].Vitality, 0, StatCalculations.DerivedStatTypes.PhyDmgNeg);
            BattleStateMachine.playerMagDef[i] = statDerivedOther.CalculateDerivedStatByte(BattleStateMachine.players[i].Spirit, 0, StatCalculations.DerivedStatTypes.MagDmgNeg);
            BattleStateMachine.MaxPlayerHP[i]  = statDerivedHP.CalculateDerivedStatUshort(BattleStateMachine.players[i].Stamina, 0, StatCalculations.DerivedStatTypes.HealthPoints);
            BattleStateMachine.MaxPlayerMP[i]  = statDerivedMP.CalculateDerivedStatUshort(BattleStateMachine.players[i].Intelect, BattleStateMachine.players[i].Spirit, 0);
            byte tempHpMp = 100;
            switch (BattleInfomation.MaxSettingHpMp)
            {
            case (0):
                tempHpMp = 100;
                break;

            case (1):
                tempHpMp = 75;
                break;

            case (2):
                tempHpMp = 50;
                break;

            case (3):
                tempHpMp = 25;
                break;

            case (4):
                tempHpMp = 1;
                break;
            }
            BattleStateMachine.CurrentPlayerHP[i] = tempHpMp == 1 ? (ushort)1 : (ushort)(BattleStateMachine.MaxPlayerHP[i] * tempHpMp / 100);
            Debug.Log("temp: " + tempHpMp + " HP:" + BattleStateMachine.CurrentPlayerHP[i] + " / " + BattleStateMachine.MaxPlayerHP[i] + " speed: " + BattleStateMachine.playerSpeed[i]);
            BattleStateMachine.CurrentPlayerMP[i] = tempHpMp == 1 ? (ushort)1 : (ushort)(BattleStateMachine.MaxPlayerMP[i] * tempHpMp / 100);
        }
    }
コード例 #2
0
    //still need to work on
    private void calcType(BaseSkills.PowerTypes powerType, int skillType)
    {
        CalcDerivedOther getModiferOther = new CalcDerivedOther();
        CalcDerivedHP    getModifierHP   = new CalcDerivedHP();
        bool             test            = false;
        byte             tempHolder      = 0;

        //float statModifer = .1f;
        if (powerType == BaseSkills.PowerTypes.NONE)
        {
            Debug.Log("Error based on powerType is " + powerType);
            return;
        }
        else if (powerType == BaseSkills.PowerTypes.AGILITY)
        {
            test = true;
            if (BattleStateMachine.currentUser < BattleStateMachine.players.Count)
            {
                tempHolder = BattleStateMachine.players[BattleStateMachine.currentUser].Agility;
            }
            else if (BattleStateMachine.currentUser < BattleStateMachine.npcs.Count + BattleStateMachine.players.Count)
            {
                tempHolder = BattleStateMachine.npcs[BattleStateMachine.currentUser - BattleStateMachine.players.Count].Agility;
            }
            else
            {
                tempHolder = BattleStateMachine.monsters[BattleStateMachine.currentUser - 4].Agility;
            }
            modifier = getModiferOther.CalculateDerivedStatByte(tempHolder, 0, StatCalculations.DerivedStatTypes.Speed);
        }
        else if (powerType == BaseSkills.PowerTypes.INTELECT)
        {
            test = true;
            if (BattleStateMachine.currentUser < BattleStateMachine.players.Count)
            {
                tempHolder = BattleStateMachine.players[BattleStateMachine.currentUser].Intelect;
            }
            else if (BattleStateMachine.currentUser < BattleStateMachine.npcs.Count + BattleStateMachine.players.Count)
            {
                tempHolder = BattleStateMachine.npcs[BattleStateMachine.currentUser - BattleStateMachine.players.Count].Intelect;
            }
            else
            {
                tempHolder = BattleStateMachine.monsters[BattleStateMachine.currentUser - 4].Intelect;
            }
            modifier = getModiferOther.CalculateDerivedStatByte(tempHolder, 0, StatCalculations.DerivedStatTypes.MagicPower);
        }
        else if (powerType == BaseSkills.PowerTypes.SPIRIT)
        {
            test = true;
            if (BattleStateMachine.currentUser < BattleStateMachine.players.Count)
            {
                tempHolder = BattleStateMachine.players[BattleStateMachine.currentUser].Spirit;
            }
            else if (BattleStateMachine.currentUser < BattleStateMachine.npcs.Count + BattleStateMachine.players.Count)
            {
                tempHolder = BattleStateMachine.npcs[BattleStateMachine.currentUser - BattleStateMachine.players.Count].Spirit;
            }
            else
            {
                tempHolder = BattleStateMachine.monsters[BattleStateMachine.currentUser - 4].Spirit;
            }
            modifier = getModiferOther.CalculateDerivedStatByte(tempHolder, 0, StatCalculations.DerivedStatTypes.MagDmgNeg);
        }
        else if (powerType == BaseSkills.PowerTypes.STAMINA)
        {
            test = true;
            if (BattleStateMachine.currentUser < BattleStateMachine.players.Count)
            {
                tempHolder = BattleStateMachine.players[BattleStateMachine.currentUser].Stamina;
            }
            else if (BattleStateMachine.currentUser < BattleStateMachine.npcs.Count + BattleStateMachine.players.Count)
            {
                tempHolder = BattleStateMachine.npcs[BattleStateMachine.currentUser - BattleStateMachine.players.Count].Stamina;
            }
            else
            {
                tempHolder = BattleStateMachine.monsters[BattleStateMachine.currentUser - 4].Stamina;
            }
            modifier = getModifierHP.CalculateDerivedStatUshort(tempHolder, 0, StatCalculations.DerivedStatTypes.HealthPoints);
        }
        else if (powerType == BaseSkills.PowerTypes.VITALITY)
        {
            test = true;
            if (BattleStateMachine.currentUser < BattleStateMachine.players.Count)
            {
                tempHolder = BattleStateMachine.players[BattleStateMachine.currentUser].Vitality;
            }
            else if (BattleStateMachine.currentUser < BattleStateMachine.npcs.Count + BattleStateMachine.players.Count)
            {
                tempHolder = BattleStateMachine.npcs[BattleStateMachine.currentUser - BattleStateMachine.players.Count].Vitality;
            }
            else
            {
                tempHolder = BattleStateMachine.monsters[BattleStateMachine.currentUser - 4].Vitality;
            }
            modifier = getModiferOther.CalculateDerivedStatByte(tempHolder, 0, StatCalculations.DerivedStatTypes.PhyDmgNeg);
        }
        else if (powerType == BaseSkills.PowerTypes.STRENGTH)
        {
            test = true;
            if (BattleStateMachine.currentUser < BattleStateMachine.players.Count)
            {
                tempHolder = BattleStateMachine.players[BattleStateMachine.currentUser].Strength;
            }
            else if (BattleStateMachine.currentUser < BattleStateMachine.npcs.Count + BattleStateMachine.players.Count)
            {
                tempHolder = BattleStateMachine.npcs[BattleStateMachine.currentUser - BattleStateMachine.players.Count].Strength;
            }
            else
            {
                tempHolder = BattleStateMachine.monsters[BattleStateMachine.currentUser - 4].Strength;
            }
            modifier = getModiferOther.CalculateDerivedStatByte(tempHolder, 0, StatCalculations.DerivedStatTypes.AttackPower);
        }
        if (test)
        {
            return;
        }
        else if (powerType == BaseSkills.PowerTypes.POWERPOINTS)  //not ready yet
        {
            modifier = skillType * GameInformation.Strength * GameInformation.Intelect;
        }
        else if (powerType == BaseSkills.PowerTypes.MANA)
        {
            modifier = skillType * GameInformation.Intelect;
        }
    }