reworking effects, turning them into their own scene for replicability

This commit is contained in:
2026-02-03 03:37:58 -05:00
parent 36b934b200
commit 435fbc7ba2
32 changed files with 321 additions and 172 deletions

View File

@@ -0,0 +1,61 @@
using Godot;
using System;
public partial class ClickEffect : Effect
{
public bool _available;
public int _calls = 0, _maxCalls = 0;
public float _timerSeconds;
public Timer _timer;
public override void _Ready()
{
base._Ready();
_timer = GetNode<Timer>("Timer");
}
public override void _Process(double delta)
{
base._Process(delta);
if (_contact._button._phone._running)
{
_contact._button._progressBar.Value = Math.Round(_timer.TimeLeft / _timerSeconds * 100, 0);
}
}
public override void Fire()
{
base.Fire();
if (_available && (_calls <= _maxCalls || _maxCalls == 0))
{
_calls++;
_timer.Start(_timerSeconds);
}
}
public override void End()
{
_contact._button._progressBar.Value = 0;
}
public virtual void SetTimer(int SECONDS)
{
_timerSeconds = SECONDS;
}
public override void Start()
{
base.Start();
_available = false;
_calls = 0;
_timer.Start(_timerSeconds);
}
private void OnTimerTimeout()
{
if (_calls <= _maxCalls || _maxCalls == 0)
{
_available = true;
}
}
}

View File

@@ -0,0 +1 @@
uid://b2h6prsg8m1y7

View File

@@ -0,0 +1,20 @@
using Godot;
using System;
using System.Collections.Generic;
using System.Linq;
public partial class ClickEffect1 : ClickEffect
{
public override void Fire()
{
base.Fire();
if (_available && (_calls <= _maxCalls || _maxCalls == 0))
{
List<Shield> shields = _contact._button._phone._player._board._shields.Where(s=>!s._broken).ToList();
int shieldNumber = Globals._rng.Next(0, shields.Count);
int damage = Globals._rng.Next(-50,-30);
shields[shieldNumber].ChangeHealth(damage);
_contact._button._phone._player._debug.Text = "Shield "+shieldNumber+" damaged for "+damage+" Damage!";
}
}
}

View File

@@ -0,0 +1 @@
uid://qmmft72g5uj6

View File

@@ -0,0 +1,9 @@
[gd_scene format=3 uid="uid://dkio7bpdjyh6q"]
[ext_resource type="PackedScene" uid="uid://fygidhjkgabe" path="res://Gameplay/effect.tscn" id="1_dgxlt"]
[ext_resource type="Script" uid="uid://qmmft72g5uj6" path="res://Gameplay/Effects/ClickEffects/ClickEffect1.cs" id="2_wfqii"]
[node name="ClickEffect1" unique_id=110922950 instance=ExtResource("1_dgxlt")]
script = ExtResource("2_wfqii")
[node name="Timer" type="Timer" parent="." index="0" unique_id=801745901]

View File

@@ -0,0 +1,7 @@
using Godot;
using System;
public partial class PassiveEffect : Effect
{
}

View File

@@ -0,0 +1 @@
uid://by1gyhcy001o0

View File

@@ -0,0 +1,7 @@
using Godot;
using System;
public partial class PassiveEffect1 : PassiveEffect
{
}

View File

@@ -0,0 +1 @@
uid://ctrfj2ixcrwa1

View File

@@ -0,0 +1,58 @@
using Godot;
using System;
using System.Runtime.InteropServices.Marshalling;
public partial class TimeEffect : Effect
{
public int _calls = 0, _maxCalls = 0;
public float _timerSeconds;
public Timer _timer;
public override void _Ready()
{
base._Ready();
_timer = GetNode<Timer>("Timer");
}
public override void _Process(double delta)
{
base._Process(delta);
if (_contact._button._phone._running)
{
_contact._button._progressBar.Value = Math.Round(_timer.TimeLeft / _timerSeconds * 100, 0);
}
}
public override void Fire()
{
base.Fire();
if (_calls <= _maxCalls || _maxCalls == 0)
{
_calls++;
_timer.Start(_timerSeconds);
}
}
public override void End()
{
_contact._button._progressBar.Value = 0;
}
public virtual void SetTimer(float SECONDS)
{
_timerSeconds = SECONDS;
}
public override void Start()
{
base.Start();
_calls = 0;
_timer.Start(_timerSeconds);
}
private void OnTimerTimeout()
{
Fire();
}
}

