protected WeatherProfile GetProfileForToday() { int currentDay = Tempest.GetCurrentSeasonDay(); foreach (WeatherProfile profile in mProfiles) { profile.CalculateLength(mSeason); } mProfiles.Sort(WeatherProfile.ReverseSortByLength); foreach (WeatherProfile profile in mProfiles) { if (!profile.mEnabled) { continue; } if (currentDay < profile.GetActualStart(mSeason)) { continue; } if (currentDay > profile.GetActualEnd(mSeason)) { continue; } return(profile); } return(mProfiles[0]); }
void MainWindow_Loaded(object sender, RoutedEventArgs e) { // create the IO object that we represent tempestSoundIO = new TDNWin32TempestSoundIO(); // create our tempest, connected to the IO object tempest = new Tempest(tempestSoundIO); // see if we're in Demo mode if (Environment.CommandLine.ToLower().IndexOf(" demo ") >= 0) { tempest.SetDemoMode(); } // set it to running startTime = DateTime.Now; tempest.Start(); timer = new DispatcherTimer(); timer.Interval = TimeSpan.FromMilliseconds(200); timer.IsEnabled = true; timer.Tick += timer_Tick; vectorTimer = new DispatcherTimer(); vectorTimer.Interval = TimeSpan.FromMilliseconds(50); vectorTimer.IsEnabled = true; vectorTimer.Tick += vectorTimer_Tick; spinnerTimer = new DispatcherTimer(); spinnerTimer.Interval = TimeSpan.FromMilliseconds(10); spinnerTimer.IsEnabled = true; spinnerTimer.Tick += spinnerTimer_Tick; }
protected override OptionResult Run(GameHitParameters <GameObject> parameters) { Dictionary <string, bool> lookup = new Dictionary <string, bool>(); List <Item> profiles = new List <Item>(); foreach (WeatherSettings settings in Tempest.Settings.Weather) { foreach (WeatherProfile profile in settings.Profiles) { string name = Common.LocalizeEAString("Ui/Caption/Options:" + settings.Season) + ": " + profile.Name; if (lookup.ContainsKey(name)) { continue; } lookup.Add(name, true); profiles.Add(new Item(name, profile)); } } Item choice = new CommonSelection <Item>(Name, profiles).SelectSingle(); if (choice == null) { return(OptionResult.Failure); } Tempest.Settings.GetWeather(mSeason).AddProfile(choice.Value); Tempest.ReapplySettings(); return(OptionResult.SuccessRetain); }
void MainWindow_Closed(object sender, EventArgs e) { if (tempest != null) { tempest.Dispose(); tempest = null; } }
// Start is called before the first frame update void Start() { timeToNextHazard = Random.Range(timeBetweenHazardMin, timeBetweenHazardMax); fire = new Fire(); tornado = new Tornado(); tempest = new Tempest(); }
void MainWindow_Loaded(object sender, RoutedEventArgs e) { try { // create the stream object that's going to be in the middle of everything tempestMemoryStream = new TDNMemoryStream(); // create the IO object that we represent tempestSoundIO = new TDNWin32TempestSoundIO(); // create the streamlistener that feeds it tempestIOStreamListener = new TDNTempestIOStreamListener(tempestMemoryStream.GetLeftSide(), tempestSoundIO); // create the IO proxy tempestIOStreamProxy = new TDNIOStreamProxy(tempestMemoryStream.GetRightSide()); // create our tempest tempest = new Tempest(tempestIOStreamProxy); // at this point here's what we have: // - tempest is writing to tempestIOStreamProxy, which is its output device // - tempestIOStreamProxy is writing to tempestMemoryStream // - tempestIOStreamListener is reading from tempestMemoryStream and writing // to tempestIO, which is the actual screen output device // // this is basically the identical scheme that we'll use to write to the real device // // set it to running startTime = DateTime.Now; tempest.Start(); timer = new DispatcherTimer(); timer.Interval = TimeSpan.FromMilliseconds(200); timer.IsEnabled = true; timer.Tick += timer_Tick; vectorTimer = new DispatcherTimer(); vectorTimer.Interval = TimeSpan.FromMilliseconds(50); vectorTimer.IsEnabled = true; vectorTimer.Tick += vectorTimer_Tick; spinnerTimer = new DispatcherTimer(); spinnerTimer.Interval = TimeSpan.FromMilliseconds(10); spinnerTimer.IsEnabled = true; spinnerTimer.Tick += spinnerTimer_Tick; } catch (Exception x) { MessageBox.Show(x.Message); Close(); } }
protected override OptionResult Run(GameHitParameters <GameObject> parameters) { if (!AcceptCancelDialog.Show(Common.Localize(GetTitlePrefix() + ":Prompt", false, new object[] { mProfile.Name }))) { return(OptionResult.Failure); } Tempest.Settings.GetWeather(mSeason).RemoveProfile(mProfile); Tempest.ReapplySettings(); return(OptionResult.SuccessLevelDown); }
private static void CalculateDateTimeOfHoliday(HolidayManager ths, ref Season season) { DateAndTime startTime = SimClock.Subtract(SimClock.CurrentTime(), TimeUnit.Hours, SimClock.CurrentTime().Hour); startTime = SimClock.Subtract(startTime, TimeUnit.Days, Tempest.GetCurrentSeasonDay() - 1); List <Pair <Season, uint> > days = new List <Pair <Season, uint> >(); HolidaySettings settings = Tempest.Settings.GetHolidays(season); Common.StringBuilder result = new Common.StringBuilder("Season: " + season); result += Common.NewLine + "CurrentTime: " + SimClock.CurrentTime(); result += Common.NewLine + "StartTime: " + startTime; result += Common.NewLine + "ExpectedEndTime: " + SeasonsManager.ExpectedEndTime; result += Common.NewLine + "GetCurrentSeasonDay: " + Tempest.GetCurrentSeasonDay(); result += Common.NewLine + SimClock.ElapsedTime(TimeUnit.Days, startTime); foreach (HolidaySettings.Holiday day in settings.Days) { uint actualDay = day.GetActualDay(season); if (actualDay == 0) { continue; } days.Add(new Pair <Season, uint>(day.mSeason, actualDay - 1)); } days.Sort(SortByDay); foreach (Pair <Season, uint> day in days) { ths.mStartDateTimeOfHoliday = SimClock.Add(startTime, TimeUnit.Days, day.Second); result += Common.NewLine + "Days: " + day.Second + " Time: " + ths.mStartDateTimeOfHoliday; if (ths.mStartDateTimeOfHoliday.Ticks < SimClock.CurrentTicks) { ths.mStartDateTimeOfHoliday = DateAndTime.Invalid; } else { result += Common.NewLine + " Success"; season = day.First; break; } } Common.DebugNotify(result); }
void MainWindow_Closed(object sender, EventArgs e) { // stop the stream listener if (tempestIOStreamListener != null) { tempestIOStreamListener.Dispose(); tempestIOStreamListener = null; } if (tempest != null) { tempest.Dispose(); tempest = null; } }
public void Import(Persistence.Lookup settings) { mHolidaySettings.Clear(); foreach (HolidaySettings setting in settings.GetList <HolidaySettings>("Holidays")) { mHolidaySettings[setting.Season] = setting; } mWeatherSettings.Clear(); foreach (WeatherSettings setting in settings.GetList <WeatherSettings>("Weather")) { mWeatherSettings[setting.Season] = setting; } Tempest.ReapplySettings(); }
public void init(GameObject parentObject) { parent = parentObject.GetComponent <Tempest>(); }
public abstract void Init(Tempest tempest);
public override void Init(Tempest tempest) { tempest.OnUpdate += (object sender, EventArgs e) => { // Spawn some random items used to test your own items int tier = 0; if (Input.GetKeyDown(KeyCode.F1)) { tier = 1; } if (Input.GetKeyDown(KeyCode.F2)) { tier = 2; } if (Input.GetKeyDown(KeyCode.F3)) { tier = 3; } if (Input.GetKeyDown(KeyCode.F4)) { tier = 4; } if (Input.GetKeyDown(KeyCode.F5)) { tier = 5; } //if (Input.GetKeyDown(KeyCode.F5)) //{ // var transform = PlayerCharacterMasterController.instances[0].master.GetBodyObject().transform; // PickupDropletController.CreatePickupDroplet(PickupCatalog.FindPickupIndex(Items[0].ItemDef.itemIndex), transform.position, transform.forward * 20f); //} if (tier != 0) { List <PickupIndex> list = new List <PickupIndex>(); switch (tier) { case 1: list = Run.instance.availableTier1DropList; break; case 2: list = Run.instance.availableTier2DropList; break; case 3: list = Run.instance.availableTier3DropList; break; case 4: list = Run.instance.availableEquipmentDropList; break; case 5: list = Run.instance.availableLunarEquipmentDropList; break; } int index = UnityEngine.Random.Range(0, list.Count); Tempest.ModLogger.LogInfo($"index {index} cap {list.Count}"); var transform = PlayerCharacterMasterController.instances[0].master.GetBodyObject().transform; PickupDropletController.CreatePickupDroplet(list[index], transform.position, transform.forward * 20f); //PickupDropletController //var transform = PlayerCharacterMasterController.instances[0].master.GetBodyObject().transform; //ItemDropAPI.ChestItems.Tier1 //// Get a random item from all possible pickups //var items = PickupCatalog.allPickups; //int index = Random.Range(0, items.Count()); ////PickupDropletController.CreatePickupDroplet(PickupCatalog.FindPickupIndex(myItemDef.itemIndex), transform.position, transform.forward * 20f); //PickupDropletController.CreatePickupDroplet(items.ElementAt(index).pickupIndex, transform.position, transform.forward * 20f); } if (Input.GetKeyDown(KeyCode.F7)) { if (TeleporterInteraction.instance) { TeleporterInteraction.instance.AddShrineStack(); } //CharacterBody component = interactor.GetComponent<CharacterBody>(); Chat.AddMessage("ORDER"); } }; }
public List <Build> ProtossBuilds(Bot bot) { List <Build> options = new List <Build>(); if (Bot.Debug) { foreach (Strategy strategy in bot.EnemyStrategyAnalyzer.Strategies) { if (strategy.DetectedPreviously) { System.Console.WriteLine("Detected previous strategy: " + strategy.Name()); } } } if (bot.EnemyRace == Race.Terran) { if (Marine.Get().DetectedPreviously && !Reaper.Get().DetectedPreviously && !Marauder.Get().DetectedPreviously && !Cyclone.Get().DetectedPreviously && !Banshee.Get().DetectedPreviously && !SiegeTank.Get().DetectedPreviously && !Medivac.Get().DetectedPreviously && !Viking.Get().DetectedPreviously && !Raven.Get().DetectedPreviously && !Battlecruiser.Get().DetectedPreviously && !WidowMine.Get().DetectedPreviously && !Hellion.Get().DetectedPreviously && !Thor.Get().DetectedPreviously && !Liberator.Get().DetectedPreviously) { // ValinMarineBot options.Add(new NinjaTurtles()); return(options); } if (BattlecruiserRush.Get().DetectedPreviously && Thor.Get().DetectedPreviously && WidowMine.Get().DetectedPreviously) { // BenBotBC options.Add(new OneBaseStalkerImmortal()); return(options); } if (Battlecruiser.Get().DetectedPreviously && !BattlecruiserRush.Get().DetectedPreviously && !Marauder.Get().DetectedPreviously && !Banshee.Get().DetectedPreviously && !Reaper.Get().DetectedPreviously && !Cyclone.Get().DetectedPreviously && !Medivac.Get().DetectedPreviously && !Raven.Get().DetectedPreviously) { options.Add(new MassVoidray() { SkipDefenses = true }); return(options); } /* * if (ProxyDetected.Get().DetectedPreviously * && !Marauder.Get().DetectedPreviously * && Banshee.Get().DetectedPreviously) * { * options.Add(new AntiMicro()); * return options; * } */ if (ProxyDetected.Get().DetectedPreviously && Marauder.Get().DetectedPreviously && Banshee.Get().DetectedPreviously) { // MicroMachine options.Add(new AntiMicro() { HuntProxies = true, CounterProxyMarauder = false }); //options.Add(new NinjaTurtles() { Expand = true }); //options.Add(new OneBaseTempest() { DefendingStalker = true }); return(options); } if (ProxyDetected.Get().DetectedPreviously && !Banshee.Get().DetectedPreviously) { // Strelok //options.Add(new PvTStalkerImmortal() { BuildReaperWall = true, ProxyPylon = false, DelayObserver = true, SendScout = true, MassTanksDetected = MassTank.Get().DetectedPreviously }); options.Add(new OneBaseStalkerImmortal() { UseSentry = true }); options.Add(new OneBaseTempest()); return(options); } if (Marine.Get().DetectedPreviously && Medivac.Get().DetectedPreviously && Viking.Get().DetectedPreviously && Reaper.Get().DetectedPreviously && Raven.Get().DetectedPreviously && !Cyclone.Get().DetectedPreviously && !Marauder.Get().DetectedPreviously && !Banshee.Get().DetectedPreviously) { options.Add(new OneBaseStalkerImmortal()); //options.Add(new PvTStalkerImmortal() { BuildReaperWall = false, ProxyPylon = false, DelayObserver = true, SendScout = false, MassTanksDetected = true }); return(options); } if (Marine.Get().DetectedPreviously && Medivac.Get().DetectedPreviously && Viking.Get().DetectedPreviously && Reaper.Get().DetectedPreviously && !Raven.Get().DetectedPreviously && Marauder.Get().DetectedPreviously && Liberator.Get().DetectedPreviously && !Banshee.Get().DetectedPreviously) { // Jensiiibot //options.Add(new PvTStalkerTempest()); //options.Add(new Builds.Protoss.WorkerRush() { CounterJensiii = true, BuildStalkers = true }); //options.Add(new PvTStalkerImmortal() { BuildReaperWall = true, ProxyPylon = false, DelayObserver = true, MassTanksDetected = MassTank.Get().DetectedPreviously, UseColosus = false }); options.Add(new PvTZealotImmortal()); return(options); } if (Marine.Get().DetectedPreviously && Medivac.Get().DetectedPreviously && Viking.Get().DetectedPreviously && Reaper.Get().DetectedPreviously && Cyclone.Get().DetectedPreviously && !Marauder.Get().DetectedPreviously && !Liberator.Get().DetectedPreviously && !Banshee.Get().DetectedPreviously) { // Rusty options.Add(new OneBaseStalkerImmortal()); return(options); } if (Marine.Get().DetectedPreviously && Medivac.Get().DetectedPreviously && Viking.Get().DetectedPreviously && Reaper.Get().DetectedPreviously && !Raven.Get().DetectedPreviously && Cyclone.Get().DetectedPreviously && Marauder.Get().DetectedPreviously && !Liberator.Get().DetectedPreviously && !Banshee.Get().DetectedPreviously && Thor.Get().DetectedPreviously && SiegeTank.Get().DetectedPreviously && MassTank.Get().DetectedPreviously && Hellbat.Get().DetectedPreviously) { // MechSweep options.Add(new OneBaseTempest() { RequiredSize = 3 }); return(options); } options.Add(new PvTStalkerImmortal() { BuildReaperWall = true, ProxyPylon = false, DelayObserver = true, MassTanksDetected = MassTank.Get().DetectedPreviously, UseColosus = false }); } else if (bot.EnemyRace == Race.Zerg) { if (Bot.Main.OpponentID == "eed44128-f488-4e31-b457-8e55f8a95628") { options.Add(new PvZHjax() { CounterRoaches = false, DefendNydus = false }); return(options); } options.Add(new PvZHjax()); return(options); /* * if (Lurker.Get().DetectedPreviously) * { * //Kagamine * //options.Add(new PvZAdeptIntoVoidray()); * //options.Add(new WorkerRush()); * options.Add(new PvZHjax()); * return options; * } * if (Mutalisk.Get().DetectedPreviously * && !Lurker.Get().DetectedPreviously) * { * options.Add(new OneBaseStalkerImmortal() { StartZealots = true }); * return options; * } * if (Hydralisk.Get().DetectedPreviously && StrategyAnalysis.ZerglingRush.Get().DetectedPreviously) * { * options.Add(new ZealotRush()); * return options; * } * if (RoachRush.Get().DetectedPreviously || StrategyAnalysis.ZerglingRush.Get().DetectedPreviously) * { * options.Add(new PvZRushDefense()); * options.Add(new NinjaTurtles()); * return options; * } * if (Roach.Get().DetectedPreviously * && Zergling.Get().DetectedPreviously * && !Hydralisk.Get().DetectedPreviously) * { * options.Add(new PvZRushDefense()); * options.Add(new NinjaTurtles()); * return options; * } * if (Queen.Get().DetectedPreviously * && Zergling.Get().DetectedPreviously * && !Hydralisk.Get().DetectedPreviously * && !Roach.Get().DetectedPreviously) * { * options.Add(new NinjaTurtles()); * return options; * } * if (bot.PreviousEnemyStrategies.MassHydra * && MassRoach.Get().DetectedPreviously * && !Lurker.Get().DetectedPreviously) * { * options.Add(new OneBaseTempest()); * return options; * } * if (!Zergling.Get().DetectedPreviously * && !Roach.Get().DetectedPreviously * && !Hydralisk.Get().DetectedPreviously * && !Queen.Get().DetectedPreviously * && !Mutalisk.Get().DetectedPreviously) * { * options.Add(new OneBaseTempest()); * return options; * } * if (!Zergling.Get().DetectedPreviously * && Roach.Get().DetectedPreviously * && !Hydralisk.Get().DetectedPreviously * && Queen.Get().DetectedPreviously * && !Mutalisk.Get().DetectedPreviously) * { * options.Add(new OneBaseTempest()); * return options; * } * options.Add(new OneBaseStalkerImmortal() { StartZealots = true }); */ } else if (bot.EnemyRace == Race.Protoss) { if (Zealot.Get().DetectedPreviously && VoidRay.Get().DetectedPreviously && !Carrier.Get().DetectedPreviously && !Tempest.Get().DetectedPreviously && !Stalker.Get().DetectedPreviously && !Adept.Get().DetectedPreviously && !Immortal.Get().DetectedPreviously && !StrategyAnalysis.CannonRush.Get().DetectedPreviously) { // MavBot3 options.Add(new ZealotRush()); return(options); } if (SkippedNatural.Get().DetectedPreviously && !AdeptHarass.Get().DetectedPreviously && VoidRay.Get().DetectedPreviously && Immortal.Get().DetectedPreviously) { // AdditionalPylons options.Add(new DoubleRoboProxy()); return(options); } if (Oracle.Get().DetectedPreviously && ThreeGate.Get().DetectedPreviously && Zealot.Get().DetectedPreviously && !Stalker.Get().DetectedPreviously && !VoidRay.Get().DetectedPreviously && !Immortal.Get().DetectedPreviously) { // LuckyBot options.Add(new OneBaseTempest()); return(options); } if (Carrier.Get().DetectedPreviously && Collosus.Get().DetectedPreviously && SkyToss.Get().DetectedPreviously && Tempest.Get().DetectedPreviously && !Archon.Get().DetectedPreviously && !HighTemplar.Get().DetectedPreviously) { // TheGoldenArmada options.Add(new OneBaseTempest()); return(options); } options.Add(new OneBaseStalkerImmortal() { DoubleRobo = true, EarlySentry = true, AggressiveMicro = true }); return(options); /* * if (AdeptHarass.Get().DetectedPreviously * && SkyToss.Get().DetectedPreviously * && Carrier.Get().DetectedPreviously * && HighTemplar.Get().DetectedPreviously * && VoidRay.Get().DetectedPreviously * && !StrategyAnalysis.CannonRush.Get().DetectedPreviously) * { * options.Add(new ZealotRush()); * options.Add(new OneBaseStalkerImmortal()); * return options; * } * if (AdeptHarass.Get().DetectedPreviously) * { * // SharpenedEdge * options.Add(new OneBaseTempest()); * options.Add(new Dishwasher()); * return options; * } * if (StrategyAnalysis.CannonRush.Get().DetectedPreviously * && Tempest.Get().DetectedPreviously) * { * // ThreeWayLover * //options.Add(new MassVoidray() { SkipDefenses = true }); * options.Add(new OneBaseTempest()); * return options; * } * if (Sentry.Get().DetectedPreviously * && Archon.Get().DetectedPreviously * && !Stalker.Get().DetectedPreviously * && !Zealot.Get().DetectedPreviously) * { * options.Add(new TempestProxy()); * return options; * } * if (Zealot.Get().DetectedPreviously * && StrategyAnalysis.CannonRush.Get().DetectedPreviously * && Oracle.Get().DetectedPreviously * && Phoenix.Get().DetectedPreviously * && Stalker.Get().DetectedPreviously * && !Immortal.Get().DetectedPreviously) * { * //Gumby * options.Add(new NinjaTurtles()); * return options; * } * if (Oracle.Get().DetectedPreviously) * { * options.Add(new OneBaseTempest()); * return options; * } * if (!Stalker.Get().DetectedPreviously * && !Zealot.Get().DetectedPreviously * && !Sentry.Get().DetectedPreviously) * { * options.Add(new ZealotRush()); * return options; * } * if (Zealot.Get().DetectedPreviously * && !Stalker.Get().DetectedPreviously) * { * options.Add(new NinjaTurtles()); * return options; * } * * options.Add(new NinjaTurtles()); * options.Add(new PvPMothershipSiege()); */ } return(options); }
public override void Init(Tempest tempest) { On.RoR2.CharacterDeathBehavior.OnDeath += DeathCounter; }
void Server_ConnectionMade(object sender, Tempest.ConnectionMadeEventArgs e) { Debug.WriteLine(String.Format("Server: Connection received from {0}:{1}!", e.Connection.RemoteTarget.Hostname, e.Connection.RemoteTarget.Port)); }