static private Monster levelMonster(int level, Monster _monster)
        {
            Classess _class = _monster.Class;
            int[] bonuses;
            _monster.IncreaseLevel(level);
            for (int lvl = 0; lvl < level; lvl++)
            {
                bonuses = PlayerClass.ParseClassLevelBonuses(_class);
                //increase primary stats
                for (int i = 0; i < (int)PrimaryStats.MAX_SIZE; i++)
                {
                    if (i == (int)PrimaryStats.VITALITY || i == (int)PrimaryStats.STRENGTH)
                    {
                        _monster.Stat[(PrimaryStats)i].Increase(bonuses[i]);
                    }
                    else
                    {
                        _monster.Stat[(PrimaryStats)i].baseValue += bonuses[i];
                        _monster.Stat[(PrimaryStats)i].currentValue += bonuses[i];
                        _monster.Stat[(PrimaryStats)i].actualValue = _monster.Stat[(PrimaryStats)i].currentValue;
                    }
                }
                //increase resists
                //if level is odd increase physical if even mental
                if (lvl % 2 != 0)
                {
                    for (int i = 0; i < (int)Resists.RESIST_6; i++)
                    {
                        _monster.Resist[(Resists)i].baseValue += bonuses[13];   //13 holds bonus to resists
                        _monster.Resist[(Resists)i].currentValue += bonuses[13];
                        _monster.Resist[(Resists)i].actualValue = _monster.Resist[(Resists)i].currentValue;
                    }
                    _monster.BaseResist[ResistGroup.MENTAL].baseValue += bonuses[13];
                    _monster.BaseResist[ResistGroup.MENTAL].currentValue += bonuses[13];
                    _monster.BaseResist[ResistGroup.MENTAL].actualValue = _monster.BaseResist[ResistGroup.MENTAL].currentValue;
                }
                else
                {
                    for (int i = 5; i < (int)Resists.MAX_SIZE; i++)
                    {
                        _monster.Resist[(Resists)i].baseValue += bonuses[13];   //13 holds bonus to resists
                        _monster.Resist[(Resists)i].currentValue += bonuses[13];
                        _monster.Resist[(Resists)i].actualValue = _monster.Resist[(Resists)i].currentValue;
                    }
                    _monster.BaseResist[ResistGroup.PHYSICAL].baseValue += bonuses[13];
                    _monster.BaseResist[ResistGroup.PHYSICAL].currentValue += bonuses[13];
                    _monster.BaseResist[ResistGroup.PHYSICAL].actualValue = _monster.BaseResist[ResistGroup.PHYSICAL].currentValue;
                }
                //proficiency bonus
                for (int i = 0; i < _monster._weaponProficiencies.GetLength(0); i++)
                {
                    _monster._weaponProficiencies[i] += bonuses[11];
                }
            }

            _monster.EXPReward = CalcualteMonsterExp(_monster);
            //recalculate defence
            _monster.Defence = new Stat(_monster._monsterArmor.Defence + Convert.ToInt16(Math.Round((_monster.Stat[PrimaryStats.DEXTERITY].actualValue / 10.0f))));
            //recalculate stamina
            _monster.BaseStamina = _monster.Stat[PrimaryStats.VITALITY].currentValue / 10 + _monster.Stat[PrimaryStats.STRENGTH].currentValue / 10;
            _monster.CurrentStamina = _monster.BaseStamina;
            _monster.ActualStamina = _monster.BaseStamina;
            //recalculate Magic Potential
            _monster.CalculateMagicPotential();
            return _monster;
        }
 public static int CalcualteMonsterExp(Monster monster)
 {
     int sum = 0;
     int statBonus = 0;
     int protBonus = 0;
     int profBonus = 0;
     int damage = 0;
     int resist = 0;
     //get value from stats
     for (PrimaryStats i = PrimaryStats.VITALITY; i < PrimaryStats.FAITH; i++)
     {
         statBonus += monster.Stat[i].baseValue / 100;
     }
     if (monster.Level == 0)
     {
         statBonus /= 2;
     }
     else
     {
         statBonus *= monster.Level;
     }
     sum = statBonus;
     //get value from defence
     sum += monster.Defence.baseValue / 100;
     //get avg value from protection
     protBonus = (monster.Protection[0] + monster.Protection[1] + monster.Protection[2]) / 3;
     sum += protBonus / 100;
     //get value from proficiencies and weapons damage
     for (int i = 0; i < monster._weaponProficiencies.GetLength(0); i++)
     {
         profBonus += monster._weaponProficiencies[i] / 100;
         int prof = monster._weaponProficiencies[i];
         int[] dmg = new int[3];
         for (int z = 0; z < 3; z++)
         {
             dmg[z] = monster._monsterWeapons[i].Damage[z];
         } 
         for (int j = 0; j < dmg.GetLength(0); j++)
         {
             if (dmg[j] == 0)
             {
                 continue;
             }
             dmg[j] = Convert.ToInt16((float)dmg[j] * (prof / 100f)) + Convert.ToInt16(Math.Round(monster.Stat[PrimaryStats.STRENGTH].currentValue / 4f));
             damage += dmg[j] / 100;
         }
     }
     sum += profBonus;
     sum += damage;
     resist = Math.Max(monster.BaseResist[ResistGroup.MENTAL].baseValue, monster.BaseResist[ResistGroup.PHYSICAL].baseValue) / 100;
     sum += resist;
     //TODO add antimagic or other stats after implementation of them
     return sum;
 }
Exemple #3
0
 public static int KillMonster(Monster monster)
 {
     //remove target from map
     int x, y;
     x = monster.getX();
     y = monster.getY();
     MapTile tile = GC.CurrentMap.getMapTile(x, y);
     tile.removeObject(monster);
     GC.CurrentMap.redrawTile(tile);
     GC.Entities.Remove(monster);
     return monster.EXPReward;
 }