94 lines
2.7 KiB
C#
94 lines
2.7 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System;
|
|
using UnityEngine;
|
|
using UnityEditor;
|
|
|
|
public class LibraryTurnMethods : MonoBehaviour
|
|
{
|
|
|
|
|
|
public void Attack()
|
|
{
|
|
Enemy _enemy = BaseEnemyTurn.basic.currentEnemy.GetComponent<Enemy>();
|
|
Player.main.ChangeHp(_enemy.enemyConfig.enemyCharacteristics.damage);
|
|
|
|
}
|
|
|
|
|
|
public void SelfHealing()
|
|
{
|
|
|
|
Enemy _enemy = BaseEnemyTurn.basic.currentEnemy.GetComponent<Enemy>();
|
|
int _selfHealing =
|
|
_enemy.enemyConfig.enemyCharacteristics.selfHealing;
|
|
|
|
_enemy.ChangeHp(-_selfHealing);
|
|
}
|
|
|
|
|
|
public void AllyHealing()
|
|
{
|
|
Enemy _enemy = BaseEnemyTurn.basic.currentEnemy.GetComponent<Enemy>();
|
|
int _allyHealing =
|
|
_enemy.enemyConfig.enemyCharacteristics.allyHealing;
|
|
List<GameObject> _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<Enemy>();
|
|
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<Enemy>().ChangeHp(-_allyHealing);
|
|
else
|
|
{
|
|
_allyHealing =
|
|
_enemy.enemyConfig.enemyCharacteristics.selfHealing;
|
|
_currentEnemies[_index].GetComponent<Enemy>().ChangeHp(-_allyHealing);
|
|
}
|
|
}
|
|
|
|
|
|
public void AllHealing()
|
|
{
|
|
Enemy _enemy = BaseEnemyTurn.basic.currentEnemy.GetComponent<Enemy>();
|
|
int _allHealing =
|
|
_enemy.enemyConfig.enemyCharacteristics.allHealing;
|
|
List<GameObject> _currentEnemies = Session.main.currentEnemies;
|
|
for (int i = 0; i < _currentEnemies.Count; i++)
|
|
{
|
|
if (_currentEnemies[i] != null)
|
|
{
|
|
Enemy _allyScript = _currentEnemies[i].GetComponent<Enemy>();
|
|
if (_allHealing != 0)
|
|
_currentEnemies[i].GetComponent<Enemy>().ChangeHp(-_allHealing);
|
|
else
|
|
{
|
|
_allHealing =
|
|
_enemy.enemyConfig.enemyCharacteristics.selfHealing;
|
|
_currentEnemies[i].GetComponent<Enemy>().ChangeHp(-_allHealing);
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|