2022-01-13 11:00:37 +03:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System;
|
|
|
|
using UnityEngine;
|
|
|
|
using UnityEditor;
|
|
|
|
|
|
|
|
public class LibraryTurnMethods : MonoBehaviour
|
|
|
|
{
|
2022-01-15 23:26:40 +03:00
|
|
|
private Enemy enemy;
|
2022-01-14 10:42:43 +03:00
|
|
|
|
2022-01-15 23:26:40 +03:00
|
|
|
|
|
|
|
private void Awake()
|
|
|
|
{
|
|
|
|
enemy = GetComponent<Enemy>();
|
|
|
|
}
|
2022-01-13 11:00:37 +03:00
|
|
|
public void Attack()
|
|
|
|
{
|
2022-01-15 23:26:40 +03:00
|
|
|
|
2022-01-15 10:29:16 +03:00
|
|
|
Player.main.ChangeHp(enemy.enemyConfig.enemyCharacteristics.damage);
|
2022-01-14 10:42:43 +03:00
|
|
|
|
2022-01-13 11:00:37 +03:00
|
|
|
}
|
2022-01-14 10:42:43 +03:00
|
|
|
|
|
|
|
|
2022-01-15 23:26:40 +03:00
|
|
|
public void HealingSelf()
|
2022-01-13 11:00:37 +03:00
|
|
|
{
|
|
|
|
|
2022-01-15 23:26:40 +03:00
|
|
|
int _selfHealing =
|
|
|
|
enemy.enemyConfig.enemyCharacteristics.selfHealing;
|
2022-01-14 10:42:43 +03:00
|
|
|
|
2022-01-15 10:29:16 +03:00
|
|
|
enemy.ChangeHp(-_selfHealing);
|
2022-01-14 10:42:43 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-01-15 23:26:40 +03:00
|
|
|
public void HealingAlly()
|
2022-01-14 10:42:43 +03:00
|
|
|
{
|
|
|
|
int _allyHealing =
|
2022-01-15 10:29:16 +03:00
|
|
|
enemy.enemyConfig.enemyCharacteristics.allyHealing;
|
2022-01-14 10:42:43 +03:00
|
|
|
List<GameObject> _currentEnemies = Session.main.currentEnemies;
|
|
|
|
int _index = 0;
|
|
|
|
int _max = 0;
|
|
|
|
for (int i = 0; i < _currentEnemies.Count; i++)
|
|
|
|
{
|
2022-01-15 23:26:40 +03:00
|
|
|
|
|
|
|
Enemy _allyScript = _currentEnemies[i].GetComponent<Enemy>();
|
|
|
|
int _hp = _allyScript.CheckHp();
|
|
|
|
if (_allyScript.enemyConfig.enemyCharacteristics.maxHp - _hp > _max)
|
2022-01-14 10:42:43 +03:00
|
|
|
{
|
2022-01-15 23:26:40 +03:00
|
|
|
_max = _allyScript.enemyConfig.enemyCharacteristics.maxHp - _hp;
|
|
|
|
_index = i;
|
2022-01-14 10:42:43 +03:00
|
|
|
}
|
|
|
|
}
|
2022-01-15 23:26:40 +03:00
|
|
|
if (_currentEnemies[_index] == null)
|
2022-01-14 12:25:32 +03:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2022-01-15 23:26:40 +03:00
|
|
|
_currentEnemies[_index].GetComponent<Enemy>().ChangeHp(-_allyHealing);
|
2022-01-14 10:42:43 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-01-15 23:26:40 +03:00
|
|
|
public void HealingAll()
|
2022-01-14 10:42:43 +03:00
|
|
|
{
|
|
|
|
int _allHealing =
|
2022-01-15 10:29:16 +03:00
|
|
|
enemy.enemyConfig.enemyCharacteristics.allHealing;
|
2022-01-14 10:42:43 +03:00
|
|
|
List<GameObject> _currentEnemies = Session.main.currentEnemies;
|
|
|
|
for (int i = 0; i < _currentEnemies.Count; i++)
|
|
|
|
{
|
2022-01-15 23:26:40 +03:00
|
|
|
Enemy _allyScript = _currentEnemies[i].GetComponent<Enemy>();
|
|
|
|
_currentEnemies[i].GetComponent<Enemy>().ChangeHp(-_allHealing);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public void AddArmorSelf()
|
|
|
|
{
|
|
|
|
int _addArmor =
|
|
|
|
enemy.enemyConfig.enemyCharacteristics.addArmorSelf;
|
|
|
|
enemy.AddArmor(_addArmor);
|
|
|
|
}
|
|
|
|
public void AddArmorAlly()
|
|
|
|
{
|
|
|
|
int _addArmorAlly =
|
|
|
|
enemy.enemyConfig.enemyCharacteristics.addArmorAlly;
|
|
|
|
List<GameObject> _currentEnemies = Session.main.currentEnemies;
|
|
|
|
int _index = 0;
|
|
|
|
int _max = 0;
|
|
|
|
for (int i = 0; i < _currentEnemies.Count; i++)
|
|
|
|
{
|
|
|
|
Enemy _allyScript = _currentEnemies[i].GetComponent<Enemy>();
|
|
|
|
int _hp = _allyScript.CheckHp();
|
|
|
|
if (_allyScript.enemyConfig.enemyCharacteristics.maxHp - _hp > _max)
|
2022-01-14 10:42:43 +03:00
|
|
|
{
|
2022-01-15 23:26:40 +03:00
|
|
|
_max = _allyScript.enemyConfig.enemyCharacteristics.maxHp - _hp;
|
|
|
|
_index = i;
|
2022-01-14 10:42:43 +03:00
|
|
|
}
|
|
|
|
}
|
2022-01-15 23:26:40 +03:00
|
|
|
if (_currentEnemies[_index] == null)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
_currentEnemies[_index].GetComponent<Enemy>().AddArmor(_addArmorAlly);
|
2022-01-14 10:42:43 +03:00
|
|
|
|
2022-01-13 11:00:37 +03:00
|
|
|
}
|
2022-01-15 23:26:40 +03:00
|
|
|
public void AddArmorAll()
|
|
|
|
{
|
|
|
|
int _addArmorAll =
|
|
|
|
enemy.enemyConfig.enemyCharacteristics.addArmorAll;
|
|
|
|
List<GameObject> _currentEnemies = Session.main.currentEnemies;
|
|
|
|
for (int i = 0; i < _currentEnemies.Count; i++)
|
|
|
|
{
|
|
|
|
Enemy _allyScript = _currentEnemies[i].GetComponent<Enemy>();
|
|
|
|
_currentEnemies[i].GetComponent<Enemy>().AddArmor(_addArmorAll);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-01-13 11:00:37 +03:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2022-01-14 10:42:43 +03:00
|
|
|
|