public override void AI() { base.AI(); Opacity = 1f; IsFlipped = Owner.direction == 1; projectile.timeLeft = 200; int xOffset = CurrentState.Contains("PUNCH") || CurrentState.Contains("RUSH") || CurrentState == "THROW_KNIVES" || CurrentState == TIMESTOP_ANIMATION ? 34 : -16; PositionOffset = Owner.Center + new Vector2(xOffset * Owner.direction, -24 + Owner.gfxOffY); if (CurrentState.Contains("PUNCH") || CurrentState == "SLAM" || CurrentState == "THROW_KNIVES" || CurrentState == TIMESTOP_ANIMATION) { Owner.heldProj = projectile.whoAmI; } projectile.Center = Vector2.Lerp(projectile.Center, PositionOffset, 0.26f); if (CurrentState == "THROW_KNIVES") { if (CurrentAnimation.CurrentFrame == 10) { Vector2 direction = VectorHelpers.DirectToMouse(projectile.Center, 14f); if (Owner.Center.X + direction.X > Owner.Center.X) { Owner.direction = 1; } else { Owner.direction = -1; } for (int i = 0; i < 2; i++) { Projectile.NewProjectile(projectile.Center + direction * 2.2f + new Vector2(Main.rand.Next(-5, 5), Main.rand.Next(-34, 34)).RotatedBy(direction.ToRotation()), direction, ModContent.ProjectileType <Knife>(), 80, 3.5f, Owner.whoAmI, projectile.whoAmI); } } } if (CurrentState == ANIMATION_DESPAWN && CurrentAnimation.Finished && TimeStopDelay <= 0) { KillStand(); } if (InIdleState) { if (Owner.whoAmI == Main.myPlayer) { if (TBAInputs.StandPose.JustPressed) { if (CurrentState == ANIMATION_IDLE) { IsTaunting = true; } else { IsTaunting = false; } } if (TBAInputs.ExtraAction02.JustPressed && TBAPlayer.Get(Owner).CheckStaminaCost(10)) { CurrentState = "THROW_KNIVES"; } if (TBAInputs.SummonStand.JustPressed) { CurrentState = ANIMATION_DESPAWN; } int roadRollerCost = TimeStopManagement.TimeStopped ? 10 : 50; if (TBAInputs.ExtraAction01.JustPressed && !BeganAscending && TBAPlayer.Get(Owner).CheckStaminaCost(roadRollerCost)) { projectile.netUpdate = true; if (!TimeStopManagement.TimeStopped) { if (!TimeStopManagement.TimeStopped) { TBAMod.PlayVoiceLine("Sounds/TheWorld/TimeStop"); } IsTaunting = false; TimeStopDelay = 25; } Owner.Center -= new Vector2(0, 16); Owner.velocity.Y = -16; CurrentState = "FLY_UP"; projectile.netUpdate = true; TBAPlayer.Get(Owner).PointOfInterest = Main.screenPosition + new Vector2(Main.screenWidth, Main.screenHeight) * 0.5f; BeganAscending = true; } if (TBAInputs.ContextAction.JustPressed) { TimeStop(); } } if (StopsItemUse) { if (PunchCounter < 2) { if (TBAPlayer.Get(Owner).MouseOneTimeReset > 0) { projectile.netUpdate = true; if (TBAPlayer.Get(Owner).MouseOneTime < 15 && !Owner.controlUseItem) { TBAPlayer.Get(Owner).CheckStaminaCost(2); Owner.direction = Main.MouseWorld.X < Owner.Center.X ? -1 : 1; if (Main.MouseWorld.Y > Owner.Center.Y + 60) { CurrentState = "PUNCH_" + (Main.rand.NextBool() ? "R" : "L") + "D"; } else if (Main.MouseWorld.Y < Owner.Center.Y - 60) { CurrentState = "PUNCH_" + (Main.rand.NextBool() ? "R" : "L") + "U"; } else { CurrentState = "PUNCH_" + (Main.rand.NextBool() ? "R" : "L"); } PunchCounter++; PunchCounterReset = 32; Projectile.NewProjectile(projectile.Center, VectorHelpers.DirectToMouse(projectile.Center, 22f), ModContent.ProjectileType <Punch>(), 80, 3.5f, Owner.whoAmI, projectile.whoAmI); } } } else if (Owner.controlUseItem) { projectile.netUpdate = true; TBAMod.PlayVoiceLine("Sounds/TheWorld/MudaRush"); TBAPlayer.Get(Owner).CheckStaminaCost(16); if (Main.MouseWorld.Y > Owner.Center.Y + 60) { CurrentState = "RUSH_DOWN"; } else if (Main.MouseWorld.Y < Owner.Center.Y - 60) { CurrentState = "RUSH_UP"; } else { CurrentState = "RUSH_MID"; } RushTimer = 180; PunchRushDirection = VectorHelpers.DirectToMouse(projectile.Center, 22f); TBAPlayer.Get(Owner).AttackDirectionResetTimer = RushTimer; TBAPlayer.Get(Owner).AttackDirection = Main.MouseWorld.X < projectile.Center.X ? -1 : 1; int barrage = Projectile.NewProjectile(projectile.Center, PunchRushDirection, ModContent.ProjectileType <WorldBarrage>(), 60, 0, Owner.whoAmI); if (Main.projectile[barrage].modProjectile is WorldBarrage worldBarrage) { worldBarrage.RushDirection = PunchRushDirection; worldBarrage.ParentProjectile = projectile.whoAmI; } } } } if (TimeStopDelay > 1) { TimeStopDelay--; } else if (TimeStopDelay == 1) { if (!TimeStopManagement.TimeStopped) { Projectile.NewProjectile(Owner.Center, Vector2.Zero, ModContent.ProjectileType <TimeStopVFX>(), 0, 0, Owner.whoAmI); Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/TheWorld/TheWorld_ZaWarudoSFX")); } TimeStopManagement.ToggleTimeStopIfStopper(TBAPlayer.Get(Owner), 11 * Constants.TICKS_PER_SECOND); TimeStopDelay--; } if (Animations.Count > 0) { Animations["RUSH_DOWN"].AutoLoop = RushTimer > 0; Animations["RUSH_UP"].AutoLoop = RushTimer > 0; Animations["RUSH_MID"].AutoLoop = RushTimer > 0; } if (BeganAscending) { if (AscensionTimer >= (int)(2 * Constants.TICKS_PER_SECOND)) { if (RoadRollerXAxis == -1.0f) { RoadRollerXAxis = Main.MouseWorld.X; } TBAPlayer.Get(Owner).PointOfInterest = new Vector2(MathHelper.Lerp(TBAPlayer.Get(Owner).PointOfInterest.X, RoadRollerXAxis, 0.1f), TBAPlayer.Get(Owner).PointOfInterest.Y); } if (++AscensionTimer >= (int)(2.5 * Constants.TICKS_PER_SECOND)) { TBAPlayer.Get(Owner).TirePlayer(30); projectile.netUpdate = true; TBAMod.PlayVoiceLine("Sounds/TheWorld/RoadRoller"); BeganAscending = false; AscensionTimer = 0; CurrentState = "SLAM"; HasResetRoadRollerDrop = false; RoadRollerID = Projectile.NewProjectile(new Vector2(RoadRollerXAxis, Owner.Center.Y), Vector2.Zero, ModContent.ProjectileType <RoadRoller>(), 20, 0, projectile.owner); RoadaRollaDa.spriteDirection = Owner.direction * -1; RoadaRollaDa.Center = new Vector2(RoadRollerXAxis, Owner.Center.Y); RoadRollerXAxis = -1.0f; } else { Owner.velocity = Vector2.Zero; Owner.Center -= new Vector2(0f, 10f); } } if (RoadaRollaDa.modProjectile is RoadRoller roller) { if (RushTimer > 0 && roller.HasTouchedGround || !roller.HasTouchedGround) { Owner.direction = RoadaRollaDa.spriteDirection * -1; Owner.Center = projectile.Center + new Vector2(20 * Owner.direction * -1, -20); projectile.Center = RoadaRollaDa.Center + new Vector2(40 * Owner.direction * -1, -40); } if (roller.HasTouchedGround && !HasResetRoadRollerDrop) { TBAMod.PlayVoiceLine("Sounds/TheWorld/MudaRush"); CurrentState = "RUSH_DOWN"; RushTimer = 180; PunchRushDirection = (RoadaRollaDa.Center - projectile.Center).SafeNormalize(-Vector2.UnitX) * 12f; TBAPlayer.Get(Owner).AttackDirectionResetTimer = RushTimer; TBAPlayer.Get(Owner).AttackDirection = RoadaRollaDa.Center.X < projectile.Center.X ? -1 : 1; TBAPlayer.Get(Owner).PointOfInterest = Vector2.Zero; HasResetRoadRollerDrop = true; int barrage = Projectile.NewProjectile(projectile.Center, PunchRushDirection, ModContent.ProjectileType <WorldBarrage>(), 60, 0, Owner.whoAmI); if (Main.projectile[barrage].modProjectile is WorldBarrage worldBarrage) { worldBarrage.RushDirection = PunchRushDirection; worldBarrage.ParentProjectile = projectile.whoAmI; } } } }
public override void AI() { base.AI(); Penetrate = -1; projectile.friendly = true; if (Animations.Count <= 0) { return; } if (CurrentState == ANIMATION_SUMMON) { if (CurrentAnimation.CurrentFrame < 3) { Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/StarPlatinum/SP_Spawn")); } Opacity = CurrentAnimation.FrameRect.Y / CurrentAnimation.FrameRect.Height * 0.25f; XPosOffset = -16; YPosOffset = -24; } if (InIdleState) { XPosOffset = -16; } #region Rush if (Animations.Count > 0) { Animations["RUSH_DOWN"].AutoLoop = RushTimer > 0; Animations["RUSH_UP"].AutoLoop = RushTimer > 0; Animations["RUSH_MIDDLE"].AutoLoop = RushTimer > 0; } #endregion TimeLeft = 200; // Runs on clients only if (Owner.whoAmI == Main.myPlayer) { if (TBAInputs.StandPose.JustPressed) { if (CurrentState == ANIMATION_IDLE) { IsTaunting = true; } else { IsTaunting = false; } } if (TBAInputs.SummonStand.JustPressed && CurrentState == ANIMATION_IDLE) { CurrentState = ANIMATION_DESPAWN; } if (TBAInputs.ContextAction.JustPressed && InIdleState) { TimeStop(); } } if (IsPunching || RushTimer > 0 || CurrentState.Contains("POSE") || CurrentState == "DONUT_PUNCH" || CurrentState == "DONUT_PULL" || CurrentState == TIMESTOP_ANIMATION) { XPosOffset = 34; } if (CurrentState == "DONUT_PUNCH" || CurrentState == "DONUT_PULL" || CurrentState == TIMESTOP_ANIMATION) { Owner.heldProj = projectile.whoAmI; } if (CurrentState == "DONUT_PUNCH" && CurrentAnimation.CurrentFrame == 4) { TBAMod.PlayVoiceLine("Sounds/StarPlatinum/Donut"); } if (CurrentState == "DONUT_PUNCH" && CurrentAnimation.CurrentFrame > 4) { Damage = 350; } else { Damage = 0; } if (CurrentState.Contains("BLOCK")) { Owner.heldProj = projectile.whoAmI; PositionOffset = Owner.Center + new Vector2(6 * Owner.direction, YPosOffset + Owner.gfxOffY); } else { PositionOffset = Owner.Center + new Vector2(XPosOffset * Owner.direction, YPosOffset + Owner.gfxOffY); } if (CurrentState.Contains("PUNCH")) { Owner.heldProj = projectile.whoAmI; } Center = Vector2.Lerp(projectile.Center, PositionOffset, 0.26f); if (IsTaunting) { if (!CurrentState.Contains("POSE")) { CurrentState = "POSE_TRANSITION"; CurrentAnimation.ResetAnimation(); } } if (!CurrentState.Contains("PUNCH")) { IsPunching = false; } #region Punch if (StopsItemUse) { if (InIdleState && TBAPlayer.Get(Owner).MouseOneTimeReset > 0 && TBAPlayer.Get(Owner).MouseOneTime < 15 && !Owner.controlUseItem) { projectile.netUpdate = true; Punching(Main.rand.Next(2) == 0); } } #endregion if (CurrentState == ANIMATION_DESPAWN) { Opacity = (5 - CurrentAnimation.FrameRect.Y / (int)CurrentAnimation.FrameSize.Y) * 0.2f; XPosOffset += 1; YPosOffset += 0.75f; if (CurrentAnimation.Finished) { KillStand(); } } if (CurrentState == ANIMATION_IDLE && Owner.controlDown) { CurrentState = "BLOCK_TRANSITION"; CurrentAnimation.ResetAnimation(); } IsFlipped = Owner.direction == 1; if (projectile.active) { Animations["POSE_IDLE"].AutoLoop = IsTaunting; Animations["BLOCK_IDLE"].AutoLoop = Owner.controlDown; } #region Time Stop if (TimeStopDelay > 1) { TimeStopDelay--; } else if (TimeStopDelay == 1) { projectile.netUpdate = true; if (!TimeStopManagement.TimeStopped) { Projectile.NewProjectile(Owner.Center, Vector2.Zero, ModContent.ProjectileType <TimeStopVFX>(), 0, 0, Owner.whoAmI); Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/StarPlatinum/SP_TimeStopSignal")); } TimeStopManagement.ToggleTimeStopIfStopper(TBAPlayer.Get(Owner), 7 * Constants.TICKS_PER_SECOND); TimeStopDelay--; } #endregion if (CurrentState == "POSE_IDLE" && !IsTaunting) { CurrentState = ANIMATION_IDLE; } if (StopsItemUse && TBAPlayer.Get(Owner).MouseOneTime >= 20 && InIdleState) { TBAPlayer.Get(Owner).CheckStaminaCost(15, true); CurrentState = "DONUT_PREP"; } if (CurrentState == "DONUT_IDLE" && !Owner.controlUseItem) { CurrentAnimation.ResetAnimation(); CurrentState = "DONUT_PUNCH"; } }