public static Item GenerateStaff(Mod mod, Vector2 position, StaffTheme theme, float dps, int enemyDef) { ProceduralStaff staff = DropStaff(mod, position, Staff.RandomStaff(theme), StaffGem.RandomGem(theme), Main.rand.Next(3) < 2 ? StaffOrnament.RandomOrnament(theme) : StaffOrnament.None, dps, enemyDef); return(staff.item); }
public static void Initialize() { Ornament = new Dictionary <int, StaffOrnament>(); None = new StaffOrnament(null, 0, 0, ""); Bow = new StaffOrnament("Bow", 4, 3, " of Wizardry", false, 1.1f, 1.1f, 1.1f, 1f, 5); Twig = new StaffOrnament("Twig", 2, 7, " of Longevity", true, 1.3f, 1f, 0.9f, 1f).SetEffect( delegate(Player player, NPC npc, Item item, int damage, bool crit) { PlayerCharacter character = player.GetModPlayer <PlayerCharacter>(); float distance = Vector2.Distance(npc.Center, character.player.Center); int count = (int)(distance / 32); Trail trail = new Trail(npc.Center, 60, delegate(SpriteBatch spriteBatch, Player p, Vector2 end, Vector2[] displacement, float scale) { for (int i = 0; i < count; i += 1) { Vector2 position = (npc.position - p.Center) * i / count + p.Center; spriteBatch.Draw(GFX.GFX.Heart, position - Main.screenPosition + displacement[i], null, Color.White, 0f, Vector2.Zero, scale, SpriteEffects.None, 0f); } }); trail.Displacement = new Vector2[count]; for (int i = 0; i < count; i += 1) { trail.Displacement[i] = new Vector2(Main.rand.NextFloat(-1f, 1f), Main.rand.NextFloat(-1f, 1f)); } character.Trails.Add(trail); int healAmount = Main.rand.Next(4) + 2; player.statLife += healAmount; player.HealEffect(healAmount); }); Loop = new StaffOrnament("Loop", 0, 6, " of Reverberation", true, 1.5f, 1.2f, 1.5f, 0f, 0, 1); Arcane = new StaffOrnament("ArcaneSpider", 7, 8, " of Articulation", true, 1.1f, 1.2f); Cage = new StaffOrnament("ArcaneCage", 3, 10, " of Resonance", true, 2f, 1f, 3, 0f, 0, 2); Demonic = new StaffOrnament("Demonic", 8, 6, " of Demons", true, 1.5f, 1.2f, 1.5f, 0, 2, 1); Explosive = new StaffOrnament("Explosive", 6, 4, " of Blasting", false, 1.2f, 0.9f, 0.9f).SetEffect( delegate(Player player, NPC npc, Item item, int damage, bool crit) { SoundManager.PlaySound(Sounds.LegacySoundStyle_Item14, player.Center, .5f); //Main.PlaySound(new LegacySoundStyle(2, 14).WithVolume(0.5f), player.Center); Projectile proj = Main.projectile[ Projectile.NewProjectile(npc.Center - new Vector2(16, 32), Vector2.Zero, ModContent.ProjectileType <Explosion>(), damage / 2, 0f, player.whoAmI)]; }); OrnamentByTheme = new Dictionary <StaffTheme, List <StaffOrnament> > { { StaffTheme.Wooden, new List <StaffOrnament> { Bow, Twig, Loop } }, { StaffTheme.Dungeon, new List <StaffOrnament> { Arcane, Cage } }, { StaffTheme.Underworld, new List <StaffOrnament> { Demonic, Explosive } } }; }
public static ProceduralStaff DropStaff(Mod mod, Vector2 position, Staff staffStaff, StaffGem staffGem, StaffOrnament staffOrnament, float dps, int enemyDef) { int id = Item.NewItem(position, mod.GetItem("ProceduralStaff").item.type); ProceduralStaff staff = (ProceduralStaff)Main.item[id].modItem; staff.Staff = staffStaff; staff.Gem = staffGem; staff.Ornament = staffOrnament; staff.Dps = dps; staff.EnemyDef = enemyDef; staff.Initialize(); StaffInitPacket.Write(id, staffStaff.Type, staffGem.Type, staffOrnament.Type, dps, enemyDef); return(staff); }