public void Start(long begin) { if (_death == null) { _death = new AbnormalityDuration(Tera.Game.PlayerClass.Common, begin); return; } _death.Start(begin); }
private void RegisterBuff() { if (HotDot.Type == "HPChange" || HotDot.Type == "MPChange") { return; } var userEntity = NetworkController.Instance.EntityTracker.GetOrNull(Target); if (!(userEntity is UserEntity)) { return; } var player = new Player((UserEntity)userEntity); if (!DamageTracker.Instance.UsersStats.ContainsKey(player)) { DamageTracker.Instance.UsersStats.Add(player, new PlayerInfo(player)); } var duration = new Duration(FirstHit, long.MaxValue); if (!DamageTracker.Instance.UsersStats[player].AbnormalityTime.ContainsKey(HotDot)) { var npcEntity = NetworkController.Instance.EntityTracker.GetOrPlaceholder(Source); PlayerClass playerClass; if (!(npcEntity is UserEntity)) { playerClass = PlayerClass.Common; } else { playerClass = ((UserEntity)npcEntity).RaceGenderClass.Class; } var abnormalityInitDuration = new AbnormalityDuration(playerClass); abnormalityInitDuration.ListDuration.Add(duration); DamageTracker.Instance.UsersStats[player].AbnormalityTime.Add(HotDot, abnormalityInitDuration); _buffRegistered = true; return; } ////////// !! WARNING !! var count = DamageTracker.Instance.UsersStats[player].AbnormalityTime[HotDot].ListDuration.Count; if (count > 0) { if (DamageTracker.Instance.UsersStats[player].AbnormalityTime[HotDot].ListDuration[count - 1].End == long.MaxValue) { return; } } //////////// DamageTracker.Instance.UsersStats[player].AbnormalityTime[HotDot].ListDuration.Add(duration); _buffRegistered = true; }
public object Clone() { var newListDuration = _listDuration.Select(duration => (Duration)duration.Clone()).ToList(); var abnormalityDuration = new AbnormalityDuration(InitialPlayerClass) { _listDuration = newListDuration }; return(abnormalityDuration); }
public void Reset() { _hasReset = new List <Entity>(); var newUserStats = new Dictionary <Player, PlayerInfo>(); var newEntityStats = new Dictionary <Entity, EntityInfo>(); bool add; foreach (var entity in EntitiesStats) { add = false; var newEntityStat = new EntityInfo(); foreach (var abnormality in entity.Value.AbnormalityTime) { if (abnormality.Value.Ended()) { continue; } var duration = new AbnormalityDuration(abnormality.Value.InitialPlayerClass); duration.ListDuration.Add(abnormality.Value.ListDuration[abnormality.Value.ListDuration.Count - 1]); newEntityStat.AbnormalityTime.Add(abnormality.Key, duration); add = true; } if (add) { newEntityStats.Add(entity.Key, newEntityStat); } } foreach (var user in UsersStats) { add = false; var newUserStat = new PlayerInfo(user.Key); foreach (var abnormality in user.Value.AbnormalityTime) { if (abnormality.Value.Ended()) { continue; } var duration = new AbnormalityDuration(abnormality.Value.InitialPlayerClass); duration.ListDuration.Add(abnormality.Value.ListDuration[abnormality.Value.ListDuration.Count - 1]); newUserStat.AbnormalityTime.Add(abnormality.Key, duration); add = true; } if (add) { newUserStats.Add(user.Key, newUserStat); } } UsersStats = newUserStats; EntitiesStats = newEntityStats; }
private void RegisterEnduranceDebuff() { if (HotDot.Type != "Endurance" || HotDot.Amount > 1) { return; } var duration = new Duration(FirstHit, long.MaxValue); var entityGame = NetworkController.Instance.EntityTracker.GetOrPlaceholder(Target); Entity entity = null; var game = entityGame as NpcEntity; if (game != null) { var target = game; entity = new Entity(target.CategoryId, target.Id, target.NpcId, target.NpcArea); } if (entity == null) { return; } if (!DamageTracker.Instance.EntitiesStats.ContainsKey(entity)) { DamageTracker.Instance.EntitiesStats.Add(entity, new EntityInfo()); } if (!DamageTracker.Instance.EntitiesStats[entity].AbnormalityTime.ContainsKey(HotDot)) { var npcEntity = NetworkController.Instance.EntityTracker.GetOrPlaceholder(Source); if (!(npcEntity is UserEntity)) { return; } var user = (UserEntity)npcEntity; var abnormalityInitDuration = new AbnormalityDuration(user.RaceGenderClass.Class); abnormalityInitDuration.ListDuration.Add(duration); DamageTracker.Instance.EntitiesStats[entity].AbnormalityTime.Add(HotDot, abnormalityInitDuration); _enduranceDebuffRegistered = true; return; } DamageTracker.Instance.EntitiesStats[entity].AbnormalityTime[HotDot].ListDuration.Add(duration); _enduranceDebuffRegistered = true; }
private void RegisterBuff() { if (HotDot.Type == "HPChange" || HotDot.Type == "MPChange") { return; } var userEntity = NetworkController.Instance.EntityTracker.GetOrNull(Target); if (!(userEntity is UserEntity)) { return; } var player = NetworkController.Instance.PlayerTracker.GetOrUpdate((UserEntity)userEntity); if (!DamageTracker.Instance.UsersStats.ContainsKey(player)) { DamageTracker.Instance.UsersStats.Add(player, new PlayerInfo(player)); } if (!DamageTracker.Instance.UsersStats[player].AbnormalityTime.ContainsKey(HotDot)) { var npcEntity = NetworkController.Instance.EntityTracker.GetOrPlaceholder(Source); PlayerClass playerClass; if (!(npcEntity is UserEntity)) { playerClass = PlayerClass.Common; } else { playerClass = ((UserEntity)npcEntity).RaceGenderClass.Class; } var abnormalityInitDuration = new AbnormalityDuration(playerClass, FirstHit); DamageTracker.Instance.UsersStats[player].AbnormalityTime.Add(HotDot, abnormalityInitDuration); _buffRegistered = true; return; } DamageTracker.Instance.UsersStats[player].AbnormalityTime[HotDot].Start(FirstHit); _buffRegistered = true; }
public void DeleteEntity(Entity entity) { if (NetworkController.Instance.Encounter == entity) { NetworkController.Instance.Encounter = null; } var add = false; var newEntityStat = new EntityInfo(); if (EntitiesStats.ContainsKey(entity)) { foreach (var abnormality in EntitiesStats[entity].AbnormalityTime) { if (abnormality.Value.Ended()) { continue; } var duration = new AbnormalityDuration(abnormality.Value.InitialPlayerClass); duration.ListDuration.Add(abnormality.Value.ListDuration[abnormality.Value.ListDuration.Count - 1]); newEntityStat.AbnormalityTime.Add(abnormality.Key, duration); add = true; } } EntitiesStats.Remove(entity); if (add) { EntitiesStats.Add(entity, newEntityStat); } foreach (var stats in UsersStats) { stats.Value.Dealt.RemoveEntity(entity); stats.Value.Received.RemoveEntity(entity); } _hasReset.Remove(entity); }