Пример #1
0
        //Cloning is CRUCIAL in making this mod work; if there is no cloning, all of the guns will have the same exact prefix/parts. No good.
        public override ModItem Clone(Item item)
        {
            TLWeapon wepClone = (TLWeapon)base.Clone(item);

            if (!wepClone.availablePrefixes.elements.Any())
            {
                wepClone.GetAvailablePrefixes();
            }
            if (!wepClone.availableElements.elements.Any())
            {
                wepClone.GetAvailableElements();
            }
            wepClone.additionalShots = 0;
            wepClone.fixedSpread     = 0f;
            if (wepClone.itemPrefix == TLPrefixList.Default)
            {
                wepClone.itemPrefix = availablePrefixes.Get();
                wepClone.item.SetNameOverride(GetAdjustedName());
            }
            if (wepClone.itemSuffix == TLSuffixList.Default)
            {
                wepClone.itemSuffix = TLSuffixList.GetRandomSuffix();
                wepClone.item.SetNameOverride(GetAdjustedName());
            }
            if (wepClone.itemElement == ElementType.Default)
            {
                wepClone.itemElement = availableElements.Get();
            }
            wepClone.AutoDefaults();
            wepClone.SetDefaults();
            return(wepClone);
        }
Пример #2
0
        public override string GetChat()
        {
            WeightedRandom <string> chat = new WeightedRandom <string>();

            chat.Add(Language.GetTextValue("Mods.GnomeWordsmith.NPCChat.GnomeWordsmith.Rand0"));
            chat.Add(Language.GetTextValue("Mods.GnomeWordsmith.NPCChat.GnomeWordsmith.Rand1"));
            chat.Add(Language.GetTextValue("Mods.GnomeWordsmith.NPCChat.GnomeWordsmith.Rand2"));
            int goblinkTinkerer = NPC.FindFirstNPC(NPCID.GoblinTinkerer);

            if (goblinkTinkerer >= 0)
            {
                chat.Add(Language.GetTextValue("Mods.GnomeWordsmith.NPCChat.GnomeWordsmith.GoblinTinkerer", Main.npc[goblinkTinkerer].GivenName));
            }

            int steampunker = NPC.FindFirstNPC(NPCID.Steampunker);

            if (steampunker >= 0)
            {
                chat.Add(Language.GetTextValue("Mods.GnomeWordsmith.NPCChat.GnomeWordsmith.Steampunker", Main.npc[steampunker].GivenName));
            }

            if (Main.bloodMoon)
            {
                chat.Add(Language.GetTextValue("Mods.GnomeWordsmith.NPCChat.GnomeWordsmith.BloodMoon"));
            }

            return(chat.Get());
        }
Пример #3
0
        protected override void FillLootBox(WeightedRandom <LootBoxContents> WR)
        {
            WR.Add(new LootBoxContents(ModContent.ItemType <ReflexPotion>(), 1 + Main.rand.Next(Main.rand.Next(2, 15))), 1);
            WR.Add(new LootBoxContents(ModContent.ItemType <ClarityPotion>(), 1 + Main.rand.Next(Main.rand.Next(2, 15))), 1);
            WR.Add(new LootBoxContents(ModContent.ItemType <CondenserPotion>(), 1 + Main.rand.Next(Main.rand.Next(2, 15))), 1);
            WR.Add(new LootBoxContents(ModContent.ItemType <EnergyPotion>(), 1 + Main.rand.Next(Main.rand.Next(2, 15))), 1);
            WR.Add(new LootBoxContents(ModContent.ItemType <IceFirePotion>(), 1 + Main.rand.Next(Main.rand.Next(1, 12))), 1);
            WR.Add(new LootBoxContents(ModContent.ItemType <RadCurePotion>(), 1 + Main.rand.Next(Main.rand.Next(2, 15))), 1);
            WR.Add(new LootBoxContents(ModContent.ItemType <TinkerPotion>(), 1 + Main.rand.Next(Main.rand.Next(1, 15))), 1);
            WR.Add(new LootBoxContents(ModContent.ItemType <TriggerFingerPotion>(), 1 + Main.rand.Next(Main.rand.Next(1, 15))), 1);
            WR.Add(new LootBoxContents(ModContent.ItemType <TrueStrikePotion>(), 1 + Main.rand.Next(Main.rand.Next(1, 15))), 1);
            WR.Add(new LootBoxContents(ModContent.ItemType <RagnarokBrew>(), 1 + Main.rand.Next(Main.rand.Next(1, 15))), 1);
            WR.Add(new LootBoxContents(ModContent.ItemType <TooltimePotion>(), 1 + Main.rand.Next(Main.rand.Next(2, 15))), 1);
            WR.Add(new LootBoxContents(ModContent.ItemType <PhalanxPotion>(), 1 + Main.rand.Next(Main.rand.Next(1, 15))), 1);
            WR.Add(new LootBoxContents(ModContent.ItemType <DragonsMightPotion>(), 1 + Main.rand.Next(Main.rand.Next(1, 15))), 0.8);
            WR.Add(new LootBoxContents(ModContent.ItemType <IntimacyPotion>(), 1 + Main.rand.Next(Main.rand.Next(1, 8))), 0.5);
            WR.Add(new LootBoxContents(ModContent.ItemType <ToxicityPotion>(), 1 + Main.rand.Next(Main.rand.Next(1, 8))), 0.5);
            WR.Add(new LootBoxContents(ModContent.ItemType <TimePotion>(), 1 + Main.rand.Next(Main.rand.Next(1, 8))), 0.5);

            WR.Add(new LootBoxContents(ModContent.ItemType <ConsumeHell>(), 1 + Main.rand.Next(Main.rand.Next(1, 6))), 1);
            WR.Add(new LootBoxContents(ModContent.ItemType <EnergizerBattery>(), 1 + Main.rand.Next(Main.rand.Next(1, 8))), 1);
            if (SGAWorld.downedWraiths > 1 && SGAWorld.downedCirno && SGAWorld.GennedVirulent)
            {
                WR.Add(new LootBoxContents(ModContent.ItemType <DivineShower>(), 1 + Main.rand.Next(Main.rand.Next(1, 3))), 1);
            }

            loots.Add(WR.Get());
        }
