Esempio n. 1
0
        private void DeleteEvent_Click(object sender, EventArgs e)
        {
            if (!mLogicTree.ContainsKey(mCurrentSpellID))
            {
                return;
            }

            List <SpellLogic> logicList = mLogicTree[mCurrentSpellID];

            if (this.eventsList.SelectedIndices.Count <= 0)
            {
                return;
            }

            int index = this.eventsList.SelectedIndices[0];

            if (index < 0 || index >= logicList.Count)
            {
                return;
            }
            SpellLogic spec = logicList[index];


            logicList.RemoveAt(index);
            ShowSpellEvens(mCurrentSpellID);
            //事件列表为空
            if (this.eventsList.Items.Count <= 0)
            {
                this.srvCondList.Items.Clear();
            }
        }
Esempio n. 2
0
        public bool ShowEffects()
        {
            if (this.srvEffectList.Items.Count > 0)
            {
                this.srvEffectList.Items.Clear();
            }

            if (this.clientEffectList.Items.Count > 0)
            {
                this.clientEffectList.Items.Clear();
            }

            SpellLogic logic = FindSpellLogic();

            if (logic == null)
            {
                return(false);
            }

            foreach (var cid in logic.mSrvEffects)
            {
                ListViewItem item = new ListViewItem(mEffectEditor.FindEffect(cid));
                this.srvEffectList.Items.Add(item);
            }

            foreach (var cid in logic.mClientEffects)
            {
                ListViewItem item = new ListViewItem(mEffectEditor.FindEffect(cid));
                this.clientEffectList.Items.Add(item);
            }

            return(true);
        }
Esempio n. 3
0
        private void AddEvent_Click(object sender, EventArgs e)
        {
            if (!mLogicTree.ContainsKey(mCurrentSpellID))
            {
                return;
            }

            List <SpellLogic> logicList = mLogicTree[mCurrentSpellID];

            SPELL_EVENT sp_event = (SPELL_EVENT)Enum.GetValues(gSpellEventEnum).GetValue(this.EventsComboBox.SelectedIndex);

            //foreach (SpellLogic logi in logicList)
            //{
            //    if (logi.nEventID == sp_event)
            //    {
            //        Trace.Warring("已经存在事件:" + sp_event.ToString() + ",请勿重复添加!");
            //        return;
            //    }
            //}
            SpellLogic logic = new SpellLogic();

            logic.nEventID = sp_event;

            logicList.Add(logic);
            ShowSpellEvens(mCurrentSpellID);
        }
Esempio n. 4
0
        public bool ShowConditions()
        {
            if (this.srvCondList.Items.Count > 0)
            {
                this.srvCondList.Items.Clear();
            }

            if (this.clientCondList.Items.Count > 0)
            {
                this.clientCondList.Items.Clear();
            }

            SpellLogic logic = FindSpellLogic();

            if (logic == null)
            {
                return(false);
            }

            foreach (var cid in logic.mSrvConditions)
            {
                ListViewItem item = new ListViewItem(mConditionEditor.FindCondition(cid));
                this.srvCondList.Items.Add(item);
            }

            foreach (var cid in logic.mClientConditions)
            {
                ListViewItem item = new ListViewItem(mConditionEditor.FindCondition(cid));
                this.clientCondList.Items.Add(item);
            }

            return(true);
        }
Esempio n. 5
0
        public void getSpellTest()
        {
            //SpellLogic spelllogic = new SpellLogic();
            dnd_service_logic.BL.SpellLogic sl = new SpellLogic();
            var result = sl.getSpells("45");

            Assert.IsNotNull(result);
        }
Esempio n. 6
0
        private void DeleteSrvCondition_Click(object sender, EventArgs e)
        {
            if (this.srvCondList.SelectedItems.Count <= 0)
            {
                return;
            }
            SpellLogic logic = FindSpellLogic();

            if (logic == null)
            {
                return;
            }

            logic.mSrvConditions.RemoveAt(this.srvCondList.SelectedItems[0].Index);
            ShowConditions();
        }
Esempio n. 7
0
        private void clientDelEffect_Click(object sender, EventArgs e)
        {
            if (this.clientEffectList.SelectedItems.Count <= 0)
            {
                return;
            }

            SpellLogic logic = FindSpellLogic();

            if (logic == null)
            {
                return;
            }

            logic.mClientEffects.RemoveAt(this.clientEffectList.SelectedItems[0].Index);
            ShowEffects();
        }
