protected override void OnActionUpdate(FixPoint delta_time) { SkillComponent skill_component = m_context.GetData <SkillComponent>(BTContextKey.OwnerSkillComponent); Skill skill = skill_component.GetOwnerSkill(); Entity attacker = skill.GetOwnerEntity(); List <Target> targets = skill.GetTargets(); LogicWorld logic_world = skill.GetLogicWorld(); for (int i = 0; i < targets.Count; ++i) { Entity current_target = targets[i].GetEntity(logic_world); if (current_target == null) { continue; } skill_component.CurrentTarget = current_target; DamagableComponent damageable_component = current_target.GetComponent(DamagableComponent.ID) as DamagableComponent; if (damageable_component == null) { continue; } Damage damage = RecyclableObject.Create <Damage>(); damage.m_attacker_id = attacker.ID; damage.m_defender_id = current_target.ID; damage.m_damage_type = m_damage_type_id; damage.m_damage_amount = m_damage_amount.Evaluate(this); damage.m_damage_amount = DamageSystem.Instance.CalculateDamageAmount(m_damage_type_id, damage.m_damage_amount, attacker, current_target); damage.m_render_effect_cfgid = m_damage_render_effect_cfgid; damage.m_sound_cfgid = m_damage_sound_cfgid; damageable_component.TakeDamage(damage); } skill_component.CurrentTarget = null; }
public void Impact() { #if COMBAT_CLIENT if (m_render_effect_cfgid > 0) { if (m_remain_attack_cnt != m_combo_attack_cnt) { PlayRenderEffectMessage stop_msg = RenderMessage.Create <PlayRenderEffectMessage>(); stop_msg.ConstructAsStop(GetOwnerEntityID(), m_render_effect_cfgid); GetLogicWorld().AddRenderMessage(stop_msg); } PlayRenderEffectMessage start_msg = RenderMessage.Create <PlayRenderEffectMessage>(); start_msg.ConstructAsPlay(GetOwnerEntityID(), m_render_effect_cfgid, FixPoint.MinusOne); GetLogicWorld().AddRenderMessage(start_msg); } #endif --m_remain_attack_cnt; if (m_remain_attack_cnt <= 0) { if (m_combo_task != null) { m_combo_task.Cancel(); } } Skill skill = GetOwnerSkill(); if (!skill.GetDefinitionComponent().NeedGatherTargets) { skill.BuildSkillTargets(); } Entity attacker = GetOwnerEntity(); List <Target> targets = skill.GetTargets(); LogicWorld logic_world = GetLogicWorld(); for (int i = 0; i < targets.Count; ++i) { m_current_target = targets[i].GetEntity(logic_world); if (m_current_target == null) { continue; } DamagableComponent damageable_component = m_current_target.GetComponent(DamagableComponent.ID) as DamagableComponent; if (damageable_component == null) { continue; } Damage damage = RecyclableObject.Create <Damage>(); damage.m_attacker_id = attacker.ID; damage.m_defender_id = m_current_target.ID; damage.m_damage_type = m_damage_type_id; damage.m_damage_amount = m_damage_amount.Evaluate(this); damage.m_damage_amount = DamageSystem.Instance.CalculateDamageAmount(m_damage_type_id, damage.m_damage_amount, attacker, m_current_target); damage.m_render_effect_cfgid = m_damage_render_effect_cfgid; damage.m_sound_cfgid = m_damage_sound_cfgid; damageable_component.TakeDamage(damage); } m_current_target = null; }
void ApplyDamage() { EffectDefinitionComponent definition_component = ((Effect)ParentObject).GetDefinitionComponent(); EntityManager entity_manager = GetLogicWorld().GetEntityManager(); Entity attacker = entity_manager.GetObject(definition_component.OriginalEntityID); Entity target = entity_manager.GetObject(definition_component.TargetEntityID); DamagableComponent damageable_component = target.GetComponent(DamagableComponent.ID) as DamagableComponent; if (damageable_component == null) { return; } Damage damage = RecyclableObject.Create <Damage>(); damage.m_attacker_id = definition_component.OriginalEntityID; damage.m_defender_id = definition_component.TargetEntityID; damage.m_damage_type = m_damage_type_id; damage.m_damage_amount = m_damage_amount.Evaluate(this); damage.m_damage_amount = DamageSystem.Instance.CalculateDamageAmount(m_damage_type_id, damage.m_damage_amount, attacker, target); damage.m_render_effect_cfgid = m_damage_render_effect_cfgid; damage.m_sound_cfgid = m_damage_sound_cfgid; damageable_component.TakeDamage(damage); }