Пример #4
0
        protected override void OnEnd()
        {
            Started = false;
            if (Main.netMode == NetmodeID.MultiplayerClient)
            {
                return;
            }

            if (rand.elements.Count == 0)
            {
                //TwitchChat.Send("No one was selected to become chat boss");
                //TwitchBoss.Boss = string.Empty;
                //TwitchChat.Post("No one...", Color.White);
                return;
            }


            var t = rand.Get();

            TwitchBoss.Boss = t;

            assignTime = DateTimeOffset.Now;
            TwitchChat.Post($"New boss is @[c/{TwitchChat.TwitchColor}:{TwitchBoss.Boss}]", Color.White);

            if (Main.netMode != NetmodeID.MultiplayerClient)
            {
                TwitchChat.Send(EndString + $" @{TwitchBoss.Boss} you can use " +
                                $"{string.Join(" ", (from s in TwitchBoss.Commands select s.Key))}");
            }

            TwitchChat.Instance.Irc.ChannelMessage -= Handle;
        }
Пример #5
0
        //Fun part :p, Control what goes into the loot box! This is per item
        protected override void FillLootBox(WeightedRandom <LootBoxContents> WR)
        {
            WR.Add(new LootBoxContents(ModContent.ItemType <RustedBulwark>(), 1), 1);
            WR.Add(new LootBoxContents(ModContent.ItemType <MurkyCharm>(), 1), 1);
            WR.Add(new LootBoxContents(ModContent.ItemType <StarCollector>(), 1), 1);
            WR.Add(new LootBoxContents(ModContent.ItemType <EnchantedShieldPolish>(), 1), 1);
            WR.Add(new LootBoxContents(ModContent.ItemType <NormalQuiver>(), 1), 1);
            WR.Add(new LootBoxContents(ModContent.ItemType <MagusSlippers>(), 1), 1);
            WR.Add(new LootBoxContents(ModContent.ItemType <YoyoTricks>(), 1), 1);
            WR.Add(new LootBoxContents(ModContent.ItemType <RingOfRespite>(), 1), 1);
            WR.Add(new LootBoxContents(ModContent.ItemType <ThrowerPouch>(), 1), 1);
            WR.Add(new LootBoxContents(ModContent.ItemType <BlinkTech>(), 1), 1);
            WR.Add(new LootBoxContents(ModContent.ItemType <LifeFlower>(), 1), 1);
            WR.Add(new LootBoxContents(ModContent.ItemType <RestorationFlower>(), 1), 1);
            WR.Add(new LootBoxContents(ModContent.ItemType <GeyserInABottle>(), 1), 1);
            WR.Add(new LootBoxContents(ModContent.ItemType <Jabbawacky>(), 1), 1);
            WR.Add(new LootBoxContents(ModContent.ItemType <AversionCharm>(), 1), 1);
            WR.Add(new LootBoxContents(ModContent.ItemType <CobaltMagnet>(), 1), 1);
            WR.Add(new LootBoxContents(ModContent.ItemType <AmberGlowSkull>(), 1), 1);
            WR.Add(new LootBoxContents(ModContent.ItemType <TwinesOfFate>(), 1), 0.80);
            WR.Add(new LootBoxContents(ModContent.ItemType <HeartOfEntropy>(), 1), 0.75);
            WR.Add(new LootBoxContents(ModContent.ItemType <VoidEmbracers>(), 1), 0.75);
            WR.Add(new LootBoxContents(ModContent.ItemType <Accessories.Charms.TidalCharm>(), 1), 0.75);
            WR.Add(new LootBoxContents(ModContent.ItemType <FluidDisplacer>(), 1), 0.75);
            WR.Add(new LootBoxContents(ModContent.ItemType <FridgeFlamesCanister>(), 1), 0.6);
            WR.Add(new LootBoxContents(ModContent.ItemType <AuraclesInsight>(), 1), 0.80);
            WR.Add(new LootBoxContents(ModContent.ItemType <CobwebRepellent>(), 1), 1);
            WR.Add(new LootBoxContents(ModContent.ItemType <LiquidGambling>(), 1), 1);
            WR.Add(new LootBoxContents(ModContent.ItemType <TerraDivingGear>(), 1), 0.2);

            loots.Add(WR.Get());
        }
