Exemplo n.º 1
0
        private int CriticalDamagePart(ref HurtDataInfo hurt)
        {
            bool flag = false;
            int  num  = 0;

            if ((hurt.atkSlot == SkillSlotType.SLOT_SKILL_0) && (hurt.iCanSkillCrit != 0))
            {
                int num2 = (int)((hurt.attackInfo.iCritStrikeValue + (hurt.attackInfo.iActorLvl * this.battleParam.dwM_Critical)) + this.battleParam.dwN_Critical);
                int num3 = 0;
                int num4 = 0;
                if (num2 > 0)
                {
                    num3 = ((hurt.attackInfo.iCritStrikeValue * 0x2710) / num2) + hurt.attackInfo.iCritStrikeRate;
                }
                int num5 = (int)((hurt.attackInfo.iReduceCritStrikeValue + (base.actor.ValueComponent.mActorValue.actorLvl * this.battleParam.dwM_ReduceCritical)) + this.battleParam.dwN_ReduceCritical);
                if (num5 > 0)
                {
                    num4  = (hurt.attackInfo.iReduceCritStrikeValue * 0x2710) / num5;
                    num4 += hurt.attackInfo.iReduceCritStrikeRate;
                }
                if (!base.actor.ActorControl.GetNoAbilityFlag(ObjAbilityType.ObjAbility_ImmuneCrit))
                {
                    flag = FrameRandom.Random(0x2710) < (num3 - num4);
                }
                num = !flag ? 0 : hurt.attackInfo.iCritStrikeEff;
                if (flag)
                {
                    DefaultGameEventParam prm = new DefaultGameEventParam(hurt.atker, hurt.target);
                    Singleton <GameEventSys> .instance.SendEvent <DefaultGameEventParam>(GameEventDef.Event_ActorCrit, ref prm);
                }
            }
            return(num);
        }
Exemplo n.º 2
0
 protected void CalcPosDir(out VInt3 outPos, out VInt3 outDir)
 {
     outPos = (VInt3)base.gameObject.transform.position;
     outDir = (VInt3)base.gameObject.transform.forward;
     if (this.RandomPos)
     {
         int num  = 0;
         int num2 = FrameRandom.Random(0x7d1);
         if (num2 > 0x3e8)
         {
             num2 -= 0x3e8;
             num2  = -num2;
         }
         int num3 = FrameRandom.Random(0x7d1);
         if (num3 > 0x3e8)
         {
             num3 -= 0x3e8;
             num3  = -num3;
         }
         VInt3   num4   = new VInt3(num2, num, num3);
         Vector3 vector = (Vector3)num4;
         vector.Normalize();
         int num5 = 0;
         if ((this.RandomPosRadiusOuter - this.RandomPosRadiusInner) > 0)
         {
             num5 = FrameRandom.Random((uint)(this.RandomPosRadiusOuter - this.RandomPosRadiusInner)) + this.RandomPosRadiusInner;
         }
         float   num6    = num5 * 0.001f;
         Vector3 vector2 = ((Vector3)outPos) + ((Vector3)(vector * num6));
         outPos = (VInt3)vector2;
         outDir = num4.NormalizeTo(0x3e8);
     }
 }
Exemplo n.º 3
0
 protected void CalcPosDir(out VInt3 outPos, out VInt3 outDir)
 {
     outPos = (VInt3)base.gameObject.transform.position;
     outDir = (VInt3)base.gameObject.transform.forward;
     if (this.RandomPos)
     {
         int num  = 0;
         int num2 = (int)FrameRandom.Random(2001u);
         if (num2 > 1000)
         {
             num2 -= 1000;
             num2  = -num2;
         }
         int num3 = (int)FrameRandom.Random(2001u);
         if (num3 > 1000)
         {
             num3 -= 1000;
             num3  = -num3;
         }
         VInt3   vInt = new VInt3(num2, num, num3);
         Vector3 a    = (Vector3)vInt;
         a.Normalize();
         int num4 = 0;
         if (this.RandomPosRadiusOuter - this.RandomPosRadiusInner > 0)
         {
             num4 = (int)FrameRandom.Random((uint)(this.RandomPosRadiusOuter - this.RandomPosRadiusInner)) + this.RandomPosRadiusInner;
         }
         float   d      = (float)num4 * 0.001f;
         Vector3 vector = (Vector3)outPos + a * d;
         outPos = (VInt3)vector;
         outDir = vInt.NormalizeTo(1000);
     }
 }
