public RenderParameters()
 {
     WireFrame = false;
     TessellationFactor = 1f;
     Textured = false;
     FlatShading = false;
     DisplayNormals = false;
     Camera = new Camera();
     Lighting = new Lighting();
 }
 public void Update()
 {
     Lighting.AddLight(this._position, 0.4f, 0.2f, 0.9f);
     this.SpawnReturnPortalDust();
 }
示例#3
0
 public override void AI()
 {
     projectile.rotation = projectile.velocity.ToRotation();
     Lighting.AddLight(projectile.Center, 0.94f, 0.40f, 0.15f);
 }
示例#4
0
 public override void PostUpdate()
 {
     Lighting.AddLight(item.Center, Main.DiscoColor.ToVector3() * 0.55f * Main.essScale);
 }
示例#5
0
        public override void AI()
        {
            if (!initialised)
            {
                initialise();
            }
            SpinIncrease       += 0.001f;
            radius             += 2.0f;
            spin               += SpinIncrease;
            projectile.position = (basePosition - new Vector2(projectile.width / 2, projectile.height / 2)) + spin.ToRotationVector2() * radius;

            if (!projectile.Name.Contains("Nebula"))
            {
                projectile.rotation = 0f;
                projectile.frameCounter++;
                int frame = 2;
                if (projectile.frameCounter < frame)
                {
                    projectile.frame = 0;
                }
                else if (projectile.frameCounter < frame * 2)
                {
                    projectile.frame = 1;
                }
                else if (projectile.frameCounter < frame * 3)
                {
                    projectile.frame = 2;
                }
                else if (projectile.frameCounter < frame * 4)
                {
                    projectile.frame = 3;
                }
                else if (projectile.frameCounter < frame * 5)
                {
                    projectile.frame = 4;
                }
                else if (projectile.frameCounter < frame * 6)
                {
                    projectile.frame = 3;
                }
                else if (projectile.frameCounter < frame * 7)
                {
                    projectile.frame = 2;
                }
                else if (projectile.frameCounter < frame * 8 - 1)
                {
                    projectile.frame = 1;
                }
                else
                {
                    projectile.frame        = 1;
                    projectile.frameCounter = 0;
                }

                int   dustType = 6;
                Color color    = MetroidMod.plaRedColor;
                if (projectile.Name.Contains("Ice"))
                {
                    dustType = 135;
                    color    = MetroidMod.iceColor;
                }
                if (projectile.Name.Contains("Stardust"))
                {
                    dustType = 88;
                    color    = MetroidMod.iceColor;
                    Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 87, 0, 0, 100, default(Color), 1.5f)].noGravity = true;
                }
                Lighting.AddLight(projectile.Center, color.R / 255f, color.G / 255f, color.B / 255f);
                int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0, 0, 100, default(Color), 2.5f);
                Main.dust[dust].noGravity = true;
            }
        }
 public override void AI()
 {
     Lighting.AddLight(projectile.position, 0f, 0f, 1.90f);
 }
示例#7
0
 public override void Update(Player player, ref int buffIndex)
 {
     player.buffTime[buffIndex] = 30;
     Lighting.AddLight(player.position, new Vector3(255, 255, 255));
 }
示例#8
0
        public void DrawBuffer(CommandBuffer buffer, VMeshData data, ushort startVertex, Matrix4 world, Lighting light, MaterialAnimCollection mc)
        {
            var mat = Material;

            if (mat == null)
            {
                mat = defaultMaterial;
            }
            if (lastmc != mc)
            {
                if (mc != null)
                {
                    mc.Anims.TryGetValue(mat.Name, out ma);
                    lastmc = mc;
                }
                else
                {
                    ma = null;
                }
            }
            float z = 0;

            if (mat.Render.IsTransparent)
            {
                z = RenderHelpers.GetZ(world, mat.Render.Camera.Position, CalculateAvg(data, startVertex));
            }

            buffer.AddCommand(
                mat.Render,
                ma,
                world,
                light,
                data.VertexBuffer,
                PrimitiveTypes.TriangleList,
                startVertex + StartVertex,
                TriangleStart,
                primitiveCount,
                SortLayers.OBJECT,
                z
                );
        }
示例#9
0
 public override void UpdateVanity(Player player, EquipType type)
 {
     Lighting.AddLight(player.position, .55f, .05f, .08f);
 }
示例#10
0
 public override void UpdateAccessory(Player player, bool hideVisual)
 {
     {
         Lighting.AddLight(player.position, 1.25f, .9f, .6f);
     }
 }
示例#11
0
        public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
        {
            SpriteEffects effects1 = SpriteEffects.None;

            if (projectile.direction == 1)
            {
                effects1 = SpriteEffects.FlipHorizontally;
            }
            Microsoft.Xna.Framework.Color color3 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0));
            {
                Texture2D texture = Main.projectileTexture[projectile.type];
                Texture2D glow    = Main.projectileTexture[projectile.type];
                int       height  = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type];
                Microsoft.Xna.Framework.Rectangle r = new Microsoft.Xna.Framework.Rectangle(0, height * projectile.frame, texture.Width, height);
                Vector2 origin = r.Size() / 2f;
                int     num2   = 5;
                int     num3   = 1;
                int     num4   = 1;
                float   num5   = 1f;
                float   num6   = 0.0f;
                num3 = 1;
                num5 = 3f;
                int index1 = num4;
                while (num3 > 0 && index1 < num2 || num3 < 0 && index1 > num2)
                {
                    Microsoft.Xna.Framework.Color newColor = color3;
                    newColor = Microsoft.Xna.Framework.Color.Lerp(newColor, Microsoft.Xna.Framework.Color.White, 2.5f);
                    Microsoft.Xna.Framework.Color color1 = projectile.GetAlpha(newColor);
                    float num7 = (float)(num2 - index1);
                    if (num3 < 0)
                    {
                        num7 = (float)(num4 - index1);
                    }
                    Microsoft.Xna.Framework.Color color2 = color1 * (num7 / ((float)ProjectileID.Sets.TrailCacheLength[projectile.type] * 1.5f));
                    Vector2       oldPo    = projectile.oldPos[index1];
                    float         rotation = projectile.rotation;
                    SpriteEffects effects2 = effects1;
                    if (ProjectileID.Sets.TrailingMode[projectile.type] == 2)
                    {
                        rotation = projectile.oldRot[index1];
                        effects2 = projectile.oldSpriteDirection[index1] == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
                    }
                    Main.spriteBatch.Draw(glow, oldPo + projectile.Size / 2f - Main.screenPosition + new Vector2(0.0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(r), color2, rotation + projectile.rotation * num6 * (float)(index1 - 1) * (float)-effects1.HasFlag((Enum)SpriteEffects.FlipHorizontally).ToDirectionInt(), origin, MathHelper.Lerp(projectile.scale, num5, (float)index1 / 15f), effects2, 0.0f);
label_709:
                    index1 += num3;
                }

                Microsoft.Xna.Framework.Color color4 = projectile.GetAlpha(color3);
                Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0.0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(r), new Color(255 - projectile.alpha, 255 - projectile.alpha, 255 - projectile.alpha, 175), projectile.rotation, origin, projectile.scale, effects1, 0.0f);
            }
            for (int a = 0; a < 1; a++)
            {
                SpriteEffects spriteEffects = SpriteEffects.None;
                if (projectile.spriteDirection == 1)
                {
                    spriteEffects = SpriteEffects.FlipHorizontally;
                }
                Texture2D texture   = Main.projectileTexture[projectile.type];
                Vector2   vector2_3 = new Vector2((float)(Main.projectileTexture[projectile.type].Width / 2), (float)(Main.projectileTexture[projectile.type].Height / 1 / 2));
                int       height    = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type];
                Microsoft.Xna.Framework.Rectangle r = new Microsoft.Xna.Framework.Rectangle(0, height * projectile.frame, texture.Width, height);
                float addY      = 0f;
                float addHeight = 0f;
                int   num7      = 5;
                float num9      = (float)(Math.Cos((double)Main.GlobalTime % 2.40000009536743 / 2.40000009536743 * 6.28318548202515) / 2.0 + 0.5);
                float num99     = (float)(Math.Cos((double)Main.GlobalTime % 2.40000009536743 / 2.40000009536743 * 6.28318548202515) / 4.0 + 0.5);
                float num8      = 0f;
                Microsoft.Xna.Framework.Color secondColor = Microsoft.Xna.Framework.Color.White;

                float   num10 = 0.0f;
                Vector2 bb    = projectile.Center - Main.screenPosition - new Vector2((float)texture.Width, (float)(texture.Height / 1)) * projectile.scale / 2f + vector2_3 * projectile.scale + new Vector2(0.0f, addY + addHeight + projectile.gfxOffY);
                Microsoft.Xna.Framework.Color color2 = new Microsoft.Xna.Framework.Color((int)sbyte.MaxValue - projectile.alpha, (int)sbyte.MaxValue - projectile.alpha, (int)sbyte.MaxValue - projectile.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.White);
                for (int index2 = 0; index2 < 4; ++index2)
                {
                    Microsoft.Xna.Framework.Color newColor2 = color2;
                    Microsoft.Xna.Framework.Color faa       = projectile.GetAlpha(newColor2) * (1f - num99);
                    Vector2 position2 = projectile.Center + ((float)((double)index2 / (double)4 * 6.28318548202515) + projectile.rotation + num10).ToRotationVector2() * (float)(8.0 * (double)num99 + 2.0) - Main.screenPosition - new Vector2((float)texture.Width, (float)(texture.Height / 1)) * projectile.scale / 2f + vector2_3 * projectile.scale + new Vector2(0.0f, addY + addHeight + projectile.gfxOffY);
                    Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], position2, new Microsoft.Xna.Framework.Rectangle?(r), faa, projectile.rotation, vector2_3, projectile.scale, spriteEffects, 0.0f);
                }
            }

            Lighting.AddLight(projectile.Center, Color.Red.ToVector3() / 2f);

            return(false);
        }
