コード例 #1
0
        static void Main(string[] args)
        {
            Parser.Default.ParseArguments <Options>(args)
            .WithParsed(o =>
            {
                if (o.ListBots)
                {
                    var bots = GetInstances <IBot>();
                    foreach (var bot in bots)
                    {
                        Console.WriteLine(bot.ToString().Split('.').Last());
                    }
                    return;
                }

                if (o.ListMaps)
                {
                    var maps = GetInstances <Map>();
                    foreach (var map in maps)
                    {
                        Console.WriteLine(map.Name);
                    }
                    return;
                }

                var startProcess = new FileInfo(o.StartProcess);
                if (startProcess.Exists)
                {
                    var botProcess = new BotProcess(startProcess, o.Arguments)
                    {
                        Name = "UserBot"
                    };
                    var enemyBot = GetEnemy(o.EnemyBot);
                    var map      = GetMap(o.MapName);

                    var arenaMaster = new ArenaMaster(botProcess, enemyBot, map);
                    Console.WriteLine("Starting Battle");
                    try
                    {
                        var battleResult = arenaMaster.GetBattleResults();
                        var file         = SaveBattleToDisk(battleResult, o.OutputFolder, o.EnemyBot);

                        if (o.showresults)
                        {
                            DisplayBattle(new string[] { file });
                        }
                    }
                    catch (Exception err)
                    {
                        Console.WriteLine(err);
                    }
                }
                else
                {
                    throw new ArgumentException($"Not possible to locate file: {startProcess.FullName}");
                }
            });
        }
コード例 #2
0
        public override int GetAttackIndex()
        {
            int index = ArenaMaster.GetInstance().GetMonsterList().FindIndex(m => m.type == "Orc");

            if (index >= 0)
            {
                return(index);
            }
            else
            {
                return(base.GetAttackIndex());
            }
        }
コード例 #3
0
        private bool game_menu_enter_practice_fight_on_condition(MenuCallbackArgs args)
        {
            Settlement currentSettlement = Settlement.CurrentSettlement;

            ArenaMaster am = (ArenaMaster)Campaign.Current.GetCampaignBehavior <ArenaMaster>();
            FieldInfo   knowTournaments = typeof(ArenaMaster).GetField("_knowTournaments", BindingFlags.NonPublic | BindingFlags.Instance);

            args.optionLeaveType = GameMenuOption.LeaveType.HostileAction;
            if (!(bool)knowTournaments.GetValue(am) || knowTournaments.GetValue(am) == null)
            {
                args.Tooltip   = new TextObject("{=Sph9Nliz}You need to learn more about the arena by talking with the arena master.", (Dictionary <string, TextObject>)null);
                args.IsEnabled = false;
                return(true);
            }
            if (Hero.MainHero.IsWounded && Campaign.Current.IsMainHeroDisguised)
            {
                args.Tooltip   = new TextObject("{=DqZtRBXR}You are wounded and in disguise.", (Dictionary <string, TextObject>)null);
                args.IsEnabled = false;
                return(true);
            }
            if (Hero.MainHero.IsWounded)
            {
                args.Tooltip   = new TextObject("{=yNMrF2QF}You are wounded", (Dictionary <string, TextObject>)null);
                args.IsEnabled = false;
                return(true);
            }
            if (Campaign.Current.IsMainHeroDisguised)
            {
                args.Tooltip   = new TextObject("{=jcEoUPCB}You are in disguise.", (Dictionary <string, TextObject>)null);
                args.IsEnabled = false;
                return(true);
            }
            if (!currentSettlement.HasTournament)
            {
                return(true);
            }
            args.Tooltip   = new TextObject("{=NESB0CVc}There is no practice fight because of the Tournament.", (Dictionary <string, TextObject>)null);
            args.IsEnabled = false;
            return(true);
        }
コード例 #4
0
 private static bool Prefix(ArenaMaster __instance, CampaignGameStarter campaignGameStarter)
 {
     campaignGameStarter.AddDialogLine("mwax_arena_entered_from_menu", "start", "mwax_arena_weapons_list", "{=mwax_arena_2}Alright, which weapon are you taking?", new ConversationSentence.OnConditionDelegate(MWAXArenaMasterDialoguePatch.MWAX_conversation_choose_weapon_condition), (ConversationSentence.OnConsequenceDelegate)null, 100, (ConversationSentence.OnClickableConditionDelegate)null);
     return(true);
 }