Ejemplo n.º 1
0
        public void mateWith(GreenSlime mateToPursue, GameLocation location)
        {
            if (location.canSlimeMateHere())
            {
                GreenSlime baby = new GreenSlime(Vector2.Zero);
                Utility.recursiveFindPositionForCharacter(baby, location, getTileLocation(), 30);
                Random r = new Random((int)Game1.stats.DaysPlayed + (int)Game1.uniqueIDForThisGame / 10 + (int)((float)scale * 100f) + (int)((float)mateToPursue.scale * 100f));
                switch (r.Next(4))
                {
                case 0:
                    baby.color.Value = new Color(Math.Min(255, Math.Max(0, color.R + r.Next((int)((float)(-color.R) * 0.25f), (int)((float)(int)color.R * 0.25f)))), Math.Min(255, Math.Max(0, color.G + r.Next((int)((float)(-color.G) * 0.25f), (int)((float)(int)color.G * 0.25f)))), Math.Min(255, Math.Max(0, color.B + r.Next((int)((float)(-color.B) * 0.25f), (int)((float)(int)color.B * 0.25f)))));
                    break;

                case 1:
                case 2:
                    baby.color.Value = Utility.getBlendedColor(color, mateToPursue.color);
                    break;

                case 3:
                    baby.color.Value = new Color(Math.Min(255, Math.Max(0, mateToPursue.color.R + r.Next((int)((float)(-mateToPursue.color.R) * 0.25f), (int)((float)(int)mateToPursue.color.R * 0.25f)))), Math.Min(255, Math.Max(0, mateToPursue.color.G + r.Next((int)((float)(-mateToPursue.color.G) * 0.25f), (int)((float)(int)mateToPursue.color.G * 0.25f)))), Math.Min(255, Math.Max(0, mateToPursue.color.B + r.Next((int)((float)(-mateToPursue.color.B) * 0.25f), (int)((float)(int)mateToPursue.color.B * 0.25f)))));
                    break;
                }
                int red   = baby.color.R;
                int green = baby.color.G;
                int blue  = baby.color.B;
                baby.Name = name;
                if (baby.Name == "Tiger Slime")
                {
                    baby.makeTigerSlime();
                }
                else if (red > 100 && blue > 100 && green < 50)
                {
                    baby.parseMonsterInfo("Sludge");
                    while (r.NextDouble() < 0.1)
                    {
                        baby.objectsToDrop.Add(386);
                    }
                    if (r.NextDouble() < 0.01)
                    {
                        baby.objectsToDrop.Add(337);
                    }
                }
                else if (red >= 200 && green < 75)
                {
                    baby.parseMonsterInfo("Sludge");
                }
                else if (blue >= 200 && red < 100)
                {
                    baby.parseMonsterInfo("Frost Jelly");
                }
                baby.Health           = ((r.NextDouble() < 0.5) ? base.Health : mateToPursue.Health);
                baby.Health           = Math.Max(1, base.Health + r.Next(-4, 5));
                baby.DamageToFarmer   = ((r.NextDouble() < 0.5) ? base.DamageToFarmer : mateToPursue.DamageToFarmer);
                baby.DamageToFarmer   = Math.Max(0, base.DamageToFarmer + r.Next(-1, 2));
                baby.resilience.Value = ((r.NextDouble() < 0.5) ? resilience : mateToPursue.resilience);
                baby.resilience.Value = Math.Max(0, (int)resilience + r.Next(-1, 2));
                baby.missChance.Value = ((r.NextDouble() < 0.5) ? missChance : mateToPursue.missChance);
                baby.missChance.Value = Math.Max(0.0, (double)missChance + (double)((float)r.Next(-1, 2) / 100f));
                baby.Scale            = ((r.NextDouble() < 0.5) ? scale : mateToPursue.scale);
                baby.Scale            = Math.Max(0.6f, Math.Min(1.5f, (float)scale + (float)r.Next(-2, 3) / 100f));
                baby.Slipperiness     = 8;
                base.speed            = ((r.NextDouble() < 0.5) ? base.speed : mateToPursue.speed);
                if (r.NextDouble() < 0.015)
                {
                    base.speed = Math.Max(1, Math.Min(6, base.speed + r.Next(-1, 2)));
                }
                baby.setTrajectory(Utility.getAwayFromPositionTrajectory(baby.GetBoundingBox(), getStandingPosition()) / 2f);
                baby.ageUntilFullGrown.Value = 120000;
                baby.Halt();
                baby.firstGeneration.Value = false;
                if (Utility.isOnScreen(base.Position, 128))
                {
                    base.currentLocation.playSound("slime");
                }
            }
            mateToPursue.doneMating();
            doneMating();
        }
