Exemplo n.º 1
0
        public override IEnumerable <IEntity> EnumerateEntities(DynamicValueContext context)
        {
            DynamicValueFightContext dynamicValueFightContext = context as DynamicValueFightContext;

            if (dynamicValueFightContext == null)
            {
                return(Enumerable.Empty <IEntity>());
            }
            return(dynamicValueFightContext.fightStatus.EnumerateEntities());
        }
Exemplo n.º 2
0
        public IEnumerable <Coord> Filter(IEnumerable <Coord> coords, DynamicValueContext context)
        {
            DynamicValueFightContext dynamicValueFightContext = context as CastTargetContext;

            if (dynamicValueFightContext == null)
            {
                return(ICoordFilterExtension.empty);
            }
            return(Filter(coords, dynamicValueFightContext.fightStatus));
        }
Exemplo n.º 3
0
        public bool TryGetEntity <T>(DynamicValueContext context, out T entity) where T : class, IEntity
        {
            DynamicValueFightContext dynamicValueFightContext = context as DynamicValueFightContext;

            if (dynamicValueFightContext == null)
            {
                entity = null;
                return(false);
            }
            return(dynamicValueFightContext.fightStatus.TryGetEntity(dynamicValueFightContext.playerId, out entity));
        }
        public IEnumerable <Coord> EnumerateCoords(DynamicValueContext context)
        {
            DynamicValueFightContext dynamicValueFightContext = context as DynamicValueFightContext;

            if (dynamicValueFightContext != null)
            {
                IEnumerable <Coord> enumerable = dynamicValueFightContext.fightStatus.EnumerateCoords();
                int count = m_onlyIf.Count;
                for (int i = 0; i < count; i++)
                {
                    enumerable = m_onlyIf[i].Filter(enumerable, context);
                }
                return(enumerable);
            }
            return(Enumerable.Empty <Coord>());
        }
        public override IEnumerable <IEntity> EnumerateEntities(DynamicValueContext context)
        {
            DynamicValueFightContext dynamicValueFightContext = context as DynamicValueFightContext;

            if (dynamicValueFightContext != null)
            {
                IEnumerable <IEntity> enumerable = dynamicValueFightContext.fightStatus.EnumerateEntities();
                int count = m_filters.Count;
                for (int i = 0; i < count; i++)
                {
                    enumerable = m_filters[i].Filter(enumerable, context);
                }
                return(enumerable);
            }
            return(Enumerable.Empty <IEntity>());
        }
Exemplo n.º 6
0
        public IEnumerable <Coord> Filter(IEnumerable <Coord> coords, DynamicValueContext context)
        {
            DynamicValueFightContext dynamicValueFightContext = context as DynamicValueFightContext;

            if (dynamicValueFightContext != null && TryGetSrcEntityCoords(context, out Coord srcCoord))
            {
                FightStatus fightStatus = dynamicValueFightContext.fightStatus;
                foreach (Coord coord in coords)
                {
                    if (IsPathEmptyBetween(fightStatus, srcCoord, coord, context))
                    {
                        yield return(coord);
                    }
                }
            }
        }
Exemplo n.º 7
0
        public IEnumerable <IEntity> Filter(IEnumerable <IEntity> entities, DynamicValueContext context)
        {
            DynamicValueFightContext dynamicValueFightContext = context as DynamicValueFightContext;

            if (dynamicValueFightContext != null && TryGetSrcEntityCoords(context, out Coord srcCoord))
            {
                FightStatus fightStatus = dynamicValueFightContext.fightStatus;
                foreach (IEntity entity in entities)
                {
                    IEntityWithBoardPresence entityWithBoardPresence = entity as IEntityWithBoardPresence;
                    if (entityWithBoardPresence != null && IsPathEmptyBetween(dest: new Coord(entityWithBoardPresence.area.refCoord), fightStatus: fightStatus, src: srcCoord, context: context))
                    {
                        yield return(entityWithBoardPresence);
                    }
                }
            }
        }
Exemplo n.º 8
0
        public override bool GetValue(DynamicValueContext context, out int value)
        {
            DynamicValueFightContext dynamicValueFightContext = context as DynamicValueFightContext;

            if (dynamicValueFightContext != null)
            {
                IEnumerable <IEntity> enumerable = dynamicValueFightContext.fightStatus.EnumerateEntities();
                for (int i = 0; i < m_entityFilters.Count; i++)
                {
                    enumerable = m_entityFilters[i].Filter(enumerable, context);
                }
                value = enumerable.Count();
                return(true);
            }
            value = 0;
            return(false);
        }
