private static bool Prefix(ref TournamentGame __result, Town town) { float gameBasicMeleeChance = 65f; float rdm = MBRandom.RandomFloatRanged(1f, 100f); try { if (rdm < gameBasicMeleeChance) { __result = new FightTournamentGame(town); return(false); } else { var newgame = new Fight2TournamentGame(town); //rdm = MBRandom.RandomFloatRanged(1f, 100f); //if (rdm < 50f) //{ // newgame.SetFightMode(Fight2TournamentGame.FightMode.One_One); //} __result = newgame; return(false); } } catch (Exception ex) { ErrorLog.Log("Error Creating Tournament\n" + ex.ToStringFull()); } return(true); }
private static void OnSelectTournamentStyle(List <InquiryElement> selectedTypes) { if (selectedTypes.Count > 0) { var town = Settlement.CurrentSettlement.Town; TournamentManager tournamentManager = Campaign.Current.TournamentManager as TournamentManager; TournamentGame tournamentGame; TournamentGame currentGame = tournamentManager.GetTournamentGame(town); switch (selectedTypes.First().Identifier.ToString()) { case "melee": tournamentGame = new FightTournamentGame(town); TournamentPrizePoolBehavior.TournamentReward = new TournamentReward(tournamentGame); break; case "melee2": tournamentGame = new Fight2TournamentGame(town); TournamentPrizePoolBehavior.TournamentReward = new TournamentReward(tournamentGame); break; //case "melee3": // tournamentGame = new BattleRoyalTournamentGame(town); // TournamentPrizePoolBehavior.TournamentReward = new TournamentReward(tournamentGame); // break; case "archery": tournamentGame = new ArcheryTournamentGame(town); break; case "joust": tournamentGame = new JoustingTournamentGame(town); break; case "race": tournamentGame = new HorseRaceTournamentGame(town); break; default: tournamentGame = new FightTournamentGame(town); break; } if (tournamentGame.GetType() != currentGame.GetType()) { ((List <TournamentGame>)Traverse.Create(tournamentManager).Field("_activeTournaments").GetValue()).Remove(currentGame); tournamentManager.AddTournament(tournamentGame); } try { GameMenu.SwitchToMenu("town_arena"); } catch (Exception ex) { ErrorLog.Log("ERROR: BMTournamentXP: Refreshing Arena Screen:"); ErrorLog.Log(ex.ToStringFull()); } } }
private static bool Prefix(ref TournamentGame __result, Town town) { float gameBasicMeleeChance = 65f; float rdm = MBRandom.RandomFloatRanged(1f, 100f); if (rdm < gameBasicMeleeChance) { __result = new FightTournamentGame(town); } else { var newgame = new Fight2TournamentGame(town); //rdm = MBRandom.RandomFloatRanged(1f, 100f); //if (rdm < 50f) //{ // newgame.SetFightMode(Fight2TournamentGame.FightMode.One_One); //} __result = newgame; } return(false); }