Beispiel #1
0
        public override void AI()
        {
            Player      player    = Main.player[projectile.owner];
            LightPlayer modPlayer = player.GetModPlayer <LightPlayer>();

            //projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.985f;
            projectile.rotation = -0.8f;
            Color color = modPlayer.LightColor;

            //red | green| blue
            Lighting.AddLight(projectile.Center, color.R / 255, color.G / 255, color.B / 255);  //this defines the projectile light color

            /*if(projectile.ai[0] != (int)Math.Floor(projectile.ai[0])){
             *  Main.npc[(int)Math.Floor(projectile.ai[0])].position = projectile.Center - new Vector2(Main.npc[(int)projectile.ai[0]].width/2, Main.npc[(int)projectile.ai[0]].height/2);
             * }*/
            if (projectile.ai[1] > 0.1f && projectile.ai[1] < 0.7f)
            {
                Main.npc[(int)Math.Floor(projectile.ai[0])].position = projectile.Center - new Vector2(Main.npc[(int)projectile.ai[0]].width / 2, (Main.npc[(int)projectile.ai[0]].height / 4) * 3);
            }
            if (!Main.npc[(int)projectile.ai[0]].active)
            {
                projectile.Kill();
            }
            if (Main.rand.Next(2) == 0)
            {
                int dust = Dust.NewDust(projectile.Center, projectile.width, projectile.height, 267, projectile.velocity.X * 0.33f, projectile.velocity.Y * 0.33f, 100, color, 0.75f);
                Main.dust[dust].noGravity = true;
            }
        }
Beispiel #2
0
        public override void RightClick(Player player)
        {
            LightPlayer modPlayer = player.GetModPlayer <LightPlayer>();

            modPlayer.PointsInUse = Math.Max(modPlayer.PointsInUse - PointsUsed, 0);
            Item.NewItem((int)player.position.X, (int)player.position.Y, player.width, player.height, ItemType <LightI>(), (int)item.shopCustomPrice);
        }
Beispiel #3
0
        public override bool CanUseItem(Player player)
        {
            LightPlayer modPlayer = player.GetModPlayer <LightPlayer>();

            if (player.altFunctionUse == 2 && item.thrown)
            {
                stealthinit = true;
                item.thrown = false;
                item.melee  = true;
            }
            else if (player.altFunctionUse == 0 && item.melee)
            {
                item.damage = (int)((50 + charge) * (1 + (modPlayer.LightStealth / 500)));
                item.thrown = true;
                item.melee  = false;
                //modPlayer.LightStealth = 0;
            }
            else if (player.altFunctionUse == 2 && item.melee)
            {
                item.damage       = (int)((50 + charge) * (2 + (modPlayer.LightStealth / 500)));
                item.useStyle     = 3;
                item.noMelee      = false;
                item.noUseGraphic = false;
                //modPlayer.LightStealth = 0;
            }
            return(base.CanUseItem(player));
        }
