Beispiel #1
0
        public static byte[] MineGenes(Random rnd, Func <Luchador, bool> filter, Action <byte[]> geneSplicer = null, int limit = 0)
        {
            int amount   = 0;
            var luchador = new Luchador(Constants.BASE_LUCHADOR_ID);

            do
            {
                var genes = GenerateGenes(rnd);

                geneSplicer?.Invoke(genes);

                luchador._hash = null;
                luchador.Genes = genes;

                if (luchador.HasValidMoveset() && (filter == null || filter(luchador)))
                {
                    return(genes);
                }

                amount++;
                if (limit > 0 && amount >= limit)
                {
                    return(null);
                }
            } while (true);
        }
Beispiel #2
0
        public static Luchador FromData(BigInteger id, Address owner, NachoWrestler data)
        {
            var luchador = new Luchador(id)
            {
                Data = data, Owner = owner
            };

            return(luchador);
        }
Beispiel #3
0
        public static Luchador FromGenes(BigInteger n, Address owner, byte[] genes)
        {
            var luchador = new Luchador(n)
            {
                Owner = owner, Genes = genes, Data = new NachoWrestler()
            };

            return(luchador);
        }
Beispiel #4
0
 private static bool HasValidMoveset(Luchador luchador)
 {
     if (luchador.SecondaryMove == WrestlingMove.Pray)
     {
         return(false);
     }
     if (luchador.SecondaryMove == WrestlingMove.Hyper_Slam)
     {
         return(false);
     }
     return(true);
 }
Beispiel #5
0
        private static bool HasValidVisual(Luchador luchador)
        {
            var legs = luchador.GetBodyPart(BodyPart.Legs).Variation;

            if (legs > 7)
            {
                return(false);
            }

            var body = luchador.GetBodyPart(BodyPart.Body).Variation;

            if (body > 28)
            {
                return(false);
            }

            var head     = luchador.GetBodyPart(BodyPart.Head).Variation;
            var isFemale = WrestlerValidation.IsFemale(head, luchador.Rarity);

            if (body > 20 && !isFemale)
            {
                return(false);
            }
            if (body <= 20 && isFemale)
            {
                return(false);
            }

            var hips = luchador.GetBodyPart(BodyPart.Hips).Variation;

            if (hips > 16)
            {
                return(false);
            }

            var arms = luchador.GetBodyPart(BodyPart.Arms).Variation;

            if (arms > 7)
            {
                return(false);
            }

            var hands = luchador.GetBodyPart(BodyPart.Hands).Variation;

            if (hands > 16)
            {
                return(false);
            }

            var feet = luchador.GetBodyPart(BodyPart.Feet).Variation;

            if (feet > 16)
            {
                return(false);
            }

            switch (luchador.Rarity)
            {
            case Rarity.Bot: if (head > 8)
                {
                    return(false);
                }
                break;

            case Rarity.Common: if (head > 35)
                {
                    return(false);
                }
                break;

            case Rarity.Uncommon: if (head > 22)
                {
                    return(false);
                }
                break;

            case Rarity.Rare: if (head > 20)
                {
                    return(false);
                }
                break;

            case Rarity.Epic: if (head > 24)
                {
                    return(false);
                }
                break;

            case Rarity.Legendary: if (head > 82)
                {
                    return(false);
                }
                break;
            }

            return(true);
        }
Beispiel #6
0
 public static bool IsValidWrestler(Luchador luchador)
 {
     return(HasValidMoveset(luchador) && HasValidVisual(luchador));
 }