private void TriggerAction(Action _action, ref PoolObjHandle <ActorRoot> target)
        {
            if (!this.attackActor)
            {
                return;
            }
            uint objID = target.get_handle().ObjID;
            int  num;

            if (this.collideCountMap.TryGetValue(objID, ref num))
            {
                num++;
                this.collideCountMap.set_Item(objID, num);
            }
            else
            {
                this.collideCountMap.Add(objID, 1);
            }
            int num2 = 0;

            if (this.collideTimeMap.TryGetValue(objID, ref num2))
            {
                this.collideTimeMap.set_Item(objID, this.localTime);
            }
            else
            {
                this.collideTimeMap.Add(objID, this.localTime);
            }
            if (this.skillContext == null)
            {
                return;
            }
            this.skillContext.EffectCount++;
            this.skillContext.EffectCountInSingleTrigger++;
            if (!this.bTriggerMode)
            {
                this.attackActor.get_handle().SkillControl.SpawnBuff(this.skillContext.Originator, this.skillContext, this.SelfSkillCombineID_1, false);
                this.attackActor.get_handle().SkillControl.SpawnBuff(this.skillContext.Originator, this.skillContext, this.SelfSkillCombineID_2, false);
                this.attackActor.get_handle().SkillControl.SpawnBuff(this.skillContext.Originator, this.skillContext, this.SelfSkillCombineID_3, false);
            }
            else
            {
                if (this.skillContext.Originator && this.SelfSkillCombineID_1 > 0)
                {
                    HitTriggerDurationContext.STriggeredBuffContext inPoint = default(HitTriggerDurationContext.STriggeredBuffContext);
                    inPoint.actor  = this.skillContext.Originator;
                    inPoint.buffId = this.SelfSkillCombineID_1;
                    if (BaseAlgorithm.AddUniqueItem <HitTriggerDurationContext.STriggeredBuffContext>(this.TriggeredBuffContextList, inPoint))
                    {
                        this.attackActor.get_handle().SkillControl.SpawnBuff(this.skillContext.Originator, this.skillContext, this.SelfSkillCombineID_1, false);
                    }
                }
                if (this.skillContext.Originator && this.SelfSkillCombineID_2 > 0)
                {
                    HitTriggerDurationContext.STriggeredBuffContext inPoint2 = default(HitTriggerDurationContext.STriggeredBuffContext);
                    inPoint2.actor  = this.skillContext.Originator;
                    inPoint2.buffId = this.SelfSkillCombineID_2;
                    if (BaseAlgorithm.AddUniqueItem <HitTriggerDurationContext.STriggeredBuffContext>(this.TriggeredBuffContextList, inPoint2))
                    {
                        this.attackActor.get_handle().SkillControl.SpawnBuff(this.skillContext.Originator, this.skillContext, this.SelfSkillCombineID_2, false);
                    }
                }
                if (this.skillContext.Originator && this.SelfSkillCombineID_3 > 0)
                {
                    HitTriggerDurationContext.STriggeredBuffContext inPoint3 = default(HitTriggerDurationContext.STriggeredBuffContext);
                    inPoint3.actor  = this.skillContext.Originator;
                    inPoint3.buffId = this.SelfSkillCombineID_3;
                    if (BaseAlgorithm.AddUniqueItem <HitTriggerDurationContext.STriggeredBuffContext>(this.TriggeredBuffContextList, inPoint3))
                    {
                        this.attackActor.get_handle().SkillControl.SpawnBuff(this.skillContext.Originator, this.skillContext, this.SelfSkillCombineID_3, false);
                    }
                }
            }
            if (target)
            {
                this.hit = true;
                if (target.get_handle().TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero && !this.bHitTargetHero)
                {
                    this.bHitTargetHero   = true;
                    this.HitTargetHeroPos = target.get_handle().location;
                }
                this.skillContext.EffectDir = this.attackActor.get_handle().forward;
                bool      flag       = false;
                BuffSkill buffSkill  = null;
                BuffSkill buffSkill2 = null;
                BuffSkill buffSkill3 = null;
                if (!this.bTriggerMode)
                {
                    this.attackActor.get_handle().SkillControl.SpawnBuff(target, this.skillContext, this.TargetSkillCombine_1, ref buffSkill, this.bExtraBuff);
                    this.attackActor.get_handle().SkillControl.SpawnBuff(target, this.skillContext, this.TargetSkillCombine_2, ref buffSkill2, this.bExtraBuff);
                    this.attackActor.get_handle().SkillControl.SpawnBuff(target, this.skillContext, this.TargetSkillCombine_3, ref buffSkill3, this.bExtraBuff);
                    if ((buffSkill != null && buffSkill.cfgData.bNotGetHate == 0) || (buffSkill2 != null && buffSkill2.cfgData.bNotGetHate == 0) || (buffSkill3 != null && buffSkill3.cfgData.bNotGetHate == 0))
                    {
                        flag = true;
                    }
                }
                else
                {
                    if (this.TargetSkillCombine_1 > 0)
                    {
                        HitTriggerDurationContext.STriggeredBuffContext inPoint4 = default(HitTriggerDurationContext.STriggeredBuffContext);
                        inPoint4.actor  = target;
                        inPoint4.buffId = this.TargetSkillCombine_1;
                        if (BaseAlgorithm.AddUniqueItem <HitTriggerDurationContext.STriggeredBuffContext>(this.TriggeredBuffContextList, inPoint4))
                        {
                            this.attackActor.get_handle().SkillControl.SpawnBuff(target, this.skillContext, this.TargetSkillCombine_1, ref buffSkill, false);
                        }
                        if (buffSkill != null && buffSkill.cfgData.bNotGetHate == 0)
                        {
                            flag = true;
                        }
                    }
                    if (this.TargetSkillCombine_2 > 0)
                    {
                        HitTriggerDurationContext.STriggeredBuffContext inPoint5 = default(HitTriggerDurationContext.STriggeredBuffContext);
                        inPoint5.actor  = target;
                        inPoint5.buffId = this.TargetSkillCombine_2;
                        if (BaseAlgorithm.AddUniqueItem <HitTriggerDurationContext.STriggeredBuffContext>(this.TriggeredBuffContextList, inPoint5))
                        {
                            this.attackActor.get_handle().SkillControl.SpawnBuff(target, this.skillContext, this.TargetSkillCombine_2, ref buffSkill2, false);
                        }
                        if (buffSkill2 != null && buffSkill2.cfgData.bNotGetHate == 0)
                        {
                            flag = true;
                        }
                    }
                    if (this.TargetSkillCombine_3 > 0)
                    {
                        HitTriggerDurationContext.STriggeredBuffContext inPoint6 = default(HitTriggerDurationContext.STriggeredBuffContext);
                        inPoint6.actor  = target;
                        inPoint6.buffId = this.TargetSkillCombine_3;
                        if (BaseAlgorithm.AddUniqueItem <HitTriggerDurationContext.STriggeredBuffContext>(this.TriggeredBuffContextList, inPoint6))
                        {
                            this.attackActor.get_handle().SkillControl.SpawnBuff(target, this.skillContext, this.TargetSkillCombine_3, ref buffSkill3, false);
                        }
                        if (buffSkill3 != null && buffSkill3.cfgData.bNotGetHate == 0)
                        {
                            flag = true;
                        }
                    }
                }
                if (this.TargetSkillLeaveRemove_1 && buffSkill != null)
                {
                    this.RemoveSkillList.Add(buffSkill);
                }
                if (this.TargetSkillLeaveRemove_2 && buffSkill2 != null)
                {
                    this.RemoveSkillList.Add(buffSkill2);
                }
                if (this.TargetSkillLeaveRemove_3 && buffSkill3 != null)
                {
                    this.RemoveSkillList.Add(buffSkill3);
                }
                if (flag)
                {
                    target.get_handle().ActorControl.BeAttackHit(this.attackActor, this.skillContext.bExposing);
                }
            }
            if (this.bTriggerBullet && this.BulletActionName != null && this.BulletActionName.get_Length() > 0)
            {
                this.skillContext.AppointType = 1;
                this.skillContext.TargetActor = target;
                this.attackActor.get_handle().SkillControl.SpawnBullet(this.skillContext, this.BulletActionName, false, this.bAgeImmeExcute, 0, 0);
            }
        }
 public void ExploreCellsInternal <TSetCellVisible>(ref TSetCellVisible setCellVisible, VInt2 newSurfPos, VInt3 unitLoc, int surfSightRange, GameFowManager pFowMgr, COM_PLAYERCAMP camp, FowLos.EViewExploringMode ViewExploringMode, bool bDrawDebugLines) where TSetCellVisible : ISetCellVisible
 {
     if (pFowMgr == null || pFowMgr.m_pFieldObj == null)
     {
         return;
     }
     if (ViewExploringMode != FowLos.EViewExploringMode.EViewExploringMode_ShadowCast)
     {
         if (ViewExploringMode == FowLos.EViewExploringMode.EViewExploringMode_DistOnly)
         {
             for (int i = -surfSightRange - 1; i <= surfSightRange + 1; i++)
             {
                 for (int j = -surfSightRange - 1; j <= surfSightRange + 1; j++)
                 {
                     VInt2 b     = new VInt2(i, j);
                     VInt2 inPos = newSurfPos + b;
                     if (pFowMgr.IsInsideSurface(inPos.x, inPos.y) && b.sqrMagnitude < surfSightRange * surfSightRange)
                     {
                         setCellVisible.SetVisible(inPos, camp, true);
                     }
                 }
             }
         }
         else if (ViewExploringMode != FowLos.EViewExploringMode.EViewExploringMode_WatchTower && ViewExploringMode == FowLos.EViewExploringMode.EViewExploringMode_RayCast)
         {
             int sightSqr = surfSightRange * surfSightRange;
             int num      = newSurfPos.x - surfSightRange;
             int num2     = newSurfPos.x + surfSightRange;
             int num3     = newSurfPos.y - surfSightRange;
             int num4     = newSurfPos.y + surfSightRange;
             num  = Mathf.Clamp(num, 0, pFowMgr.m_pFieldObj.NumX - 1);
             num2 = Mathf.Clamp(num2, 0, pFowMgr.m_pFieldObj.NumX - 1);
             num3 = Mathf.Clamp(num3, 0, pFowMgr.m_pFieldObj.NumY - 1);
             num4 = Mathf.Clamp(num4, 0, pFowMgr.m_pFieldObj.NumY - 1);
             byte viewBlockId = pFowMgr.m_pFieldObj.LevelGrid.GetGridCell(newSurfPos).m_viewBlockId;
             FieldObj.SViewBlockAttr sViewBlockAttr = default(FieldObj.SViewBlockAttr);
             pFowMgr.m_pFieldObj.QueryAttr(newSurfPos, out sViewBlockAttr);
             FowLos.CRaycastQuadrant cRaycastQuadrant = new FowLos.CRaycastQuadrant();
             cRaycastQuadrant.min = new VInt2(num, num3);
             cRaycastQuadrant.max = new VInt2(num2, num4);
             if (pFowMgr.m_pFieldObj.ViewBlockArrayImpl != null)
             {
                 List <FowLos.SBlockWalls> .Enumerator enumerator = pFowMgr.m_pFieldObj.ViewBlockArrayImpl.GetEnumerator();
                 while (enumerator.MoveNext())
                 {
                     FowLos.SBlockWalls current = enumerator.get_Current();
                     int areaId = (int)current.m_areaId;
                     DebugHelper.Assert(areaId != 0);
                     FieldObj.SViewBlockAttr sViewBlockAttr2;
                     if (((int)viewBlockId != areaId || sViewBlockAttr.BlockType != 1) && (pFowMgr.m_pFieldObj.GrassBlockView || !pFowMgr.m_pFieldObj.ViewBlockAttrMap.TryGetValue((byte)areaId, ref sViewBlockAttr2) || sViewBlockAttr2.BlockType != 1) && this.ValidateViewBlock(current, cRaycastQuadrant.min.x, cRaycastQuadrant.max.x, cRaycastQuadrant.min.y, cRaycastQuadrant.max.y))
                     {
                         cRaycastQuadrant.viewBlockArrayFinal.Add(current);
                         Dictionary <byte, List <FowLos.SGridWall> > .Enumerator enumerator2 = current.m_wallsHorizontal.GetEnumerator();
                         while (enumerator2.MoveNext())
                         {
                             List <byte> wallsHorizontal = cRaycastQuadrant.wallsHorizontal;
                             KeyValuePair <byte, List <FowLos.SGridWall> > current2 = enumerator2.get_Current();
                             BaseAlgorithm.AddUniqueItem <byte>(wallsHorizontal, current2.get_Key());
                         }
                         enumerator2 = current.m_wallsVertical.GetEnumerator();
                         while (enumerator2.MoveNext())
                         {
                             List <byte> wallsVertical = cRaycastQuadrant.wallsVertical;
                             KeyValuePair <byte, List <FowLos.SGridWall> > current3 = enumerator2.get_Current();
                             BaseAlgorithm.AddUniqueItem <byte>(wallsVertical, current3.get_Key());
                         }
                     }
                 }
                 this.RaycastCheck <TSetCellVisible>(pFowMgr, cRaycastQuadrant, newSurfPos, unitLoc, sightSqr, camp, bDrawDebugLines, viewBlockId, ref setCellVisible);
             }
             cRaycastQuadrant.Clear();
         }
     }
 }
