Пример #1
0
        public override void PostUpdate()
        {
            noContactDamageTime--;

            DialogSystem.Update();

            NPC.MoonLordCountdown = (NPC.MoonLordCountdown > 250) ? 250 : NPC.MoonLordCountdown;

            if (invincible)
            {
                Player.ghost = false;
            }

            CommandLogic.instance.Update();
            if (Main.playerInventory)
            {
                KingdomTerrahearts.instance.HideCommandUI();
            }
            else
            {
                if (lastHeldKeyblade > 0)
                {
                    KingdomTerrahearts.instance.ShowCommandUI();
                }
                else
                {
                    KingdomTerrahearts.instance.HideCommandUI();
                }
            }
            if (lastHeldKeyblade < 0)
            {
                guardType = blockingType.none;
            }
            if (guardTime == 30)
            {
                PlayGuardSound();
            }

            lastHeldKeyblade--;

            base.PostUpdate();

            lastHeldItem = Player.HeldItem;
        }
Пример #2
0
        public override void PreUpdate()
        {
            inTwilightTown = KingdomWorld.twilightBiome > 75 && !Main.gameMenu;

            if (levelUpShowingTime > 0)
            {
                KingdomTerrahearts.instance.ShowLevelUpUI();
            }
            else
            {
                KingdomTerrahearts.instance.HideLevelUpUI();
            }

            if (skipTime && Main.dayTime != skipToDay)
            {
                Main.time += 100;
            }
            else if (Main.dayTime == skipToDay)
            {
                skipTime = false;
            }

            if (curInvulnerabilityFrames > 0)
            {
                Player.immune = true;
                curInvulnerabilityFrames--;
            }

            if (Player.velocity.Y == 0)
            {
                curGlideTime = glideTime;
            }

            if (--secondChanceReload <= 0)
            {
                secondChanceReload = 0;
            }
            if (--autoHPReload <= 0)
            {
                autoHPReload = 0;
            }

            Player.noFallDmg = (tpFallImmunity > 0) ? true : Player.noFallDmg;

            if (invincible)
            {
                Player.ghost        = false;
                Player.statMana     = Player.statLifeMax;
                Player.statLife     = Player.statLifeMax;
                Player.maxMinions   = 1000;
                Player.slotsMinions = 1000;
                Player.merman       = true;
                Player.nightVision  = true;
                Player.noKnockback  = true;
                Player.blockRange   = 1000;
                Player.wallSpeed    = 1000;
                Player.tileSpeed    = 1000;
                Player.cLight       = 1;
                Player.blockRange   = 1000;
                Player.autoJump     = true;
                Player.wingTimeMax  = 1000000;
                Player.wingTime     = 1000000;
                Player.autoJump     = true;

                /*For Rolling
                 *
                 * Vector2 rotOrigin = player.Center - player.position;
                 * rotOrigin.Y *= 1.25f;
                 * player.fullRotationOrigin = rotOrigin;
                 * player.fullRotation = (float)Math.PI;
                 *
                 */
            }

            if (fightingInBattleground)
            {
                //check if really trapped
                bool newTrapped = false;
                for (int i = 0; i < Main.maxNPCs; i++)
                {
                    newTrapped = (isBoss(i) && Main.npc[i].life > 0 && Main.npc[i].active) ? true : newTrapped;
                }
                fightingInBattleground = newTrapped;

                //effects
                Vector2 nextPos = Player.Center + Player.velocity;

                collisionPoints.X = Math.Clamp(nextPos.X, initPosTrap.X, endPosTrap.X);
                collisionPoints.Y = Math.Clamp(nextPos.Y, initPosTrap.Y, endPosTrap.Y);

                collisionRight = nextPos.X > endPosTrap.X;
                collisionLeft  = nextPos.X < initPosTrap.X;
                collisionDown  = nextPos.Y > endPosTrap.Y;
                collisionUp    = nextPos.Y < initPosTrap.Y;

                Vector2 clampedPos = Player.Center;
                clampedPos.X  = Math.Min(endPosTrap.X, Math.Max(initPosTrap.X, clampedPos.X));
                clampedPos.Y  = Math.Min(endPosTrap.Y, Math.Max(initPosTrap.Y, clampedPos.Y));
                Player.Center = clampedPos;
            }
            else
            {
                initPosTrap = Vector2.Zero;
                endPosTrap  = Vector2.Zero;

                collisionRight = collisionLeft = collisionDown = collisionUp = false;
            }

            tpFallImmunity -= (tpFallImmunity > 0)?1:0;

            base.PreUpdate();


            guardTime = (guardTime > -100) ? guardTime - 1 : -100;

            if (guardTime <= 0)
            {
                guardProj     = -1;
                guardType     = blockingType.none;
                blockedAttack = false;
            }

            if (guardType != blockingType.none)
            {
                Player.velocity = Vector2.Zero;
                int projType = ModContent.ProjectileType <Projectiles.ScepTend.Vergil_Bubble>();

                float projScale = 1;
                switch (guardType)
                {
                case blockingType.normal:
                    projType = ProjectileID.Typhoon;
                    break;

                case blockingType.reflect:
                    projType = ModContent.ProjectileType <Projectiles.guardProjectile>();
                    break;

                case blockingType.reversal:
                    projScale = 5;
                    break;
                }

                if (guardProj == -1 || !Main.projectile[guardProj].active)
                {
                    ProjectileSource_Item source = new ProjectileSource_Item(Player, Player.HeldItem);
                    guardProj = Projectile.NewProjectile(source, Player.Center, Player.velocity, projType, 0, 0, Owner: Player.whoAmI);
                }
                Main.projectile[guardProj].scale    = projScale;
                Main.projectile[guardProj].timeLeft = guardTime;
            }
        }