コード例 #1
0
        public void Assign(StardewValley.Objects.Hat hat, IEffect effect)
        {
            if (WrappedItem == hat)
            {
                return;
            }
            Effect = effect;

            this._GetOneFrom(hat);
        }
コード例 #2
0
        // Adds the items to the shop
        private void CreateShop()
        {
            StardewValley.Object            itm;
            StardewValley.Tools.MeleeWeapon wpn;
            StardewValley.Objects.Hat       hat;
            int[] q = new int[2];
            q[0] = 1; //Price
            q[1] = 1; //Quantity

            // Add party hat
            hat = new StardewValley.Objects.Hat(58);
            items.Add(hat, new int[2] {
                0, 1
            });

            // Add chocolate cake
            itm = new StardewValley.Object(220, 1, quality: 4);
            items.Add(itm, new int[2] {
                0, 1
            });

            // Add 3 magic rock candy
            itm = new StardewValley.Object(279, 3);
            items.Add(itm, new int[2] {
                0, 3
            });

            // Add 200 explosive ammo
            itm = new StardewValley.Object(441, 200);
            items.Add(itm, new int[2] {
                0, 200
            });

            // Add tempered galaxy sword
            wpn = new StardewValley.Tools.MeleeWeapon(66);
            items.Add(wpn, new int[2] {
                0, 1
            });
        }
コード例 #3
0
        public KeyValuePair <int, int>?GetLoot(out Item special)
        {
            special = null;

            if (!Geode.IsGeode)
            {
                return(null);
            }

            try {
                if (RNG.NextDouble() <= 0.1 && Game1.player.team.SpecialOrderRuleActive("DROP_QI_BEANS"))
                {
                    int count = RNG.NextDouble() < Config.Geode.ManyBeansOdds ? Config.Geode.ManyBeansCount : 1;
                    return(new KeyValuePair <int, int>(ID_QI_BEAN, count));
                }
                if (Geode.ID == ID_GOLDEN_COCONUT)
                {
                    if (RNG.NextDouble() < Config.Geode.CoconutHatOdds && !Game1.player.hasOrWillReceiveMail("goldenCoconutHat"))
                    {
                        Game1.player.mailReceived.Add("goldenCoconutHat");
                        special = new StardewValley.Objects.Hat(ID_GOLDEN_HELMET);
                        return(null);
                    }
                    return(RNG.Choose(GOLDEN_COCONUT_DROPS_LIST));
                }

                if (Geode.ID == ID_ARTIFACT_TROVE || RNG.NextDouble() < Config.Geode.TreasureOdds)
                {
                    Log.Trace("Treasure code path chosen");
                    return(GetGeodeTreasure());
                }

                Log.Trace("Mineral code path chosen");

                int amount = (RNG.Next(3) * 2) + 1;

                if (RNG.NextDouble() < Config.Geode.TenMineralsOdds)
                {
                    amount = 10;
                }

                if (RNG.NextDouble() < Config.Geode.TwentyMineralsOdds)
                {
                    amount = 20;
                }

                if (RNG.NextDouble() >= Config.Geode.OreCoalOdds)
                {
                    switch (RNG.Next(4))
                    {
                    case 0:
                    case 1:
                        return(new KeyValuePair <int, int>(ID_STONE, amount));

                    case 2:
                        return(new KeyValuePair <int, int>(ID_CLAY, 1));

                    case 3: {
                        int parentSheetIndex = Geode.ID switch {
                            ID_OMNI_GEODE => ID_FIRE_QUARTZ + (RNG.Next(3) * 2),
                            ID_FROZEN_GEODE => ID_FROZEN_TEAR,
                            ID_GEODE => ID_EARTH_CRYSTAL,
                            _ => ID_FIRE_QUARTZ      // Magma Geode
                        };
                        return(new KeyValuePair <int, int>(parentSheetIndex, 1));
                    }
                    }
                }

                switch (Geode.ID)
                {
                case ID_GEODE:
                    return((RNG.Next(3)) switch {
                        0 => new KeyValuePair <int, int>(ID_COPPER_ORE, amount),
                        1 => new KeyValuePair <int, int>((Game1.player.deepestMineLevel > 25) ? ID_IRON_ORE : ID_COPPER_ORE, amount),
                        // 2
                        _ => new KeyValuePair <int, int>(ID_COAL, amount)
                    });

                case ID_FROZEN_GEODE:
                    return((RNG.Next(4)) switch {
                        0 => new KeyValuePair <int, int>(ID_COPPER_ORE, amount),
                        1 => new KeyValuePair <int, int>(ID_IRON_ORE, amount),
                        2 => new KeyValuePair <int, int>(ID_COAL, amount),
                        // 3
                        _ => new KeyValuePair <int, int>((Game1.player.deepestMineLevel > 75) ? ID_GOLD_ORE : ID_IRON_ORE, amount)
                    });
コード例 #4
0
 public static void HatChanged(Netcode.NetRef <StardewValley.Objects.Hat> field, StardewValley.Objects.Hat oldValue, StardewValley.Objects.Hat newValue)
 {
     ApplyHatEffect();
 }