Esempio n. 8
0
        private void AddEffect_Click(object sender, EventArgs e)
        {
            if (this.eventsList.Items.Count <= 0)
            {
                Trace.Error("请先添加事件!");
                return;
            }
            if (this.eventsList.SelectedIndices.Count <= 0)
            {
                Trace.Error("请选择一个事件");
                return;
            }
            SpellLogic logic = FindSpellLogic();

            if (logic == null)
            {
                return;
            }

            mEffectEditor.ShowDialog();
            ShowEffects();
        }
Esempio n. 9
0
        SpellLogic FindSpellLogic()
        {
            if (!mLogicTree.ContainsKey(mCurrentSpellID))
            {
                return(null);
            }

            List <SpellLogic> logicList = mLogicTree[mCurrentSpellID];

            if (this.eventsList.SelectedIndices.Count <= 0)
            {
                return(null);
            }

            int index = this.eventsList.SelectedIndices[0];

            if (index < 0 || index >= logicList.Count)
            {
                return(null);
            }
            m_CurrentSpellLogic = logicList[index];
            return(logicList[index]);
        }
Esempio n. 10
0
        /// <summary>
        /// 转换成逻辑链表
        /// </summary>
        /// <param name="logic">目标</param>
        /// <param name="eventList">事件链表</param>
        /// <param name="conditionList">条件链表</param>
        /// <param name="effectList">效果链表</param>
        /// <returns></returns>
        private bool ConverToSpellLogicList(ref List <SpellLogic> logic, List <SPELL_EVENT> eventList, List <string> clientCondList, List <string> clientEffectList, List <string> srvCondList, List <string> srvEffectList, int CurrentSkillID)
        {
            if (logic == null)
            {
                return(false);
            }

            try
            {
                logic.Clear();

                for (int i = 0; i < eventList.Count; i++)
                {
                    SpellLogic log = new SpellLogic();
                    log.nEventID = eventList[i];

                    // 填充客户端条件列表
                    string conditionStr = clientCondList[i];
                    if (!conditionStr.Equals(SpellLogicInvalidFiled) && !string.IsNullOrEmpty(conditionStr))
                    {
                        string[] conditions = conditionStr.Split(';');
                        for (int k = 0; k < conditions.Length; k++)
                        {
                            int condID = Convert.ToInt32(conditions[k]);
                            if (!log.mClientConditions.Contains(condID))
                            {
                                log.mClientConditions.Add(condID);
                            }
                            else
                            {
                                Trace.Warring("spellogic中有重复的效果id:" + condID + "请检查配置文件,技能ID:" + CurrentSkillID.ToString());
                            }
                        }
                    }

                    // 填充服务器条件列表
                    conditionStr = srvCondList[i];
                    if (!conditionStr.Equals(SpellLogicInvalidFiled) && !string.IsNullOrEmpty(conditionStr))
                    {
                        string[] conditions = conditionStr.Split(';');
                        for (int k = 0; k < conditions.Length; k++)
                        {
                            int condID = Convert.ToInt32(conditions[k]);
                            if (!log.mSrvConditions.Contains(condID))
                            {
                                log.mSrvConditions.Add(condID);
                            }
                            else
                            {
                                Trace.Warring("spellogic中有重复的效果id:" + condID + "请检查配置文件,技能ID:" + CurrentSkillID.ToString());
                            }
                        }
                    }

                    // 填充客户端效果列表
                    string effectStr = clientEffectList[i];
                    if (!effectStr.Equals(SpellLogicInvalidFiled) && !string.IsNullOrEmpty(effectStr))
                    {
                        string[] effects = effectStr.Split(';');
                        for (int k = 0; k < effects.Length; k++)
                        {
                            int condID = Convert.ToInt32(effects[k]);

                            if (!log.mClientEffects.Contains(condID))
                            {
                                log.mClientEffects.Add(condID);
                            }
                            else
                            {
                                Trace.Warring("spellogic中有重复的效果id:" + condID + "请检查配置文件,技能ID:" + CurrentSkillID.ToString());
                            }
                        }
                    }

                    // 填充服务器效果列表
                    effectStr = srvEffectList[i];
                    if (!effectStr.Equals(SpellLogicInvalidFiled) && !string.IsNullOrEmpty(effectStr))
                    {
                        string[] effects = effectStr.Split(';');
                        for (int k = 0; k < effects.Length; k++)
                        {
                            int condID = Convert.ToInt32(effects[k]);

                            if (!log.mSrvEffects.Contains(condID))
                            {
                                log.mSrvEffects.Add(condID);
                            }
                            else
                            {
                                Trace.Warring("spellogic中有重复的效果id:" + condID + "请检查配置文件,技能ID:" + CurrentSkillID.ToString());
                            }
                        }
                    }

                    logic.Add(log);
                }
                return(true);
            }
            catch (Exception e)
            {
                Trace.Error(e.Message);
                return(false);
            }
        }
    public void OnSpellLogicChange(SpellLogic _spellLogic)
    {
        spellLogic = _spellLogic;

        power = spellLogic.power[0];
    }
