Index: Services/WCell.RealmServer/Spells/Effects/Charge.cs
===================================================================
--- Services/WCell.RealmServer/Spells/Effects/Charge.cs (revision 0)
+++ Services/WCell.RealmServer/Spells/Effects/Charge.cs (revision 0)
@@ -0,0 +1,54 @@
+п»їusing System;
+using WCell.Constants;
+using WCell.Constants.Spells;
+using WCell.Core.Graphics;
+using WCell.RealmServer.Entities;
+using WCell.RealmServer.Handlers;
+using WCell.Constants.NPCs;
+
+namespace WCell.RealmServer.Spells.Effects
+{
+ public class ChargeEffectHandler : SpellEffectHandler
+ {
+ public ChargeEffectHandler(SpellCast cast, SpellEffect effect)
+ : base(cast, effect)
+ {
+ }
+
+ public override void Initialize(ref SpellFailedReason failReason)
+ {
+ if (!m_cast.Selected.IsInFrontOf(m_cast.Caster))
+ {
+ failReason = SpellFailedReason.NotInfront;
+ }
+
+ if (m_cast.CasterUnit.IsInCombat)
+ {
+ failReason = SpellFailedReason.AffectingCombat;
+ }
+
+ failReason = SpellFailedReason.Ok;
+ }
+
+ protected override void Apply(WorldObject target)
+ {
+ float distance = m_cast.Caster.Position.GetDistance(target.Position) - (target as Unit).BoundingRadius - 2;
+
+ Vector3 direction = target.Position - m_cast.Caster.Position;
+ direction.Normalize();
+ direction = m_cast.Caster.Position + direction * distance;
+
+ MovementHandler.SendMoveToPacket(m_cast.CasterUnit, ref direction, m_cast.CasterUnit.Orientation, 3, MonsterMoveFlags.Walk);
+
+ // TODO: Need to put caster and target in combat
+ }
+
+ public override ObjectTypes TargetType
+ {
+ get
+ {
+ return ObjectTypes.Unit;
+ }
+ }
+ }
+}
Index: Services/WCell.RealmServer/Spells/SpellHandler.cs
===================================================================
--- Services/WCell.RealmServer/Spells/SpellHandler.cs (revision 915)
+++ Services/WCell.RealmServer/Spells/SpellHandler.cs (working copy)
@@ -387,6 +387,7 @@
SpellEffectCreators[(int)SpellEffectType.FeedPet] = (cast, effect) => new FeedPetEffectHandler(cast, effect);
SpellEffectCreators[(int)SpellEffectType.SetNumberOfTalentGroups] = (cast, effect) => new SetNumberOfTalentGroupsHandler(cast, effect);
SpellEffectCreators[(int)SpellEffectType.ActivateTalentGroup] = (cast, effect) => new ActivateTalentGroupHandler(cast, effect);
+ SpellEffectCreators[(int)SpellEffectType.Charge] = (cast, effect) => new ChargeEffectHandler(cast, effect);
for (var i = 0; i < SpellEffectCreators.Length; i++)