Пример #1
0
        protected override Boolean IsApplySpellEventForMe(Object p_sender, EventArgs p_args, out String out_buffNameKey, out String out_spellNameKey)
        {
            out_buffNameKey  = null;
            out_spellNameKey = null;
            if (p_args is SpellEventArgs)
            {
                SpellEventArgs spellEventArgs = (SpellEventArgs)p_args;
                foreach (MonsterBuffTarget monsterBuffTarget in spellEventArgs.SpellTargetsOfType <MonsterBuffTarget>())
                {
                    if (monsterBuffTarget.Target == MyController && monsterBuffTarget.Buff != EMonsterBuffType.NONE && ((Monster)monsterBuffTarget.Target).BuffHandler.HasBuff(monsterBuffTarget.Buff))
                    {
                        out_buffNameKey  = monsterBuffTarget.Buff.ToString();
                        out_spellNameKey = GetSpellNameKey(spellEventArgs.Spell);
                        return(true);
                    }
                }
                return(false);
            }
            ItemSuffixApplyBuffEventArgs itemSuffixApplyBuffEventArgs = (ItemSuffixApplyBuffEventArgs)p_args;

            if (itemSuffixApplyBuffEventArgs.TargetMonster == MyController && itemSuffixApplyBuffEventArgs.Buff != EMonsterBuffType.NONE)
            {
                out_buffNameKey  = itemSuffixApplyBuffEventArgs.Buff.ToString();
                out_spellNameKey = itemSuffixApplyBuffEventArgs.SuffixKey;
                return(true);
            }
            return(false);
        }
Пример #2
0
        private void OnMonsterCastSpell(Object p_sender, EventArgs p_args)
        {
            SpellEventArgs spellEventArgs = (SpellEventArgs)p_args;

            foreach (AttackedTarget attackedTarget in spellEventArgs.SpellTargetsOfType <AttackedTarget>())
            {
                if (attackedTarget.Target == m_character && attackedTarget.Result != null)
                {
                    ShowDamageTextAndAnimationAndPlaySound(attackedTarget.Result, false, false, spellEventArgs.DamageType != EDamageType.PHYSICAL);
                }
            }
        }
Пример #3
0
        private void OnMonsterCastSpell(Object p_sender, EventArgs p_args)
        {
            SpellEventArgs spellEventArgs = (SpellEventArgs)p_args;

            foreach (AttackedTarget attackedTarget in spellEventArgs.SpellTargetsOfType <AttackedTarget>())
            {
                if (spellEventArgs.Spell.NameKey != "MONSTER_SPELL_LIQUID_MEMBRANE")
                {
                    ShowHitEffect((Monster)p_sender);
                }
            }
        }
Пример #4
0
 private void OnCharacterAttackOrSpell(Object p_sender, EventArgs p_args)
 {
     if (p_args is AttacksEventArgs)
     {
         AttacksEventArgs attacksEventArgs = (AttacksEventArgs)p_args;
         foreach (AttacksEventArgs.AttackedTarget attackedTarget in attacksEventArgs.Attacks)
         {
             if (attackedTarget.AttackTarget == MyController)
             {
                 m_LastAttackOrSpellFrameCount = Time.frameCount;
                 EResultType result = attackedTarget.AttackResult.Result;
                 if (result == EResultType.BLOCK || result == EResultType.EVADE)
                 {
                     PlayAnimation(EAnimType.DEFEND, EState.HIT, -1f, 1f);
                     break;
                 }
             }
         }
     }
     else if (p_args is SpellEventArgs)
     {
         if (p_sender is Summon)
         {
             OnTakeHitSpell_OnFxHit(p_sender, p_args);
             return;
         }
         SpellEventArgs spellEventArgs = (SpellEventArgs)p_args;
         foreach (AttackedTarget attackedTarget2 in spellEventArgs.SpellTargetsOfType <AttackedTarget>())
         {
             if (attackedTarget2.Target == MyController)
             {
                 m_LastAttackOrSpellFrameCount = Time.frameCount;
                 break;
             }
         }
     }
 }
