예제 #1
0
파일: Town.cs 프로젝트: sakseichek/homm
 public Town()
 {
     _id = 0;
     _playerId = 0;
     _armyName = "";
     _player = null;
     _buildingKIds = new Hashtable();
     _armyAvKIds = new Hashtable();
     _armyInCastleKSlots = new Hashtable();
     _armyInCastleLabels = new Hashtable();
     _heroInCastle = null;
     _heroVisit = null;
     _isBuilt = false;
 }
예제 #2
0
파일: Hero.cs 프로젝트: sakseichek/homm
        public void CopyFrom(Hero hero)
        {
            this._id = hero._id;
            this._playerId = hero._playerId;
            this._name = hero._name;
            this._description = hero._description;
            this._sex = hero._sex;
            this._heroType = hero._heroType;

            this._basicAttack = hero._basicAttack;
            this._basicDefense = hero._basicDefense;
            this._basicPower = hero._basicPower;
            this._basicKnowledge = hero._basicKnowledge;

            this._attack = hero._attack;
            this._defense = hero._defense;
            this._power = hero._power;
            this._knowledge = hero._knowledge;
            this._speed = hero._speed;
            this._health = hero._health;

            this._experience = hero._experience;
            this._level = hero._level;
            this._maxSpellPoint = hero._maxSpellPoint;
            this._spellPointLeft = hero._spellPointLeft;
            this._infoImgFileName = hero._infoImgFileName;

            this._movementPoint = hero._movementPoint;
            this._movementPointLeft = hero._movementPointLeft;
        }
예제 #3
0
파일: Hero.cs 프로젝트: sakseichek/homm
        public void CopyAllFrom(Hero hero)
        {
            CopyFrom(hero);

            this._player = new Player();
            this._player.CopyFrom(hero._player);

            foreach (Army army in hero._armyKSlots.Values)
            {
                this._armyKSlots.Add(army._slotNo, army);
            }

            foreach (Spell spell in hero._spells.Values)
            {
                Spell spell2 = new Spell();
                spell2.CopyFrom(spell);
                this._spells.Add(spell2._id, spell2);
            }

            foreach (Skill skill in hero._skills.Values)
            {
                Skill skill2 = new Skill();
                skill2.CopyFrom(skill);
                this._skills.Add(skill2._id, skill2);
            }
        }
예제 #4
0
파일: Setting.cs 프로젝트: edwardsak/homm
        private static bool GetHeros(out Hashtable lst)
        {
            lst = new Hashtable();

            using (StreamReader sr = new StreamReader(string.Format(@"{0}\Data\Hero.txt", _appStartupPath)))
            {
                string strLine = "";
                strLine = sr.ReadLine();    // 1st line is column header

                while (!sr.EndOfStream)
                {
                    strLine = sr.ReadLine();

                    // id,race,type,name,sex,specialId,a,d,p,k,img,desc
                    string[] datas = strLine.Split(new char[] { ',' }, 12);

                    Hero dr = new Hero();
                    dr._id = System.Convert.ToInt32(datas[0]);
                    dr._raceId = System.Convert.ToInt32(datas[1]);
                    dr._heroType = (HeroTypeEnum)System.Convert.ToInt32(datas[2]);
                    dr._name = datas[3];
                    dr._sex = (SexEnum)System.Convert.ToInt32(datas[4]);
                    //dr._specialty = (SpecialtyIdEnum)System.Convert.ToInt32(datas[5]);

                    dr._basicAttack = System.Convert.ToInt32(datas[6]);
                    dr._basicDefense = System.Convert.ToInt32(datas[7]);
                    dr._basicPower = System.Convert.ToInt32(datas[8]);
                    dr._basicKnowledge = System.Convert.ToInt32(datas[9]);

                    dr._attack = dr._basicAttack;
                    dr._defense = dr._basicDefense;
                    dr._power = dr._basicPower;
                    dr._knowledge = dr._basicKnowledge;

                    dr._infoImgFileName = string.Format(@"{0}\Images\Core\Heros\Info\{1}", _appStartupPath, datas[10]);
                    dr._description = datas[11];

                    lst.Add(dr._id, dr);
                }
            }

            return true;
        }
예제 #5
0
파일: Spell.cs 프로젝트: sakseichek/homm
        private int GetSkillLevel(Hero hero)
        {
            int level = 0;
            if (_elementType == ElementTypeEnum.Air)
            {
                if (hero._skills.ContainsKey((int)SkillIdEnum.AirMagic))
                {
                    Skill skill = (Skill)hero._skills[(int)SkillIdEnum.AirMagic];
                    level = skill._level;
                }
            }
            else if (_elementType == ElementTypeEnum.Fire)
            {
                if (hero._skills.ContainsKey((int)SkillIdEnum.FireMagic))
                {
                    Skill skill = (Skill)hero._skills[(int)SkillIdEnum.FireMagic];
                    level = skill._level;
                }
            }
            else if (_elementType == ElementTypeEnum.Earth)
            {
                if (hero._skills.ContainsKey((int)SkillIdEnum.EarthMagic))
                {
                    Skill skill = (Skill)hero._skills[(int)SkillIdEnum.EarthMagic];
                    level = skill._level;
                }
            }
            else if (_elementType == ElementTypeEnum.Water)
            {
                if (hero._skills.ContainsKey((int)SkillIdEnum.WaterMagic))
                {
                    Skill skill = (Skill)hero._skills[(int)SkillIdEnum.WaterMagic];
                    level = skill._level;
                }
            }

            return level;
        }
예제 #6
0
파일: Spell.cs 프로젝트: sakseichek/homm
        public void CalculateDamage(Hero hero)
        {
            int level = GetSkillLevel(hero);
            if (level == 0) level = 1;  // at least has basic damage

            decimal sorceryBonus = 0m;
            if (hero._skills.ContainsKey((int)SkillIdEnum.Sorcery))
            {
                Skill skill = (Skill)hero._skills[(int)SkillIdEnum.Sorcery];
                sorceryBonus = (decimal)skill._effects[skill._level - 1] / 100m;
            }

            decimal artifactBonus = 0m;
            if (hero._spellDmgKEles.ContainsKey(this._elementType))
                artifactBonus = (decimal)hero._spellDmgKEles[this._elementType] / 100m;

            decimal dmg = ((decimal)hero._power * (decimal)this._basicDamage + (decimal)this._damageLevels[level - 1])
                * (1m + sorceryBonus) * (1m + artifactBonus);
            this._damage = (int)decimal.Truncate(dmg);
        }
예제 #7
0
파일: Spell.cs 프로젝트: sakseichek/homm
        public void CalculateCost(Hero hero)
        {
            int level = GetSkillLevel(hero);

            decimal reductionBonus = 0m;
            if (level > 0) reductionBonus = 0.2m;

            decimal cost = (decimal)_basicCost * (1m - reductionBonus);
            this._cost = (int)decimal.Truncate(cost);
        }
예제 #8
0
        public DialogResult ShowDialog(Heroes.Core.Hero attackHero, Heroes.Core.Hero defendHero, Heroes.Core.Monster monster, Heroes.Core.Town defendCastle)
        {
            _attackHero = attackHero;
            _defendHero = defendHero;
            _monster = monster;
            _defendCastle = defendCastle;

            _controller = new Controller(this, null, new Size(800, 600), null);
            _poller = new Poller(this);
            _inputMethod = new InputPollerCommand(_poller);

            SetupEngine();
            SetupRenderer();

            return this.ShowDialog();
        }