public void UpdateStandInfo() { Player player = Main.player[projectile.owner]; MyPlayer modPlayer = player.GetModPlayer <MyPlayer>(); newPunchTime = punchTime - modPlayer.standSpeedBoosts; newShootTime = shootTime - modPlayer.standSpeedBoosts; newMaxDistance = maxDistance + modPlayer.standRangeBoosts; newAltMaxDistance = maxAltDistance + modPlayer.standRangeBoosts; newPunchDamage = (int)(punchDamage * modPlayer.standDamageBoosts); newProjectileDamage = (int)(projectileDamage * modPlayer.standDamageBoosts); modPlayer.poseSoundName = poseSoundName; if (!playedSpawnSound) { Terraria.Audio.LegacySoundStyle spawnSound = JoJoStands.JoJoStandsSounds.GetLegacySoundSlot(SoundType.Custom, "Sounds/SummonCries/" + spawnSoundName); spawnSound.WithVolume(MyPlayer.soundVolume); Main.PlaySound(spawnSound, projectile.position); playedSpawnSound = true; } if (modPlayer.standType != standType) { modPlayer.standType = standType; } if (newPunchTime <= 2) { newPunchTime = 2; } if (newShootTime <= 5) { newShootTime = 5; } }
public static ReLogic.Utilities.SlotId PlayVanillaSound(Terraria.Audio.LegacySoundStyle soundId, Vector2 location, float volume = 1f, float pitchVariance = 0f) { if (Main.dedServ) { return(ReLogic.Utilities.SlotId.Invalid); } if (location == Vector2.Zero) { return(Main.PlayTrackedSound(soundId.WithVolume(volume).WithPitchVariance(pitchVariance), location)); } else { // this method doesn't return a sound effect instance, it just plays a sound. return(Main.PlayTrackedSound(soundId.WithVolume(volume).WithPitchVariance(pitchVariance), location)); } }
public override bool OnTileCollide(Vector2 oldVelocity) { Shatter(oldVelocity); Terraria.Audio.LegacySoundStyle glass = SoundID.Item27; glass.WithVolume(0.8f); Main.PlaySound(glass, projectile.position); return(base.OnTileCollide(oldVelocity)); }
public override void Kill(int timeLeft) { int rnd = Main.rand.Next(1, 4); for (int i = 0; i < rnd; i++) { Glass.CreateDust(this, projectile.Center); } Terraria.Audio.LegacySoundStyle glass = SoundID.Item27; glass.WithVolume(0.4f); Main.PlaySound(glass, projectile.position); }
public void PlayPunchSound() { if (punchSoundName != "" && !playedBeginning) { Terraria.Audio.LegacySoundStyle sound = JoJoStands.JoJoStandsSounds.GetLegacySoundSlot(SoundType.Custom, "Sounds/BattleCries/" + punchSoundName + "_Beginning"); sound.WithVolume(MyPlayer.soundVolume); //Main.PlaySound(sound, projectile.position); playedBeginning = true; } if (punchSoundName != "" && playedBeginning) { Terraria.Audio.LegacySoundStyle sound = JoJoStands.JoJoStandsSounds.GetLegacySoundSlot(SoundType.Custom, "Sounds/BattleCries/" + punchSoundName); sound.WithVolume(MyPlayer.soundVolume); Main.PlaySound(sound, projectile.position); } }
public override void AI() { SelectAnimation(); UpdateStandInfo(); updateTimer++; if (shootCount > 0) { shootCount--; } Player player = Main.player[projectile.owner]; MyPlayer modPlayer = player.GetModPlayer <MyPlayer>(); projectile.frameCounter++; if (modPlayer.StandOut) { projectile.timeLeft = 2; } if (projectile.spriteDirection == 1) { drawOffsetX = -10; } if (projectile.spriteDirection == -1) { drawOffsetX = -60; } drawOriginOffsetY = -halfStandHeight; if (updateTimer >= 90) //an automatic netUpdate so that if something goes wrong it'll at least fix in about a second { updateTimer = 0; projectile.netUpdate = true; } if (SpecialKeyPressed() && !player.HasBuff(mod.BuffType("TheWorldBuff")) && timestopStartDelay <= 0) { if (JoJoStands.JoJoStandsSounds == null) { timestopStartDelay = 120; } else { Terraria.Audio.LegacySoundStyle zawarudo = JoJoStands.JoJoStandsSounds.GetLegacySoundSlot(SoundType.Custom, "Sounds/SoundEffects/TheWorld"); zawarudo.WithVolume(MyPlayer.soundVolume); Main.PlaySound(zawarudo, projectile.position); timestopStartDelay = 1; } } if (timestopStartDelay != 0) { timestopStartDelay++; if (timestopStartDelay >= 120) { Timestop(2); timestopPoseTimer = 60; timestopStartDelay = 0; } } if (timestopPoseTimer > 0) { timestopPoseTimer--; normalFrames = false; attackFrames = false; abilityPose = true; Main.mouseLeft = false; Main.mouseRight = false; if (timestopPoseTimer <= 1) { abilityPose = false; } } if (!modPlayer.StandAutoMode) { if (Main.mouseLeft && projectile.owner == Main.myPlayer) { Punch(); } else { if (player.whoAmI == Main.myPlayer) { attackFrames = false; } } if (!attackFrames) { StayBehind(); } } if (modPlayer.StandAutoMode) { BasicPunchAI(); } }
public override void AI() { SelectAnimation(); UpdateStandInfo(); updateTimer++; if (shootCount > 0) { shootCount--; } Player player = Main.player[projectile.owner]; MyPlayer modPlayer = player.GetModPlayer <MyPlayer>(); projectile.frameCounter++; if (modPlayer.StandOut) { projectile.timeLeft = 2; } if (updateTimer >= 90) //an automatic netUpdate so that if something goes wrong it'll at least fix in about a second { updateTimer = 0; projectile.netUpdate = true; } if (SpecialKeyPressed() && !player.HasBuff(mod.BuffType("SkippingTime")) && !player.HasBuff(mod.BuffType("ForesightBuff"))) { if (JoJoStands.JoJoStandsSounds == null) { timeskipStartDelay = 80; } else { Terraria.Audio.LegacySoundStyle kingCrimson = JoJoStands.JoJoStandsSounds.GetLegacySoundSlot(SoundType.Custom, "Sounds/SoundEffects/KingCrimson"); kingCrimson.WithVolume(MyPlayer.soundVolume); Main.PlaySound(kingCrimson, projectile.position); timeskipStartDelay = 1; } } if (timeskipStartDelay != 0) { timeskipStartDelay++; if (timeskipStartDelay >= 80) { player.AddBuff(mod.BuffType("PreTimeSkip"), 10); Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/sound/TimeSkip")); timeskipStartDelay = 0; } } if (!modPlayer.StandAutoMode) { if (Main.mouseLeft && projectile.owner == Main.myPlayer) { HandleDrawOffsets(); attackFrames = true; normalFrames = false; Main.mouseRight = false; projectile.netUpdate = true; float rotaY = Main.MouseWorld.Y - projectile.Center.Y; projectile.rotation = MathHelper.ToRadians((rotaY * projectile.spriteDirection) / 6f); if (Main.MouseWorld.X > projectile.position.X) { projectile.spriteDirection = 1; projectile.direction = 1; } if (Main.MouseWorld.X < projectile.position.X) { projectile.spriteDirection = -1; projectile.direction = -1; } velocityAddition = Main.MouseWorld - projectile.position; velocityAddition.Normalize(); velocityAddition *= 5f; mouseDistance = Vector2.Distance(Main.MouseWorld, projectile.Center); if (mouseDistance > 40f) { projectile.velocity = player.velocity + velocityAddition; } if (mouseDistance <= 40f) { projectile.velocity = Vector2.Zero; } if (shootCount <= 0 && (projectile.frame == 0 || projectile.frame == 4)) { shootCount += newPunchTime; Vector2 shootVel = Main.MouseWorld - projectile.Center; if (shootVel == Vector2.Zero) { shootVel = new Vector2(0f, 1f); } shootVel.Normalize(); shootVel *= shootSpeed; int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, shootVel.X, shootVel.Y, mod.ProjectileType("Fists"), newPunchDamage, punchKnockback, projectile.owner, fistWhoAmI); Main.projectile[proj].netUpdate = true; projectile.netUpdate = true; } LimitDistance(); } else { if (player.whoAmI == Main.myPlayer) { attackFrames = false; } } if (!attackFrames) { StayBehind(); } if (Main.mouseRight && projectile.owner == Main.myPlayer && !player.HasBuff(mod.BuffType("AbilityCooldown")) && !player.HasBuff(mod.BuffType("ForesightBuff")) && !player.HasBuff(mod.BuffType("SkippingTime"))) { player.AddBuff(mod.BuffType("ForesightBuff"), 540); modPlayer.Foresight = true; if (Main.netMode == NetmodeID.MultiplayerClient) { ModNetHandler.effectSync.SendForesight(256, player.whoAmI, true, player.whoAmI); } } } if (modPlayer.StandAutoMode) { BasicPunchAI(); } }
public override void AI() { SelectFrame(); updateTimer++; if (shootCount > 0) { shootCount--; } Player player = Main.player[projectile.owner]; MyPlayer modPlayer = player.GetModPlayer <MyPlayer>(); projectile.frameCounter++; if (modPlayer.StandOut) { projectile.timeLeft = 2; } if (updateTimer >= 90) //an automatic netUpdate so that if something goes wrong it'll at least fix in about a second { updateTimer = 0; projectile.netUpdate = true; } if (JoJoStands.SpecialHotKey.JustPressed && !player.HasBuff(mod.BuffType("AbilityCooldown")) && !player.HasBuff(mod.BuffType("TheWorldBuff")) && projectile.owner == Main.myPlayer) { if (JoJoStands.JoJoStandsSounds == null) { timestopStartDelay = 240; } else { Terraria.Audio.LegacySoundStyle zawarudo = JoJoStands.JoJoStandsSounds.GetLegacySoundSlot(SoundType.Custom, "Sounds/SoundEffects/StarPlatinumTheWorld"); zawarudo.WithVolume(MyPlayer.soundVolume); Main.PlaySound(zawarudo, projectile.position); timestopStartDelay = 1; } } if (timestopStartDelay != 0) { timestopStartDelay++; if (timestopStartDelay >= 120) { Timestop(4); timestopStartDelay = 0; } } if (!modPlayer.StandAutoMode) { if (Main.mouseLeft && projectile.owner == Main.myPlayer && player.ownedProjectileCounts[mod.ProjectileType("StarFinger")] == 0) { Punch(); } else { if (player.whoAmI == Main.myPlayer) { attackFrames = false; } } if (!attackFrames) { StayBehindWithAbility(); } if (Main.mouseRight && shootCount <= 0 && player.ownedProjectileCounts[mod.ProjectileType("StarFinger")] == 0 && projectile.owner == Main.myPlayer) { shootCount += 120; Main.mouseLeft = false; Vector2 shootVel = Main.MouseWorld - projectile.Center; if (shootVel == Vector2.Zero) { shootVel = new Vector2(0f, 1f); } shootVel.Normalize(); shootVel *= shootSpeed; int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, shootVel.X, shootVel.Y, mod.ProjectileType("StarFinger"), (int)(altDamage * modPlayer.standDamageBoosts), 2f, Main.myPlayer, projectile.whoAmI); Main.projectile[proj].netUpdate = true; projectile.netUpdate = true; } if (player.ownedProjectileCounts[mod.ProjectileType("StarFinger")] != 0) { secondaryAbilityFrames = true; Main.mouseLeft = false; projectile.netUpdate = true; } } if (modPlayer.StandAutoMode) { PunchAndShootAI(mod.ProjectileType("StarFinger")); } }
public override void AI() { SelectAnimation(); UpdateStandInfo(); if (shootCount > 0) { shootCount--; } Player player = Main.player[projectile.owner]; MyPlayer modPlayer = player.GetModPlayer <MyPlayer>(); projectile.frameCounter++; if (modPlayer.StandOut) { projectile.timeLeft = 2; } if (!attackFrames) { StayBehind(); } else { GoInFront(); } if (player.ownedProjectileCounts[mod.ProjectileType("RedBind")] == 0) { secondaryAbilityFrames = false; } if (!modPlayer.StandAutoMode) { if (Main.mouseLeft && projectile.owner == Main.myPlayer && player.ownedProjectileCounts[mod.ProjectileType("RedBind")] == 0) { attackFrames = true; Main.mouseRight = false; projectile.netUpdate = true; if (shootCount <= 0) { shootCount += newShootTime; Vector2 shootVel = Main.MouseWorld - projectile.Center; if (shootVel == Vector2.Zero) { shootVel = new Vector2(0f, 1f); } shootVel.Normalize(); shootVel *= shootSpeed; int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, shootVel.X, shootVel.Y, mod.ProjectileType("FireAnkh"), newProjectileDamage, 3f, projectile.owner, chanceToDebuff, debuffDuration); Main.projectile[proj].netUpdate = true; projectile.netUpdate = true; } } else { if (player.whoAmI == Main.myPlayer) { normalFrames = true; attackFrames = false; } } if (Main.mouseRight && projectile.owner == Main.myPlayer && player.ownedProjectileCounts[mod.ProjectileType("RedBind")] == 0 && !player.HasBuff(mod.BuffType("AbilityCooldown"))) { secondaryAbilityFrames = true; Main.mouseLeft = false; projectile.netUpdate = true; if (JoJoStands.SoundsLoaded) { Terraria.Audio.LegacySoundStyle redBind = JoJoStands.JoJoStandsSounds.GetLegacySoundSlot(SoundType.Custom, "Sounds/SoundEffects/RedBind"); redBind.WithVolume(MyPlayer.soundVolume); Main.PlaySound(redBind, projectile.position); } Vector2 shootVel = Main.MouseWorld - projectile.Center; if (shootVel == Vector2.Zero) { shootVel = new Vector2(0f, 1f); } shootVel.Normalize(); shootVel *= 16f; int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, shootVel.X, shootVel.Y, mod.ProjectileType("RedBind"), newProjectileDamage, 3f, projectile.owner, projectile.whoAmI, debuffDuration - 60); Main.projectile[proj].netUpdate = true; projectile.netUpdate = true; player.AddBuff(mod.BuffType("AbilityCooldown"), modPlayer.AbilityCooldownTime(15)); } if (SpecialKeyPressed()) { for (int p = 1; p <= 50; p++) { float radius = p * 5; Vector2 offset = player.Center + (radius.ToRotationVector2() * 48f); int proj = Projectile.NewProjectile(offset.X, offset.Y, 0f, 0f, mod.ProjectileType("CrossfireHurricaneAnkh"), newProjectileDamage, 5f, projectile.owner, 48f, radius); Main.projectile[proj].netUpdate = true; projectile.netUpdate = true; } if (JoJoStands.SoundsLoaded) { Terraria.Audio.LegacySoundStyle crossFireHurricane = JoJoStands.JoJoStandsSounds.GetLegacySoundSlot(SoundType.Custom, "Sounds/SoundEffects/CrossfireHurricaneSpecial"); crossFireHurricane.WithVolume(MyPlayer.soundVolume); Main.PlaySound(crossFireHurricane, projectile.position); } player.AddBuff(mod.BuffType("AbilityCooldown"), modPlayer.AbilityCooldownTime(30)); } } if (modPlayer.StandAutoMode) { NPC target = null; Vector2 targetPos = projectile.position; float targetDist = 350f; if (target == null) { for (int k = 0; k < 200; k++) //the targeting system { NPC npc = Main.npc[k]; if (npc.CanBeChasedBy(this, false)) { float distance = Vector2.Distance(npc.Center, player.Center); if (distance < targetDist && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) { if (npc.boss) //is gonna try to detect bosses over anything { targetDist = distance; targetPos = npc.Center; target = npc; } else //if it fails to detect a boss, it'll detect the next best thing { targetDist = distance; targetPos = npc.Center; target = npc; } } } } } if (target != null) { attackFrames = true; normalFrames = false; if ((targetPos - projectile.Center).X > 0f) { projectile.spriteDirection = projectile.direction = 1; } else if ((targetPos - projectile.Center).X < 0f) { projectile.spriteDirection = projectile.direction = -1; } if (targetPos.X > projectile.position.X) { projectile.velocity.X = 4f; } if (targetPos.X < projectile.position.X) { projectile.velocity.X = -4f; } if (targetPos.Y > projectile.position.Y) { projectile.velocity.Y = 4f; } if (targetPos.Y < projectile.position.Y) { projectile.velocity.Y = -4f; } if (shootCount <= 0) { if (Main.myPlayer == projectile.owner) { shootCount += newShootTime; Vector2 shootVel = targetPos - projectile.Center; if (shootVel == Vector2.Zero) { shootVel = new Vector2(0f, 1f); } shootVel.Normalize(); shootVel *= shootSpeed; int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, shootVel.X, shootVel.Y, mod.ProjectileType("FireAnkh"), newProjectileDamage, 3f, projectile.owner, chanceToDebuff, debuffDuration); Main.projectile[proj].netUpdate = true; projectile.netUpdate = true; } } } else { normalFrames = true; attackFrames = false; } } }
public override void AI() { SelectAnimation(); UpdateStandInfo(); if (shootCount > 0) { shootCount--; } Player player = Main.player[projectile.owner]; MyPlayer mPlayer = player.GetModPlayer <MyPlayer>(); projectile.frameCounter++; if (mPlayer.StandOut) { projectile.timeLeft = 2; } if (Main.dayTime) { bubbleDamage = 180; } if (!Main.dayTime) { bubbleDamage = 158; } drawOriginOffsetY = -halfStandHeight; int newBubbleDamage = (int)(bubbleDamage * mPlayer.standDamageBoosts); if (!attackFrames) { StayBehind(); } if (attackFrames) { GoInFront(); } if (SpecialKeyPressed() && !player.HasBuff(mod.BuffType("BitesTheDust"))) { if (JoJoStands.JoJoStandsSounds == null) { btdStartDelay = 205; } else { Terraria.Audio.LegacySoundStyle biteTheDust = JoJoStands.JoJoStandsSounds.GetLegacySoundSlot(SoundType.Custom, "Sounds/SoundEffects/BiteTheDust"); biteTheDust.WithVolume(MyPlayer.soundVolume); Main.PlaySound(biteTheDust, projectile.position); btdStartDelay = 1; } } if (btdStartDelay != 0) { btdStartDelay++; if (btdStartDelay >= 205) { player.AddBuff(mod.BuffType("BitesTheDust"), 10); Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/sound/BiteTheDustEffect")); btdStartDelay = 0; } } if (!mPlayer.StandAutoMode) { if (Main.mouseLeft && projectile.owner == Main.myPlayer && projectile.ai[0] == 0f) { attackFrames = true; Main.mouseRight = false; projectile.netUpdate = true; if (projectile.frame == 4 && !mPlayer.StandAutoMode) { if (shootCount <= 0) { shootCount += newShootTime; Vector2 shootVel = Main.MouseWorld - projectile.Center; if (shootVel == Vector2.Zero) { shootVel = new Vector2(0f, 1f); } shootVel.Normalize(); shootVel *= shootSpeed; int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, shootVel.X, shootVel.Y, mod.ProjectileType("Bubble"), newBubbleDamage, 6f, projectile.owner, 1f, projectile.whoAmI); Main.projectile[proj].netUpdate = true; projectile.netUpdate = true; } } if (projectile.frame >= 5) { attackFrames = false; } } else if (!secondaryAbilityFrames) { if (player.whoAmI == Main.myPlayer) { normalFrames = true; attackFrames = false; } } if (Main.mouseRight && projectile.owner == Main.myPlayer && projectile.ai[0] == 0f) { secondaryAbilityFrames = true; projectile.ai[0] = 1f; //to detonate all bombos Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/sound/KQButtonClick")); } if (secondaryAbilityFrames && projectile.ai[0] == 1f) { if (projectile.frame >= 2) { projectile.ai[0] = 0f; normalFrames = true; attackFrames = false; secondaryAbilityFrames = false; } } } if (mPlayer.StandAutoMode) { NPC target = null; Vector2 targetPos = projectile.position; float targetDist = 350f; if (target == null) { for (int k = 0; k < 200; k++) //the targeting system { NPC npc = Main.npc[k]; if (npc.CanBeChasedBy(this, false)) { float distance = Vector2.Distance(npc.Center, player.Center); if (distance < targetDist && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) { if (npc.boss) //is gonna try to detect bosses over anything { targetDist = distance; targetPos = npc.Center; target = npc; } else //if it fails to detect a boss, it'll detect the next best thing { targetDist = distance; targetPos = npc.Center; target = npc; } } } } } if (target != null) { attackFrames = true; normalFrames = false; if ((targetPos - projectile.Center).X > 0f) { projectile.spriteDirection = projectile.direction = 1; } else if ((targetPos - projectile.Center).X < 0f) { projectile.spriteDirection = projectile.direction = -1; } if (attackFrames && projectile.frame == 5 && shootCount <= 0) { if (Main.myPlayer == projectile.owner) { shootCount += newShootTime; Vector2 shootVel = targetPos - projectile.Center; if (shootVel == Vector2.Zero) { shootVel = new Vector2(0f, 1f); } shootVel.Normalize(); shootVel *= shootSpeed; int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, shootVel.X, shootVel.Y, mod.ProjectileType("Bubble"), newBubbleDamage, 6f, projectile.owner, 0f, projectile.whoAmI); Main.projectile[proj].netUpdate = true; projectile.netUpdate = true; } } } else { normalFrames = true; attackFrames = false; } } }
public override void AI() { SelectAnimation(); UpdateStandInfo(); updateTimer++; if (shootCount > 0) { shootCount--; } Player player = Main.player[projectile.owner]; MyPlayer modPlayer = player.GetModPlayer <MyPlayer>(); projectile.frameCounter++; if (modPlayer.StandOut) { projectile.timeLeft = 2; } if (updateTimer >= 90) //an automatic netUpdate so that if something goes wrong it'll at least fix in about a second { updateTimer = 0; projectile.netUpdate = true; } if (SpecialKeyPressed() && !player.HasBuff(mod.BuffType("TheWorldBuff"))) { if (JoJoStands.JoJoStandsSounds == null) { timestopStartDelay = 120; } else { Terraria.Audio.LegacySoundStyle zawarudo = JoJoStands.JoJoStandsSounds.GetLegacySoundSlot(SoundType.Custom, "Sounds/SoundEffects/TheWorld"); zawarudo.WithVolume(MyPlayer.soundVolume); Main.PlaySound(zawarudo, projectile.position); timestopStartDelay = 1; } } if (timestopStartDelay != 0) { timestopStartDelay++; if (timestopStartDelay >= 120) { Timestop(9); timestopPoseTimer = 60; timestopStartDelay = 0; } } if (timestopPoseTimer > 0) { timestopPoseTimer--; normalFrames = false; attackFrames = false; secondaryAbilityFrames = false; abilityPose = true; Main.mouseLeft = false; Main.mouseRight = false; if (timestopPoseTimer <= 1) { abilityPose = false; } } if (!modPlayer.StandAutoMode) { if (Main.mouseLeft && projectile.owner == Main.myPlayer) { Punch(); } else { if (player.whoAmI == Main.myPlayer) { attackFrames = false; } } if (!attackFrames) { if (!secondaryAbilityFrames) { StayBehind(); projectile.direction = (projectile.spriteDirection = player.direction); } else { GoInFront(); if (Main.MouseWorld.X > projectile.position.X) { projectile.spriteDirection = 1; projectile.direction = 1; } if (Main.MouseWorld.X < projectile.position.X) { projectile.spriteDirection = -1; projectile.direction = -1; } } secondaryAbilityFrames = false; } if (Main.mouseRight && player.HasItem(mod.ItemType("Knife")) && projectile.owner == Main.myPlayer) { Main.mouseLeft = false; secondaryAbilityFrames = true; normalFrames = false; attackFrames = false; if (shootCount <= 0 && projectile.frame == 1) { shootCount += 13; // has to be half if the framecounter + 1 (2 if shootCount goes to -1) float rotationk = MathHelper.ToRadians(15); float numberKnives = 4; Vector2 shootVel = Main.MouseWorld - projectile.Center; if (shootVel == Vector2.Zero) { shootVel = new Vector2(0f, 1f); } shootVel.Normalize(); shootVel *= 100f; for (int i = 0; i < numberKnives; i++) { Vector2 perturbedSpeed = new Vector2(shootVel.X, shootVel.Y).RotatedBy(MathHelper.Lerp(-rotationk, rotationk, i / (numberKnives - 1))) * .2f; int proj = Projectile.NewProjectile(projectile.position.X + 5f, projectile.position.Y - 3f, perturbedSpeed.X, perturbedSpeed.Y, mod.ProjectileType("Knife"), (int)(altDamage * modPlayer.standDamageBoosts), 2f, player.whoAmI); Main.projectile[proj].netUpdate = true; player.ConsumeItem(mod.ItemType("Knife")); projectile.netUpdate = true; } } } if (SpecialKeyPressed() && player.HasBuff(mod.BuffType("TheWorldBuff")) && timestopPoseTimer <= 0 && player.ownedProjectileCounts[mod.ProjectileType("RoadRoller")] == 0) { if (JoJoStands.SoundsLoaded) { Main.PlaySound(JoJoStands.JoJoStandsSounds.GetLegacySoundSlot(SoundType.Custom, "Sounds/SoundEffects/RoadRollerDa")); } shootCount += 12; Vector2 shootVel = Main.MouseWorld - projectile.Center; if (shootVel == Vector2.Zero) { shootVel = new Vector2(0f, 1f); } shootVel.Normalize(); shootVel *= shootSpeed + 4f; int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, shootVel.X, shootVel.Y, mod.ProjectileType("RoadRoller"), 512, 12f, player.whoAmI); Main.projectile[proj].netUpdate = true; projectile.netUpdate = true; } } if (modPlayer.StandAutoMode) { PunchAndShootAI(mod.ProjectileType("Knife"), mod.ItemType("Knife"), true); } }
public override void AI() { SelectAnimation(); UpdateStandInfo(); updateTimer++; if (shootCount > 0) { shootCount--; } Player player = Main.player[projectile.owner]; MyPlayer modPlayer = player.GetModPlayer <MyPlayer>(); if (modPlayer.StandOut) { projectile.timeLeft = 2; } if (updateTimer >= 90) //an automatic netUpdate so that if something goes wrong it'll at least fix in about a second { updateTimer = 0; projectile.netUpdate = true; } if (SpecialKeyPressed() && !player.HasBuff(mod.BuffType("TheWorldBuff")) && timestopStartDelay <= 0) { if (JoJoStands.JoJoStandsSounds == null) { timestopStartDelay = 240; } else { Terraria.Audio.LegacySoundStyle zawarudo = JoJoStands.JoJoStandsSounds.GetLegacySoundSlot(SoundType.Custom, "Sounds/SoundEffects/StarPlatinumTheWorld"); zawarudo.WithVolume(MyPlayer.soundVolume); Main.PlaySound(zawarudo, projectile.position); timestopStartDelay = 1; } } if (timestopStartDelay != 0) { timestopStartDelay++; if (timestopStartDelay >= 120) { Timestop(4); timestopStartDelay = 0; } } if (!modPlayer.StandAutoMode) { if (Main.mouseLeft && projectile.owner == Main.myPlayer && player.ownedProjectileCounts[mod.ProjectileType("StarFinger")] == 0) { Punch(); } else { if (player.whoAmI == Main.myPlayer) { attackFrames = false; } } if (!attackFrames) { StayBehindWithAbility(); } if (Main.mouseRight && shootCount <= 0 && projectile.owner == Main.myPlayer) { int bulletIndex = GetPlayerAmmo(player); if (bulletIndex != -1) { Item bulletItem = player.inventory[bulletIndex]; if (bulletItem.shoot != -1) { flickFrames = true; if (projectile.frame == 1) { shootCount += 80; Main.mouseLeft = false; Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 41, 1f, 2.8f); Vector2 shootVel = Main.MouseWorld - projectile.Center; if (shootVel == Vector2.Zero) { shootVel = new Vector2(0f, 1f); } shootVel.Normalize(); shootVel *= 12f; int proj = Projectile.NewProjectile(projectile.Center, shootVel, bulletItem.shoot, (int)(altDamage * modPlayer.standDamageBoosts), bulletItem.knockBack, projectile.owner, projectile.whoAmI); Main.projectile[proj].netUpdate = true; projectile.netUpdate = true; if (bulletItem.Name.Contains("Bullet")) { player.ConsumeItem(bulletItem.type); } } } } else { if (player.ownedProjectileCounts[mod.ProjectileType("StarFinger")] == 0) { shootCount += 120; Main.mouseLeft = false; Vector2 shootVel = Main.MouseWorld - projectile.Center; if (shootVel == Vector2.Zero) { shootVel = new Vector2(0f, 1f); } shootVel.Normalize(); shootVel *= shootSpeed; int proj = Projectile.NewProjectile(projectile.Center, shootVel, mod.ProjectileType("StarFinger"), (int)(altDamage * modPlayer.standDamageBoosts), 4f, projectile.owner, projectile.whoAmI); Main.projectile[proj].netUpdate = true; projectile.netUpdate = true; } } } if (player.ownedProjectileCounts[mod.ProjectileType("StarFinger")] != 0) { secondaryAbilityFrames = true; Main.mouseLeft = false; projectile.netUpdate = true; } } if (modPlayer.StandAutoMode) { PunchAndShootAI(mod.ProjectileType("StarFinger"), shootMax: 1); } }
public override void AI() { PlayAnimations(); UpdateStandInfo(); Player player = Main.player[projectile.owner]; MyPlayer modPlayer = player.GetModPlayer <MyPlayer>(); projectile.frameCounter++; if (shootCount > 0) { shootCount--; } if (player.whoAmI == Main.myPlayer && modPlayer.tuskActNumber == 4) //Making an owner check cause tuskActNumber isn't in sync with other players, causing TA4 to die for everyone else { projectile.timeLeft = 10; } if (goldenRectangleEffectTimer >= 215) { if (JoJoStands.SoundsLoaded && !playedSound) { Terraria.Audio.LegacySoundStyle chumimiiin = JoJoStands.JoJoStandsSounds.GetLegacySoundSlot(SoundType.Custom, "Sounds/SoundEffects/Chumimiiin"); chumimiiin.WithVolume(MyPlayer.soundVolume); Main.PlaySound(chumimiiin, projectile.position); playedSound = true; } Dust.NewDust(projectile.position, projectile.width, projectile.height, 169, projectile.velocity.X, projectile.velocity.Y); Dust.NewDust(projectile.position, projectile.width, projectile.height, 169, projectile.velocity.X - 5f, projectile.velocity.Y + 5f); Dust.NewDust(projectile.position, projectile.width, projectile.height, 169, projectile.velocity.X + 5f, projectile.velocity.Y - 5f); Dust.NewDust(projectile.position, projectile.width, projectile.height, 169, projectile.velocity.X + 5f, projectile.velocity.Y + 5f); Dust.NewDust(projectile.position, projectile.width, projectile.height, 169, projectile.velocity.X - 5f, projectile.velocity.Y - 5f); //Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 169, projectile.velocity.X * -0.5f, projectile.velocity.Y * -0.5f); } if (goldenRectangleEffectTimer > 0) { goldenRectangleEffectTimer -= 2; } NPC target = null; for (int n = 0; n < Main.maxNPCs; n++) { NPC npc = Main.npc[n]; if (npc.active) { float distance = Vector2.Distance(npc.Center, player.Center); if (npc.CanBeChasedBy(this) && distance < 9f * 16f && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) { target = npc; } } } if (target != null) { attackFrames = true; normalFrames = false; PlayPunchSound(); Vector2 velocity = (target.position + new Vector2(0f, -4f)) - projectile.position; velocity.Normalize(); projectile.velocity = velocity * 4f; if ((target.position - projectile.Center).X > 0f) //the turn around stuff { projectile.spriteDirection = projectile.direction = 1; } else if ((target.position - projectile.Center).X < 0f) { projectile.spriteDirection = projectile.direction = -1; } if (Main.myPlayer == projectile.owner) { if (shootCount <= 0) { shootCount += newPunchTime; Vector2 shootVel = target.position - projectile.Center; if (shootVel == Vector2.Zero) { shootVel = new Vector2(0f, 1f); } shootVel.Normalize(); shootVel *= shootSpeed; int proj = Projectile.NewProjectile(projectile.Center, shootVel, mod.ProjectileType("Fists"), newPunchDamage, punchKnockback, projectile.owner); Main.projectile[proj].netUpdate = true; Main.projectile[proj].timeLeft = 3; projectile.netUpdate = true; } } } else { attackFrames = false; normalFrames = true; } if (target == null || (!attackFrames && normalFrames)) { Vector2 vector131 = player.Center; vector131.X -= (float)((12 + player.width / 2) * player.direction); vector131.Y -= 25f; projectile.Center = Vector2.Lerp(projectile.Center, vector131, 0.2f); projectile.velocity *= 0.8f; projectile.direction = projectile.spriteDirection = player.direction; projectile.netUpdate = true; StopSounds(); } }
public override void AI() { SelectAnimation(); UpdateStandInfo(); updateTimer++; if (shootCount > 0) { shootCount--; } Player player = Main.player[projectile.owner]; MyPlayer modPlayer = player.GetModPlayer <MyPlayer>(); projectile.frameCounter++; if (modPlayer.StandOut) { projectile.timeLeft = 2; } if (updateTimer >= 90) //an automatic netUpdate so that if something goes wrong it'll at least fix in about a second { updateTimer = 0; projectile.netUpdate = true; } if (SpecialKeyPressed() && !player.HasBuff(mod.BuffType("SkippingTime")) && timeskipStartDelay <= 0) { if (JoJoStands.JoJoStandsSounds == null) { timeskipStartDelay = 80; } else { Terraria.Audio.LegacySoundStyle kingCrimson = JoJoStands.JoJoStandsSounds.GetLegacySoundSlot(SoundType.Custom, "Sounds/SoundEffects/KingCrimson"); kingCrimson.WithVolume(MyPlayer.soundVolume); Main.PlaySound(kingCrimson, projectile.position); timeskipStartDelay = 1; } } if (timeskipStartDelay != 0) { timeskipStartDelay++; if (timeskipStartDelay >= 80) { player.AddBuff(mod.BuffType("PreTimeSkip"), 10); Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/sound/TimeSkip")); timeskipStartDelay = 0; } } if (!modPlayer.StandAutoMode) { if (Main.mouseLeft && projectile.owner == Main.myPlayer && !player.HasBuff(mod.BuffType("SkippingTime"))) { HandleDrawOffsets(); attackFrames = true; normalFrames = false; Main.mouseRight = false; projectile.netUpdate = true; float rotaY = Main.MouseWorld.Y - projectile.Center.Y; projectile.rotation = MathHelper.ToRadians((rotaY * projectile.spriteDirection) / 6f); if (Main.MouseWorld.X > projectile.position.X) { projectile.spriteDirection = 1; projectile.direction = 1; } if (Main.MouseWorld.X < projectile.position.X) { projectile.spriteDirection = -1; projectile.direction = -1; } velocityAddition = Main.MouseWorld - projectile.position; velocityAddition.Normalize(); velocityAddition *= 5f; mouseDistance = Vector2.Distance(Main.MouseWorld, projectile.Center); if (mouseDistance > 40f) { projectile.velocity = player.velocity + velocityAddition; } if (mouseDistance <= 40f) { projectile.velocity = Vector2.Zero; } if (shootCount <= 0 && (projectile.frame == 0 || projectile.frame == 4)) { shootCount += newPunchTime; Vector2 shootVel = Main.MouseWorld - projectile.Center; if (shootVel == Vector2.Zero) { shootVel = new Vector2(0f, 1f); } shootVel.Normalize(); shootVel *= shootSpeed; int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, shootVel.X, shootVel.Y, mod.ProjectileType("Fists"), newPunchDamage, punchKnockback, projectile.owner, fistWhoAmI); Main.projectile[proj].netUpdate = true; projectile.netUpdate = true; } LimitDistance(); } else { if (!Main.mouseRight && player.whoAmI == Main.myPlayer) { attackFrames = false; } } if (Main.mouseRight && projectile.owner == Main.myPlayer && !playerHasAbilityCooldown && !player.HasBuff(mod.BuffType("SkippingTime"))) { GoInFront(); normalFrames = false; attackFrames = false; secondaryAbilityFrames = true; if (blockSearchTimer > 0) { blockSearchTimer--; return; } int rectWidth = 56; int rectHeight = 64; Rectangle blockRect = new Rectangle((int)projectile.Center.X - (rectWidth / 2), (int)projectile.Center.Y - (rectHeight / 2), rectWidth, rectHeight); for (int p = 0; p < Main.maxProjectiles; p++) { Projectile otherProj = Main.projectile[p]; if (otherProj.active) { if (blockRect.Intersects(otherProj.Hitbox) && otherProj.type != projectile.type && !otherProj.friendly) { for (int i = 0; i < 20; i++) { Dust.NewDust(player.position, player.width, player.height, 114); } otherProj.penetrate -= 1; if (otherProj.penetrate <= 0) { projectile.Kill(); } secondaryAbilityFrames = false; Vector2 repositionOffset = new Vector2(5f * 16f * -player.direction, 0f); while (WorldGen.SolidTile((int)(player.position.X + repositionOffset.X) / 16, (int)(player.position.Y + repositionOffset.Y) / 16)) { repositionOffset.Y -= 16f; } player.position += repositionOffset; player.AddBuff(mod.BuffType("AbilityCooldown"), modPlayer.AbilityCooldownTime(10)); Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/sound/TimeSkip")); for (int i = 0; i < 20; i++) { Dust.NewDust(player.position, player.width, player.height, 114); } } } } for (int n = 0; n < Main.maxNPCs; n++) { NPC npc = Main.npc[n]; if (npc.active && npc.lifeMax > 5 && !npc.immortal && !npc.townNPC && !npc.friendly && !npc.hide && npc.Hitbox.Intersects(blockRect)) { for (int i = 0; i < 20; i++) { Dust.NewDust(player.position, player.width, player.height, 114); } Vector2 repositionOffset = new Vector2(5f * 16f * -player.direction, 0f); while (WorldGen.SolidTile((int)(player.position.X + repositionOffset.X) / 16, (int)(player.position.Y + repositionOffset.Y) / 16)) { repositionOffset.Y -= 16f; } player.position += repositionOffset; player.AddBuff(mod.BuffType("AbilityCooldown"), modPlayer.AbilityCooldownTime(10)); npc.StrikeNPC(newPunchDamage * 2, punchKnockback * 1.5f, projectile.direction); Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/sound/TimeSkip")); for (int i = 0; i < 20; i++) { Dust.NewDust(player.position, player.width, player.height, 114); } } } blockSearchTimer += 5; } else { secondaryAbilityFrames = false; } if (!attackFrames && !secondaryAbilityFrames) { StayBehind(); } } if (modPlayer.StandAutoMode) { BasicPunchAI(); } }
public override void AI() { SelectAnimation(); UpdateStandInfo(); updateTimer++; if (shootCount > 0) { shootCount--; } Player player = Main.player[projectile.owner]; MyPlayer modPlayer = player.GetModPlayer <MyPlayer>(); if (modPlayer.StandOut) { projectile.timeLeft = 2; } if (updateTimer >= 90) //an automatic netUpdate so that if something goes wrong it'll at least fix in about a second { updateTimer = 0; projectile.netUpdate = true; } if (SpecialKeyPressed() && !player.HasBuff(mod.BuffType("TheWorldBuff")) && timestopStartDelay <= 0) { if (JoJoStands.JoJoStandsSounds == null) { timestopStartDelay = 120; } else { Terraria.Audio.LegacySoundStyle zawarudo = JoJoStands.JoJoStandsSounds.GetLegacySoundSlot(SoundType.Custom, "Sounds/SoundEffects/TheWorld"); zawarudo.WithVolume(MyPlayer.soundVolume); Main.PlaySound(zawarudo, projectile.position); timestopStartDelay = 1; } } if (timestopStartDelay != 0) { timestopStartDelay++; if (timestopStartDelay >= 120) { Timestop(5); timestopPoseTimer = 60; timestopStartDelay = 0; } } if (timestopPoseTimer > 0) { timestopPoseTimer--; normalFrames = false; attackFrames = false; secondaryAbilityFrames = false; abilityPose = true; Main.mouseLeft = false; Main.mouseRight = false; if (timestopPoseTimer <= 1) { abilityPose = false; } } if (!modPlayer.StandAutoMode) { if (Main.mouseLeft && projectile.owner == Main.myPlayer) { Punch(); } else { if (player.whoAmI == Main.myPlayer) { attackFrames = false; } } if (!attackFrames) { if (!secondaryAbilityFrames) { StayBehind(); projectile.direction = projectile.spriteDirection = player.direction; } else { GoInFront(); if (Main.MouseWorld.X > projectile.position.X) { projectile.spriteDirection = 1; projectile.direction = 1; } if (Main.MouseWorld.X < projectile.position.X) { projectile.spriteDirection = -1; projectile.direction = -1; } secondaryAbilityFrames = false; } } if (Main.mouseRight && player.HasItem(mod.ItemType("Knife")) && projectile.owner == Main.myPlayer) { Main.mouseLeft = false; secondaryAbilityFrames = true; normalFrames = false; attackFrames = false; if (shootCount <= 0 && projectile.frame == 1) { shootCount += 28; float rotationk = MathHelper.ToRadians(15); float numberKnives = 3; Vector2 shootVel = Main.MouseWorld - projectile.Center; if (shootVel == Vector2.Zero) { shootVel = new Vector2(0f, 1f); } shootVel.Normalize(); shootVel *= 100f; for (int i = 0; i < numberKnives; i++) { Vector2 perturbedSpeed = shootVel.RotatedBy(MathHelper.Lerp(-rotationk, rotationk, i / (numberKnives - 1))) * 0.2f; int proj = Projectile.NewProjectile(projectile.position + new Vector2(5f, -3f), perturbedSpeed, mod.ProjectileType("Knife"), (int)(altDamage * modPlayer.standDamageBoosts), 2f, player.whoAmI); Main.projectile[proj].netUpdate = true; player.ConsumeItem(mod.ItemType("Knife")); projectile.netUpdate = true; } } } if (SecondSpecialKeyPressed() && player.HasItem(mod.ItemType("Knife")) && player.CountItem(mod.ItemType("Knife")) >= 45 && projectile.owner == Main.myPlayer) { NPC target = null; for (int n = 0; n < Main.maxNPCs; n++) { NPC npc = Main.npc[n]; if (npc.active && npc.lifeMax > 5 && !npc.townNPC && !npc.immortal && !npc.hide && Vector2.Distance(npc.Center, Main.MouseWorld) <= 25f) { target = npc; break; } } if (target == null) { return; } int firstRingKnives = 15; for (int k = 0; k < firstRingKnives; k++) { float radius = target.height; float radians = (360 / firstRingKnives) * k; Vector2 position = target.position + (MathHelper.ToRadians(radians).ToRotationVector2() * radius); Vector2 velocity = target.position - position; velocity.Normalize(); velocity *= 8f; Projectile.NewProjectile(position, velocity, mod.ProjectileType("Knife"), (int)(altDamage * modPlayer.standDamageBoosts), 2f, player.whoAmI); } int secondRingKnives = 30; for (int k = 0; k < secondRingKnives; k++) { float radius = target.height * 1.8f; float radians = (360 / secondRingKnives) * k; Vector2 position = target.position + (MathHelper.ToRadians(radians).ToRotationVector2() * radius); Vector2 velocity = target.position - position; velocity.Normalize(); velocity *= 8f; Projectile.NewProjectile(position, velocity, mod.ProjectileType("Knife"), (int)(altDamage * modPlayer.standDamageBoosts), 2f, player.whoAmI); } for (int i = 0; i < firstRingKnives + secondRingKnives; i++) { player.ConsumeItem(mod.ItemType("Knife")); } modPlayer.poseMode = true; player.AddBuff(mod.BuffType("AbilityCooldown"), modPlayer.AbilityCooldownTime(15)); } } if (modPlayer.StandAutoMode) { PunchAndShootAI(mod.ProjectileType("Knife"), mod.ItemType("Knife"), true); } }