Beispiel #1
0
        private void AddBuffsOnSpawn(SmartEntity target)
        {
            if (target.TroopComp == null)
            {
                return;
            }
            string[] spawnApplyBuffs = target.TroopComp.TroopType.SpawnApplyBuffs;
            if (spawnApplyBuffs == null || spawnApplyBuffs.Length == 0)
            {
                return;
            }
            ArmorType armorType = BuffController.DeduceArmorType(target);

            if (armorType == ArmorType.Invalid)
            {
                return;
            }
            IDataController dataController = Service.Get <IDataController>();
            int             i   = 0;
            int             num = spawnApplyBuffs.Length;

            while (i < num)
            {
                BuffTypeVO buffTypeVO = dataController.Get <BuffTypeVO>(spawnApplyBuffs[i]);
                if (buffTypeVO.ApplyToSelf)
                {
                    this.TryAddBuffStack(target, buffTypeVO, armorType, BuffVisualPriority.Default);
                }
                i++;
            }
        }
Beispiel #2
0
        private void ApplyBuffFromBullet(Bullet bullet)
        {
            SmartEntity      target         = bullet.Target;
            ProjectileTypeVO projectileType = bullet.ProjectileType;

            if (target == null || target.TeamComp == null || projectileType == null)
            {
                return;
            }
            if (target.HealthComp == null || target.HealthComp.IsDead())
            {
                return;
            }
            string[] applyBuffs = projectileType.ApplyBuffs;
            if (applyBuffs == null || applyBuffs.Length == 0)
            {
                return;
            }
            ArmorType armorType = BuffController.DeduceArmorType(target);

            if (armorType == ArmorType.Invalid)
            {
                return;
            }
            bool            flag           = bullet.Owner == target;
            bool            flag2          = !flag && bullet.OwnerTeam == target.TeamComp.TeamType;
            IDataController dataController = Service.Get <IDataController>();
            int             i   = 0;
            int             num = applyBuffs.Length;

            while (i < num)
            {
                BuffTypeVO buffTypeVO = dataController.Get <BuffTypeVO>(applyBuffs[i]);
                if (flag)
                {
                    if (buffTypeVO.ApplyToSelf)
                    {
                        goto IL_B9;
                    }
                }
                else if (flag2)
                {
                    if (buffTypeVO.ApplyToAllies)
                    {
                        goto IL_B9;
                    }
                }
                else if (buffTypeVO.ApplyToEnemies)
                {
                    goto IL_B9;
                }
IL_C4:
                i++;
                continue;
IL_B9:
                this.TryAddBuffStack(target, buffTypeVO, armorType, BuffVisualPriority.Default);
                goto IL_C4;
            }
        }
Beispiel #3
0
        private void AddMaxHealthWarBuff(SmartEntity entity, WarBuffVO warBuffVO)
        {
            IDataController   dataController = Service.Get <IDataController>();
            BuildingComponent buildingComp   = entity.BuildingComp;

            if (buildingComp == null)
            {
                return;
            }
            bool            flag       = buildingComp.BuildingType.Type == BuildingType.HQ || buildingComp.BuildingType.Type == BuildingType.Wall;
            HealthComponent healthComp = entity.HealthComp;

            if (flag && healthComp != null)
            {
                BuffTypeVO buffType = dataController.Get <BuffTypeVO>(warBuffVO.BuildingBuffUid);
                this.TryAddBuffStack(entity, buffType, BuffController.DeduceArmorType(entity), BuffVisualPriority.SquadWars);
            }
        }
Beispiel #4
0
        private void ApplyBuildingEquipmentBuffs(SmartEntity entity)
        {
            if (entity.TeamComp == null || entity.BuildingComp == null)
            {
                return;
            }
            IDataController          dataController        = Service.Get <IDataController>();
            List <EquipmentEffectVO> equipmentBuffsForTeam = this.GetEquipmentBuffsForTeam(entity.TeamComp.TeamType);
            int num = (equipmentBuffsForTeam != null) ? equipmentBuffsForTeam.Count : 0;

            for (int i = 0; i < num; i++)
            {
                EquipmentEffectVO equipmentEffectVO = equipmentBuffsForTeam[i];
                if (equipmentEffectVO.BuffUids != null && equipmentEffectVO.AffectedBuildingIds != null)
                {
                    string buildingID = entity.BuildingComp.BuildingType.BuildingID;
                    int    j          = 0;
                    int    num2       = equipmentEffectVO.AffectedBuildingIds.Length;
                    while (j < num2)
                    {
                        if (equipmentEffectVO.AffectedBuildingIds[j] == buildingID)
                        {
                            int k    = 0;
                            int num3 = equipmentEffectVO.BuffUids.Length;
                            while (k < num3)
                            {
                                BuffTypeVO buffType = dataController.Get <BuffTypeVO>(equipmentEffectVO.BuffUids[k]);
                                this.TryAddBuffStack(entity, buffType, BuffController.DeduceArmorType(entity), BuffVisualPriority.Equipment);
                                k++;
                            }
                            break;
                        }
                        j++;
                    }
                }
            }
        }
Beispiel #5
0
 public unsafe static long $Invoke23(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(BuffController.DeduceArmorType((SmartEntity)GCHandledObjects.GCHandleToObject(*args))));
 }