Skip to content

Commit c27e9eb

Browse files
author
Kamus
committed
Fix and add usage to the knockback skill effect
1 parent 9b91624 commit c27e9eb

File tree

6 files changed

+74
-1
lines changed

6 files changed

+74
-1
lines changed

Framework/Intersect.Framework.Core/GameObjects/Spells/SpellCombatDescriptor.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,11 @@ public string PercentageStatDiffJson
8383

8484
public SpellEffect Effect { get; set; }
8585

86+
/// <summary>
87+
/// Number of tiles to push the target when Knockback effect is applied.
88+
/// </summary>
89+
public int KnockbackTiles { get; set; } = 1;
90+
8691
public string TransformSprite { get; set; }
8792

8893
[Column("OnHit")]

Intersect.Editor/Forms/Editors/frmSpell.Designer.cs

Lines changed: 38 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Intersect.Editor/Forms/Editors/frmSpell.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,8 @@ private void cmbExtraEffect_SelectedIndexChanged(object sender, EventArgs e)
535535
lblSprite.Visible = false;
536536
cmbTransform.Visible = false;
537537
picSprite.Visible = false;
538+
lblKnockbackTiles.Visible = false;
539+
nudKnockbackTiles.Visible = false;
538540

539541
if (cmbExtraEffect.SelectedIndex == 6) //Transform
540542
{
@@ -567,6 +569,13 @@ private void cmbExtraEffect_SelectedIndexChanged(object sender, EventArgs e)
567569
picSprite.BackgroundImage = null;
568570
}
569571
}
572+
573+
if (cmbExtraEffect.SelectedIndex == (int)SpellEffect.Knockback) // Knockback
574+
{
575+
lblKnockbackTiles.Visible = true;
576+
nudKnockbackTiles.Visible = true;
577+
nudKnockbackTiles.Value = Math.Max(1, mEditorItem.Combat.KnockbackTiles);
578+
}
570579
}
571580

572581
private void frmSpell_FormClosed(object sender, FormClosedEventArgs e)
@@ -1100,4 +1109,9 @@ private void cmbTickAnimation_SelectedIndexChanged(object sender, EventArgs e)
11001109
Guid animationId = AnimationDescriptor.IdFromList(cmbTickAnimation.SelectedIndex - 1);
11011110
mEditorItem.TickAnimation = AnimationDescriptor.Get(animationId);
11021111
}
1112+
1113+
private void nudKnockbackTiles_ValueChanged(object sender, EventArgs e)
1114+
{
1115+
mEditorItem.Combat.KnockbackTiles = (int)nudKnockbackTiles.Value;
1116+
}
11031117
}

Intersect.Editor/Localization/Strings.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5364,6 +5364,9 @@ public partial struct SpellEditor
53645364
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
53655365
public static LocalizedString TickAnimation = @"Tick Animation:";
53665366

5367+
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
5368+
public static LocalizedString knockbacktiles = @"Tiles:";
5369+
53675370
public static LocalizedString magicresist = @"Magic Resist:";
53685371

53695372
public static LocalizedString manacost = @"Mana Cost:";

Intersect.Server.Core/Entities/Combat/Status.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,17 @@ public Status(Entity en, Entity attacker, SpellDescriptor spell, SpellEffect typ
208208
}
209209

210210
}
211+
212+
// If this is a Knockback effect, apply the displacement (push target away from attacker)
213+
if (Type == SpellEffect.Knockback && spell.Combat.KnockbackTiles > 0)
214+
{
215+
// Calculate direction from attacker to target, then that's the direction to push
216+
var knockbackDirection = Attacker.GetDirectionTo(en);
217+
if (knockbackDirection != Direction.None)
218+
{
219+
var dash = new Dash(en, spell.Combat.KnockbackTiles, knockbackDirection, false, false, false, false);
220+
}
221+
}
211222
}
212223

213224
public long[] Shield { get; set; } = new long[Enum.GetValues<Vital>().Length];

Intersect.Server.Core/Migrations/Sqlite/Game/SqliteGameContextModelSnapshot.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1535,6 +1535,9 @@ protected override void BuildModel(ModelBuilder modelBuilder)
15351535
b1.Property<int>("HotDotInterval")
15361536
.HasColumnType("INTEGER");
15371537

1538+
b1.Property<int>("KnockbackTiles")
1539+
.HasColumnType("INTEGER");
1540+
15381541
b1.Property<int>("OnHitDuration")
15391542
.HasColumnType("INTEGER")
15401543
.HasColumnName("OnHit");

0 commit comments

Comments
 (0)