Ejemplo n.º 1
0
        public async Task Skill(string skillName, IUser user)
        {
            DBUser  dbUser = DBFuncs.FindDBUser(Context.User);
            DBUser  target = DBFuncs.FindDBUser(user);
            DBSkill skill  = DBFuncs.GetSkill(skillName);

            if (target.Location == Context.Channel.Id)
            {
                if (DBFuncs.HasSkill(skill, Context.User))
                {
                    if (dbUser.Energy >= skill.EnergyCost && !dbUser.Charging)
                    {
                        int power = skill.Power * Convert.ToInt32(DBFuncs.GetAttribute("POWER_LVL", Context.User));
                        await Context.Channel.SendMessageAsync($"{Context.User.Username} uses {skill.Name} on {user.Username} with a power of {power}");

                        dbUser.Charging = true;
                        Timer timer = new Timer(await target.Hurt(Context.Channel, power), null, skill.Charge * 1000, Timeout.Infinite);
                    }
                }
                else
                {
                    await Context.Channel.SendMessageAsync("You do not have this skill!");
                }
            }
            else
            {
                await Context.Channel.SendMessageAsync("That person is not here.");
            }
        }
Ejemplo n.º 2
0
        public async void UseSkill(DBSkill skill, DBUser user)
        {
            int power = skill.Power * Power_Level;
            await Place.SendMessageAsync($"{Name} uses {skill.Name} on {user.User.Username} with a power of {power}");

            Target.Charging = true;
            Timer timer = new Timer(await user.Hurt(Place, power), null, skill.Charge * 1000, Timeout.Infinite);
        }
Ejemplo n.º 3
0
 public static bool HasSkill(DBSkill skill, IUser user)
 {
     foreach (string skillOption in GetPlayerSkillList(user))
     {
         if (skill.Name == GetSkill(skillOption).Name)
         {
             return(true);
         }
     }
     return(false);
 }
Ejemplo n.º 4
0
 public static void GiveSkill(DBSkill skill, IUser user)
 {
     File.AppendAllText($@"Players\{user.Id}.txt", $"{skill.Name}");
 }
Ejemplo n.º 5
0
        public static bool HasSkill(string skillName, IUser user)
        {
            DBSkill skill = GetSkill(skillName);

            return(HasSkill(skill, user));
        }
Ejemplo n.º 6
0
        public async Task Power(string direction, int amount)
        {
            if (direction == "up")
            {
                string race  = DBFuncs.GetAttribute("RACE", Context.User);
                IGuild guild = Bot.client.GetGuild(Constants.Guilds.DBZ_EARTH);
                var    user  = await guild.GetUserAsync(Context.User.Id);

                ulong[] role = new ulong[3];

                for (int i = 0; i < amount; i++)
                {
                    if ((user.RoleIds.Contains(Constants.Roles.KAIOKEN[0]) || role == Constants.Roles.KAIOKEN) && DBFuncs.HasSkill("Super Saiyan", Context.User))
                    {
                        await Power("down");

                        role = Constants.Roles.SUPER;
                    }
                    else if ((user.RoleIds.Contains(Constants.Roles.SUPER[0]) || role == Constants.Roles.SUPER) && DBFuncs.HasSkill("SSGSS", Context.User))
                    {
                        await Power("down");

                        role = Constants.Roles.SSGSS;
                    }
                    else if (DBFuncs.HasSkill("Kaioken", Context.User) && !user.RoleIds.Contains(Constants.Roles.SSGSS[0]))
                    {
                        role = Constants.Roles.KAIOKEN;
                    }
                }

                if (role[0] != 0)
                {
                    Funcs.GiveRole(role, Context.User);
                    DBSkill skill = DBFuncs.GetSkill(guild.GetRole(role[0]).Name);
                    DBFuncs.SetAttribute("MULTIPLIER", Context.User, Convert.ToString(skill.Power));
                }
                else
                {
                    await Context.Channel.SendMessageAsync("You attempt to power up further, but fail.");
                }
            }
            else if (direction == "down")
            {
                var guilds = Constants.Guilds.PLANETS;
                for (int i = 0; i < 3; i++)
                {
                    var guildID = guilds.ElementAt(i);
                    var guild   = Bot.client.GetGuild(guildID);
                    if (await Funcs.InGuild(guild, Context.User))
                    {
                        var user = guild.GetUser(Context.User.Id);
                        if (user.Roles.Contains(guild.GetRole(Constants.Roles.KAIOKEN[i])))
                        {
                            await user.RemoveRoleAsync(guild.GetRole(Constants.Roles.KAIOKEN[i]));
                        }
                        else if (user.Roles.Contains(guild.GetRole(Constants.Roles.SUPER[i])))
                        {
                            await user.RemoveRoleAsync(guild.GetRole(Constants.Roles.SUPER[i]));
                        }
                        else if (user.Roles.Contains(guild.GetRole(Constants.Roles.SSGSS[i])))
                        {
                            await user.RemoveRoleAsync(guild.GetRole(Constants.Roles.SSGSS[i]));
                        }
                    }
                    DBFuncs.SetAttribute("FORM", Context.User, "1");
                }
                DBFuncs.SetAttribute("MULTIPLIER", Context.User, "1");
            }
        }