Пример #6
0
        public override void NPCLoot(NPC npc)
        {
            EventWorld world = ModContent.GetInstance <EventWorld>();

            if (useTuple)
            {
                if (InvasionList.ContainsKey(npc.type))
                {
                    world.CurrentEvent.TimeLeft -= InvasionList[npc.type].Item2;
                }
            }

            if (Main.netMode == 1)
            {
                return;
            }

            if (IsItemPoolOverrided && ItemPool != null)
            {
                var rand = new WeightedRandom <int>();
                foreach (KeyValuePair <int, float> it in ItemPool)
                {
                    rand.Add(it.Key, it.Value);
                }
                if (rand.random.NextFloat(100) > 55)
                {
                    Item.NewItem(npc.position, npc.Size, rand.Get());
                }
            }
        }
Пример #7
0
        protected override void OnEnd()
        {
            TwitchChat.Instance.Irc.ChannelMessage -= CountVote;

            if (VoteMode != VoteMode.EndAction || Main.netMode == NetmodeID.MultiplayerClient)
            {
                return;
            }

            var votesCount = new SortedDictionary <string, int>();

            foreach (KeyValuePair <string, string> it in Votes)
            {
                if (votesCount.ContainsKey(it.Value))
                {
                    votesCount[it.Value]++;
                }
                else
                {
                    votesCount.Add(it.Value, 1);
                }
            }

            var    bigger = 0;
            string index = "", draftIndex = "";

            foreach (KeyValuePair <string, int> it in votesCount)
            {
                if (it.Value > bigger)
                {
                    bigger     = it.Value;
                    index      = it.Key;
                    draftIndex = "";
                }
                else if (it.Value == bigger)
                {
                    draftIndex = it.Key;
                }
            }


            if (index == draftIndex && index != "")
            {
                var rand = new WeightedRandom <string>();
                rand.Add(index);
                rand.Add(draftIndex);

                index = rand.Get();
            }

            if (index != string.Empty)
            {
                VoteSuggestion[index].Invoke(null);
            }
            else
            {
                TwitchChat.Send("No votes...");
            }
        }
Пример #8
0
 //Fun part :p, Control what goes into the loot box! This is per item
 protected virtual void FillLootBox(WeightedRandom <LootBoxContents> WR)
 {
     WR.Add(new LootBoxContents(ItemID.TwilightDye, 5), 1);
     WR.Add(new LootBoxContents(ItemID.CoinGun, 1), 0.1);
     WR.Add(new LootBoxContents(ItemID.AleThrowingGlove, 1), 0.01);
     WR.Add(new LootBoxContents(ItemID.Handgun, 1), 4);
     loots.Add(WR.Get());
 }