Beispiel #4
0
        public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
        {
            Player      player    = Main.player[projectile.owner];
            LightPlayer modPlayer = player.GetModPlayer <LightPlayer>();
            float       speedDiv  = 1.75f;
            Vector2     targvel   = target.velocity;
            Vector2     playervel = player.velocity;

            if (projectile.velocity.X < -0.5)
            {
                target.velocity.X = (float)Math.Max(Main.player[projectile.owner].velocity.X, Math.Max((projectile.velocity.X * movementFactor / speedDiv), -24) * Math.Max(target.knockBackResist, 0));
                Main.player[projectile.owner].velocity.X = (float)Math.Max(Main.player[projectile.owner].velocity.X, -Math.Max((projectile.velocity.X * movementFactor / speedDiv), -24) * Math.Max(1 - target.knockBackResist, 0));
            }
            else if (projectile.velocity.X > 0.5)
            {
                target.velocity.X = (float)Math.Min(Main.player[projectile.owner].velocity.X, Math.Min((projectile.velocity.X * movementFactor / speedDiv), 24) * Math.Max(target.knockBackResist, 0));
                Main.player[projectile.owner].velocity.X = (float)Math.Min(Main.player[projectile.owner].velocity.X, -Math.Min((projectile.velocity.X * movementFactor / speedDiv), 24) * Math.Max(1 - target.knockBackResist, 0));
            }
            if (projectile.velocity.Y < -0.5)
            {
                target.velocity.Y = (float)Math.Max(Main.player[projectile.owner].velocity.Y, Math.Max((projectile.velocity.Y * movementFactor / speedDiv), -24) * Math.Max(target.knockBackResist, 0));
                Main.player[projectile.owner].velocity.Y = (float)Math.Max(Main.player[projectile.owner].velocity.Y, -Math.Max((projectile.velocity.Y * movementFactor / speedDiv), -24) * Math.Max(1 - target.knockBackResist, 0));
            }
            else if (projectile.velocity.Y > 0.5)
            {
                target.velocity.Y = (float)Math.Min(Main.player[projectile.owner].velocity.Y, Math.Min((projectile.velocity.Y * movementFactor / speedDiv), 24) * Math.Max(target.knockBackResist, 0));
                Main.player[projectile.owner].velocity.Y = (float)Math.Min(Main.player[projectile.owner].velocity.Y, -Math.Min((projectile.velocity.Y * movementFactor / speedDiv), 24) * Math.Max(1 - target.knockBackResist, 0));
            }
            player.chatOverhead.NewMessage(target.knockBackResist + "", 60);
            Main.player[projectile.owner].wingTime = Main.player[projectile.owner].wingTimeMax;
        }
Beispiel #5
0
        public override void HoldItem(Player player)
        {
            LightPlayer modPlayer = player.GetModPlayer <LightPlayer>();

            item.holdStyle = 0;
            //item.defence = 30+charge;

            /*if (modPlayer.channeling <= 0)
             * {
             *      item.shoot = ProjectileType<LightDagger>();
             *      item.useStyle = 4;
             *      item.noUseGraphic = true;
             *      item.useTime = 20;
             *      item.useAnimation = 20;
             * }
             *
             * // From lunar emblems
             * if (modPlayer.channeling > 0)
             * {
             * if (player.itemAnimation == 0)
             * {
             *              player.controlUseItem = true;
             *              item.autoReuse = true;
             * }else{
             * player.releaseUseItem = true;
             *      }
             * }*/
        }
Beispiel #6
0
        public Color GetColor()
        {
            Player      player    = Main.player[projectile.owner];
            LightPlayer modPlayer = player.GetModPlayer <LightPlayer>();

            return(modPlayer.lightColor);
        }
Beispiel #7
0
        public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
        {
            LightPlayer modPlayer = player.GetModPlayer <LightPlayer>();
            Color       color     = modPlayer.LightColor;
            Vector2     velocity;

            if (player.altFunctionUse == 2 && player.itemAnimation < 25) //Right click
            {
                Main.PlaySound(SoundID.Item1, (int)player.position.X, (int)player.position.Y);
                //Main.PlaySound(32, (int)player.position.X, (int)player.position.Y, 21, 5f);
                //Main.PlaySound(13, (int)player.position.X, (int)player.position.Y, 1);
                //Main.PlaySound(42, (int)player.position.X, (int)player.position.Y, 63);
                for (int i = 0; i < 20; i++)                                                                                          //Makes 20 attempts at finding a projectile position that the player can reach. Gives up otherwise.
                {
                    position = player.MountedCenter + (RandomFloat(FullCircle / -2).ToRotationVector2().OfLength(RandomInt(10, 50))); //Random rotation, random distance from the player

                    if (Collision.CanHit(player.MountedCenter, 18, 18, position, 0, 0))
                    {
                        break;
                    }
                }
                //velocity = new Vector2(player.direction * item.shootSpeed, 0); //Straight in the direction the player is facing
                velocity = Vector2.Lerp(Main.MouseWorld - player.Center, Main.MouseWorld - position, 0.5f).OfLength(item.shootSpeed + 1); //Direction is a middlepoint between straight from the player to the cursor and straight from the sword to the cursor
                Projectile.NewProjectile(position, velocity, type, damage, knockBack, player.whoAmI);
                for (int i = 0; i < 7; i++)                                                                                               //Makes 20 attempts at finding a projectile position that the player can reach. Gives up otherwise.
                {
                    int dust = Dust.NewDust(position - new Vector2(4, 8), 8, 16, 267, 0f, 0f, 0, color, 1f);
                    Main.dust[dust].noGravity = true;
                }
                return(false);                //So it doesn't shoot normally
            }
            return(true);
        }
