Example #1
0
 public Item(string[] data)
 {
     int col = 0;
     foreach (string s in data)
     {
         switch (col)
         {
             case 0: 
                 {
                     _name = s;
                     break;
                 }
             case 1: 
                 {
                     _weight = Convert.ToInt16(s);
                     break;
                 }
             case 2: 
                 {
                     _value = Convert.ToInt16(s);
                     break;
                 }
             case 3: 
                 {
                     _visual = Convert.ToChar(s);
                     break;
                 }
             case 4: 
                 {
                     _color = (ConsoleColor)Enum.Parse(typeof(ConsoleColor), s);
                     break;
                 }
             case 5: 
                 {
                     _durability = new Stat(Convert.ToInt16(s));
                     break;
                 }
             case 6:
                 {
                     _Desc = (StringName)Enum.Parse(typeof(StringName), s);
                     break;
                 }
             case 7:
                 {
                     _itemClass = (ItemClass)Enum.Parse(typeof(ItemClass), s);
                     break;
                 }
             case 8:
                 {
                     _slot = (SlotType)Enum.Parse(typeof(SlotType), s);
                     break;
                 }
         }
         col++;
     }
     //set posx and posy to 0
     _posX = 0;
     _oldX = 0;
     _posY = 0;
     _oldY = 0;
     _isPassable = true;
     _blockVision = false;
     _type = ObjectType.O_ITEM;
     _seen = false;
 }
Example #2
0
 public Armor(string[] data)
 {
     int col = 0;
     foreach (string s in data)
     {
         switch (col)
         {
             case 0:
                 {
                     _name = s;
                     break;
                 }
             case 1:
                 {
                     _weight = Convert.ToInt16(s);
                     break;
                 }
             case 2:
                 {
                     _value = Convert.ToInt16(s);
                     break;
                 }
             case 3:
                 {
                     _visual = Convert.ToChar(s);
                     break;
                 }
             case 4:
                 {
                     _color = (ConsoleColor)Enum.Parse(typeof(ConsoleColor), s);
                     break;
                 }
             case 5:
                 {
                     _durability = new Stat(Convert.ToInt16(s));
                     break;
                 }
             case 6:
                 {
                     _Desc = (StringName)Enum.Parse(typeof(StringName), s);
                     break;
                 }
             case 7:
                 {
                     _itemClass = (ItemClass)Enum.Parse(typeof(ItemClass), s);
                     break;
                 }
             case 8:
                 {
                     _slot = (SlotType)Enum.Parse(typeof(SlotType), s);
                     break;
                 }
             case 9:
                 {
                     _resistBonus = Convert.ToInt16(s);
                     break;
                 }
             case 10:
                 {
                     _statLimitation = new int[2];
                     string[] limits = s.Split('/');
                     _statLimitation[0] = Convert.ToInt16(limits[0]);
                     _statLimitation[1] = Convert.ToInt16(limits[1]);
                     break;
                 }
             case 11:
                 {
                     _defence = Convert.ToInt16(s);
                     break;
                 }
             case 12:
                 {
                     _protection = new int[3];
                     string[] limits = s.Split('/');
                     _protection[0] = Convert.ToInt16(limits[0]);
                     _protection[1] = Convert.ToInt16(limits[1]);
                     _protection[2] = Convert.ToInt16(limits[2]);
                     break;
                 }
         }
         col++;
         //set posx and posy to 0
         _posX = 0;
         _oldX = 0;
         _posY = 0;
         _oldY = 0;
         _isPassable = true;
         _blockVision = false;
         _type = ObjectType.O_ITEM;
         _seen = false;
     }
 }