Exemplo n.º 4
0
        private void SpawnBullet(AGE.Action _action)
        {
            SkillUseContext refParamObject = _action.refParams.GetRefParamObject <SkillUseContext>("SkillContext");

            for (int i = 0; i < this.spawnMax; i++)
            {
                int   index = 0;
                VInt3 zero  = VInt3.zero;
                if (this.transArray.Length < 0)
                {
                    zero = VInt3.zero;
                }
                else
                {
                    if (this.bRandom)
                    {
                        index = FrameRandom.Random((uint)this.transArray.Length);
                    }
                    else
                    {
                        index = i % this.transArray.Length;
                    }
                    zero = this.transArray[index];
                }
                refParamObject.BulletPos = zero;
                PoolObjHandle <BulletSkill> handle = this.skillControl.SpawnBullet(refParamObject, this.ActionName, this.bDeadRemove, this.bAgeImmeExcute);
            }
        }
Exemplo n.º 5
0
        public void InitRandomSkill(int inPassSkillRule)
        {
            int num = 0;
            int key = inPassSkillRule;

            if ((key != 0) && Singleton <FrameSynchr> .instance.bRunning)
            {
                ResRandomSkillPassiveRule dataByKey = GameDataMgr.randomSkillPassiveDatabin.GetDataByKey(key);
                if (dataByKey != null)
                {
                    for (int i = 0; i < 20; i++)
                    {
                        if (dataByKey.astRandomSkillPassiveID1[i].iParam == 0)
                        {
                            break;
                        }
                        num++;
                    }
                    if (num > 0)
                    {
                        ushort index  = FrameRandom.Random((uint)num);
                        int    iParam = dataByKey.astRandomSkillPassiveID1[index].iParam;
                        this.CreateTalent(iParam);
                        int num6 = dataByKey.astRandomSkillPassiveID2[index].iParam;
                        if (num6 != 0)
                        {
                            this.CreateTalent(num6);
                        }
                    }
                }
            }
        }