Beispiel #8
0
        public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
        {
            LightPlayer modPlayer = player.GetModPlayer <LightPlayer>();
            Color       color     = modPlayer.lightColor;
            Vector2     velocity;

            if (player.altFunctionUse == 2 && player.itemAnimation < 25)
            {
                Main.PlaySound(SoundID.Item1, (int)player.position.X, (int)player.position.Y);

                //Makes 20 attempts at finding a projectile position that the player can reach. Gives up otherwise.
                for (int i = 0; i < 20; i++)
                {
                    //Random rotation, random distance from the player
                    position = player.MountedCenter + (Main.rand.NextVector2CircularEdge(1, 1) * Main.rand.NextFloat(10, 50));

                    if (Collision.CanHit(player.MountedCenter, 18, 18, position, 0, 0))
                    {
                        break;
                    }
                }
                //Direction is a middlepoint between straight from the player to the cursor and straight from the sword to the cursor
                velocity = Vector2.Lerp(Main.MouseWorld - player.Center, Main.MouseWorld - position, 0.5f).OfLength(item.shootSpeed + 1);
                Projectile.NewProjectile(position, velocity, type, damage, knockBack, player.whoAmI);
                for (int i = 0; i < 7; i++)
                {
                    int dust = Dust.NewDust(position - new Vector2(4, 8), 8, 16, 267, 0f, 0f, 0, color, 1f);
                    Main.dust[dust].noGravity = true;
                }
                return(false);
            }
            return(true);
        }
Beispiel #9
0
        public override void AI()
        {
            Player      player    = Main.player[projectile.owner];
            LightPlayer modPlayer = player.GetModPlayer <LightPlayer>();

            projectile.rotation = projectile.velocity.ToRotation() + 0.875f;
            Color color = modPlayer.lightColor;

            /*if(ModLoader.GetMod("CustomizerMod") != null){
             *      if(ModLoader.GetMod("CustomizerMod").mod.ammoShaders[projectile.owner] == GameShaders.Armor.GetShaderIdFromItemId(3556)){
             *
             *      }
             * }*/
            //red | green| blue
            Lighting.AddLight(projectile.Center, color.R / 255, color.G / 255, color.B / 255);  //this defines the projectile light color
            //int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Fire);   //this adds a vanilla terraria dust to the projectile
            int dust2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, /*DustID.AncientLight*/ 267, 0f, 0f, 0, color);

            //Main.dust[dust].velocity /= 30f;  //this modify the velocity of the first dust
            Main.dust[dust2].velocity /= 30f; //this modify the velocity of dust2
            //Main.dust[dust].scale = 1f;  //this modify the scale of the first dust
            Main.dust[dust2].scale     = 1f;  //this modify the scale of the dust2
            Main.dust[dust2].noGravity = true;
            if (projectile.ai[0] != 0 && projectile.ai[0] != -1 && Main.npc[(int)projectile.ai[0]].life > 0)
            {
                NPC     target2 = Main.npc[(int)projectile.ai[0]];
                Vector2 newvel  = new Vector2(target2.Center.X - projectile.position.X, target2.Center.Y - projectile.position.Y);
                newvel.Normalize();
                newvel *= projectile.velocity.Length();
                projectile.velocity = newvel;
            }
        }
Beispiel #10
0
        public override void MeleeEffects(Player player, Rectangle hitbox)
        {
            LightPlayer modPlayer = player.GetModPlayer <LightPlayer>();
            int         dust      = Dust.NewDust(hitbox.Center(), 0, 0, /*DustID.Vortex*/ 267, 0, 0, 25, modPlayer.LightColor);

            Main.dust[dust].noGravity = true;
        }
Beispiel #11
0
        public override bool OnPickup(Player player)
        {
            LightPlayer modPlayer = player.GetModPlayer <LightPlayer>();

            modPlayer.ShadeCure = 600;
            return(false);
        }
