diff --git a/Resources/Bullets/Boss/Rumia/LaserBulletTest.tres b/Resources/Bullets/Boss/Rumia/LaserBulletTest.tres index fc6a5c78..8b6fbfb4 100644 --- a/Resources/Bullets/Boss/Rumia/LaserBulletTest.tres +++ b/Resources/Bullets/Boss/Rumia/LaserBulletTest.tres @@ -31,5 +31,5 @@ Owner = 2 DamageType = 0 Controllable = false Grazeable = false -GrazeValue = 1.0 +GrazeValue = 0.2 TimeModifiers = Array[Object]([SubResource("Resource_3a5dw"), SubResource("Resource_rtncg")]) diff --git a/Resources/Bullets/Boss/Rumia/Rumia_Red_Chase_Bullet.tres b/Resources/Bullets/Boss/Rumia/Rumia_Red_Chase_Bullet.tres index 7cc24c0c..b9d32e90 100644 --- a/Resources/Bullets/Boss/Rumia/Rumia_Red_Chase_Bullet.tres +++ b/Resources/Bullets/Boss/Rumia/Rumia_Red_Chase_Bullet.tres @@ -28,6 +28,6 @@ Owner = 2 DamageType = 0 Controllable = false Grazeable = true -GrazeValue = 1.0 +GrazeValue = 0.2 Modifier = SubResource("Resource_jeq72") TimeModifiers = Array[Object]([SubResource("Resource_edsop")]) diff --git a/Resources/Bullets/EmitterTestBullet.tres b/Resources/Bullets/EmitterTestBullet.tres index 6181d531..1a553f76 100644 --- a/Resources/Bullets/EmitterTestBullet.tres +++ b/Resources/Bullets/EmitterTestBullet.tres @@ -15,5 +15,5 @@ Owner = 0 DamageType = 2 Controllable = false Grazeable = true -GrazeValue = 1.0 +GrazeValue = 0.2 TimeModifiers = Array[Object]([]) diff --git a/Resources/Bullets/Fire_Emitter_Bullet.tres b/Resources/Bullets/Fire_Emitter_Bullet.tres index 5ce7ca58..84215b5a 100644 --- a/Resources/Bullets/Fire_Emitter_Bullet.tres +++ b/Resources/Bullets/Fire_Emitter_Bullet.tres @@ -15,6 +15,6 @@ Owner = 0 DamageType = 2 Controllable = false Grazeable = false -GrazeValue = 1.0 +GrazeValue = 0.2 TimeModifiers = null metadata/_custom_type_script = "uid://dslyrfcej3g2n" diff --git a/Resources/Bullets/Spider_Bomb_Bullet.tres b/Resources/Bullets/Spider_Bomb_Bullet.tres index a9c69eb7..992fc9dd 100644 --- a/Resources/Bullets/Spider_Bomb_Bullet.tres +++ b/Resources/Bullets/Spider_Bomb_Bullet.tres @@ -17,6 +17,6 @@ Owner = 1 DamageType = 0 Controllable = true Grazeable = false -GrazeValue = 1.0 +GrazeValue = 0.2 TimeModifiers = null metadata/_custom_type_script = "uid://dslyrfcej3g2n" diff --git a/Resources/Bullets/nuclear_bullets.tres b/Resources/Bullets/nuclear_bullets.tres index c34db4b8..79cbab11 100644 --- a/Resources/Bullets/nuclear_bullets.tres +++ b/Resources/Bullets/nuclear_bullets.tres @@ -17,5 +17,5 @@ Owner = 1 DamageType = 2 Controllable = false Grazeable = false -GrazeValue = -1.0 +GrazeValue = -0.2 TimeModifiers = null diff --git a/Resources/Bullets/simple_enemy_bullet.tres b/Resources/Bullets/simple_enemy_bullet.tres index 90e94707..aa4f942b 100644 --- a/Resources/Bullets/simple_enemy_bullet.tres +++ b/Resources/Bullets/simple_enemy_bullet.tres @@ -13,4 +13,7 @@ LifeTime = 10.0 DestroyOnCollision = true Owner = 2 DamageType = 0 +Controllable = false +Grazeable = true +GrazeValue = 0.2 TimeModifiers = null diff --git a/Resources/Bullets/simple_ice_bullet.tres b/Resources/Bullets/simple_ice_bullet.tres index 8ee24140..0ffffcf4 100644 --- a/Resources/Bullets/simple_ice_bullet.tres +++ b/Resources/Bullets/simple_ice_bullet.tres @@ -17,5 +17,5 @@ Owner = 1 DamageType = 3 Controllable = false Grazeable = false -GrazeValue = 1.0 +GrazeValue = 0.2 TimeModifiers = null diff --git a/Resources/Items/Spider_Bomb_Pickup.tres b/Resources/Items/Spider_Bomb_Pickup.tres index 46473fdc..e6699c3e 100644 --- a/Resources/Items/Spider_Bomb_Pickup.tres +++ b/Resources/Items/Spider_Bomb_Pickup.tres @@ -23,11 +23,11 @@ BulletCapacity = 10 ReloadTime = 1.0 AutoReload = true InfiniteAmmo = true +ItemKey = null +AmmoKey = null BulletsPerShot = 1 SpreadAngle = 0.0 RandomSpread = 0.0 -ItemKey = null -AmmoKey = null _rotationOffset = 0.0 metadata/_custom_type_script = "uid://b6fmrnipv88bk" diff --git a/Resources/Weapons/Enemy/TurretWeapon.tres b/Resources/Weapons/Enemy/TurretWeapon.tres index 7baa077c..400c04bc 100644 --- a/Resources/Weapons/Enemy/TurretWeapon.tres +++ b/Resources/Weapons/Enemy/TurretWeapon.tres @@ -36,10 +36,10 @@ BulletCapacity = 20 ReloadTime = 2.0 AutoReload = true InfiniteAmmo = true +ItemKey = null +AmmoKey = null BulletsPerShot = 1 SpreadAngle = 0.0 RandomSpread = 0.0 -ItemKey = null -AmmoKey = null _rotationOffset = 0.0 metadata/_custom_type_script = "uid://b6fmrnipv88bk" diff --git a/Scenes/test.tscn b/Scenes/test.tscn index 9a160225..f008b53f 100644 --- a/Scenes/test.tscn +++ b/Scenes/test.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=153 format=4 uid="uid://bv451a8wgty4u"] +[gd_scene load_steps=154 format=4 uid="uid://bv451a8wgty4u"] [ext_resource type="Script" uid="uid://doxmbokehw8ci" path="res://Scripts/GameManager.cs" id="1_8tmoj"] [ext_resource type="PackedScene" uid="uid://c4pr2707hbeph" path="res://Scenes/Actors/fsm_player.tscn" id="2_ksslq"] @@ -74,6 +74,7 @@ [ext_resource type="PackedScene" uid="uid://c5fiv1nioghfb" path="res://Scenes/Actors/Marisa.tscn" id="50_mp5ma"] [ext_resource type="Resource" uid="uid://37h0tjja4sns" path="res://Resources/Maps/RebelBase.tres" id="52_orkt3"] [ext_resource type="PackedScene" uid="uid://bqjcwxene73l2" path="res://Scenes/Actors/ActorEnemyTest.tscn" id="55_chha6"] +[ext_resource type="Script" uid="uid://b5fesrd4lv8t1" path="res://Scripts/Resources/Events/EventResource.cs" id="55_dferh"] [ext_resource type="PackedScene" uid="uid://bjskkeb3ppcs8" path="res://Scenes/Actors/Turret360.tscn" id="62_h0jm4"] [ext_resource type="Script" uid="uid://v57xjmhi28kw" path="res://Scripts/Resources/Events/ControlActorEvent.cs" id="64_rphi8"] [ext_resource type="PackedScene" uid="uid://b0gpbkxdfbnjh" path="res://Scenes/Actors/ForceField_Horizontal.tscn" id="66_nxn3h"] @@ -275,7 +276,7 @@ ActivationType = 0 Targets = Array[NodePath]([NodePath("../Rumia")]) WaitForCompletion = true -[sub_resource type="Resource" id="Resource_j86ly"] +[sub_resource type="Resource" id="Resource_fuaed"] resource_local_to_scene = true script = ExtResource("49_0si7g") Target = NodePath(".") @@ -724,7 +725,7 @@ Invisible = true metadata/_edit_group_ = true [node name="ScriptableAreaTrigger" parent="Parallax2D/Factory Tilemaps/LevelProps/DebugTeleporter" instance=ExtResource("43_kf3qc")] -Events = [SubResource("Resource_usuub")] +Events = Array[ExtResource("55_dferh")]([SubResource("Resource_usuub")]) [node name="BlueKeycard2" parent="Parallax2D/Factory Tilemaps/LevelProps" instance=ExtResource("35_rblsn")] position = Vector2(-1032, -317) @@ -921,7 +922,7 @@ position = Vector2(-1423, -188) [node name="LevelStartTrigger" parent="Parallax2D/Factory Tilemaps/LevelProps" instance=ExtResource("43_kf3qc")] position = Vector2(-762, -129) scale = Vector2(1.455, 1.455) -Events = [SubResource("Resource_5er5x"), SubResource("Resource_b25hy")] +Events = Array[ExtResource("55_dferh")]([SubResource("Resource_5er5x"), SubResource("Resource_b25hy")]) [node name="AreaTrigger2" parent="Parallax2D/Factory Tilemaps/LevelProps" node_paths=PackedStringArray("Target") instance=ExtResource("28_6au4t")] position = Vector2(-435, -162) @@ -964,7 +965,7 @@ metadata/_edit_group_ = true [node name="Script2" type="Node2D" parent="Parallax2D/Factory Tilemaps/LevelProps/Computer2"] position = Vector2(120, 25) script = ExtResource("42_wigyb") -Events = [SubResource("Resource_wma5c")] +Events = Array[ExtResource("55_dferh")]([SubResource("Resource_wma5c")]) [node name="Computer8" parent="Parallax2D/Factory Tilemaps/LevelProps" node_paths=PackedStringArray("Targets") instance=ExtResource("31_243ec")] position = Vector2(-2073, -205) @@ -975,7 +976,7 @@ metadata/_edit_group_ = true [node name="Script2" type="Node2D" parent="Parallax2D/Factory Tilemaps/LevelProps/Computer8"] position = Vector2(120, 25) script = ExtResource("42_wigyb") -Events = [SubResource("Resource_dferh")] +Events = Array[ExtResource("55_dferh")]([SubResource("Resource_dferh")]) [node name="Computer6" parent="Parallax2D/Factory Tilemaps/LevelProps" node_paths=PackedStringArray("Targets") instance=ExtResource("31_243ec")] position = Vector2(-1113, -139) @@ -985,7 +986,7 @@ metadata/_edit_group_ = true [node name="Script2" type="Node2D" parent="Parallax2D/Factory Tilemaps/LevelProps/Computer6"] position = Vector2(0, 1) script = ExtResource("42_wigyb") -Events = [SubResource("Resource_cxj4w")] +Events = Array[ExtResource("55_dferh")]([SubResource("Resource_cxj4w")]) [node name="Computer7" parent="Parallax2D/Factory Tilemaps/LevelProps" node_paths=PackedStringArray("Targets") instance=ExtResource("31_243ec")] position = Vector2(-1175.36, 213.708) @@ -996,7 +997,7 @@ metadata/_edit_group_ = true [node name="Computer7Script" type="Node2D" parent="Parallax2D/Factory Tilemaps/LevelProps/Computer7"] position = Vector2(0, 1) script = ExtResource("42_wigyb") -Events = [SubResource("Resource_tcc7d")] +Events = Array[ExtResource("55_dferh")]([SubResource("Resource_tcc7d")]) [node name="Computer5" parent="Parallax2D/Factory Tilemaps/LevelProps" node_paths=PackedStringArray("Targets") instance=ExtResource("31_243ec")] position = Vector2(-1344, -251) @@ -1004,7 +1005,7 @@ Targets = [NodePath("Computer5Script")] [node name="Computer5Script" type="Node2D" parent="Parallax2D/Factory Tilemaps/LevelProps/Computer5"] script = ExtResource("42_wigyb") -Events = [SubResource("Resource_fasrq"), SubResource("Resource_mah4x"), SubResource("Resource_0bqta")] +Events = Array[ExtResource("55_dferh")]([SubResource("Resource_fasrq"), SubResource("Resource_mah4x"), SubResource("Resource_0bqta")]) [node name="Computer3" parent="Parallax2D/Factory Tilemaps/LevelProps" node_paths=PackedStringArray("Target") instance=ExtResource("31_243ec")] position = Vector2(-612.57, -358.528) @@ -1012,7 +1013,7 @@ Target = NodePath("Script") [node name="Script" type="Node2D" parent="Parallax2D/Factory Tilemaps/LevelProps/Computer3"] script = ExtResource("42_wigyb") -Events = [SubResource("Resource_o2kpk")] +Events = Array[ExtResource("55_dferh")]([SubResource("Resource_o2kpk")]) [node name="Computer4" parent="Parallax2D/Factory Tilemaps/LevelProps" node_paths=PackedStringArray("Target") instance=ExtResource("31_243ec")] position = Vector2(-791, -505) @@ -1020,7 +1021,7 @@ Target = NodePath("Node2D") [node name="Node2D" type="Node2D" parent="Parallax2D/Factory Tilemaps/LevelProps/Computer4"] script = ExtResource("42_wigyb") -Events = [SubResource("Resource_s3g2w")] +Events = Array[ExtResource("55_dferh")]([SubResource("Resource_s3g2w")]) [node name="Label" type="Label" parent="Parallax2D/Factory Tilemaps/LevelProps/Computer4"] offset_left = -5.0 @@ -1049,11 +1050,11 @@ position = Vector2(-792, -407) [node name="BossBattleEndScript" type="Node2D" parent="Parallax2D/Factory Tilemaps/LevelProps"] position = Vector2(-1628.53, -477.628) script = ExtResource("42_wigyb") -Events = [SubResource("Resource_068l7"), SubResource("Resource_l3nop")] +Events = Array[ExtResource("55_dferh")]([SubResource("Resource_068l7"), SubResource("Resource_l3nop")]) [node name="BossBattleStartScript" parent="Parallax2D/Factory Tilemaps/LevelProps" instance=ExtResource("43_kf3qc")] position = Vector2(-1487, -396) -Events = [SubResource("Resource_4f4id"), SubResource("Resource_s2o7m"), SubResource("Resource_b1dht"), SubResource("Resource_xrgpy"), SubResource("Resource_j86ly")] +Events = Array[ExtResource("55_dferh")]([SubResource("Resource_4f4id"), SubResource("Resource_s2o7m"), SubResource("Resource_b1dht"), SubResource("Resource_xrgpy"), SubResource("Resource_fuaed")]) [node name="Enemy13" parent="Parallax2D/Factory Tilemaps/LevelProps" instance=ExtResource("47_u1ve6")] position = Vector2(-1657, -788) @@ -1180,7 +1181,7 @@ position = Vector2(-2000, -736) [node name="ControlPad8" parent="Parallax2D/Factory Tilemaps/LevelProps" node_paths=PackedStringArray("Targets") instance=ExtResource("12_hfkf1")] position = Vector2(-2027, -735) Targets = [NodePath("../HorizontalForceField")] -Requirements = [ExtResource("84_ma1ta")] +Requirements = Array[ExtResource("6_8tdlb")]([ExtResource("84_ma1ta")]) [node name="Ammo6" parent="Parallax2D/Factory Tilemaps/LevelProps" instance=ExtResource("34_17pjh")] position = Vector2(-872, -220) @@ -1356,7 +1357,7 @@ position = Vector2(-2232, -203) [node name="ScriptableAreaTrigger" parent="Parallax2D/Factory Tilemaps/LevelProps" instance=ExtResource("43_kf3qc")] position = Vector2(-2063, -232) -Events = [SubResource("Resource_l476f"), SubResource("Resource_dskij")] +Events = Array[ExtResource("55_dferh")]([SubResource("Resource_l476f"), SubResource("Resource_dskij")]) [node name="ShieldExtendPickup" parent="Parallax2D/Factory Tilemaps/LevelProps" instance=ExtResource("103_0bqta")] position = Vector2(-1646, 38) @@ -1484,7 +1485,7 @@ position = Vector2(-1633, 391) [node name="MovementSensorLonger" parent="Parallax2D/Factory Tilemaps/LevelProps" instance=ExtResource("112_j86ly")] position = Vector2(-1495, 516) -Events = [SubResource("Resource_uslvo")] +Events = Array[ExtResource("55_dferh")]([SubResource("Resource_uslvo")]) [node name="WallEmitter" parent="Parallax2D/Factory Tilemaps/LevelProps" instance=ExtResource("113_dferh")] position = Vector2(-1480, 451) diff --git a/Scripts/Components/Actors/GenericDamageReceiver.cs b/Scripts/Components/Actors/GenericDamageReceiver.cs index 0deadfe2..7476054f 100644 --- a/Scripts/Components/Actors/GenericDamageReceiver.cs +++ b/Scripts/Components/Actors/GenericDamageReceiver.cs @@ -1,4 +1,5 @@ using System.Linq; +using Cirno.Scripts.Enums; using Cirno.Scripts.Resources; using Godot; using Godot.Collections; @@ -60,8 +61,17 @@ public partial class GenericDamageReceiver : Area2D, IHittable { if (!Enabled) return; if (Invulnerable) return; + + // Change value based on difficulty + float difficultyReducedDmg = GlobalState.Instance.SessionSettings.Difficulty switch + { + DifficultyLevel.Easy => damage * 5, + DifficultyLevel.Normal => damage * 2, + DifficultyLevel.Hard or DifficultyLevel.Lunatic => damage, + _ => damage + }; - var dmg = DamageResistances.Aggregate(damage, (current, resistance) => current * resistance.CalculateDamage(current, damageType)); + var dmg = DamageResistances.Aggregate(difficultyReducedDmg, (current, resistance) => current * resistance.CalculateDamage(current, damageType)); HealthProvider.CurrentResource -= dmg; } diff --git a/Scripts/Components/Actors/PlayerDamageReceiver.cs b/Scripts/Components/Actors/PlayerDamageReceiver.cs index 6331627a..f60015db 100644 --- a/Scripts/Components/Actors/PlayerDamageReceiver.cs +++ b/Scripts/Components/Actors/PlayerDamageReceiver.cs @@ -184,15 +184,24 @@ public partial class PlayerDamageReceiver : Area2D { if (!Enabled) return; + // Change value based on difficulty + float difficultyReducedDmg = GlobalState.Instance.SessionSettings.Difficulty switch + { + DifficultyLevel.Easy => damage / 5, + DifficultyLevel.Normal => damage / 2, + DifficultyLevel.Hard or DifficultyLevel.Lunatic => damage, + _ => damage + }; + // Check if the shield is empty or damage has skip attributes if (CurrentShield <= 0 || ShieldDamageResistances.Where(x => x.DamageType == type).Any(x => x.Attribute is DamageAttribute.Skip)) { // do not apply, go to health - ApplyDamageToHealth(damage, type); + ApplyDamageToHealth(difficultyReducedDmg, type); } else { - var shieldDmg = ShieldDamageResistances.Aggregate(damage, (current, resistance) => current * resistance.CalculateDamage(current, type)); + var shieldDmg = ShieldDamageResistances.Aggregate(difficultyReducedDmg, (current, resistance) => current * resistance.CalculateDamage(current, type)); // apply and get remainder var remainder = CurrentShield - shieldDmg; @@ -205,33 +214,33 @@ public partial class PlayerDamageReceiver : Area2D } } - return; + // return; - if (CurrentShield > 0 && type is not DamageType.Explosive or DamageType.Acid) - { - // Reduce shield - //PlayShieldAnimation(); // Let this be handled by event - CurrentShield -= damage; - if (CurrentShield < 0) - { - CurrentHealth -= Math.Abs(CurrentShield); - CurrentShield = 0; - } - } - else - { - if (type is DamageType.Fire) - { - CurrentHealth -= damage * 2; - } - else - { - CurrentHealth -= damage; - } - - //Blink(); // Let this be handled by event - } - - if (!(CurrentHealth <= 0)) return; + // if (CurrentShield > 0 && type is not DamageType.Explosive or DamageType.Acid) + // { + // // Reduce shield + // //PlayShieldAnimation(); // Let this be handled by event + // CurrentShield -= damage; + // if (CurrentShield < 0) + // { + // CurrentHealth -= Math.Abs(CurrentShield); + // CurrentShield = 0; + // } + // } + // else + // { + // if (type is DamageType.Fire) + // { + // CurrentHealth -= damage * 2; + // } + // else + // { + // CurrentHealth -= damage; + // } + // + // //Blink(); // Let this be handled by event + // } + // + // if (!(CurrentHealth <= 0)) return; } } \ No newline at end of file diff --git a/Scripts/Components/FSM/Player/PlayerGrazingModule.cs b/Scripts/Components/FSM/Player/PlayerGrazingModule.cs index da75a7dd..5d251fa7 100644 --- a/Scripts/Components/FSM/Player/PlayerGrazingModule.cs +++ b/Scripts/Components/FSM/Player/PlayerGrazingModule.cs @@ -1,4 +1,5 @@ using Cirno.Scripts.Components.Actors; +using Cirno.Scripts.Enums; using Godot; namespace Cirno.Scripts.Components.FSM.Player; @@ -40,7 +41,18 @@ public partial class PlayerGrazingModule : PlayerArea2DModule bullet.Graze(); //bullet.IsGrazed = true; - Shield.CurrentResource += bullet.BulletInfo.GrazeValue; + var baseGrazeValue = bullet.BulletInfo.GrazeValue; + + float grazeShield = GlobalState.Instance.SessionSettings.Difficulty switch + { + DifficultyLevel.Easy => baseGrazeValue * 5, + DifficultyLevel.Normal => baseGrazeValue * 2, + DifficultyLevel.Hard or DifficultyLevel.Lunatic => baseGrazeValue, + _ => baseGrazeValue + }; + + Shield.CurrentResource += grazeShield; + // check if it's grazed // check if it's grazeable // restore appropriate amount of shield diff --git a/Scripts/Resources/BulletResource.cs b/Scripts/Resources/BulletResource.cs index aaf0ead8..f512eaff 100644 --- a/Scripts/Resources/BulletResource.cs +++ b/Scripts/Resources/BulletResource.cs @@ -21,7 +21,7 @@ public partial class BulletResource : Resource [Export] public DamageType DamageType = DamageType.Neutral; [Export] public bool Controllable = false; [Export] public bool Grazeable { get; set; } = true; - [Export] public float GrazeValue { get; set; } = 1f; + [Export] public float GrazeValue { get; set; } = 0.2f; [Export] public BulletCreationModifier Modifier;