Skip to content

Commit d3344af

Browse files
committed
rename SpellBase -> SpellDescriptor
rename SpellCombatData -> SpellCombatDescriptor rename SpellDashOpts -> SpellDashDescriptor rename SpellWarpData -> SpellWarpDescriptor
1 parent 2f2046c commit d3344af

File tree

46 files changed

+340
-328
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+340
-328
lines changed

Framework/Intersect.Framework.Core/Descriptors/GameObjectType.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public enum GameObjectType
3636
[GameObjectInfo(typeof(ShopDescriptor), "shops")]
3737
Shop,
3838

39-
[GameObjectInfo(typeof(SpellBase), "spells")]
39+
[GameObjectInfo(typeof(SpellDescriptor), "spells")]
4040
Spell,
4141

4242
[GameObjectInfo(typeof(CraftingTableDescriptor), "crafting_tables")]

Framework/Intersect.Framework.Core/GameObjects/Items/ItemDescriptor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,9 @@ public AnimationDescriptor EquipmentAnimation
145145

146146
[NotMapped]
147147
[JsonIgnore]
148-
public SpellBase Spell
148+
public SpellDescriptor Spell
149149
{
150-
get => SpellBase.Get(SpellId);
150+
get => SpellDescriptor.Get(SpellId);
151151
set => SpellId = value?.Id ?? Guid.Empty;
152152
}
153153

Framework/Intersect.Framework.Core/GameObjects/NPCs/NPCDescriptor.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -269,11 +269,11 @@ public string JsonMaxVital
269269
public string CraftsJson
270270
{
271271
get => JsonConvert.SerializeObject(Spells, Formatting.None);
272-
protected set => Spells = JsonConvert.DeserializeObject<DbList<SpellBase>>(value);
272+
protected set => Spells = JsonConvert.DeserializeObject<DbList<SpellDescriptor>>(value);
273273
}
274274

275275
[NotMapped]
276-
public DbList<SpellBase> Spells { get; set; } = [];
276+
public DbList<SpellDescriptor> Spells { get; set; } = [];
277277

278278
public string Sprite { get; set; } = string.Empty;
279279

@@ -314,7 +314,7 @@ public string RegenJson
314314
/// <inheritdoc />
315315
public string Folder { get; set; } = string.Empty;
316316

317-
public SpellBase GetRandomSpell(Random random)
317+
public SpellDescriptor GetRandomSpell(Random random)
318318
{
319319
if (Spells == null || Spells.Count == 0)
320320
{
@@ -324,6 +324,6 @@ public SpellBase GetRandomSpell(Random random)
324324
var spellIndex = random.Next(0, Spells.Count);
325325
var spellId = Spells[spellIndex];
326326

327-
return SpellBase.Get(spellId);
327+
return SpellDescriptor.Get(spellId);
328328
}
329329
}

Framework/Intersect.Framework.Core/GameObjects/PlayerClass/ClassSpell.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ public partial class ClassSpell
1010

1111
public int Level { get; set; }
1212

13-
public SpellBase Get()
13+
public SpellDescriptor Get()
1414
{
15-
return SpellBase.Get(Id);
15+
return SpellDescriptor.Get(Id);
1616
}
1717
}

Framework/Intersect.Framework.Core/GameObjects/Projectiles/ProjectileDescriptor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,9 @@ public string GrappleHookOptionsJson
137137

