示例#1
0
        private void AddDamageValue(ref PoolObjHandle <ActorRoot> actor, SkillSlotType slotType, int iValue, HurtTypeDef hurtType)
        {
            if (this.m_listDamageActorValue != null && slotType <= SkillSlotType.SLOT_SKILL_VALID && actor)
            {
                uint objID = actor.get_handle().ObjID;
                this.DeleteTimeoutDamageValue(objID, 0uL);
                DAMAGE_ACTOR_INFO dAMAGE_ACTOR_INFO;
                if (!this.m_listDamageActorValue.TryGetValue(objID, ref dAMAGE_ACTOR_INFO))
                {
                    dAMAGE_ACTOR_INFO           = default(DAMAGE_ACTOR_INFO);
                    dAMAGE_ACTOR_INFO.actorType = actor.get_handle().TheActorMeta.ActorType;
                    dAMAGE_ACTOR_INFO.actorName = actor.get_handle().name;
                    dAMAGE_ACTOR_INFO.ConfigId  = actor.get_handle().TheActorMeta.ConfigId;
                    if (dAMAGE_ACTOR_INFO.actorType == ActorTypeDef.Actor_Type_Monster)
                    {
                        MonsterWrapper monsterWrapper = actor.get_handle().AsMonster();
                        dAMAGE_ACTOR_INFO.bMonsterType = monsterWrapper.GetActorSubType();
                        dAMAGE_ACTOR_INFO.actorSubType = monsterWrapper.GetActorSubSoliderType();
                    }
                    Player player = Singleton <GamePlayerCenter> .get_instance().GetPlayer(actor.get_handle().TheActorMeta.PlayerId);

                    if (player != null)
                    {
                        dAMAGE_ACTOR_INFO.playerName = player.Name;
                    }
                    dAMAGE_ACTOR_INFO.listDamage = new SortedList <ulong, DOUBLE_INT_INFO[]>();
                    this.m_listDamageActorValue.Add(objID, dAMAGE_ACTOR_INFO);
                }
                ulong logicFrameTick = Singleton <FrameSynchr> .get_instance().LogicFrameTick;

                DOUBLE_INT_INFO[] array;
                if (!dAMAGE_ACTOR_INFO.listDamage.TryGetValue(logicFrameTick, ref array))
                {
                    array = new DOUBLE_INT_INFO[12];
                    dAMAGE_ACTOR_INFO.listDamage.Add(logicFrameTick, array);
                }
                if (array[(int)slotType].iValue == 0)
                {
                    array[(int)slotType].iKey = (int)hurtType;
                }
                DOUBLE_INT_INFO[] expr_170_cp_0 = array;
                expr_170_cp_0[(int)slotType].iValue = expr_170_cp_0[(int)slotType].iValue + iValue;
                dAMAGE_ACTOR_INFO.listDamage.set_Item(logicFrameTick, array);
                this.m_listDamageActorValue.set_Item(objID, dAMAGE_ACTOR_INFO);
            }
        }
        private void AddDamageValue(ref HurtEventResultInfo prm)
        {
            PoolObjHandle <ActorRoot> atker   = prm.atker;
            SkillSlotType             atkSlot = prm.hurtInfo.atkSlot;
            int                 hurtTotal     = prm.hurtTotal;
            HurtTypeDef         hurtType      = prm.hurtInfo.hurtType;
            SKILL_USE_FROM_TYPE skillUseFrom  = prm.hurtInfo.SkillUseFrom;

            if (this.m_listDamageActorValue != null && atkSlot <= SkillSlotType.SLOT_SKILL_VALID && atker)
            {
                uint objID = atker.handle.ObjID;
                this.DeleteTimeoutDamageValue(objID, 0uL);
                DAMAGE_ACTOR_INFO dAMAGE_ACTOR_INFO;
                if (!this.m_listDamageActorValue.TryGetValue(objID, ref dAMAGE_ACTOR_INFO))
                {
                    dAMAGE_ACTOR_INFO           = default(DAMAGE_ACTOR_INFO);
                    dAMAGE_ACTOR_INFO.actorType = atker.handle.TheActorMeta.ActorType;
                    dAMAGE_ACTOR_INFO.actorName = atker.handle.name;
                    dAMAGE_ACTOR_INFO.ConfigId  = atker.handle.TheActorMeta.ConfigId;
                    if (dAMAGE_ACTOR_INFO.actorType == ActorTypeDef.Actor_Type_Monster)
                    {
                        MonsterWrapper monsterWrapper = atker.handle.AsMonster();
                        dAMAGE_ACTOR_INFO.bMonsterType = monsterWrapper.GetActorSubType();
                        dAMAGE_ACTOR_INFO.actorSubType = monsterWrapper.GetActorSubSoliderType();
                    }
                    Player player = Singleton <GamePlayerCenter> .instance.GetPlayer(atker.handle.TheActorMeta.PlayerId);

                    if (player != null)
                    {
                        dAMAGE_ACTOR_INFO.playerName = player.Name;
                    }
                    dAMAGE_ACTOR_INFO.listDamage = new SortedList <ulong, SKILL_SLOT_HURT_INFO[]>();
                    this.m_listDamageActorValue.Add(objID, dAMAGE_ACTOR_INFO);
                }
                ulong logicFrameTick = Singleton <FrameSynchr> .instance.LogicFrameTick;
                SKILL_SLOT_HURT_INFO[] array;
                if (!dAMAGE_ACTOR_INFO.listDamage.TryGetValue(logicFrameTick, ref array))
                {
                    array = new SKILL_SLOT_HURT_INFO[12];
                    dAMAGE_ACTOR_INFO.listDamage.Add(logicFrameTick, array);
                }
                if (array[(int)atkSlot].listHurtInfo == null)
                {
                    array[(int)atkSlot].listHurtInfo = new List <HURT_INFO>();
                }
                if (array[(int)atkSlot].listHurtInfo != null)
                {
                    string text    = null;
                    string strName = null;
                    if (skillUseFrom == SKILL_USE_FROM_TYPE.SKILL_USE_FROM_TYPE_SKILL)
                    {
                        SkillSlot skillSlot;
                        if (atkSlot < SkillSlotType.SLOT_SKILL_COUNT && atker.handle.SkillControl != null && (atker.handle.TheActorMeta.ActorType != ActorTypeDef.Actor_Type_Hero || atkSlot != SkillSlotType.SLOT_SKILL_0) && atker.handle.SkillControl.TryGetSkillSlot(atkSlot, out skillSlot) && skillSlot.SkillObj != null && skillSlot.SkillObj.cfgData != null)
                        {
                            if (!string.IsNullOrEmpty(skillSlot.SkillObj.IconName))
                            {
                                text = skillSlot.SkillObj.IconName;
                            }
                            if (!string.IsNullOrEmpty(skillSlot.SkillObj.cfgData.szSkillName))
                            {
                                strName = skillSlot.SkillObj.cfgData.szSkillName;
                            }
                        }
                    }
                    else if (skillUseFrom == SKILL_USE_FROM_TYPE.SKILL_USE_FROM_TYPE_EQUIP)
                    {
                        uint             uiFromId  = prm.hurtInfo.uiFromId;
                        ResEquipInBattle dataByKey = GameDataMgr.m_equipInBattleDatabin.GetDataByKey(uiFromId);
                        if (dataByKey != null)
                        {
                            text    = dataByKey.szIcon;
                            strName = dataByKey.szName;
                        }
                    }
                    else if (skillUseFrom == SKILL_USE_FROM_TYPE.SKILL_USE_FROM_TYPE_AREATRIGGER)
                    {
                        uint uiFromId2 = prm.hurtInfo.uiFromId;
                        ResSkillCombineCfgInfo dataByKey2 = GameDataMgr.skillCombineDatabin.GetDataByKey(uiFromId2);
                        if (dataByKey2 != null)
                        {
                            text    = dataByKey2.szIconPath;
                            strName = dataByKey2.szSkillCombineName;
                        }
                    }
                    int count = array[(int)atkSlot].listHurtInfo.get_Count();
                    int i;
                    for (i = 0; i < count; i++)
                    {
                        if (array[(int)atkSlot].listHurtInfo.get_Item(i).strIconName == text)
                        {
                            HURT_INFO hURT_INFO;
                            array[(int)atkSlot].listHurtInfo.get_Item(i).iValue = hURT_INFO.iValue + hurtTotal;
                            break;
                        }
                    }
                    if (i >= count)
                    {
                        HURT_INFO hURT_INFO2 = new HURT_INFO(hurtType, text, strName, hurtTotal, skillUseFrom);
                        array[(int)atkSlot].listHurtInfo.Add(hURT_INFO2);
                    }
                }
                dAMAGE_ACTOR_INFO.listDamage.set_Item(logicFrameTick, array);
                this.m_listDamageActorValue.set_Item(objID, dAMAGE_ACTOR_INFO);
            }
        }
        private void OnActorDeadIncomeGoldCoinInBattle(ref PoolObjHandle <ActorRoot> target, ref PoolObjHandle <ActorRoot> attacker)
        {
            if (!target || !attacker)
            {
                return;
            }
            if (ActorHelper.IsHostCtrlActor(ref attacker) && (target.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Monster || target.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero))
            {
                if (attacker.handle.EffectControl != null)
                {
                    attacker.handle.EffectControl.PlayDyingGoldEffect(target);
                }
                Singleton <CSoundManager> .GetInstance().PlayBattleSound("Glod_Get", target, target.handle.gameObject);
            }
            ResIncomeAllocRule resIncomeAllocRule = null;

            switch (target.handle.TheActorMeta.ActorType)
            {
            case ActorTypeDef.Actor_Type_Hero:
                resIncomeAllocRule = this.m_incomeAllocRules[2][3];
                break;

            case ActorTypeDef.Actor_Type_Monster:
            {
                MonsterWrapper monsterWrapper = target.handle.AsMonster();
                if (monsterWrapper != null)
                {
                    RES_MONSTER_TYPE bMonsterType = (RES_MONSTER_TYPE)monsterWrapper.cfgInfo.bMonsterType;
                    if (bMonsterType == RES_MONSTER_TYPE.RES_MONSTER_TYPE_JUNGLE)
                    {
                        byte actorSubSoliderType = monsterWrapper.GetActorSubSoliderType();
                        if (actorSubSoliderType == 7 || actorSubSoliderType == 8 || actorSubSoliderType == 9)
                        {
                            resIncomeAllocRule = this.m_incomeAllocRules[2][5];
                        }
                        else if (actorSubSoliderType == 15)
                        {
                            resIncomeAllocRule = this.m_incomeAllocRules[2][7];
                        }
                        else
                        {
                            resIncomeAllocRule = this.m_incomeAllocRules[2][4];
                        }
                    }
                    else if (bMonsterType == RES_MONSTER_TYPE.RES_MONSTER_TYPE_SOLDIERLINE)
                    {
                        resIncomeAllocRule = this.m_incomeAllocRules[2][2];
                    }
                }
                break;
            }

            case ActorTypeDef.Actor_Type_Organ:
                resIncomeAllocRule = this.m_incomeAllocRules[2][1];
                break;

            case ActorTypeDef.Actor_Type_EYE:
                resIncomeAllocRule = this.m_incomeAllocRules[2][6];
                break;
            }
            if (resIncomeAllocRule != null)
            {
                ResDT_IncomeAttackRule incomeAllocRuleByAtker = this.GetIncomeAllocRuleByAtker(ref attacker, resIncomeAllocRule);
                if (incomeAllocRuleByAtker != null)
                {
                    this.AllocIncome(ref target, ref attacker, incomeAllocRuleByAtker, enIncomeType.GoldCoinInBattle, resIncomeAllocRule.IncomeChangeRate, resIncomeAllocRule.iComputerChangeRate);
                }
            }
        }
        private void OnActorDeadIncomeSoul(ref PoolObjHandle <ActorRoot> target, ref PoolObjHandle <ActorRoot> attacker)
        {
            if (!target || !attacker)
            {
                return;
            }
            ResIncomeAllocRule resIncomeAllocRule = null;

            switch (target.handle.TheActorMeta.ActorType)
            {
            case ActorTypeDef.Actor_Type_Hero:
                resIncomeAllocRule = this.m_incomeAllocRules[1][3];
                break;

            case ActorTypeDef.Actor_Type_Monster:
            {
                MonsterWrapper monsterWrapper = target.handle.AsMonster();
                if (monsterWrapper != null)
                {
                    RES_MONSTER_TYPE bMonsterType = (RES_MONSTER_TYPE)monsterWrapper.cfgInfo.bMonsterType;
                    if (bMonsterType == RES_MONSTER_TYPE.RES_MONSTER_TYPE_JUNGLE)
                    {
                        byte actorSubSoliderType = monsterWrapper.GetActorSubSoliderType();
                        if (actorSubSoliderType == 7 || actorSubSoliderType == 8 || actorSubSoliderType == 9)
                        {
                            resIncomeAllocRule = this.m_incomeAllocRules[1][5];
                        }
                        else if (actorSubSoliderType == 15)
                        {
                            resIncomeAllocRule = this.m_incomeAllocRules[1][7];
                        }
                        else
                        {
                            resIncomeAllocRule = this.m_incomeAllocRules[1][4];
                        }
                    }
                    else if (bMonsterType == RES_MONSTER_TYPE.RES_MONSTER_TYPE_SOLDIERLINE)
                    {
                        resIncomeAllocRule = this.m_incomeAllocRules[1][2];
                    }
                }
                break;
            }

            case ActorTypeDef.Actor_Type_Organ:
                resIncomeAllocRule = this.m_incomeAllocRules[1][1];
                break;

            case ActorTypeDef.Actor_Type_EYE:
                resIncomeAllocRule = this.m_incomeAllocRules[1][6];
                break;
            }
            if (resIncomeAllocRule != null)
            {
                ResDT_IncomeAttackRule incomeAllocRuleByAtker = this.GetIncomeAllocRuleByAtker(ref attacker, resIncomeAllocRule);
                if (incomeAllocRuleByAtker != null)
                {
                    this.AllocIncome(ref target, ref attacker, incomeAllocRuleByAtker, enIncomeType.Soul, resIncomeAllocRule.IncomeChangeRate, resIncomeAllocRule.iComputerChangeRate);
                }
            }
        }
        private bool CheckTargetFromEnemy(PoolObjHandle <ActorRoot> src, PoolObjHandle <ActorRoot> target)
        {
            bool result = false;

            if (!src || !target)
            {
                return(result);
            }
            if (src.get_handle().TheActorMeta.ActorType != ActorTypeDef.Actor_Type_Hero)
            {
                return(result);
            }
            if (target.get_handle().TheActorMeta.ActorType != ActorTypeDef.Actor_Type_Monster)
            {
                return(src.get_handle().TheActorMeta.ActorCamp != target.get_handle().TheActorMeta.ActorCamp);
            }
            MonsterWrapper monsterWrapper = target.get_handle().AsMonster();

            if (monsterWrapper != null)
            {
                RES_MONSTER_TYPE bMonsterType = monsterWrapper.cfgInfo.bMonsterType;
                if (bMonsterType == 1)
                {
                    if (src.get_handle().TheActorMeta.ActorCamp != target.get_handle().TheActorMeta.ActorCamp)
                    {
                        result = true;
                    }
                }
                else if (bMonsterType == 2)
                {
                    byte actorSubSoliderType = monsterWrapper.GetActorSubSoliderType();
                    if (actorSubSoliderType != 8 && actorSubSoliderType != 9 && actorSubSoliderType != 7 && actorSubSoliderType != 14)
                    {
                        long  num     = 0L;
                        long  num2    = 0L;
                        VInt3 bornPos = target.get_handle().BornPos;
                        List <PoolObjHandle <ActorRoot> > organActors = Singleton <GameObjMgr> .get_instance().OrganActors;

                        int num3 = 0;
                        for (int i = 0; i < organActors.get_Count(); i++)
                        {
                            PoolObjHandle <ActorRoot> poolObjHandle = organActors.get_Item(i);
                            if (poolObjHandle.get_handle().TheStaticData.TheOrganOnlyInfo.OrganType == 2)
                            {
                                VInt3 location = poolObjHandle.get_handle().location;
                                if (poolObjHandle.get_handle().TheActorMeta.ActorCamp == src.get_handle().TheActorMeta.ActorCamp)
                                {
                                    num = (bornPos - location).get_sqrMagnitudeLong2D();
                                }
                                else
                                {
                                    num2 = (bornPos - location).get_sqrMagnitudeLong2D();
                                }
                                num3++;
                                if (num3 >= 2)
                                {
                                    break;
                                }
                            }
                        }
                        if (num > num2)
                        {
                            result = true;
                        }
                    }
                }
            }
            return(result);
        }