Пример #9
0
        private TownNPCSpawnResult SpawnTownNpcHook(WorldGen.orig_SpawnTownNPC orig, int x, int y)
        {
            //Avoid crush when we not in world
            if (Main.gameMenu)
            {
                return(TownNPCSpawnResult.Blocked);
            }

            TownNPCSpawnResult v = orig?.Invoke(x, y) ?? TownNPCSpawnResult.Blocked;

            if (v != TownNPCSpawnResult.Successful)
            {
                return(v);
            }

            //if game actually spawn new town npc
            TwitchWorld          w = ModContent.GetInstance <TwitchWorld>();
            var                  r = new WeightedRandom <string>();
            IEnumerable <string> l = RecentChatters.Except(w.UsedNicks);

            foreach (var it in l)
            {
                r.Add(it);
            }

            //Then select random nick
            var username = r.Get();

            if (username == string.Empty)
            {
                return(v);
            }

            //Go through shadow array
            for (var i = 0; i < Main.maxNPCs; i++)
            {
                //If this is active town npc and has different typeID what this slot has before
                if (Main.npc[i].active && Main.npc[i].townNPC && ShadowNpc[i] != Main.npc[i].type)
                {
                    //Post a message
                    Post($"But wait, he's actually a [c/{TwitchColor}:{username}]!", Color.White);
                    w.UsedNicks.Add(username);
                    //Add a scheduled action since npc at this moment isn't get reset yet
                    ModContent.GetInstance <EventWorld>().WorldScheduler.AddDelayed(
                        () => { Main.npc[i].GivenName = username; },
                        5);
                    break;
                }
            }

            //Update shadow array
            for (var i = 0; i < Main.npc.Length; i++)
            {
                ShadowNpc[i] = Main.npc[i].type;
            }

            return(v);
        }
Пример #10
0
 //Fun part :p, Control what goes into the loot box! This is per item
 protected override void FillLootBox(WeightedRandom <LootBoxContents> WR)
 {
     WR.Add(new LootBoxContents(ModContent.ItemType <DreadfulChalice>(), 1), 1);
     WR.Add(new LootBoxContents(ModContent.ItemType <DireKunai>(), 1), 1);
     WR.Add(new LootBoxContents(ModContent.ItemType <Nystagmus>(), 1), 1);
     WR.Add(new LootBoxContents(ModContent.ItemType <SentientTetherRemote>(), 1), 1);
     WR.Add(new LootBoxContents(ModContent.ItemType <HorizonStriderAegis>(), 1), 1);
     loots.Add(WR.Get());
 }
Пример #11
0
        public static VitriBuff GetRandomBuff(Item item)
        {
            VitriBuff ret;

            if (WeightedBuffs.elements.Count <= 0)
            {
                BuildWeightedBuffsFor(item);
            }

            ret = WeightedBuffs.Get();

            if (ret != null && !ret.IApplicableTo(item))
            {
                BuildWeightedBuffsFor(item);
                ret = WeightedBuffs.Get();
            }

            return(ret);
        }
Пример #12
0
        public override bool PreNPCLoot(VNPC npc)         // @TODO weighted money rates
        {
            WeightedRandom <double> wr = new WeightedRandom <double>();

            wr.Add(0.5, 30f);
            wr.Add(1, 50f);
            wr.Add(1.5, 15f);
            wr.Add(2, 5f);
            npc.npc.value = (int)(npc.npc.value * wr.Get());
            return(base.PreNPCLoot(npc));
        }
Пример #13
0
        public override string TownNPCName()
        {
            WeightedRandom <string> name = new WeightedRandom <string>();

            name.Add("Harry");
            name.Add("Arnold");
            name.Add("Jerry");
            name.Add("Raiven");
            name.Add("Edison");
            name.Add("Garold");
            return(name.Get());
        }
Пример #14
0
        /// <summary>
        /// Returns the best available camera to frame the target vehicle.
        /// </summary>
        public MountedCamera GetBestCamera(BaseVehicleDriver targetVehicle)
        {
            if (targetVehicle == null)
            {
                return(GetRandomFrontFacingCamera());
            }
#if UNITY_EDITOR
            LookAtVehicle = targetVehicle;
#endif
            RelativeQuadrant quadrant = TrackHelper.GetRelativeQuadrant(targetVehicle, followVehicle);
            return(WeightedRandom.Get(GetQuadrantCameras(quadrant)));
        }
Пример #15
0
        public override string GetChat()
        {
            WeightedRandom <string> chats = new WeightedRandom <string>();

            const int count = 9;

            for (int i = 1; i < count + 1; i++)
            {
                chats.Add(Language.GetTextValue("Mods.PboneUtils.TownChat.MysteriousTrader." + i));
            }

            return(chats.Get());
        }