138138
[NotMapped]
139139
[JsonIgnore]
140-
public SpellBase Spell
140+
public SpellDescriptor Spell
141141
{
142-
get => SpellBase.Get(SpellId);
142+
get => SpellDescriptor.Get(SpellId);
143143
set => SpellId = value?.Id ?? Guid.Empty;
144144
}
145145

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
using System.ComponentModel.DataAnnotations.Schema;
2+
using Intersect.Enums;
3+
using Intersect.Utilities;
4+
using Microsoft.EntityFrameworkCore;
5+
using Newtonsoft.Json;
6+
7+
namespace Intersect.GameObjects;
8+
9+
[Owned]
10+
public partial class SpellCombatDescriptor
11+
{
12+
[NotMapped]
13+
public long[] VitalDiff = new long[Enum.GetValues<Vital>().Length];
14+
15+
public int CritChance { get; set; }
16+
17+
public double CritMultiplier { get; set; } = 1.5;
18+
19+
public int DamageType { get; set; } = 1;
20+
21+
public int HitRadius { get; set; }
22+
23+
public bool Friendly { get; set; }
24+
25+
public int CastRange { get; set; }
26+
27+
//Extra Data, Teleport Coords, Custom Spells, Etc
28+
[Column("Projectile")]
29+
public Guid ProjectileId { get; set; }
30+
31+
[NotMapped]
32+
[JsonIgnore]
33+
public ProjectileDescriptor Projectile
34+
{
35+
get => ProjectileDescriptor.Get(ProjectileId);
36+
set => ProjectileId = value?.Id ?? Guid.Empty;
37+
}
38+
39+
//Heal/Damage
40+
[Column("VitalDiff")]
41+
[JsonIgnore]
42+
public string VitalDiffJson
43+
{
44+
get => DatabaseUtils.SaveLongArray(VitalDiff, Enum.GetValues<Vital>().Length);
45+
set => VitalDiff = DatabaseUtils.LoadLongArray(value, Enum.GetValues<Vital>().Length);
46+
}
47+
48+
//Buff/Debuff Data
49+
[Column("StatDiff")]
50+
[JsonIgnore]
51+
public string StatDiffJson
52+
{
53+
get => DatabaseUtils.SaveIntArray(StatDiff, Enum.GetValues<Stat>().Length);
54+
set => StatDiff = DatabaseUtils.LoadIntArray(value, Enum.GetValues<Stat>().Length);
55+
}
56+
57+
[NotMapped]
58+
public int[] StatDiff { get; set; } = new int[Enum.GetValues<Stat>().Length];
59+
60+
//Buff/Debuff Data
61+
[Column("PercentageStatDiff")]
62+
[JsonIgnore]
63+
public string PercentageStatDiffJson
64+
{
65+
get => DatabaseUtils.SaveIntArray(PercentageStatDiff, Enum.GetValues<Stat>().Length);
66+
set => PercentageStatDiff = DatabaseUtils.LoadIntArray(value, Enum.GetValues<Stat>().Length);
67+
}
68+
69+
[NotMapped]
70+
public int[] PercentageStatDiff { get; set; } = new int[Enum.GetValues<Stat>().Length];
71+
72+
public int Scaling { get; set; } = 0;
73+
74+
public int ScalingStat { get; set; }
75+
76+
public SpellTargetType TargetType { get; set; }
77+
78+
public bool HoTDoT { get; set; }
79+
80+
public int HotDotInterval { get; set; }
81+
82+
public int Duration { get; set; }
83+
84+
public SpellEffect Effect { get; set; }
85+
86+
public string TransformSprite { get; set; }
87+
88+
[Column("OnHit")]
89+
public int OnHitDuration { get; set; }
90+
91+
[Column("Trap")]
92+
public int TrapDuration { get; set; }
93+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using Microsoft.EntityFrameworkCore;
2+
3+
namespace Intersect.GameObjects;
4+
5+
[Owned]
6+
public partial class SpellDashDescriptor
7+
{
8+
public bool IgnoreMapBlocks { get; set; }
9+
10+
public bool IgnoreActiveResources { get; set; }
11+
12+
public bool IgnoreInactiveResources { get; set; }
13+
14+
public bool IgnoreZDimensionAttributes { get; set; }
15+
}

Framework/Intersect.Framework.Core/GameObjects/SpellBase.cs renamed to Framework/Intersect.Framework.Core/GameObjects/Spells/SpellDescriptor.cs

Lines changed: 10 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@
55
using Intersect.Framework.Core.GameObjects.Items;
66
using Intersect.Models;
77
using Intersect.Utilities;
8-
using Microsoft.EntityFrameworkCore;
98
using Newtonsoft.Json;
109

1110
namespace Intersect.GameObjects;
1211

13-
public partial class SpellBase : DatabaseObject<SpellBase>, IFolderable
12+
public partial class SpellDescriptor : DatabaseObject<SpellDescriptor>, IFolderable
1413
{
1514
private long[] _vitalCost = new long[Enum.GetValues<Vital>().Length];
1615

@@ -22,12 +21,12 @@ public long[] VitalCost
2221
}
2322

2423
[JsonConstructor]
25-
public SpellBase(Guid id) : base(id)
24+
public SpellDescriptor(Guid id) : base(id)
2625
{
2726
Name = "New Spell";
2827
}
2928

30-
public SpellBase()
29+
public SpellDescriptor()
3130
{
3231
Name = "New Spell";
3332
}
@@ -112,13 +111,13 @@ public string JsonCastRequirements
112111
public string CastSpriteOverride { get; set; }
113112

114113
//Combat Info
115-
public SpellCombatData Combat { get; set; } = new();
114+
public SpellCombatDescriptor Combat { get; set; } = new();
116115

117116
//Warp Info
118-
public SpellWarpData Warp { get; set; } = new();
117+
public SpellWarpDescriptor Warp { get; set; } = new();
119118

120119
//Dash Info
121-
public SpellDashOpts Dash { get; set; } = new();
120+
public SpellDashDescriptor Dash { get; set; } = new();
122121

123122
//Event Info
124123
[Column("Event")]
@@ -149,7 +148,7 @@ public string VitalCostJson
149148
/// </summary>
150149
/// <param name="cooldownGroup">The cooldown group to search for.</param>
151150
/// <returns>Returns an array of <see cref="ItemDescriptor"/> containing all items with the supplied cooldown group.</returns>
152-
public static SpellBase[] GetCooldownGroup(string cooldownGroup)
151+
public static SpellDescriptor[] GetCooldownGroup(string cooldownGroup)
153152
{
154153
cooldownGroup = cooldownGroup.Trim();
155154

@@ -160,118 +159,8 @@ public static SpellBase[] GetCooldownGroup(string cooldownGroup)
160159
}
161160

162161
return Lookup
163-
.Where(i => ((SpellBase)i.Value).CooldownGroup.Trim() == cooldownGroup)
164-
.Select(i => (SpellBase)i.Value)
162+
.Where(i => ((SpellDescriptor)i.Value).CooldownGroup.Trim() == cooldownGroup)
163+
.Select(i => (SpellDescriptor)i.Value)
165164
.ToArray();
166165
}
167-
}
168-
169-
[Owned]
170-
public partial class SpellCombatData
171-
{
172-
[NotMapped]
173-
public long[] VitalDiff = new long[Enum.GetValues<Vital>().Length];
174-
175-
public int CritChance { get; set; }
176-
177-
public double CritMultiplier { get; set; } = 1.5;
178-
179-
public int DamageType { get; set; } = 1;
180-
181-
public int HitRadius { get; set; }
182-
183-
public bool Friendly { get; set; }
184-
185-
public int CastRange { get; set; }
186-
187-
//Extra Data, Teleport Coords, Custom Spells, Etc
188-
[Column("Projectile")]
189-
public Guid ProjectileId { get; set; }
190-
191-
[NotMapped]
192-
[JsonIgnore]
193-
public ProjectileDescriptor Projectile
194-
{
195-
get => ProjectileDescriptor.Get(ProjectileId);
196-
set => ProjectileId = value?.Id ?? Guid.Empty;
197-
}
198-
199-
//Heal/Damage
200-
[Column("VitalDiff")]
201-
[JsonIgnore]
202-
public string VitalDiffJson
203-
{
204-
get => DatabaseUtils.SaveLongArray(VitalDiff, Enum.GetValues<Vital>().Length);
205-
set => VitalDiff = DatabaseUtils.LoadLongArray(value, Enum.GetValues<Vital>().Length);
206-
}
207-
208-
//Buff/Debuff Data
209-
[Column("StatDiff")]
210-
[JsonIgnore]
211-
public string StatDiffJson
212-
{
213-
get => DatabaseUtils.SaveIntArray(StatDiff, Enum.GetValues<Stat>().Length);
214-
set => StatDiff = DatabaseUtils.LoadIntArray(value, Enum.GetValues<Stat>().Length);
215-
}
216-
217-
[NotMapped]
218-
public int[] StatDiff { get; set; } = new int[Enum.GetValues<Stat>().Length];
219-
220-
//Buff/Debuff Data
221-
[Column("PercentageStatDiff")]
222-
[JsonIgnore]
223-
public string PercentageStatDiffJson
224-
{
225-
get => DatabaseUtils.SaveIntArray(PercentageStatDiff, Enum.GetValues<Stat>().Length);
226-
set => PercentageStatDiff = DatabaseUtils.LoadIntArray(value, Enum.GetValues<Stat>().Length);
227-
}
228-
229-
[NotMapped]
230-
public int[] PercentageStatDiff { get; set; } = new int[Enum.GetValues<Stat>().Length];
231-
232-
public int Scaling { get; set; } = 0;
233-
234-
public int ScalingStat { get; set; }
235-
236-
public SpellTargetType TargetType { get; set; }
237-
238-
public bool HoTDoT { get; set; }
239-
240-
public int HotDotInterval { get; set; }
241-
242-
public int Duration { get; set; }
243-
244-
public SpellEffect Effect { get; set; }
245-
246-
public string TransformSprite { get; set; }
247-
248-
[Column("OnHit")]
249-
public int OnHitDuration { get; set; }
250-
251-
[Column("Trap")]
252-
public int TrapDuration { get; set; }
253-
}
254-
255-
[Owned]
256-
public partial class SpellWarpData
257-
{
258-
public Guid MapId { get; set; }
259-
260-
public int X { get; set; }
261-
262-
public int Y { get; set; }
263-
264-
public int Dir { get; set; }
265-
}
266-
267-
[Owned]
268-
public partial class SpellDashOpts
269-
{
270-
public bool IgnoreMapBlocks { get; set; }
271-
272-
public bool IgnoreActiveResources { get; set; }
273-
274-
public bool IgnoreInactiveResources { get; set; }
275-
276-
public bool IgnoreZDimensionAttributes { get; set; }
277-
}
166+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using Microsoft.EntityFrameworkCore;
2+
3+
namespace Intersect.GameObjects;
4+
5+
[Owned]
6+
public partial class SpellWarpDescriptor
7+
{
8+
public Guid MapId { get; set; }
9+
10+
public int X { get; set; }
11+
12+
public int Y { get; set; }
13+
14+
public int Dir { get; set; }
15+
}

0 commit comments

Comments
 (0)