public int GetDifficultyMultiplier(DifficultyMode difficulty) { int returnVal = 0; switch (difficulty) { case DifficultyMode.NEWBIEmode: { returnVal = 3; break; } case DifficultyMode.NORMALmode: { returnVal = 2; break; } case DifficultyMode.ELITEmode: { returnVal = 1; break; } } return(returnVal); }
/// <summary> /// Creates a new gameplay screen. /// </summary> /// <param name="gameDifficultyMode">The desired game difficulty.</param> public GameplayScreen(DifficultyMode gameDifficultyMode) { TransitionOnTime = TimeSpan.FromSeconds(0.0); TransitionOffTime = TimeSpan.FromSeconds(0.0); startScreenTime = TimeSpan.FromSeconds(3); //Loads configuration ConfigurationManager.LoadConfiguration(XDocument.Load("Content/Configuration/Configuration.xml")); ConfigurationManager.DifficultyMode = gameDifficultyMode; gameDifficultyLevel = gameDifficultyMode; gameElapsed = ConfigurationManager.ModesConfiguration[gameDifficultyLevel].GameElapsed; amountOfSoldierBee = 4; amountOfWorkerBee = 16; controlstickBoundaryPosition = new Vector2(34, 347); smokeButtonPosition = new Vector2(664, 346); controlstickStartupPosition = new Vector2(55, 369); IsInMotion = false; isAtStartupCountDown = true; isLevelEnd = false; EnabledGestures = GestureType.Tap; }
private string DefineDifficultString(DifficultyMode difficultyMode) { string str = null; switch (difficultyMode) { case DifficultyMode.Easy: str = StringService.GetRandomString(3, _mainWindow.IsCaseSensitive); break; case DifficultyMode.Normal: str = StringService.GetRandomString(4, _mainWindow.IsCaseSensitive); break; case DifficultyMode.Hard: str = StringService.GetRandomString(5, _mainWindow.IsCaseSensitive); break; case DifficultyMode.Professional: str = StringService.GetRandomString(6, _mainWindow.IsCaseSensitive); break; case DifficultyMode.Expert: str = StringService.GetRandomString(7, _mainWindow.IsCaseSensitive); break; } return(str); }
private void Start() { // depending on level of difficulty, different number of players GameObject diffObj = GameObject.FindWithTag("DiffMode"); player_health = player.GetComponent <PlayerHealth>(); monitor_game = monitorGameObj.GetComponent <MonitorGame>(); checkIfHit = player.GetComponent <CheckIfHit>(); difficultyMode = diffObj.GetComponent <DifficultyMode>(); if (difficultyMode.levelOfDiff == 1) { // normal mode amountOfEnemies = 4; player_health.numberOfHeals = 3; checkIfHit.damageFromEnemy = 10; monitor_game.healsLeft = 3; monitor_game.UpdateHealDisplay(3); } else { // hard mode amountOfEnemies = 9; player_health.numberOfHeals = 1; checkIfHit.damageFromEnemy = 20; monitor_game.healsLeft = 1; monitor_game.UpdateHealDisplay(1); } SpawnEnemies(); }
private void Slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e) { ((Slider)sender).SelectionEnd = e.OldValue; _difficultyMode = (DifficultyMode)(int)e.NewValue; lbDifficulty.Content = ((int)_difficultyMode).ToString(); switch (_difficultyMode) { case DifficultyMode.Easy: this.Background = Brushes.White; lbTime.Content = _timeLeftDefault = 90; break; case DifficultyMode.Normal: this.Background = new SolidColorBrush(Color.FromRgb(173, 218, 254)); lbTime.Content = _timeLeftDefault = 70; break; case DifficultyMode.Hard: this.Background = new SolidColorBrush(Color.FromRgb(255, 220, 172)); lbTime.Content = _timeLeftDefault = 50; break; case DifficultyMode.Professional: this.Background = new SolidColorBrush(Color.FromRgb(255, 181, 172)); lbTime.Content = _timeLeftDefault = 30; break; case DifficultyMode.Expert: this.Background = new SolidColorBrush(Color.FromRgb(254, 173, 242)); lbTime.Content = _timeLeftDefault = 20; break; } }
public void Can_ParseSongDifficultModes(string xPathToSong, string xPathToDifficultMode, int difficultyLevel, DifficultyCategory difficultyCategory) { var doc = new HtmlDocument(); doc.Load("ez2onDBSample.html"); var songNode = doc.DocumentNode.SelectSingleNode(xPathToSong); var mockLogger = new Mock <ILogger <Ez2OnParser> >(); Ez2OnParser parser = new Ez2OnParser(mockLogger.Object); DifficultyMode parsedMode = parser.ParseDifficultyModeFromSongNode(songNode, xPathToDifficultMode, difficultyCategory); Assert.Equal(difficultyLevel, parsedMode.Level); Assert.Equal(difficultyCategory, parsedMode.Category); }
public void Validate_GamePlayList_ReturnsTrue() { var fakePerson = new Bogus.Person() { Random = new Randomizer(1080) }; var randomPhrase = new Bogus.DataSets.Hacker() { Random = new Randomizer(1080) }; var randomFluent = new Bogus.Faker() { Random = new Randomizer(1080) }; GameTrackPlaylist gameTrackPlaylist = new GameTrackPlaylist(); for (int count = 0; count < 10; count++) { Song fakeSong = new Song() { Title = randomPhrase.Phrase(), Album = randomPhrase.Phrase(), Composer = fakePerson.FullName }; Game fakeGame = new Game() { Title = randomPhrase.Phrase() }; DifficultyMode fakeMode = new DifficultyMode(); gameTrackPlaylist.Add(new Ez2OnGameTrack(fakeSong, fakeGame, fakeMode)); } gameTrackPlaylist.Name = randomPhrase.Phrase(); gameTrackPlaylist.DateTimeCreated = randomFluent.Date.Past(10, DateTime.Now); gameTrackPlaylist.DateTimeModified = randomFluent.Date.Future(10, DateTime.Now); GamePlayListValidator validator = new GamePlayListValidator(); ValidationResult results = validator.Validate(gameTrackPlaylist); Assert.True(results.IsValid); }
public int GetIntervalBetweenColors(DifficultyMode mode) { switch (mode) { case DifficultyMode.Easy: return(EASY); case DifficultyMode.Normal: return(NORMAL); case DifficultyMode.Hard: return(HARD);; default: return(EASY); } }
public List <Run> InitString(DifficultyMode difficultyMode) { _listRuns = new List <Run>(); string str = DefineDifficultString(difficultyMode); if (str == null) { throw new Exception("Ошибка инициализации строки!"); } foreach (char c in str) { _listRuns.Add(new Run(c.ToString())); } return(_listRuns); }
public void Assign_DefaultDateTimeModified_To_GamePlayList_ReturnsFalse() { var fakePerson = new Bogus.Person() { Random = new Randomizer(1080) }; var randomPhrase = new Bogus.DataSets.Hacker() { Random = new Randomizer(1080) }; var randomFluent = new Bogus.Faker() { Random = new Randomizer(1080) }; GameTrackPlaylist gameTrackPlaylist = new GameTrackPlaylist(); for (int count = 0; count < 10; count++) { Song fakeSong = new Song() { Title = randomPhrase.Phrase(), Album = randomPhrase.Phrase(), Composer = fakePerson.FullName }; Game fakeGame = new Game() { Title = randomPhrase.Phrase() }; DifficultyMode fakeMode = new DifficultyMode(); gameTrackPlaylist.Add(new Ez2OnGameTrack(fakeSong, fakeGame, fakeMode)); } gameTrackPlaylist.Name = randomPhrase.Phrase(); gameTrackPlaylist.DateTimeCreated = DateTime.Now; GamePlayListValidator validator = new GamePlayListValidator(); ValidationResult results = validator.Validate(gameTrackPlaylist); Assert.Contains(results.Errors, x => x.ErrorMessage == GamePlayListValidator.DateTimeModifiedErrorMessage); }
public DifficultyMode ParseDifficultyModeFromSongNode(HtmlNode songNode, string xPathToDifficultyLevel, DifficultyCategory category) { DifficultyMode difficultyMode = new DifficultyMode(); var difficultLevelNode = songNode.SelectSingleNode(xPathToDifficultyLevel); if (difficultLevelNode != null) { difficultyMode.Level = int.Parse(difficultLevelNode.InnerText); difficultyMode.Category = category; } if (difficultyMode.Level == 0) { _logger.LogWarning("Unable to parse DifficultyMode Level. " + "Consider verifying song difficult level from source"); } return(difficultyMode); }
/// <summary> /// Creates a new gameplay screen. /// </summary> /// <param name="gameDifficultyMode">The desired game difficulty.</param> public GameplayScreen(DifficultyMode gameDifficultyMode) { TransitionOnTime = TimeSpan.FromSeconds(0.0); TransitionOffTime = TimeSpan.FromSeconds(0.0); startScreenTime = TimeSpan.FromSeconds(3); //Loads configuration ConfigurationManager.LoadConfiguration(XDocument.Load("Content/Configuration/Configuration.xml")); ConfigurationManager.DifficultyMode = gameDifficultyMode; gameDifficultyLevel = gameDifficultyMode; gameElapsed = ConfigurationManager.ModesConfiguration[gameDifficultyLevel].GameElapsed; smokeButtonPosition = new Vector2(664, 346); isAtStartupCountDown = true; isLevelEnd = false; EnabledGestures = GestureType.Tap; }
int rageUsed; // Keeps track of the last turn a rage potion was used //public Game() //{ //} /// <summary> /// Try to create an instance of Game satisfying the specified configuration. /// It should throw an exception if it does not manage to generate a dungeon /// satisfying the configuration. /// </summary> public Game(GameConfiguration conf) { // Set the difficulty mode difficultyMode = conf.difficultyMode; // Get the difficulty HP and AR multiplier var difMult = conf.GetDifficultyMultiplier(difficultyMode); // Initialize the player player = new Player("playerId", conf.playerName, (conf.playerBaseHp * difMult), (conf.playerBaseAr * difMult)); // Initialize the dungeon dungeon = new Dungeon(conf.dungeonShape, conf.numberOfRooms, conf.maxRoomCapacity); // Seed the monsters and items TrySeed(); // Get the list of all monsters created in the dungeon and store it livingMonsters = dungeon.Monsters; // Place the player in the starting room of the dungeon player.Location = dungeon.StartRoom; // Try seeding the monsters and items a couple of times, throw an exception is still not successful void TrySeed() { for (int i = 0; i < 10; i++) { // Try seeding the monsters and items 10 times if (dungeon.SeedMonstersAndItems(conf.initialNumberOfMonsters, conf.initialNumberOfHealingPots, conf.initialNumberOfRagePots)) { return; } } // Throw and argument exception if this seeding fails throw new ArgumentException("Could not seed the dungeon with the given parameters"); } }
public void GameSong_MustBeAssociatedWith_EitherGameOrDlc(string locale) { var lorem = new Bogus.DataSets.Lorem(locale) { Random = new Randomizer(1080) }; Game fakeGame = new Game() { Title = lorem.Letter(1) }; Song fakeSong = new Song() { Title = lorem.Letter(1), Composer = lorem.Letter((1)), Album = lorem.Letter(1) }; var randomFluent = new Bogus.Faker() { Random = new Randomizer(1080) }; DifficultyMode fakeMode = new DifficultyMode(); fakeMode.Level = randomFluent.Random.Int(1, 20); fakeMode.Category = DifficultyCategory.Easy; Ez2OnGameTrack fakeGameTrack = new Ez2OnGameTrack(fakeSong, fakeGame, fakeMode); SongValidator fakeSongValidator = new SongValidator(); GameValidator fakeGameValidator = new GameValidator(); GameTrackValidator mockValidator = new GameTrackValidator(fakeSongValidator, fakeGameValidator); var gameMusicResults = mockValidator.Validate(fakeGameTrack); Assert.True(gameMusicResults.IsValid); }
public void Test_Game_Flee_Player( [Values(1, 2, 3)] int roomType, // room nextToStart = 1, room nextToExit = 2, normal room = 3 [Values(1, 9)] int healPotUsed, // Last turn heal potion was used [Values(true, false)] bool playerEnraged, [Values(DifficultyMode.NEWBIEmode, DifficultyMode.NORMALmode, DifficultyMode.ELITEmode)] DifficultyMode mode, [Values(true, false)] bool eliteFlee) // Only relevant if next to exit { // Initialize correct gameConfiguration GameConfiguration gameConfiguration = new GameConfiguration { numberOfRooms = 5, maxRoomCapacity = 5, dungeonShape = DungeonShapeType.LINEARshape, initialNumberOfMonsters = 1, initialNumberOfHealingPots = 1, initialNumberOfRagePots = 1, difficultyMode = mode }; // Initialize the game Game g = new Game(gameConfiguration); // Set turn number to 10 g.TurnNumber = 10; // Set healUsed g.HealUsed = healPotUsed; // Set player.enraged g.Player.Enraged = playerEnraged; // Move the player to a room with the correct neighbours switch (roomType) { case 1: g.Player.Location = g.Dungeon.StartRoom.Neighbors.First(); break; case 2: g.Player.Location = g.Dungeon.ExitRoom.Neighbors.First(); // Also set elite flee to the correct value if next to exit node g.Player.EliteFlee = eliteFlee; break; default: foreach (Room r in g.Dungeon.StartRoom.Neighbors.First().Neighbors) { if (r.RoomType == RoomType.ORDINARYroom) { g.Player.Location = r; break; } } break; } // Initialize a monster and add it to the room player is in Monster m = new Monster("mId", "TestMonster", 10, 10); m.Location = g.Player.Location; g.Player.Location.Monsters.Add(m); // If room is next to start room player should always be able to flee if (roomType == 1) { // Check that Assert.IsTrue(g.Flee(g.Player)); Assert.IsFalse(m.Location == g.Player.Location); return; } // If heal potion is used at turn t-1 player should not be able to flee if (g.TurnNumber <= g.HealUsed + 1) { Assert.IsFalse(g.Flee(g.Player)); Assert.IsTrue(m.Location == g.Player.Location); return; } // If difficulty mode is not newbie mode and player is enraged, player should not be able to flee // If in elite mode and player entered room neighboring exit room enraged, player should not be able to flee if (g.DifficultyMode != DifficultyMode.NEWBIEmode && g.Player.Enraged || (g.DifficultyMode == DifficultyMode.ELITEmode && (roomType == 2 && !eliteFlee))) { Assert.IsFalse(g.Flee(g.Player)); Assert.IsTrue(m.Location == g.Player.Location); return; } // In all other cases player should be able to flee Assert.IsTrue(g.Flee(g.Player)); Assert.IsFalse(m.Location == g.Player.Location); }
/// <summary> /// Creates a new gameplay screen. /// </summary> /// <param name="gameDifficultyMode">The desired game difficulty.</param> public GameplayScreen(DifficultyMode gameDifficultyMode) { TransitionOnTime = TimeSpan.FromSeconds(0.0); TransitionOffTime = TimeSpan.FromSeconds(0.0); startScreenTime = TimeSpan.FromSeconds(3); //Loads configuration var config = Path.Combine(NSBundle.MainBundle.ResourcePath,"Content/Configuration/Configuration.xml"); //ConfigurationManager.LoadConfiguration(XDocument.Load("Content/Configuration/Configuration.xml")); ConfigurationManager.LoadConfiguration(XDocument.Load(config)); ConfigurationManager.DifficultyMode = gameDifficultyMode; gameDifficultyLevel = gameDifficultyMode; gameElapsed = ConfigurationManager.ModesConfiguration[gameDifficultyLevel].GameElapsed; amountOfSoldierBee = 4; amountOfWorkerBee = 16; controlstickBoundaryPosition = new Vector2(34, 347); smokeButtonPosition = new Vector2(664, 346); controlstickStartupPosition = new Vector2(55, 369); IsInMotion = false; isAtStartupCountDown = true; isLevelEnd = false; EnabledGestures = GestureType.Tap; }
private void Awake() { GameObject diffObj = GameObject.FindWithTag("DiffMode"); difficultyMode = diffObj.GetComponent <DifficultyMode>(); }
/// <summary> /// Instantiate a new instance of Ez2On Game Track based on a Game Song's metadata /// </summary> /// <param name="songDetails"></param> /// <param name="game"></param> public Ez2OnGameTrack(Song songDetails, IGame game, DifficultyMode difficultyMode) : base(songDetails) { Game = game; DifficultyMode = difficultyMode; }
/// <summary> /// Ctor. /// </summary> /// <param name="text">The text to display</param> /// <param name="difficultyMode">The next level</param> public LevelOverScreen(string text, DifficultyMode? difficultyMode) { this.text = text; EnabledGestures = GestureType.Tap; this.difficultyMode = difficultyMode; }
// Token: 0x06001030 RID: 4144 public void OnRecieveDamage(Damage damage) { if (RandomizerBonusSkill.Invincible) { return; } if (damage.Amount < 9000f || damage.Type != DamageType.Water) { if (this.IsImmortal) { return; } if (!this.Sein.Controller.CanMove) { return; } if (damage.Type == DamageType.SpiritFlameSplatter || damage.Type == DamageType.LevelUp) { return; } } damage.SetAmount(Mathf.Round(damage.Amount * Randomizer.DamageModifier)); bool flag = this.m_invincibleTimeRemaining > 0f; bool flag2 = this.m_invincibleToEnemiesTimeRemaining > 0f; if (this.Sein.Abilities.Stomp && this.Sein.Abilities.Stomp.Logic.CurrentState == this.Sein.Abilities.Stomp.State.StompDown) { flag = true; } if (!this.Sein.gameObject.activeInHierarchy) { return; } if (flag && damage.Amount < 100f && damage.Type != DamageType.Drowning) { damage.SetAmount(0f); } if (flag2 && damage.Amount < 100f && (damage.Type == DamageType.Enemy || damage.Type == DamageType.Projectile || damage.Type == DamageType.SlugSpike)) { damage.SetAmount(0f); } if (damage.Amount == 0f) { return; } if (damage.Amount < 100f) { DifficultyMode difficulty = DifficultyController.Instance.Difficulty; if (difficulty != DifficultyMode.Easy) { if (difficulty == DifficultyMode.Hard) { damage.SetAmount(damage.Amount * 2f); if (damage.Amount < 8f) { damage.SetAmount(8f); } } } else if (damage.Type != DamageType.Lava && damage.Type != DamageType.Spikes) { damage.SetAmount(damage.Amount / 2f); } else { int num = Mathf.RoundToInt(damage.Amount / 4f); if (num > 3) { num = Mathf.FloorToInt((float)(num - 3) * 0.5f) + 3; } damage.SetAmount((float)(num * 4)); } } if (Randomizer.OHKO) { damage.SetAmount(damage.Amount * 100f); } UI.Vignette.SeinHurt.Restart(); SoundDescriptor soundForDamage = ((damage.Amount >= this.BadlyHurtAmount) ? this.SeinBadlyHurtSound : this.SeinHurtSound).GetSoundForDamage(damage); if (soundForDamage != null) { SoundPlayer soundPlayer = Sound.Play(soundForDamage, this.PlatformMovement.Position, null); if (soundPlayer) { soundPlayer.AttachTo = this.Sein.PlatformBehaviour.transform; } } int num2 = Mathf.CeilToInt(damage.Amount / 4f); damage.SetAmount((float)num2); if (damage.Amount < 1000f && this.Sein.PlayerAbilities.UltraDefense.HasAbility) { damage.SetAmount((float)Mathf.RoundToInt((float)num2 * 0.8f)); } Attacking.DamageDisplayText.Create(damage, this.Sein.transform); damage.SetAmount((float)(num2 * 4)); if (damage.Amount < 1000f && this.Sein.PlayerAbilities.UltraDefense.HasAbility) { damage.SetAmount((float)(Mathf.FloorToInt((float)(num2 * 2) * 0.8f) * 2)); } int num3 = Mathf.RoundToInt(damage.Amount); if ((float)num3 >= this.HealthController.Amount) { this.Sein.Mortality.Health.TakeDamage(num3); this.OnKill(damage); return; } this.Sein.Mortality.Health.TakeDamage(num3); if (damage.Type != DamageType.Drowning) { this.MakeInvincible(1f); base.StartCoroutine(this.FlashSprite()); if (this.HurtEffect) { GameObject expr_3BA = (GameObject)InstantiateUtility.Instantiate(this.HurtEffect); expr_3BA.transform.position = base.transform.position; Vector3 vector = this.PlatformMovement.LocalSpeed.normalized + damage.Force.normalized; float z = Mathf.Atan2(vector.y, vector.x) * 57.29578f; expr_3BA.transform.rotation = Quaternion.Euler(0f, 0f, z); } base.Active = true; if (this.Sein.Abilities.GrabWall) { this.Sein.Abilities.GrabWall.Exit(); } if (this.Sein.Abilities.Dash) { this.Sein.Abilities.Dash.Exit(); } this.PlatformMovement.LocalSpeed = ((damage.Force.x <= 0f) ? new Vector2(-this.HurtSpeed.x, this.HurtSpeed.y) : this.HurtSpeed); this.m_hurtTimeRemaining = this.HurtDuration; this.Sein.PlatformBehaviour.Visuals.Animation.Play(this.HurtAnimation, 140, new Func <bool>(this.ShouldHurtAnimationKeepPlaying)); return; } base.StartCoroutine(this.FlashSprite()); }
public bool Load(string filePath) { using (FileStream fs = File.Open(filePath, FileMode.Open, FileAccess.Read, FileShare.Read)) { using (BinaryReader reader = new BinaryReader(fs)) { if (reader.ReadString() != HEADER_FORMAT_STRING) { return(false); } FilePath = filePath; Version = reader.ReadInt32(); if (Version < 10) { return(false); } AreaName = reader.ReadString(); Completion = reader.ReadInt32(); Health = reader.ReadInt32(); MaxHealth = reader.ReadInt32(); Energy = reader.ReadInt32(); MaxEnergy = reader.ReadInt32(); Hours = reader.ReadInt32(); Minutes = reader.ReadInt32(); Seconds = reader.ReadInt32(); Progression = (WorldProgression)reader.ReadInt32(); Completed = reader.ReadBoolean(); Identifier = new SceneID(reader.ReadBytes(16)); DebugOn = reader.ReadBoolean(); Order = reader.ReadInt32(); Difficulty = (DifficultyMode)reader.ReadInt32(); WasKilled = reader.ReadBoolean(); CompletedWithEverything = reader.ReadBoolean(); LowestDifficulty = (DifficultyMode)reader.ReadInt32(); IsTrialSave = reader.ReadBoolean(); Scenes.Clear(); if (reader.ReadString() != FILE_FORMAT_STRING) { return(false); } DataVersion = reader.ReadInt32(); int num = reader.ReadInt32(); for (int i = 0; i < num; i++) { SceneCollection saveScene = new SceneCollection(); saveScene.ID = new SceneID(reader.ReadBytes(16)); this.Scenes.Add(saveScene.ID, saveScene); int num2 = reader.ReadInt32(); for (int j = 0; j < num2; j++) { SceneID id = new SceneID(reader.ReadBytes(16)); SceneData item = new SceneData() { ID = id }; item.ReadData(reader); saveScene.Objects.Add(item.ID, item); } } } } return(true); }