Пример #5
0
        private void OnTakeHitAttackGeneric(Object p_sender, EventArgs p_args, EEventType p_eventType)
        {
            Boolean flag  = true;
            Boolean flag2 = false;

            if (p_args is AttacksEventArgs)
            {
                AttacksEventArgs attacksEventArgs = (AttacksEventArgs)p_args;
                foreach (AttacksEventArgs.AttackedTarget attackedTarget in attacksEventArgs.Attacks)
                {
                    if (attackedTarget.AttackTarget == MyController)
                    {
                        AttackResult attackResult = attackedTarget.AttackResult;
                        if (!flag2 && attacksEventArgs.PushToParty)
                        {
                            flag2 = true;
                            m_MainView.PushEntityToPosition();
                        }
                        foreach (AttacksEventArgs.AttackedTarget attackedTarget2 in attacksEventArgs.Attacks)
                        {
                            if (attackedTarget2.AttackTarget != null && attackedTarget2.AttackTarget == MyController)
                            {
                                Monster monster = (Monster)MyController;
                                FlushMonsterLogEntries();
                                monster.CombatHandler.CheckCounterAttack((Character)p_sender);
                                List <CombatEntryEventArgs> counterLogEntries = monster.CombatHandler.CounterLogEntries;
                                if (counterLogEntries.Count > 0)
                                {
                                    foreach (CombatEntryEventArgs p_args2 in counterLogEntries)
                                    {
                                        LegacyLogic.Instance.ActionLog.PushEntry(p_args2);
                                        if (LegacyLogic.Instance.WorldManager.Party.Buffs.HasBuff(EPartyBuffs.CELESTIAL_ARMOR))
                                        {
                                            if (LegacyLogic.Instance.WorldManager.Party.Buffs.GetBuff(EPartyBuffs.CELESTIAL_ARMOR).IsExpired())
                                            {
                                                LegacyLogic.Instance.WorldManager.Party.Buffs.RemoveBuff(EPartyBuffs.CELESTIAL_ARMOR);
                                            }
                                            LegacyLogic.Instance.WorldManager.Party.Buffs.FlushActionLog();
                                        }
                                        ((Character)p_sender).ConditionHandler.FlushActionLog();
                                        ((Character)p_sender).ConditionHandler.FlushDelayedActionLog();
                                    }
                                }
                                counterLogEntries.Clear();
                                if (monster.AiHandler is MamushiAIHandler)
                                {
                                    ((Character)p_sender).FightHandler.FlushActionLog();
                                    ((Character)p_sender).FightHandler.FlushDelayedActionLog();
                                    ((Character)p_sender).FlushNormalActionLog();
                                }
                            }
                        }
                        if (attackResult.ReflectedDamage != null && attackResult.ReflectedDamage.Damages.Count > 0 && MyController is Monster)
                        {
                            Monster      p_attacker    = MyController as Monster;
                            AttackResult attackResult2 = ((Character)p_sender).FightHandler.AttackEntity(attackResult.ReflectedDamage, true, EDamageType.PHYSICAL, true, 0, false);
                            ((Character)p_sender).ApplyDamages(attackResult2, p_attacker);
                            Object p_source = (attackResult2.ReflectedDamageSource != null) ? attackResult2.ReflectedDamageSource : MyController;
                            CombatEntryEventArgs p_args3 = new CombatEntryEventArgs(p_source, p_sender, attackResult2, null);
                            LegacyLogic.Instance.ActionLog.PushEntry(p_args3);
                            AttacksEventArgs attacksEventArgs2 = new AttacksEventArgs(false);
                            attacksEventArgs2.Attacks.Add(new AttacksEventArgs.AttackedTarget(p_sender, attackResult2));
                            DelayedEventManager.InvokeEvent(EDelayType.ON_FX_FINISH, EEventType.REFLECTED_MAGIC_DAMAGE, p_sender, attacksEventArgs2);
                        }
                        if (flag)
                        {
                            flag = false;
                            m_CommandQueue.Enqueue(delegate
                            {
                                ((Monster)MyController).HitAnimationDone.Trigger();
                                DelayedEventManager.InvokeEvent(EDelayType.ON_FX_FINISH, p_eventType, p_sender, p_args);
                            });
                            PlayTakeHitSound(p_sender, attackResult, p_eventType == EEventType.CHARACTER_ATTACKS_RANGED);
                        }
                        TakeHit(attackedTarget.AttackResult, false);
                    }
                }
            }
            else if (p_args is SpellEventArgs)
            {
                SpellEventArgs spellEventArgs = (SpellEventArgs)p_args;
                foreach (AttackedTarget attackedTarget3 in spellEventArgs.SpellTargetsOfType <AttackedTarget>())
                {
                    if (attackedTarget3.Target == MyController)
                    {
                        if (p_sender is Summon)
                        {
                            ((Summon)p_sender).FlushActionLog();
                        }
                        FlushMonsterLogEntries();
                        if (flag)
                        {
                            flag = false;
                            m_CommandQueue.Enqueue(delegate
                            {
                                ((Monster)MyController).HitAnimationDone.Trigger();
                                if (!(p_sender is Summon))
                                {
                                    DelayedEventManager.InvokeEvent(EDelayType.ON_FX_FINISH, EEventType.CHARACTER_CAST_SPELL, p_sender, p_args);
                                }
                            });
                        }
                        TakeHit(attackedTarget3.Result, spellEventArgs.DamageType != EDamageType.PHYSICAL);
                    }
                }
                foreach (PushedTarget pushedTarget in spellEventArgs.SpellTargetsOfType <PushedTarget>())
                {
                    if (pushedTarget.Target == MyController)
                    {
                        m_MainView.PushEntityToPosition();
                    }
                }
            }
        }
