コード例 #1
0
 protected virtual void OnEffect_DamageCureEvent(Effect_DamageCureEventArgs e)
 {
     if (Effect_DamageCure != null)
     {
         Effect_DamageCure(this, e);
     }
 }
コード例 #2
0
        private void HurtOrCure(object sender, Effect_DamageCureEventArgs e)
        {
            if (!e.Targets.Contains(m_ID))
            {
                return;
            }
            int index = -1;

            for (int i = 0; i < e.Targets.Count; i++)
            {
                if (e.Targets[i] == m_ID)
                {
                    if (e.TargetPlayerIDs[i] == m_playerID)
                    {
                        index = i;
                    }
                    else
                    {
                        return;
                    }
                }
            }
            hp -= e.HPChange[index];

            if (hp != e.LeftHP[index])
            {
                UtilLog.Log("HP mismatch with server, something wrong localHP:" + hp + " server:" + e.LeftHP[index]);
            }
            string eventInfo = string.Format("{0} got cure/hurt: {1}:{2} EffectID:{3} EffectTypeID:{4} Skill:{5} eff:{6}", GetMyString(), e.HPChange[index], e.LeftHP[index], e.EffectID, e.EffectTypeID, e.SkillID, e.effName);

            UtilLog.Log(eventInfo);
            m_EventInfoQueue.Enqueue(new EventInfo(e.effName, Time.time));
        }
