//Same as above, except to decrease the stat
    public void DecreaseStat(Stat stat, float baseStat)
    {
        float  newStatValue = 0;
        string statName     = null;

        switch (stat)
        {
        case Stat.PHYSICAL_ATTACK:
            if (PhysicalAttack - 1 >= (int)baseStat)
            {
                PhysicalAttack--;
                newStatValue = PhysicalAttack;
                statName     = "PAtk";
                StatPoints++;
            }
            break;

        case Stat.MAGICAL_ATTACK:
            if (MagicalAttack - 1 >= (int)baseStat)
            {
                MagicalAttack--;
                newStatValue = MagicalAttack;
                statName     = "MAtk";
                StatPoints++;
            }
            break;

        case Stat.PHYSICAL_DEFENSE:
            if (PhysicalDefense - 1 >= (int)baseStat)
            {
                PhysicalDefense--;
                newStatValue = PhysicalDefense;
                statName     = "Pdef";
                StatPoints++;
            }
            break;

        case Stat.MAGICAL_DEFENSE:
            if (MagicalDefense - 1 >= (int)baseStat)
            {
                MagicalDefense--;
                newStatValue = MagicalDefense;
                statName     = "MDef";
                StatPoints++;
            }
            break;

        case Stat.SPEED:
            if (Speed - 1 >= baseStat)
            {
                Speed--;
                newStatValue = Speed;
                statName     = "Speed";
                StatPoints++;
            }
            break;
        }
        _network.UpdatePlayerStat(statName, newStatValue.ToString());
        _network.UpdatePlayerStat("StatPoints", StatPoints.ToString());
    }
Exemplo n.º 2
0
 public Character(string name, CharClass classType,
                  StatPoints hpId,
                  StatPoints atkId,
                  StatPoints defId,
                  StatPoints dexId,
                  StatPoints wisId)
 {
     Name      = name;
     ClassType = classType;
     HpId      = hpId;
     AtkId     = atkId;
     DefId     = defId;
     DexId     = dexId;
     WisId     = wisId;
 }
    //takes in a PlayerStats.Stat and uses a skillpoint to level up a stat
    //Effective stats get increased by 1 by default. If you want better scaling, change this
    public void LevelUpStat(Stat stat)
    {
        float  newStatValue = 0;
        string statName     = null;

        if (StatPoints > 0)
        {
            switch (stat)
            {
            case Stat.PHYSICAL_ATTACK:
                PhysicalAttack++;
                newStatValue = PhysicalAttack;
                statName     = "PAtk";
                break;

            case Stat.MAGICAL_ATTACK:
                MagicalAttack++;
                newStatValue = MagicalAttack;
                statName     = "MAtk";
                break;

            case Stat.PHYSICAL_DEFENSE:
                PhysicalDefense++;
                newStatValue = PhysicalDefense;
                statName     = "Pdef";
                break;

            case Stat.MAGICAL_DEFENSE:
                MagicalDefense++;
                newStatValue = MagicalDefense;
                statName     = "MDef";
                break;

            case Stat.SPEED:
                Speed++;
                newStatValue = Speed;
                statName     = "Speed";
                break;
            }
            StatPoints--;
        }
        _network.UpdatePlayerStat(statName, newStatValue.ToString());
        _network.UpdatePlayerStat("StatPoints", StatPoints.ToString());
    }
Exemplo n.º 4
0
 public void RemoveStatBonus(StatBonus statBonus)
 {
     this.StatPoints.Remove(StatPoints.Find(x => x.BonusValue == statBonus.BonusValue));
 }