Esempio n. 12
0
        //技能逻辑,目标不一定是有效目标
        public bool __DoSpellLogic(int nSpellLogicID, ObjectCreature pTarget, bool bCritical)
        {
            LogManager.LogAssert(m_pHolder);
            LogManager.LogAssert(m_pSpellInfo);

            switch (nSpellLogicID)
            {
            case (int)EM_SPELL_LOGIC.EM_SPELL_LOGIC1:
            {
                return(SpellLogic.DoLogic1(m_pHolder, pTarget, m_pSpellInfo, bCritical));
            }

            case (int)EM_SPELL_LOGIC.EM_SPELL_LOGIC2:
            {
                return(SpellLogic.DoLogic2(m_pHolder, pTarget, m_pSpellInfo, bCritical));
            }

            case (int)EM_SPELL_LOGIC.EM_SPELL_LOGIC3:
            {
                return(SpellLogic.DoLogic3(m_pHolder, pTarget, m_pSpellInfo, bCritical));
            }

            case (int)EM_SPELL_LOGIC.EM_SPELL_LOGIC4:
            {
                return(SpellLogic.DoLogic4(m_pHolder, pTarget, m_pSpellInfo, bCritical));
            }

            case (int)EM_SPELL_LOGIC.EM_SPELL_LOGIC5:
            {
                return(SpellLogic.DoLogic5(m_pHolder, pTarget, m_pSpellInfo, bCritical));
            }

            case (int)EM_SPELL_LOGIC.EM_SPELL_LOGIC6:
            {
                return(SpellLogic.DoLogic6(m_pHolder, pTarget, m_pSpellInfo, bCritical));
            }

            case (int)EM_SPELL_LOGIC.EM_SPELL_LOGIC7:
            {
                return(SpellLogic.DoLogic7(m_pHolder, pTarget, m_pSpellInfo, bCritical));
            }

            case (int)EM_SPELL_LOGIC.EM_SPELL_LOGIC11:
            {
                return(SpellLogic.DoLogic11(m_pHolder, pTarget, m_pSpellInfo, bCritical));
            }

            case (int)EM_SPELL_LOGIC.EM_SPELL_LOGIC12:
            {
                return(SpellLogic.DoLogic12(m_pHolder, pTarget, m_pSpellInfo, bCritical));
            }

            case (int)EM_SPELL_LOGIC.EM_SPELL_LOGIC14:
            {
                return(SpellLogic.DoLogic14(m_pHolder, pTarget, m_pSpellInfo, bCritical));
            }

            case (int)EM_SPELL_LOGIC.EM_SPELL_LOGIC15:
            {
                return(SpellLogic.DoLogic15(m_pHolder, pTarget, m_pSpellInfo, bCritical));
            }

            case (int)EM_SPELL_LOGIC.EM_SPELL_LOGIC16:
            {
                return(SpellLogic.DoLogic16(m_pHolder, pTarget, m_pSpellInfo, bCritical));
            }

            case (int)EM_SPELL_LOGIC.EM_SPELL_LOGIC17:
            {
                return(SpellLogic.DoLogic17(m_pHolder, pTarget, m_pSpellInfo, bCritical));
            }

            case (int)EM_SPELL_LOGIC.EM_SPELL_LOGIC18:
            {
                return(SpellLogic.DoLogic18(m_pHolder, pTarget, m_pSpellInfo, bCritical));
            }

            default:
            {
                //其他id不处理即可。不用error [8/4/2015 Zmy]
//                     LogManager.LogAssert(nSpellLogicID);
//                     LogManager.LogToFile("!!!!Error:__DoSpellLogic()'s nSpellLogicID param is null :" + nSpellLogicID);
            }
            break;
            }
            return(true);
        }