public void Init(Transform attach_transform, float text_offset, string text, eTextPushType push_type, float scale, float add_position) { CheckText(); AttachTransform = attach_transform; PushType = push_type; m_Text.text = text; m_Scale = scale; Reset(); Depth = text_offset; AddPosition = 2f + add_position; switch (push_type) { case eTextPushType.Critical: m_Text.fontSize = 22; AddPosition += 1f; break; case eTextPushType.Normal: m_Text.fontSize = 20; break; case eTextPushType.Dot: m_Text.fontSize = 16; break; case eTextPushType.CriticalDot: m_Text.fontSize = 18; break; } }
override public eSkillTargetHit OnHit() { eTextPushType push_type = MNS.Random.Instance.NextRange(1, 10) <= 3 ? eTextPushType.Critical : eTextPushType.Normal; if (m_Self.Creature.IsTeam != m_Target.Creature.IsTeam) #if !SH_ASSETBUNDLE { TextManager.Instance.PushDamage(m_Self.Creature.Info.AttackType == SharedData.eAttackType.physic, m_Target.Creature, -100, push_type); } #else { TextManager.Instance.PushDamage(true, m_Target.Creature, -100, push_type); }
public void PushHeal(ICreature creature, int heal, eTextPushType push_type, float add_position = 0f) { if (creature.IsShowText == false) { return; } Transform attach_transform = creature.Character.transform; float scale = attach_transform.GetComponent <Character>().Creature.Scale; Heal.Push(attach_transform, creature.TextOffset, GetNumberText(heal), push_type, scale, add_position); }
public void PushMana(ICreature creature, int mp, eTextPushType push_type, float add_position = 0f) { if (creature.IsShowText == false) { return; } Transform attach_transform = creature.Character.transform; float scale = attach_transform.GetComponent <Character>().Creature.Scale; string text = string.Format("{0:0.##}%", mp * 0.01f); if (mp > 0) { text = "+" + text; } Mana.Push(attach_transform, creature.TextOffset, text, push_type, scale, add_position); }
public void PushDamage(bool is_physic, ICreature creature, int damage, eTextPushType push_type, float add_position = 0f) { if (creature.IsShowText == false) { return; } Transform attach_transform = creature.Character.transform; float scale = attach_transform.GetComponent <Character>().Creature.Scale; if (is_physic) { DamagePhysic.Push(attach_transform, creature.TextOffset, GetNumberText(damage), push_type, scale, add_position); } else { DamageMagic.Push(attach_transform, creature.TextOffset, GetNumberText(damage), push_type, scale, add_position); } }
public bool Update() { float playback_time = m_Creature.Character.PlaybackTime; float past_time = playback_time - StartTime; float percent = past_time / Duration; if (BuffContainer.Asset != null) { BuffContainer.Asset.OnUpdate(percent, AffectValuePercent); } bool is_finish = false; if (Action != null && Action.Update(playback_time) == false || Parent != null && Parent.IsFinish == true) { is_finish = true; } if (Action == null && Parent == null && past_time >= Duration && Duration != -1f) { is_finish = true; } if (IsFinish == true) { if (Action == null || is_finish == true) { return(false); } return(true); } if (BattleBase.Instance.IsBattleEnd == true) { return(true); } switch (ActionInfo.actionType) { case eActionType.dot_damage: case eActionType.dot_heal: if ((past_time - m_DotTime >= m_DotTick || is_finish == true)) { m_DotValue = Value * (past_time - m_LastUpdateTime); int hit_value = (int)m_DotValue; m_DotValue -= hit_value; m_LastUpdateTime = past_time; bool is_critical = false; if (BattleConfig.Instance.UseCritical && Skill.IsLeaderActive == false) { is_critical = MNS.Random.Instance.NextRange(1, 10000) <= Skill.Creature.GetValue(eStatType.CriticalChance); if (is_critical == false) { is_critical = ((m_Creature.IsTeam != Skill.Creature.IsTeam && (m_Creature.CanAction(Skill) == false || m_Creature.IsPlayingAction) || m_Creature.IsTeam == Skill.Creature.IsTeam && !(m_Creature.CanAction() == false || m_Creature.IsPlayingAction))); } } int critical_power = Skill.Creature.GetValue(eStatType.CriticalPower); eTextPushType push_type = is_critical ? eTextPushType.CriticalDot : eTextPushType.Dot; if (is_critical) { hit_value = hit_value * critical_power / 10000; } if (ActionInfo.actionType == eActionType.dot_damage) { if (m_Creature.InvokeImmune(eImmuneType.dot, Skill.Creature.Info.AttackType, Skill.Level) == false) { if (Skill.Creature != null) { Skill.Creature.AddDeal(-hit_value); } m_Creature.SetDamage(hit_value, true); TextManager.Instance.PushDamage(Skill.Creature.Info.AttackType == SharedData.eAttackType.physic, m_Creature, hit_value, push_type); float damage_percent = -hit_value / (float)m_Creature.Stat.MaxHP; m_Creature.AddMP(eMPFillType.Damage, damage_percent); if (Skill.IsDefault == true) { Skill.Creature.AddMP(eMPFillType.Deal, damage_percent); } ActionInfo.Fire(Skill, eActionType.dot_damage, hit_value); } } else { m_Creature.SetHeal(hit_value, true); TextManager.Instance.PushHeal(m_Creature, hit_value, push_type); if (Skill.IsDefault == true) { float heal_percent = hit_value / (float)m_Creature.Stat.MaxHP; Skill.Creature.AddMP(eMPFillType.Heal, heal_percent); } } m_DotTime += m_DotTick; } break; case eActionType.dot_damage_mana: case eActionType.dot_heal_mana: if ((past_time - m_DotTime >= m_DotTick || is_finish == true)) { m_DotValue = Value * (past_time - m_LastUpdateTime); int hit_value = (int)m_DotValue; m_DotValue -= hit_value; m_LastUpdateTime = past_time; bool is_critical = false; if (BattleConfig.Instance.UseCritical && Skill.IsLeaderActive == false) { is_critical = MNS.Random.Instance.NextRange(1, 10000) <= Skill.Creature.GetValue(eStatType.CriticalChance); if (is_critical == false) { is_critical = ((m_Creature.IsTeam != Skill.Creature.IsTeam && (m_Creature.CanAction(Skill) == false || m_Creature.IsPlayingAction) || m_Creature.IsTeam == Skill.Creature.IsTeam && !(m_Creature.CanAction() == false || m_Creature.IsPlayingAction))); } } int critical_power = Skill.Creature.GetValue(eStatType.CriticalPower); eTextPushType push_type = is_critical ? eTextPushType.CriticalDot : eTextPushType.Dot; if (is_critical) { hit_value = hit_value * critical_power / 10000; } if (ActionInfo.actionType == eActionType.dot_damage_mana) { if (m_Creature.InvokeImmune(eImmuneType.dot, Skill.Creature.Info.AttackType, Skill.Level) == false) { m_Creature.SetDamageMana(hit_value, true); TextManager.Instance.PushMana(m_Creature, hit_value, push_type); } } else { m_Creature.SetHealMana(hit_value, true); TextManager.Instance.PushMana(m_Creature, hit_value, push_type); } m_DotTime += m_DotTick; } break; } if (is_finish) { IsFinish = true; return(false); } return(true); }
override public eSkillTargetHit OnHit() { HitInfo hit_info = HitValues.Dequeue(); SkillInfo.Action main_action = Skill.Info.Actions[0]; if (BattleBase.Instance.IsBattleEnd == true) { return(eSkillTargetHit.Miss); } if (m_Creature.IsDead == true || main_action.check_distance == true && Character.MoveDistance > BattleConfig.Instance.HitDistance) { bool next = false; if (Skill.Info.TargetType == eTargetType.position_next) { int target_index = target_container.target_creatures.FindIndex(c => c == m_Creature); if (target_index != -1) { for (int i = target_index + 1; i < target_container.target_creatures.Count + target_index; ++i) { ICreature target_creature = target_container.target_creatures[i % target_container.target_creatures.Count]; if (target_creature != null && target_creature.IsDead == false && (main_action.check_distance == false || target_creature.Character.MoveDistance < BattleConfig.Instance.HitDistance)) { // 당첨 m_Creature = target_creature as BattleCreature; next = true; break; } } } } if (next == false) { if (m_Creature.IsDead == false) { if (target_container.main_target != null) { Battle.Instance.PlayParticle(target_container.main_target, Battle.Instance.m_Miss); TextManager.Instance.PushMessagePosition(target_container.main_target, Skill.Creature, Localization.Get("AttackFail"), eBuffColorType.Immune, eTextPushType.Normal, -4f); } return(eSkillTargetHit.MissPosition); } return(eSkillTargetHit.Miss); } } if (m_Creature.IsTeam != Skill.Creature.IsTeam) { int hit_rate = Skill.Creature.GetValue(eStatType.HitRate); int evade_rate = m_Creature.GetValue(eStatType.EvadeRate); if (MNS.Random.Instance.NextRange(1, 10000) > (hit_rate - evade_rate)) { TextManager.Instance.PushMessage(m_Creature, Localization.Get("Evade"), eBuffColorType.Immune, eTextPushType.Normal); return(eSkillTargetHit.Evade); } } int critical_power = Skill.Creature.GetValue(eStatType.CriticalPower); bool is_critical = false; if (BattleConfig.Instance.UseCritical && Skill.IsLeaderActive == false) { is_critical = MNS.Random.Instance.NextRange(1, 10000) <= Skill.Creature.GetValue(eStatType.CriticalChance); if (is_critical == false) { is_critical = ((m_Creature.IsTeam != Skill.Creature.IsTeam && (m_Creature.CanAction(Skill) == false || m_Creature.IsPlayingAction) || m_Creature.IsTeam == Skill.Creature.IsTeam && !(m_Creature.CanAction() == false || m_Creature.IsPlayingAction))); } } var direct_actions = Skill.Info.Actions.Where(a => a.IsDirect); bool is_damage_mana = direct_actions.Any(a => a.actionType == eActionType.damage_mana); foreach (SkillInfo.Action action in direct_actions) { int hit_value = Mathf.RoundToInt(CalculateHitValue(action) * hit_info.percent); eTextPushType push_type = is_critical ? eTextPushType.Critical : eTextPushType.Normal; if (is_critical) { hit_value = hit_value * critical_power / 10000; } switch (action.actionType) { case eActionType.damage: { if (m_Creature.InvokeImmune(eImmuneType.damage, Skill.Creature.Info.AttackType, Skill.Level) == true) { return(eSkillTargetHit.Immune); } if (Skill.Creature != null) { Skill.Creature.AddDeal(-hit_value); } hit_value = m_Creature.ApplyShield(Skill.Creature.Info.AttackType, hit_value); if (hit_value < 0) { TextManager.Instance.PushDamage(Skill.Creature.Info.AttackType == SharedData.eAttackType.physic, m_Creature, hit_value, push_type); m_Creature.SetDamage(hit_value, false); m_Creature.SetWait(); float damage_percent = -hit_value / (float)m_Creature.Stat.MaxHP; if (is_damage_mana == false) { m_Creature.AddMP(eMPFillType.Damage, damage_percent); } if (Skill.IsDefault == true) { Skill.Creature.AddMP(eMPFillType.Deal, damage_percent); } action.Fire(Skill, eActionType.damage, hit_value); } else { return(eSkillTargetHit.Shield); } } break; case eActionType.heal: { TextManager.Instance.PushHeal(m_Creature, hit_value, push_type); m_Creature.SetHeal(hit_value, false); m_Creature.SetWait(); if (Skill.IsDefault == true) { float heal_percent = hit_value / (float)m_Creature.Stat.MaxHP; Skill.Creature.AddMP(eMPFillType.Heal, heal_percent); } } break; case eActionType.damage_mana: { if (m_Creature.InvokeImmune(eImmuneType.damage, Skill.Creature.Info.AttackType, Skill.Level) == true) { return(eSkillTargetHit.Immune); } TextManager.Instance.PushMana(m_Creature, hit_value, push_type); m_Creature.SetDamageMana(hit_value, false); m_Creature.SetWait(); } break; case eActionType.heal_mana: { TextManager.Instance.PushMana(m_Creature, hit_value, push_type); m_Creature.SetHealMana(hit_value, false); m_Creature.SetWait(); float heal_percent = hit_value / (float)m_Creature.Stat.MaxMP; if (Skill.IsDefault == true) { Skill.Creature.AddMP(eMPFillType.HealMana, heal_percent); } } break; } } //Debug.LogFormat("{0} -> {1} : {2}", self.Character.name, target.Character.name, skill.Info.Name); return(eSkillTargetHit.Hit); }
void Optimize() { if (m_List.Count <= 1) { return; } float push_time = m_List[0].PushTime; float push_position_normal = m_List[0].PushPosition; float push_position_critical = m_List[0].PushPositionCritical; float push_position_critical_dot = m_List[0].PushPositionCriticalDot; float push_position_dot = m_List[0].PushPositionDot; float last_time = -10f; float last_position = 0f; eTextPushType last_push_type = eTextPushType.Normal; for (int i = m_List.Count - 1; i >= 0; --i) { TextAnimation animation = m_List[i]; if (animation.IsPlaying == false) { continue; } bool is_optimize = false; if (push_time > 0f) { float time = animation.PlaybackTime; if (time - last_time < push_time) { animation.PlaybackTime = last_time + push_time; is_optimize = true; } last_time = animation.PlaybackTime; } float local_push_position = 0f; if (i != m_List.Count - 1) { switch (last_push_type) { case eTextPushType.Dot: local_push_position += push_position_dot; break; case eTextPushType.Critical: local_push_position += push_position_critical; break; case eTextPushType.CriticalDot: local_push_position += push_position_critical_dot; break; default: local_push_position += push_position_normal; break; } } switch (animation.PushType) { case eTextPushType.Dot: local_push_position += push_position_dot; break; case eTextPushType.Critical: local_push_position += push_position_critical; break; case eTextPushType.CriticalDot: local_push_position += push_position_critical_dot; break; default: local_push_position += push_position_normal; break; } if (local_push_position > 0f) { float pos = animation.CurrentPosition; if (pos - last_position < local_push_position) { animation.AddPosition += last_position + local_push_position - pos; last_position = animation.CurrentPosition; is_optimize = true; } else { last_position = pos; } } last_push_type = animation.PushType; if (is_optimize == true) { animation.Sample(); } } }
public void PushMessagePosition(Transform attach_transform, ICreature creature, string message, eBuffColorType color_type, eTextPushType push_type, float add_position = 0f) { if (creature.IsShowText == false) { return; } TextAnimation ta = Message.Push(attach_transform, creature.TextOffset, message, push_type, 1f, add_position); ta.Text.color = CharacterBuff.GetColor(color_type); }
public void PushMessage(ICreature creature, string message, eBuffColorType color_type, eTextPushType push_type, float add_position = 0f) { if (creature.IsShowText == false) { return; } Transform attach_transform = creature.Character.transform; float scale = attach_transform.GetComponent <Character>().Creature.Scale; TextAnimation ta = Message.Push(attach_transform, creature.TextOffset, message, push_type, scale, add_position); ta.Text.color = CharacterBuff.GetColor(color_type); }
public TextAnimation Push(Transform attach_transform, float text_offset, string text, eTextPushType push_type, float scale, float add_position) { switch (push_type) { case eTextPushType.Critical: case eTextPushType.CriticalDot: text = "CRITICAL\n" + text; break; } TextAnimation new_obj = GetFree(attach_transform); new_obj.Init(attach_transform, text_offset, text, push_type, scale, add_position); AddList(attach_transform, new_obj); return(new_obj); }