示例#12
0
        public override void AI()
        {
            Vector2 distance = Main.player[projectile.owner].Center - projectile.Center;

            if (almostHitPlayer)
            {
                trackTimer++;
            }
            else if (distance.Length() <= 150)
            {
                projectile.velocity = Vector2.Zero;
                almostHitPlayer     = true;
            }

            if (trackTimer == 91)
            {
                distance.Normalize();
                distance *= 15;

                if (!almostHitPlayerTwice)
                {
                    almostHitPlayer      = false;
                    almostHitPlayerTwice = true;
                    trackTimer           = 0;
                    distance            += Main.player[projectile.owner].velocity / 2; //will not track on last bolt
                }

                projectile.velocity = distance;
            }

            if (projectile.alpha > 0)
            {
                projectile.alpha -= 25;
            }
            if (projectile.alpha < 0)
            {
                projectile.alpha = 0;
            }

            projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f;
            Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0.8f, 0f, 0f);
            float num1 = 150f;
            float num2 = 3f;

            if ((double)projectile.ai[1] == 0.0)
            {
                projectile.localAI[0] += num2;
                if ((double)projectile.localAI[0] > (double)num1)
                {
                    projectile.localAI[0] = num1;
                }
            }
            else
            {
                projectile.localAI[0] -= num2;
                if ((double)projectile.localAI[0] <= 0.0)
                {
                    projectile.Kill();
                    return;
                }
            }

            if (projectile.velocity == Vector2.Zero)
            {
                if (ringTimer == 0 || ringTimer == 30 || ringTimer == 60 || ringTimer == 90)
                {
                    Projectile.NewProjectile(projectile.Center, Vector2.Zero, mod.ProjectileType("BrimstoneRing"), projectile.damage, 0, Main.myPlayer, 0, 0);
                }

                ringTimer++;
            }
            else
            {
                ringTimer = 0;
            }
        }
示例#13
0
        public override void AI()
        {
            if (projectile.wet)
            {
                projectile.active = true;
            }
            else
            {
                projectile.active = false;
            }
            projectile.frameCounter++;

            if (projectile.frameCounter > 4)
            {
                projectile.frame++;
                projectile.frameCounter = 2;
            }
            if (projectile.frame > 7)
            {
                projectile.frame = 0;
            }

            Player player = Main.player[projectile.owner];

            Lighting.AddLight(projectile.position, 0f, 0.68f, 0f);

            projectile.velocity.X = 0f;

            int   type = 8;
            float num1 = 200f;
            int   num2 = 10;

            if (player == Main.player[projectile.owner])
            {
                for (int index2 = 0; index2 < 200; ++index2)
                {
                    NPC npc = Main.npc[index2];
                    if (Main.rand.Next(1250000) == 0)
                    {
                        NPC.NewNPC((int)(projectile.position.X - Main.rand.Next(-100, 100)), (int)(projectile.position.Y + Main.rand.Next(140, 200)), (mod.NPCType("Seaweed")));
                    }
                    if (Main.rand.Next(1250000) == 0)
                    {
                        NPC.NewNPC((int)(projectile.position.X - Main.rand.Next(-100, 100)), (int)(projectile.position.Y + Main.rand.Next(140, 200)), (mod.NPCType("TinCan")));
                    }
                    if (Main.rand.Next(1250000) == 0)
                    {
                        NPC.NewNPC((int)(projectile.position.X - Main.rand.Next(-100, 100)), (int)(projectile.position.Y + Main.rand.Next(140, 200)), (mod.NPCType("OldShoe")));
                    }
                    if (Main.rand.Next(1250000) == 0)
                    {
                        NPC.NewNPC((int)(projectile.position.X - Main.rand.Next(-100, 100)), (int)(projectile.position.Y + Main.rand.Next(140, 200)), (mod.NPCType("WoodenCrate")));
                    }
                    if (Main.rand.Next(2000000) == 0)
                    {
                        NPC.NewNPC((int)(projectile.position.X - Main.rand.Next(-100, 100)), (int)(projectile.position.Y + Main.rand.Next(140, 200)), (mod.NPCType("IronCrate")));
                    }
                    if (Main.rand.Next(3000000) == 0)
                    {
                        NPC.NewNPC((int)(projectile.position.X - Main.rand.Next(-100, 100)), (int)(projectile.position.Y + Main.rand.Next(140, 200)), (mod.NPCType("GoldenCrate")));
                    }
                    if (player.ZoneJungle)
                    {
                        if (Main.rand.Next(3000000) == 0)
                        {
                            NPC.NewNPC((int)(projectile.position.X - Main.rand.Next(-100, 100)), (int)(projectile.position.Y + Main.rand.Next(140, 200)), (mod.NPCType("JungleCrate")));
                        }
                    }
                    if (player.ZoneSkyHeight)
                    {
                        if (Main.rand.Next(3000000) == 0)
                        {
                            NPC.NewNPC((int)(projectile.position.X - Main.rand.Next(-100, 100)), (int)(projectile.position.Y + Main.rand.Next(140, 200)), (mod.NPCType("SkyCrate")));
                        }
                    }
                    if (player.ZoneCorrupt)
                    {
                        if (Main.rand.Next(3000000) == 0)
                        {
                            NPC.NewNPC((int)(projectile.position.X - Main.rand.Next(-100, 100)), (int)(projectile.position.Y + Main.rand.Next(140, 200)), (mod.NPCType("CorruptCrate")));
                        }
                    }
                    if (player.ZoneCrimson)
                    {
                        if (Main.rand.Next(3000000) == 0)
                        {
                            NPC.NewNPC((int)(projectile.position.X - Main.rand.Next(-100, 100)), (int)(projectile.position.Y + Main.rand.Next(140, 200)), (mod.NPCType("CrimsonCrate")));
                        }
                    }
                    if (player.ZoneHoly)
                    {
                        if (Main.rand.Next(3000000) == 0)
                        {
                            NPC.NewNPC((int)(projectile.position.X - Main.rand.Next(-100, 100)), (int)(projectile.position.Y + Main.rand.Next(140, 200)), (mod.NPCType("HallowedCrate")));
                        }
                    }
                    if (player.ZoneDungeon)
                    {
                        if (Main.rand.Next(3000000) == 0)
                        {
                            NPC.NewNPC((int)(projectile.position.X - Main.rand.Next(-100, 100)), (int)(projectile.position.Y + Main.rand.Next(140, 200)), (mod.NPCType("DungeonCrate")));
                        }
                    }
                }
            }
            if (projectile.timeLeft == 7199 && player == Main.player[projectile.owner])
            {
                projectile.velocity.Y = 1;
            }
        }
