private void TargetHit2(IBattleEntity target, TargetHitType hitType, Skill skill, int damage, int hitmode, short?skillEffect = null, short?mapX = null, short?mapY = null, ComboDTO skillCombo = null, bool showTargetAnimation = false, bool isPvp = false, bool isRange = false) { target.GetDamage(damage, Entity, !(Session is MapMonster mon && mon.IsInvicible)); string str = $"su {(byte)Entity.SessionType()} {Entity.GetId()} {(byte)target.SessionType()} {target.GetId()} {skill?.SkillVNum ?? 0} {skill?.Cooldown ?? 0}"; switch (hitType) { case TargetHitType.SingleTargetHit: str += $" {skill?.AttackAnimation ?? 11} {skill?.Effect ?? skillEffect ?? 0} {Entity.GetPos().X} {Entity.GetPos().Y} {(target.CurrentHp > 0 ? 1 : 0)} {(int)(target.CurrentHp / (double)target.MaxHp * 100)} {damage} {hitmode} {skill?.SkillType - 1 ?? 0}"; break; case TargetHitType.SingleTargetHitCombo: str += $" {skillCombo?.Animation ?? 0} {skillCombo?.Effect ?? 0} {Entity.GetPos().X} {Entity.GetPos().Y} {(target.CurrentHp > 0 ? 1 : 0)} {(int)(target.CurrentHp / (double)target.MaxHp * 100)} {damage} {hitmode} {skill.SkillType - 1}"; break; case TargetHitType.SingleAOETargetHit: switch (hitmode) { case 1: hitmode = 4; break; case 3: hitmode = 6; break; default: hitmode = 5; break; } if (showTargetAnimation) { Entity.MapInstance.Broadcast($" {skill?.AttackAnimation ?? 0} {skill?.Effect ?? 0} 0 0 {(target.CurrentHp > 0 ? 1 : 0)} {(int)(target.CurrentHp / (double)target.MaxHp * 100)} 0 0 {skill.SkillType - 1}"); } str += $" {skill?.AttackAnimation ?? 0} {skill?.Effect ?? 0} {Entity.GetPos().X} {Entity.GetPos().Y} {(target.CurrentHp > 0 ? 1 : 0)} {(int)(target.CurrentHp / (double)target.MaxHp * 100)} {damage} {hitmode} {skill.SkillType - 1}"; break; case TargetHitType.AOETargetHit: switch (hitmode) { case 1: hitmode = 4; break; case 3: hitmode = 6; break; default: hitmode = 5; break; } str += $" {skill?.AttackAnimation ?? 0} {skill?.Effect ?? 0} {Entity.GetPos().X} {Entity.GetPos().Y} {(target.CurrentHp > 0 ? 1 : 0)} {(int)(target.CurrentHp / (double)target.MaxHp * 100)} {damage} {hitmode} {skill.SkillType - 1}"; break; case TargetHitType.ZoneHit: str += $" {skill?.AttackAnimation ?? 0} {skillEffect ?? 0} {mapX ?? Entity.GetPos().X} {mapY ?? Entity.GetPos().Y} {(target.CurrentHp > 0 ? 1 : 0)} {(int)(target.CurrentHp / (double)target.MaxHp * 100)} {damage} 5 {skill.SkillType - 1}"; break; case TargetHitType.SpecialZoneHit: str += $" {skill?.AttackAnimation ?? 0} {skillEffect ?? 0} {Entity.GetPos().X} {Entity.GetPos().Y} {(target.CurrentHp > 0 ? 1 : 0)} {(int)(target.CurrentHp / (double)target.MaxHp * 100)} {damage} 0 {skill.SkillType - 1}"; break; } Entity.MapInstance.Broadcast(str); bool isBoss = false; if (Entity.GetSession() is Character character) { character.LastSkillUse = DateTime.Now; RemoveBuff(85); // Hideout } else if (Entity.GetSession() is Mate mate) { mate.LastSkillUse = DateTime.Now; } if (target.GetSession() is MapMonster monster) { if (monster.Target == null) { monster.LastSkill = DateTime.Now; } monster.Target = Entity; isBoss = monster.IsBoss; if (isBoss) { Entity.MapInstance?.Broadcast(monster.GenerateBoss()); } monster.DamageList.AddOrUpdate(Entity, damage, (key, oldValue) => oldValue + damage); } if (!isBoss && skill != null) { foreach (BCard bcard in skill.BCards.Where(b => b != null)) { switch ((CardType)bcard.Type) { case CardType.Buff: Buff.Buff b = new Buff.Buff(bcard.SecondData); switch (b.Card?.BuffType) { case BuffType.Bad: bcard.ApplyBCards(target, Entity); break; case BuffType.Good: case BuffType.Neutral: bcard.ApplyBCards(Entity, Entity); break; } break; case CardType.HealingBurningAndCasting: switch ((AdditionalTypes.HealingBurningAndCasting)bcard.SubType) { case AdditionalTypes.HealingBurningAndCasting.RestoreHP: case AdditionalTypes.HealingBurningAndCasting.RestoreHPWhenCasting: bcard.ApplyBCards(Entity, Entity); break; default: bcard.ApplyBCards(target, Entity); break; } break; case CardType.MeditationSkill: bcard.ApplyBCards(Entity); break; default: bcard.ApplyBCards(target, Entity); break; } } } if (skill == null || (skill.Range <= 0 && skill.TargetRange <= 0) || isRange || !(Entity.GetSession() is MapMonster)) { return; } foreach (IBattleEntity entitiesInRange in Entity.MapInstance?.GetBattleEntitiesInRange(Entity.GetPos(), skill.TargetRange).Where(e => e != target && e.IsTargetable(Entity.SessionType()))) { TargetHit2(entitiesInRange, TargetHitType.SingleTargetHit, skill, damage, hitmode, isRange: true); } }