コード例 #1
0
ファイル: Fight.cs プロジェクト: Dieho/Hero
        public string Kick(ILive first, ILive second, IBattleSkill skill = null)
        {
            var batleRandom = new BatleCalculates();
            string result = "";
            if (first.HPCurent > 0 && second.HPCurent > 0)
            {
                bool chance = batleRandom.ChanceToHit(first);
                if (!chance)
                {
                    result = "You MISS!";
                }
                else
                {
                    if (skill == null)
                        second.HPCurent = second.HPCurent - batleRandom.Damage(first) / second.DefCurent;
                    else
                    {
                        first.skillInUse.Add(skill as Skill);
                        second.HPCurent = second.HPCurent - skill.Smash(first, second) / second.DefCurent;
                    }

                }
                if (first.HPCurent > 0 && second.HPCurent > 0)
                {
                    chance = batleRandom.ChanceToHit(second);

                    if (!chance)
                        result += "He MISS!Ha-Ha";
                    else
                    {
                        first.HPCurent = first.HPCurent - batleRandom.Damage(second) / first.DefCurent;
                    }
                }
                GoEffect(first, second);
            }

            if (first.HPCurent <= 0)
            {
                first.HPCurent = 0;
                result += "You are dead!:(";
                batleRandom.Experience(second, first);
            }
            if (second.HPCurent <= 0)
            {
                second.HPCurent = 0;
                result += "He is dead!:)";
                batleRandom.Experience(first, second);
            }

            return result;
        }
コード例 #2
0
ファイル: Fight.cs プロジェクト: wizard1991/HeroGame
        public string Kick(ILive first, ILive second)
        {
            BatleCalculates batleRandom = new BatleCalculates();
            string result = "";
            if (first.HPCurent > 0 && second.HPCurent > 0)
            {
                bool chance = batleRandom.ChanceToHit(first);
                if (!chance)
                {
                    result = "You MISS!";
                }
                else
                {
                    second.HPCurent = second.HPCurent - batleRandom.Damage(first) / second.DefCurent;
                }
                if (first.HPCurent > 0 && second.HPCurent > 0)
                {
                    chance = batleRandom.ChanceToHit(second);

                    if (!chance)
                        result += "He MISS!Ha-Ha";
                    else
                    {
                        first.HPCurent = first.HPCurent - batleRandom.Damage(second) / first.DefCurent;
                    }
                }
            }

            if (first.HPCurent <= 0)
            {
                first.HPCurent = 0;
                result += "You are dead!:(";
                batleRandom.Experience(second, first);
            }
            if (second.HPCurent <= 0)
            {
                second.HPCurent = 0;
                result += "He is dead!:)";
                batleRandom.Experience( first,second);
            }

            return result;
        }
コード例 #3
0
ファイル: StartForm.cs プロジェクト: Dieho/Hero
        private void button9_Click(object sender, EventArgs e)
        {
            foreach (Skill i in _hero1.battleSkills)
            {
                if (i.Name == "BleedingSting")
                {
                    var f = new Fight();
                    string result = f.Kick(_hero1, _hero2, i as IBattleSkill);
                    richTextBox1.Text = richTextBox1.Text + _hero1.Name + " - " + _hero1.HPCurent.ToString() + " - " +
                                        _hero2.Name + " " + _hero2.HPCurent.ToString() + "\n" + result + " \n";
                    if (_hero1.HPCurent == 0)
                    {
                        _hero1 = null;

                        button1.Enabled = false;
                        button8.Enabled = false;
                    }
                    if (_hero2.HPCurent == 0)
                    {
                        _hero2 = null;
                        var asd = new BatleCalculates();
                        asd.LvlUp(_hero1);
                        button1.Enabled = false;
                    }

                    button9.Enabled = false;
                }
                else
                {
                    MessageBox.Show("You have not this skill!");
                }
            }
        }
コード例 #4
0
ファイル: StartForm.cs プロジェクト: Dieho/Hero
        private void Button1Click(object sender, EventArgs e)
        {
            var f = new Fight();
            string result = f.Kick(_hero1, _hero2);
            richTextBox1.Text = richTextBox1.Text + _hero1.Name + " - " + _hero1.HPCurent.ToString() + " - " + _hero2.Name + " " + _hero2.HPCurent.ToString() + "\n" + result + " \n";
            if (_hero1.HPCurent == 0)
            {
                _hero1 = null;

                button1.Enabled = false;
                button8.Enabled = false;
            }
            if (_hero2.HPCurent == 0)
            {
                _hero2 = null;
                var asd = new BatleCalculates();
                asd.LvlUp(_hero1);
                button1.Enabled = false;
            }
            if (_hero1 != null)
            {
                if (_hero1.skillInUse.Count == 0)
                {
                    button9.Enabled = true;
                }
                else
                {
                    foreach (var i in _hero1.skillInUse)
                    {
                        if (i.Name == "BleedingSting")
                        {
                            if (i.IsCooled)
                                button9.Enabled = true;
                        }
                    }
                }
            }
        }