示例#14
0
        public override void AI()
        {
            float rand = Main.rand.Next(90, 111) * 0.01f * (Main.essScale * 0.5f);

            Lighting.AddLight(projectile.Center, 0.5f * rand, 0.1f * rand, 0.1f * rand);

            /*projectile.ai[0]--;
             * if (projectile.ai[0] > 0)
             * {
             *  projectile.rotation = -projectile.velocity.ToRotation();
             * }
             * else if (projectile.ai[0] == 0)
             *  projectile.velocity = Vector2.Zero;
             * else
             * {
             *  projectile.ai[1]--;
             *  if (projectile.ai[1] == 0)
             *  {
             *      projectile.velocity = projectile.DirectionTo(Main.player[Player.FindClosest(projectile.Center, 0, 0)].Center) * 20;
             *      projectile.netUpdate = true;
             *  }
             *  if (projectile.ai[1] <= 0)
             *  {
             *      projectile.rotation = projectile.velocity.ToRotation();
             *  }
             * }
             *
             * projectile.rotation -= (float)Math.PI / 2;*/

            if (projectile.localAI[0] == 0)
            {
                projectile.localAI[0] = 1;
                projectile.ai[0]      = -1;
            }

            if (projectile.ai[0] >= 0 && projectile.ai[0] < 200)
            {
                int ai0 = (int)projectile.ai[0];
                if (Main.npc[ai0].CanBeChasedBy())
                {
                    double num4 = (Main.npc[ai0].Center - projectile.Center).ToRotation() - projectile.velocity.ToRotation();
                    if (num4 > Math.PI)
                    {
                        num4 -= 2.0 * Math.PI;
                    }

                    if (num4 < -1.0 * Math.PI)
                    {
                        num4 += 2.0 * Math.PI;
                    }

                    projectile.velocity = projectile.velocity.RotatedBy(num4 * (projectile.Distance(Main.npc[ai0].Center) > 100 ? 0.4f : 0.1f));
                }
                else
                {
                    projectile.ai[0]     = -1f;
                    projectile.netUpdate = true;
                }
            }
            else
            {
                if (++projectile.localAI[1] > 6f)
                {
                    projectile.localAI[1] = 0f;
                    float maxDistance    = 700f;
                    int   possibleTarget = -1;
                    for (int i = 0; i < 200; i++)
                    {
                        NPC npc = Main.npc[i];
                        if (npc.CanBeChasedBy())
                        {
                            float npcDistance = projectile.Distance(npc.Center);
                            if (npcDistance < maxDistance)
                            {
                                maxDistance    = npcDistance;
                                possibleTarget = i;
                            }
                        }
                    }

                    projectile.ai[0]     = possibleTarget;
                    projectile.netUpdate = true;
                }
            }

            projectile.rotation = projectile.velocity.ToRotation() - (float)Math.PI / 2;
        }
示例#15
0
        public void DrawGlowmask(PlayerDrawInfo info)
        {
            Player player = info.drawPlayer;

            if (player.heldProj > -1 && Main.projectile[player.heldProj].type == mod.ProjectileType("VitricBowProjectile"))
            {
                Projectile held = Main.projectile[player.heldProj];
                Vector2    off  = Vector2.Normalize(held.velocity) * 16;

                var data = new DrawData(GetTexture(Texture), player.Center + off - Main.screenPosition, null, Lighting.GetColor((int)player.Center.X / 16, (int)player.Center.Y / 16), off.ToRotation(), item.Size / 2, 1, 0, 0);
                Main.playerDrawData.Add(data);

                if (held.modProjectile != null && held.modProjectile is VitricBowProjectile)
                {
                    float fraction = held.ai[0] / VitricBowProjectile.MaxCharge;
                    Color colorz   = Color.Lerp(Lighting.GetColor((int)player.Center.X / 16, (int)player.Center.Y / 16), Color.Aquamarine, fraction) * Math.Min(held.timeLeft / 20f, 1f);

                    var data2 = new DrawData(GetTexture(Texture), player.Center + off - Main.screenPosition, null, colorz, off.ToRotation(), item.Size / 2, 1, 0, 0);
                    Main.playerDrawData.Add(data2);
                }
            }
        }
示例#16
0
 public void Draw(RenderState rstate, VertexBuffer buff, ushort startVertex, Matrix4 world, Lighting light, MaterialAnimCollection mc)
 {
     if (lastmc != mc)
     {
         if (mc != null)
         {
             mc.Anims.TryGetValue(Material.Name, out ma);
             lastmc = mc;
         }
         else
         {
             ma = null;
         }
     }
     Material.Render.MaterialAnim = ma;
     Material.Render.World        = world;
     Material.Render.Use(rstate, buff.VertexType, light);
     buff.Draw(PrimitiveTypes.TriangleList, startVertex + StartVertex, TriangleStart, primitiveCount);
 }
示例#17
0
 public override void MeleeEffects(Player player, Rectangle hitbox)
 {
     Lighting.AddLight(item.Center, 0.9f, 0.1f, 0.3f);
 }
