public bool IsThereAPosibleSpawneableTile(int playerID)
        {
            int columnIndex = 2;

            if (playerID == 1)
            {
                columnIndex = 8;
            }
            for (int i = 0; i < rowsHeight; i++)
            {
                if (GridArray[columnIndex, i].IsOccupied() == false)
                {
                    return(true);
                }
                if (GridArray[columnIndex, i].GetOcuppy() == null)
                {
                    return(false);
                }
                if (GridArray[columnIndex, i].GetOcuppy().OccupierType != OCUPPIERTYPE.UNIT)
                {
                    return(false);
                }
                Kimboko auxKimb = (Kimboko)GridArray[columnIndex, i].GetOcuppy();
                if (auxKimb.OwnerPlayerID == playerID)
                {
                    if (CombineKimbokoRules.CanICombineAndEvolveWithUnitType(auxKimb, UNITTYPE.X))
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
Exemple #2
0
        private void ExecuteSpecialSpawn(SpawnAbility spawnAbility, SpawnAbilityEventInfo spwInf)
        {
            Kimboko unit = (Kimboko)spwInf.spawnTile.GetOcuppy();

            if (unit == null)
            {
                return;
            }
            if (unit.OwnerPlayerID != spwInf.spawnerPlayer.OwnerPlayerID)
            {
                return;
            }
            bool canCombine          = CombineKimbokoRules.CanICombineWithUnitType(unit, spwInf.spawnUnitType);
            bool canCombineAndEvolve = CombineKimbokoRules.CanICombineAndEvolveWithUnitType(unit, spwInf.spawnUnitType);

            if (canCombineAndEvolve)
            {
                ExecuteSpawnCombineAndEvolve(unit, spwInf);
            }
            else if (canCombine)
            {
                ExecuteSpawnCombine(unit, spawnAbility, spwInf);
            }
            else
            {
                // Y ACA NO SE PUDO COMBINAR NI EVOLUCIONAR
                // ESTO PUEDE PASAR POR INVOCAR UNA UNIDAD Y QUE SE LE CAMBIE DE CLASE
                // AL HACER ESTO NO PODEMOS INVOCARLA POR QUE SON INCOMPATIBLES
                // SE EJECUTA IGUAL EL END PERFORM?????
                // PODRIAMOS TENER UN ESTADO EN EL EVENT INFO PARA PONER CANCEL EXECUTION
                // ENTONCES DE ESTA MANERA SABEMOS QUE SE CANCELO Y NO HACEMOS EL END PERFORM...
            }
        }
        public List <SpawnTile> GetPlayerSpawnTiles(int playerID)
        {
            List <SpawnTile> spawnTile = new List <SpawnTile>();
            int columnIndex            = 2;

            if (playerID == 1)
            {
                columnIndex = 8;
            }
            for (int i = 0; i < rowsHeight; i++)
            {
                if (GridArray[columnIndex, i].IsOccupied() == false)
                {
                    SpawnTile aux = (SpawnTile)GridArray[columnIndex, i];
                    spawnTile.Add(aux);
                    continue;
                }
                if (GridArray[columnIndex, i].GetOcuppy() == null)
                {
                    continue;
                }

                if (GridArray[columnIndex, i].GetOcuppy().OccupierType != OCUPPIERTYPE.UNIT)
                {
                    continue;
                }

                Kimboko auxKimb = (Kimboko)GridArray[columnIndex, i].GetOcuppy();
                if (auxKimb.OwnerPlayerID == playerID)
                {
                    if (CombineKimbokoRules.CanICombineWithUnitType(auxKimb, UNITTYPE.X))
                    {
                        SpawnTile aux = (SpawnTile)GridArray[columnIndex, i];
                        spawnTile.Add(aux);
                        continue;
                    }

                    if (CombineKimbokoRules.CanICombineAndEvolveWithUnitType(auxKimb, UNITTYPE.X))
                    {
                        SpawnTile aux = (SpawnTile)GridArray[columnIndex, i];
                        spawnTile.Add(aux);
                        continue;
                    }
                }
            }
            return(spawnTile);
        }