Example #3
0
 public Weapon(string[] data)
 {
     int col = 0;
     foreach (string s in data)
     {
         switch (col)
         {
             case 0:
                 {
                     _name = s;
                     break;
                 }
             case 1:
                 {
                     _weight = Convert.ToInt16(s);
                     break;
                 }
             case 2:
                 {
                     _value = Convert.ToInt16(s);
                     break;
                 }
             case 3:
                 {
                     _visual = Convert.ToChar(s);
                     break;
                 }
             case 4:
                 {
                     _color = (ConsoleColor)Enum.Parse(typeof(ConsoleColor), s);
                     break;
                 }
             case 5:
                 {
                     _durability = new Stat(Convert.ToInt16(s));
                     break;
                 }
             case 6:
                 {
                     _Desc = (StringName)Enum.Parse(typeof(StringName), s);
                     break;
                 }
             case 7:
                 {
                     _itemClass = (ItemClass)Enum.Parse(typeof(ItemClass), s);
                     break;
                 }
             case 8:
                 {
                     _slot = (SlotType)Enum.Parse(typeof(SlotType), s);
                     break;
                 }
             case 9:
                 {
                     _weaponClass = (WeaponClass)Enum.Parse(typeof(WeaponClass), s);
                     break;
                 }
             case 10:
                 {
                     _weaponType = (WeaponType)Enum.Parse(typeof(WeaponType), s);
                     break;
                 }
             case 11:
                 {
                     _range = Convert.ToInt16(s);
                     break;
                 }
             case 12:
                 {
                     _minStrReq = Convert.ToInt16(s);
                     break;
                 }
             case 13:
                 {
                     _latency = Convert.ToInt16(s);
                     break;
                 }
             case 14:
                 {
                     _dmg = new int[3];
                     string[] dmg = s.Split('/');
                     _dmg[0] = Convert.ToInt16(dmg[0]);
                     _dmg[1] = Convert.ToInt16(dmg[1]);
                     _dmg[2] = Convert.ToInt16(dmg[2]);
                     break;
                 }
             case 15:
                 {
                     _rangeDmg = new int[3];
                     string[] dmg = s.Split('/');
                     _rangeDmg[0] = Convert.ToInt16(dmg[0]);
                     _rangeDmg[1] = Convert.ToInt16(dmg[1]);
                     _rangeDmg[2] = Convert.ToInt16(dmg[2]);
                     break;
                 }
             case 16:
                 {
                     _defenceBonus = Convert.ToInt16(s);
                     break;
                 }
             case 17:
                 {
                     _armorDmgMultipiers = Single.Parse(s);
                     break;
                 }
             case 18:
                 {
                     _attack = Convert.ToInt16(s);
                     break;
                 }
             case 19:
                 {
                     _heightReq = Convert.ToInt16(s);
                     break;
                 }
         }
         col++;
     }
         //set posx and posy to 0
         _posX = 0;
         _oldX = 0;
         _posY = 0;
         _oldY = 0;
         _isPassable = true;
         _blockVision = false;
         _type = ObjectType.O_ITEM;
         _seen = false;
 }
Example #4
0
 public Monster(int[] stats, int[] resists, MonsterFight mf, Classess monClass, int baseM, int basePh, string desc, char vis, ConsoleColor color)
 {
     _isPassable = false;
     _type = ObjectType.O_MONSTER;
     _monsterBehaviur = MonsterState.MS_IDLE;
     _pathAvaible = false;
     _route = new List<Point>();
     _movement = new List<Point>();
     _seen = false;
     _description = desc;
     _visual = vis;
     _color = color;
     _class = monClass;
     _primaryStats = new Dictionary<PrimaryStats, Stat>();
     _resists = new Dictionary<Resists, Stat>();
     _BaseResists = new Dictionary<ResistGroup, Stat>();
     _monsterWeapons = mf.ListOfWeapons;
     _monsterArmor = mf.monsterArmor;
     _weaponProficiencies = new int[mf.ListOfWeapons.GetLength(0)];
     _states = new bool[(int)PlayerStates.MAX_SIZE];
     changeState(PlayerStates.NORMAL);
     for (PrimaryStats i = PrimaryStats.VITALITY; i < PrimaryStats.MAX_SIZE; i++)
     {
         _primaryStats.Add(i, new Stat(stats[(int)i]));
     }
     for (Resists i = Resists.RESIST_1; i < Resists.MAX_SIZE; i++)
     {
         _resists.Add(i, new Stat(resists[(int)i]));
     }
     _BaseResists.Add(ResistGroup.MENTAL, new Stat(baseM));
     _BaseResists.Add(ResistGroup.PHYSICAL, new Stat(basePh));
     Level = 0;
     _Stamina = new Stat(_primaryStats[PrimaryStats.VITALITY].currentValue / 10 + _primaryStats[PrimaryStats.STRENGTH].currentValue / 10);
     //recalculate dex and spd based on armor limitation
     _primaryStats[PrimaryStats.DEXTERITY].actualValue /= _monsterArmor.Limitation[0];
     _primaryStats[PrimaryStats.SPEED].actualValue /= _monsterArmor.Limitation[1];
     //calculate defence without weapon
     _defence = new Stat(_monsterArmor.Defence + Convert.ToInt16(Math.Round((_primaryStats[PrimaryStats.DEXTERITY].actualValue / 10.0f))));
     _protection = new int[3];
     _protection[0] = _monsterArmor.Protection[0];
     _protection[1] = _monsterArmor.Protection[1];
     _protection[2] = _monsterArmor.Protection[2];
     //genereate weapon proficiency for all weapons
     for (int i = 0; i < _monsterWeapons.GetLength(0); i++)
     {
         int bonus = _monsterWeapons[i].ProfBonus;
         int prof = bonus + Data.PlayerClass.ClassProficiencyTable[_class][1] + Dice.Roll("d50");
         _weaponProficiencies[i] = prof;
     }
     _steps = 0;
     _exp = MonsterGenerator.CalcualteMonsterExp(this);
     //calcualte magic potential for future casters
     _MagicPotential = new Stat(0);
     CalculateMagicPotential();
 }
