public static MOVEDIRECTIONTYPE GetMovementDirectionTypeCombineStat(List <Kimboko> combineKimbokos)
        {
            MOVEDIRECTIONTYPE moveType;
            int strong = 0;

            for (int i = 0; i < combineKimbokos.Count; i++)
            {
                int newStrong = CombineKimbokoRules.PuntuateKimboko(combineKimbokos[i]);
                if (newStrong > strong)
                {
                    strong = newStrong;
                }
            }
            if (strong < 17)
            {
                if (combineKimbokos[0].OwnerPlayerID == 0)
                {
                    moveType = MOVEDIRECTIONTYPE.CROSSRIGHT;
                }
                else
                {
                    moveType = MOVEDIRECTIONTYPE.CROSSLEFT;
                }
            }
            else if (strong >= 17 && strong < 115)
            {
                moveType = MOVEDIRECTIONTYPE.DIAGONAL;
            }
            else
            {
                moveType = MOVEDIRECTIONTYPE.MULTI;
            }

            return(moveType);
        }
        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);
        }
        public override bool CanIExecute()
        {
            // QUE LA ACCION NO ESTE CANCELADA
            if (actionStatus == ABILITYEXECUTIONSTATUS.CANCELED)
            {
                return(false);
            }
            // 1- TENER LOS AP NECESARIOS
            if (performerIOcuppy.GetCurrentActionPoints() < GetActionPointsRequiredToUseAbility())
            {
                Debug.Log("Spawn Ability: Not Enough Action Points");
                return(false);
            }
            // 2- VER SI LOS PUEDO COMBINAR
            if (CombineKimbokoRules.CanICombine(actionInfo.combiner, actionInfo.kimbokoToCombine) == false)
            {
                Debug.Log("You cant combine this two kimbokos");
                return(false);
            }

            // 3- ME TENGO QUE FIJAR QUE NO HAYA ESTE DEFENDIENDO... AUNQUE ESO AUTOMATICAMENTE DEBERIA PONERME EN 0 LOS AC
            // 3- ACA DEBO CHEQUEAR LAS REGLAS DE COMBINACION, NO SOLO SI LOS PJ SON APTOS, SINO TAMBIEN SI MI PJ PUEDE EJECUTARLA

            return(true);
        }
Example #4
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);
        }
        public static Dictionary <STATTYPE, Stat> CreateKimbokoCombineStat(List <Kimboko> combineKimbokos)
        {
            Dictionary <STATTYPE, ActualMax> groupStat = new Dictionary <STATTYPE, ActualMax>();

            // RECORRER LA LISTA DE KIMBOKOS
            for (int i = 0; i < combineKimbokos.Count; i++)
            {
                // RECORRER EL DICCIONARIO DE SUS STATS
                foreach (KeyValuePair <STATTYPE, Stat> stat in combineKimbokos[i].Stats)
                {
                    if (groupStat.ContainsKey(stat.Key))
                    {
                        switch (stat.Key)
                        {
                        case STATTYPE.ATTACKPOW:
                        case STATTYPE.HEALTH:
                            // TANTO ATK POW COMO HP SE SUMAN EL ACTUAL Y EL MAX
                            groupStat[stat.Key].Actual += stat.Value.ActualStatValue;
                            groupStat[stat.Key].Max    += stat.Value.MaxStatValue;
                            break;

                        case STATTYPE.ATTACKRANGE:
                        case STATTYPE.MOVERANGE:
                            if (groupStat[stat.Key].Max < stat.Value.MaxStatValue)
                            {
                                groupStat[stat.Key].Max = stat.Value.MaxStatValue;
                            }
                            if (groupStat[stat.Key].Actual < stat.Value.ActualStatValue)
                            {
                                groupStat[stat.Key].Actual = stat.Value.ActualStatValue;
                            }
                            break;

                        default:
                            break;
                        }
                    }
                    else
                    {
                        groupStat.Add(stat.Key, new ActualMax(stat.Value.ActualStatValue, stat.Value.MaxStatValue));
                    }
                }
            }

            // AGREGO LOS STATS A AL DICCIONARIO
            Dictionary <STATTYPE, Stat> Stats = new Dictionary <STATTYPE, Stat>();

            if (groupStat.ContainsKey(STATTYPE.ATTACKPOW))
            {
                AttackPowerStat attackPow = new AttackPowerStat(groupStat[STATTYPE.ATTACKPOW].Actual, groupStat[STATTYPE.ATTACKPOW].Max);
                Stats.Add(attackPow.StatType, attackPow);
            }
            if (groupStat.ContainsKey(STATTYPE.ATTACKRANGE))
            {
                AttackRangeStat attackRan = new AttackRangeStat(groupStat[STATTYPE.ATTACKRANGE].Actual, groupStat[STATTYPE.ATTACKRANGE].Max);
                Stats.Add(attackRan.StatType, attackRan);
            }
            if (groupStat.ContainsKey(STATTYPE.MOVERANGE))
            {
                MoveRangeStat moveRan = new MoveRangeStat(groupStat[STATTYPE.MOVERANGE].Actual, groupStat[STATTYPE.MOVERANGE].Max);
                Stats.Add(moveRan.StatType, moveRan);
            }
            if (groupStat.ContainsKey(STATTYPE.HEALTH))
            {
                HealthStat healthStat = new HealthStat(groupStat[STATTYPE.HEALTH].Actual, groupStat[STATTYPE.HEALTH].Max);
                Stats.Add(healthStat.StatType, healthStat);
            }

            // ZX = 116 - ZY = 132 SOLO 1/1
            int points = CombineKimbokoRules.PuntuateKimbokoList(combineKimbokos);

            if (points == 116 || points == 132)
            {
                ActionPointStat actionPStat = new ActionPointStat(0, 1);
                Stats.Add(actionPStat.StatType, actionPStat);
            }
            else
            {
                ActionPointStat actionPStat = new ActionPointStat(0, 2);
                Stats.Add(actionPStat.StatType, actionPStat);
            }
            return(Stats);
        }