Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 22.12 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using TMPro;
  5. using UnityEngine.UI;
  6.  
  7. /* Purpose: This script is suppose to handle the entire battle event.
  8. *
  9. *
  10. * SHOULD WE PRESS THE BUTTONS OR USE KEYS LIKE NORMAL POKEMON?
  11. * Alot easier to press the buttons with the mouse i guess. (code wise)
  12. *
  13. * TODO: When making this script its with the intent to handle everything in the battle, like both sides pokemons etc.
  14. * Why in the world did i make BattlePokemon and WildPokemon? Shouldnt they be in this script aswell?
  15. * Might just work to have them seperate and have a reference to them here.
  16. * Made By: Jesper, 22/6-19
  17. */
  18.  
  19. public class BattleScript : MonoBehaviour
  20. {
  21. public Player player;
  22.  
  23. [Header("Pokemon Info")]
  24. //Here we create a new list to hold all pokemons present in the battle(on the field and in pokeballs).
  25. public List<PokemonTemplate> jointPokemon = new List<PokemonTemplate>();
  26. public GameObject currentTeamPokemonGameObject;
  27. public GameObject currentEnemyPokemonGameObject;
  28. public GameObject pokemonPanel;
  29.  
  30. //We need to know how many pokemons we and the enemy have, aswelll as what index in jointPokemon are currently battling.
  31. //TODO: Remove SerializeField
  32. [SerializeField] private float longWaitTime;
  33. [SerializeField] private float shortWaitTime;
  34. public int teamPokemonQuantity;
  35. [SerializeField] private int teamPokemonAbilityQuantity;
  36. public int currentTeamPokemonIndex;
  37. [SerializeField] private int currentTeamPokemonAbilityIndex;
  38. [SerializeField] private int enemyPokemonQuantity;
  39. [SerializeField] private int currentEnemyPokemonIndex;
  40. [SerializeField] private int currentEnemyPokemonAbilityIndex;
  41. //Used so the faster pokemon can attack first and then the slower pokemon.
  42. [SerializeField] private int fasterPokemonIndex;
  43. [SerializeField] private int slowerPokemonIndex;
  44. [SerializeField] private int fasterPokemonAbilityIndex;
  45. [SerializeField] private int slowerPokemonAbilityIndex;
  46. [SerializeField] private bool turnInProgress = false;
  47. [SerializeField] private bool criticalStrike = false;
  48. [SerializeField] private bool panelIsOpen = false;
  49.  
  50. //Battle Specific stuff we might use
  51. //TODO: Remove SerializeField
  52. [SerializeField] private string weather; //Certain weather makes moves hit hard/less.
  53.  
  54. //Things that will be written throughout the battle.
  55. //TODO: Is this how we should make the texts?
  56. private string wildPokemonAppearMsg;
  57. private string sendOutTeamPokemon;
  58. private string teamPokemonAttackMsg;
  59. private string enemyPokemonAttackMsg;
  60. private string criticalStrikeMsg;
  61. private string lvlUpMsg;
  62. private string superEffectiveMsg;
  63. private string notVeryEffectiveMsg;
  64. private string foePokemonFaintedMsg;
  65. private string teamPokemonFaintedMsg;
  66. private string awardExpMsg;
  67.  
  68. [Header("Buttons and Texts")]
  69. public TextMeshProUGUI battleText;
  70. public List<Button> attackButtons = new List<Button>();
  71. private List<TextMeshProUGUI> attackTexts = new List<TextMeshProUGUI>();
  72. public Button pokemonButton;
  73. public Button bagButton;
  74. public Button runButton;
  75. public TextMeshProUGUI teamPokemonNameTmpro;
  76. public TextMeshProUGUI teamPokemonHealthTmpro;
  77. public TextMeshProUGUI teamPokemonLvlTmpro;
  78. public Image teamPokemonHealthBar;
  79. public TextMeshProUGUI enemyPokemonNameTmpro;
  80. public TextMeshProUGUI enemyPokemonHealthTmpro;
  81. public TextMeshProUGUI enemyPokemonLvlTmpro;
  82. public Image enemyPokemonHealthBar;
  83.  
  84. void Update()
  85. {
  86. if (Input.GetKeyDown(KeyCode.Escape) && panelIsOpen)
  87. {
  88. ShowPokemonMenu();
  89. }
  90. }
  91. //When the Battle Script is enabled we need to put the myPokemon and enemyPokemon list into that of jointPokemon.
  92. void OnEnable()
  93. {
  94. //Always close pokemonPanel when we enter a battle.
  95. pokemonPanel.SetActive(false);
  96. //Add all myPokemons to the list and set how many pokemons we brought to the battle.
  97. foreach (PokemonTemplate pokemon in player.myPokemons)
  98. {
  99. jointPokemon.Add(pokemon);
  100. }
  101. teamPokemonQuantity = jointPokemon.Count;
  102.  
  103. //Add all enemyPokemons to the list and set how many pokemons the enemy brought to the battle.
  104. foreach (PokemonTemplate pokemon in player.enemyPokemon)
  105. {
  106. jointPokemon.Add(pokemon);
  107. }
  108. enemyPokemonQuantity = jointPokemon.Count - teamPokemonQuantity;
  109.  
  110. //Check through all the pokemons we brought and take the first alive pokemon and make it the one we send into battle.
  111. for (int i = 0; i < teamPokemonQuantity; i++)
  112. {
  113. if (jointPokemon[i].stats.Health > 0)
  114. {
  115. currentTeamPokemonIndex = i;
  116. break;
  117. }
  118. }
  119. teamPokemonAbilityQuantity = jointPokemon[currentTeamPokemonIndex].moves.Count;
  120.  
  121. //The enemy should always have alive pokemons when we first get into battle, so we set their pokemon to be the first index after ours
  122. currentEnemyPokemonIndex = teamPokemonQuantity;
  123.  
  124. //Find the Texts in the attack buttons
  125. for (int i = 0; i < 4; i++)
  126. {
  127. attackTexts.Add(attackButtons[i].gameObject.GetComponentInChildren<TextMeshProUGUI>());
  128. }
  129.  
  130. int xRand = Random.Range(4, 5);
  131. int zRand = Random.Range(4, 5);
  132. //The first thing we need to do is to spawn our Pokemon and the enemy Pokemon.
  133. //TODO: Make it check for first alive pokemon.
  134.  
  135. Debug.Log("Should spawn Pokemons/" + jointPokemon[currentTeamPokemonIndex].PokemonName);
  136. if (currentTeamPokemonGameObject == null)
  137. {
  138. currentTeamPokemonGameObject = (GameObject)Instantiate((Resources.Load("Pokemons/" + jointPokemon[currentTeamPokemonIndex].PokemonName)),
  139. new Vector3(xRand, 2, zRand) + player.transform.position, new Quaternion(0, 0, 0, 0));
  140. }
  141. if (currentEnemyPokemonGameObject == null)
  142. {
  143. currentEnemyPokemonGameObject = (GameObject)Instantiate((Resources.Load("Pokemons/" + jointPokemon[currentEnemyPokemonIndex].PokemonName)),
  144. new Vector3(-xRand, 2, -zRand) + player.transform.position, new Quaternion(0, 0, 0, 0));
  145. }
  146.  
  147.  
  148. //Make the pokemon face eachother
  149. currentTeamPokemonGameObject.transform.LookAt(currentEnemyPokemonGameObject.transform);
  150. currentEnemyPokemonGameObject.transform.LookAt(currentTeamPokemonGameObject.transform);
  151.  
  152. UpdateUI();
  153. EnableButtons();
  154. StartCoroutine(WildPokemonAppearMsg());
  155. }
  156. public void UpdateUI()
  157. {
  158. for (int i = 0; i < 4; i++)
  159. {
  160. if (i < teamPokemonAbilityQuantity)
  161. {
  162. attackTexts[i].text = jointPokemon[currentTeamPokemonIndex].moves[i].abilityName;
  163. }
  164. else
  165. {
  166. attackTexts[i].text = "";
  167. }
  168.  
  169. }
  170.  
  171. enemyPokemonNameTmpro.text = jointPokemon[currentEnemyPokemonIndex].PokemonName;
  172. enemyPokemonHealthTmpro.text = "Health: " + jointPokemon[currentEnemyPokemonIndex].stats.Health.ToString()+ "/" +
  173. jointPokemon[currentEnemyPokemonIndex].maxStats.Health.ToString();
  174. enemyPokemonLvlTmpro.text = "Lvl: " + jointPokemon[currentEnemyPokemonIndex].lvl.ToString();
  175. enemyPokemonHealthBar.fillAmount = (float)jointPokemon[currentEnemyPokemonIndex].stats.Health / jointPokemon[currentEnemyPokemonIndex].maxStats.Health;
  176. teamPokemonNameTmpro.text = jointPokemon[currentTeamPokemonIndex].PokemonName;
  177. teamPokemonHealthTmpro.text = "Health: " + jointPokemon[currentTeamPokemonIndex].stats.Health.ToString() + "/" +
  178. jointPokemon[currentTeamPokemonIndex].maxStats.Health.ToString();
  179. teamPokemonLvlTmpro.text = "Lvl: " + jointPokemon[currentTeamPokemonIndex].lvl.ToString();
  180. teamPokemonHealthBar.fillAmount = (float)jointPokemon[currentTeamPokemonIndex].stats.Health / jointPokemon[currentTeamPokemonIndex].maxStats.Health;
  181. }
  182. //sets the index of the chosen ability to the corrent one and then calls PrePerformTurn.
  183. //These functions are gonna be called from the ui buttons.
  184. public void Attack1()
  185. {
  186. currentTeamPokemonAbilityIndex = 0;
  187. AttackChosen();
  188. }
  189. public void Attack2()
  190. {
  191. currentTeamPokemonAbilityIndex = 1;
  192. AttackChosen();
  193. }
  194. public void Attack3()
  195. {
  196. currentTeamPokemonAbilityIndex = 2;
  197. AttackChosen();
  198. }
  199. public void Attack4()
  200. {
  201. currentTeamPokemonAbilityIndex = 3;
  202. AttackChosen();
  203. }
  204. public void ShowPokemonMenu()
  205. {
  206. panelIsOpen = !panelIsOpen;
  207. pokemonPanel.SetActive(panelIsOpen);
  208. }
  209. public void PokemonMenuDuringBattle()
  210. {
  211. //Here we need to open the pokemon menu during battle.
  212. //TODO: Make the pokemon menu...
  213. //If we change our pokemon we waste our turn like in the pokemon games, or?
  214. //PerformTurn();
  215. }
  216. public void BagMenuDuringBattle()
  217. {
  218. //Here we need to open the bag menu during battle.
  219. //TODO: Make the bag menu...
  220. //If we use an item we waste our turn like in the pokemon games, or?
  221. //PerformTurn();
  222. }
  223. public void RunAwayFromBattle()
  224. {
  225. //Run away from the battle.
  226. //TODO: We need to restore camera angle to what it was previously
  227. //TODO: We need to make our character visible again.
  228. //TODO: We need to destroy our 2 prefabs for BattlePokemon and EnemyPokemon.
  229.  
  230. jointPokemon.Clear();
  231. Destroy(currentTeamPokemonGameObject);
  232. Destroy(currentEnemyPokemonGameObject);
  233. StopAllCoroutines();
  234. GameEvents.PokemonBattleOver(); //TODO: This should probably be made better.
  235.  
  236. }
  237. //We chose to do an attack, make sure everything is fine and then send it to startTurn.
  238. public void AttackChosen()
  239. {
  240. //Check if the chosen move (attack1 = index 0) in our pokemon from the joint list
  241. if (jointPokemon[currentTeamPokemonIndex].moves[currentTeamPokemonAbilityIndex].PP > 0)
  242. {
  243. //Check what form ability1 is and set the flag evaluateVariable accordingly so later functions know.
  244. if (jointPokemon[currentTeamPokemonIndex].moves[currentTeamPokemonAbilityIndex].abilityForm == "Status")
  245. {
  246. //TODO: Fix it so we can do status abilities!
  247. Debug.Log("We cant do status abilities yet!");
  248. }
  249. else
  250. {
  251. //Check whatever pokemon is faster and set that index as faster.
  252. //TODO: We should add a priority move check here, IE Quick Attack!
  253. if (jointPokemon[currentTeamPokemonIndex].stats.Speed > jointPokemon[currentEnemyPokemonIndex].stats.Speed)
  254. {
  255. fasterPokemonIndex = currentTeamPokemonIndex;
  256. fasterPokemonAbilityIndex = currentTeamPokemonAbilityIndex;
  257. slowerPokemonIndex = currentEnemyPokemonIndex;
  258. slowerPokemonAbilityIndex = currentEnemyPokemonAbilityIndex;
  259. }
  260. else
  261. {
  262. fasterPokemonIndex = currentEnemyPokemonIndex;
  263. fasterPokemonAbilityIndex = currentEnemyPokemonAbilityIndex;
  264. slowerPokemonIndex = currentTeamPokemonIndex;
  265. slowerPokemonAbilityIndex = currentTeamPokemonAbilityIndex;
  266. }
  267.  
  268. //Start the mainBattle script.
  269. StartCoroutine(startTurn());
  270. }
  271. }
  272. else
  273. {
  274. //If we didnt have enough PP for the chosen move, let user know that user have to pick another one.
  275. Debug.Log("Not enough PP, please chose again");
  276. }
  277.  
  278.  
  279. }
  280.  
  281. //This function is in charge of the entire battle scenario.
  282. //TODO: Change so we can swap pokemon and come in midway?
  283. IEnumerator startTurn()
  284. {
  285. //Trigger the event that the turn is initiated.
  286. Debug.Log("BattleTurnInitiated");
  287. DisableButtons();
  288.  
  289. //Faster Pokemon Attacks. Check what Index is the faster pokemon and write the correct msg.
  290. if (fasterPokemonIndex == currentTeamPokemonIndex)
  291. {
  292. yield return StartCoroutine(TeamPokemonAttackMsg());
  293. }
  294. else
  295. {
  296. yield return StartCoroutine(EnemyPokemonAttackMsg());
  297. }
  298.  
  299. yield return new WaitForSeconds(longWaitTime);
  300. //Here we should also check if its super effective or not!
  301.  
  302. //If the hit was a critical strike, write it.
  303. if (criticalStrike == true)
  304. {
  305. yield return StartCoroutine(CriticalStrikeMsg());
  306. yield return new WaitForSeconds(longWaitTime);
  307. criticalStrike = false;
  308. }
  309.  
  310. //This is where the damage is applied.
  311. jointPokemon[slowerPokemonIndex].stats.Health -= DamageCalculator(fasterPokemonIndex, fasterPokemonAbilityIndex, slowerPokemonIndex); ;
  312. if (jointPokemon[slowerPokemonIndex].stats.Health < 0)
  313. {
  314. jointPokemon[slowerPokemonIndex].stats.Health = 0;
  315. }
  316. UpdateUI();
  317.  
  318. //Slower Pokemon Attacks.
  319. if (fasterPokemonIndex != currentTeamPokemonIndex)
  320. {
  321. yield return StartCoroutine(TeamPokemonAttackMsg());
  322. }
  323. else
  324. {
  325. yield return StartCoroutine(EnemyPokemonAttackMsg());
  326. }
  327.  
  328.  
  329. yield return new WaitForSeconds(longWaitTime);
  330. //Here we should also check if its super effective or not!
  331.  
  332. //Check if crit and write if so.
  333. if (criticalStrike == true)
  334. {
  335. yield return StartCoroutine(CriticalStrikeMsg());
  336. yield return new WaitForSeconds(longWaitTime);
  337. criticalStrike = false;
  338.  
  339. }
  340. //This is where the damage is applied.
  341. jointPokemon[fasterPokemonIndex].stats.Health -= DamageCalculator(slowerPokemonIndex, slowerPokemonAbilityIndex, fasterPokemonIndex);
  342. if (jointPokemon[fasterPokemonIndex].stats.Health < 0)
  343. {
  344. jointPokemon[fasterPokemonIndex].stats.Health = 0;
  345. }
  346. UpdateUI();
  347. yield return new WaitForSeconds(longWaitTime);
  348.  
  349. EnableButtons();
  350. }
  351.  
  352. //In this function we see if any of the current active pokemons died.
  353. public void EvalutatePokemons()
  354. {
  355. if (jointPokemon[currentTeamPokemonIndex].stats.Health <= 0)
  356. {
  357.  
  358. }
  359. }
  360. //We use this function to write out msgs one letter at the time.
  361. IEnumerator TypeSentence(string _msg)
  362. {
  363. battleText.text = "";
  364. foreach (char letter in _msg.ToCharArray())
  365. {
  366. battleText.text += letter;
  367. yield return null;
  368. }
  369. yield return new WaitForSeconds(longWaitTime);
  370.  
  371. }
  372. //We call this to make the user not able to press the buttons.
  373. public void DisableButtons()
  374. {
  375. for (int i = 0; i < 4; i++)
  376. {
  377. attackButtons[i].interactable = false;
  378. }
  379.  
  380.  
  381. pokemonButton.interactable = false;
  382. bagButton.interactable = false;
  383. runButton.interactable = false;
  384. }
  385. //We call this to make the user able to press the buttons.
  386. public void EnableButtons()
  387. {
  388. for (int i = 0; i < 4; i++)
  389. {
  390. attackButtons[i].interactable = false;
  391. }
  392.  
  393. pokemonButton.interactable = true;
  394. bagButton.interactable = true;
  395. runButton.interactable = true;
  396.  
  397.  
  398. if (jointPokemon[currentTeamPokemonIndex].moves.Count >= 1)
  399. attackButtons[0].interactable = true;
  400.  
  401. if (jointPokemon[currentTeamPokemonIndex].moves.Count >= 2)
  402. attackButtons[1].interactable = true;
  403.  
  404. if (jointPokemon[currentTeamPokemonIndex].moves.Count >= 3)
  405. attackButtons[2].interactable = true;
  406.  
  407. if (jointPokemon[currentTeamPokemonIndex].moves.Count >= 4)
  408. attackButtons[3].interactable = true;
  409.  
  410. }
  411. //Message we display when a wild pokemon appears
  412. IEnumerator WildPokemonAppearMsg()
  413. {
  414. wildPokemonAppearMsg = "A wild " + jointPokemon[currentEnemyPokemonIndex].PokemonName + " appears!";
  415. yield return StartCoroutine(TypeSentence(wildPokemonAppearMsg));
  416. }
  417. //Msg we display when we send out a pokemon, either in the start or when we change pokemon.
  418. IEnumerator SendOutTeamPokemonMsg()
  419. {
  420. sendOutTeamPokemon = "Go! " + jointPokemon[currentTeamPokemonIndex].PokemonName;
  421. yield return StartCoroutine(TypeSentence(sendOutTeamPokemon));
  422. }
  423. //Msg we display when our pokemon attack.
  424. IEnumerator TeamPokemonAttackMsg()
  425. {
  426. teamPokemonAttackMsg = jointPokemon[currentTeamPokemonIndex].PokemonName + " used " +
  427. jointPokemon[currentTeamPokemonIndex].moves[currentTeamPokemonAbilityIndex].abilityName;
  428. yield return StartCoroutine(TypeSentence(teamPokemonAttackMsg));
  429. }
  430. //Msg we display when our pokemon attack.
  431. IEnumerator EnemyPokemonAttackMsg()
  432. {
  433. enemyPokemonAttackMsg = "Foe " + jointPokemon[currentEnemyPokemonIndex].PokemonName + " used " +
  434. jointPokemon[currentEnemyPokemonIndex].moves[currentEnemyPokemonAbilityIndex].abilityName;
  435. yield return StartCoroutine(TypeSentence(enemyPokemonAttackMsg));
  436. }
  437. IEnumerator CriticalStrikeMsg()
  438. {
  439. criticalStrikeMsg = "It's a critical strike!";
  440. yield return StartCoroutine(TypeSentence(criticalStrikeMsg));
  441. }
  442. //Msg we display when an attack is super effective.
  443. IEnumerator SuperEffectiveMsg()
  444. {
  445. superEffectiveMsg = "It's super effective!";
  446. yield return StartCoroutine(TypeSentence(superEffectiveMsg));
  447. }
  448. //Msg we display when an attack is not very effective.
  449. IEnumerator NotVeryEffectiveMsg()
  450. {
  451. notVeryEffectiveMsg = "It's not very effective";
  452. yield return StartCoroutine(TypeSentence(notVeryEffectiveMsg));
  453. }
  454. //Msg we display when an enemy pokemon faints.
  455. IEnumerator FoePokemonFaintedMsg()
  456. {
  457. foePokemonFaintedMsg = "Foe " + jointPokemon[currentEnemyPokemonIndex].PokemonName + " fainted!";
  458. yield return StartCoroutine(TypeSentence(foePokemonFaintedMsg));
  459. }
  460. //Msg we display when a team pokemon faints.
  461. IEnumerator TeamPokemonFaintedMsg()
  462. {
  463. teamPokemonFaintedMsg = jointPokemon[currentTeamPokemonIndex].PokemonName + " fainted!";
  464. yield return StartCoroutine(TypeSentence(teamPokemonFaintedMsg));
  465. }
  466. //Msg we display when we award exp to a team pokemon.
  467. IEnumerator AwardExpMsg(int _expAmount)
  468. {
  469. awardExpMsg = jointPokemon[currentTeamPokemonIndex].PokemonName + " gained " + _expAmount.ToString() + " Exp. Points!";
  470. yield return StartCoroutine(TypeSentence(awardExpMsg));
  471. }
  472. //Msg we display if a pokemons lvls up.
  473. IEnumerator LvlUpMsg()
  474. {
  475. lvlUpMsg = jointPokemon[currentTeamPokemonIndex].PokemonName + " grew to level " + jointPokemon[currentTeamPokemonIndex].lvl + "!";
  476. yield return StartCoroutine(TypeSentence(lvlUpMsg));
  477. }
  478.  
  479. //This is where the damage formula is appled.
  480. //See https://bulbapedia.bulbagarden.net/wiki/Damage for how the equation.
  481. public int DamageCalculator(int _attackPokemonIndex, int _attackMoveIndex, int _defendPokemonIndex)
  482. {
  483. float _weather = 1.0f;
  484. //Check if the ability is boosted by the weather.
  485. if (jointPokemon[_attackPokemonIndex].moves[_attackMoveIndex].abilityType == weather)
  486. {
  487. _weather = 1.5f;
  488. }
  489. float _stab = 1.0f;
  490. //Check if the ability is boosted by stab.
  491. if (jointPokemon[_attackPokemonIndex].moves[_attackMoveIndex].abilityType == jointPokemon[_attackPokemonIndex].type1 ||
  492. jointPokemon[_attackPokemonIndex].moves[_attackMoveIndex].abilityType == jointPokemon[_attackPokemonIndex].type2)
  493. {
  494. _stab = 1.5f;
  495. }
  496. float _crit = 1.0f;
  497. //20% chance of crit
  498. //TODO: What should the chance to crit be?
  499. if (Random.Range(0, 100) <= 20)
  500. {
  501. _crit = 1.5f;
  502. criticalStrike = true;
  503. Debug.Log("It is a critical hit!");
  504. }
  505. //Random multiplier between 0.85-1;
  506. float _random = (float)(Random.Range(85, 100)) / 100;
  507. //TODO: hardcoding _badge to 1.0 for now, dont know if we should use it.
  508. float _badge = 1.0f;
  509. //TODO: We need to make a super effective check!
  510. float _type = 1.0f;
  511. //TODO: Hardcoding burn to one for now, dont know if we should use it.
  512. float _burn = 1.0f;
  513. //TODO: Hardcoding targets to 1 since we probably arent gonna fight 2x pokemon.
  514. float _targets = 1;
  515. int _level = jointPokemon[_attackPokemonIndex].lvl;
  516. int _A;
  517. int _D;
  518. if (jointPokemon[_attackPokemonIndex].moves[_attackMoveIndex].abilityForm == "Physical")
  519. {
  520. _A = jointPokemon[_attackPokemonIndex].stats.Attack;
  521. _D = jointPokemon[_defendPokemonIndex].stats.Defence;
  522. }
  523. else if (jointPokemon[_attackPokemonIndex].moves[_attackMoveIndex].abilityForm == "Special")
  524. {
  525. _A = jointPokemon[_attackPokemonIndex].stats.Sp_Attack;
  526. _D = jointPokemon[_defendPokemonIndex].stats.Sp_Defence;
  527. }
  528. else
  529. {
  530. _A = 1;
  531. _D = 1;
  532. Debug.Log("wrong assignment of _A and _D in BattleScripts, DamageCalculation function");
  533. }
  534.  
  535. int _power = jointPokemon[_attackPokemonIndex].moves[_attackMoveIndex].ability.power;
  536. float _modifier = _targets * _weather * _badge * _crit * _random * _stab * _type * _burn;
  537. int _damage = (int)(((2.5 * _level + 2) * _power * _A / _D / 50 + 2) * _modifier);
  538. Debug.Log("Damage dealt: " + _damage);
  539. return _damage;
  540. }
  541. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement