Example #1
0
        public override List <SwapChoices> GetSwapMoves(PlayerSeat seat)
        {
            List <JewelID> prefJewels = new List <JewelID>()
            {
                JewelID.wrath
            };

            // Look through all of the current mohe's abilities
            IRuntimeMoheData mohe = GameController.Instance.GetPlayerController(seat).Player.Roster.CurrentMohe();

            // If there are any abilities that are uncharged, add to abilities buffer
            foreach (var abl in mohe.Abilities)
            {
                foreach (var comp in abl.AbilityComponents)
                {
                    if (comp.Has < comp.Needs && !prefJewels.Contains(comp.JewelType))
                    {
                        prefJewels.Add(comp.JewelType);
                    }
                }
            }

            // look for matches
            List <SwapChoices> matchesBuff = FindMatchesUtil.FindBestMatches(game.GameBoard.GetBoardData().GetMap(), prefJewels);

            return(matchesBuff.OrderByDescending(m => m.matches).ToList());
        }
Example #2
0
        public override void OnEnterState()
        {
            // Look through all jewels
            IRuntimeJewel[,] jewels = board.GetBoardData().GetMap();

            // Right here is where I need to look through all the jewels and see if two jewels are clicked
            List <IRuntimeJewel> jewelsClicked = new List <IRuntimeJewel>();

            for (int x = 0; x < jewels.GetLength(0); x++)
            {
                for (int y = 0; y < jewels.GetLength(1); y++)
                {
                    if (jewels[x, y].IsSelected)
                    {
                        jewelsClicked.Add(jewels[x, y]);
                    }
                }
            }

            if (jewelsClicked.Count <= 1)
            {
                // Clean Board state
                GameEvents.Instance.Notify <ICleanBoard>(i => i.OnBoardCleanCheck());
            }
            else if (jewelsClicked.Count == 2 && FindMatchesUtil.WillCauseMatch(jewels, jewelsClicked[0], jewelsClicked[1]))
            {
                // If the two jewels will cause a match, swap the jewels, then swap to evaluate board state
                GameEvents.Instance.Notify <ISwapBoard>(i => i.OnBoardSwapCheck());
            }
            else
            {
                // Remove all selected board state
                GameEvents.Instance.Notify <IRemoveSelectedBoard>(i => i.OnBoardRemoveSelectedCheck());
            }
        }
Example #3
0
        //private List<IRuntimeJewel> toRemoveBuff = new List<IRuntimeJewel>();

        public override void OnEnterState()
        {
            //Logger.Log<EvaluateBoardState>("OnEnterState");
            base.OnEnterState();

            // Bring in board data
            IRuntimeJewel[,] jewelMap = board.GetBoardData().GetMap();
            if (FindMatchesUtil.FindBestMatches(jewelMap).Count == 0)
            {
                OnResetState();
                return;
            }

            List <List <IRuntimeJewel> > toRemoveBuffs = FindMatchesUtil.FindMatchesBuffer(jewelMap);

            foreach (var toRemoveBuff in toRemoveBuffs)
            {
                if (toRemoveBuff.Count > 3)
                {
                    OnBonus(toRemoveBuff.Select((jewel) => { return(jewel.Data.JewelID); }).ToList());
                }
                foreach (var jewel in toRemoveBuff)
                {
                    OnRemove(jewel);
                }
            }
            if (toRemoveBuffs.Count > 0 || FindMatchesUtil.ContainsNullJewel(board.GetBoardData().GetMap()))
            {
                OnCascadeState();
            }
            else
            {
                OnCleanBoardState();
            }
        }
Example #4
0
        public override void OnEnterState()
        {
            // Look through all jewels
            IRuntimeJewel[,] jewelMap = board.GetBoardData().GetMap();
            List <SwapChoices> matchesBuff = FindMatchesUtil.FindBestMatches(jewelMap);

            if (matchesBuff.Count == 0)
            {
                int width  = jewelMap.GetLength(0);
                int height = jewelMap.GetLength(1);
                for (int y = 0; y < height; y++)
                {
                    for (int x = 0; x < width; x++)
                    {
                        OnRemove(jewelMap[x, y]);
                    }
                }
            }
            Notify();
        }