Beispiel #12
0
        public override bool OnTileCollide(Vector2 oldVelocity)
        {
            Player      player    = Main.player[projectile.owner];
            LightPlayer modPlayer = player.GetModPlayer <LightPlayer>();
            float       speedDiv  = 1.75f;

            if (oldVelocity.X < -0.5)
            {
                player.velocity.X = (float)Math.Max(player.velocity.X, -Math.Max(oldVelocity.X * movementFactor / speedDiv, -24));

                /*if(modPlayer.phasing || !Collision.CanHit(player.position, player.width, player.height, player.position-new Vector2((oldVelocity.X*movementFactor)-Math.Max(oldVelocity.X*movementFactor/speedDiv, -24), 0), player.width, player.height)){
                 *  player.position.X = player.position.X-((oldVelocity.X*movementFactor)-Math.Max(oldVelocity.X*movementFactor/speedDiv, -24));
                 * }//*/
                if (modPlayer.phasing)
                {
                    player.position.X = player.position.X - ((oldVelocity.X * movementFactor) - Math.Max(oldVelocity.X * movementFactor / speedDiv, -24));
                }
            }
            else if (oldVelocity.X > 0.5)
            {
                player.velocity.X = (float)Math.Min(player.velocity.X, -Math.Min(oldVelocity.X * movementFactor / speedDiv, 24));

                /*if(modPlayer.phasing || !Collision.CanHit(player.position, player.width, player.height, player.position-new Vector2((oldVelocity.X*movementFactor)-Math.Min(oldVelocity.X*movementFactor/speedDiv, 24), 0), player.width, player.height)){
                 *  player.position.X = player.position.X-((oldVelocity.X*movementFactor)-Math.Min(oldVelocity.X*movementFactor/speedDiv, 24));
                 * }//*/
                if (modPlayer.phasing)
                {
                    player.position.X = player.position.X - ((oldVelocity.X * movementFactor) - Math.Min(oldVelocity.X * movementFactor / speedDiv, 24));
                }
            }
            if (oldVelocity.Y < -0.5)
            {
                player.velocity.Y = (float)Math.Max(player.velocity.Y, -Math.Max(oldVelocity.Y * movementFactor / speedDiv, -24));

                /*if(modPlayer.phasing || !Collision.CanHit(player.position, player.width, player.height, player.position-new Vector2(0, (oldVelocity.Y*movementFactor)-Math.Max(oldVelocity.Y*movementFactor/speedDiv, -24)), player.width, player.height)){
                 *  player.position.Y = player.position.Y-((oldVelocity.Y*movementFactor)-Math.Min(oldVelocity.Y*movementFactor/speedDiv, 24));
                 * }//*/
                if (modPlayer.phasing)
                {
                    player.position.Y = player.position.Y - ((oldVelocity.Y * movementFactor) - Math.Max(oldVelocity.Y * movementFactor / speedDiv, -24));
                }
            }
            else if (oldVelocity.Y > 0.5)
            {
                player.velocity.Y = (float)Math.Min(player.velocity.Y, -Math.Min(oldVelocity.Y * movementFactor / speedDiv, 24));

                /*if(modPlayer.phasing || !Collision.CanHit(player.position, player.width, player.height, player.position-new Vector2(0, (oldVelocity.Y*movementFactor)-Math.Min(oldVelocity.Y*movementFactor/speedDiv, 24)), player.width, player.height)){
                 *  player.position.Y = player.position.Y-((oldVelocity.Y*movementFactor)-Math.Min(oldVelocity.Y*movementFactor/speedDiv, 24));
                 * }//*/
                if (modPlayer.phasing)
                {
                    player.position.Y = player.position.Y - ((oldVelocity.Y * movementFactor) - Math.Min(oldVelocity.Y * movementFactor / speedDiv, 24));
                }
            }
            projectile.velocity = oldVelocity;
            player.wingTime     = player.wingTimeMax;
            return(false);
        }
Beispiel #13
0
        public override bool OnPickup(Player player)
        {
            LightPlayer modPlayer = player.GetModPlayer <LightPlayer>();
            int         droppedby = item.value;

            item.value = 0;
            Light.SetBitToInt(ref modPlayer.PointsFrom, droppedby);
            return(true);
        }
