Example #1
0
        public static ProceduralSword NewSword(Mod mod, Vector2 position, SwordHilt hilt, SwordBlade blade, SwordAccent accent, float dps, int enemyDef)
        {
            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();
            if (Main.netMode == 2)
            {
                ModPacket packet = mod.GetPacket();
                packet.Write((byte)Message.SwordInit);
                packet.Write(id);
                packet.Write(blade.type);
                packet.Write(hilt.type);
                packet.Write(accent.type);
                packet.Write(dps);
                packet.Write(enemyDef);
                packet.Send();
            }
            return(sword);
        }
Example #2
0
        public override ModItem Clone(Item item)
        {
            ProceduralSword copy = (ProceduralSword)base.Clone(item);

            copy.hilt      = hilt;
            copy.blade     = blade;
            copy.accent    = accent;
            copy.dps       = dps;
            copy.enemyDef  = enemyDef;
            copy.spear     = spear;
            copy.eleDamage = new Dictionary <ELEMENT, float>();
            foreach (ELEMENT element in Enum.GetValues(typeof(ELEMENT)))
            {
                copy.eleDamage[element] = eleDamage[element];
            }
            copy.item.SetNameOverride(item.Name);
            return(copy);
        }