コード例 #3
0
        //sometimes no skillID in effect data;
        protected void ProduceEvents(List <N2.BattleRoundAction_Effect> effects, int skillIDFromParent)
        {
            //UtilLog.Log("ProduceEvents BattleRoundActionEffect ");
            foreach (N2.BattleRoundAction_Effect eff in effects)
            {
                //UtilLog.Log("working on eff:"+eff.ToString());
                string effectStr        = "";
                int    eventInteralType = EVENT_Effect_BuffAuraDot;

                ActiveSkillEventArgs args = null;
                if (!string.IsNullOrEmpty(eff.TypeName))
                {
                    effectStr = eff.TypeName;

                    if (eff.AuraEffectType != null && eff.AuraEffectType.Count > 0 ||
                        eff.BuffEffectType != null && eff.BuffEffectType.Count > 0 ||
                        eff.DotEffectType != null && eff.DotEffectType.Count > 0 ||
                        eff.TypeName.Equals("ExitEffectType"))
                    {
                        args             = new Effect_BuffAuraDotEventArgs();
                        eventInteralType = EVENT_Effect_BuffAuraDot;
                    }
                    else if (eff.Damage != null && eff.Damage.Count > 0 ||
                             eff.Recover != null && eff.Recover.Count > 0)
                    {
                        args             = new Effect_DamageCureEventArgs();
                        eventInteralType = EVENT_Effect_DamageCure;
                    }
                    else if (eff.Value != null && eff.Value.Count > 0 ||
                             eff.ResultValue != null && eff.ResultValue.Count > 0)
                    {
                        //todo need more check on data
                        args             = new Effect_BuffAuraDotValueEventArgs();
                        eventInteralType = EVENT_Effect_BuffAuraDotValue;
                    }
                    else
                    {
                        UtilLog.Log("Effect neither damge/cure nor buffAuraDot");
                    }
                }
                else if (!string.IsNullOrEmpty(eff.StateName))
                {
                    effectStr        = eff.StateName;
                    args             = new Effect_STATEEventArgs();
                    eventInteralType = EVENT_Effect_State;
                }
                else
                {
                    UtilLog.Log("Effect neither typename, nore statename");
                }
                args.effName = effectStr;
                if (eff.Caster != null)
                {
                    args.Caster = int.Parse(eff.GetCasterID());
                }
                //sometimes no skillID in effect data;
                if (eff.SkillID == 0)
                {
                    args.SkillID = skillIDFromParent;
                }
                else
                {
                    args.SkillID = eff.SkillID;
                }

                args.EffectID     = eff.EffectID;
                args.EffectTypeID = eff.EffectTypeID;
                if (eventInteralType == EVENT_Effect_BuffAuraDot)
                {
                    Effect_BuffAuraDotEventArgs buffAuraDotArgs = args as Effect_BuffAuraDotEventArgs;
                }
                else if (eventInteralType == EVENT_Effect_State)
                {
                    Effect_STATEEventArgs stateArgs = args as Effect_STATEEventArgs;
                    stateArgs.StateID = eff.StateID;
                }

                //pattern = reportFromationTable.GetEffectStatePattern(effectStr);
                if (eff.Targets != null && eff.Targets.Count > 0)
                {
                    for (int i = 0; i < eff.Targets.Count; i++)
                    {
                        if (eventInteralType == EVENT_Effect_DamageCure)
                        {
                            Effect_DamageCureEventArgs dmgCureArgs = args as Effect_DamageCureEventArgs;
                            if (eff.Damage != null)
                            {
                                dmgCureArgs.HPChange.Add(eff.Damage[i]);
                            }
                            else if (eff.Recover != null)
                            {
                                dmgCureArgs.HPChange.Add(eff.Recover[i]);
                            }
                            if (eff.LeftHP != null)
                            {
                                dmgCureArgs.LeftHP.Add(eff.LeftHP[i]);
                            }
                        }
                        else if (eventInteralType == EVENT_Effect_BuffAuraDot)
                        {
                            Effect_BuffAuraDotEventArgs buffAuraDotArgs = args as Effect_BuffAuraDotEventArgs;
                            if (eff.AuraEffectType != null && eff.AuraEffectType.Count > 0)
                            {
                                //UtilLog.Log("auraEffect has size " + eff.AuraEffectType.Count +" ,we're index:" + i);
                                buffAuraDotArgs.eventType.Add(BuffAuraDot_TYPE.Aura);
                                buffAuraDotArgs.BuffAuraDotID.Add(eff.AuraEffectType[i]);
                            }
                            else if (eff.BuffEffectType != null && eff.BuffEffectType.Count > 0)
                            {
                                buffAuraDotArgs.eventType.Add(BuffAuraDot_TYPE.Buff);
                                buffAuraDotArgs.BuffAuraDotID.Add(eff.BuffEffectType[i]);
                            }
                            else if (eff.DotEffectType != null && eff.DotEffectType.Count > 0)
                            {
                                buffAuraDotArgs.eventType.Add(BuffAuraDot_TYPE.Dot);
                                buffAuraDotArgs.BuffAuraDotID.Add(eff.DotEffectType[i]);
                            }
                            else if (eff.RemoveEffectTypeID != null && eff.RemoveEffectTypeID.Count > 0)
                            {
                                buffAuraDotArgs.eventType.Add(BuffAuraDot_TYPE.RemoveEffect);
                                buffAuraDotArgs.BuffAuraDotID.Add(eff.RemoveEffectTypeID[i]);
                            }
                            else if (eff.TypeName.Equals("ExitEffectType"))
                            {
                                buffAuraDotArgs.eventType.Add(BuffAuraDot_TYPE.RemoveEffect);
                                buffAuraDotArgs.BuffAuraDotID.Add(eff.EffectTypeID);
                            }
                            //aura/dot/buff has no value
                        }
                        else if (eventInteralType == EVENT_Effect_BuffAuraDotValue)
                        {
                            Effect_BuffAuraDotValueEventArgs buffAuraDotArgs = args as Effect_BuffAuraDotValueEventArgs;
                            if (eff.Value != null)
                            {
                                buffAuraDotArgs.ValueChange.Add(eff.Value[i]);
                            }
                            if (eff.ResultValue != null)
                            {
                                buffAuraDotArgs.ResultValue.Add(eff.ResultValue[i]);
                            }
                            if (eff.Result != null && eff.Result.Count > 0)
                            {
                                buffAuraDotArgs.bUsePercent = (eff.Result[0] == 0);
                            }
                        }
                        args.TargetPlayerIDs.Add(int.Parse(BattleReport.UnPackPlayerID(eff.Targets[i])));
                        args.Targets.Add(int.Parse(BattleReport.UnPackID(eff.Targets[i])));
                    }
                }
                m_eventQueue.Enqueue(new EventItem(m_timer.NextTimeStampEffect(), eventInteralType, args));
                //UtilLog.Log(m_eventQueue.Last().ToString());
            }
        }