예제 #1
0
        public override bool Shoot(Player player, ref Vector2 pos, ref float velX, ref float velY, ref int type, ref int dmg,
                                   ref float kb)
        {
            Vector2 worldMousePos = new Vector2(Main.mouseX, Main.mouseY) + Main.screenPosition;
            int     worldX        = (int)worldMousePos.X;
            int     worldY        = (int)worldMousePos.Y;
            ushort  tileX         = (ushort)(worldX / 16);
            ushort  tileY         = (ushort)(worldY / 16);
            Color?  dustColor     = null;

            if (this.IsCopying)
            {
                if (!this.AttemptCopyColorAt(player, tileX, tileY))
                {
                    Main.NewText("No color found to copy from.", Color.Yellow);
                }

                this.IsCopying = false;
            }
            else
            {
                Item paintItem = this.GetCurrentPaintItem();

                if (paintItem != null)
                {
                    if (PaintBlasterHelpers.GetPaintAmount(paintItem) <= 0)
                    {
                        if (this.SwitchToNextMatchingNonemptyPaint())
                        {
                            paintItem = this.GetCurrentPaintItem();
                        }
                        else
                        {
                            paintItem = null;
                        }
                    }

                    if (paintItem != null)
                    {
                        Color paintColor = PaintBlasterHelpers.GetPaintColor(paintItem);

                        if (this.HasMatchingPaintAt(paintColor, tileX, tileY))
                        {
                            dustColor = paintColor;
                        }
                    }
                }
            }

            if (this.BufferedPaintUses > 0 && dustColor != null)
            {
                this.BufferedPaintUses = 0f;

                pos = PlayerItemHelpers.TipOfHeldItem(player) - Main.screenPosition;
                Dust.NewDust(pos, 8, 8, 2, velX, velY, 0, (Color)dustColor, 1f);
            }

            return(false);
        }
예제 #2
0
        ////////////////

        public override bool PreItemCheck()
        {
            if (this.player.itemAnimation > 0)
            {
                Item heldItem = this.player.HeldItem;

                if (heldItem.type == ModContent.ItemType <CrossDimensionalAggregatorItem>())
                {
                    Vector2 pos = PlayerItemHelpers.TipOfHeldItem(this.player);
                    Dust.NewDust(pos, heldItem.width, heldItem.height, 15, 0, 0, 150, Main.DiscoColor, 1.2f);
                }
            }

            return(base.PreItemCheck());
        }
예제 #3
0
        ////////////////

        public void RenderRodCastFX(Player player)
        {
            var     mymod     = (DowsingMod)this.mod;
            Vector2 pos       = PlayerItemHelpers.TipOfHeldItem(player);
            int     particles = Math.Max(2, ((mymod.Config.Data.MaxDowsingRangeInTiles / 3) - this.CurrentBeamTravelDistance) / 2);
            int     dust_type = 264;

            for (int i = 0; i < particles; i++)
            {
                var dust = Dust.NewDustDirect(pos, 1, 1, dust_type, 0f, 0f, 0, Color.YellowGreen, 0.8f);
                dust.noGravity = true;
                dust.noLight   = true;
                dust.fadeIn    = 0.8f;
            }

            if ((mymod.DEBUGFLAGS & 1) != 0)
            {
                DebugHelpers.Print("cast from", "particles: " + particles + ", dist: " + this.CurrentBeamTravelDistance, 20);
            }
        }