109 lines
2.8 KiB
C#
109 lines
2.8 KiB
C#
using Chickensoft.AutoInject;
|
|
using Chickensoft.Introspection;
|
|
using Chickensoft.Serialization;
|
|
using Godot;
|
|
using Zennysoft.Ma.Adapter;
|
|
using Zennysoft.Ma.Adapter.Entity;
|
|
|
|
namespace Zennysoft.Game.Ma;
|
|
|
|
[Meta(typeof(IAutoNode)), Id("weapon")]
|
|
public partial class Weapon : Node3D, IWeapon
|
|
{
|
|
public override void _Notification(int what) => this.Notify(what);
|
|
|
|
[Node] private Sprite3D _sprite { get; set; }
|
|
|
|
public SoundEffect SoundEffect => Stats.SoundEffect;
|
|
|
|
public Weapon()
|
|
{
|
|
Init();
|
|
}
|
|
|
|
public override void _Ready()
|
|
{
|
|
Init();
|
|
}
|
|
|
|
public void Init()
|
|
{
|
|
if (_sprite != null)
|
|
_sprite.Texture = Stats.Texture;
|
|
_bonusDamage = Stats.BonusAttack;
|
|
_bonusDefense = Stats.BonusDefense;
|
|
_bonusLuck = Stats.BonusLuck;
|
|
_bonusHp = Stats.BonusHP;
|
|
_bonusVt = Stats.BonusVT;
|
|
}
|
|
|
|
public string ItemName => Stats.Name;
|
|
|
|
public string StatDescription => Stats.StatDescription;
|
|
|
|
public string FlavorText => Stats.FlavorText;
|
|
|
|
public float SpawnRate => Stats.SpawnRate;
|
|
|
|
public int ThrowDamage => Stats.ThrowDamage;
|
|
|
|
public float ThrowSpeed => Stats.ThrowSpeed;
|
|
|
|
[Save("weapon_attack_speed")]
|
|
public double AttackSpeed => Stats.AttackSpeed;
|
|
[Save("weapon_tag")]
|
|
public WeaponTag WeaponTag => Stats.WeaponTag;
|
|
|
|
public ItemTag ItemTag => Stats.ItemTag;
|
|
[Save("weapon_element")]
|
|
public ElementType WeaponElement => Stats.WeaponElement;
|
|
|
|
public ElementalResistanceSet ElementalResistance => new ElementalResistanceSet(Stats.AeolicResistance, Stats.HydricResistance, Stats.IgneousResistance, Stats.FerrumResistance, Stats.TelluricResistance, Stats.HolyResistance, Stats.CurseResistance);
|
|
|
|
public void IncreaseAttack(int bonus) => _bonusDamage += bonus;
|
|
|
|
public void SetAttack(int newBonus) => _bonusDamage = newBonus;
|
|
|
|
public void IncreaseDefense(int bonus) => _bonusDefense += bonus;
|
|
|
|
public void SetDefense(int newBonus) => _bonusDefense = newBonus;
|
|
|
|
public void IncreaseLuck(int bonus) => _bonusLuck += bonus;
|
|
|
|
public void SetLuck(int newBonus) => _bonusLuck = newBonus;
|
|
|
|
public int BonusAttack { get => _bonusDamage; }
|
|
|
|
public int BonusDefense { get => _bonusDefense; }
|
|
|
|
public int BonusLuck { get => _bonusLuck; }
|
|
|
|
public int BonusHP { get => _bonusHp; }
|
|
|
|
public int BonusVT { get => _bonusVt; }
|
|
|
|
[Save("weapon_bonus_damage")]
|
|
private int _bonusDamage { get; set; } = 0;
|
|
|
|
[Save("weapon_bonus_damage")]
|
|
private int _bonusDefense { get; set; } = 0;
|
|
|
|
[Save("weapon_bonus_luck")]
|
|
private int _bonusLuck { get; set; } = 0;
|
|
|
|
[Save("weapon_bonus_hp")]
|
|
private int _bonusHp { get; set; } = 0;
|
|
|
|
[Save("weapon_bonus_vt")]
|
|
private int _bonusVt { get; set; } = 0;
|
|
|
|
[Export]
|
|
[Save("weapon_stats")]
|
|
public WeaponStats Stats { get; set; } = new WeaponStats();
|
|
public Augment Augment { get; set; }
|
|
|
|
public bool Glued { get; set; }
|
|
|
|
public Texture2D GetTexture() => Stats.Texture;
|
|
}
|