示例#18
0
        public override void AI()
        {
            Lighting.AddLight(projectile.Center, 1f, 0.3f, 0.3f);

            projectile.rotation += projectile.velocity.X * 0.04f;
            bool     flag64    = projectile.type == mod.ProjectileType("AbyssCultist");
            Player   player    = Main.player[projectile.owner];
            MyPlayer modPlayer = player.GetModPlayer <MyPlayer>(mod);

            player.AddBuff(mod.BuffType("AbyssCultistBuff"), 3600);
            if (flag64)
            {
                if (player.dead)
                {
                    modPlayer.abyssCultist = false;
                }
                if (modPlayer.abyssCultist)
                {
                    projectile.timeLeft = 2;
                }
            }
            for (int k = 0; k < 200; k++)
            {
                Projectile other = Main.projectile[k];
                if (k != projectile.whoAmI && other.type == projectile.type && other.active && Math.Abs(projectile.position.X - other.position.X) + Math.Abs(projectile.position.Y - other.position.Y) < projectile.width)
                {
                    const float pushAway = 0.05f;
                    if (projectile.position.X < other.position.X)
                    {
                        projectile.velocity.X -= pushAway;
                    }
                    else
                    {
                        projectile.velocity.X += pushAway;
                    }
                    if (projectile.position.Y < other.position.Y)
                    {
                        projectile.velocity.Y -= pushAway;
                    }
                    else
                    {
                        projectile.velocity.Y += pushAway;
                    }
                }
            }

            shootTimer--;
            float max = 400f;

            for (int i = 0; i < 200; i++)
            {
                NPC nPC = Main.npc[i];
                if (nPC.active && !nPC.friendly && !nPC.dontTakeDamage && Vector2.Distance(projectile.Center, nPC.Center) <= max && Main.npc[i].CanBeChasedBy(projectile, false))
                {
                    int     numberProjectiles = 5 + Main.rand.Next(0, 1);
                    Vector2 vector8           = new Vector2(projectile.position.X + (projectile.width / 2), projectile.position.Y + (projectile.height / 2));
                    int     type     = mod.ProjectileType("AbyssCultistBolt");
                    float   Speed    = 12f;
                    float   rotation = (float)Math.Atan2(vector8.Y - (nPC.position.Y + (nPC.height * 0.5f)), vector8.X - (nPC.position.X + (nPC.width * 0.5f)));
                    int     damage   = projectile.damage / 3;
                    if (shootTimer <= 0)
                    {
                        for (int l = 0; l < numberProjectiles; l++)
                        {
                            Vector2 perturbedSpeed = new Vector2((float)((Math.Cos(rotation) * Speed) * -1), (float)((Math.Sin(rotation) * Speed) * -1)).RotatedByRandom(MathHelper.ToRadians(90));
                            Projectile.NewProjectile(vector8.X, vector8.Y, perturbedSpeed.X, perturbedSpeed.Y, type, damage, 0f, Main.myPlayer, 0f, 0f);
                        }
                        shootTimer = 30;
                    }
                }
            }
            // idk wtf is happening, how to even arc?

            /* for (int i = 0; i < 200; i++)
             * {
             *   NPC nPC = Main.npc[i];
             *   if (nPC.active && !nPC.friendly && !nPC.dontTakeDamage && Vector2.Distance(projectile.Center, nPC.Center) <= max && Main.npc[i].CanBeChasedBy(projectile, false))
             *   {
             *       float numberProjectiles = 3;
             *       Vector2 vector8 = new Vector2(projectile.Center.X, projectile.Center.Y);
             *       float rotation = MathHelper.ToRadians(45);
             *       Vector2 direction = (nPC.Center - projectile.Center).SafeNormalize(-Vector2.UnitY);
             *       if (shootTimer <= 0)
             *       {
             *           for (int k = 0; k < numberProjectiles; k++)
             *           {
             *               Vector2 perturbedSpeed = direction.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numberProjectiles - 1)));
             *               Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X * 10, perturbedSpeed.Y * 10, ProjectileID.FireArrow, 4, 3f, projectile.owner);
             *           }
             *           shootTimer = 50;
             *       }
             *   }
             * }*/
        }
示例#19
0
 public override void Update(Player player, ref int buffIndex)
 {
     player.buffImmune[BuffID.Shine] = true;
     Lighting.AddLight(player.Center, 1.1f, 1.15f, 1.2f);
     player.nightVision = true;
 }
示例#20
0
 public override void PostAll()
 {
     Lighting.AddLight(projectile.Center, 0.15f, 0.5f, 1.5f);
     base.PostAll(); //Fades
 }
示例#21
0
 public override bool PreAI()
 {
     Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), .042f * 2, .115f * 2, .233f * 2);
     return(true);
 }
示例#22
0
        public override bool PreDraw(SpriteBatch sb, Color lightColor)
        {
            Projectile    P             = projectile;
            SpriteEffects spriteEffects = SpriteEffects.None;

            if (P.spriteDirection == -1)
            {
                spriteEffects = SpriteEffects.FlipHorizontally;
            }
            Color     color25 = Lighting.GetColor((int)P.Center.X / 16, (int)P.Center.Y / 16);
            Vector2   pos     = P.Center + Vector2.UnitY * P.gfxOffY - Main.screenPosition;
            Texture2D tex     = Main.projectileTexture[P.type];
            Texture2D tex2    = mod.GetTexture("Projectiles/missiles/NebulaMissileImpact2");
            Color     alpha4  = P.GetAlpha(color25);
            Vector2   origin8 = new Vector2((float)tex.Width, (float)tex.Height) / 2f;

            Color color57 = alpha4 * 0.8f;

            color57.A /= 2;
            Color color58 = Color.Lerp(alpha4, Color.Black, 0.5f);

            color58.A = alpha4.A;
            float num274 = 0.95f + (P.rotation * 0.75f).ToRotationVector2().Y * 0.1f;

            color58 *= num274;
            float scale13 = 0.6f + P.scale * 0.6f * num274;

            float   dist  = Math.Max(radius, 1);
            Vector2 diff2 = Vector2.Normalize(P.Center - basePosition);

            if (float.IsNaN(diff2.X) || float.IsNaN(diff2.Y))
            {
                diff2 = -Vector2.UnitY;
            }

            float spin2 = spin + (float)Math.PI / 2;

            int k = 1;

            for (float i = 0f; i < dist; i += 1f + (30f * (i / dist)))
            {
                SpriteEffects se = SpriteEffects.None;
                if (k == -1)
                {
                    se = SpriteEffects.FlipHorizontally;
                }

                Vector2 pos1 = basePosition + spin2.ToRotationVector2() * i;
                Vector2 pos2 = basePosition + diff2 * i;

                Vector2 fPos = Vector2.Lerp(pos1, pos2, i / dist) - Main.screenPosition;

                float rot = ((float)Math.PI * 2f / dist) * i;
                sb.Draw(tex2, fPos, null, alpha4, rot + P.rotation * k, origin8, MathHelper.Lerp(0.1f, P.scale, (i / dist)), se, 0f);
                k *= -1;
            }

            sb.Draw(tex2, basePosition - Main.screenPosition, null, alpha4, -P.rotation, origin8, P.scale, spriteEffects ^ SpriteEffects.FlipHorizontally, 0f);


            sb.Draw(tex2, pos, null, color58, -P.rotation + 0.35f, origin8, scale13, spriteEffects ^ SpriteEffects.FlipHorizontally, 0f);
            sb.Draw(tex2, pos, null, alpha4, -P.rotation, origin8, P.scale, spriteEffects ^ SpriteEffects.FlipHorizontally, 0f);
            sb.Draw(tex, pos, null, color57, -P.rotation * 0.7f, origin8, P.scale, spriteEffects ^ SpriteEffects.FlipHorizontally, 0f);
            sb.Draw(tex2, pos, null, alpha4 * 0.8f, P.rotation * 0.5f, origin8, P.scale * 0.9f, spriteEffects, 0f);
            alpha4.A = 0;

            sb.Draw(tex, pos, null, alpha4, P.rotation, origin8, P.scale, spriteEffects, 0f);

            return(false);
        }