Exemplo n.º 9
0
        public override bool GetValue(DynamicValueContext context, out int value)
        {
            DynamicValueFightContext dynamicValueFightContext = context as DynamicValueFightContext;

            if (dynamicValueFightContext != null)
            {
                IEnumerable <IEntity> entities = dynamicValueFightContext.fightStatus.EnumerateEntities <PlayerStatus>();
                int num = 0;
                foreach (IEntity item in m_player.Filter(entities, context))
                {
                    num += item.GetCarac(m_elementType);
                }
                value = num;
                return(true);
            }
            value = 0;
            return(false);
        }
        public override bool GetValue(DynamicValueContext context, out int value)
        {
            DynamicValueFightContext dynamicValueFightContext = context as DynamicValueFightContext;

            if (dynamicValueFightContext != null)
            {
                IEnumerable <IEntityWithBoardPresence> entities = dynamicValueFightContext.fightStatus.EnumerateEntities <IEntityWithBoardPresence>();
                int num = 0;
                foreach (IEntity item in m_entity.Filter(entities, context))
                {
                    num += item.GetCarac(m_carac);
                }
                value = num;
                return(true);
            }
            value = 0;
            return(false);
        }
        public bool TryGetEntity <T>(DynamicValueContext context, out T entity) where T : class, IEntity
        {
            DynamicValueFightContext dynamicValueFightContext = context as DynamicValueFightContext;

            if (dynamicValueFightContext != null)
            {
                foreach (T item in dynamicValueFightContext.fightStatus.EnumerateEntities <T>())
                {
                    CompanionStatus companionStatus = item as CompanionStatus;
                    if (companionStatus != null && companionStatus.ownerId == dynamicValueFightContext.playerId && companionStatus.definition.get_id() == m_companion.value)
                    {
                        entity = item;
                        return(true);
                    }
                }
            }
            entity = null;
            return(false);
        }
Exemplo n.º 12
0
        public override bool GetValue(DynamicValueContext context, out int value)
        {
            //IL_0030: Unknown result type (might be due to invalid IL or missing references)
            //IL_0035: Unknown result type (might be due to invalid IL or missing references)
            //IL_003c: Unknown result type (might be due to invalid IL or missing references)
            //IL_0041: Unknown result type (might be due to invalid IL or missing references)
            //IL_0044: Unknown result type (might be due to invalid IL or missing references)
            //IL_0045: Unknown result type (might be due to invalid IL or missing references)
            DynamicValueFightContext dynamicValueFightContext = context as DynamicValueFightContext;

            if (dynamicValueFightContext != null && m_start.TryGetEntity(context, out IEntityWithBoardPresence entity) && m_end.TryGetEntity(context, out IEntityWithBoardPresence entity2))
            {
                Vector2Int refCoord  = entity.area.refCoord;
                Vector2Int refCoord2 = entity2.area.refCoord;
                value = refCoord.DistanceTo(refCoord2);
                return(true);
            }
            value = 0;
            return(false);
        }
Exemplo n.º 13
0
        public override IEnumerable <IEntity> EnumerateEntities(DynamicValueContext context)
        {
            DynamicValueFightContext fightContext = context as DynamicValueFightContext;

            if (fightContext != null)
            {
                List <int> ownerIds = ListPool <int> .Get(2);

                foreach (IEntity item in m_selector.EnumerateEntities(context))
                {
                    IEntityWithOwner entityWithOwner = item as IEntityWithOwner;
                    if (entityWithOwner != null && !ownerIds.Contains(entityWithOwner.ownerId))
                    {
                        ownerIds.Add(entityWithOwner.ownerId);
                        if (fightContext.fightStatus.TryGetEntity(entityWithOwner.ownerId, out IEntity entityStatus))
                        {
                            yield return(entityStatus);
                        }
                    }
                }
                ListPool <int> .Release(ownerIds);
            }
        }
        public IEnumerable <Target> EnumerateTargets(DynamicValueContext context)
        {
            int casterId = -1;

            foreach (IEntity item in EnumerateEntities(context))
            {
                if (!item.HasProperty(PropertyId.Untargetable))
                {
                    yield return(new Target(item));
                }
                else
                {
                    if (casterId == -1)
                    {
                        casterId = 0;
                        DynamicValueFightContext dynamicValueFightContext = context as DynamicValueFightContext;
                        if (dynamicValueFightContext == null)
                        {
                            Log.Warning("Selector " + GetType().Name + " tried to retrieve caster but wasn't given a compatible context.", 47, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Data\\TargetSelectors\\ISelectorForCast.cs");
                            continue;
                        }
                        if (!dynamicValueFightContext.fightStatus.TryGetEntity(dynamicValueFightContext.playerId, out PlayerStatus entityStatus))
                        {
                            Log.Warning("Selector " + GetType().Name + " tried to retrieve caster but could not find it.", 41, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Data\\TargetSelectors\\ISelectorForCast.cs");
                            continue;
                        }
                        casterId = entityStatus.id;
                    }
                    IEntityWithOwner entityWithOwner = item as IEntityWithOwner;
                    if (entityWithOwner != null && entityWithOwner.ownerId == casterId)
                    {
                        yield return(new Target(item));
                    }
                }
            }
        }
Exemplo n.º 15
0
        public bool TryGetEntity <T>(DynamicValueContext context, out T entity) where T : class, IEntity
        {
            DynamicValueFightContext dynamicValueFightContext = context as DynamicValueFightContext;

            if (dynamicValueFightContext == null)
            {
                entity = null;
                return(false);
            }
            if (!dynamicValueFightContext.fightStatus.TryGetEntity(dynamicValueFightContext.playerId, out PlayerStatus entityStatus))
            {
                entity = null;
                return(false);
            }
            T val = entityStatus.heroStatus as T;

            if (val == null)
            {
                entity = null;
                return(false);
            }
            entity = val;
            return(true);
        }