public virtual Effect CloneToDirection(float offset, Enums.AttackType type, Enums.AttackSubType subType) { return(new Effect() { Active = false }); }
private void SingleTargetAttack(uint AttackedUID, Enums.AttackType AttackType) { if (AttackedUID >= Constants.Min_MobUID && AttackedUID <= Constants.Max_MobUID) { Entities.Monster Target; if (!Owner.Character.Screen.Monsters.TryGetValue(AttackedUID, out Target)) { return; } if (!Owner.Character.CanTarget(Target)) { return; } uint Damage = 0; if (AttackType == Enums.AttackType.Archer) { Damage = Calculations.Attacks.RangedPlayerVsMonster(Owner.Character, Target); } else if (AttackType == Enums.AttackType.Physical) { Damage = Calculations.Attacks.MeleePlayerVsMonster(Owner.Character, Target); } else { return; } Target.SendScreen(Packets.ToSend.Attack(Owner.UniqueID, AttackedUID, Target.X, Target.Y, Damage, AttackType)); Target.TakeDamage(Owner.UniqueID, Damage); } else if (AttackedUID >= Constants.Min_PlayerUID && AttackedUID <= Constants.Max_PlayerUID) { Network.SocketClient Target; if (!Owner.Character.Screen.Players.TryGetValue(AttackedUID, out Target)) { return; } if (!Owner.Character.CanTarget(Target.Character)) { return; } uint Damage = 0; if (AttackType == Enums.AttackType.Archer) { Damage = Calculations.Attacks.RangedPlayerVsPlayer(Owner.Character, Target.Character); } else if (AttackType == Enums.AttackType.Physical) { Damage = Calculations.Attacks.MeleePlayerVsPlayer(Owner.Character, Target.Character); } else { return; } Target.Character.Screen.Send(Packets.ToSend.Attack(Owner.UniqueID, AttackedUID, Target.Character.X, Target.Character.Y, Damage, AttackType), true); Target.Character.TakeDamage(Owner.UniqueID, Damage); } }
public override Effect CloneToDirection(float offset, Enums.AttackType type, Enums.AttackSubType subType) { Bullet bullet = new Bullet(); bullet.LoadEffect(Texture); bullet.Position = Position; bullet.Rotation = (Rotation + offset) % (float)(2 * Math.PI); bullet.MaxSpeed = MaxSpeed; bullet.Color = Color; bullet.MinDamage = MinDamage; bullet.MaxDamage = MaxDamage; bullet.CastedBy = CastedBy; bullet.EffectType = type; bullet.EffectSubType = subType; return(bullet); }
public void Handle(byte[] Data, bool AutoAttack = false) { int Time = Environment.TickCount; if (NextAttack > Time) { return; } if (!AutoAttack) { this.LastAttack = Data; } AutoAttack = false; NextAttack = Time + AttackSpeed; uint AttackerUID = BitConverter.ToUInt32(Data, 8); uint AttackedUID = BitConverter.ToUInt32(Data, 12); Enums.AttackType AttackType = (Enums.AttackType)BitConverter.ToUInt16(Data, 20); switch (AttackType) { case Enums.AttackType.Physical: case Enums.AttackType.Archer: SingleTargetAttack(AttackedUID, AttackType); break; case Enums.AttackType.Magic: MagicAttack(Data, AttackedUID); break; case Enums.AttackType.RequestMarriage: break; case Enums.AttackType.AcceptMarriage: break; case Enums.AttackType.Death: break; case Enums.AttackType.None: break; default: break; } }
public static byte[] Attack(uint AttackerUID, uint AttackedUID, ushort AttackedX, ushort AttackedY, uint Damage, Enums.AttackType AttackType) { Writer PWR = new Writer(28); PWR.Fill((ushort)28, 0); PWR.Fill((ushort)1022, 2); PWR.Fill(AttackerUID, 8); PWR.Fill(AttackedUID, 12); PWR.Fill(AttackedX, 16); PWR.Fill(AttackedY, 18); PWR.Fill((uint)AttackType, 20); PWR.Fill(Damage, 24); return(PWR.Bytes); }