Example #3
0
 private void TriggerAction(AGE.Action _action, ref PoolObjHandle <ActorRoot> target)
 {
     if (this.attackActor != 0)
     {
         int  num;
         uint objID = target.handle.ObjID;
         if (this.collideCountMap.TryGetValue(objID, out num))
         {
             num++;
             this.collideCountMap[objID] = num;
         }
         else
         {
             this.collideCountMap.Add(objID, 1);
         }
         int num3 = 0;
         if (this.collideTimeMap.TryGetValue(objID, out num3))
         {
             this.collideTimeMap[objID] = this.localTime;
         }
         else
         {
             this.collideTimeMap.Add(objID, this.localTime);
         }
         SkillUseContext refParamObject = _action.refParams.GetRefParamObject <SkillUseContext>("SkillContext");
         if ((refParamObject != null) && (_action.refParams.GetRefParamObject <BaseSkill>("SkillObj") != null))
         {
             refParamObject.EffectCount++;
             if (!this.bTriggerMode)
             {
                 this.attackActor.handle.SkillControl.SpawnBuff(refParamObject.Originator, refParamObject, this.SelfSkillCombineID_1, false);
                 this.attackActor.handle.SkillControl.SpawnBuff(refParamObject.Originator, refParamObject, this.SelfSkillCombineID_2, false);
                 this.attackActor.handle.SkillControl.SpawnBuff(refParamObject.Originator, refParamObject, this.SelfSkillCombineID_3, false);
             }
             else
             {
                 if ((refParamObject.Originator != 0) && (this.SelfSkillCombineID_1 > 0))
                 {
                     STriggeredBuffContext inPoint = new STriggeredBuffContext {
                         actor  = refParamObject.Originator,
                         buffId = this.SelfSkillCombineID_1
                     };
                     if (BaseAlgorithm.AddUniqueItem <STriggeredBuffContext>(this.TriggeredBuffContextList, inPoint))
                     {
                         this.attackActor.handle.SkillControl.SpawnBuff(refParamObject.Originator, refParamObject, this.SelfSkillCombineID_1, false);
                     }
                 }
                 if ((refParamObject.Originator != 0) && (this.SelfSkillCombineID_2 > 0))
                 {
                     STriggeredBuffContext context3 = new STriggeredBuffContext {
                         actor  = refParamObject.Originator,
                         buffId = this.SelfSkillCombineID_2
                     };
                     if (BaseAlgorithm.AddUniqueItem <STriggeredBuffContext>(this.TriggeredBuffContextList, context3))
                     {
                         this.attackActor.handle.SkillControl.SpawnBuff(refParamObject.Originator, refParamObject, this.SelfSkillCombineID_2, false);
                     }
                 }
                 if ((refParamObject.Originator != 0) && (this.SelfSkillCombineID_3 > 0))
                 {
                     STriggeredBuffContext context4 = new STriggeredBuffContext {
                         actor  = refParamObject.Originator,
                         buffId = this.SelfSkillCombineID_3
                     };
                     if (BaseAlgorithm.AddUniqueItem <STriggeredBuffContext>(this.TriggeredBuffContextList, context4))
                     {
                         this.attackActor.handle.SkillControl.SpawnBuff(refParamObject.Originator, refParamObject, this.SelfSkillCombineID_3, false);
                     }
                 }
             }
             if (target != 0)
             {
                 this.hit = true;
                 if ((target.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero) && !this.bHitTargetHero)
                 {
                     this.bHitTargetHero   = true;
                     this.HitTargetHeroPos = target.handle.location;
                 }
                 refParamObject.EffectDir = this.attackActor.handle.forward;
                 bool flag = false;
                 if (!this.bTriggerMode)
                 {
                     bool introduced12 = this.attackActor.handle.SkillControl.SpawnBuff(target, refParamObject, this.TargetSkillCombine_1, this.bExtraBuff);
                     flag  = introduced12 | this.attackActor.handle.SkillControl.SpawnBuff(target, refParamObject, this.TargetSkillCombine_2, this.bExtraBuff);
                     flag |= this.attackActor.handle.SkillControl.SpawnBuff(target, refParamObject, this.TargetSkillCombine_3, this.bExtraBuff);
                 }
                 else
                 {
                     if (this.TargetSkillCombine_1 > 0)
                     {
                         STriggeredBuffContext context5 = new STriggeredBuffContext {
                             actor  = target,
                             buffId = this.TargetSkillCombine_1
                         };
                         if (BaseAlgorithm.AddUniqueItem <STriggeredBuffContext>(this.TriggeredBuffContextList, context5))
                         {
                             this.attackActor.handle.SkillControl.SpawnBuff(target, refParamObject, this.TargetSkillCombine_1, false);
                         }
                         flag = true;
                     }
                     if (this.TargetSkillCombine_2 > 0)
                     {
                         STriggeredBuffContext context6 = new STriggeredBuffContext {
                             actor  = target,
                             buffId = this.TargetSkillCombine_2
                         };
                         if (BaseAlgorithm.AddUniqueItem <STriggeredBuffContext>(this.TriggeredBuffContextList, context6))
                         {
                             this.attackActor.handle.SkillControl.SpawnBuff(target, refParamObject, this.TargetSkillCombine_2, false);
                         }
                         flag = true;
                     }
                     if (this.TargetSkillCombine_3 > 0)
                     {
                         STriggeredBuffContext context7 = new STriggeredBuffContext {
                             actor  = target,
                             buffId = this.TargetSkillCombine_3
                         };
                         if (BaseAlgorithm.AddUniqueItem <STriggeredBuffContext>(this.TriggeredBuffContextList, context7))
                         {
                             this.attackActor.handle.SkillControl.SpawnBuff(target, refParamObject, this.TargetSkillCombine_3, false);
                         }
                         flag = true;
                     }
                 }
                 if (flag)
                 {
                     target.handle.ActorControl.BeAttackHit(this.attackActor);
                 }
             }
             if ((this.bTriggerBullet && (this.BulletActionName != null)) && (this.BulletActionName.Length > 0))
             {
                 refParamObject.AppointType = SkillRangeAppointType.Target;
                 refParamObject.TargetActor = target;
                 this.attackActor.handle.SkillControl.SpawnBullet(refParamObject, this.BulletActionName, false, this.bAgeImmeExcute);
             }
         }
     }
 }