public override void AI() { base.AI(); if (Animations.Count <= 0) { return; } OwnerCtrlUse = Owner.controlUseTile; projectile.width = (int)CurrentAnimation.FrameSize.X; projectile.height = (int)CurrentAnimation.FrameSize.Y; IsFlipped = Owner.direction == 1; projectile.timeLeft = 200; projectile.friendly = true; if (Owner.whoAmI == Main.myPlayer) { /*if (TBAInputs.StandPose.JustPressed) * if (CurrentState == ANIMATION_IDLE) * IsTaunting = true; * else * IsTaunting = false;*/ if (TBAInputs.SummonStand.JustPressed && InIdleState) { CurrentState = ANIMATION_DESPAWN; } } int xOffset = IsTaunting || CurrentState.Contains("PUNCH") || CurrentState.Contains("ATT") || CurrentState == "DONUT_UNDO" || CurrentState == "DONUT_MISS" || RushTimer > 0? 34 : -16; int yOffset = CurrentState.Contains("POSE") ? 36 : 0; xOffset = CurrentState.Contains("POSE") ? 24 : xOffset; PositionOffset = Owner.Center + new Vector2(xOffset * Owner.direction, -24 + Owner.gfxOffY + yOffset); projectile.Center = Vector2.Lerp(projectile.Center, PositionOffset, 0.26f); if (CurrentState == ANIMATION_SUMMON) { Opacity = 1; } #region Punching if (InIdleState) { if (TBAInputs.StandPose.JustPressed && Owner.whoAmI == Main.myPlayer) { CurrentState = "POSE_PREP"; } if (StopsItemUse) { if (PunchCounter < 2) { projectile.netUpdate = true; if (TBAPlayer.Get(Owner).MouseOneTimeReset > 0) { if (TBAPlayer.Get(Owner).MouseOneTime < 15 && !Owner.controlUseItem) { TBAPlayer.Get(Owner).Stamina -= 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 = 28; Projectile.NewProjectile(projectile.Center, VectorHelpers.DirectToMouse(projectile.Center, 22f), ModContent.ProjectileType <Punch>(), 60, 3.5f, Owner.whoAmI, projectile.whoAmI); } if (TBAPlayer.Get(Owner).MouseOneTime >= 15) { TBAPlayer.Get(Owner).Stamina -= 10; Owner.direction = Main.MouseWorld.X < Owner.Center.X ? -1 : 1; CurrentState = "CUT_PREP"; } } } else if (Owner.controlUseItem) { projectile.netUpdate = true; TBAPlayer.Get(Owner).CheckStaminaCost(16, true); 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, 18f); 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 <CrimsonBarrage>(), 60, 0, Owner.whoAmI); if (Main.projectile[barrage].modProjectile is CrimsonBarrage crimsonBarrage) { crimsonBarrage.RushDirection = PunchRushDirection; crimsonBarrage.ParentProjectile = projectile.whoAmI; } } } } #endregion #region Rush Animations["RUSH_DOWN"].AutoLoop = RushTimer > 0; Animations["RUSH_UP"].AutoLoop = RushTimer > 0; Animations["RUSH_MID"].AutoLoop = RushTimer > 0; #endregion if (CurrentState.Contains("PUNCH") || CurrentState.Contains("ATT") || CurrentState.Contains("UNDO") || CurrentState == "DONUT_MISS") { Owner.heldProj = projectile.whoAmI; } #region Yeet attacc // If we do a YEET attack, damage is dealt by stand itself instead of a seperate projectile bool yeeting = CurrentState == "CUT_ATT" && CurrentAnimation.CurrentFrame > 3 && CurrentAnimation.CurrentFrame < 9; bool donuting = CurrentState == "DONUT_ATT" && CurrentAnimation.CurrentFrame == 3; projectile.damage = yeeting ? 400 : 0; if (donuting && Owner.ownedProjectileCounts[ModContent.ProjectileType <DonutPunch>()] <= 1) { Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType <DonutPunch>(), 60, 0, Owner.whoAmI, projectile.whoAmI, -1); } if (CurrentState == "CUT_IDLE" && !Owner.controlUseItem) { CurrentAnimation.ResetAnimation(); CurrentState = "CUT_ATT"; } #endregion if (StopsItemUse && TBAPlayer.Get(Owner).MouseTwoTime > 20 && InIdleState) { TBAPlayer.Get(Owner).CheckStaminaCost(10, true); CurrentState = "DONUT_PREP"; } if (CurrentState == "DONUT_IDLE" && !OwnerCtrlUse) { CurrentAnimation.ResetAnimation(); CurrentState = "DONUT_ATT"; } Animations["DONUT_UNDO"].FrameSpeed = Animations["DONUT_UNDO"].CurrentFrame < 5 ? 12 : 5; if (InIdleState && CurrentAnimation.Finished) { CurrentAnimation.ResetAnimation(); } if (CurrentState == ANIMATION_DESPAWN) { Opacity = (5 - CurrentAnimation.FrameRect.Y / (int)CurrentAnimation.FrameSize.Y) * 0.2f; if (CurrentAnimation.Finished) { KillStand(); } } if (InIdleState) { HasMissedDonut = true; } if (CurrentState == "DONUT_ATT") { Animations["DONUT_ATT"].SetNextAnimation(HasMissedDonut ? Animations["DONUT_MISS"] : Animations["DONUT_UNDO"]); } if (TBAInputs.ContextAction.JustPressed && Owner.whoAmI == Main.myPlayer && !CurrentState.Contains("RUSH")) { EraseTime(); } if (TBAInputs.StandPose.JustPressed && Owner.whoAmI == Main.myPlayer && CurrentState == "POSE_IDLE") { CurrentState = "POSE_END"; } if (CurrentState.Contains("POSE")) { Owner.heldProj = projectile.whoAmI; } }
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; } } } }
private void SpawnPunch() { Projectile.NewProjectile(projectile.Center, VectorHelpers.DirectToMouse(projectile.Center, 22f), ModContent.ProjectileType <Punch>(), 80, 3.5f, Owner.whoAmI, projectile.whoAmI); }
public override void AI() { base.AI(); IsFlipped = Owner.direction == 1; if (Animations.Count > 0) { Animations["RUSH_DOWN"].AutoLoop = RushTimer > 0; Animations["RUSH_UP"].AutoLoop = RushTimer > 0; Animations["RUSH_MID"].AutoLoop = RushTimer > 0; } if (CurrentState == ANIMATION_SUMMON) { Width = Height = 40; if (CurrentAnimation.CurrentFrame < 9) { IsFlipped = Owner.direction == -1; } Opacity = 1f; XPosOffset = 18; YPosOffset = -24; } PositionOffset = Owner.Center + new Vector2(XPosOffset * -Owner.direction, YPosOffset); projectile.Center = Vector2.Lerp(projectile.Center, PositionOffset, 0.26f); if (CurrentState == ANIMATION_DESPAWN) { Opacity -= 0.12f; YPosOffset += 4; XPosOffset -= 3; if (CurrentAnimation.Finished) { KillStand(); } } if (InIdleState) { XPosOffset = 18; } if (CurrentState.Contains("SLASH") || CurrentState.Contains("RUSH")) { XPosOffset = -32; } #region controls if (Owner.whoAmI == Main.myPlayer) { if (InIdleState) { if (TBAInputs.SummonStand.JustPressed) { CurrentState = ANIMATION_DESPAWN; } 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, true); Owner.direction = Main.MouseWorld.X < Owner.Center.X ? -1 : 1; string useAlt = (Main.rand.NextBool() ? "" : "ALT"); if (Main.MouseWorld.Y > Owner.Center.Y + 60) { CurrentState = "SLASH_DOWN" + useAlt; } else if (Main.MouseWorld.Y < Owner.Center.Y - 60) { CurrentState = "SLASH_UP" + useAlt; } else { CurrentState = "SLASH_MID" + useAlt; } PunchCounter++; PunchCounterReset = 28; Projectile.NewProjectile(projectile.Center, VectorHelpers.DirectToMouse(projectile.Center, 32f), ModContent.ProjectileType <Punch>(), 80, 3.5f, Owner.whoAmI, projectile.whoAmI); CurrentAnimation.ResetAnimation(); } } } else if (Owner.controlUseItem) { projectile.netUpdate = true; 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 <ChariotBarrage>(), 60, 0, Owner.whoAmI); if (Main.projectile[barrage].modProjectile is ChariotBarrage silverBarrage) { silverBarrage.RushDirection = PunchRushDirection; silverBarrage.ParentProjectile = projectile.whoAmI; } } } } #endregion }
public void Punching(bool left) { if (PunchCounter < 2) { TBAPlayer.Get(Owner).CheckStaminaCost(2); if (Main.MouseWorld.Y > Owner.Center.Y + 60) { CurrentState = left ? "DOWNPUNCH_LEFTHAND" : "DOWNPUNCH_RIGHTHAND"; } else if (Main.MouseWorld.Y < Owner.Center.Y - 60) { CurrentState = left ? "UPPUNCH_LEFTHAND" : "UPPUNCH_RIGHTHAND"; } else { CurrentState = left ? "MIDDLEPUNCH_LEFTHAND" : "MIDDLEPUNCH_RIGHTHAND"; } SpawnPunch(); SetOwnerDirection(); PunchCounter++; PunchCounterReset = 26; IsPunching = true; CurrentAnimation.ResetAnimation(); } else { TBAPlayer.Get(Owner).CheckStaminaCost(16, true); TBAMod.PlayVoiceLine("Sounds/StarPlatinum/Ora"); 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_MIDDLE"; } PunchCounter = 0; PunchCounterReset = 0; PunchRushDirection = VectorHelpers.DirectToMouse(projectile.Center, 18f); RushTimer = 180; int barrage = Projectile.NewProjectile(projectile.Center, PunchRushDirection, ModContent.ProjectileType <StarBarrage>(), 60, 0, Owner.whoAmI); if (Main.projectile[barrage].modProjectile is StarBarrage starBarrage) { starBarrage.RushDirection = PunchRushDirection; starBarrage.ParentProjectile = projectile.whoAmI; } SetOwnerDirection(180); CurrentAnimation.ResetAnimation(); } }