Basic projectile implementation (put sample version in FilthEaterModelView)

This commit is contained in:
2025-10-23 18:50:05 -07:00
parent bc161a58b3
commit f5360adbf1
36 changed files with 1124 additions and 106 deletions

View File

@@ -155,7 +155,6 @@ public class EffectService
var currentWeapon = (Weapon)_player.EquipmentComponent.EquippedWeapon.Value;
currentWeapon.IncreaseWeaponAttack(1);
_player.AttackComponent.RaiseBonusAttack(1);
}
public void RaiseCurrentArmorDefense()
@@ -165,7 +164,6 @@ public class EffectService
var currentArmor = (Armor)_player.EquipmentComponent.EquippedArmor.Value;
currentArmor.IncreaseArmorDefense(1);
_player.DefenseComponent.RaiseBonusDefense(1);
}
public void RaiseLevel() => _player.LevelUp();

View File

@@ -1,7 +1,6 @@
using Chickensoft.Introspection;
using Chickensoft.Serialization;
using Godot;
using Zennysoft.Game.Implementation;
using Zennysoft.Ma.Adapter;
namespace Zennysoft.Game.Ma;
@@ -24,11 +23,26 @@ public abstract partial class InventoryItemStats : Resource
[Export]
[Save("armor_defense")]
public int Defense { get; set; } = 0;
public int BonusDefense { get; set; } = 0;
[Export]
[Save("weapon_luck")]
public double Luck { get; set; } = 0.05;
public double BonusLuck { get; set; } = 0.05;
[Export]
public int AeolicResistance { get; set; } = 0;
[Export]
public int TelluricResistance { get; set; } = 0;
[Export]
public int HydricResistance { get; set; } = 0;
[Export]
public int IgneousResistance { get; set; } = 0;
[Export]
public int FerrumResistance { get; set; } = 0;
[Export(PropertyHint.Range, "0, 25, 0.1")]
public float ThrowSpeed { get; set; } = 12.0f;

View File

@@ -45,7 +45,8 @@ public partial class ItemDatabase : Node
var armorInfo = GD.Load<ArmorStats>($"res://src/items/armor/resources/{armor}");
var armorScene = ResourceLoader.Load<PackedScene>("res://src/items/armor/Armor.tscn").Instantiate<Armor>();
armorScene.Stats = armorInfo;
database.Add(armorScene);
if (!database.Contains(armorScene))
database.Add(armorScene);
}
foreach (var weapon in weaponResources)
@@ -53,6 +54,8 @@ public partial class ItemDatabase : Node
var weaponInfo = GD.Load<WeaponStats>($"res://src/items/weapons/resources/{weapon}");
var weaponScene = ResourceLoader.Load<PackedScene>("res://src/items/weapons/Weapon.tscn").Instantiate<Weapon>();
weaponScene.Stats = weaponInfo;
if (!database.Contains(weaponScene))
database.Add(weaponScene);
database.Add(weaponScene);
}
@@ -61,6 +64,8 @@ public partial class ItemDatabase : Node
var accessoryInfo = GD.Load<AccessoryStats>($"res://src/items/accessory/resources/{accessory}");
var accessoryScene = ResourceLoader.Load<PackedScene>("res://src/items/accessory/Accessory.tscn").Instantiate<Accessory>();
accessoryScene.Stats = accessoryInfo;
if (!database.Contains(accessoryScene))
database.Add(accessoryScene);
database.Add(accessoryScene);
}
@@ -69,6 +74,8 @@ public partial class ItemDatabase : Node
var throwableItemInfo = GD.Load<ThrowableItemStats>($"res://src/items/throwable/resources/{throwable}");
var throwableItemScene = ResourceLoader.Load<PackedScene>("res://src/items/throwable/ThrowableItem.tscn").Instantiate<ThrowableItem>();
throwableItemScene.Stats = throwableItemInfo;
if (!database.Contains(throwableItemScene))
database.Add(throwableItemScene);
database.Add(throwableItemScene);
}
@@ -77,6 +84,8 @@ public partial class ItemDatabase : Node
var consumableItemInfo = GD.Load<ConsumableItemStats>($"res://src/items/consumable/resources/{consumable}");
var consumableItemScene = ResourceLoader.Load<PackedScene>("res://src/items/consumable/ConsumableItem.tscn").Instantiate<ConsumableItem>();
consumableItemScene.Stats = consumableItemInfo;
if (!database.Contains(consumableItemScene))
database.Add(consumableItemScene);
database.Add(consumableItemScene);
}
@@ -85,6 +94,8 @@ public partial class ItemDatabase : Node
var effectItemInfo = GD.Load<EffectItemStats>($"res://src/items/effect/resources/{effectItem}");
var effectItemScene = ResourceLoader.Load<PackedScene>("res://src/items/effect/EffectItem.tscn").Instantiate<EffectItem>();
effectItemScene.Stats = effectItemInfo;
if (!database.Contains(effectItemScene))
database.Add(effectItemScene);
database.Add(effectItemScene);
}