Beispiel #14
0
        public override bool CanUseItem(Player player)
        {
            LightPlayer modPlayer = player.GetModPlayer <LightPlayer>();
            int         a         = NPC.NewNPC((int)Main.MouseWorld.X, (int)Main.MouseWorld.Y, mod.NPCType("LightForgeNpc"));

            ((LightForgeNpc)Main.npc[a].modNPC).owner = modPlayer;
            Main.npc[a].GivenName = ((LightForgeNpc)Main.npc[a].modNPC).TownNPCName();
            return(base.CanUseItem(player));
        }
Beispiel #15
0
        public override bool OnPickup(Player player)
        {
            LightPlayer lightPlayer = player.GetModPlayer <LightPlayer>();
            int         droppedby   = item.value;

            item.value = -1;
            lightPlayer.PointsCollected[item.value] = true;
            return(true);
        }
Beispiel #16
0
        public override bool CanPickup(Player player)
        {
            LightPlayer lightPlayer = player.GetModPlayer <LightPlayer>();

            if (lightPlayer.PointsCollected[item.value])
            {
                return(false);
            }
            return(true);
        }
Beispiel #17
0
        public override bool CanPickup(Player player)
        {
            LightPlayer modPlayer = player.GetModPlayer <LightPlayer>();

            if (Light.GetBitFromInt(modPlayer.PointsFrom, item.value) && item.value != 0)
            {
                return(false);
            }
            return(true);
        }
Beispiel #18
0
        public override void HoldItem(Player player)
        {
            LightPlayer modPlayer = player.GetModPlayer <LightPlayer>();

            item.holdStyle    = 0;
            item.pick         = 40 + charge;
            item.damage       = 5 + (int)((float)charge / 10);
            item.useTime      = 10;
            item.useAnimation = 10;
        }
Beispiel #19
0
        public static LightPlayer[] GetPlayers()
        {
            var cpy   = new List <LightPlayer>(players.Values);
            var array = new LightPlayer[freePlayerIDs.Count];

            foreach (var player in cpy)
            {
                array[player.ID] = player;
            }

            return(array);
        }
Beispiel #20
0
        public override void AI()
        {
            Player      projOwner = Main.player[projectile.owner];
            Player      player    = Main.player[projectile.owner];
            LightPlayer modPlayer = player.GetModPlayer <LightPlayer>();
            Color       color     = modPlayer.LightColor;

            //red | green| blue
            Lighting.AddLight(projectile.Center, color.R / 255, color.G / 255, color.B / 255);  //this defines the projectile light color
            Vector2 ownerMountedCenter = projOwner.RotatedRelativePoint(projOwner.MountedCenter, true);

            projectile.direction  = projOwner.direction;
            projOwner.heldProj    = projectile.whoAmI;
            projOwner.itemTime    = projOwner.itemAnimation;
            projectile.position.X = ownerMountedCenter.X - (float)(projectile.width / 2);
            projectile.position.Y = ownerMountedCenter.Y - (float)(projectile.height / 2);
            if (!projOwner.frozen)
            {
                if (movementFactor == 0f)
                {
                    movementFactor       = 3f;
                    projectile.netUpdate = true;
                }
                if (projOwner.itemAnimation < projOwner.itemAnimationMax / 3.1)
                {
                    movementFactor -= 2.4f;
                }
                else
                {
                    movementFactor += 2.1f;
                }
            }

            projectile.position += projectile.velocity * movementFactor;

            /*if (projOwner.itemAnimation == 0)
             * {
             *  projectile.Kill();
             * }*/

            if (projOwner.itemAnimation <= 1)
            {
                projectile.Kill();
            }

            if (Main.rand.Next(2) == 0)
            {
                int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, 267, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, color, 0.75f);
                Main.dust[dust].noGravity = true;
                //or 20 instead of 15
            }
        }
