Esempio n. 1
0
        public override bool Parse(Hashtable info)
        {
            eCombatEventType type = ParseType(info);

            if (type != eCombatEventType.SYNC)
            {
                EB.Debug.LogWarning("CombatSyncEvent.Parse: invalid type = {0}", type);
                return(false);
            }

            List <CombatEvent> children = CombatUtil.ParseEffects(info);

            if (children != null)
            {
                m_children = children;
            }

            int len = m_children.Count;

            for (int i = 0; i < len; i++)
            {
                CombatEffectEvent effect = m_children[i] as CombatEffectEvent;
                if (effect.Timing == eCombatEventTiming.AUTO)
                {
                    effect.Timing = eCombatEventTiming.ON_START;
                }

                if (effect.Sender == null)
                {
                    effect.Sender = new CombatantIndex(effect.Target.TeamIndex, effect.Target.IndexOnTeam);
                }
            }

            return(true);
        }
Esempio n. 2
0
        public override bool Parse(Hashtable info)
        {
            m_owner = CombatantIndex.Parse(info["sender"] as Hashtable);
            if (m_owner == null)
            {
                EB.Debug.LogWarning("CombatImpactEvent.Parse: owner is empty {0}", EB.JSON.Stringify(info));
                return(false);
            }

            ImpactData = CombatUtil.ParseImpactData(info["impact_data"] as Hashtable, null);

            List <CombatEvent> children = CombatUtil.ParseEffects(info);

            if (children != null)
            {
                m_children = children;
            }

            int len = m_children.Count;

            for (int i = 0; i < len; i++)
            {
                CombatEffectEvent effect = m_children[i] as CombatEffectEvent;
                if (effect.Timing == eCombatEventTiming.AUTO)
                {
                    effect.Timing = eCombatEventTiming.ON_START;
                }

                if (effect.Sender == null)
                {
                    effect.Sender = new CombatantIndex(m_owner.TeamIndex, m_owner.IndexOnTeam);
                }
            }

            return(true);
        }
Esempio n. 3
0
        public override bool Parse(Hashtable info)
        {
            if (!base.Parse(info))
            {
                return(false);
            }

            IsCombo    = m_timing != eCombatEventTiming.AUTO;
            ComboDelay = EB.Dot.Single("delay", info, 0.0f);

            // skip flag
            m_skip = EB.Dot.Bool("skip", info, false);

            m_sender = ParseSender(info);
            if (m_sender == null)
            {
                EB.Debug.LogWarning("CombatSkillEvent.Parse: sender is empty {0}", EB.JSON.Stringify(info));
                return(false);
            }

            // may be empty
            m_trigger = ParseTrigger(info);
            m_target  = ParseTarget(info);

            m_skillId = ParseSkillId(info);
            if (m_skillId < 0)
            {
                EB.Debug.LogWarning("CombatSkillEvent.Parse: skill is empty {0}", EB.JSON.Stringify(info));
                return(false);
            }

            m_targets = ParseTargets(info);
            if (m_targets == null)
            {
                if (m_skip && m_target == null)
                {
                    m_targets = new HashSet <CombatantIndex>();
                }
                else
                {
                    EB.Debug.LogWarning("CombatSkillEvent.Parse: targets is empty {0}", EB.JSON.Stringify(info));
                    return(false);
                }
            }

            m_comboIndex = EB.Dot.Integer("combo_index", info, m_comboIndex);

            m_children = CombatUtil.ParseEffects(info);
            if (m_children == null)
            {
                if (m_skip && m_target == null)
                {
                    m_children = new List <CombatEvent>();
                }
                else
                {
                    EB.Debug.LogWarning("CombatSkillEvent.Parse: effects is empty {0}", EB.JSON.Stringify(info));
                    return(false);
                }
            }

            int len = m_children.Count;

            for (int i = 0; i < len; i++)
            {
                CombatEffectEvent effect = m_children[i] as CombatEffectEvent;
                if (effect.Timing == eCombatEventTiming.AUTO)
                {
                    effect.Timing = eCombatEventTiming.RUNTIME;
                }

                if (effect.Sender == null)
                {
                    effect.Sender = new CombatantIndex(m_sender.TeamIndex, m_sender.IndexOnTeam);
                }
            }

            return(true);
        }