Ejemplo n.º 1
0
    public void AddBuff(int id)
    {
        var buff = Buff.Create(id);
        var node = Buffs.Find(i => { return(i.Data.Id == id); });

        if (node != null)
        {
            node.Overlay(buff);
            var evt = new Evt_UpdateBuff()
            {
                Target = this, Data = node
            };
            EventManager.Instance.QueueEvent(evt);
        }
        else
        {
            buff.SetOwner(this);
            Buffs.AddLast(buff);
            var evt = new Evt_AddBuff()
            {
                Target = this, Data = buff
            };
            EventManager.Instance.QueueEvent(evt);
        }
    }
Ejemplo n.º 2
0
        private void ExecuteBuff(RoundResult rr, ISpell spell)
        {
            if (spell?.AbilityBuff == null)
            {
                return;
            }

            var buff = Buffs.Find(b => b == spell.AbilityBuff);

            buff.Activate(rr.TimeSec);
        }
Ejemplo n.º 3
0
    public void RemoveBuff(int id)
    {
        var node = Buffs.Find(i => { return(i.Data.Id == id); });

        if (node != null)
        {
            Buffs.Remove(node);
            var evt = new Evt_RemoveBuff()
            {
                Target = this, Data = node
            };
            EventManager.Instance.QueueEvent(evt);
        }
    }
Ejemplo n.º 4
0
    public Buff GetProvoke()
    {
        if (IsHidden() == true)
        {
            return(null);
        }

        Buff provoke = Buffs.Find(b => b.IsFinish == false && b.ActionInfo.actionType == eActionType.provoke);

        if (provoke == null)
        {
            return(null);
        }
        return(provoke);
    }
Ejemplo n.º 5
0
    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;
        }
    }