Exemple #1
0
        private void cmdWood_Click(object sender, EventArgs e)
        {
            Button btn = (Button)sender;

            if (this._currentHero._movementPointLeft <= 0)
            {
                MessageBox.Show("No more movement points.");
                return;
            }

            int mineType = 0;
            int[] armyLevels = null;
            if (cmdWood.Equals(btn))
            {
                mineType = (int)Heroes.Core.MineTypeEnum.Wood;
                armyLevels = new int[] { 1, 2 };
            }
            else if (cmdOre.Equals(btn))
            {
                mineType = (int)Heroes.Core.MineTypeEnum.Ore;
                armyLevels = new int[] { 1, 2 };
            }
            else if (cmdMercury.Equals(btn))
            {
                mineType = (int)Heroes.Core.MineTypeEnum.Mercury;
                armyLevels = new int[] { 3, 4 };
            }
            else if (cmdSulfur.Equals(btn))
            {
                mineType = (int)Heroes.Core.MineTypeEnum.Sulfur;
                armyLevels = new int[] { 3, 4 };
            }
            else if (cmdCrystal.Equals(btn))
            {
                mineType = (int)Heroes.Core.MineTypeEnum.Crystal;
                armyLevels = new int[] { 3, 4 };
            }
            else if (cmdGem.Equals(btn))
            {
                mineType = (int)Heroes.Core.MineTypeEnum.Gem;
                armyLevels = new int[] { 3, 4 };
            }
            else if (cmdGold.Equals(btn))
            {
                mineType = (int)Heroes.Core.MineTypeEnum.Gold;
                armyLevels = new int[] { 5, 6 };
            }
            else
                return;

            this._currentHero._movementPointLeft -= 1;

            ArrayList mines = _currentPlayer._mineKTypes[mineType];
            int count = mines.Count;
            count += 1;

            Heroes.Core.Monster monster = CreateMonster(armyLevels, 2, count);

            if (chkQuickCombat.Checked)
            {
                Heroes.Core.Battle.Quick.BattleCommander quickBattle = new Heroes.Core.Battle.Quick.BattleCommander(this._currentPlayer, this._currentHero,
                    null, null, monster, true);
                Heroes.Core.Battle.BattleSideEnum victory = quickBattle.Start();

                if (!ShowBattleResult(victory, this._currentPlayer._id,
                    quickBattle._attackHero, quickBattle._defendHero, quickBattle._monster)) return;
            }
            else
            {
                StartingBattleEventArg e2 = new StartingBattleEventArg(this._currentHero, null, monster);
                OnStartingBattle(e2);

                if (!e2._success) return;
            }

            Heroes.Core.Mine mine = new Heroes.Core.Mine();
            mine.CopyFrom((Heroes.Core.Mine)Heroes.Core.Setting._mineTypes[mineType]);
            mines.Add(mine);
        }
Exemple #2
0
        private void cmdWarriorTomb_Click(object sender, EventArgs e)
        {
            Button btn = (Button)sender;

            if (this._currentHero._movementPointLeft <= 0)
            {
                MessageBox.Show("No more movement points.");
                return;
            }

            int qtyIndex = 0;
            int tombIndex = 0;
            Heroes.Core.Heros.ArtifactLevelEnum artifactLevel = Heroes.Core.Heros.ArtifactLevelEnum.Treasure;
            int[] armyLevels = null;
            if (btn.Equals(cmdWarriorTomb))
            {
                qtyIndex = 2;
                tombIndex = 0;
                artifactLevel = Heroes.Core.Heros.ArtifactLevelEnum.Treasure;
                armyLevels = new int[] { 1, 2 };
            }
            else if (btn.Equals(cmdDwarvenTreasury))
            {
                qtyIndex = 2;
                tombIndex = 1;
                artifactLevel = Heroes.Core.Heros.ArtifactLevelEnum.Minor;
                armyLevels = new int[] { 3, 4 };
            }
            else if (btn.Equals(cmdGriffinConserv))
            {
                qtyIndex = 2;
                tombIndex = 2;
                artifactLevel = Heroes.Core.Heros.ArtifactLevelEnum.Major;
                armyLevels = new int[] { 5, 6 };
            }
            else if (btn.Equals(cmdDragonUtopia))
            {
                qtyIndex = 2;
                tombIndex = 3;
                artifactLevel = Heroes.Core.Heros.ArtifactLevelEnum.Relic;
                armyLevels = new int[] { 7 };
            }
            else
                return;

            int count = _artifactVisitCounts[tombIndex];
            count += 1;

            this._currentHero._movementPointLeft -= 1;

            Heroes.Core.Monster monster = CreateMonster(armyLevels, qtyIndex, count);

            if (chkQuickCombat.Checked)
            {
                Heroes.Core.Battle.Quick.BattleCommander quickBattle = new Heroes.Core.Battle.Quick.BattleCommander(this._currentPlayer, this._currentHero,
                    null, null, monster, true);
                Heroes.Core.Battle.BattleSideEnum victory = quickBattle.Start();

                if (!ShowBattleResult(victory, this._currentPlayer._id,
                    quickBattle._attackHero, quickBattle._defendHero, quickBattle._monster)) return;
            }
            else
            {
                StartingBattleEventArg e2 = new StartingBattleEventArg(this._currentHero, null, monster);
                OnStartingBattle(e2);

                if (!e2._success) return;
            }

            _artifactVisitCounts[tombIndex] = count;

            GettingArtifactEventArg e3 = new GettingArtifactEventArg(artifactLevel);
            OnGettingArtifact(e3);

            if (e3._artifact != null)
            {
                MessageBox.Show(string.Format("You get {0}.", e3._artifact._name));

                this._currentHero.AddArtifacts(e3._artifact);
                this._currentHero.CalculateAll();
            }
        }