コード例 #1
0
        public override void UpdateInventory(Player player)
        {
            EpikPlayer epikPlayer = player.GetModPlayer <EpikPlayer>();

            if (epikPlayer.sacrifice > 0)
            {
                epikPlayer.sacrifice = 0;
                charge++;
                if (charge >= 3)
                {
                    item.type = SanguineMaterial.id;
                    item.SetDefaults(item.type);
                }
            }
        }
コード例 #2
0
        public override void AI()
        {
            Player     player     = Main.player[projectile.owner];
            EpikPlayer epikPlayer = player.GetModPlayer <EpikPlayer>();
            float      fact       = 1;

            if (epikPlayer.yoteTimeCollide == (0, 0))
            {
                epikPlayer.orionDash = 20;
                Projectile explosion = Projectile.NewProjectileDirect(player.Bottom, Vector2.Zero, ProjectileID.SolarWhipSwordExplosion, 80, 12.5f, player.whoAmI, 1, 1);
                Vector2    exPos     = explosion.Center;
                explosion.height *= 8;
                explosion.width  *= 8;
                explosion.Center  = exPos;
                explosion.melee   = false;
                Main.PlaySound(SoundID.Item14, exPos);
            }
コード例 #3
0
        public override void UpdateInventory(Player player)
        {
            EpikPlayer epikPlayer = player.GetModPlayer <EpikPlayer>();

            epikPlayer.chargedAmber = true;
            int oldLife = epikPlayer.oldStatLife;
            int dmg     = oldLife - player.statLife;

            if (dmg <= 0)
            {
                return;
            }
            hp -= dmg;
            if (hp <= 0)
            {
                item.type = ItemID.LargeAmber;
                item.SetDefaults(item.type);
            }
        }
コード例 #4
0
        public override bool?CanUseGrapple(Player player)
        {
            EpikPlayer epikPlayer = player.GetModPlayer <EpikPlayer>();

            if (epikPlayer.yoteTimeCollide.y > 0 || epikPlayer.yoteTimeCollide.x != 0)
            {
                return(true);
            }
            Item item = new Item();

            item.SetDefaults(Orion_Boots.ID);
            bool cs = false;

            if (epikPlayer.orionDash == 0)
            {
                float f = 0;
                int   i = 0;
                player.PickAmmo(item, ref i, ref f, ref cs, ref i, ref f);
            }
            return(cs);
        }
コード例 #5
0
ファイル: Spring_Boots.cs プロジェクト: Tyfyter/EpikV2
        public override void AI()
        {
            Player     player     = Main.player[projectile.owner];
            EpikPlayer epikPlayer = player.GetModPlayer <EpikPlayer>();
            float      fact       = 1;

            if (epikPlayer.yoteTimeCollide.y > 0 && projectile.velocity.Y > 0)
            {
                projectile.velocity.Y = 0;
                fact *= Spring_Boots.collisionMult;
            }
            else if (epikPlayer.yoteTimeCollide.y < 0 && projectile.velocity.Y < 0)
            {
                projectile.velocity.Y = 0;
                fact *= Spring_Boots.collisionMult;
            }
            if (epikPlayer.yoteTimeCollide.x > 0 && projectile.velocity.X > 0)
            {
                projectile.velocity.X = 0;
                fact *= Spring_Boots.collisionMult;
            }
            else if (epikPlayer.yoteTimeCollide.x < 0 && projectile.velocity.X < 0)
            {
                projectile.velocity.X = 0;
                fact *= Spring_Boots.collisionMult;
            }
            Vector2 normProjVel = projectile.velocity.SafeNormalize(Vector2.Zero);
            Vector2 d           = player.velocity.SafeNormalize(Vector2.Zero) * normProjVel;
            float   v           = projectile.velocity.Length();
            float   pv          = player.velocity.Length();

            v -= (float)Math.Max(Math.Min((v - pv) * Math.Pow(d.X + d.Y, 3f), v), 0);
            if ((d.X + d.Y) > 0 && pv > 16)
            {
                v = Math.Max(v - pv / 1.25f, 0);
            }
            player.velocity += normProjVel * v * fact;
            projectile.Kill();
        }
コード例 #6
0
 public override void UpdateInventory(Item item, Player player)
 {
     if (player.GetModPlayer <EpikPlayer>().golemTime > 0)
     {
         bool consumed = false;
         if (item.type == ItemID.LargeEmerald)
         {
             item.type = AquamarineMaterial.id;
             item.SetDefaults(item.type);
             consumed = true;
         }
         else if (item.type == ItemID.LargeAmber)
         {
             item.type = SunstoneMaterial.id;
             item.SetDefaults(item.type);
             consumed = true;
         }
         if (consumed)
         {
             player.GetModPlayer <EpikPlayer>().golemTime = 0;
         }
     }/*else if(item.type==ItemID.LargeDiamond&&EpikWorld.EmpressTime>0) {
       * item.type = MoonlaceStaffMaterial.id;
       * item.SetDefaults(item.type);
       * }*/
     if (item.type == ItemID.LargeRuby)
     {
         EpikPlayer epikPlayer = player.GetModPlayer <EpikPlayer>();
         if (epikPlayer.sacrifice > 0)
         {
             epikPlayer.sacrifice = 0;
             item.type            = SanguineMaterialPartial.id;
             item.SetDefaults(item.type);
         }
     }
 }
コード例 #7
0
ファイル: Moonlight_Staff.cs プロジェクト: Tyfyter/EpikV2
        public override void AI()
        {
            Player     player     = Main.player[projectile.owner];
            EpikPlayer epikPlayer = player.GetModPlayer <EpikPlayer>();

            #region Active check
            // This is the "active check", makes sure the minion is alive while the player is alive, and despawns if not
            if (player.dead || !player.active)
            {
                player.ClearBuff(Moonlace_Buff.ID);
            }
            if (player.HasBuff(Moonlace_Buff.ID))
            {
                projectile.timeLeft = 2;
            }
            #endregion

            #region General behavior
            idlePosition = player.Top;
            int   threads    = (++epikPlayer.moonlightThreads + 1) / 2;
            float centerDist = 36 * threads;
            idlePosition.X -= centerDist * player.direction;

            // Teleport to player if distance is too big
            Vector2 vectorToIdlePosition   = idlePosition - projectile.Center;
            float   distanceToIdlePosition = vectorToIdlePosition.Length();
            if (Main.myPlayer == player.whoAmI && distanceToIdlePosition > 2000f)
            {
                // Whenever you deal with non-regular events that change the behavior or position drastically, make sure to only run the code on the owner of the projectile,
                // and then set netUpdate to true
                projectile.Center    = idlePosition;
                projectile.velocity *= 0.1f;
                projectile.netUpdate = true;
            }

            // If your minion is flying, you want to do this independently of any conditions
            float overlapVelocity = 0.04f;
            for (int i = 0; i < Main.maxProjectiles; i++)
            {
                // Fix overlap with other minions
                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
            // Starting search distance
            float   distanceFromTarget = 800f;
            Vector2 targetCenter       = projectile.Center;
            int     oldTarget          = (int)projectile.localAI[0];
            int     target             = 0;
            bool    foundTarget        = false;
            if (oldTarget >= 0 && !Main.npc[oldTarget].active)
            {
                projectile.localAI[0] = oldTarget = -1;
            }

            if (!foundTarget)
            {
                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;
                        target             = player.MinionAttackTargetNPC;
                        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;
                            if ((closest && inRange) || !foundTarget)
                            {
                                distanceFromTarget = between;
                                targetCenter       = npc.Center;
                                target             = npc.whoAmI;
                                foundTarget        = true;
                            }
                        }
                    }
                }
            }
            projectile.friendly = foundTarget;
            #endregion

            #region Movement
            // Default movement parameters (here for attacking)
            float speed   = 8f;
            float inertia = 1.1f;
            if (foundTarget)
            {
                speed = 4f;
                if ((int)projectile.localAI[0] != target)
                {
                    speed = distanceFromTarget;
                }
                projectile.localAI[0] = target;
                // Minion has a target: attack (here, fly towards the enemy)
                // The immediate range around the target (so it doesn't latch onto it when close)
                Vector2 dirToTarg = targetCenter - projectile.Center;
                dirToTarg.Normalize();
                dirToTarg          *= speed;
                projectile.velocity = (projectile.velocity * (inertia - 1) + dirToTarg) / inertia;
            }
            else
            {
                vectorToIdlePosition = MagnitudeMin(vectorToIdlePosition, speed);
                if (distanceToIdlePosition < 1)
                {
                    projectile.Center   = idlePosition;
                    projectile.velocity = Vector2.Zero;
                    IdleDance();
                }
                else
                {
                    projectile.velocity = vectorToIdlePosition;
                    idleVelocity        = Vector2.Zero;
                    LinearSmoothing(ref idleOffset, Vector2.Zero, 0.5f);
                }
            }
            #endregion
        }
コード例 #8
0
ファイル: Spring_Boots.cs プロジェクト: Tyfyter/EpikV2
        public override bool?CanUseGrapple(Player player)
        {
            EpikPlayer epikPlayer = player.GetModPlayer <EpikPlayer>();

            return(epikPlayer.yoteTimeCollide.y > 0 || epikPlayer.yoteTimeCollide.x != 0);
        }