Пример #16
0
        protected override void FillLootBox(WeightedRandom <LootBoxContents> WR)
        {
            WR.Add(new LootBoxContents(ItemID.InfernoPotion, 1 + Main.rand.Next(Main.rand.Next(2, 15))), 1);
            WR.Add(new LootBoxContents(ItemID.ObsidianSkinPotion, 1 + Main.rand.Next(Main.rand.Next(2, 15))), 1);
            WR.Add(new LootBoxContents(ItemID.LifeforcePotion, 1 + Main.rand.Next(Main.rand.Next(2, 15))), 1);
            WR.Add(new LootBoxContents(ItemID.EndurancePotion, 1 + Main.rand.Next(Main.rand.Next(2, 15))), 1);
            WR.Add(new LootBoxContents(ItemID.TeleportationPotion, 1 + Main.rand.Next(Main.rand.Next(2, 15))), 1);
            WR.Add(new LootBoxContents(ItemID.GravitationPotion, 1 + Main.rand.Next(Main.rand.Next(2, 15))), 1);
            WR.Add(new LootBoxContents(ItemID.SuperHealingPotion, 5 + Main.rand.Next(Main.rand.Next(5, 15))), 0.5);
            WR.Add(new LootBoxContents(ItemID.SuperManaPotion, 5 + Main.rand.Next(Main.rand.Next(5, 15))), 0.5);

            loots.Add(WR.Get());
        }
Пример #17
0
        private Texture2D GetBubble()
        {
            WeightedRandom <Texture2D> wr = new WeightedRandom <Texture2D>(Main.rand);

            wr.Add(possibleBubbleTextures[0], 0.1f);
            wr.Add(possibleBubbleTextures[1], 0.1f);
            wr.Add(possibleBubbleTextures[2], 0.05f);
            wr.Add(possibleBubbleTextures[3], 0.05f);
            wr.Add(possibleBubbleTextures[4], 0.2f);
            wr.Add(possibleBubbleTextures[5], 0.3f);
            wr.Add(possibleBubbleTextures[6], 0.025f);
            wr.Add(possibleBubbleTextures[7], 0.175f);

            return(wr.Get());
        }
Пример #18
0
        // TODO: Add localization support
        public override string TownNPCName()
        {
            WeightedRandom <string> name = new WeightedRandom <string>();

            name.Add("Arne");
            name.Add("Egil");
            name.Add("Gunnar");
            name.Add("Harald");
            name.Add("Hjalmar");
            name.Add("Leif");
            name.Add("Ragnar");
            name.Add("Nisse", 0.5);

            return(name.Get());
        }
Пример #19
0
        protected override void FillLootBox(WeightedRandom <LootBoxContents> WR)
        {
            foreach (int itemtype in Dimensions.DeeperDungeon.CommonItems)
            {
                WR.Add(new LootBoxContents(itemtype, itemtype == ModContent.ItemType <Weapons.Almighty.Megido>() ? Main.rand.Next(8, 17) : 1), 1);
            }
            foreach (int itemtype in Dimensions.DeeperDungeon.RareItems)
            {
                WR.Add(new LootBoxContents(itemtype, 1), 0.25);
            }
            foreach (int itemtype in Dimensions.DeeperDungeon.ShadowItems.Where(testby => testby > ItemID.Count))
            {
                WR.Add(new LootBoxContents(itemtype, 1), 0.40);
            }

            loots.Add(WR.Get());
        }
        public CinematicCamera GetWeightedCamera()
        {
            CinematicShotType randomShotType = WeightedRandom.Get(shotWeights);

            switch (randomShotType)
            {
            default:
            case CinematicShotType.Level: {
                // Get a mounted camera if there are no level cameras available.
                return(GetWeightedLevelCamera() ?? GetBestMountedCamera(WorldObjectManager.Instance.PlayerDriver, null));
            }

            case CinematicShotType.Mounted: {
                return(GetBestMountedCamera(WorldObjectManager.Instance.PlayerDriver, null));
            }
            }
        }
Пример #21
0
 protected override void FillLootBox(WeightedRandom <LootBoxContents> WR)
 {
     WR.Add(new LootBoxContents(ItemID.PaladinsShield, 1));
     WR.Add(new LootBoxContents(ItemID.CellPhone, 1));
     WR.Add(new LootBoxContents(ItemID.CosmicCarKey, 1));
     WR.Add(new LootBoxContents(ItemID.TerraBlade, 1));
     WR.Add(new LootBoxContents(ItemID.SnowmanCannon, 1));
     WR.Add(new LootBoxContents(ItemID.BlizzardStaff, 1));
     WR.Add(new LootBoxContents(ItemID.DefenderMedal, 50), 1);
     WR.Add(new LootBoxContents(ItemID.ReindeerBells, 1));
     WR.Add(new LootBoxContents(ItemID.PaladinsShield, 1));
     WR.Add(new LootBoxContents(ItemID.DefendersForge, 1));
     WR.Add(new LootBoxContents(ItemID.FireGauntlet, 1));
     WR.Add(new LootBoxContents(ItemID.DestroyerEmblem, 1));
     WR.Add(new LootBoxContents(ItemID.CelestialShell, 1));
     WR.Add(new LootBoxContents(ItemID.AnkhShield, 1));
     loots.Add(WR.Get());
 }
