diff options
Diffstat (limited to 'scripts/Magic')
| -rw-r--r-- | scripts/Magic/DamageEffect.cs | 18 | ||||
| -rw-r--r-- | scripts/Magic/DamageEffect.cs.uid | 1 | ||||
| -rw-r--r-- | scripts/Magic/Spell.cs.uid | 1 | ||||
| -rw-r--r-- | scripts/Magic/SpellBook.cs | 20 | ||||
| -rw-r--r-- | scripts/Magic/SpellBook.cs.uid | 1 | ||||
| -rw-r--r-- | scripts/Magic/SpellEffect.cs | 10 | ||||
| -rw-r--r-- | scripts/Magic/SpellEffect.cs.uid | 1 | ||||
| -rw-r--r-- | scripts/Magic/SpellResource.cs | 36 | ||||
| -rw-r--r-- | scripts/Magic/SpellResource.cs.uid | 1 |
9 files changed, 89 insertions, 0 deletions
diff --git a/scripts/Magic/DamageEffect.cs b/scripts/Magic/DamageEffect.cs new file mode 100644 index 0000000..abd2cca --- /dev/null +++ b/scripts/Magic/DamageEffect.cs @@ -0,0 +1,18 @@ +using Godot; +using TheLegendOfGustav.Entities.Actors; + +namespace TheLegendOfGustav.Magic; + +[GlobalClass] +public partial class DamageEffect : SpellEffect +{ + [Export] + public int Damage { get; set; } + + public override void Apply(Actor caster, Actor target) + { + int damageDealt = Damage - target.Men; + + target.Hp -= damageDealt; + } +}
\ No newline at end of file diff --git a/scripts/Magic/DamageEffect.cs.uid b/scripts/Magic/DamageEffect.cs.uid new file mode 100644 index 0000000..be2d36b --- /dev/null +++ b/scripts/Magic/DamageEffect.cs.uid @@ -0,0 +1 @@ +uid://cmgtdh2kdo1rq diff --git a/scripts/Magic/Spell.cs.uid b/scripts/Magic/Spell.cs.uid new file mode 100644 index 0000000..78c0570 --- /dev/null +++ b/scripts/Magic/Spell.cs.uid @@ -0,0 +1 @@ +uid://byo6rbhx6nlgh diff --git a/scripts/Magic/SpellBook.cs b/scripts/Magic/SpellBook.cs new file mode 100644 index 0000000..8ccba71 --- /dev/null +++ b/scripts/Magic/SpellBook.cs @@ -0,0 +1,20 @@ +using Godot; + +namespace TheLegendOfGustav.Magic; + +public partial class SpellBook : Node +{ + public Godot.Collections.Array<SpellResource> KnownSpells { get; private set; } = []; + + public bool KnowsSpell(SpellResource spell) => KnownSpells.Contains(spell); + + public void LearnSpell(SpellResource spell) { + if (!KnownSpells.Contains(spell)) { + KnownSpells.Add(spell); + } + } + + public void ForgetSpell(SpellResource spell) { + KnownSpells.Remove(spell); + } +}
\ No newline at end of file diff --git a/scripts/Magic/SpellBook.cs.uid b/scripts/Magic/SpellBook.cs.uid new file mode 100644 index 0000000..d18055c --- /dev/null +++ b/scripts/Magic/SpellBook.cs.uid @@ -0,0 +1 @@ +uid://bn3q4xypi2ogf diff --git a/scripts/Magic/SpellEffect.cs b/scripts/Magic/SpellEffect.cs new file mode 100644 index 0000000..482a64f --- /dev/null +++ b/scripts/Magic/SpellEffect.cs @@ -0,0 +1,10 @@ +using Godot; +using TheLegendOfGustav.Entities.Actors; + +namespace TheLegendOfGustav.Magic; + +[GlobalClass] +public abstract partial class SpellEffect : Resource +{ + public abstract void Apply(Actor caster, Actor target); +}
\ No newline at end of file diff --git a/scripts/Magic/SpellEffect.cs.uid b/scripts/Magic/SpellEffect.cs.uid new file mode 100644 index 0000000..4fc1573 --- /dev/null +++ b/scripts/Magic/SpellEffect.cs.uid @@ -0,0 +1 @@ +uid://brhihikhjtc6e diff --git a/scripts/Magic/SpellResource.cs b/scripts/Magic/SpellResource.cs new file mode 100644 index 0000000..bb3fd15 --- /dev/null +++ b/scripts/Magic/SpellResource.cs @@ -0,0 +1,36 @@ +using Godot; +using TheLegendOfGustav.Entities.Actions; +using TheLegendOfGustav.Entities.Actors; + +namespace TheLegendOfGustav.Magic; + +public enum SpellType +{ + Ranged, + Self +} +[GlobalClass] +public partial class SpellResource : Resource +{ + /// <summary> + /// Ícone do feitiço na interface gráfica. + /// </summary> + [ExportCategory("Visuals")] + [Export] + public Texture2D Icon { get; set; } + /// <summary> + /// Nome do feitiço na interface gráfica. + /// </summary> + [Export] + public string SpellName { get; set; } = "unnamed spell"; + + [ExportCategory("Mechanics")] + [Export] + public int Cost { get; set; } + [Export] + public SpellType Type { get; set; } + [Export] + public int Range { get; set; } + [Export] + public Godot.Collections.Array<SpellEffect> Effects { get; set; } = []; +}
\ No newline at end of file diff --git a/scripts/Magic/SpellResource.cs.uid b/scripts/Magic/SpellResource.cs.uid new file mode 100644 index 0000000..7472e6b --- /dev/null +++ b/scripts/Magic/SpellResource.cs.uid @@ -0,0 +1 @@ +uid://bi6jdrduu76de |
