Exemplo n.º 1
0
        protected Cropbeast(CropTile cropTile, bool containsPlant,
                            bool containsPrimaryHarvest, bool containsSecondaryHarvest,
                            string beastName = null)
            : base(beastName ?? cropTile.mapping.beastName, cropTile.location,
                   Utility.PointToVector2(cropTile.tileLocation) * 64f +
                   new Vector2(0f, -32f))
        {
            cropTile_          = cropTile;
            harvestIndex.Value = cropTile.harvestIndex;
            giantCrop.Value    = cropTile.giantCrop;
            tileLocation.Value = cropTile.tileLocation;

            this.containsPlant.Value            = containsPlant;
            this.containsPrimaryHarvest.Value   = containsPrimaryHarvest;
            this.containsSecondaryHarvest.Value = containsSecondaryHarvest;

            // Calculate the beast's coloration.
            primaryColor.Value = cropTile.mapping.primaryColor
                                 ?? TailoringMenu.GetDyeColor(cropTile.mapping.harvestObject)
                                 ?? Color.White;
            secondaryColor.Value = cropTile.mapping.secondaryColor
                                   ?? primaryColor.Value;

            // Scale health and damage based on combat skill of players present.
            // Base values in Monsters.json are for level zero.
            MaxHealth      = Health = scaleByCombatSkill(Health, 1.2f);
            DamageToFarmer = scaleByCombatSkill(DamageToFarmer, 0.2f);

            // Calculate the normal gain of farming experience.
            int price = cropTile.mapping.harvestObject.Price;

            experienceGained.Value = (int)Math.Ceiling(8.0 *
                                                       Math.Log(0.018 * (double)price + 1.0, Math.E));
        }
Exemplo n.º 2
0
        internal static void Create(Message message)
        {
            // Check preconditions.
            if (Context.IsMainPlayer)
            {
                throw new InvalidOperationException("Only farmhands can do that.");
            }

            // Create guest spawner for farmhand.
            GuestCropTile cropTile = GuestCropTile.Create(message.harvestIndex,
                                                          message.giantCrop, message.tileLocation);
            GameLocation location = Game1.getLocationFromName
                                        (message.locationName);

            new Spawner(cropTile, location, message.baseQuantity, null,
                        message.showWitchFlyover);
        }
Exemplo n.º 3
0
        private Spawner(GuestCropTile cropTile, GameLocation location,
                        int baseQuantity, List <Cropbeast> beasts, bool showWitchFlyover)
        {
            this.cropTile         = cropTile;
            this.location         = location;
            this.baseQuantity     = baseQuantity;
            this.beasts           = beasts;
            this.showWitchFlyover = showWitchFlyover;

            if (showWitchFlyover)
            {
                witchFlyover();
            }
            else
            {
                startTransformation();
            }
        }