コード例 #1
0
ファイル: Move.cs プロジェクト: Snaquaza/Pokemon
    // Flags
    // Pass target and user always - Allows a lot
    // Delegate Function

    private void Start()
    {
        // Make this look for file instead;
        if (!GetBasePower)
        {
            GetBasePower = (BasePower)Instantiate(Resources.Load("StandardBasePower"));
        }
        if (!GetSTAB)
        {
            GetBasePower = (BasePower)Instantiate(Resources.Load("StandardSTAB"));
        }
        if (!GetEffectiveness)
        {
            GetBasePower = (BasePower)Instantiate(Resources.Load("StandardEffectiveness"));
        }
        if (!GetCategory)
        {
            GetBasePower = (BasePower)Instantiate(Resources.Load("StandardCategory"));
        }
        if (!GetAccuracy)
        {
            GetBasePower = (BasePower)Instantiate(Resources.Load("StandardAccuracy"));
        }
        if (!GetPriority)
        {
            GetBasePower = (BasePower)Instantiate(Resources.Load("StandardPriority"));
        }
        if (!GetEffect)
        {
            GetBasePower = (BasePower)Instantiate(Resources.Load("StandardEffect"));
        }
    }
コード例 #2
0
ファイル: Mybot.cs プロジェクト: SirTman/Discord_Bot_WV
        //Roll ATK *NEW*
        private void RefisterFighterattack()
        {
            commands.CreateCommand("ATK")
            .Description("User [Base Power] Mod[Added Together]")
            .Parameter("User", ParameterType.Required)
            .Parameter("Basepower", ParameterType.Required)
            .Parameter("Mod", ParameterType.Optional)
            .Do(async(e) =>
            {
                Random rnd = new Random((int)DateTime.Now.Ticks);
                float BasePower;
                float Mod;
                if (Single.TryParse(e.GetArg("Basepower"), out BasePower))
                {
                    //mod hanndler
                    if (e.GetArg("Mod") != null)
                    {
                        if (Single.TryParse(e.GetArg("Mod"), out Mod))
                        {
                            BasePower *= Mod;
                        }
                        else
                        {
                        }
                    }
                    //Critical hit & Message exicution
                    int ChanceOfCrit = rnd.Next(11);
                    if (ChanceOfCrit == 10)
                    {
                        int crit = rnd.Next(2, 7);

                        string Crittype = "";
                        //2=Nice, 3=Good, 4=Perfect
                        if (crit == 2)
                        {
                            BasePower *= 1.25f;
                            Crittype   = "Nice";
                        }
                        else if (crit == 3)
                        {
                            BasePower *= 1.5f;
                            Crittype   = "Good";
                        }
                        else if (crit == 4)
                        {
                            BasePower *= 1.5f;
                            Crittype   = "Excelent";
                        }
                        else if (crit == 5)
                        {
                            BasePower *= 1.75f;
                            Crittype   = "Perfect";
                        }
                        else if (crit == 6)
                        {
                            BasePower *= 2f;
                            Crittype   = "Row Row Fight the power";
                        }
                        await e.Channel.SendMessage("```" + "Critical Hit " + Crittype + "```");
                    }
                    string DMG = BasePower.ToString();
                    await e.Channel.SendMessage("```" + e.GetArg("User") + " dealt " + DMG + "```");
                }
                //Failed
                else
                {
                    await e.Channel.SendMessage("```" + e.GetArg("Basepower") + " Isn't vaild```");
                }
            });
        }