Exemplo n.º 1
0
        internal async Task HandleBattle(Dictionary <string, string> args)
        {
            if (args.ContainsKey("user"))
            {
                var b = await BattleHandler.BeginBattle(args["user"], this, args["trainer"]);

                if (b == null)
                {
                    return;
                }
                ActiveBattle   = b;
                ActiveBattleId = b.Id;
                return;
            }
            if (ActiveBattle == null)
            {
                ActiveBattle = BattleHandler.GetBattle(this);
            }
            if (ActiveBattle == null)
            {
                Logger.Logger.Log($"Can't find battle for user: {Username}");
                await SendMessage("<TRA dead>");

                return;
            }
            if (args.ContainsKey("seed"))
            {
                await ActiveBattle.GetRandomSeed(this, args["turn"]);
            }
            else if (args.ContainsKey("choices"))
            {
                await ActiveBattle.SendChoice(Username, args["choices"], args["m"], args["rseed"]);
            }
            else if (args.ContainsKey("new"))
            {
                await ActiveBattle.NewPokemon(Username, args["new"]);
            }
            else if (args.ContainsKey("damage"))
            {
                await ActiveBattle.Damage(Username, args["damage"], args["state"]);
            }
        }