Пример #1
0
        public static AttackResult SlashAttack(ShardedCommandContext context)
        {
            var config  = GlobalUserAccounts.GetUserAccount(context.User);
            var player2 = context.Guild.GetUser(config.OpponentId);
            var choms   = ActiveChomusuke.GetActiveChomusuke(config.Id, config.OpponentId);
            var chom1   = choms.Item1;
            var chom2   = choms.Item2;

            string response;
            var    dmg      = (int)Math.Round(Attack.Damage * chom1.CP * .05);
            var    accuracy = Global.Rng.Next(1, Attack.Accuracy + 1);

            if (accuracy > 1)
            {
                var result = CheckModifiers.GetDMGModifiers(context.User, player2, dmg);
                dmg = result.Item1;
                var modifier = result.Item2;

                var block   = CheckModifiers.CheckForBlock(context.User, player2, dmg);
                var deflect = CheckModifiers.CheckForDeflect(context.User, player2, dmg);
                if (block.Item1)
                {
                    chom2.Health -= (uint)block.Item3;
                    GlobalUserAccounts.SaveAccounts(config.Id);
                    response =
                        $":dagger:  | **{context.User.Username}**, You hit and did **{dmg}** damage (buffed by {modifier}% due to active damage modifiers), but **{block.Item2}** damage was blocked!\n\n{Helpers.GetHpLeft(chom1, chom2)}";
                    dmg = block.Item3;
                }
                else if (deflect.Item1)
                {
                    chom2.Health -= (uint)deflect.Item2;
                    chom1.Health -= (uint)deflect.Item2;
                    GlobalUserAccounts.SaveAccounts(config.Id);
                    response =
                        $":dagger:  | **{context.User.Username}**, You hit and did **{dmg}** damage (buffed by {modifier}% due to active damage modifiers), but **{deflect.Item2}** damage was deflected back!\n\n{Helpers.GetHpLeft(chom1, chom2)}";
                    dmg = deflect.Item2;
                }
                else
                {
                    chom2.Health -= (uint)dmg;
                    GlobalUserAccounts.SaveAccounts(config.Id);
                    response =
                        $":dagger:  | **{context.User.Username}**, You hit and did **{dmg}** damage (buffed by {modifier}% due to active damage modifiers)!\n\n**{chom1.Name}** has **{chom1.Health}** health left!\n{Helpers.GetHpLeft(chom1, chom2)}";
                }
            }
            else
            {
                response = $":dash:  **|** **{context.User.Username}**, your attack missed!";
            }

            return(new AttackResult {
                Success = true, Response = response, Damage = dmg
            });
        }
Пример #2
0
        public static AttackResult FireballAttack(ShardedCommandContext context)
        {
            var config  = GlobalUserAccounts.GetUserAccount(context.User);
            var player2 = context.Guild.GetUser(config.OpponentId);
            var configg = GlobalUserAccounts.GetUserAccount(player2);
            var choms   = ActiveChomusuke.GetActiveChomusuke(config.Id, config.OpponentId);
            var chom1   = choms.Item1;
            var chom2   = choms.Item2;

            var    accuracy = Global.Rng.Next(1, Attack.Accuracy + 1);
            string response;
            bool   success;
            var    dmg = (int)Math.Round(Attack.Damage * chom1.CP * .05);

            //use if something negates this

            /*if (configg.armour == "reinforced")
             * {
             *  GlobalUserAccounts.SaveAccounts();
             *  response = $":fire: **|** **{configg.OpponentName}** used **Fireball** but {config.OpponentName}** has reinforced armour. Therefore it had no effect.";
             *  success = true;
             *  return new AttackResult{Success = success, Response = response, Damage = 0};
             * }*/
            if (accuracy > 1)
            {
                var result = CheckModifiers.GetDMGModifiers(context.User, player2, dmg);
                dmg = result.Item1;
                var modifier = result.Item2;
                chom2.Health -= (uint)dmg;
                chom2.Effects.Add(Effect.Burned);

                GlobalUserAccounts.SaveAccounts(config.Id);
                response =
                    $":fire:  | **{configg.OpponentName}** used **Fireball** and did {dmg} damage (buffed by {modifier}% due to active damage modifiers)!\n\n**{config.OpponentName}** is now burning";
                success = true;
                return(new AttackResult {
                    Success = success, Response = response, Damage = dmg
                });
            }
            else
            {
                dmg = 0;
                var result = CheckModifiers.GetDMGModifiers(context.User, player2, dmg);
                response = $":dash:  **|** **{context.User.Username}**, your attack missed!";
                success  = true;
                return(new AttackResult {
                    Success = success, Response = response, Damage = dmg
                });
            }
        }