Пример #6
0
        protected virtual void OnEntityCastSpell(Object p_sender, EventArgs p_args)
        {
            if (p_sender != MyController)
            {
                return;
            }
            SpellEventArgs args         = (SpellEventArgs)p_args;
            MonsterSpell   spell        = (MonsterSpell)args.Spell;
            EventHandler   eventHandler = delegate(Object sender, EventArgs e)
            {
                DelayedEventManager.InvokeEvent(EDelayType.ON_FX_HIT, EEventType.MONSTER_CAST_SPELL, p_sender, args);
                MyController.AttackingDone.Trigger();
                if (spell.SpellType == EMonsterSpell.FLICKER)
                {
                    m_MainView.SetEntityPosition();
                }
                if (MyController is Monster)
                {
                    ((Monster)MyController).BuffHandler.FlushActionLog(MonsterBuffHandler.ELogEntryPhase.ON_CAST_SPELL);
                    ((Monster)MyController).BuffHandler.RemoveFlaggedBuffs();
                }
                SpellEffectEntryEventArgs p_args9 = new SpellEffectEntryEventArgs(p_sender, args);
                LegacyLogic.Instance.ActionLog.PushEntry(p_args9);
                foreach (SpellTarget spellTarget2 in args.SpellTargets)
                {
                    if (spellTarget2.Target is Character)
                    {
                        ((Character)spellTarget2.Target).ConditionHandler.FlushActionLog();
                        ((Character)spellTarget2.Target).ConditionHandler.FlushDelayedActionLog();
                        LegacyLogic.Instance.WorldManager.Party.Buffs.FlushActionLog();
                    }
                }
                if (MyController is Monster)
                {
                    ((Monster)MyController).BuffHandler.FlushActionLog(MonsterBuffHandler.ELogEntryPhase.ON_END_TURN);
                }
            };
            FXDescription fxdescription = Helper.ResourcesLoad <FXDescription>(spell.EffectKey, false);

            if (fxdescription == null)
            {
                Debug.LogError("FXDescription not found! at " + spell.EffectKey, this);
                eventHandler(this, EventArgs.Empty);
                return;
            }
            fxdescription           = Helper.Instantiate <FXDescription>(fxdescription);
            fxdescription.Finished += eventHandler;
            Vector3 p_slotOriginPosition;
            Vector3 p_slotForward;
            Vector3 p_slotLeft;
            Vector3 p_slotTargetPosition;

            ViewManager.GetSlotDatas(MyController.Position, LegacyLogic.Instance.WorldManager.Party.Position, out p_slotOriginPosition, out p_slotForward, out p_slotLeft, out p_slotTargetPosition);
            Int32 animationID;

            if (Int32.TryParse(spell.EffectAnimationClip, out animationID))
            {
                m_animatorControl.AttackMagic(animationID);
            }
            else
            {
                Debug.LogError("Error parse animation id for attack magic '" + spell.EffectAnimationClip + "'");
                m_animatorControl.AttackMagic();
            }
            GameObject  gameObject = this.gameObject;
            ETargetType targetType = spell.TargetType;

            if (args.SpellTargets.Count == 0)
            {
                Debug.LogError("Error, missing targets for effects\n" + DebugUtil.DumpObjectText(spell));
                FXArgs p_args2 = new FXArgs(gameObject, gameObject, gameObject, gameObject, p_slotOriginPosition, p_slotForward, p_slotLeft, p_slotTargetPosition, new List <GameObject>
                {
                    gameObject
                });
                fxdescription.Configurate(m_eventHandler, p_args2);
                return;
            }
            if ((targetType & ETargetType.MONSTER) == ETargetType.MONSTER)
            {
                PlayerEntityView  playerEntityView = ViewManager.Instance.FindViewAndGetComponent <PlayerEntityView>(LegacyLogic.Instance.WorldManager.Party);
                MovingEntity      movingEntity     = null;
                List <GameObject> list             = new List <GameObject>();
                foreach (SpellTarget spellTarget in args.SpellTargets)
                {
                    GameObject gameObject2 = null;
                    if (spellTarget.Target is Character)
                    {
                        if (movingEntity == null)
                        {
                            movingEntity = LegacyLogic.Instance.WorldManager.Party;
                        }
                        gameObject2 = playerEntityView.GetMemberGameObject(((Character)spellTarget.Target).Index);
                    }
                    else if (spellTarget.Target is MovingEntity)
                    {
                        if (movingEntity == null)
                        {
                            movingEntity = (MovingEntity)spellTarget.Target;
                        }
                        gameObject2 = ViewManager.Instance.FindView((MovingEntity)spellTarget.Target);
                    }
                    if (gameObject2 != null)
                    {
                        list.Add(gameObject2);
                    }
                }
                ViewManager.GetSlotDatas(MyController.Position, movingEntity.Position, out p_slotOriginPosition, out p_slotForward, out p_slotLeft, out p_slotTargetPosition);
                FXArgs p_args3 = new FXArgs(gameObject, playerEntityView.gameObject, gameObject, playerEntityView.gameObject, p_slotOriginPosition, p_slotForward, p_slotLeft, p_slotTargetPosition, list);
                fxdescription.Configurate(m_eventHandler, p_args3);
            }
            else if ((targetType & ETargetType.MULTY) == ETargetType.MULTY)
            {
                PlayerEntityView  playerEntityView2 = ViewManager.Instance.FindViewAndGetComponent <PlayerEntityView>(LegacyLogic.Instance.WorldManager.Party);
                List <GameObject> list2             = new List <GameObject>(4);
                for (Int32 i = 0; i < 4; i++)
                {
                    list2.Add(playerEntityView2.GetMemberGameObject(i));
                }
                FXArgs p_args4 = new FXArgs(gameObject, playerEntityView2.gameObject, gameObject, playerEntityView2.gameObject, p_slotOriginPosition, p_slotForward, p_slotLeft, p_slotTargetPosition, list2);
                fxdescription.Configurate(m_eventHandler, p_args4);
            }
            else if ((targetType & ETargetType.SINGLE) == ETargetType.SINGLE)
            {
                Boolean flag = true;
                foreach (AttackedTarget attackedTarget in args.SpellTargetsOfType <AttackedTarget>())
                {
                    Character  character   = (Character)attackedTarget.Target;
                    GameObject characterGO = FXHelper.GetCharacterGO(character.Index);
                    if (!flag)
                    {
                        fxdescription = Helper.Instantiate <FXDescription>(fxdescription);
                    }
                    FXArgs p_args5 = new FXArgs(gameObject, characterGO, gameObject, characterGO, p_slotOriginPosition, p_slotForward, p_slotLeft, p_slotTargetPosition, new List <GameObject>
                    {
                        characterGO
                    });
                    fxdescription.Configurate(m_eventHandler, p_args5);
                    flag = false;
                }
                foreach (MonsterBuffTarget monsterBuffTarget in args.SpellTargetsOfType <MonsterBuffTarget>())
                {
                    Character  character2   = (Character)monsterBuffTarget.Target;
                    GameObject characterGO2 = FXHelper.GetCharacterGO(character2.Index);
                    if (!flag)
                    {
                        fxdescription = Helper.Instantiate <FXDescription>(fxdescription);
                    }
                    FXArgs p_args6 = new FXArgs(gameObject, characterGO2, gameObject, characterGO2, p_slotOriginPosition, p_slotForward, p_slotLeft, p_slotTargetPosition, new List <GameObject>
                    {
                        characterGO2
                    });
                    fxdescription.Configurate(m_eventHandler, p_args6);
                    flag = false;
                }
            }
            else if ((targetType & ETargetType.ADJACENT) == ETargetType.ADJACENT)
            {
                FXArgs p_args7 = new FXArgs(gameObject, gameObject, gameObject, gameObject, p_slotOriginPosition, p_slotForward, p_slotLeft, p_slotTargetPosition);
                fxdescription.Configurate(m_eventHandler, p_args7);
            }
            else
            {
                FXArgs p_args8 = new FXArgs(gameObject, gameObject, gameObject, gameObject, p_slotOriginPosition, p_slotForward, p_slotLeft, p_slotTargetPosition);
                fxdescription.Configurate(m_eventHandler, p_args8);
            }
        }