示例#23
0
        public override bool PreDraw(int i, int j, SpriteBatch spriteBatch)
        {
            Tile      tile = Main.tile[i, j];
            Texture2D texture;

            if (Main.canDrawColorTile(i, j))
            {
                texture = Main.tileAltTexture[Type, (int)tile.color()];
            }
            else
            {
                texture = Main.tileTexture[Type];
            }
            Vector2 zero = new Vector2(Main.offScreenRange, Main.offScreenRange);

            if (Main.drawToScreen)
            {
                zero = Vector2.Zero;
            }
            Main.spriteBatch.Draw(texture, new Vector2(i * 16 - (int)Main.screenPosition.X, ((j * 16) + 2) - (int)Main.screenPosition.Y) + zero, new Rectangle(tile.frameX, tile.frameY, 16, 16), Lighting.GetColor(i, j), 0f, default, 1f, SpriteEffects.None, 0f);
示例#24
0
        public override void AI()
        {
            Lighting.AddLight(npc.Center, new Vector3(1, 1, 0.8f));

            GlobalTimer++;                                    //tick our timer up constantly
            AttackTimer++;                                    //tick up our attack timer

            if (npc.ai[0] == (int)OvergrowBossPhase.Struggle) //when the boss is trapped before spawning the first time
            {
                if (spawnPoint == Vector2.Zero)
                {
                    spawnPoint = npc.Center; //sets the boss' home
                }
                npc.velocity.Y = (float)Math.Sin((GlobalTimer % 120) / 120f * 6.28f) * 0.6f;

                if (!Main.npc.Any(n => n.active && n.type == NPCType <OvergrowBossAnchor>())) //once the chains are broken
                {
                    npc.velocity *= 0;
                    npc.Center    = spawnPoint;
                    GlobalTimer   = 0;

                    StarlightPlayer mp = Main.LocalPlayer.GetModPlayer <StarlightPlayer>();
                    mp.ScreenMoveTime   = 860;
                    mp.ScreenMoveTarget = npc.Center;
                    mp.ScreenMovePan    = npc.Center + new Vector2(0, -100);

                    Phase = (int)OvergrowBossPhase.spawnAnimation;
                }
            }

            if (Phase == (int)OvergrowBossPhase.spawnAnimation) //the boss' spawn animation.
            {
                if (GlobalTimer == 1)
                {
                    music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/OvergrowBoss");
                }

                if (GlobalTimer <= 120)
                {
                    npc.position.Y--;
                }

                if (GlobalTimer == 120)
                {
                    StarlightWorld.Flag(WorldFlags.OvergrowBossFree);
                }

                if (GlobalTimer == 500)
                {
                    string message = "Faerie Guardian";
                    if (Main.rand.Next(10000) == 0)
                    {
                        message = "Titty Elongator"; // Yep
                    }
                    UILoader.GetUIState <TextCard>().Display("Eggshells", message, null, 220);
                }

                if (GlobalTimer >= 860)
                {
                    Phase = (int)OvergrowBossPhase.Setup;
                }
            }

            if (Phase == (int)OvergrowBossPhase.Setup)
            {
                npc.boss = true;

                int index = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCType <OvergrowBossFlail>()); //spawn the flail after intro
                (Main.npc[index].modNPC as OvergrowBossFlail).parent = this;                                 //set the flail's parent
                flail = Main.npc[index].modNPC as OvergrowBossFlail;                                         //tells the boss what flail it owns

                Phase       = (int)OvergrowBossPhase.FirstAttack;                                            //move on to the first attack phase
                GlobalTimer = 0;                                                                             //reset our timer
                npc.ai[3]   = 0;                                                                             //reset our attack timer
            }

            if (flail == null)
            {
                return;                                      //at this point, our boss should have her flail. if for some reason she dosent, this is a safety check
            }
            if (Phase == (int)OvergrowBossPhase.FirstAttack) //the first attacking phase
            {
                //attack pattern advancement logic
                if (AttackTimer == 1)
                {
                    RandomizeTarget();
                    if (AttackPhase == 1)
                    {
                        AttackPhase++;                   //tick up an additional time so that we dont use 2 alternate attacks in a row. TODO: Should make a cleaner way to do this.
                    }
                    AttackPhase++;
                    if (AttackPhase == 1 && Main.rand.Next(2) == 0)
                    {
                        AttackPhase++;
                    }
                    if (AttackPhase > 6)
                    {
                        AttackPhase = 0;
                    }

                    if (flail.npc.life <= 1) //move to next phase once the flail is depleated
                    {
                        Phase       = (int)OvergrowBossPhase.FirstToss;
                        AttackPhase = 0;
                        ResetAttack();
                        //foreach (Projectile proj in Main.projectile.Where(p => p.type == ProjectileType<Projectiles.Dummies.OvergrowBossPitDummy>())) proj.ai[1] = 1; //opens the pits
                    }
                }
                switch (AttackPhase) //attack pattern
                {
                case 0: Phase1Spin(); break;

                case 1: Phase1Bolts(); break;     //______randonly picks between these two

                case 2: Phase1Trap(); break;      //___|

                case 3: Phase1Toss(); break;

                case 4: Phase1Toss(); break;

                case 5: Phase1Bolts(); break;

                case 6: Phase1Toss(); break;
                }
            }

            if (Phase == (int)OvergrowBossPhase.FirstToss)
            {
                RapidToss();                                            //toss rapidly till thrown into a pit
            }
            if (Phase == (int)OvergrowBossPhase.Stun)
            {
                if (GlobalTimer == 1)
                {
                    npc.alpha = 255;

                    for (int k = 0; k < 100; k++)
                    {
                        Dust d = Dust.NewDustPerfect(npc.Center, 1 /*DustType<>()*/, Vector2.One.RotatedByRandom(Math.PI) * Main.rand.NextFloat(5));
                        d.customData = npc.Center;
                    }

                    npc.Center      = spawnPoint + new Vector2(0, 320);
                    flail.npc.ai[0] = 1;
                }

                if (GlobalTimer >= 120)
                {
                    npc.alpha = 0;
                    if (npc.Hitbox.Intersects(flail.npc.Hitbox))
                    {
                        flail.npc.ai[0]          = 0;
                        flail.npc.ai[3]          = 1;
                        flail.npc.velocity      *= 0;
                        flail.npc.life           = flail.npc.lifeMax;
                        flail.npc.dontTakeDamage = false;
                        flail.npc.friendly       = false;

                        npc.life -= 20000;
                        Phase     = (int)OvergrowBossPhase.SecondAttack;
                        ResetAttack();

                        CombatText.NewText(npc.Hitbox, Color.Red, 20000, true);
                        Main.PlaySound(SoundID.DD2_BetsyScream, npc.Center);
                        Main.LocalPlayer.GetModPlayer <StarlightPlayer>().Shake += 30;

                        for (int k = 0; k < 100; k++)
                        {
                            Dust d = Dust.NewDustPerfect(flail.npc.Center, DustType <Dusts.Stone>(), Vector2.One.RotatedByRandom(Math.PI) * Main.rand.NextFloat(5));
                        }
                    }
                }
            }
        }