Example #5
0
 public Character(int posX, int posY, Race r, SocialStatus s, string name, PlayerClass p, int[] pStats, int[] pResists, int[] pBaseRes, int[,] wp, char visual = '@')
 {
     _posX = posX;
     _posY = posY;
     _oldX = posX;
     _oldY = posY;
     _visibilityRange = 5;
     _visual = visual;
     _color = ConsoleColor.Green;
     _type = ObjectType.O_PC;
     _seen = true;
     gender = r.GenderType;
     genderName = r.genderName;
     race = r.RaceType;
     raceName = r.Name;
     Height = r.Height;
     Weight = r.Weight;
     Title = s.Title;
     Name = name;
     PlaceOfBirth = s.PoB;
     SocialClass = s.SocialClass;
     nameSocialClass = s.nameSocialClass;
     playerSocialStatus = s.socialStatus;
     nameSocialStatus = s.nameSocialStatus;
     playerClass = p.playerClass;
     className = p.className;
     _backpack = new Backpack();
     _inventory = new Inventory();
     _weaponProficiencies = new List<WeaponProficiency>();
     _primaryStats = new Dictionary<PrimaryStats, Stat>();
     _resists = new Dictionary<Resists, Stat>();
     _BaseResists = new Dictionary<ResistGroup, Stat>();
     _protection = new int[(int)DamageType.MAX_SIZE];
     _states = new bool[(int)PlayerStates.MAX_SIZE];
     changeState(PlayerStates.NORMAL);
     for (PrimaryStats i = PrimaryStats.VITALITY; i < PrimaryStats.MAX_SIZE; i++)
     {
         _primaryStats.Add(i, new Stat(pStats[(int)i]));
     }
     for (Resists i = Resists.RESIST_1; i < Resists.MAX_SIZE; i++)
     {
         _resists.Add(i, new Stat(pResists[(int)i]));
     }
     _BaseResists.Add(ResistGroup.MENTAL, new Stat(pBaseRes[0]));
     _BaseResists.Add(ResistGroup.PHYSICAL, new Stat(pBaseRes[1]));
     _Stamina = new Stat(_primaryStats[PrimaryStats.VITALITY].currentValue / 10 + _primaryStats[PrimaryStats.STRENGTH].currentValue / 10);
     _MagicPotential = new Stat(0);
     _freeProficiences = PlayerClass.ClassProficiencyTable[playerClass][0];
     Gold = s.Gold;
     Level = 0;
     Exp = 0;
     _timeOfDamage = -1;
     CalculateRegenerationRate();
     _defence = new Stat(Race.MaleStatsTable[(int)race][11]);
     int count = wp.GetLength(0);
     _freeProficiences = PlayerClass.ClassProficiencyTable[playerClass][0] - count;
     for (int i = 0; i < count; i++)
     {
         _weaponProficiencies.Add(new WeaponProficiency((WeaponClass)wp[i, 0], wp[i, 1], (StringName)Enum.Parse(typeof(StringName), "WEAPONCLASS_" + (WeaponClass)wp[i, 0])));
     }
     CalculateBaseDefence();
     CalculateBaseProtection();
     CalculateEncumbrance();
     CalculateStamina();
     if (PlayerClass.GetCastesOfClass(playerClass) == Castes.PRIESTS || PlayerClass.GetCastesOfClass(playerClass) == Castes.SORCERERS)
     {
         CalculateMagicPotential();
     }
 }