View File

@@ -3,6 +3,7 @@ using Chickensoft.Introspection;
using Chickensoft.Serialization;
using Godot;
using Zennysoft.Ma.Adapter;
using Zennysoft.Ma.Adapter.Entity;
namespace Zennysoft.Game.Ma;
@@ -27,6 +28,8 @@ public partial class Accessory : EquipableItem
public override float ThrowSpeed => Stats.ThrowSpeed;
public override ElementalResistanceSet ElementalResistance => new ElementalResistanceSet(Stats.AeolicResistance, Stats.HydricResistance, Stats.IgneousResistance, Stats.FerrumResistance, Stats.TelluricResistance);
public AccessoryTag AccessoryTag => Stats.AccessoryTag;
public override ItemTag ItemTag => Stats.ItemTag;

View File

@@ -3,6 +3,7 @@ using Chickensoft.Introspection;
using Chickensoft.Serialization;
using Godot;
using Zennysoft.Ma.Adapter;
using Zennysoft.Ma.Adapter.Entity;
namespace Zennysoft.Game.Ma;
@@ -28,10 +29,12 @@ public partial class Armor : EquipableItem
public override float ThrowSpeed => Stats.ThrowSpeed;
public override int BonusDefense => Stats.Defense + _bonusDefense;
public override int BonusDefense => Stats.BonusDefense + _bonusDefense;
private int _bonusDefense { get; set; } = 0;
public override ElementalResistanceSet ElementalResistance => new ElementalResistanceSet(Stats.AeolicResistance, Stats.HydricResistance, Stats.IgneousResistance, Stats.FerrumResistance, Stats.TelluricResistance);
public void IncreaseArmorDefense(int bonus) => _bonusDefense += bonus;
public override ItemTag ItemTag => Stats.ItemTag;

View File

@@ -3,6 +3,7 @@ using Chickensoft.Introspection;
using Chickensoft.Serialization;
using Godot;
using Zennysoft.Ma.Adapter;
using Zennysoft.Ma.Adapter.Entity;
namespace Zennysoft.Game.Ma;
@@ -28,7 +29,7 @@ public partial class Weapon : EquipableItem
public override float ThrowSpeed => Stats.ThrowSpeed;
public double Luck => Stats.Luck;
public double Luck => Stats.BonusLuck;
public double AttackSpeed => Stats.AttackSpeed;
@@ -38,6 +39,8 @@ public partial class Weapon : EquipableItem
public ElementType WeaponElement => Stats.WeaponElement;
public override ElementalResistanceSet ElementalResistance => new ElementalResistanceSet(Stats.AeolicResistance, Stats.HydricResistance, Stats.IgneousResistance, Stats.FerrumResistance, Stats.TelluricResistance);
public void IncreaseWeaponAttack(int bonus) => _extraDamage += bonus;
public override int BonusAttack { get => Stats.BonusAttack + _extraDamage; }