示例#25
0
        public override void AI()
        {
            Player player = Main.player[projectile.owner];

            #region Active check
            if (player.dead || !player.active)
            {
                player.ClearBuff(BuffType <Buffs.Minions.Ores.FloatingCobaltOre>());
            }
            if (player.HasBuff(BuffType <Buffs.Minions.Ores.FloatingCobaltOre>()))
            {
                projectile.timeLeft = 2;
            }
            #endregion

            #region General behavior
            Vector2 idlePosition = player.Center;

            //float minionPositionOffsetX = (10 + projectile.minionPos * 40) * -player.direction;
            //idlePosition.X += minionPositionOffsetX;

            Vector2 vectorToIdlePosition   = idlePosition - projectile.Center;
            float   distanceToIdlePosition = vectorToIdlePosition.Length();
            if (Main.myPlayer == player.whoAmI && distanceToIdlePosition > 2000f)
            {
                projectile.position  = idlePosition;
                projectile.velocity *= 0.1f;
                projectile.netUpdate = true;
            }
            float overlapVelocity = 0.04f;
            for (int i = 0; i < Main.maxProjectiles; i++)
            {
                Projectile other = Main.projectile[i];
                if (i != projectile.whoAmI && other.active && other.owner == projectile.owner && Math.Abs(projectile.position.X - other.position.X) + Math.Abs(projectile.position.Y - other.position.Y) < projectile.width)
                {
                    if (projectile.position.X < other.position.X)
                    {
                        projectile.velocity.X -= overlapVelocity;
                    }
                    else
                    {
                        projectile.velocity.X += overlapVelocity;
                    }

                    if (projectile.position.Y < other.position.Y)
                    {
                        projectile.velocity.Y -= overlapVelocity;
                    }
                    else
                    {
                        projectile.velocity.Y += overlapVelocity;
                    }
                }
            }
            #endregion

            #region Find target
            float   distanceFromTarget = 500f;
            Vector2 targetCenter       = projectile.position;
            bool    foundTarget        = false;

            if (player.HasMinionAttackTargetNPC)
            {
                NPC   npc     = Main.npc[player.MinionAttackTargetNPC];
                float between = Vector2.Distance(npc.Center, projectile.Center);
                if (between < 2000f)
                {
                    distanceFromTarget = between;
                    targetCenter       = npc.Center;
                    foundTarget        = true;
                }
            }
            if (!foundTarget)
            {
                for (int i = 0; i < Main.maxNPCs; i++)
                {
                    NPC npc = Main.npc[i];
                    if (npc.CanBeChasedBy())
                    {
                        float between          = Vector2.Distance(npc.Center, projectile.Center);
                        bool  closest          = Vector2.Distance(projectile.Center, targetCenter) > between;
                        bool  inRange          = between < distanceFromTarget;
                        bool  lineOfSight      = true;                   //Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height);
                        bool  closeThroughWall = between < 100f;
                        if (((closest && inRange) || !foundTarget) && (lineOfSight || closeThroughWall))
                        {
                            distanceFromTarget = between;
                            targetCenter       = npc.Center;
                            foundTarget        = true;
                        }
                    }
                }
            }
            projectile.friendly = foundTarget;
            #endregion

            #region Movement

            float speed   = 16f;
            float inertia = 50f;

            if (foundTarget)
            {
                if (distanceFromTarget > 40f)
                {
                    Vector2 direction = targetCenter - projectile.Center;
                    direction.Normalize();
                    direction          *= speed;
                    projectile.velocity = (projectile.velocity * (inertia - 1) + direction) / inertia;
                }
            }
            else
            {
                if (distanceToIdlePosition > 600f)
                {
                    speed   = 24f;
                    inertia = 80f;
                }
                else
                {
                    speed   = 16f;
                    inertia = 100f;
                }
                if (distanceToIdlePosition > 20f)
                {
                    vectorToIdlePosition.Normalize();
                    vectorToIdlePosition *= speed;
                    projectile.velocity   = (projectile.velocity * (inertia - 1) + vectorToIdlePosition) / inertia;
                }
                else if (projectile.velocity == Vector2.Zero)
                {
                    projectile.velocity.X = -0.15f;
                    projectile.velocity.Y = -0.05f;
                }
            }
            #endregion

            #region Projectile
            Vector2 projDir = Vector2.Normalize(targetCenter - projectile.Center) * 40;
            if (foundTarget)
            {
                Timer++;
                if (Timer % 40 == rand)
                {
                    Projectile.NewProjectile(projectile.Center, projDir, mod.ProjectileType("CobaltOrebolt"), projectile.damage, projectile.knockBack, Main.myPlayer);
                }
            }

            #endregion

            #region Animation and visuals
            projectile.rotation += 0.02f;

            Lighting.AddLight(projectile.Center, Color.CadetBlue.ToVector3() * 0.78f);
            #endregion
        }