Ejemplo n.º 2
0
        public void mateWith(GreenSlime mateToPursue, GameLocation location)
        {
            if (location.canSlimeMateHere())
            {
                GreenSlime greenSlime = new GreenSlime(Vector2.Zero);
                Utility.recursiveFindPositionForCharacter((NPC)greenSlime, location, this.getTileLocation(), 30);
                Random random = new Random((int)Game1.stats.DaysPlayed + (int)Game1.uniqueIDForThisGame / 10 + (int)((double)this.scale * 100.0) + (int)((double)mateToPursue.scale * 100.0));
                switch (random.Next(4))
                {
                case 0:
                    greenSlime.color = new Color(Math.Min((int)byte.MaxValue, Math.Max(0, (int)this.color.R + random.Next((int)((double)-this.color.R * 0.25), (int)((double)this.color.R * 0.25)))), Math.Min((int)byte.MaxValue, Math.Max(0, (int)this.color.G + random.Next((int)((double)-this.color.G * 0.25), (int)((double)this.color.G * 0.25)))), Math.Min((int)byte.MaxValue, Math.Max(0, (int)this.color.B + random.Next((int)((double)-this.color.B * 0.25), (int)((double)this.color.B * 0.25)))));
                    break;

                case 1:
                case 2:
                    greenSlime.color = Utility.getBlendedColor(this.color, mateToPursue.color);
                    break;

                case 3:
                    greenSlime.color = new Color(Math.Min((int)byte.MaxValue, Math.Max(0, (int)mateToPursue.color.R + random.Next((int)((double)-mateToPursue.color.R * 0.25), (int)((double)mateToPursue.color.R * 0.25)))), Math.Min((int)byte.MaxValue, Math.Max(0, (int)mateToPursue.color.G + random.Next((int)((double)-mateToPursue.color.G * 0.25), (int)((double)mateToPursue.color.G * 0.25)))), Math.Min((int)byte.MaxValue, Math.Max(0, (int)mateToPursue.color.B + random.Next((int)((double)-mateToPursue.color.B * 0.25), (int)((double)mateToPursue.color.B * 0.25)))));
                    break;
                }
                int r = (int)greenSlime.color.R;
                int g = (int)greenSlime.color.G;
                int b = (int)greenSlime.color.B;
                if (r > 100 && b > 100 && g < 50)
                {
                    greenSlime.parseMonsterInfo("Sludge");
                    while (random.NextDouble() < 0.1)
                    {
                        greenSlime.objectsToDrop.Add(386);
                    }
                    if (random.NextDouble() < 0.01)
                    {
                        greenSlime.objectsToDrop.Add(337);
                    }
                }
                else if (r >= 200 && g < 75)
                {
                    greenSlime.parseMonsterInfo("Sludge");
                }
                else if (b >= 200 && r < 100)
                {
                    greenSlime.parseMonsterInfo("Frost Jelly");
                }
                greenSlime.health         = random.NextDouble() < 0.5 ? this.health : mateToPursue.health;
                greenSlime.health         = Math.Max(1, this.health + random.Next(-4, 5));
                greenSlime.damageToFarmer = random.NextDouble() < 0.5 ? this.damageToFarmer : mateToPursue.damageToFarmer;
                greenSlime.damageToFarmer = Math.Max(0, this.damageToFarmer + random.Next(-1, 2));
                greenSlime.resilience     = random.NextDouble() < 0.5 ? this.resilience : mateToPursue.resilience;
                greenSlime.resilience     = Math.Max(0, this.resilience + random.Next(-1, 2));
                greenSlime.missChance     = random.NextDouble() < 0.5 ? this.missChance : mateToPursue.missChance;
                greenSlime.missChance     = Math.Max(0.0, this.missChance + (double)random.Next(-1, 2) / 100.0);
                greenSlime.scale          = random.NextDouble() < 0.5 ? this.scale : mateToPursue.scale;
                greenSlime.scale          = Math.Max(0.6f, Math.Min(1.5f, this.scale + (float)random.Next(-2, 3) / 100f));
                greenSlime.slipperiness   = 8;
                this.speed = random.NextDouble() < 0.5 ? this.speed : mateToPursue.speed;
                if (random.NextDouble() < 0.015)
                {
                    this.speed = Math.Max(1, Math.Min(6, this.speed + random.Next(-1, 2)));
                }
                greenSlime.setTrajectory(Utility.getAwayFromPositionTrajectory(greenSlime.GetBoundingBox(), this.getStandingPosition()) / 2f);
                greenSlime.ageUntilFullGrown = 120000;
                greenSlime.Halt();
                greenSlime.firstGeneration = false;
                if (Utility.isOnScreen(this.position, 128))
                {
                    Game1.playSound("slime");
                }
            }
            mateToPursue.doneMating();
            this.doneMating();
        }