magic powers refactor WIP

This commit is contained in:
2026-01-19 14:25:38 +01:00
parent f303bfc2a8
commit b988044526
35 changed files with 60438 additions and 59651 deletions

View File

@@ -724,5 +724,57 @@ namespace Beyond
yield return new WaitForSeconds(fireballDamagerDuration);
collider.enabled = false;
}
//placeholder for future methods related to magic attacks
/// <summary>
/// Spells call this to rotate the player before firing
/// </summary>
public IEnumerator RotateTowardsTargetRoutine(Transform target, float duration)
{
if (target == null || duration <= 0) yield break;
float timer = 0f;
while (timer < duration)
{
if (target == null) yield break;
Vector3 dir = (target.position - transform.position);
dir.y = 0;
if (dir.sqrMagnitude > 0.01f)
{
Quaternion look = Quaternion.LookRotation(dir);
transform.rotation = Quaternion.RotateTowards(transform.rotation, look, Time.deltaTime * 500f); // Fast rotation
}
timer += Time.deltaTime;
yield return null;
}
}
/// <summary>
/// Helper to apply Trinket damage (Soulfire) to an object
/// </summary>
public void ApplyDamageModifiers(GameObject spellObject)
{
float mult = Player.Instance.CurrentTrinketStats.soulfireDamageMult;
if (Mathf.Abs(mult - 1f) < 0.01f) return;
var damages = spellObject.GetComponentsInChildren<Invector.vObjectDamage>();
foreach (var d in damages)
{
d.damage.damageValue = Mathf.RoundToInt(d.damage.damageValue * mult);
}
}
public bItem GetEquippedSpellItem()
{
if (powersArea != null && powersArea.equipSlots.Count > 0)
{
// Assuming the logic uses the current selection
// If powersArea tracks selection internally, use powersArea.currentEquippedItem
return powersArea.currentEquippedItem;
}
return null;
}
}
}