magic powers refactor WIP
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user