public AIBase(AIDifficulty difficulty) { _difficulty = difficulty; if (_difficulty <= AIDifficulty.Hard) { _UseFuzzyLogicOnRatings = true; } if (_difficulty == AIDifficulty.VeryEasy) { _FuzzyDistortion = 16; } if (_difficulty == AIDifficulty.Easy) { _FuzzyDistortion = 8; } if (_difficulty == AIDifficulty.Medium) { _FuzzyDistortion = 4; } if (_difficulty == AIDifficulty.Hard) { _FuzzyDistortion = -4; } if (_difficulty >= AIDifficulty.Medium) { _tryToBlockOpponentsGoodConnections = true; _createCompulsionsCount = 12; } if (_difficulty >= AIDifficulty.Hard) { _createCompulsionsCount = int.MaxValue; _blockOpponentCompulsionsCount = 12; } if (_difficulty >= AIDifficulty.VeryHard) { _blockOpponentCompulsionsCount = int.MaxValue; } }
public void AlterDifficulty() { switch (difficulty) { case AIDifficulty.Expert: difficulty = AIDifficulty.Beginner; speed = 8f; agent.speed = 8f; imperfection = 2.5f; break; case AIDifficulty.Beginner: difficulty = AIDifficulty.Intermediate; speed = 10f; agent.speed = 10f; imperfection = 2f; break; case AIDifficulty.Intermediate: difficulty = AIDifficulty.Expert; speed = 12f; agent.speed = 12f; imperfection = .5f; break; } }
private void LoadBattleWithAI(AIDifficulty difficulty) { AIPlayer.difficulty = difficulty; GameManager.GType = GameType.AI; //ConstantData.physical -= 1; ConstantData.BattleSceneType = ConstantData.ToAI; LoadScene(1); }
protected void ChooseDifficulty(AIDifficulty difficulty) { if (contextBuilder != null) { contextBuilder.WithDifficulty(difficulty); InitializeGameManager(); } }
public Builder WithDifficulty(AIDifficulty difficulty) { if (Mode != GameMode.SP_AI) { throw new ArgumentException(Constants.INCORRECT_GAME_MODE_ERROR_STRING); } Difficulty = difficulty; return(this); }
void Start() { /* Initializes the AI difficulty */ try { aiDifficulty = (AIDifficulty)Enum.Parse(typeof(AIDifficulty), GRHGameSettings.gameSettings.gameDifficulty); Debug.Log($"\"{aiDifficulty}\" difficulty loaded."); } catch (Exception) { Debug.LogError($"Parse Error: failed to load AI difficulty."); } }
private void btnApply_Click(object sender, EventArgs e) { InitProcess(); try { if (SelectedVersion.Version == 1) { HotsOffsets_V1 CurrentVersion = SelectedVersion as HotsOffsets_V1; FileVersionInfo ver = Memory.CurrentProcess.MainModule.FileVersionInfo; if (ver.FilePrivatePart != Offsets[cbVersions.SelectedIndex].Build) { MessageBox.Show("Wrong or incompatible build selected! Patch failed."); return; } // Map patch byte[] mapName = Encoding.ASCII.GetBytes(cbMapSelect.SelectedItem + "\0\0\0"); if (mapNamePtr == IntPtr.Zero) { mapNamePtr = Memory.Alloc(mapName.Length); } Memory.Write(mapNamePtr, mapName); oldMapPtr1 = Memory.Read <IntPtr>(CurrentVersion.PatchMapOffset1); oldMapPtr2 = Memory.Read <IntPtr>(CurrentVersion.PatchMapOffset2); Memory.Write <IntPtr>(CurrentVersion.PatchMapOffset1, mapNamePtr); Memory.Write <IntPtr>(CurrentVersion.PatchMapOffset2, mapNamePtr + mapName.Length - 3); } for (int i = 0; i < 10; ++i) { Heroes[i] = (int)Enum.Parse(SelectedVersion.HeroIDEnum, (string)HeroComboBoxes[i].SelectedItem); } AlliedAI = (AIDifficulty)Enum.Parse(typeof(AIDifficulty), (string)cbAllyTeamAI.SelectedItem); EnemyAI = (AIDifficulty)Enum.Parse(typeof(AIDifficulty), (string)cbEnemyTeamAI.SelectedItem); timer1.Enabled = true; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public static AIStrategy CreateAIStrategy(AIDifficulty type) { switch (type) { case AIDifficulty.Easy: return(new EasyAIStrategy()); case AIDifficulty.Medium: return(new MediumAIStrategy()); case AIDifficulty.Hard: return(new HardAIStrategy()); default: throw new ArgumentException("Not recognized AIDifficulty"); } }
public void setAIDifficulty(AIDifficulty _aiDifficulty) { aiDifficulty = _aiDifficulty; }
public static IAIStrategy Provide(BoardCell aiCell, IBoardManager boardManager, AIDifficulty difficulty) { return(difficulty switch { AIDifficulty.EASY => new EasyAIStrategy(aiCell, boardManager), AIDifficulty.MEDIUM => new MediumAIStrategy(aiCell, boardManager), AIDifficulty.HARD => new HardAIStrategy(aiCell, boardManager), _ => throw new System.NotSupportedException(), });
public void SetAIDifficulty(int difficulty) { m_AIDifficulty = (AIDifficulty)difficulty; }
private Color GetOpponentColor(AIDifficulty diff) { Color easy = Color.FromRgb(70, 242, 51); Color norm = Color.FromRgb(242, 163, 51); Color hard = Color.FromRgb(255, 0, 0); switch(diff) { case AIDifficulty.NORMAL: return Color.FromScRgb(0.7f, norm.ScR, norm.ScG, norm.ScB); case AIDifficulty.HARD: return Color.FromScRgb(0.7f, hard.ScR, hard.ScG, hard.ScB); default: return Color.FromScRgb(0.7f, easy.ScR, easy.ScG, easy.ScB); } }
private void btnApply_Click(object sender, EventArgs e) { InitProcess(); try { if (SelectedVersion.Version == 1) { HotsOffsets_V1 CurrentVersion = SelectedVersion as HotsOffsets_V1; FileVersionInfo ver = Memory.CurrentProcess.MainModule.FileVersionInfo; if (ver.FilePrivatePart != Offsets[cbVersions.SelectedIndex].Build) { MessageBox.Show("Wrong or incompatible build selected! Patch failed."); return; } // Map patch byte[] mapName = Encoding.ASCII.GetBytes(cbMapSelect.SelectedItem + "\0\0\0"); if (mapNamePtr == IntPtr.Zero) mapNamePtr = Memory.Alloc(mapName.Length); Memory.Write(mapNamePtr, mapName); oldMapPtr1 = Memory.Read<IntPtr>(CurrentVersion.PatchMapOffset1); oldMapPtr2 = Memory.Read<IntPtr>(CurrentVersion.PatchMapOffset2); Memory.Write<IntPtr>(CurrentVersion.PatchMapOffset1, mapNamePtr); Memory.Write<IntPtr>(CurrentVersion.PatchMapOffset2, mapNamePtr + mapName.Length - 3); } for (int i = 0; i < 10; ++i) { Heroes[i] = (int)Enum.Parse(SelectedVersion.HeroIDEnum, (string)HeroComboBoxes[i].SelectedItem); } AlliedAI = (AIDifficulty)Enum.Parse(typeof(AIDifficulty), (string)cbAllyTeamAI.SelectedItem); EnemyAI = (AIDifficulty)Enum.Parse(typeof(AIDifficulty), (string)cbEnemyTeamAI.SelectedItem); timer1.Enabled = true; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
void ChooseAIDifficulty() { m_AIDifficulty = (AIDifficulty)(Constants.WinGameBlue + 1); }
public static AIDifficulty ConvertAIDifficulty(int i) { return(AIDifficulty.GetAIDifficulty(i)); }
public AIPlayer(BoardCell aiCell, IBoardManager boardManager, AIDifficulty difficulty) : base(aiCell, boardManager) { aiStrategy = AIStrategyProvider.Provide(aiCell, boardManager, difficulty); }
// Start is called before the first frame update void Start() { m_difficulty = AIDifficulty.PRO; }
public AIPlayer(int botNumber, AIDifficulty type, GameManager game) : base(new User { ID = botNumber + 1, UserName = $"AI{botNumber + 1}" }, game) { this.strategy = AIStrategyFactory.CreateAIStrategy(type); }
public void SetDifficulty(Dropdown dropdown) //Attached to Dropdown in Editor { Difficulty = AIDifficulties[dropdown.value]; }
public AIOpponent(GameBoard board, AIDifficulty diff) : base(board) { this.difficulty = diff; ResetDirections(); }