Пример #3
0
        public static AttackResult BashAttack(ShardedCommandContext context)
        {
            var config  = GlobalUserAccounts.GetUserAccount(context.User);
            var player2 = context.Guild.GetUser(config.OpponentId);
            var choms   = ActiveChomusuke.GetActiveChomusuke(config.Id, config.OpponentId);
            var chom1   = choms.Item1;
            var chom2   = choms.Item2;

            string response;
            bool   success  = false;
            var    dmg      = (int)Math.Round(Attack.Damage * chom1.CP * .05);
            var    stunProb = Global.Rng.Next(1, 3);

            chom1.Mana -= Attack.Mana;

            var result = CheckModifiers.GetDMGModifiers(context.User, player2, dmg);

            dmg = result.Item1;
            int modifier = result.Item2;

            var block = CheckModifiers.CheckForBlock(context.User, player2, dmg);

            if (block.Item1)
            {
                chom2.Health -= (uint)block.Item3;
                GlobalUserAccounts.SaveAccounts(config.Id);
                response =
                    $"**{context.User.Username}**, You bashed **{chom2.Name}** and did **{dmg}** damage (buffed by {modifier}% due to active damage modifiers), but **{block.Item2}** damage was blocked!\n\n{Helpers.GetHpLeft(chom1, chom2)}";
                dmg = block.Item3;
                return(new AttackResult {
                    Success = success, Response = response, Damage = dmg
                });
            }

            var deflect = CheckModifiers.CheckForDeflect(context.User, player2, dmg);

            if (deflect.Item1)
            {
                chom2.Health -= (uint)deflect.Item2;
                chom1.Health -= (uint)deflect.Item2;
                GlobalUserAccounts.SaveAccounts(config.Id);
                response =
                    $"**{context.User.Username}**, You bashed **{chom2.Name}** and did **{dmg}** damage (buffed by {modifier}% due to active damage modifiers), but **{deflect.Item2}** damage was deflected back!\n\n{Helpers.GetHpLeft(chom1, chom2)}";
                dmg = deflect.Item2;
                return(new AttackResult {
                    Success = success, Response = response, Damage = dmg
                });
            }

            if (stunProb == 1)
            {
                response =
                    $"**{context.User.Username}**, You bashed **{chom2.Name}** and did **{dmg}** damage (buffed by {modifier}% due to active damage modifiers)!**{chom2.Name}** is now stunned!\n\n{Helpers.GetHpLeft(chom1, chom2)}";
                foreach (Effect effect in Attack.Effects)
                {
                    chom2.Effects.Add(effect);
                }
            }

            chom2.Health -= (uint)dmg;
            GlobalUserAccounts.SaveAccounts(context.User.Id, player2.Id);

            response =
                $"**{context.User.Username}**, You bashed **{chom2.Name}** and did **{dmg}** damage (buffed by {modifier}% due to active damage modifiers)!\n\n{Helpers.GetHpLeft(chom1, chom2)}";
            success = true;

            return(new AttackResult {
                Success = success, Response = response, Damage = dmg
            });
        }
Пример #4
0
        public static AttackResult AbsorbAttack(ShardedCommandContext context)
        {
            var config  = GlobalUserAccounts.GetUserAccount(context.User);
            var player2 = context.Guild.GetUser(config.OpponentId);
            var choms   = ActiveChomusuke.GetActiveChomusuke(config.Id, config.OpponentId);
            var chom1   = choms.Item1;
            var chom2   = choms.Item2;

            string response;
            bool   success;
            int    hit = Global.Rng.Next(1, Attack.Accuracy + 1);

            if (hit == 1)
            {
                //use if something negates this

                /*if (configg.armour == "reinforced")
                 * {
                 *  GlobalUserAccounts.SaveAccounts();
                 *  response =
                 *      $":fire: **|** **{configg.OpponentName}** used **Absorb** but {config.OpponentName}** has reinforced armour. Therefore it had no effect.";
                 *  success = true;
                 *  return new AttackResult{Success = success, Response = response, Damage = 0};
                 * }*/

                var dmg = (int)Math.Round(Attack.Damage * chom1.CP * .05);

                var result = CheckModifiers.GetDMGModifiers(context.User, player2, dmg);
                dmg = result.Item1;
                var modifier = result.Item2;

                var block = CheckModifiers.CheckForBlock(context.User, player2, dmg);
                if (block.Item1 == true)
                {
                    chom2.Health -= (uint)block.Item3;
                    GlobalUserAccounts.SaveAccounts(config.Id);
                    response =
                        $":comet:  | **{context.User.Username}**,You absorbed **{dmg}** health and did **{dmg}** damage (buffed by {modifier}% due to active damage modifiers), but **{block.Item2}** damage was blocked!\n\n{Helpers.GetHpLeft(chom1, chom2)}";
                    dmg     = block.Item3;
                    success = true;
                    return(new AttackResult {
                        Success = success, Response = response, Damage = dmg
                    });
                }

                var deflect = CheckModifiers.CheckForDeflect(context.User, player2, dmg);
                if (deflect.Item1 == true)
                {
                    chom2.Health -= (uint)deflect.Item2;
                    chom1.Health -= (uint)deflect.Item2;
                    GlobalUserAccounts.SaveAccounts(config.Id);
                    response =
                        $":comet:  | **{context.User.Username}**, You absorbed **{dmg}** health and did **{dmg}** damage (buffed by {modifier}% due to active damage modifiers), but **{deflect.Item2}** damage was deflected back!\n\n{Helpers.GetHpLeft(chom1, chom2)}";
                    dmg     = deflect.Item2;
                    success = true;
                    return(new AttackResult {
                        Success = success, Response = response, Damage = dmg
                    });
                }

                chom2.Health -= (uint)dmg;
                GlobalUserAccounts.SaveAccounts(config.Id);

                response =
                    $":comet:  | **{context.User.Username}**, You absorbed **{dmg}** health and did **{dmg}** damage (buffed by {modifier}% due to active damage modifiers)!\n\n{Helpers.GetHpLeft(chom1, chom2)}";
                success = true;
                return(new AttackResult {
                    Success = success, Response = response, Damage = dmg
                });
            }
            else
            {
                int dmg    = 0;
                var result = CheckModifiers.GetDMGModifiers(context.User, player2, dmg); //resets 1 turn buffs
                response = $":dash:  **|** **{context.User.Username}**, your attack missed!";
                success  = true;
                return(new AttackResult {
                    Success = success, Response = response, Damage = dmg
                });
            }
        }