//Misc methods private void UpdateButton() { //Updates the button text, clickability, etc. //If it's out of bounds, disable the button if (moveNum >= battleUIManager.playerPokemon.knownMovesCount) { DisableButton(); return; } //Get the move IndividualPokemonMove move = battleUIManager.playerPokemon.GetMove(moveNum); //If the move is null, disable button if (move == null) { DisableButton(); return; } //Change the button's text to match the move name text.text = move.entry.moveName; button.interactable = true; //If there's no PP left, disable button if (move.currentPP <= 0) { text.text += "(No PP)"; button.interactable = false; } }
//Moves public void LearnMove(DexID moveID) { //Learns a move //Throw an error if too many moves if (knownMoves.Count >= MAX_KNOWN_MOVES) { throw new TooManyMovesException(); } //Learn the move IndividualPokemonMove indMove = new IndividualPokemonMove(moveID, 0); knownMoves.Add(indMove); }
private IEnumerator ExecuteCommand(BattleCommand command) { //Actually execute the command executingCommand = true; //Determine which set of display objects to use BattlePokemonDisplay userDisplay = playerDisplay; ScrollingTextbox userTextbox = playerTextbox; BattlePokemonDisplay targetDisplay = enemyDisplay; if (command.userPokemon == enemyPokemon) { userTextbox = enemyTextbox; userDisplay = enemyDisplay; targetDisplay = playerDisplay; } //Display the command text userTextbox.text = command.text; //Execute the move if (command.commandType == BattleCommandType.useMove) { IndividualPokemon user = command.userPokemon; IndividualPokemon target = command.targetPokemon; IndividualPokemonMove move = user.GetMove(command.moveToUse); //Start the command's animation float waitTime = userDisplay.GenericMoveAnimation(move.entry.genericAnimationID); yield return(new WaitForSecondsOrSkip(waitTime)); //Use the move user.GetMove(command.moveToUse).Use(user, target); //Start flashing targetDisplay.TakeDamage(); } executingCommand = false; yield return(null); }
public void ForgetMove(IndividualPokemonMove move) { //Forgets a move knownMoves.Remove(move); }