コード例 #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;
        }