Пример #7
0
        private void TakeHit(Object p_sender, EventArgs p_args, Boolean p_isRanged)
        {
            Int32   tagHash  = m_animator.GetCurrentAnimatorStateInfo(0).tagHash;
            Int32   tagHash2 = m_animator.GetNextAnimatorStateInfo(0).tagHash;
            Int32   num      = Animator.StringToHash("ATTACK");
            Int32   num2     = Animator.StringToHash("DIE");
            Boolean flag     = true;
            Boolean flag2    = false;

            if (p_args is AttacksEventArgs)
            {
                AttacksEventArgs attacksEventArgs = (AttacksEventArgs)p_args;
                foreach (AttacksEventArgs.AttackedTarget attackedTarget in attacksEventArgs.Attacks)
                {
                    if (attackedTarget.AttackTarget == MyController)
                    {
                        AttackResult attackResult = attackedTarget.AttackResult;
                        if (flag)
                        {
                            flag = false;
                            ((Monster)MyController).HitAnimationDone.Trigger();
                            FlushMonsterLogEntries();
                            DelayedEventManager.InvokeEvent(EDelayType.ON_FX_FINISH, (!p_isRanged) ? EEventType.CHARACTER_ATTACKS : EEventType.CHARACTER_ATTACKS_RANGED, p_sender, p_args);
                            if (attackedTarget.AttackResult.DamageDone > 0 && num2 != tagHash && num2 != tagHash2 && num != tagHash && num != tagHash2)
                            {
                                m_animatorControl.Hit();
                            }
                            PlayTakeHitSound(p_sender, attackResult, p_isRanged);
                        }
                        if (!flag2 && attacksEventArgs.PushToParty)
                        {
                            flag2 = true;
                            m_MainView.PushEntityToPosition();
                        }
                        foreach (AttacksEventArgs.AttackedTarget attackedTarget2 in attacksEventArgs.Attacks)
                        {
                            if (attackedTarget2.AttackTarget != null && attackedTarget2.AttackTarget == MyController)
                            {
                                Monster monster = (Monster)MyController;
                                monster.CombatHandler.CheckCounterAttack((Character)p_sender);
                                List <CombatEntryEventArgs> counterLogEntries = monster.CombatHandler.CounterLogEntries;
                                if (counterLogEntries.Count > 0)
                                {
                                    foreach (CombatEntryEventArgs p_args2 in counterLogEntries)
                                    {
                                        LegacyLogic.Instance.ActionLog.PushEntry(p_args2);
                                        if (LegacyLogic.Instance.WorldManager.Party.Buffs.HasBuff(EPartyBuffs.CELESTIAL_ARMOR))
                                        {
                                            if (LegacyLogic.Instance.WorldManager.Party.Buffs.GetBuff(EPartyBuffs.CELESTIAL_ARMOR).IsExpired())
                                            {
                                                LegacyLogic.Instance.WorldManager.Party.Buffs.RemoveBuff(EPartyBuffs.CELESTIAL_ARMOR);
                                            }
                                            LegacyLogic.Instance.WorldManager.Party.Buffs.FlushActionLog();
                                        }
                                        ((Character)p_sender).ConditionHandler.FlushActionLog();
                                        ((Character)p_sender).ConditionHandler.FlushDelayedActionLog();
                                    }
                                }
                                counterLogEntries.Clear();
                            }
                        }
                        if (attackResult.ReflectedDamage != null && attackResult.ReflectedDamage.Damages.Count > 0 && MyController is Monster && (!p_isRanged || (p_isRanged && ((Monster)MyController).DistanceToParty < 1.1f)))
                        {
                            ((Monster)MyController).AbilityHandler.FlushActionLog(EExecutionPhase.ON_CHARACTER_ATTACKS_MONSTER_AFTER_DAMAGE_REDUCTION);
                            AttackResult attackResult2 = ((Character)p_sender).FightHandler.AttackEntity(attackResult.ReflectedDamage, true, EDamageType.PHYSICAL, true, 0, false);
                            ((Character)p_sender).ApplyDamages(attackResult2, (Monster)MyController);
                            Object p_source = (attackResult2.ReflectedDamageSource != null) ? attackResult2.ReflectedDamageSource : MyController;
                            CombatEntryEventArgs p_args3 = new CombatEntryEventArgs(p_source, p_sender, attackResult2, null);
                            LegacyLogic.Instance.ActionLog.PushEntry(p_args3);
                            DelayedEventManager.InvokeEvent(EDelayType.ON_FX_FINISH, EEventType.REFLECTED_MAGIC_DAMAGE, p_sender, new AttacksEventArgs(false)
                            {
                                Attacks =
                                {
                                    new AttacksEventArgs.AttackedTarget(p_sender, attackResult2)
                                }
                            });
                        }
                        this.SendEvent("OnReceivedAttacks", new AttacksUnityEventArgs(this, attackResult, false));
                    }
                }
            }
            else if (p_args is SpellEventArgs)
            {
                SpellEventArgs spellEventArgs = (SpellEventArgs)p_args;
                foreach (AttackedTarget attackedTarget3 in spellEventArgs.SpellTargetsOfType <AttackedTarget>())
                {
                    if (attackedTarget3.Target == MyController)
                    {
                        if (flag)
                        {
                            flag = false;
                            TakeHitDoFinishBySpell(p_sender, p_args);
                            if (attackedTarget3.Result.DamageDone > 0 && num2 != tagHash && num2 != tagHash2 && num != tagHash && num != tagHash2)
                            {
                                m_animatorControl.Hit();
                            }
                        }
                        if (attackedTarget3.Result.ReflectedDamage != null && attackedTarget3.Result.ReflectedDamage.Damages.Count > 0 && MyController is Monster && (!p_isRanged || (p_isRanged && ((Monster)MyController).DistanceToParty < 1.1f)))
                        {
                            ((Monster)MyController).AbilityHandler.FlushActionLog(EExecutionPhase.ON_CHARACTER_ATTACKS_MONSTER_AFTER_DAMAGE_REDUCTION);
                            AttackResult attackResult3 = ((Character)p_sender).FightHandler.AttackEntity(attackedTarget3.Result.ReflectedDamage, true, EDamageType.PHYSICAL, true, 0, false);
                            ((Character)p_sender).ApplyDamages(attackResult3, (Monster)MyController);
                            Object p_source2             = (attackResult3.ReflectedDamageSource != null) ? attackResult3.ReflectedDamageSource : MyController;
                            CombatEntryEventArgs p_args4 = new CombatEntryEventArgs(p_source2, p_sender, attackResult3, null);
                            LegacyLogic.Instance.ActionLog.PushEntry(p_args4);
                            DelayedEventManager.InvokeEvent(EDelayType.ON_FX_FINISH, EEventType.REFLECTED_MAGIC_DAMAGE, p_sender, new AttacksEventArgs(false)
                            {
                                Attacks =
                                {
                                    new AttacksEventArgs.AttackedTarget(p_sender, attackResult3)
                                }
                            });
                        }
                        this.SendEvent("OnReceivedAttacks", new AttacksUnityEventArgs(this, attackedTarget3.Result, spellEventArgs.DamageType != EDamageType.PHYSICAL));
                    }
                }
                foreach (PushedTarget pushedTarget in spellEventArgs.SpellTargetsOfType <PushedTarget>())
                {
                    if (pushedTarget.Target == MyController)
                    {
                        m_MainView.PushEntityToPosition();
                    }
                }
                foreach (MonsterBuffTarget monsterBuffTarget in spellEventArgs.SpellTargetsOfType <MonsterBuffTarget>())
                {
                    if (flag && monsterBuffTarget.Target == MyController)
                    {
                        flag = false;
                        TakeHitDoFinishBySpell(p_sender, p_args);
                    }
                }
            }
        }