Exemple #1
0
 public void Initialize(PAbility ability, int level)
 {
     Type           = ability;
     Level          = level;
     Power          = Pet.GetNeededPower(level - 1);
     _nextPowerGoal = Pet.GetNeededPower(level);
 }
Exemple #2
0
        public PetAbility(Pet owner, int abilityId)
        {
            _owner     = owner;
            _abilityId = abilityId;

            Type  = PAbility.Undefined;
            Level = 1;
            Power = 0;

            _nextPowerGoal = Pet.GetNeededPower(Level);
        }
Exemple #3
0
        public PetAbility(Pet owner, DbPet dbPet, int abilityId)
        {
            _owner     = owner;
            _abilityId = abilityId;

            var ability = dbPet.Ability[abilityId];

            Type  = ability.Type;
            Level = ability.Level;
            Power = ability.Power;

            _nextPowerGoal = Pet.GetNeededPower(Level);
        }
Exemple #4
0
        public void Feed(int feedPower)
        {
            if (Level >= _owner.MaxLevel)
            {
                return;
            }

            // modify feed power based on ability
            var p = feedPower;

            switch (_abilityId)
            {
            case 0:
                break;

            case 1:
                p = (int)(p * .65f);
                break;

            case 2:
                p = (int)(p * .30f);
                break;

            default:
                p = (int)(p * .10f);
                break;
            }

            // power up
            Power += p;
            while (Power >= _nextPowerGoal)
            {
                Level++;

                if (Level >= _owner.MaxLevel)
                {
                    Power = _nextPowerGoal;
                }

                _nextPowerGoal = Pet.GetNeededPower(Level);
            }
        }