示例#1
0
        public static ProceduralSword NewSword(Mod mod, Vector2 position, SwordHilt hilt, SwordBlade blade, SwordAccent accent, float dps, int enemyDef)
        {
            if (hilt == null)
            {
                kRPG.LogMessage("Ummm....  Why is the hilt null?");
            }
            if (blade == null)
            {
                kRPG.LogMessage("Ummm....  Why is the blade null?");
            }

            int             id    = Item.NewItem(position, mod.GetItem("ProceduralSword").item.type);
            ProceduralSword sword = (ProceduralSword)Main.item[id].modItem;

            sword.Hilt     = hilt;
            sword.Blade    = blade;
            sword.Accent   = accent;
            sword.Dps      = dps;
            sword.EnemyDef = enemyDef;
            sword.Initialize();

            SwordInitPacket.Write(id, blade.Type, hilt.Type, accent.Type, dps, enemyDef);

            return(sword);
        }
示例#2
0
        public static void Initialize()
        {
            Accents = new Dictionary <int, SwordAccent>();

            None   = new SwordAccent(null, "", 0, 0);
            GemRed = new SwordAccent("GemRed", " of Rejuvenation", 2, 2, 2, delegate(Player player, NPC npc, ProceduralSword sword, int damage, bool crit)
            {
                if (Main.rand.Next(4) != 0)
                {
                    return;
                }
                PlayerCharacter character = player.GetModPlayer <PlayerCharacter>();
                float distance            = Vector2.Distance(npc.Center, character.player.Center);
                int count   = (int)(distance / 20);
                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);
                    }
                })
                {
                    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(5) + 3;
                player.statLife += healAmount;
                player.HealEffect(healAmount);
            });
            Flame = new SwordAccent("Flame", " of Ignition", 2, 2, 3, delegate(Player player, NPC npc, ProceduralSword sword, int damage, bool crit)
            {
                //Main.PlaySound(new LegacySoundStyle(2, 14).WithVolume(0.5f), player.Center);
                SoundManager.PlaySound(Sounds.LegacySoundStyle_Item14, player.Center, .5f);
                Projectile proj = Main.projectile[Projectile.NewProjectile(npc.Center - new Vector2(16, 32), Vector2.Zero, ModContent.ProjectileType <Explosion>(), Math.Max(1, (int)Math.Round(sword.EleDamage[Element.Fire] * damage * 2)), 0f, player.whoAmI)];
            }, 1.05f).SetEleDamage(new Dictionary <Element, float> {
                { Element.Fire, 0.2f }, { Element.Cold, 0f }, { Element.Lightning, 0f }, { Element.Shadow, 0f }
            })
                    .SetEffect(delegate(Rectangle rect, Player player)
            {
                if (Main.rand.Next(2) != 0)
                {
                    return;
                }
                int dust = Dust.NewDust(new Vector2(rect.X, rect.Y), rect.Width, rect.Height, DustID.Fire, player.velocity.X * 0.2f + player.direction * 3f, player.velocity.Y * 0.2f, 63, new Color(), 1.5f);
                Main.dust[dust].noGravity = true;
            });
            GemGreen = new SwordAccent("GemGreen", " of Thunder", 2, 2, 2, delegate(Player player, NPC npc, ProceduralSword sword, int damage, bool crit)
            {
                //Main.PlaySound(new LegacySoundStyle(2, 14).WithVolume(0.5f), player.Center);
                SoundManager.PlaySound(Sounds.LegacySoundStyle_Item14, player.Center, .5f);
                Projectile proj = Main.projectile[Projectile.NewProjectile(npc.Center - new Vector2(24, 48), Vector2.Zero, ModContent.ProjectileType <SmokePellets>(), Math.Max(1, damage / 6), 0f, player.whoAmI)];
            }, 1.1f, 4).SetEleDamage(new Dictionary <Element, float>
            {
                { Element.Fire, 0f }, { Element.Cold, 0f }, { Element.Lightning, 0.2f }, { Element.Shadow, 0f }
            })
                       .SetEffect(delegate(Rectangle rect, Player player)
            {
                if (Main.rand.Next(2) != 0)
                {
                    return;
                }
                int dust = Dust.NewDust(new Vector2(rect.X, rect.Y), rect.Width, rect.Height, DustID.Electric,
                                        player.velocity.X * 0.2f + player.direction * 3f,
                                        player.velocity.Y * 0.2f, 63, new Color(), 0.5f);
                Main.dust[dust].noGravity = true;
            });
            GemBlue = new SwordAccent("GemBlue", " of Everest", 2, 2, 0, null, 1.15f, 0, delegate(Rectangle rect, Player player)
            {
                if (Main.rand.Next(3) == 0)
                {
                    int dust = Dust.NewDust(new Vector2(rect.X, rect.Y), rect.Width, rect.Height, ModContent.GetInstance <Ice>().Type,
                                            player.velocity.X * 0.2f + player.direction * 3f, player.velocity.Y * 0.2f, 100, new Color(), 1.5f);
                    Main.dust[dust].noGravity = true;
                }

                Lighting.AddLight(rect.Center(), 0f, 0.4f, 1f);
            }).SetEleDamage(new Dictionary <Element, float> {
                { Element.Fire, 0f }, { Element.Cold, 0.3f }, { Element.Lightning, 0f }, { Element.Shadow, 0f }
            });
            GemPurple = new SwordAccent("GemPurple", " of Starlight", 2, 1, 3, null, 1.1f).SetEffect(delegate(Rectangle rect, Player player)
            {
                if (Main.rand.Next(2) != 0)
                {
                    return;
                }
                int dust = Dust.NewDust(new Vector2(rect.X, rect.Y), rect.Width, rect.Height, 27, player.velocity.X * 0.2f + player.direction * 3f,
                                        player.velocity.Y * 0.2f, 63, new Color(), 1.5f);
                Main.dust[dust].noGravity = true;
            });
        }
示例#3
0
        public static Item GenerateSword(Mod mod, Vector2 position, SwordTheme theme, float dps, int enemyDef)
        {
            ProceduralSword sword = NewSword(mod, position, SwordHilt.RandomHilt(theme), SwordBlade.RandomBlade(theme), Main.rand.Next(5) < 3 ? SwordAccent.RandomAccent() : SwordAccent.None, dps, enemyDef);

            return(sword.item);
        }