Exemplo n.º 6
0
        public bool GetRevivePosDir(ref ActorMeta actorMeta, bool bGiveBirth, out VInt3 outPosWorld, out VInt3 outDirWorld)
        {
            outPosWorld = VInt3.zero;
            outDirWorld = VInt3.forward;
            if (Singleton <GamePlayerCenter> .get_instance().GetPlayer(actorMeta.PlayerId) == null)
            {
                return(false);
            }
            ListView <ReviveRegion> .Enumerator enumerator = this.reviveAreas.GetEnumerator();
            while (enumerator.MoveNext())
            {
                if (!(enumerator.get_Current() == null) && actorMeta.ActorCamp == enumerator.get_Current().CampType)
                {
                    IGameActorDataProvider actorDataProvider = Singleton <ActorDataCenter> .get_instance().GetActorDataProvider(GameActorDataProviderType.ServerDataProvider);

                    int       num       = actorDataProvider.Fast_GetActorServerDataBornIndex(ref actorMeta);
                    Transform transform = enumerator.get_Current().transform;
                    if (!bGiveBirth)
                    {
                        uint num2 = (uint)enumerator.get_Current().SubRevivePlaces.Length;
                        if (!enumerator.get_Current().OnlyBirth)
                        {
                            num2 += 1u;
                            int num3 = (int)FrameRandom.Random(num2);
                            if (0 < num3 && enumerator.get_Current().SubRevivePlaces[num3 - 1] != null)
                            {
                                transform = enumerator.get_Current().SubRevivePlaces[num3 - 1].transform;
                            }
                        }
                        else if (num2 >= 1u)
                        {
                            int num4 = (int)FrameRandom.Random(num2);
                            if (enumerator.get_Current().SubRevivePlaces[num4] != null)
                            {
                                transform = enumerator.get_Current().SubRevivePlaces[num4].transform;
                            }
                        }
                    }
                    Transform transform2 = null;
                    if (transform != null)
                    {
                        if (num < transform.childCount)
                        {
                            transform2 = transform.GetChild(num);
                        }
                        else
                        {
                            transform2 = transform;
                        }
                    }
                    if (transform2 != null)
                    {
                        outPosWorld = (VInt3)transform2.position;
                        outDirWorld = (VInt3)transform2.forward;
                        return(true);
                    }
                }
            }
            return(false);
        }
        private void SpawnBullet(Action _action)
        {
            SkillUseContext refParamObject = _action.refParams.GetRefParamObject <SkillUseContext>("SkillContext");

            for (int i = 0; i < this.spawnMax; i++)
            {
                VInt3 bulletPos = VInt3.zero;
                if (this.transArray.Length < 0)
                {
                    bulletPos = VInt3.zero;
                }
                else
                {
                    int num;
                    if (this.bRandom)
                    {
                        num = (int)FrameRandom.Random((uint)this.transArray.Length);
                    }
                    else
                    {
                        num = i % this.transArray.Length;
                    }
                    bulletPos = this.transArray[num];
                }
                refParamObject.BulletPos = bulletPos;
                PoolObjHandle <BulletSkill> poolObjHandle = this.skillControl.SpawnBullet(refParamObject, this.ActionName, this.bDeadRemove, this.bAgeImmeExcute, 0, 0);
            }
        }
        public void InitRandomSkill(int inPassSkillRule)
        {
            int num = 0;

            if (inPassSkillRule != 0)
            {
                DebugHelper.Assert(!Singleton <FrameSynchr> .instance.bActive || Singleton <FrameSynchr> .instance.isRunning);
                if (Singleton <FrameSynchr> .instance.isRunning)
                {
                    ResRandomSkillPassiveRule dataByKey = GameDataMgr.randomSkillPassiveDatabin.GetDataByKey((long)inPassSkillRule);
                    if (dataByKey != null)
                    {
                        for (int i = 0; i < 20; i++)
                        {
                            if (dataByKey.astRandomSkillPassiveID1[i].iParam == 0)
                            {
                                break;
                            }
                            num++;
                        }
                        if (num > 0)
                        {
                            ushort num2   = FrameRandom.Random((uint)num);
                            int    iParam = dataByKey.astRandomSkillPassiveID1[(int)num2].iParam;
                            this.CreateTalent(iParam, SKILL_USE_FROM_TYPE.SKILL_USE_FROM_TYPE_PASSIVESKILL, this.actorPtr.handle.ObjID);
                            int iParam2 = dataByKey.astRandomSkillPassiveID2[(int)num2].iParam;
                            if (iParam2 != 0)
                            {
                                this.CreateTalent(iParam2, SKILL_USE_FROM_TYPE.SKILL_USE_FROM_TYPE_PASSIVESKILL, this.actorPtr.handle.ObjID);
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 9
0
 protected void CalcPosDir(out VInt3 outPos, out VInt3 outDir)
 {
     outPos = (VInt3)base.gameObject.transform.position;
     outDir = (VInt3)base.gameObject.transform.forward;
     if (this.RandomPos)
     {
         int y   = 0;
         int num = (int)FrameRandom.Random(2001u);
         if (num > 1000)
         {
             num -= 1000;
             num  = -num;
         }
         int num2 = (int)FrameRandom.Random(2001u);
         if (num2 > 1000)
         {
             num2 -= 1000;
             num2  = -num2;
         }
         VInt3   ob = new VInt3(num, y, num2);
         Vector3 a  = (Vector3)ob;
         a.Normalize();
         int num3 = 0;
         if (this.RandomPosRadiusOuter - this.RandomPosRadiusInner > 0)
         {
             num3 = (int)FrameRandom.Random((uint)(this.RandomPosRadiusOuter - this.RandomPosRadiusInner)) + this.RandomPosRadiusInner;
         }
         float   d   = (float)num3 * 0.001f;
         Vector3 ob2 = (Vector3)outPos + a * d;
         outPos = (VInt3)ob2;
         outDir = ob.NormalizeTo(1000);
     }
 }
Exemplo n.º 10
0
        public virtual void DoSpawn()
        {
            switch (this.SpawnStyle)
            {
            case CommonSpawnPoint.ESpawnStyle.AllPoints:
                this.DoSpawnSelf();
                this.DoSpawnSubPointsAll();
                this.m_spawnPointOver += this.m_spawnPointList.get_Count() + 1;
                break;

            case CommonSpawnPoint.ESpawnStyle.RandomSubPoint:
            {
                int num = (int)FrameRandom.Random((uint)(this.m_spawnPointList.get_Count() + 1));
                if (num == 0)
                {
                    this.DoSpawnSelf();
                }
                else
                {
                    this.DoSpawnSubPoint(this.m_spawnPointList.get_Item(num - 1) as CommonSpawnPoint);
                }
                this.m_spawnPointOver++;
                break;
            }

            case CommonSpawnPoint.ESpawnStyle.Self:
                this.DoSpawnSelf();
                this.m_spawnPointOver++;
                break;
            }
            if (this.onAllSpawned != null)
            {
                this.onAllSpawned(this);
            }
        }
Exemplo n.º 11
0
        private int RandomSkillID()
        {
            randomList.Clear();
            if (this.changeSkillID != 0)
            {
                randomList.Add(this.changeSkillID);
            }
            if (this.changeSkillID2 != 0)
            {
                randomList.Add(this.changeSkillID2);
            }
            if (this.changeSkillID3 != 0)
            {
                randomList.Add(this.changeSkillID3);
            }
            if (randomList.Count == 1)
            {
                return(randomList[0]);
            }
            if (randomList.Count == 0)
            {
                return(0);
            }
            int num = FrameRandom.Random((uint)randomList.Count);

            return(randomList[num]);
        }
Exemplo n.º 12
0
            protected override EBTStatus update(Agent pAgent, EBTStatus childStatus)
            {
                if (childStatus != EBTStatus.BT_RUNNING)
                {
                    return(childStatus);
                }
                if (base.m_activeChildIndex != -1)
                {
                    BehaviorTask task = base.m_children[base.m_activeChildIndex];
                    return(task.exec(pAgent));
                }
                int   num  = FrameRandom.Random((ushort)this.m_totalSum);
                float num2 = 0f;

                for (int i = 0; i < base.m_children.Count; i++)
                {
                    int num4 = this.m_weightingMap[i];
                    num2 += num4;
                    if ((num4 > 0) && (num2 >= num))
                    {
                        EBTStatus status2 = base.m_children[i].exec(pAgent);
                        if (status2 == EBTStatus.BT_RUNNING)
                        {
                            base.m_activeChildIndex = i;
                            return(status2);
                        }
                        base.m_activeChildIndex = -1;
                        return(status2);
                    }
                }
                return(EBTStatus.BT_FAILURE);
            }
Exemplo n.º 13
0
            protected override EBTStatus update(Agent pAgent, EBTStatus childStatus)
            {
                if (childStatus != EBTStatus.BT_RUNNING)
                {
                    return(childStatus);
                }
                if (this.m_activeChildIndex != -1)
                {
                    BehaviorTask behaviorTask = this.m_children[this.m_activeChildIndex];
                    return(behaviorTask.exec(pAgent));
                }
                int   num  = (int)FrameRandom.Random((uint)((ushort)this.m_totalSum));
                float num2 = 0f;

                for (int i = 0; i < this.m_children.Count; i++)
                {
                    int num3 = this.m_weightingMap.get_Item(i);
                    num2 += (float)num3;
                    if (num3 > 0 && num2 >= (float)num)
                    {
                        BehaviorTask behaviorTask2 = this.m_children[i];
                        EBTStatus    eBTStatus     = behaviorTask2.exec(pAgent);
                        if (eBTStatus == EBTStatus.BT_RUNNING)
                        {
                            this.m_activeChildIndex = i;
                        }
                        else
                        {
                            this.m_activeChildIndex = -1;
                        }
                        return(eBTStatus);
                    }
                }
                return(EBTStatus.BT_FAILURE);
            }
Exemplo n.º 14
0
        private void SpawnBullet(Action _action)
        {
            SkillUseContext refParamObject = _action.refParams.GetRefParamObject <SkillUseContext>("SkillContext");

            for (int i = 0; i < this.spawnMax; i++)
            {
                PoolObjHandle <BulletSkill> handle = this.skillControl.SpawnBullet(refParamObject, this.ActionName, this.bDeadRemove);
                VInt3 zero = VInt3.zero;
                if ((handle != 0) && (handle.handle.CurAction != null))
                {
                    int index = 0;
                    if (this.transArray.Length < 0)
                    {
                        zero = VInt3.zero;
                    }
                    else
                    {
                        if (this.bRandom)
                        {
                            index = FrameRandom.Random((uint)this.transArray.Length);
                        }
                        else
                        {
                            index = i % this.transArray.Length;
                        }
                        zero = this.transArray[index];
                    }
                    handle.handle.CurAction.refParams.SetRefParam("_BulletPos", zero);
                }
            }
        }
Exemplo n.º 15
0
        public bool GetRevivePosDir(ref ActorMeta actorMeta, bool bGiveBirth, out VInt3 outPosWorld, out VInt3 outDirWorld)
        {
            outPosWorld = VInt3.zero;
            outDirWorld = VInt3.forward;
            if (Singleton <GamePlayerCenter> .instance.GetPlayer(actorMeta.PlayerId) != null)
            {
                ListView <ReviveRegion> .Enumerator enumerator = this.reviveAreas.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    if ((enumerator.Current != null) && (actorMeta.ActorCamp == enumerator.Current.CampType))
                    {
                        int index = Singleton <ActorDataCenter> .instance.GetActorDataProvider(GameActorDataProviderType.ServerDataProvider).Fast_GetActorServerDataBornIndex(ref actorMeta);

                        Transform transform = enumerator.Current.transform;
                        if (!bGiveBirth)
                        {
                            uint length = (uint)enumerator.Current.SubRevivePlaces.Length;
                            if (!enumerator.Current.OnlyBirth)
                            {
                                length++;
                                int num3 = FrameRandom.Random(length);
                                if ((0 < num3) && (enumerator.Current.SubRevivePlaces[num3 - 1] != null))
                                {
                                    transform = enumerator.Current.SubRevivePlaces[num3 - 1].transform;
                                }
                            }
                            else if (length >= 1)
                            {
                                int num4 = FrameRandom.Random(length);
                                if (enumerator.Current.SubRevivePlaces[num4] != null)
                                {
                                    transform = enumerator.Current.SubRevivePlaces[num4].transform;
                                }
                            }
                        }
                        Transform child = null;
                        if (transform != null)
                        {
                            if (index < transform.childCount)
                            {
                                child = transform.GetChild(index);
                            }
                            else
                            {
                                child = transform;
                            }
                        }
                        if (child != null)
                        {
                            outPosWorld = (VInt3)child.position;
                            outDirWorld = (VInt3)child.forward;
                            return(true);
                        }
                    }
                }
            }
            return(false);
        }
Exemplo n.º 16
0
 public bool CheckTriggerRate(BuffSkill _buffSkill)
 {
     if (_buffSkill.cfgData.iTriggerRate > 0)
     {
         int num = (int)FrameRandom.Random(10000u);
         return(num < _buffSkill.cfgData.iTriggerRate);
     }
     return(true);
 }
Exemplo n.º 17
0
        private void RandomFindTarget(List <PoolObjHandle <ActorRoot> > _srcList, int _count)
        {
            ushort num = FrameRandom.Random((uint)_srcList.Count);

            for (int i = 0; i < _count; i++)
            {
                this.triggerPriority.Add(_srcList[num]);
                num = (ushort)(num + 1);
                num = (ushort)(num % ((ushort)_srcList.Count));
            }
        }
        private void RandomFindTarget(List <PoolObjHandle <ActorRoot> > _srcList, int _count)
        {
            ushort num = FrameRandom.Random((uint)_srcList.get_Count());

            for (int i = 0; i < _count; i++)
            {
                this.triggerPriority.Add(_srcList.get_Item((int)num));
                num += 1;
                num %= (ushort)_srcList.get_Count();
            }
        }
Exemplo n.º 19
0
 public static int GetRandomValue(CMethodBase method, Agent pAgent)
 {
     if (method != null)
     {
         ParentType parentType = method.GetParentType();
         Agent      parent     = pAgent;
         if (parentType == ParentType.PT_INSTANCE)
         {
             parent = Agent.GetInstance(method.GetInstanceNameString(), parent.GetContextId());
         }
         return((int)method.run(parent, pAgent));
     }
     return(FrameRandom.Random(RandomMax));
 }
Exemplo n.º 20
0
        public void MakeDropItemIfNeed(MonsterWrapper InMonster, ObjWrapper InTarget)
        {
            DebugHelper.Assert(InMonster != null);
            ResMonsterCfgInfo cfgInfo = InMonster.cfgInfo;

            if ((cfgInfo != null) && (cfgInfo.iBufDropID != 0))
            {
                this.MonsterRef = InMonster;
                if (FrameRandom.Random(0x2710) < cfgInfo.iBufDropRate)
                {
                    this.SpawnBuf(cfgInfo.iBufDropID);
                }
            }
        }
Exemplo n.º 21
0
 public override void UpdateLogic(int _delta)
 {
     base.UpdateLogic(_delta);
     if (base.Fit())
     {
         if (FrameRandom.Random(0x2710) < this.randomRate)
         {
             base.Trigger();
         }
         base.Reset();
     }
     else
     {
         base.Reset();
     }
 }
Exemplo n.º 22
0
 public void AutoLearnTalent(PoolObjHandle <ActorRoot> hero, int level)
 {
     if (hero.handle.ActorAgent.IsAutoAI())
     {
         int          bID  = 0;
         bool         flag = false;
         int          num2 = 0;
         ResTalentLib lib  = null;
         for (int i = 0; i < this.m_talentRuleList.Count; i++)
         {
             if (this.m_talentRuleList[i].bSoulRequestValue == level)
             {
                 bID  = this.m_talentRuleList[i].bID;
                 flag = true;
                 break;
             }
         }
         if (flag)
         {
             ResTalentHero dataByKey = GameDataMgr.talentHero.GetDataByKey((uint)hero.handle.TheActorMeta.ConfigId);
             if (dataByKey != null)
             {
                 num2 = FrameRandom.Random(2);
                 if (bID == 2)
                 {
                     lib = GameDataMgr.talentLib.GetDataByKey(dataByKey.astTalentList[bID - 1].dwLvl1ID);
                 }
                 else if ((bID >= 1) && (bID <= dataByKey.astTalentList.Length))
                 {
                     if (num2 == 0)
                     {
                         lib = GameDataMgr.talentLib.GetDataByKey(dataByKey.astTalentList[bID - 1].dwLvl1ID);
                     }
                     else
                     {
                         lib = GameDataMgr.talentLib.GetDataByKey(dataByKey.astTalentList[bID - 1].dwLvl2ID);
                     }
                 }
                 if (lib != null)
                 {
                     this.DirectLearnTalentCommand(hero, lib.dwID, (sbyte)(bID - 1));
                 }
             }
         }
     }
 }
        private void SpawnBuf(int BufID)
        {
            ResBufDropInfo dataByKey = GameDataMgr.bufDropInfoDatabin.GetDataByKey((uint)BufID);

            DebugHelper.Assert(dataByKey != null, "找不到Buf,id={0}", new object[]
            {
                BufID
            });
            if (dataByKey == null)
            {
                return;
            }
            int  num  = 0;
            uint num2 = 0u;

            for (int i = 0; i < 10; i++)
            {
                if (dataByKey.astBufs[i].dwBufID == 0u)
                {
                    break;
                }
                num++;
                num2 += dataByKey.astBufs[i].dwProbability;
            }
            if (num <= 0)
            {
                return;
            }
            int num3 = (int)FrameRandom.Random(num2);
            ResBufConfigInfo resBufConfigInfo = null;

            for (int j = 0; j < num; j++)
            {
                if ((long)num3 < (long)((ulong)dataByKey.astBufs[j].dwProbability))
                {
                    resBufConfigInfo = dataByKey.astBufs[j];
                    break;
                }
                num3 -= (int)dataByKey.astBufs[j].dwProbability;
            }
            DebugHelper.Assert(resBufConfigInfo != null);
            SimpleParabolaEffect inDropdownEffect = new SimpleParabolaEffect(this.MonsterRef.actor.location, this.TraceOnTerrain(this.MonsterRef.actor.location));
            PickupBufEffect      inPickupEffect   = new PickupBufEffect(resBufConfigInfo);

            Singleton <DropItemMgr> .instance.CreateItem(Utility.UTF8Convert(resBufConfigInfo.szPrefab), inDropdownEffect, inPickupEffect);
        }
        public void MakeDropItemIfNeed(MonsterWrapper InMonster, ObjWrapper InTarget)
        {
            DebugHelper.Assert(InMonster != null);
            ResMonsterCfgInfo cfgInfo = InMonster.cfgInfo;

            if (cfgInfo == null || cfgInfo.iBufDropID == 0)
            {
                return;
            }
            this.MonsterRef = InMonster;
            ushort num = FrameRandom.Random(10000u);

            if ((int)num < cfgInfo.iBufDropRate)
            {
                this.SpawnBuf(cfgInfo.iBufDropID);
            }
        }
Exemplo n.º 25
0
 public override void UpdateLogic(int _delta)
 {
     base.UpdateLogic(_delta);
     if (base.Fit())
     {
         int num = (int)FrameRandom.Random(10000u);
         if (num < this.randomRate)
         {
             base.Trigger();
         }
         base.Reset();
     }
     else
     {
         base.Reset();
     }
 }
Exemplo n.º 26
0
        public void CreateImposterActor()
        {
            List <Player> diffCampPlayers = Singleton <GamePlayerCenter> .GetInstance().GetDiffCampPlayers(this.actorPtr.handle.TheActorMeta.ActorCamp);

            int count = diffCampPlayers.get_Count();

            if (count > 0)
            {
                int    num    = (int)FrameRandom.Random((uint)count);
                Player player = diffCampPlayers.get_Item(num);
                if (player.Captain)
                {
                    this.imposterActor = player.Captain;
                    return;
                }
            }
            this.imposterActor = this.actorPtr;
        }
Exemplo n.º 27
0
        public int TakeBouncesDamage(ref HurtDataInfo hurt)
        {
            int num  = this.CriticalDamagePart(ref hurt);
            int num2 = (int)(9900 + FrameRandom.Random(200u));

            this.actor.BuffHolderComp.OnDamageExtraValueEffect(ref hurt, hurt.atker, hurt.atkSlot);
            if (this.ImmuneDamage(ref hurt) || this.actor.BuffHolderComp.BuffImmuneDamage(ref hurt))
            {
                return(0);
            }
            bool flag    = hurt.atker && hurt.atker.handle.bOneKiller;
            int  actorHp = this.actor.ValueComponent.actorHp;
            int  num3    = this.CommonDamagePart(ref hurt) * (10000 - this.ReduceDamagePart(ref hurt, hurt.hurtType)) / 10000 * (10000 + num) / 10000 - this.actor.ValueComponent.mActorValue[RES_FUNCEFT_TYPE.RES_FUNCEFT_REALHURTLESS].totalValue;

            num3 = num3 * (10000 - this.actor.ValueComponent.mActorValue[RES_FUNCEFT_TYPE.RES_PROPERTY_HURTREDUCERATE].totalValue) / 10000;
            if (num3 < 0)
            {
                num3 = 0;
            }
            if (hurt.atker)
            {
                num3 = num3 * Singleton <BattleLogic> .GetInstance().clashAddition.CalcDamageAddition(hurt.atker.handle.TheStaticData.TheBaseAttribute.ClashMark, this.actor.TheStaticData.TheBaseAttribute.ClashMark) / 10000;
            }
            num3 = this.actor.BuffHolderComp.OnDamage(ref hurt, num3);
            int num4 = this.actor.ValueComponent.actorHp;

            this.actor.ValueComponent.actorHp -= num3;
            num4 = this.actor.ValueComponent.actorHp - num4;
            if (flag)
            {
                this.actor.ValueComponent.actorHp = 0;
                num4 = actorHp * -1;
            }
            if (hurt.atker && this.actor.TheActorMeta.ActorCamp != hurt.atker.handle.TheActorMeta.ActorCamp && this.actor.ValueComponent.actorHp > 0)
            {
                this.actor.ActorControl.AddHurtSelfActor(hurt.atker);
            }
            HurtEventResultInfo hurtEventResultInfo = new HurtEventResultInfo(base.GetActor(), hurt.atker, hurt, num3, num4, num);

            Singleton <GameEventSys> .instance.SendEvent <HurtEventResultInfo>(GameEventDef.Event_ActorDamage, ref hurtEventResultInfo);

            return(num4);
        }
            public static int GetRandomValue(CMethodBase method, Agent pAgent)
            {
                int result;

                if (method != null)
                {
                    ParentType parentType = method.GetParentType();
                    Agent      agent      = pAgent;
                    if (parentType == ParentType.PT_INSTANCE)
                    {
                        agent = Agent.GetInstance(method.GetInstanceNameString(), agent.GetContextId());
                    }
                    result = (int)method.run(agent, pAgent);
                }
                else
                {
                    result = (int)FrameRandom.Random(CompositeStochastic.CompositeStochasticTask.RandomMax);
                }
                return(result);
            }
        protected override void OnDead()
        {
            if (this.cfgInfo.iBufDropID != 0 && (int)FrameRandom.Random(10000u) < this.cfgInfo.iBufDropRate)
            {
                Singleton <ShenFuSystem> .GetInstance().CreateShenFuOnMonsterDead(this.actorPtr, (uint)this.cfgInfo.iBufDropID);
            }
            if (this.isCalledMonster)
            {
                this.RemoveCheckDistanceTimer();
            }
            if (this.actorSubSoliderType == 8 && this.myLastAtker)
            {
                COM_PLAYERCAMP actorCamp = this.myLastAtker.handle.TheActorMeta.ActorCamp;
                int            num       = (actorCamp == COM_PLAYERCAMP.COM_PLAYERCAMP_1) ? this.cfgInfo.iKillByCamp1ChangeSoldierWave : this.cfgInfo.iKillByCamp2ChangeSoldierWave;
                if (num > 0)
                {
                    ListView <SoldierRegion> soldierRegionsByCamp = Singleton <BattleLogic> .GetInstance().mapLogic.GetSoldierRegionsByCamp(actorCamp);

                    for (int i = 0; i < soldierRegionsByCamp.Count; i++)
                    {
                        soldierRegionsByCamp[i].SwitchWave(num, true);
                    }
                }
            }
            base.OnDead();
            bool flag = true;

            if (flag)
            {
                Singleton <GameObjMgr> .instance.RecycleActor(this.actorPtr, this.cfgInfo.iRecyleTime);
            }
            if (this.isCalledMonster && this.suicideWhenHostDead)
            {
                this.HostActor.handle.ActorControl.eventActorDead -= new ActorDeadEventHandler(this.OnActorDead);
            }
            if (this.actor.HorizonMarker != null)
            {
                this.actor.HorizonMarker.SetTranslucentMark(HorizonConfig.HideMark.Skill, false, false);
                this.actor.HorizonMarker.SetTranslucentMark(HorizonConfig.HideMark.Jungle, false, false);
            }
        }
Exemplo n.º 30
0
 public override void NotifyDropEvent(PoolObjHandle <ActorRoot> actor)
 {
     DebugHelper.Assert((bool)actor);
     if (actor.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Organ)
     {
         ResOrganCfgInfo dataCfgInfoByCurLevelDiff = OrganDataHelper.GetDataCfgInfoByCurLevelDiff(actor.handle.TheActorMeta.ConfigId);
         object[]        inParameters = new object[] { actor.handle.TheActorMeta.ConfigId };
         DebugHelper.Assert(dataCfgInfoByCurLevelDiff != null, "can't find organ config, id={0}", inParameters);
         if (dataCfgInfoByCurLevelDiff != null)
         {
             if (dataCfgInfoByCurLevelDiff.bOrganType == 2)
             {
                 this.FinishDrop();
             }
             else if (this.hasRemain && (FrameRandom.Random(100) <= MonoSingleton <GlobalConfig> .instance.OrganDropItemProbability))
             {
                 this.PlayDrop();
             }
         }
     }
 }