60 lines
2.0 KiB
C#
60 lines
2.0 KiB
C#
using UnityEngine;
|
|
|
|
public class ResistanceTest : MonoBehaviour
|
|
{
|
|
[Header("Test Settings")]
|
|
public int testLevel = 5;
|
|
public int testPhysicalDamage = 25; // Increased test damage to show more impact
|
|
public int testMagicalDamage = 30; // Increased test damage to show more impact
|
|
|
|
[Header("Results")]
|
|
[SerializeField] private string resistanceInfo;
|
|
[SerializeField] private int effectivePhysicalDamage;
|
|
[SerializeField] private int effectiveMagicalDamage;
|
|
[SerializeField] private bool shieldActive;
|
|
|
|
private enemyScript testEnemy;
|
|
|
|
void Start()
|
|
{
|
|
// Create a test enemy
|
|
GameObject enemyObj = new GameObject("TestEnemy");
|
|
testEnemy = enemyObj.AddComponent<enemyScript>();
|
|
|
|
// Set the enemy level
|
|
testEnemy.SetLevel(testLevel);
|
|
|
|
// Calculate and display results
|
|
CalculateTestResults();
|
|
}
|
|
|
|
void CalculateTestResults()
|
|
{
|
|
if (testEnemy == null) return;
|
|
|
|
resistanceInfo = testEnemy.GetResistanceInfo();
|
|
effectivePhysicalDamage = testEnemy.CalculateEffectiveDamage(testPhysicalDamage, false);
|
|
effectiveMagicalDamage = testEnemy.CalculateEffectiveDamage(testMagicalDamage, true);
|
|
shieldActive = testEnemy.IsShieldActive();
|
|
|
|
Debug.Log($"=== Resistance & Shield Test Results ===");
|
|
Debug.Log($"Enemy Level: {testLevel}");
|
|
Debug.Log($"Resistance: {resistanceInfo}");
|
|
Debug.Log($"Physical Damage: {testPhysicalDamage} -> {effectivePhysicalDamage}");
|
|
Debug.Log($"Magical Damage: {testMagicalDamage} -> {effectiveMagicalDamage}");
|
|
Debug.Log($"Shield Active: {shieldActive}");
|
|
Debug.Log($"Shield Health: {testEnemy.magicalHealth}");
|
|
Debug.Log($"Regular Health: {testEnemy.health}");
|
|
Debug.Log($"===============================");
|
|
}
|
|
|
|
[ContextMenu("Run Test")]
|
|
void RunTest()
|
|
{
|
|
if (testEnemy != null)
|
|
{
|
|
testEnemy.SetLevel(testLevel);
|
|
CalculateTestResults();
|
|
}
|
|
}
|
|
} |