string GetRandomCommand() { string command = ""; //Gets random number between 1 and 4 int commandValue = Random.Range(1, 5); //Sets command based on command value switch (commandValue) { case 1: command = "Set up"; break; case 2: command = "Rest"; break; case 3: Attack randAttack = GetRandomAttack(); command = randAttack.Name; break; case 4: Taunt randTaunt = GetRandomTaunt(); command = randTaunt.Name; break; } //Returns command return(command); }
private Taunt GetPossibleTauntThatHasNotPlayed(List <Taunt> ts) { List <Taunt> possibleTaunts = new List <Taunt>(); foreach (Taunt t in ts) { if (t.isPossible && !t.hasPlayed) { possibleTaunts.Add(t); } } if (possibleTaunts.Count > 0) { Taunt temp = possibleTaunts[UnityEngine.Random.Range(0, possibleTaunts.Count - 1)]; temp.hasPlayed = true; return(temp); } //Reset all possible taunts so they can play again; foreach (Taunt t in ts) { if (t.isPossible) { t.hasPlayed = false; possibleTaunts.Add(t); } } Taunt returnTaunt = possibleTaunts[UnityEngine.Random.Range(0, possibleTaunts.Count - 1)]; returnTaunt.hasPlayed = true; return(returnTaunt); }
public void LearnTaunt(Taunt learnedTaunt) { //Adds learnedAttack to list of learned attacks learnedTaunts.Add(learnedTaunt); knownTaunts.Add(learnedTaunt.Name, learnedTaunt); }
private void OnGUI() { switch (currentState) { case CombatStates.PlayerTurn: //Menu for (int i = 0; i < displayedMenu.Count; i++) { //If the displayed menu is selected, selected option is highlighted GUI.color = i == selectedOption && currentMenu == displayedMenu ? Color.yellow : Color.white; //Prints menu options out to screen GUI.Label(new Rect(100, 35 + i * 20, 200, 50), displayedMenu[i]); } //Taunt Descriptions if (currentMenu == tauntMenu && selectedOption != currentMenu.Count - 1) { GUI.color = Color.white; //Gets selected taunt Taunt currentTaunt = player.knownTaunts[currentMenu[selectedOption]]; //Prints taunt's descritption out to screen GUI.Label(new Rect(200, 35, 200, 50), currentTaunt.Description); } //Draws command menu for (int i = 0; i < commandMenu.Count; i++) { //If the command menu is selected, selected option is highlighted GUI.color = i == selectedOption && currentMenu == commandMenu ? Color.yellow : Color.white; //Prints menu options out to screen GUI.Label(new Rect(250, 250 + 25 * i, 200, 50), commandMenu[i]); } break; case CombatStates.EnemyTurn: break; case CombatStates.DamageDealt: break; case CombatStates.End: //Displays winning text GUI.Label(new Rect(0, 0, 100, 100), "\n" + winner.wrestlerName + " wins!"); break; } //Shows health information for both wrestlers string healths = player.wrestlerName + ": " + player.Health + "\n" + enemy.wrestlerName + ": " + enemy.Health + "\n" + "Turn Cost: " + player.CurrentTurnCost + "/" + player.MaxTurnCost; GUI.color = Color.white; //Prints health information out to screen GUI.Label(new Rect(0, 35, 200, 50), healths); //Prints recent action out to screen GUI.Label(new Rect(55, 135, 250, 150), actionMessage); }
/// <summary> /// Den här metoden sköter ability3 /// </summary> /// <returns></returns> protected override Ability CastAbility3() { Ability ability = new Taunt(TextureBank.mageSpellList[9], pos, new Vector2(0, 0), this); Ability3CooldownTimer = ability.coolDownTime; SoundBank.SoundEffectList[7].Play(); return(ability); }
public Knight(Texture2D tex, Vector2 pos, int playerIndex, Controller Controller) : base(tex, pos, playerIndex, Controller) { HealthPoints = ValueBank.KnightHealth; MaxHealthPoints = HealthPoints; Ability1 = new Block(TextureBank.roomTextureList[0], pos, LastDirection, this); Ability2 = new Slash(TextureBank.mageSpellList[1], pos, LastDirection, this); Ability3 = new Taunt(TextureBank.mageSpellList[10], pos, new Vector2(0, 0), this); }
private void OnDelete(object sender, RoutedEventArgs e) { Button b = sender as Button; if (b != null) { Taunt t = b.CommandParameter as Taunt; if (t != null) { Taunts.Remove(t); } } }
public IActionResult AddTaunt(int ID, Taunt fromForm) { int?SessionId = HttpContext.Session.GetInt32("userKey"); var LoggedUser = dbContext.UserTable.FirstOrDefault(u => u.UserId == SessionId); if (LoggedUser == null) { return(RedirectToAction("Index")); } var NewTaunt = new Taunt() { Message = fromForm.Message, UserId = LoggedUser.UserId, FightId = ID }; dbContext.Add(NewTaunt); dbContext.SaveChanges(); return(RedirectToAction("FightViewer", new { ID = ID })); }
public override void useSkill(List <BattleChar> target) { base.useSkill(target); set.user.BM.zoomPlayerCam(); //디버프 foreach (BattleChar bc in target) { if (enemies.Exists(x => x == bc)) { debuff.ToArray()[enemies.IndexOf(bc)].turn = 3; } else { Buff d = new Buff(); d.turn = 3; d.buffPhyATK -= 0.1f + 0.02f * level; debuff.Add(d); enemies.Add(bc); bc.buffStack.Add(d); } } //도발 set.user.tauntTurn = 3; foreach (BattleChar g in set.user.BM.getGuarded(set.user)) { if (guarded.Exists(x => x == g)) { list.ToArray()[guarded.IndexOf(g)].setTurn(3); } else { Taunt t = new Taunt(3, set.user, g); list.Add(t); guarded.Add(g); g.stateTaunt.Add(t); } } }
public override void useSkill(List <BattleChar> target) { base.useSkill(target); set.user.BM.zoomPlayerCam(); //자버프 if (selfBuff == null) { selfBuff = new Buff(); selfBuff.turn = 3; selfBuff.user = set.user; selfBuff.buffMgcDEF += .1f + 0.05f * level; selfBuff.buffPhyDEF += .1f + 0.05f * level; selfBuff.buffPhyATK -= .1f + 0.01f * level; set.user.buffStack.Add(selfBuff); } else { selfBuff.turn = 3; } //도발 set.user.tauntTurn = 3; foreach (BattleChar g in set.user.BM.getGuarded(set.user)) { if (guarded.Exists(x => x == g)) { list.ToArray()[guarded.IndexOf(g)].setTurn(3); } else { Taunt t = new Taunt(3, set.user, g); list.Add(t); guarded.Add(g); g.stateTaunt.Add(t); } } }
public void SetTauntDelegate(Taunt taunt) { _taunt = taunt; }
private static void PlayGame() { var board = new UltimateTicTacToeBoard(); ITicTacToePlayer player1 = new HumanConsolePlayer(Player.X); ITicTacToePlayer player2 = new HumanConsolePlayer(Player.O); Console.SetWindowSize(80, 48); Console.WriteLine("Ultimate Tic Tac Toe!!!"); bool correctPlayers = false; while (!correctPlayers) { Console.Write("How Many Players? "); int players; correctPlayers = int.TryParse(Console.ReadLine(), out players); if (correctPlayers) { if (players == 2) { player1 = new HumanConsolePlayer(Player.X); player2 = new HumanConsolePlayer(Player.O); } else if (players == 1) { Console.WriteLine("Do you want to play as X or O?"); var response = Console.ReadLine(); if (response?.StartsWith("x", StringComparison.InvariantCultureIgnoreCase) == true) { player1 = new HumanConsolePlayer(Player.X); player2 = new MinMaxAIPlayer(Player.O); } else if (response?.StartsWith("o", StringComparison.InvariantCultureIgnoreCase) == true) { player1 = new MinMaxAIPlayer(Player.X); player2 = new HumanConsolePlayer(Player.O); } else { correctPlayers = false; } } else if (players == 0) { player1 = new MinMaxAIPlayer(Player.X); player2 = new MinMaxAIPlayer(Player.O); } else { correctPlayers = false; } } if (!correctPlayers) { Console.WriteLine("Sorry kiddums, try again!"); } } var startTime = DateTime.UtcNow; string[] player1LastTaunt = { "" }; Taunt p1Taunt = delegate(string msg) { if (player1LastTaunt[0].Equals(msg)) { return; } player1LastTaunt[0] = msg; Console.WriteLine(msg); }; player1.SetTauntDelegate(p1Taunt); string[] player2LastTaunt = { "" }; Taunt p2Taunt = delegate(string msg) { if (player2LastTaunt[0].Equals(msg)) { return; } player2LastTaunt[0] = msg; Console.WriteLine(msg); }; player2.SetTauntDelegate(p2Taunt); var playerTurn = Player.X; while (board.State == GameState.Open) { player1LastTaunt[0] = ""; player2LastTaunt[0] = ""; var validMove = false; while (!validMove) { var move = playerTurn == Player.X ? player1.TakeTurn(board.Clone(cloneMoves: true)) : player2.TakeTurn(board.Clone(cloneMoves: true)); validMove = board.MakeMove(playerTurn, move.OuterCell, move.InnerCell); if (!validMove) { Console.WriteLine("Sorry kiddums, try again!"); } else { Console.Clear(); Console.WriteLine(GetCurrentGameStats(DateTime.UtcNow.Subtract(startTime))); Console.WriteLine(); Console.WriteLine(board.ToString()); } } playerTurn = playerTurn == Player.X ? Player.O : Player.X; } var gameTime = DateTime.UtcNow.Subtract(startTime); _playtime = _playtime.Add(gameTime); _totalPlaytime = _totalPlaytime.Add(gameTime); string stateStr = null; switch (board.State) { case GameState.Xwin: _xWins++; stateStr = "Player X Wins!"; break; case GameState.Owin: _oWins++; stateStr = "Player O Wins!"; break; case GameState.Open: break; case GameState.Draw: _draws++; stateStr = "DRAW!"; break; default: throw new ArgumentOutOfRangeException(); } Console.Clear(); Console.WriteLine(GetGameStats()); Console.WriteLine(); Console.WriteLine(board.ToString()); Console.WriteLine("Game has Ended: " + stateStr); }
/// <summary> /// Check if a number is equal to the taunt /// </summary> /// <param name="taunt">The taunt</param> /// <param name="nb">The number</param> /// <returns>true if equals, false otherwise</returns> public static bool IsEqual(this Taunt taunt, int nb) { return(taunt == (Taunt)nb); }
public override void Initialize(GameObject obj) { enemy = obj.GetComponentInChildren <Taunt>(); }