override public void OnBuff(CharacterActionBuffComponent buff_component, bool is_lighting, float apply_scale) { if (buff_index >= Skill.Info.Actions.Count) { Debug.LogErrorFormat("buff index failed : {0} in {1}", buff_index, Skill.Info.ID); return; } SkillInfo.Action buff_action = Skill.Info.Actions[buff_index++]; if (m_Creature.IsDead == true || buff_action.check_distance == true && Character.MoveDistance > BattleConfig.Instance.HitDistance) { return; } ISkillBuff apply_buff = DoBuff(buff_action, Skill.Creature, m_Creature, Skill, m_TargetIndex, null); if (apply_buff != null) { CharacterActionBuff new_action = buff_component.data.CreateAction(buff_component, Character.PlaybackTime, Character, apply_buff.Duration, is_lighting, apply_scale); apply_buff.Action = new_action; } for (int sub_index = 0; sub_index < buff_action.SubActions.Count; ++sub_index) { var sub_action = buff_action.SubActions[sub_index]; var sub_buff = DoBuff(sub_action, Skill.Creature, m_Creature, Skill, m_TargetIndex, apply_buff); if (sub_buff == null) { continue; } if (apply_buff == null) { apply_buff = sub_buff; if (buff_component.sub_components.Length == 0) { CharacterActionBuff new_action = buff_component.data.CreateAction(buff_component, Character.PlaybackTime, Character, apply_buff.Duration, is_lighting, apply_scale); apply_buff.Action = new_action; } } if (sub_index < buff_component.sub_components.Length) { var sub_component = buff_component.sub_components[sub_index]; CharacterActionBuff new_action = sub_component.data.CreateAction(sub_component, Character.PlaybackTime, Character, apply_buff.Duration, is_lighting, apply_scale); sub_buff.Action = new_action; } } }
public BattleCreature(MapCreatureInfo map_creature_info, CharacterContainer character_container, float attack_next_time, GameObject hpBarPrefab, GameObject skillPrefab) { MapStageDifficulty stage_info = Network.BattleStageInfo; IsTeam = false; Info = map_creature_info.CreatureInfo; SkinName = map_creature_info.SkinName; MapCreature = map_creature_info; Grade = map_creature_info.Grade; Level = map_creature_info.Level; GradePercent = map_creature_info.GradePercent; Enchant = map_creature_info.Enchant; if (map_creature_info.UseLeaderSkillType != pe_UseLeaderSkillType.Manual && Info.TeamSkill != null) { SetLeader(map_creature_info.UseLeaderSkillType, BattleStage.Instance.OnUseEnemyLeaderSkill); } switch (map_creature_info.CreatureType) { case eMapCreatureType.Elite: Scale = 1.2f; break; case eMapCreatureType.Boss: Scale = 1.4f; if (stage_info.MapInfo.MapType == "boss") { Level = Boss.CalculateLevel(Level, stage_info); Grade = Boss.CalculateGrade(Level); Enchant = Boss.CalculateEnchant(Level); GradePercent = CreatureInfoManager.Instance.Grades[Grade].enchants[Enchant].stat_percent * GameConfig.Get <float>("boss_grade_percent"); } Battle.Instance.m_BossHP.Init(this); break; case eMapCreatureType.WorldBoss: Scale = 2.5f; BattleWorldboss.Instance.m_BossHP.Init(this, true); IgnoreTween = true; TextOffset = -20f; // IsShowText = false; break; } Stat = new CreatureStat(map_creature_info.GetStat(Level, GradePercent, Enchant)); AutoSkillIndex = map_creature_info.AutoSkillIndex; InitCommon(character_container, attack_next_time, hpBarPrefab, skillPrefab); if (map_creature_info.CreatureType == eMapCreatureType.WorldBoss) { HPBar.gameObject.SetActive(false); } foreach (SkillInfo skill_info in Info.Skills) { if (skill_info.Type != eSkillType.active) { continue; } Skills.Add(new BattleSkill(skill_info, this, map_creature_info.Level)); } if (map_creature_info.PassiveInfos.Count > 0) { foreach (var passive_info in map_creature_info.PassiveInfos) { bool first = true; var battle_skill = new BattleSkill(passive_info.SkillInfo, this, map_creature_info.Level); foreach (var action in passive_info.SkillInfo.Actions) { ISkillBuff buff = SkillTarget.DoBuff(action, this, this, battle_skill, 0, null); if (first == true && string.IsNullOrEmpty(passive_info.SkillInfo.ActionName) == false) { first = false; var comp = AssetManager.GetCharacterPrefab("PassiveEtc_" + passive_info.SkillInfo.ActionName).GetComponent <CharacterActionBuffComponent>(); // comp.data.InitEffect(); CharacterActionBuff new_action = comp.data.CreateAction(comp, PlaybackTime, Character, 999f, false, 1f); buff.Action = new_action; } } } var buff_worldboss = Buffs.Find(b => b.ActionInfo.actionType == eActionType.worldboss); if (buff_worldboss != null) { Stat.HP = Stat.MaxHP = buff_worldboss.ActionInfo.value; } else { Stat.HP = Stat.MaxHP = Stat.Stat.MaxHP; } Stat.MP = Stat.Stat.ManaInit; } }