Add more boxes, implement weapon that gets stronger on lower HP
This commit is contained in:
@@ -462,6 +462,17 @@ public partial class Game : Node3D, IGame
|
||||
foreach (var item in newInventory)
|
||||
_player.Inventory.TryAdd(item);
|
||||
break;
|
||||
case ItemTag.ContainsUnobtainedItem:
|
||||
_effectService.GetUnobtainedItem();
|
||||
break;
|
||||
case ItemTag.ContainsBasicItem:
|
||||
_effectService.GetBasicItem<InventoryItem>();
|
||||
break;
|
||||
case ItemTag.UnequipAllItems:
|
||||
_player.EquipmentComponent.Unequip(_player.EquipmentComponent.EquippedWeapon.Value);
|
||||
_player.EquipmentComponent.Unequip(_player.EquipmentComponent.EquippedArmor.Value);
|
||||
_player.EquipmentComponent.Unequip(_player.EquipmentComponent.EquippedAccessory.Value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
height = 0.725098
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_qdeu2"]
|
||||
size = Vector3(0.778381, 0.929947, 0.731567)
|
||||
size = Vector3(0.898941, 2.34974, 0.86676)
|
||||
|
||||
[node name="Armor" type="RigidBody3D"]
|
||||
collision_layer = 0
|
||||
@@ -36,4 +36,5 @@ texture_filter = 0
|
||||
render_priority = 100
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Pickup"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.00804907, 0.709896, 0.0675965)
|
||||
shape = SubResource("BoxShape3D_qdeu2")
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
[gd_resource type="Resource" script_class="BoxItemStats" load_steps=3 format=3 uid="uid://ds7s722m5y7m4"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://bg47n2tmintm0" path="res://src/items/consumable/textures/past self remnant.PNG" id="1_dgx1x"]
|
||||
[ext_resource type="Script" uid="uid://vuavr681au06" path="res://src/items/accessory/BoxItemStats.cs" id="2_ncstm"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("2_ncstm")
|
||||
DamageToPlayer = 0
|
||||
Name = "Alluring Acquisition"
|
||||
Description = "Grants you a basic item."
|
||||
SpawnRate = 0.5
|
||||
BonusAttack = 0
|
||||
BonusDefense = 0
|
||||
BonusLuck = 0.05
|
||||
BonusHP = 0
|
||||
BonusVT = 0
|
||||
AeolicResistance = 0
|
||||
TelluricResistance = 0
|
||||
HydricResistance = 0
|
||||
IgneousResistance = 0
|
||||
FerrumResistance = 0
|
||||
ThrowSpeed = 12.0
|
||||
ThrowDamage = 5
|
||||
ItemTag = 14
|
||||
Texture = ExtResource("1_dgx1x")
|
||||
metadata/_custom_type_script = "uid://vuavr681au06"
|
||||
26
Zennysoft.Game.Ma/src/items/box/resources/Asceticism.tres
Normal file
26
Zennysoft.Game.Ma/src/items/box/resources/Asceticism.tres
Normal file
@@ -0,0 +1,26 @@
|
||||
[gd_resource type="Resource" script_class="BoxItemStats" load_steps=3 format=3 uid="uid://6c0t45setc82"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://bg47n2tmintm0" path="res://src/items/consumable/textures/past self remnant.PNG" id="1_wwmaf"]
|
||||
[ext_resource type="Script" uid="uid://vuavr681au06" path="res://src/items/accessory/BoxItemStats.cs" id="2_6h66g"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("2_6h66g")
|
||||
DamageToPlayer = 0
|
||||
Name = "Asceticism"
|
||||
Description = "Forcibly unequips all of your items."
|
||||
SpawnRate = 0.5
|
||||
BonusAttack = 0
|
||||
BonusDefense = 0
|
||||
BonusLuck = 0.05
|
||||
BonusHP = 0
|
||||
BonusVT = 0
|
||||
AeolicResistance = 0
|
||||
TelluricResistance = 0
|
||||
HydricResistance = 0
|
||||
IgneousResistance = 0
|
||||
FerrumResistance = 0
|
||||
ThrowSpeed = 12.0
|
||||
ThrowDamage = 5
|
||||
ItemTag = 16
|
||||
Texture = ExtResource("1_wwmaf")
|
||||
metadata/_custom_type_script = "uid://vuavr681au06"
|
||||
26
Zennysoft.Game.Ma/src/items/box/resources/GlueJar.tres
Normal file
26
Zennysoft.Game.Ma/src/items/box/resources/GlueJar.tres
Normal file
@@ -0,0 +1,26 @@
|
||||
[gd_resource type="Resource" script_class="BoxItemStats" load_steps=3 format=3 uid="uid://bb44i0nb2ov3i"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://bg47n2tmintm0" path="res://src/items/consumable/textures/past self remnant.PNG" id="1_kqlme"]
|
||||
[ext_resource type="Script" uid="uid://vuavr681au06" path="res://src/items/accessory/BoxItemStats.cs" id="2_w23fa"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("2_w23fa")
|
||||
DamageToPlayer = 0
|
||||
Name = "Glue Jar"
|
||||
Description = "Makes you unable to unequip any items."
|
||||
SpawnRate = 0.5
|
||||
BonusAttack = 0
|
||||
BonusDefense = 0
|
||||
BonusLuck = 0.05
|
||||
BonusHP = 0
|
||||
BonusVT = 0
|
||||
AeolicResistance = 0
|
||||
TelluricResistance = 0
|
||||
HydricResistance = 0
|
||||
IgneousResistance = 0
|
||||
FerrumResistance = 0
|
||||
ThrowSpeed = 12.0
|
||||
ThrowDamage = 5
|
||||
ItemTag = 15
|
||||
Texture = ExtResource("1_kqlme")
|
||||
metadata/_custom_type_script = "uid://vuavr681au06"
|
||||
@@ -0,0 +1,26 @@
|
||||
[gd_resource type="Resource" script_class="BoxItemStats" load_steps=3 format=3 uid="uid://ba1ihsi6culef"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://bg47n2tmintm0" path="res://src/items/consumable/textures/past self remnant.PNG" id="1_a6ha2"]
|
||||
[ext_resource type="Script" uid="uid://vuavr681au06" path="res://src/items/accessory/BoxItemStats.cs" id="2_tbg32"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("2_tbg32")
|
||||
DamageToPlayer = 0
|
||||
Name = "Scripture Sign; Curiosity"
|
||||
Description = "Grants you an item you do not currently have."
|
||||
SpawnRate = 0.5
|
||||
BonusAttack = 0
|
||||
BonusDefense = 0
|
||||
BonusLuck = 0.05
|
||||
BonusHP = 0
|
||||
BonusVT = 0
|
||||
AeolicResistance = 0
|
||||
TelluricResistance = 0
|
||||
HydricResistance = 0
|
||||
IgneousResistance = 0
|
||||
FerrumResistance = 0
|
||||
ThrowSpeed = 12.0
|
||||
ThrowDamage = 5
|
||||
ItemTag = 13
|
||||
Texture = ExtResource("1_a6ha2")
|
||||
metadata/_custom_type_script = "uid://vuavr681au06"
|
||||
@@ -6,7 +6,7 @@
|
||||
height = 0.725098
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_7mh0f"]
|
||||
size = Vector3(0.778381, 0.929947, 0.731567)
|
||||
size = Vector3(0.778381, 3.19556, 0.731567)
|
||||
|
||||
[node name="ConsumableItem" type="RigidBody3D"]
|
||||
collision_layer = 0
|
||||
@@ -38,4 +38,5 @@ texture_filter = 0
|
||||
render_priority = 100
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Pickup"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.13281, 0)
|
||||
shape = SubResource("BoxShape3D_7mh0f")
|
||||
|
||||
@@ -2,6 +2,7 @@ using Chickensoft.AutoInject;
|
||||
using Chickensoft.Introspection;
|
||||
using Chickensoft.Serialization;
|
||||
using Godot;
|
||||
using System;
|
||||
using Zennysoft.Ma.Adapter;
|
||||
using Zennysoft.Ma.Adapter.Entity;
|
||||
|
||||
@@ -44,6 +45,8 @@ public partial class Weapon : EquipableItem
|
||||
|
||||
public void IncreaseWeaponAttack(int bonus) => _bonusDamage += bonus;
|
||||
|
||||
public void SetWeaponAttack(int newBonus) => _bonusDamage = newBonus;
|
||||
|
||||
public override int BonusAttack { get => Stats.BonusAttack + _bonusDamage; }
|
||||
|
||||
[Save("weapon_bonus_damage")]
|
||||
|
||||
30
Zennysoft.Game.Ma/src/items/weapons/resources/HopesEdge.tres
Normal file
30
Zennysoft.Game.Ma/src/items/weapons/resources/HopesEdge.tres
Normal file
@@ -0,0 +1,30 @@
|
||||
[gd_resource type="Resource" script_class="WeaponStats" load_steps=4 format=3 uid="uid://c5d1lx0m53d5i"]
|
||||
|
||||
[ext_resource type="AudioStream" uid="uid://ilf2s8ct2stt" path="res://src/audio/sfx/PLAYER_slower_slash.ogg" id="1_wkueq"]
|
||||
[ext_resource type="Texture2D" uid="uid://cil3xe3jq82r6" path="res://src/items/weapons/textures/JIBLETT.PNG" id="2_13kat"]
|
||||
[ext_resource type="Script" uid="uid://cc7byqeolw5y4" path="res://src/items/weapons/WeaponStats.cs" id="3_34krx"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("3_34krx")
|
||||
AttackSpeed = 1.0
|
||||
WeaponElement = 0
|
||||
WeaponTag = 5
|
||||
SoundEffect = 4
|
||||
Name = "Hope's Edge"
|
||||
Description = "Sword that strikes harder the lower HP you have."
|
||||
SpawnRate = 0.1
|
||||
BonusAttack = 0
|
||||
BonusDefense = 0
|
||||
BonusLuck = 0.05
|
||||
BonusHP = 0
|
||||
BonusVT = 0
|
||||
AeolicResistance = 0
|
||||
TelluricResistance = 0
|
||||
HydricResistance = 0
|
||||
IgneousResistance = 0
|
||||
FerrumResistance = 0
|
||||
ThrowSpeed = 12.0
|
||||
ThrowDamage = 5
|
||||
ItemTag = 0
|
||||
Texture = ExtResource("2_13kat")
|
||||
AudioStream = ExtResource("1_wkueq")
|
||||
@@ -169,6 +169,7 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
|
||||
{
|
||||
Hitbox.AreaEntered += Hitbox_AreaEntered;
|
||||
CollisionDetector.AreaEntered += CollisionDetector_AreaEntered;
|
||||
HealthComponent.CurrentHP.Changed += InverseHPToAttackPowerSync;
|
||||
HealthComponent.HealthReachedZero += Die;
|
||||
PlayerFXAnimations.AnimationFinished += PlayerFXAnimations_AnimationFinished;
|
||||
HealthTimer.WaitTime = _healthTimerWaitTime;
|
||||
@@ -332,6 +333,17 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
|
||||
PlayerDied?.Invoke();
|
||||
}
|
||||
|
||||
private void InverseHPToAttackPowerSync(int obj)
|
||||
{
|
||||
var weapon = (Weapon)EquipmentComponent.EquippedWeapon.Value;
|
||||
if (weapon.WeaponTag == WeaponTag.InverseHPAttackPower)
|
||||
{
|
||||
var healthPercentage = (HealthComponent.CurrentHP.Value * 10) / HealthComponent.MaximumHP.Value;
|
||||
weapon.SetWeaponAttack(10 - healthPercentage);
|
||||
EquipmentComponent.Equip(weapon);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnExitTree()
|
||||
{
|
||||
PlayerLogic.Stop();
|
||||
|
||||
Reference in New Issue
Block a user