public CharacterAction_EffectCamera Clone(CharacterActionData action_data, ICreature skill_creature, ISkillTarget target, CharacterAction_EffectTarget linked_target) { CharacterAction_EffectCamera new_effect = new CharacterAction_EffectCamera(); new_effect.m_ActionData = action_data; new_effect.time = this.time; new_effect.target = target; new_effect.target_linked = target_linked; new_effect.LinkedTarget = linked_target; new_effect.m_SkillCreature = skill_creature; new_effect.power = power; new_effect.duration = duration; return(new_effect); }
public CharacterAction_EffectContainer Clone(CharacterActionData action_data, Character self, List <ISkillTarget> targets) { CharacterAction_EffectContainer new_container = new CharacterAction_EffectContainer(); new_container.m_ActionData = action_data; new_container.ScaleTime = this.ScaleTime; new_container.MoveScale = this.MoveScale; new_container.JumpScale = this.JumpScale; new_container.FxHeight = this.FxHeight; List <CharacterAction_EffectCasting> casting = new List <CharacterAction_EffectCasting>(); for (int i = 0; i < Casting.Length; ++i) { if (action_data == null || Casting[i].IsEnable == true) { casting.Add(Casting[i].Clone(action_data, self)); } } new_container.Casting = casting.ToArray(); if (action_data != null) { float first_action_time = -1f, last_action_time = 0f; int target_count = targets == null ? 0 : targets.Count; List <CharacterAction_EffectTarget> effect_target = new List <CharacterAction_EffectTarget>(); List <CharacterAction_EffectHit> effect_hit = new List <CharacterAction_EffectHit>(); List <CharacterAction_EffectBuff> effect_buff = new List <CharacterAction_EffectBuff>(); List <CharacterAction_EffectCamera> effect_camera = new List <CharacterAction_EffectCamera>(); List <CharacterAction_EffectTarget> temp_effect_target = new List <CharacterAction_EffectTarget>(); for (int target_index = 0; target_index < target_count; ++target_index) { if (targets[target_index] == null) { continue; } float time_gap = (target_index == 0 || TargetTimeGroup == 0) ? 0f : (TargetTimeGap * ((target_index - 1) / TargetTimeGroup + 1)); if (UseSingTarget == false) { temp_effect_target.Clear(); } if (UseSingTarget == false || target_index == 0) { for (int i = 0; i < Target.Length; ++i) { if (Target[i].IsEnable == false) { continue; } int effect_target_count = Math.Max(1, Target[i].count); for (int et = 0; et < effect_target_count; ++et) { CharacterAction_EffectTarget new_data = Target[i].Clone(action_data, self, targets[target_index].Character); new_data.time += time_gap + et * Target[i].time_tick; effect_target.Add(new_data); temp_effect_target.Add(new_data); } } } if (targets[target_index] == null || targets[target_index].Character == null || targets[target_index].Character.Creature.IsDead == true) { continue; } if (Hit.Length > 0) { List <float> hits = new List <float>(); int hit_chance_total = 0; for (int i = 0; i < Hit.Length; ++i) { if (Hit[i].IsEnable == false) { continue; } if (Hit[i].target_linked == true) { for (int j = 0; j < temp_effect_target.Count; ++j) { hits.Add(Hit[i].chance); hit_chance_total += Hit[i].chance; } } else { for (int hit_index = 0; hit_index < Hit[i].count; ++hit_index) { hits.Add(Hit[i].chance); hit_chance_total += Hit[i].chance; } } } hits = hits.Select(h => h / hit_chance_total).ToList(); targets[target_index].InitHit(hits); for (int i = 0, hit_index = 0; i < Hit.Length; ++i) { CharacterAction_EffectHit hit = Hit[i]; if (hit.IsEnable == false) { continue; } if (hit.target_linked) { foreach (CharacterAction_EffectTarget target in temp_effect_target) { CharacterAction_EffectHit new_data = hit.Clone(action_data, self.Creature, targets[target_index], target); new_data.time += target.time + (UseSingTarget == true?time_gap:0f); new_data.HitIndex = hit_index++; effect_hit.Add(new_data); } } else { for (int hit_count_index = 0; hit_count_index < hit.count; ++hit_count_index) { float hit_time_gap = (target_index == 0 || TargetTimeGroup == 0) ? 0f : ((hit.time_gap == 0f?TargetTimeGap:hit.time_gap) * ((target_index - 1) / TargetTimeGroup + 1)); CharacterAction_EffectHit new_data = hit.Clone(action_data, self == null ? null : self.Creature, targets[target_index], null); new_data.time += hit_time_gap + hit_count_index * new_data.time_tick; new_data.HitIndex = hit_index++; effect_hit.Add(new_data); } } } if (effect_hit.Count > 0) { first_action_time = effect_hit[0].time; last_action_time = effect_hit[effect_hit.Count - 1].time; } } if (Buff.Length > 0) { for (int i = 0; i < Buff.Length; ++i) { CharacterAction_EffectBuff buff = Buff[i]; if (buff.IsEnable == false) { continue; } if (buff.target_linked) { foreach (CharacterAction_EffectTarget target in temp_effect_target) { CharacterAction_EffectBuff new_data = buff.Clone(action_data, self.Creature, targets[target_index], null); new_data.time += target.time + (UseSingTarget == true ? time_gap : 0f); effect_buff.Add(new_data); } } else { CharacterAction_EffectBuff new_data = buff.Clone(action_data, self == null?null:self.Creature, targets[target_index], null); new_data.time += time_gap; effect_buff.Add(new_data); } } if (effect_buff.Count > 0) { if (first_action_time == -1f) { first_action_time = effect_buff[0].time; } else { first_action_time = Mathf.Min(first_action_time, effect_buff[0].time); } last_action_time = Mathf.Max(last_action_time, effect_buff[effect_buff.Count - 1].time); } } if (Camera.Length > 0) { for (int i = 0; i < Camera.Length; ++i) { CharacterAction_EffectCamera camera = Camera[i]; if (camera.IsEnable == false) { continue; } if (camera.target_linked) { foreach (CharacterAction_EffectTarget target in temp_effect_target) { CharacterAction_EffectCamera new_data = camera.Clone(action_data, self.Creature, targets[target_index], null); new_data.time += target.time + (UseSingTarget == true ? time_gap : 0f); effect_camera.Add(new_data); } } else { CharacterAction_EffectCamera new_data = camera.Clone(action_data, self == null ? null : self.Creature, targets[target_index], null); new_data.time += time_gap; effect_camera.Add(new_data); } } if (effect_camera.Count > 0) { if (first_action_time == -1f) { first_action_time = effect_camera[0].time; } else { first_action_time = Mathf.Min(first_action_time, effect_camera[0].time); } last_action_time = Mathf.Max(last_action_time, effect_camera[effect_camera.Count - 1].time); } } } new_container.Target = effect_target.ToArray(); new_container.Hit = effect_hit.ToArray(); new_container.Buff = effect_buff.ToArray(); new_container.Camera = effect_camera.ToArray(); new_container.FirstActionTime = first_action_time; new_container.LastActionTime = last_action_time; } else { new_container.Target = new CharacterAction_EffectTarget[Target.Length]; for (int i = 0; i < Target.Length; ++i) { new_container.Target[i] = Target[i].Clone(null, null, null); } new_container.Hit = new CharacterAction_EffectHit[Hit.Length]; for (int i = 0; i < Hit.Length; ++i) { new_container.Hit[i] = Hit[i].Clone(null, null, null, null); } new_container.Buff = new CharacterAction_EffectBuff[Buff.Length]; for (int i = 0; i < Buff.Length; ++i) { new_container.Buff[i] = Buff[i].Clone(null, null, null, null); } new_container.Camera = new CharacterAction_EffectCamera[Camera.Length]; for (int i = 0; i < Camera.Length; ++i) { new_container.Camera[i] = Camera[i].Clone(null, null, null, null); } } return(new_container); }