Пример #22
0
        public override string GetChat()
        {
            WeightedRandom <string> text = new WeightedRandom <string>(Main.rand);

            text.Add("Science rules!");
            text.Add("Inertia is a property of matter.");
            text.Add("Consider the following: buying from my shop!");
            text.Add("What? No, I'm not going to talk about that. Science is about solving problems, not about discussing philosophy!");

            int wizard = NPC.FindFirstNPC(NPCID.Wizard);

            if (wizard >= 0 && Main.rand.NextBool(4))
            {
                text.Add($"Can you tell {Main.npc[wizard].GivenName} to stop giving me his weird potions?");
            }

            int guide = NPC.FindFirstNPC(NPCID.Guide);

            if (guide >= 0 && NPC.downedBoss3 && !Main.hardMode && Main.rand.NextBool(4))
            {
                text.Add($"Hmm... {Main.npc[guide].GivenName} seems distressed about something. I wonder what it could be?");
            }

            int witchDoctor = NPC.FindFirstNPC(NPCID.WitchDoctor);

            if (witchDoctor >= 0 && Main.rand.NextBool(4))
            {
                text.Add($"I keep trying to tell {Main.npc[witchDoctor].GivenName} that I don't believe his voodoo mumbo-jumbo, but he just won't seem to listen!");
            }

            int barkeep = NPC.FindFirstNPC(NPCID.DD2Bartender);

            if (barkeep >= 0 && Main.rand.NextBool(4))
            {
                text.Add("There has to be some sort of scientific reason behind the portals created by the Old One's Army, there just has to be!  I refuse to believe that it's magic!");
            }

            if (Main.LocalPlayer.HasItem(ItemID.PortalGun))
            {
                text.Add("That's an interesting... tool you've got there.  From Apple-ture Labs you say?  Now that's thinking with portals!");
            }

            return(text.Get());
        }
Пример #23
0
        /// <summary>
        /// Performs a mod prefix roll. If the vanillaWeight wins the roll, then prefix is unchanged.
        /// </summary>
        internal static void Roll(Item item, ref int prefix, int vanillaWeight, params PrefixCategory[] categories)
        {
            WeightedRandom <byte> wr = new WeightedRandom <byte>();

            foreach (PrefixCategory category in categories)
            {
                foreach (ModPrefix modPrefix in categoryPrefixes[category].Where(x => x.CanRoll(item)))
                {
                    wr.Add(modPrefix.Type, modPrefix.RollChance(item));
                }
            }

            if (vanillaWeight > 0)
            {
                wr.Add((byte)prefix, vanillaWeight);
            }

            prefix = wr.Get();
        }
Пример #24
0
        void teleport()
        {
            float rot = npc.rotation + MathHelper.Pi / 2f;
            WeightedRandom <Vector2> options = new WeightedRandom <Vector2>();

            for (int i = 0; i < 16; i++)
            {
                Vector2 unit = new Vector2(4, 0).RotatedBy(rot + Main.rand.NextFloat(-0.05f, 0.05f));
                Vector2 pos  = GetLoSLength(Main.player[npc.target].Center, new Point(8, 8), unit, new Point(8, 8), 75, out int length);
                pos -= unit * (length < 75 ? 4 : 1);
                if (length >= 32)
                {
                    options.Add(pos, length * Main.rand.NextFloat(0.9f, 1.1f));
                    //Main.npc[NPC.NewNPC((int)pos.X,(int)pos.Y,NPCID.WaterSphere)].velocity = Vector2.Zero; //accidental miniboss if no velocity change
                }
                rot += MathHelper.Pi / 16f;
            }
            if (options.elements.Count == 0)
            {
                for (int i = 0; i < 16; i++)
                {
                    Vector2 unit = new Vector2(4, 0).RotatedBy(rot + Main.rand.NextFloat(-0.05f, 0.05f));
                    Vector2 pos  = GetLoSLength(Main.player[npc.target].Center, new Point(8, 8), unit, new Point(8, 8), 75, out int length);
                    pos -= unit * (length < 75 ? 4 : 1);
                    if (length >= 24)
                    {
                        options.Add(pos, length * Main.rand.NextFloat(0.9f, 1.1f));
                        //Main.npc[NPC.NewNPC((int)pos.X,(int)pos.Y,NPCID.WaterSphere)].velocity = Vector2.Zero;
                    }
                    rot += MathHelper.Pi / 16f;
                }
            }
            if (options.elements.Count == 0)
            {
                //npc.active = false;
                return;
            }
            npc.Center = options.Get();
        }