View File

@@ -0,0 +1 @@
uid://jvk7ejpb7xnc

View File

@@ -0,0 +1,21 @@
using Godot;
using System;
using System.Collections.Generic;
using System.Linq;
public partial class TimeEffect1 : TimeEffect
{
public override void Fire()
{
base.Fire();
if (_calls <= _maxCalls || _maxCalls == 0)
{
List<Shield> shields = _contact._button._phone._player._board._shields.Where(s=>!s._broken).ToList();
int shieldNumber = Globals._rng.Next(0, shields.Count);
int damage = Globals._rng.Next(-12,-8);
shields[shieldNumber].ChangeHealth(damage);
_contact._button._phone._player._debug.Text = "Shield "+shieldNumber+" damaged for "+damage+" Damage!";
}
}
}

View File

@@ -0,0 +1 @@
uid://b3ql333letuv

View File

@@ -0,0 +1,10 @@
[gd_scene format=3 uid="uid://dxr716rnqu2e"]
[ext_resource type="Script" uid="uid://b3ql333letuv" path="res://Gameplay/Effects/TimeEffects/TimeEffect1.cs" id="1_l6ud1"]
[node name="TimeEffect1" type="Node" unique_id=980963154]
script = ExtResource("1_l6ud1")
[node name="Timer" type="Timer" parent="." unique_id=1364707554]
[connection signal="timeout" from="Timer" to="." method="OnTimerTimeout"]

View File

@@ -0,0 +1,9 @@
[gd_scene format=3 uid="uid://dg1haube60fgt"]
[ext_resource type="PackedScene" uid="uid://fygidhjkgabe" path="res://Gameplay/effect.tscn" id="1_udl8u"]
[ext_resource type="Script" uid="uid://jvk7ejpb7xnc" path="res://Gameplay/Effects/TimeEffect.cs" id="2_uob21"]
[node name="ClickEffect" unique_id=110922950 instance=ExtResource("1_udl8u")]
script = ExtResource("2_uob21")
[node name="Timer" type="Timer" parent="." index="0" unique_id=801745901]

View File

@@ -0,0 +1,7 @@
[gd_scene format=3 uid="uid://cudff465hbjhq"]
[ext_resource type="PackedScene" uid="uid://fygidhjkgabe" path="res://Gameplay/effect.tscn" id="1_yrp4s"]
[ext_resource type="Script" uid="uid://jvk7ejpb7xnc" path="res://Gameplay/Effects/TimeEffect.cs" id="2_87klk"]
[node name="PassiveEffect" unique_id=110922950 instance=ExtResource("1_yrp4s")]
script = ExtResource("2_87klk")

View File

@@ -0,0 +1,11 @@
[gd_scene format=3 uid="uid://bi16tiewckt3c"]
[ext_resource type="PackedScene" uid="uid://fygidhjkgabe" path="res://Gameplay/effect.tscn" id="1_dhrm1"]
[ext_resource type="Script" uid="uid://jvk7ejpb7xnc" path="res://Gameplay/Effects/TimeEffect.cs" id="2_v3kdq"]
[node name="TimeEffect" unique_id=110922950 instance=ExtResource("1_dhrm1")]
script = ExtResource("2_v3kdq")
[node name="Timer" type="Timer" parent="." index="0" unique_id=801745901]
[connection signal="timeout" from="Timer" to="." method="OnTimerTimeout"]