예제 #1
0
        public static int PhysicalAttack(YiObj attacker, MsgInteractType attackType = MsgInteractType.Physical)
        {
            if (!CanAttackPhysical(attacker, attacker.CurrentTarget))
            {
                return(-1);
            }

            if (attacker.HasFlag(StatusEffect.Invisibility))
            {
                attacker.RemoveStatusEffect(StatusEffect.Invisibility);
            }

            if (attacker is Player player)
            {
                if (player.AttackJob != null)
                {
                    player.AttackJob.Cancelled = true;
                }
                if (player.CurrentTarget != null && player.CurrentTarget.Alive)
                {
                    player.AttackJob = YiScheduler.Instance.DoReturn(TimeSpan.FromMilliseconds(attacker.AttackSpeed), () => MsgInteract.Handle(player, MsgInteract.Create(attacker, attacker.CurrentTarget, attackType, 0)));
                }
            }
            return(AttackCalcs.GetDamage(attacker, attacker.CurrentTarget, attackType));
        }
예제 #2
0
파일: MsgInteract.cs 프로젝트: Pircs/Yi
        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);
        }
예제 #3
0
        private static bool AddBuff(YiObj target, Skill skill)
        {
            var shieldBuff = new Buff(target, SkillId.Shield, BuffDuration)
            {
                Effect      = StatusEffect.Invisibility,
                Description = $"Invisibility Level {skill.Level}"
            };

            target.RemoveStatusEffect(StatusEffect.XpList);
            BuffSystem.AddBuff(target, shieldBuff);
            return(true);
        }
예제 #4
0
        private static bool AddBuff(YiObj target, Skill skill)
        {
            var shieldBuff = new Buff(target, SkillId.Shield, BuffDuration)
            {
                PhysDefMod  = DefenseBonusPercent,
                Effect      = StatusEffect.MagicShield,
                Description = $"MagicShield Level {skill.Level}: +{(DefenseBonusPercent*100)-100}% Physical Defense."
            };

            target.RemoveStatusEffect(StatusEffect.XpList);
            BuffSystem.AddBuff(target, shieldBuff);
            return(true);
        }
예제 #5
0
        private static bool AddBuff(YiObj target, Skill skill)
        {
            var shieldBuff = new Buff(target, SkillId.Superman, BuffDuration)
            {
                PhysAtkMod  = AttackBonusPercent,
                Effect      = StatusEffect.SuperMan,
                Description = "Superman: +1.000% Attack!"
            };

            target.RemoveStatusEffect(StatusEffect.XpList);
            BuffSystem.AddBuff(target, shieldBuff);
            return(true);
        }
예제 #6
0
        private static bool AddBuff(YiObj target, Skill skill)
        {
            var shieldBuff = new Buff(target, SkillId.Cyclone, BuffDuration)
            {
                SpeedMod    = SpeedBonusPercent,
                Effect      = StatusEffect.Cyclone,
                Description = "Cyclone: +100% Speed!"
            };

            target.RemoveStatusEffect(StatusEffect.XpList);
            BuffSystem.AddBuff(target, shieldBuff);
            return(true);
        }
예제 #7
0
파일: BuffSystem.cs 프로젝트: Pircs/Yi
        public static void RemoveBuff(YiObj owner, Buff buff)
        {
            Create(owner);
            Entries[owner.UniqueId].TryRemove(buff.SkillId);

            if (Entries[owner.UniqueId].Values.All(b => b.Effect != buff.Effect))
            {
                owner.RemoveStatusEffect(buff.Effect);
            }

            if ((buff.SkillId == SkillId.Superman || buff.SkillId == SkillId.Cyclone) && owner is Player player)
            {
                player.CurrentKO = 0;
            }
        }
예제 #8
0
파일: TeamSystem.cs 프로젝트: Pircs/Yi
        public static void Disband(YiObj leader)
        {
            if (!Teams.ContainsKey(leader.UniqueId))
            {
                return;
            }

            foreach (var member in Teams[leader.UniqueId].Members.Values)
            {
                (member as Player)?.Send(MsgTeam.Kick(member));
                Teams.TryRemove(member.UniqueId);
            }

            (leader as Player)?.Send(MsgTeam.DisbandTeam(leader));
            leader.RemoveStatusEffect(StatusEffect.TeamLeader);
            Teams.TryRemove(leader.UniqueId);
        }
예제 #9
0
        private static bool AddBuff(YiObj target, Skill skill)
        {
            //Map map;
            //if (GameWorld.Maps.TryGetValue(target.MapId, out map))
            //{
            //    if (map.Flags.HasFlag(MapFlags.DisableFly))
            //        target.GetMessage("SYSTEM", target.Name, "Flying forbidden on this map.", MsgTextType.Action);
            //        return false;
            //}

            var flyBuff = new Buff(target, SkillId.Fly, BuffDuration)
            {
                Effect      = StatusEffect.Flying,
                Description = $"XP Fly:{skill.Level}: Makes you fly :3"
            };

            BuffSystem.AddBuff(target, flyBuff);
            target.RemoveStatusEffect(StatusEffect.XpList);
            return(true);
        }