Пример #25
0
        protected override void FillLootBox(WeightedRandom <LootBoxContents> WR)
        {
            WR.Add(new LootBoxContents(ItemID.RegenerationPotion, 1 + Main.rand.Next(Main.rand.Next(2, 15))), 1);
            WR.Add(new LootBoxContents(ItemID.SwiftnessPotion, 1 + Main.rand.Next(Main.rand.Next(2, 15))), 1);
            WR.Add(new LootBoxContents(ItemID.IronskinPotion, 1 + Main.rand.Next(Main.rand.Next(2, 15))), 1);
            WR.Add(new LootBoxContents(ItemID.WrathPotion, 1 + Main.rand.Next(Main.rand.Next(2, 15))), 1);
            WR.Add(new LootBoxContents(ItemID.RagePotion, 1 + Main.rand.Next(Main.rand.Next(2, 15))), 1);
            WR.Add(new LootBoxContents(ItemID.TitanPotion, 1 + Main.rand.Next(Main.rand.Next(2, 15))), 1);
            WR.Add(new LootBoxContents(ItemID.SummoningPotion, 1 + Main.rand.Next(Main.rand.Next(2, 15))), 1);
            WR.Add(new LootBoxContents(ItemID.FishingPotion, 1 + Main.rand.Next(Main.rand.Next(2, 15))), 1);
            WR.Add(new LootBoxContents(ItemID.CratePotion, 1 + Main.rand.Next(Main.rand.Next(2, 15))), 1);
            WR.Add(new LootBoxContents(ItemID.ThornsPotion, 1 + Main.rand.Next(Main.rand.Next(2, 15))), 1);
            WR.Add(new LootBoxContents(ItemID.HeartreachPotion, 1 + Main.rand.Next(Main.rand.Next(2, 15))), 1);
            WR.Add(new LootBoxContents(ItemID.InvisibilityPotion, 1 + Main.rand.Next(Main.rand.Next(2, 15))), 1);
            WR.Add(new LootBoxContents(ItemID.WarmthPotion, 1 + Main.rand.Next(Main.rand.Next(2, 15))), 1);
            WR.Add(new LootBoxContents(ItemID.ArcheryPotion, 1 + Main.rand.Next(Main.rand.Next(2, 15))), 1);
            WR.Add(new LootBoxContents(ItemID.AmmoReservationPotion, 1 + Main.rand.Next(Main.rand.Next(2, 15))), 1);
            WR.Add(new LootBoxContents(ItemID.FlipperPotion, 1 + Main.rand.Next(Main.rand.Next(2, 15))), 1);

            WR.Add(new LootBoxContents(ItemID.GreaterHealingPotion, 5 + Main.rand.Next(Main.rand.Next(5, 15))), 0.5);
            WR.Add(new LootBoxContents(ItemID.GreaterManaPotion, 5 + Main.rand.Next(Main.rand.Next(5, 15))), 0.5);

            loots.Add(WR.Get());
        }
Пример #26
0
 public override string GetChat()
 => _chats.Get();
Пример #27
0
 public override string TownNPCName()
 => _names.Get();
