From 30860c7fd14e047bafc6a3570a7fe5ab24c3485c Mon Sep 17 00:00:00 2001 From: Salomo309 <109785084+Salomo309@users.noreply.github.com> Date: Fri, 10 May 2024 14:13:54 +0700 Subject: [PATCH] refactor: fix class name, add increase attack from pet --- .../Scripts/Enemy/Jenderal/JenderalAttack.cs | 12 +++++++++++- Assets/Scripts/Enemy/Raja/RajaAttack.cs | 18 +++++++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/Assets/Scripts/Enemy/Jenderal/JenderalAttack.cs b/Assets/Scripts/Enemy/Jenderal/JenderalAttack.cs index f677065..cfaa2d4 100644 --- a/Assets/Scripts/Enemy/Jenderal/JenderalAttack.cs +++ b/Assets/Scripts/Enemy/Jenderal/JenderalAttack.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; using UnityEngine; using UnityEngine.AI; -public class Jenderal : PausibleObject +public class JenderalAttack : PausibleObject { public float timeBetweenAttacks = 0.5f; public int attackDamage = 10; @@ -99,4 +99,14 @@ public class Jenderal : PausibleObject { playerHealth.TakeDamage(playerDamagePerSecond); } + + public void IncreaseAttack(float percentage) + { + float increaseAmount = attackDamage * (percentage / 100f); + + attackDamage += Mathf.RoundToInt(increaseAmount); + + Debug.Log("Attack damage increased by " + percentage + "%"); + } + } diff --git a/Assets/Scripts/Enemy/Raja/RajaAttack.cs b/Assets/Scripts/Enemy/Raja/RajaAttack.cs index 43b80ec..51cb6e4 100644 --- a/Assets/Scripts/Enemy/Raja/RajaAttack.cs +++ b/Assets/Scripts/Enemy/Raja/RajaAttack.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; using UnityEngine; using UnityEngine.AI; -public class Raja : PausibleObject +public class RajaAttack : PausibleObject { public float timeBetweenAttacks = 0.5f; public int attackDamage = 10; @@ -13,6 +13,7 @@ public class Raja : PausibleObject public float playerSlowdownFactor = 0.5f; public int playerDamagePerSecond = 5; public float kerocoSpawnTimer; + private int petIncreaserCount = 0; public GameObject kerocoPrefab; public Transform[] spawnPoints; @@ -134,4 +135,19 @@ public class Raja : PausibleObject Debug.LogWarning("KerocoPrefab atau SpawnPoints belum ditentukan!"); } } + + public void IncreaseAttack(float percentage) + { + float increaseAmount = attackDamage * (percentage / 100f); + + attackDamage += Mathf.RoundToInt(increaseAmount); + + Debug.Log("Attack damage increased by " + percentage + "%"); + + if (petIncreaserCount >= 1) + { + attackDamage += Mathf.RoundToInt(increaseAmount * 0.2f); + Debug.Log("Additional 20% increase applied due to having multiple Pet Increasers"); + } + } } -- GitLab