SoldierBuff.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class SoldierBuff : MonoBehaviour
  5. {
  6. private Demonic dem;
  7. private AttackController ac;
  8. private AttributeStatus ats;
  9. private void OnEnable()
  10. {
  11. dem = GetComponent<Demonic>();
  12. ac = dem.attackController;
  13. ats = dem.attributeStatus;
  14. }
  15. public void AddHP(int hp)
  16. {
  17. dem.totalHp += hp;
  18. dem.hp += hp;
  19. dem.uiHp.Show(dem.hp, dem.totalHp);
  20. }
  21. public void AddSummonAttack(int attack)
  22. {
  23. ac.attackMethod[0].attackInfo.damage += attack;
  24. }
  25. public void AddMarchAttack(int attack)
  26. {
  27. for(int i = 1; i < ac.attackMethod.Length; i++)
  28. {
  29. ac.attackMethod[i].attackInfo.damage += attack;
  30. }
  31. }
  32. public void AddArmor(int armor)
  33. {
  34. ats.resistances.armor += armor;
  35. }
  36. public void AddShootDownDamage(int damage)
  37. {
  38. for(int i = 0; i < ac.attackMethod.Length; i++)
  39. {
  40. AttackInfo ai = ac.attackMethod[i].attackInfo;
  41. AttackEffect[] aes = ai.attackEffect;
  42. foreach(AttackEffect ae in aes)
  43. {
  44. if (ae == AttackEffect.ShotDown)
  45. {
  46. AttackInfo.ShotDown sd = ai.shotDown;
  47. sd.landingDamage += damage;
  48. ai.shotDown = sd;
  49. break;
  50. }
  51. }
  52. ac.attackMethod[i].attackInfo = ai;
  53. }
  54. }
  55. }