Пример #28
0
        public int getSwordType()
        {
            WeightedRandom <int> swords = new WeightedRandom <int>();

            swords.Add(ItemID.CopperShortsword);
            swords.Add(ItemID.TinShortsword);
            swords.Add(ItemID.WoodenSword);
            swords.Add(ItemID.BorealWoodSword);
            swords.Add(ItemID.CopperBroadsword);
            swords.Add(ItemID.IronShortsword);
            swords.Add(ItemID.PalmWoodSword);
            swords.Add(ItemID.RichMahoganySword);
            swords.Add(ItemID.CactusSword);
            swords.Add(ItemID.LeadShortsword);
            swords.Add(ItemID.SilverShortsword);
            swords.Add(ItemID.TinShortsword);
            swords.Add(ItemID.EbonwoodSword);
            swords.Add(ItemID.IronBroadsword);
            swords.Add(ItemID.ShadewoodSword);
            swords.Add(ItemID.TungstenShortsword);
            swords.Add(ItemID.GoldShortsword);
            swords.Add(ItemID.LeadBroadsword);
            swords.Add(ItemID.SilverBroadsword);
            swords.Add(ItemID.TungstenBroadsword);
            swords.Add(ItemID.ZombieArm);
            swords.Add(ItemID.GoldBroadsword);
            swords.Add(ItemID.PlatinumShortsword);
            swords.Add(ItemID.AntlionClaw);
            swords.Add(ItemID.StylistKilLaKillScissorsIWish);
            swords.Add(ItemID.PlatinumBroadsword);
            swords.Add(ItemID.BoneSword);
            swords.Add(ItemID.CandyCaneSword);
            swords.Add(ItemID.Katana);
            swords.Add(ItemID.IceBlade);
            swords.Add(ItemID.LightsBane);
            swords.Add(ItemID.Muramasa);
            swords.Add(ItemID.Arkhalis);
            swords.Add(ItemID.DyeTradersScimitar);
            swords.Add(ItemID.BluePhaseblade);
            swords.Add(ItemID.GreenPhaseblade);
            swords.Add(ItemID.PurplePhaseblade);
            swords.Add(ItemID.RedPhaseblade);
            swords.Add(ItemID.WhitePhaseblade);
            swords.Add(ItemID.YellowPhaseblade);
            swords.Add(ItemID.BloodButcherer);
            swords.Add(ItemID.Starfury);
            swords.Add(ItemID.EnchantedSword);
            swords.Add(ItemID.PurpleClubberfish);
            swords.Add(ItemID.BeeKeeper);
            swords.Add(ItemID.FalconBlade);
            swords.Add(ItemID.BladeofGrass);
            swords.Add(ItemID.FieryGreatsword);
            swords.Add(ItemID.BluePhasesaber);
            swords.Add(ItemID.GreenPhasesaber);
            swords.Add(ItemID.PurplePhasesaber);
            swords.Add(ItemID.RedPhasesaber);
            swords.Add(ItemID.WhitePhasesaber);
            swords.Add(ItemID.YellowPhasesaber);
            swords.Add(ItemID.NightsEdge);

            swords.Add(ItemID.PearlwoodSword);
            swords.Add(ItemID.TaxCollectorsStickOfDoom);
            swords.Add(ItemID.SlapHand);
            swords.Add(ItemID.BreakerBlade);
            swords.Add(ItemID.CobaltSword);
            swords.Add(ItemID.PalladiumSword);
            swords.Add(ItemID.MythrilSword);
            swords.Add(ItemID.OrichalcumSword);
            swords.Add(ItemID.ChlorophyteSaber);
            swords.Add(ItemID.Cutlass);
            swords.Add(ItemID.Frostbrand);
            swords.Add(ItemID.AdamantiteSword);
            swords.Add(ItemID.Seedler);
            swords.Add(ItemID.BeamSword);
            swords.Add(ItemID.TitaniumSword);
            swords.Add(ItemID.Bladetongue);
            swords.Add(ItemID.Excalibur);

            swords.Add(ItemID.Spear);
            swords.Add(ItemID.Trident);
            swords.Add(ItemID.TheRottedFork);
            swords.Add(ItemID.Swordfish);
            swords.Add(ItemID.DarkLance);
            swords.Add(ItemID.CobaltNaginata);
            swords.Add(ItemID.PalladiumPike);
            swords.Add(ItemID.MythrilHalberd);
            swords.Add(ItemID.OrichalcumHalberd);
            swords.Add(ItemID.AdamantiteGlaive);
            swords.Add(ItemID.TitaniumTrident);
            swords.Add(ItemID.Gungnir);
            swords.Add(ItemID.ChlorophytePartisan);
            swords.Add(ItemID.MushroomSpear);
            swords.Add(ItemID.ObsidianSwordfish);
            swords.Add(ItemID.NorthPole);

            swords.Add(ItemID.ScourgeoftheCorruptor);
            swords.Add(ItemID.DayBreak);

            swords.Add(ItemID.SkyFracture);

            swords.Add(ItemID.WarAxeoftheNight);
            swords.Add(ItemID.BloodLustCluster);
            swords.Add(ItemID.FleshGrinder);
            swords.Add(ItemID.TheBreaker);

            swords.Add(ItemID.Hammush);
            swords.Add(ItemID.CobaltWaraxe);

            return(swords.Get());
        }
Пример #29
0
 public override string GetChat()
 => Name == "Hodor" ? Name : _chats.Get();
 public CinematicCamera GetRandomStuntCamera()
 {
     return(WeightedRandom.Get(stuntCameras.ToArray()));
 }