using System.Collections; using System.Collections.Generic; using System; using UnityEngine; using UnityEditor; public class LibraryTurnMethods : MonoBehaviour { [SerializeField] Enemy enemy; public void Attack() { Player.main.ChangeHp(enemy.enemyConfig.enemyCharacteristics.damage); } public void SelfHealing() { int _selfHealing = enemy.enemyConfig.enemyCharacteristics.selfHealing; enemy.ChangeHp(-_selfHealing); } public void AllyHealing() { int _allyHealing = enemy.enemyConfig.enemyCharacteristics.allyHealing; List _currentEnemies = Session.main.currentEnemies; int _index = 0; int _max = 0; for (int i = 0; i < _currentEnemies.Count; i++) { if (_currentEnemies[i] != null) { Enemy _allyScript = _currentEnemies[i].GetComponent(); int _hp = _allyScript.CheckHp(); if (_allyScript.enemyConfig.enemyCharacteristics.maxHp - _hp > _max) { _max = _allyScript.enemyConfig.enemyCharacteristics.maxHp - _hp; _index = i; } } } if(_currentEnemies[_index] != null) { return; } if (_allyHealing != 0) _currentEnemies[_index].GetComponent().ChangeHp(-_allyHealing); else { _allyHealing = enemy.enemyConfig.enemyCharacteristics.selfHealing; _currentEnemies[_index].GetComponent().ChangeHp(-_allyHealing); } } public void AllHealing() { int _allHealing = enemy.enemyConfig.enemyCharacteristics.allHealing; List _currentEnemies = Session.main.currentEnemies; for (int i = 0; i < _currentEnemies.Count; i++) { if (_currentEnemies[i] != null) { Enemy _allyScript = _currentEnemies[i].GetComponent(); if (_allHealing != 0) _currentEnemies[i].GetComponent().ChangeHp(-_allHealing); else { _allHealing = enemy.enemyConfig.enemyCharacteristics.selfHealing; _currentEnemies[i].GetComponent().ChangeHp(-_allHealing); } } } } }