Exemple #1
0
        private static void PhysicalAttack(YiObj attacker, ref MsgInteract packet)
        {
            if (attacker.HasFlag(StatusEffect.Invisibility))
            {
                attacker.RemoveStatusEffect(StatusEffect.Invisibility);
            }
            if (attacker.HasFlag(StatusEffect.SpawnProtection))
            {
                attacker.RemoveStatusEffect(StatusEffect.SpawnProtection);
            }

            if (!GameWorld.Maps[attacker.MapId].Find(packet.TargetUniqueId, out YiObj currentTarget))
            {
                return;
            }

            attacker.CurrentTarget = currentTarget;
            packet.Value           = Physical.PhysicalAttack(attacker, packet.Type);

            attacker.Equipment.RemoveDura(MsgItemPosition.LeftWeapon);
            attacker.Equipment.RemoveDura(MsgItemPosition.RightWeapon);
            attacker.Equipment.RemoveDura(MsgItemPosition.Ring);
            attacker.AddWeaponProf(MsgItemPosition.LeftWeapon, (uint)packet.Value);
            attacker.AddWeaponProf(MsgItemPosition.RightWeapon, (uint)packet.Value);

            if (packet.Type == MsgInteractType.Archer)
            {
                packet.Value = packet.Value / 2;
            }

            if (packet.Value == -1)
            {
                return;
            }

            if (attacker.ActivatePassiveSkill(attacker, ref packet.Value, out var skill) && skill.HasValue)
            {
                attacker.CurrentSkill = skill.Value;
                Magic.ExecuteAttack((Player)attacker, attacker.Location);
                return;
            }

            ScreenSystem.Send(attacker, packet, true);
            currentTarget.GetHit(attacker, packet.Type == MsgInteractType.Archer? packet.Value * 2: packet.Value);
        }
Exemple #2
0
        private static void MagicAttack(Player player, ref MsgInteract packet)
        {
            player.Equipment.RemoveDura(MsgItemPosition.RightWeapon);
            if (player.HasFlag(StatusEffect.Invisibility))
            {
                player.RemoveStatusEffect(StatusEffect.Invisibility);
            }
            if (player.HasFlag(StatusEffect.SpawnProtection))
            {
                player.RemoveStatusEffect(StatusEffect.SpawnProtection);
            }

            if (GameWorld.Maps[player.MapId].Find(packet.TargetUniqueId, out YiObj target))
            {
                if (packet.TargetUniqueId != 0)
                {
                    player.CurrentTarget = target;
                }
            }

            Magic.ExecuteAttack(player, new Vector2(packet.X, packet.Y));
        }