Esempio n. 1
0
        public override void ReceiveExtraAI(BinaryReader reader)
        {
            projectile.owner = reader.ReadInt32();
            int starType  = reader.ReadInt32();
            int crossType = reader.ReadInt32();
            int moonType  = reader.ReadInt32();

            projectile.damage = reader.ReadInt32();
            bool minionCaster = reader.ReadBoolean();

            Caster = minionCaster ? Main.projectile[reader.ReadInt32()] : (Entity)Main.player[reader.ReadInt32()];
            List <GlyphModifier> modifiers = new List <GlyphModifier>();
            int count = reader.ReadInt32();

            for (int i = 0; i < count; i += 1)
            {
                modifiers.Add(GlyphModifier.Modifiers[reader.ReadInt32()]);
            }
            if (Source == null)
            {
                Source = new ProceduralSpell(mod);
                Source.Glyphs[(byte)GlyphType.Star].SetDefaults(starType, true);
                Source.Glyphs[(byte)GlyphType.Cross].SetDefaults(crossType, true);
                Source.Glyphs[(byte)GlyphType.Moon].SetDefaults(moonType, true);
                Source.ModifierOverride = modifiers;
            }

            foreach (Item item in Source.Glyphs)
            {
                Glyph glyph = (Glyph)item.modItem;
                if (glyph.GetAiAction() != null)
                {
                    Ai.Add(glyph.GetAiAction());
                }
                if (glyph.GetInitAction() != null)
                {
                    Inits.Add(glyph.GetInitAction());
                }
                if (glyph.GetImpactAction() != null)
                {
                    Impacts.Add(glyph.GetImpactAction());
                }
                if (glyph.GetKillAction() != null)
                {
                    Kills.Add(glyph.GetKillAction());
                }
            }

            foreach (GlyphModifier modifier in modifiers)
            {
                if (modifier.Impact != null)
                {
                    Impacts.Add(modifier.Impact);
                }
                if (modifier.Draw != null)
                {
                    SpellDraw.Add(modifier.Draw);
                }
                if (modifier.Init != null)
                {
                    Inits.Add(modifier.Init);
                }
            }

            Initialize();
        }
        public override void ReceiveExtraAI(BinaryReader reader)
        {
            projectile.owner = reader.ReadInt32();
            int startype  = reader.ReadInt32();
            int crosstype = reader.ReadInt32();
            int moontype  = reader.ReadInt32();

            projectile.damage = reader.ReadInt32();
            bool minion_caster = reader.ReadBoolean();

            caster = minion_caster ? (Entity)Main.projectile[reader.ReadInt32()] : (Entity)Main.player[reader.ReadInt32()];
            List <GlyphModifier> modifiers = new List <GlyphModifier>();
            int count = reader.ReadInt32();

            for (int i = 0; i < count; i += 1)
            {
                modifiers.Add(GlyphModifier.modifiers[reader.ReadInt32()]);
            }
            if (source == null)
            {
                source = new ProceduralSpell(mod);
                source.glyphs[(byte)GLYPHTYPE.STAR].SetDefaults(startype, true);
                source.glyphs[(byte)GLYPHTYPE.CROSS].SetDefaults(crosstype, true);
                source.glyphs[(byte)GLYPHTYPE.MOON].SetDefaults(moontype, true);
                source.modifierOverride = modifiers;
            }
            foreach (Item item in source.glyphs)
            {
                Glyph glyph = (Glyph)item.modItem;
                if (glyph.GetAIAction() != null)
                {
                    ai.Add(glyph.GetAIAction());
                }
                if (glyph.GetInitAction() != null)
                {
                    init.Add(glyph.GetInitAction());
                }
                if (glyph.GetImpactAction() != null)
                {
                    impact.Add(glyph.GetImpactAction());
                }
                if (glyph.GetKillAction() != null)
                {
                    kill.Add(glyph.GetKillAction());
                }
            }
            foreach (GlyphModifier modifier in modifiers)
            {
                if (modifier.impact != null)
                {
                    impact.Add(modifier.impact);
                }
                if (modifier.draw != null)
                {
                    draw.Add(modifier.draw);
                }
                if (modifier.init != null)
                {
                    init.Add(modifier.init);
                }
            }
            Initialize();
        }