Beispiel #21
0
        public override void RightClick(Player player)
        {
            LightPlayer modPlayer = player.GetModPlayer <LightPlayer>();

            //modPlayer.PointsInUse = Math.Max(modPlayer.PointsInUse-4, 0);
            //Item.NewItem((int)player.position.X, (int)player.position.Y, player.width, player.height, ItemType<LightI>(), (int)item.shopCustomPrice);
            Item.NewItem((int)player.position.X, (int)player.position.Y, player.width, player.height, ItemID.SoulofLight, charges[0]);
            Item.NewItem((int)player.position.X, (int)player.position.Y, player.width, player.height, ItemID.SoulofNight, charges[1]);
            Item.NewItem((int)player.position.X, (int)player.position.Y, player.width, player.height, ItemID.SoulofFright, charges[2]);
            Item.NewItem((int)player.position.X, (int)player.position.Y, player.width, player.height, ItemID.SoulofMight, charges[3]);
            Item.NewItem((int)player.position.X, (int)player.position.Y, player.width, player.height, ItemID.SoulofSight, charges[4]);
            Item.NewItem((int)player.position.X, (int)player.position.Y, player.width, player.height, ItemID.SoulofFlight, charges[5]);
            Item.NewItem((int)player.position.X, (int)player.position.Y, player.width, player.height, ItemType <SoulOfInosite>(), charges[6]);
        }
Beispiel #22
0
        public override void Update(Player player, ref int buffIndex)
        {
            LightPlayer modPlayer = player.GetModPlayer <LightPlayer>();

            if (Main.expertMode)
            {
                player.buffTime[buffIndex]--;
            }

            /*player.magicDamage *= player.buffTime[buffIndex]/weakduration;
             * player.meleeDamage *= player.buffTime[buffIndex]/weakduration;
             * player.minionDamage *= player.buffTime[buffIndex]/weakduration;
             * player.thrownDamage *= player.buffTime[buffIndex]/weakduration;
             * modPlayer.lightdamage *= player.buffTime[buffIndex]/(weakduration/2);*/
            if (Main.rand.Next(3) == 0)
            {
                int dust2 = Dust.NewDust(player.Center, player.width, player.height, 226, 0f, 0f, 100, Color.Black);
                Main.dust[dust2].velocity /= 10f;
                Main.dust[dust2].scale     = 1f;
            }
            if (player.buffTime[buffIndex] > 0 && modPlayer.ShadeCure >= 1)
            {
                player.buffTime[buffIndex] = 0;
            }
            if (player.buffTime[buffIndex] <= 1 && modPlayer.ShadeCure < 1)
            {
                player.statLife = 0;
                for (int i = 0; i < 15; i++)
                {
                    Dust.NewDust(player.position, player.width, player.height, 14, 0f, 0f, 0, new Color(255, 0, 0));
                }
                //Main.PlaySound(2, player.position, 27); //crystal smash
                //Main.PlaySound(2, player.position, 45); //inferno fork
                //Main.PlaySound(2, player.position, 46); //hydra summon
                //Main.PlaySound(2, player.position, 104); //shadowflame?
                Main.PlaySound(2, player.position, 119);                 //phantasm dragon roar
                //Main.PlaySound(4, player.position, 6); //etherial gasp
                //Main.PlaySound(4, player.position, 39); //spectre
                //Main.PlaySound(4, player.position, 51); //reaper
                Main.PlaySound(5, player.position, 1);                //normal death
                //Main.PlaySound(2, player.position, 103);//shadowflame hex doll
                //player.dead = true;
                Terraria.DataStructures.PlayerDeathReason YUdie = new Terraria.DataStructures.PlayerDeathReason();
                YUdie.SourceCustomReason = player.name + " was edgy.";
                player.KillMe(YUdie, player.statLife, 0);
                player.respawnTimer = 300;
            }
        }
Beispiel #23
0
        public override void HoldItem(Player player)
        {
            LightPlayer modPlayer = player.GetModPlayer <LightPlayer>();

            item.holdStyle = 0;
            //item.defence = 30+charge;

            if (modPlayer.channeling > 0)
            {
                item.holdStyle = 1;
                Color color = modPlayer.LightColor;
                //red | green| blue
                Lighting.AddLight(player.Center, color.R / 255, color.G / 255, color.B / 255);            //this defines the projectile light color
                if (charge < maxcharge && base.CanUseItem(player))
                {
                    for (int j = 0; j < player.inventory.Length; j++)
                    {
                        if (player.inventory[j].type == ItemType <LightI>())
                        {
                            player.inventory[j].stack--;
                            charge++;
                        }
                    }
                }
            }

            /*if (modPlayer.channeling <= 0)
             * {
             *      item.shoot = ProjectileType<LightDagger>();
             *      item.useStyle = 4;
             *      item.noUseGraphic = true;
             *      item.useTime = 20;
             *      item.useAnimation = 20;
             * }
             *
             * // From lunar emblems
             * if (modPlayer.channeling > 0)
             * {
             * if (player.itemAnimation == 0)
             * {
             *              player.controlUseItem = true;
             *              item.autoReuse = true;
             * }else{
             * player.releaseUseItem = true;
             *      }
             * }*/
        }
