public static IEnumerable <Area> TargetsToCompareAreaList(ITargetSelector targetToCompare, DynamicValueContext context)
        {
            IEntitySelector entitySelector = targetToCompare as IEntitySelector;

            if (entitySelector != null)
            {
                foreach (IEntity item in entitySelector.EnumerateEntities(context))
                {
                    IEntityWithBoardPresence entityWithBoardPresence = item as IEntityWithBoardPresence;
                    if (entityWithBoardPresence != null)
                    {
                        yield return(entityWithBoardPresence.area);
                    }
                }
            }
            ICoordSelector coordSelector = targetToCompare as ICoordSelector;

            if (coordSelector != null)
            {
                foreach (Coord item2 in coordSelector.EnumerateCoords(context))
                {
                    yield return(new PointArea((Vector2Int)item2));
                }
            }
        }
示例#2
0
        public IEnumerable <IsoObject> EnumerateInstantiationObjectTargets([NotNull] DynamicValueContext castTargetContext)
        {
            IEntitySelector entitySelector = m_originTarget as IEntitySelector;

            if (entitySelector != null)
            {
                foreach (IEntity item in entitySelector.EnumerateEntities(castTargetContext))
                {
                    IEntityWithBoardPresence entityWithBoardPresence = item as IEntityWithBoardPresence;
                    if (entityWithBoardPresence != null)
                    {
                        yield return(entityWithBoardPresence.view);
                    }
                }
            }
        }
示例#3
0
        public override IEnumerable <IEntity> EnumerateEntities(DynamicValueContext context)
        {
            HashSet <IEntity> entitiesSet = new HashSet <IEntity>();

            foreach (IEntity e in m_first.EnumerateEntities(context))
            {
                yield return(e);

                entitiesSet.Add(e);
            }
            foreach (IEntity item in m_second.EnumerateEntities(context))
            {
                if (entitiesSet.Add(item))
                {
                    yield return(item);
                }
            }
        }
        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 void Begin([NotNull] ICharacterEntity tracked, FightPathFinder pathFinder)
        {
            //IL_0067: Unknown result type (might be due to invalid IL or missing references)
            //IL_006c: Unknown result type (might be due to invalid IL or missing references)
            //IL_006f: Unknown result type (might be due to invalid IL or missing references)
            //IL_0097: Unknown result type (might be due to invalid IL or missing references)
            //IL_00c3: Unknown result type (might be due to invalid IL or missing references)
            //IL_013a: Unknown result type (might be due to invalid IL or missing references)
            //IL_013f: Unknown result type (might be due to invalid IL or missing references)
            //IL_0142: Unknown result type (might be due to invalid IL or missing references)
            //IL_019d: Unknown result type (might be due to invalid IL or missing references)
            //IL_01fb: Unknown result type (might be due to invalid IL or missing references)
            //IL_0200: Unknown result type (might be due to invalid IL or missing references)
            //IL_0203: Unknown result type (might be due to invalid IL or missing references)
            //IL_025e: Unknown result type (might be due to invalid IL or missing references)
            IMapStateProvider  mapStateProvider  = stateProvider;
            IMapEntityProvider mapEntityProvider = entityProvider;
            HashSet <IObjectTargetableByAction> objectsTargetableByAction = m_objectsTargetableByAction;

            canMove             = tracked.canMove;
            canPassThrough      = tracked.HasProperty(PropertyId.CanPassThrough);
            canDoActionOnTarget = tracked.canDoActionOnTarget;
            int num = grid.Length;

            for (int i = 0; i < num; i++)
            {
                Cell cell = grid[i];
                if (cell.state != 0)
                {
                    Vector2Int coords = cell.coords;
                    IEntityWithBoardPresence entity;
                    CellState state = (!mapEntityProvider.TryGetEntityBlockingMovementAt(coords, out entity)) ? CellState.Movement : ((entity != tracked) ? (CellState.Movement | CellState.Occupied) : (CellState.Movement | CellState.Reachable | CellState.Tracked));
                    grid[i] = new Cell(cell.coords, state, entity);
                }
            }
            pathFinder.FloodFill(mapStateProvider, grid, tracked.area.refCoord, tracked.movementPoints, canPassThrough);
            ActionType      actionType         = tracked.actionType;
            IEntitySelector customActionTarget = tracked.customActionTarget;

            if (customActionTarget != null)
            {
                CharacterActionValueContext context = new CharacterActionValueContext((FightStatus)mapEntityProvider, tracked);
                foreach (IEntity item in customActionTarget.EnumerateEntities(context))
                {
                    IEntityTargetableByAction entityTargetableByAction;
                    if (item != tracked && (entityTargetableByAction = (item as IEntityTargetableByAction)) != null)
                    {
                        Vector2Int refCoord = entityTargetableByAction.area.refCoord;
                        if (IsInActionRange(refCoord, tracked))
                        {
                            IObjectTargetableByAction objectTargetableByAction;
                            if ((objectTargetableByAction = (entityTargetableByAction.view as IObjectTargetableByAction)) != null)
                            {
                                objectTargetableByAction.ShowActionTargetFeedback(actionType, isSelected: false);
                                objectsTargetableByAction.Add(objectTargetableByAction);
                            }
                            int  cellIndex = mapStateProvider.GetCellIndex(refCoord.get_x(), refCoord.get_y());
                            Cell cell2     = grid[cellIndex];
                            grid[cellIndex] = new Cell(refCoord, cell2.state | CellState.Targetable, entityTargetableByAction);
                        }
                    }
                }
            }
            else
            {
                foreach (IEntityTargetableByAction item2 in mapEntityProvider.EnumerateEntities <IEntityTargetableByAction>())
                {
                    if (item2 != tracked)
                    {
                        Vector2Int refCoord2 = item2.area.refCoord;
                        if (IsInActionRange(refCoord2, tracked))
                        {
                            IObjectTargetableByAction objectTargetableByAction2;
                            if ((objectTargetableByAction2 = (item2.view as IObjectTargetableByAction)) != null)
                            {
                                objectTargetableByAction2.ShowActionTargetFeedback(actionType, isSelected: false);
                                objectsTargetableByAction.Add(objectTargetableByAction2);
                            }
                            int  cellIndex2 = mapStateProvider.GetCellIndex(refCoord2.get_x(), refCoord2.get_y());
                            Cell cell3      = grid[cellIndex2];
                            grid[cellIndex2] = new Cell(refCoord2, cell3.state | CellState.Targetable, item2);
                        }
                    }
                }
            }
            trackedCharacter = tracked;
            targetedEntity   = null;
        }