示例#26
0
        public override void AI()
        {
            projectile.frameCounter++;
            if (projectile.frameCounter >= 6)
            {
                projectile.frame        = (projectile.frame + 1) % Main.projFrames[projectile.type];
                projectile.frameCounter = 0;
            }

            Vector3 RGB        = new Vector3(0f, 0.5f, 1.5f);
            float   multiplier = 1;
            float   max        = 2.25f;
            float   min        = 1.0f;

            RGB *= multiplier;
            if (RGB.X > max)
            {
                multiplier = 0.5f;
            }
            if (RGB.X < min)
            {
                multiplier = 1.5f;
            }
            Lighting.AddLight(projectile.position, RGB.X, RGB.Y, RGB.Z);

            timer++;
            int range = 650;               //How many tiles away the projectile targets NPCs

            //TARGET NEAREST NPC WITHIN RANGE
            float lowestDist = float.MaxValue;

            foreach (Player player in Main.player)
            {
                //if npc is a valid target (active, not friendly, and not a critter)
                if (player.active)
                {
                    //if npc is within 50 blocks
                    float dist = projectile.Distance(player.Center);
                    if (dist / 16 < range)
                    {
                        //if npc is closer than closest found npc
                        if (dist < lowestDist)
                        {
                            lowestDist = dist;

                            //target this npc
                            projectile.ai[1] = player.whoAmI;
                        }
                    }
                }
            }

            if (timer < 125)
            {
                projectile.velocity.Y *= 0.98f;
                if (timer > 100)
                {
                    int dust = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 206, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f);
                    Main.dust[dust].noGravity = true;
                }
            }
            int index = (int)projectile.ai[1];

            if (timer == 125 && index >= 0 && index < Main.maxPlayers && Main.player[index].active)
            {
                Vector2 direction9 = Main.player[(int)projectile.ai[1]].Center - projectile.Center;
                direction9.Normalize();
                direction9.X       *= 15f;
                direction9.Y       *= 15f;
                projectile.velocity = direction9;
            }
        }
        public override void AI()
        {
            timer++;
            if (timer <= 50)
            {
                colortimer++;
            }
            if (timer > 50)
            {
                colortimer--;
            }
            if (timer >= 100)
            {
                timer = 0;
            }
            float num395 = Main.mouseTextColor / 155f - 0.35f;

            num395             *= 0.34f;
            projectile.scale    = num395 + 0.55f;
            projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 1.57f;
            Lighting.AddLight((int)(projectile.position.X / 16f), (int)(projectile.position.Y / 16f), 0.396f / 2, 0.370588235f / 2, 0.364705882f / 2);
            bool flag25 = false;
            int  jim    = 1;

            for (int index1 = 0; index1 < 200; index1++)
            {
                if (Main.npc[index1].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[index1].Center, 1, 1))
                {
                    float num23 = Main.npc[index1].position.X + (float)(Main.npc[index1].width / 2);
                    float num24 = Main.npc[index1].position.Y + (float)(Main.npc[index1].height / 2);
                    float num25 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num23) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num24);
                    if (num25 < 500f)
                    {
                        flag25 = true;
                        jim    = index1;
                    }
                }
            }
            if (flag25)
            {
                float   num1       = 12.5f;
                Vector2 vector2    = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f);
                float   num2       = Main.npc[jim].Center.X - vector2.X;
                float   num3       = Main.npc[jim].Center.Y - vector2.Y;
                Vector2 direction5 = Main.npc[jim].Center - projectile.Center;
                direction5.Normalize();
                projectile.rotation = projectile.DirectionTo(Main.npc[jim].Center).ToRotation() + 1.57f;
                float num4 = (float)Math.Sqrt((double)num2 * (double)num2 + (double)num3 * (double)num3);
                float num5 = num1 / num4;
                float num6 = num2 * num5;
                float num7 = num3 * num5;
                int   num8 = 10;
                if (Main.rand.Next(16) == 0)
                {
                    projectile.velocity.X = (projectile.velocity.X * (float)(num8 - 1) + num6) / (float)num8;
                    projectile.velocity.Y = (projectile.velocity.Y * (float)(num8 - 1) + num7) / (float)num8;
                }
            }

            projectile.ai[1] += 1f;
            if (projectile.ai[1] >= 7200f)
            {
                projectile.alpha += 5;
                if (projectile.alpha > 255)
                {
                    projectile.alpha = 255;
                    projectile.Kill();
                }
            }
            projectile.localAI[0] += 1f;
            if (projectile.localAI[0] >= 10f)
            {
                projectile.localAI[0] = 0f;
                int   num416 = 0;
                int   num417 = 0;
                float num418 = 0f;
                int   num419 = projectile.type;
                for (int num420 = 0; num420 < 1000; num420++)
                {
                    if (Main.projectile[num420].active && Main.projectile[num420].owner == projectile.owner && Main.projectile[num420].type == num419 && Main.projectile[num420].ai[1] < 3600f)
                    {
                        num416++;
                        if (Main.projectile[num420].ai[1] > num418)
                        {
                            num417 = num420;
                            num418 = Main.projectile[num420].ai[1];
                        }
                    }
                    if (num416 > 8)
                    {
                        Main.projectile[num417].netUpdate = true;
                        Main.projectile[num417].ai[1]     = 36000f;
                        return;
                    }
                }
            }
        }
示例#28
0
 public override void Update(Player player, ref int buffIndex)
 {
     KiDrainAdd(player);
     if (IsKaioken)
     {
         MyPlayer.ModPlayer(player).hasKaioken = true;
         Lighting.AddLight(player.Center, KaioLightValue, 0f, 0f);
     }
     if (player.lifeRegen > 0)
     {
         player.lifeRegen = 0;
     }
     player.lifeRegenTime = 0;
     player.lifeRegen    -= HealthDrainRate;
     if (IsSSJ)
     {
         MyPlayer.ModPlayer(player).IsTransformed = true;
         KiDrainTimer++;
         if (KiDrainTimer > 1)
         {
             MyPlayer.ModPlayer(player).KiCurrent -= KiDrainRate;
             KiDrainTimer = 0;
         }
         Lighting.AddLight(player.Center, 1f, 1f, 0f);
     }
     if (MyPlayer.ModPlayer(player).speedToggled)
     {
         player.moveSpeed       += SpeedMulti - 1f;
         player.maxRunSpeed     += SpeedMulti - 1f;
         player.runAcceleration += SpeedMulti - 1f;
     }
     else if (!MyPlayer.ModPlayer(player).speedToggled)
     {
         player.moveSpeed       += 2f;
         player.maxRunSpeed     += 2f;
         player.runAcceleration += 2f;
     }
     player.meleeDamage  += DamageMulti - 1;
     player.rangedDamage += DamageMulti - 1;
     player.magicDamage  += DamageMulti - 1;
     player.minionDamage += DamageMulti - 1;
     player.thrownDamage += DamageMulti - 1;
     MyPlayer.ModPlayer(player).KiDamage += DamageMulti - 1;
     if (DBZMOD.instance.thoriumLoaded)
     {
         ThoriumEffects(player);
     }
     if (DBZMOD.instance.tremorLoaded)
     {
         TremorEffects(player);
     }
     if (DBZMOD.instance.enigmaLoaded)
     {
         EnigmaEffects(player);
     }
     if (DBZMOD.instance.battlerodsLoaded)
     {
         BattleRodEffects(player);
     }
     if (IsSSJ)
     {
         if (MyPlayer.ModPlayer(player).KiCurrent <= 0)
         {
             MyPlayer.ModPlayer(player).IsTransformed = false;
             player.ClearBuff(mod.BuffType("SSJ1Buff"));
             player.ClearBuff(mod.BuffType("ASSJBuff"));
             player.ClearBuff(mod.BuffType("USSJBuff"));
             player.ClearBuff(mod.BuffType("SSJ1KaiokenBuff"));
             player.ClearBuff(mod.BuffType("SSJ2Buff"));
             player.ClearBuff(mod.BuffType("SSJ3Buff"));
             Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/PowerDown").WithVolume(.3f));
             MyPlayer.ModPlayer(player).IsTransformed = false;
         }
     }
 }