Beispiel #24
0
        public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
        {
            Player      player    = Main.player[projectile.owner];
            LightPlayer modPlayer = player.GetModPlayer <LightPlayer>();
            //Redraw the projectile with the color not influenced by light
            Vector2 drawOrigin = new Vector2(Main.projectileTexture[projectile.type].Width * 0.5f, projectile.height * 0.5f);
            Color   color      = modPlayer.LightColor;

            /*for (int k = 0; k < projectile.oldPos.Length; k++)
             * {
             *      Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY);
             *      //Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length);
             *      spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f);
             * }//*/
            spriteBatch.Draw(Main.projectileTexture[projectile.type], projectile.position, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f);
            return(true);
        }
Beispiel #25
0
        public static bool Update(IPEndPoint endPoint, UpdateRequest state)
        {
            try {
                lastUpdated[endPoint] = DateTime.Now;

                LightPlayer player = players[endPoint];
                int         id     = player.ID;
                if (id != state.PlayerID)
                {
                    return(false);
                }

                UpdatePlayer(endPoint, state.Players[0]);

                if (state.Shots != null)
                {
                    LightShot shot = state.Shots[0];
                    if (shots.Any((x) => x.ID == shot.ID))
                    {
                        return(true);
                    }

                    Vector2i mousePos = new Vector2i(shot.Dest.X, shot.Dest.Y);
                    Vector2i hit      = new Player(player).HitScan(level, mousePos, players.Values);
                    shot.Dest = new LightVect2(hit);
                    shots.Add(shot);

                    LightPlayer target = FindTarget(shot, id);
                    if (target != null)
                    {
                        target.ReSpawn = true;
                        target.Deaths += 1;
                        player.Score  += 1;
                    }
                }
                return(true);
            }
            catch (KeyNotFoundException) {
                if (endPoint != lastUnkownEP)
                {
                    PrintErr($"update request: unknown player from {endPoint}");
                    lastUnkownEP = endPoint;
                }
                return(false);
            }
        }
Beispiel #26
0
        public override void AI()
        {
            Player      player    = Main.player[projectile.owner];
            LightPlayer modPlayer = player.GetModPlayer <LightPlayer>();

            projectile.rotation = projectile.velocity.ToRotation() + 0.785f;
            Color color = modPlayer.LightColor;

            //red | green| blue
            Lighting.AddLight(projectile.Center, color.R / 255, color.G / 255, color.B / 255);

            if (Main.rand.Next(2) == 0)
            {
                int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, 267, projectile.velocity.X * 0.33f, projectile.velocity.Y * 0.33f, 100, color, 0.75f);
                Main.dust[dust].noGravity = true;
            }
        }
