using System.Collections.Generic; using System.ComponentModel; using Godot; using Godot.Bridge; using Godot.NativeInterop; [ScriptPath("res://Scripts/Bullets/FoxBombs.cs")] public partial class FoxBombs : Node2D { [Export(PropertyHint.None, "")] private Node2D[] bullets; [Export(PropertyHint.None, "")] private float cooldown = 45f; [Export(PropertyHint.None, "")] private float variance; [Export(PropertyHint.None, "")] private float height = 20f; [Export(PropertyHint.None, "")] private float fallSpeed = 0.025f; [Export(PropertyHint.None, "")] private AudioStream bellNoise; [Export(PropertyHint.None, "")] private AudioStream explosion; private List bells = new List(); private List speed = new List(); private float cd; private float floor; public override void _EnterTree() { if (BattleDR.current.enemies[0].HPPercent() < 0.6f || BattleDR.current.enemies[0].spare > 50) { cooldown *= 0.5f; } floor = BattleDR.current.activeBoard.boardSize.Y / 2f - 5f; } public override void _Process(double delta) { if (cd <= 0f) { bells.Add((Node2D)bullets[0].Duplicate()); speed.Add(0f); cd = cooldown + Main.RandomRange(0f - variance, variance); Audio.PlaySound(bellNoise); List list = bells; AddChild(list[list.Count - 1], forceReadableName: false, InternalMode.Disabled); List list2 = bells; list2[list2.Count - 1].Modulate = Main.colorClear; List list3 = bells; list3[list3.Count - 1].ProcessMode = ProcessModeEnum.Inherit; List list4 = bells; list4[list4.Count - 1].Position = new Vector2(Main.RandomRange((0f - BattleDR.current.activeBoard.boardSize.X) / 2f, BattleDR.current.activeBoard.boardSize.X / 2f) * 0.9f, (0f - BattleDR.current.activeBoard.boardSize.Y) / 2f - height); } else { cd -= Main.deltaTime; } if (bells.Count <= 0) { return; } for (int num = bells.Count - 1; num >= 0; num--) { speed[num] += fallSpeed * Main.deltaTime; bells[num].Position += Vector2.Down * speed[num]; bells[num].Modulate = bells[num].Modulate.Lerp(Main.colorWhite, Main.deltaTime * 0.15f); if (bells[num].Position.Y > floor) { CameraController.Shake(10f, 2f); Audio.PlaySound(explosion); Node2D node2D; AddChild(node2D = (Node2D)bullets[1].Duplicate(), forceReadableName: false, InternalMode.Disabled); node2D.Position = bells[num].Position; node2D.ProcessMode = ProcessModeEnum.Inherit; AddChild(node2D = (Node2D)bullets[2].Duplicate(), forceReadableName: false, InternalMode.Disabled); node2D.Position = bells[num].Position; node2D.ProcessMode = ProcessModeEnum.Inherit; bells[num].QueueFree(); bells.RemoveAt(num); speed.RemoveAt(num); } } } }