public override ModItem Clone(Item item) { RangedWeapon copy = (RangedWeapon)base.Clone(item); copy.dps = dps; copy.name = name; copy.enemyDef = enemyDef; copy.item.SetNameOverride(item.Name); return(copy); }
public static int NewRangedWeapon(Mod mod, Vector2 position, int npclevel, int playerlevel, float dps, int enemyDef) { int combined = npclevel + playerlevel; int ammo = 0; string weapon = ""; if (combined >= 35) { switch (Main.rand.Next(5)) { default: weapon = "AngelBow"; ammo = ItemID.WoodenArrow; break; case 1: weapon = "DemonBow"; ammo = ItemID.WoodenArrow; break; case 2: weapon = "Kalashnikov"; ammo = ItemID.MusketBall; break; case 3: weapon = "M16"; ammo = ItemID.MusketBall; break; case 4: weapon = "Microgun"; ammo = ItemID.MusketBall; break; } } else { switch (Main.rand.Next(4)) { default: weapon = "Longbow"; ammo = ItemID.WoodenArrow; break; case 1: weapon = "GoldenPistol"; ammo = ItemID.MusketBall; break; case 2: weapon = "WoodenBow"; ammo = ItemID.WoodenArrow; break; case 3: weapon = "NambuPistol"; ammo = ItemID.MusketBall; break; } } RangedWeapon item = (RangedWeapon)Main.item[Item.NewItem(position, mod.ItemType(weapon))].modItem; item.dps = dps; item.enemyDef = enemyDef; item.Initialize(); if (Main.netMode == 2) { ModPacket packet = mod.GetPacket(); packet.Write((byte)Message.BowInit); packet.Write(item.item.whoAmI); packet.Write(item.dps); packet.Write(item.enemyDef); packet.Send(); } return(ammo); }