Beispiel #27
0
        public override void HoldItem(Player player)
        {
            LightPlayer modPlayer = player.GetModPlayer <LightPlayer>();

            item.damage    = 125 + charge;
            item.holdStyle = 0;
            //2 is right click
            if (player.altFunctionUse == 0 && player.itemAnimation == 0)
            {
                item.useTime      = 20;
                item.useAnimation = 20;
            }
            else
            {
                item.damage = 25 + (charge / 5);
            }
            item.noUseGraphic = true;
            if (charge / maxcharge >= 0.75)
            {
                range = (int)(240 + (16 * (charge - (maxcharge * 0.75))));
            }
            if (modPlayer.Ulting && modPlayer.UltCD <= 0 && charge / maxcharge >= 0.75)
            {
                for (int i2 = 0; i2 < Main.npc.Length; i2++)
                {
                    NPC target2 = Main.npc[i2];
                    if (target2.Distance(player.Center) < range && !((target2.friendly || target2.damage == 0) || target2.immortal || !target2.chaseable) && target2.active)
                    {
                        //int a = Projectile.NewProjectile(target2.position.X, target2.position.Y, 0, -5, ProjectileType<RadialJavelin>(), item.damage*(6+(0.6*(charge-(maxcharge*0.75)))), 0, player.whoAmI);
                        target2.velocity = new Vector2(0, 0);
                        int a = Projectile.NewProjectile((float)target2.Center.X, (float)target2.Center.Y + 150, 0, -5, ProjectileType <RadialJavelin>(), (int)(item.damage * ((0.006 * (charge - (maxcharge * 0.75))))), 0, player.whoAmI, i2);
                        modPlayer.UltCD = (int)Math.Min(modPlayer.UltCD + (600.0f - modPlayer.UltCD) / 5, 600);
                    }
                }
                if (modPlayer.UltCD > 0)
                {
                    Main.NewText("Ultimate now on cooldown for " + Math.Round((float)modPlayer.UltCD / 60, 1) + " seconds.");
                }
                modPlayer.Ulting = false;
            }
            else if (modPlayer.Ulting && modPlayer.UltCD > 0)
            {
                Main.NewText("Ultimate on cooldown, " + Math.Round((float)modPlayer.UltCD / 60, 1) + " seconds left.");
            }
        }
Beispiel #28
0
        private static void UpdatePlayer(IPEndPoint endPoint, LightPlayer clientPlayer)
        {
            LightPlayer player = players[endPoint];

            player.Name      = clientPlayer.Name;
            player.Pos       = clientPlayer.Pos;
            player.State     = clientPlayer.State;
            player.Frame     = clientPlayer.Frame;
            player.Direction = clientPlayer.Direction;
            player.HookPoint = clientPlayer.HookPoint;
            player.Hooked    = clientPlayer.Hooked;

            if (clientPlayer.HasRespawned)
            {
                player.ReSpawn      = false;
                player.HasRespawned = false;
            }
        }
Beispiel #29
0
        public override void ModifyHitNPC(Player player, NPC target, ref int damage, ref float knockBack, ref bool crit)
        {
            LightPlayer modPlayer = player.GetModPlayer <LightPlayer>();

            if (stealthinit)
            {
                modPlayer.LightStealth = modPlayer.LightStealthMax;
                damage *= 2;
            }
            else
            {
                modPlayer.LightStealth /= 2;
            }
            if (target.modNPC != null && target.modNPC.mod.DisplayName.Contains("Calamity Mod"))
            {
                damage += (int)(target.lifeMax * 0.02);
            }
        }
Beispiel #30
0
        /*public override void MeleeEffects(Player player, Rectangle hitbox)
         * {
         *      if (Main.rand.Next(10) == 0)
         *      {
         *              int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, mod.DustType("Sparkle"));
         *      }
         * }//*/
        public override void ModifyTooltips(List <TooltipLine> tooltips)
        {
            Player      player    = Main.player[item.owner];
            LightPlayer modPlayer = player?.GetModPlayer <LightPlayer>();

            for (int i = 0; i < tooltips.Count; i++)
            {
                if (tooltips[i].text.Contains("DisplayCharge"))
                {
                    TooltipLine tip;
                    //tooltips[i].text.Substring(8, tooltips[i].text.Length-8);
                    tip = new TooltipLine(mod, "DisplayCharge",
                                          "current defence level: " + (int)(charge + 30));
                    //tip.overrideColor = new Color(255, 32, 174, 200);
                    tip.overrideColor = modPlayer?.lightColor;
                    tooltips.RemoveAt(i);
                    tooltips.Insert(i, tip);
                }
            }
        }
 public Player AddPlayer(LightPlayer lp)
 {
     Player p = new Player(lp.name);
     Character c = new Character(lp.character.textureName, pengine, lp.character.position, lp.character.size, lp.character.size.X);
     p.addCharacter(c);
     newPlayers.Enqueue(p);
     return p;
 }
 public void PushBack(LightPlayer.BL.Commands.CmdEnum cmd)
 {
     var startTime = CalculateFrameStartTime();
     var frame = _builder.CreateFrameByCmdEnum(cmd, startTime);
     Add(frame);
 }