示例#6
0
        private bool CheckTargetFromEnemy(PoolObjHandle <ActorRoot> src, PoolObjHandle <ActorRoot> target)
        {
            bool flag = false;

            if ((src != 0) && (target != 0))
            {
                float num2;
                float num3;
                if (src.handle.TheActorMeta.ActorType != ActorTypeDef.Actor_Type_Hero)
                {
                    return(flag);
                }
                if (target.handle.TheActorMeta.ActorType != ActorTypeDef.Actor_Type_Monster)
                {
                    return(ActorHelper.IsHostEnemyActor(ref target));
                }
                MonsterWrapper wrapper = target.handle.AsMonster();
                if (wrapper == null)
                {
                    return(flag);
                }
                RES_MONSTER_TYPE bMonsterType = (RES_MONSTER_TYPE)wrapper.cfgInfo.bMonsterType;
                if (bMonsterType == RES_MONSTER_TYPE.RES_MONSTER_TYPE_SOLDIERLINE)
                {
                    if (src.handle.TheActorMeta.ActorCamp != target.handle.TheActorMeta.ActorCamp)
                    {
                        flag = true;
                    }
                    return(flag);
                }
                if (bMonsterType != RES_MONSTER_TYPE.RES_MONSTER_TYPE_JUNGLE)
                {
                    return(flag);
                }
                switch (wrapper.GetActorSubSoliderType())
                {
                case 8:
                case 9:
                case 7:
                case 14:
                    return(flag);

                default:
                {
                    num2 = 0f;
                    num3 = 0f;
                    Vector3 position = target.handle.gameObject.transform.position;
                    List <PoolObjHandle <ActorRoot> > organActors = Singleton <GameObjMgr> .instance.OrganActors;
                    int num4 = 0;
                    for (int i = 0; i < organActors.Count; i++)
                    {
                        PoolObjHandle <ActorRoot> handle = organActors[i];
                        if (handle.handle.TheStaticData.TheOrganOnlyInfo.OrganType == 2)
                        {
                            Vector3 b = handle.handle.gameObject.transform.position;
                            if (handle.handle.TheActorMeta.ActorCamp == src.handle.TheActorMeta.ActorCamp)
                            {
                                num2 = Vector3.Distance(position, b);
                            }
                            else
                            {
                                num3 = Vector3.Distance(position, b);
                            }
                            num4++;
                            if (num4 >= 2)
                            {
                                break;
                            }
                        }
                    }
                    break;
                }
                }
                if (num2 > num3)
                {
                    flag = true;
                }
            }
            return(flag);
        }