示例#29
0
        public override void PostDrawTiles()
        {
            Player player = Main.player[Main.myPlayer];

            int count = SpookyPlayer.pages;

            if (!Main.playerInventory && player.CountBuffs() == 0 && !Main.hideUI && !player.dead)
            {
                SpookyTerrariaUtils.DrawPageUI(count, 35f, 100f);
            }
            if (!Main.playerInventory && player.CountBuffs() <= 11 && player.CountBuffs() > 0 && !Main.hideUI && !player.dead)
            {
                SpookyTerrariaUtils.DrawPageUI(count, 35f, 150f);
            }
            if (!Main.playerInventory && player.CountBuffs() > 11 && !Main.hideUI && !player.dead)
            {
                SpookyTerrariaUtils.DrawPageUI(count, 35f, 210f);
            }
            if (Main.playerInventory && !Main.hideUI && !player.dead)
            {
                SpookyTerrariaUtils.DrawPageUI(count, 35f, 325f);
            }

            if (player.GetModPlayer <SpookyPlayer>().deathTextTimer == 1)
            {
                deathTextChoice = Main.rand.Next(0, 10);
            }
            int countCached = player.GetModPlayer <SpookyPlayer>().cachedPageCount;

            Color lighterRed   = new Color(255, 50, 50);
            Color lerpable     = SpookyTerrariaUtils.ColorSwitcher(Color.Red, lighterRed, 30f);
            Color moreLerpable = Color.Lerp(Color.Red, Color.Green, player.GetModPlayer <SpookyPlayer>().cachedPageCount * 0.125f);
            // 205, 92, 92, a: 255

            string displayableString = SpookyTerrariaUtils.ChooseRandomDeathText(deathTextChoice);
            string subString         = "Returning to Main Menu...";
            string pagesFound        = $"Pages Found: {player.GetModPlayer<SpookyPlayer>().cachedPageCount} / 8";

            float x1 = Main.screenWidth / 2;
            float y1 = Main.screenHeight / 2;

            float b = y1 - 75f;

            float x = Main.rand.NextFloat(x1 - 5, x1 + 5);
            float y = Main.rand.NextFloat(y1 - 5, y1 + 5);

            float m = y1 - 100f;

            float j = y1 + 40f;

            Vector2 middle1 = Main.fontDeathText.MeasureString(displayableString) / 2;
            Vector2 middle2 = Main.fontDeathText.MeasureString(subString) / 2;
            Vector2 middle3 = Main.fontDeathText.MeasureString(pagesFound) / 2;

            if (player.dead)
            {
                SpookyTerrariaUtils.DrawPageUI(countCached, x1 - 88, b);
                // Main.hideUI = true;
                Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
                // Text with shake
                Main.spriteBatch.DrawString(Main.fontDeathText, displayableString, new Vector2(x, y), Color.IndianRed * 0.6f, 0f, middle1, 1f, SpriteEffects.None, 0f);
                // Text without shake
                Main.spriteBatch.DrawString(Main.fontDeathText, displayableString, new Vector2(x1, y1), Color.IndianRed, 0f, middle1, 1f, SpriteEffects.None, 0f);
                // Pages Found
                Main.spriteBatch.DrawString(Main.fontDeathText, pagesFound, new Vector2(x1, m), moreLerpable, 0f, middle3, 0.4f, SpriteEffects.None, 0f);
                if (Main.worldName == SpookyTerrariaUtils.slenderWorldName)
                {
                    Main.spriteBatch.DrawString(Main.fontDeathText, subString, new Vector2(x1, j), lerpable, 0f, middle2, 0.5f, SpriteEffects.None, 0f);
                }
                Main.spriteBatch.End();
            }
            if (player.GetModPlayer <SpookyPlayer>().pageDisplayTimer < 99 && player.GetModPlayer <SpookyPlayer>().pageDisplayTimer > 0)
            {
                // player.GetModPlayer<SpookyPlayer>().displayTimes++;
                SpookyTerrariaUtils.DrawPageInterface(choice);
            }
            if (player.GetModPlayer <SpookyPlayer>().pageDisplayTimer == 99)
            {
                choice = Main.rand.Next(1, 9);
            }
            float lighting = Lighting.GetSubLight(Main.MouseWorld).X;

            Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
            if (lighting > 0.05f)
            {
                if (!Main.gameMenu)
                {
                    if (Main.LocalPlayer.GetModPlayer <SpookyPlayer>().hoveringPageLeft || Main.LocalPlayer.GetModPlayer <SpookyPlayer>().hoveringPageRight || Main.LocalPlayer.GetModPlayer <SpookyPlayer>().hoveringPageWall)
                    {
                        string  pickUp = $"Right click to pick up";
                        Vector2 g      = Main.fontMouseText.MeasureString(pickUp);
                        // Main.spriteBatch.DrawString(Main.fontMouseText, pickUp, Main.MouseScreen + new Vector2(25, 25), Color.White, 0f, new Vector2(0, 0), Main.essScale * 5/*1f*/, SpriteEffects.None, 0f);
                        Main.spriteBatch.DrawString(Main.fontMouseText, pickUp, Main.MouseWorld + new Vector2(15, -35) - Main.screenPosition, Color.White * lighting, 0f, new Vector2(g.X / 2, 5), 1f, SpriteEffects.None, 0f);
                    }
                }
            }
            Main.spriteBatch.End();
        }
示例#30
0
        public override void AI()
        {
            projectile.netUpdate  = true;
            projectile.netUpdate2 = true;

            if (_existanceTimer < 15)
            {
                _existanceTimer++;
            }


            Helpers.CreateGeneralUseDust(4, projectile.Center - new Vector2(-3, 16).RotatedBy(projectile.rotation), Color.Cyan);

            if ((!Owner.active || Owner.dead) && projectile.ai[0] == 0)
            {
                projectile.Kill();
            }

            if (projectile.ai[1] == 0 && Owner.whoAmI == Main.myPlayer)
            {
                Owner.heldProj          = projectile.whoAmI;
                TLoZPlayer.HasBomb      = true;
                TLoZPlayer.ItemUseDelay = 15;
                projectile.Center       = new Vector2((int)Owner.position.X, (int)Owner.position.Y + Owner.gfxOffY) + new Vector2(10, -4);

                if (Owner.controlUseItem && Owner.itemAnimation == 0 && _existanceTimer >= 15)
                {
                    projectile.velocity = Owner.velocity.X != 0 && !Owner.controlDown? new Vector2(8 * Owner.direction, -8) : Vector2.Zero;
                    projectile.ai[1]    = 1;

                    TLoZPlayer.HasBomb = false;
                }
            }

            if (projectile.ai[1] >= 1)
            {
                projectile.velocity.Y += 0.3f;
            }

            if (projectile.wet)
            {
                projectile.velocity.X *= 0.98f;
                projectile.velocity.Y *= 0.7f;
            }

            if (projectile.timeLeft == 2)
            {
                Dusts();
                projectile.width   = 200;
                projectile.height  = 200;
                projectile.Center -= new Vector2(100, 100);
                Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SheikahExplosion"));
            }

            if (Main.myPlayer == Owner.whoAmI)
            {
                if (Vector2.Distance(projectile.Center, Owner.Center) <= 16 * 5)
                {
                    TLoZPlayer.IsNearBomb = true;

                    if (projectile.Hitbox.Contains(Main.MouseWorld.ToPoint()) && Owner.controlUseTile)
                    {
                        projectile.ai[0] = 0;
                        projectile.ai[1] = 0;
                    }
                }

                else if (Vector2.Distance(projectile.Center, Owner.Center) > 16 * 5 && RequiredRune && Owner.controlUseTile)
                {
                    projectile.damage = 200;
                    projectile.ai[0]  = 1;
                    projectile.ai[1]  = 2;
                }
            }

            Lighting.AddLight(projectile.Center, new Vector3(0.0f, 1.4f, 1.4f));
            projectile.velocity = Collision.TileCollision(projectile.position, projectile.velocity, 20, 20, false, false, 1);
        }
示例#31
0
 public override void MeleeEffects(Player player, Rectangle hitbox)
 {
     Lighting.AddLight(player.position, 1.0f, 1.0f, 1.0f);
 }