Esempio n. 1
0
        /// <summary>
        /// dont use directly, only if necessary to rewrite new genes for the harcoded genes in the contract
        /// </summary>
        public static byte[] MineBotGenes(Random rnd, PraticeLevel level)
        {
            Hue   hue;
            sbyte shade;

            GetDummyVisuals(level, out hue, out shade);

            var headVariation = (byte)(level) - 1;

            byte targetStat = (byte)(Formulas.BaseStatSplit + ((byte)level) * 5);

            var isOdd = ((int)level) % 2 == 1;

            //var movesList = allowedMoves != null ? allowedMoves.ToArray() : null;

            return(MineGenes(rnd, x =>
            {
                if ((x.Rarity != Rarity.Bot) ||
                    (x.GetBodyPart(BodyPart.Head).Variation != headVariation) ||
                    (x.SkinHue != hue || x.SkinShade != shade) ||
                    (Math.Abs(x.BaseStamina - targetStat) > 1 || Math.Abs(x.BaseAttack - targetStat) > 10 || Math.Abs(x.BaseDefense - targetStat) > 10) ||
                    (x.BaseAttack < x.BaseStamina != isOdd))
                {
                    return false;
                }

                return true;
            },
                             (genes) =>
            {
                genes[Constants.GENE_RARITY] = (byte)((genes[Constants.GENE_RARITY] / 6) * 6);
                genes[Constants.GENE_STAMINA] = (byte)(targetStat - 5 + rnd.Next() % 10);
                genes[Constants.GENE_ATK] = (byte)(targetStat - 5 + rnd.Next() % 10);
                genes[Constants.GENE_DEF] = (byte)(targetStat - 5 + rnd.Next() % 10);
                genes[Constants.GENE_COUNTRY] = (byte)Country.Mexico;

                /*if (movesList != null)
                 * {
                 *  var index = genes[GENE_MOVE] % movesList.Length;
                 *  var targetMove = movesList[index];
                 *  genes[GENE_MOVE] = (byte)((int)targetMove - (1 + (int)WrestlingMove.Custom));
                 * }*/
            }
                             ));
        }
Esempio n. 2
0
        public static void GetDummyVisuals(PraticeLevel level, out Hue hue, out sbyte shade)
        {
            switch (level)
            {
            case PraticeLevel.Wood:
            {
                hue   = Hue.Brown;
                shade = 0;
                break;
            }

            case PraticeLevel.Iron:
            {
                hue   = Hue.Gray;
                shade = -1;
                break;
            }

            case PraticeLevel.Steel:
            {
                hue   = Hue.Blue;
                shade = 0;
                break;
            }

            case PraticeLevel.Silver:
            {
                hue   = Hue.Gray;
                shade = 1;
                break;
            }

            case PraticeLevel.Gold:
            {
                hue   = Hue.Brown;
                shade = 2;
                break;
            }

            case PraticeLevel.Ruby:
            {
                hue   = Hue.Pink;
                shade = 0;
                break;
            }

            case PraticeLevel.Emerald:
            {
                hue   = Hue.Green;
                shade = 2;
                break;
            }

            case PraticeLevel.Diamond:
            {
                hue   = Hue.Cyan;
                shade = 1;
                break;
            }

            default:
            {
                hue   = Hue.Purple;
                shade = 0;
                break;
            }
            }
        }