private void End() { player.pulley = false; oPlayer.PlaySound("Ori/Bash/seinBashEnd" + _rand.NextNoRepeat(3), 0.5f); oPlayer.UnrestrictedMovement = true; Vector2 bashVector = new Vector2((float)(0 - Math.Cos(BashAngle)), (float)(0 - Math.Sin(BashAngle))); Vector2 playerBashVector = -bashVector * BashPlayerStrength; Vector2 npcBashVector = bashVector * BashNpcStrength; player.velocity = playerBashVector; player.position += playerBashVector * 3; BashEntity.velocity = npcBashVector; player.position += npcBashVector * 5; if (oPlayer.IsGrounded) { player.position.Y -= 1f; } oPlayer.immuneTimer = 5; BashTarget.IsBashed = false; if (IsLocal && Level >= 2 && BashEntity is NPC npc) { player.ApplyDamageToNPC(npc, BashDamage, 0, 1, false); } PutOnCooldown(); }
protected override void UpdateEnding() { if (CurrentTime == 0) { oPlayer.PlaySound("Ori/Glide/seinGlideEnd" + _randEnd.NextNoRepeat(3), 0.8f); } }
internal override void Tick() { if (CanUse && input.jump.JustPressed) { if (player.jumpAgainBlizzard || player.jumpAgainCloud || player.jumpAgainFart || player.jumpAgainSail || player.jumpAgainSandstorm || player.mount.Active) { return; } SetState(State.Active); currentCount++; _gravityDirection = (sbyte)player.gravDir; if (MaxJumps != 1 && currentCount == MaxJumps) { oPlayer.PlaySound("Ori/TripleJump/seinTripleJumps" + _rand.NextNoRepeat(5), 0.6f); } else { oPlayer.PlaySound("Ori/DoubleJump/seinDoubleJumps" + _rand.NextNoRepeat(4), 0.5f); } return; } if (oPlayer.IsGrounded || abilities.bash || abilities.launch || oPlayer.OnWall) { currentCount = 0; if (oPlayer.IsGrounded || abilities.bash || abilities.launch || abilities.climb) { SetState(State.Inactive); } } if (Active) { SetState(State.Ending); } else if (Ending) { if (CurrentTime > EndDuration || player.velocity.Y * player.gravDir > 0) { SetState(State.Inactive); } } // Other than activation, Air Jump is deterministic and requires no additional syncing netUpdate = false; }
protected override void UpdateActive() { if (player.controlLeft != _oldLeft || player.controlRight != _oldRight) { oPlayer.PlaySound("Ori/Glide/seinGlideMoveLeftRight" + _randActive.NextNoRepeat(5), 0.45f); } _oldLeft = player.controlLeft; _oldRight = player.controlRight; }
private void StartChargeJump() { oPlayer.PlaySound("Ori/ChargeJump/seinChargeJumpJump" + _rand.NextNoRepeat(3)); _currentCharge = 0; Projectile.NewProjectileDirect(player.Center, Vector2.Zero, ModContent.ProjectileType <ChargeJumpProjectile>(), 30, 0f, player.whoAmI, 0, 1); PutOnCooldown(); abilities.climb.SetState(State.Inactive); }
protected override void UpdateStarting() { if (CurrentTime == 0) { oPlayer.PlaySound("Ori/Stomp/seinStompStart" + _randStart.NextNoRepeat(3), 0.8f, 0.2f); } player.velocity.X = 0; player.velocity.Y *= 0.9f; player.gravity = -0.1f; }
/// <summary> /// Plays a footstep sound effect from the <paramref name="player"/>. /// </summary> /// <param name="player">Player to play sound effect from.</param> /// <returns><see cref="SoundEffectInstance"/> representing the sound that is played.</returns> public SoundEffectInstance PlayFootstepFromPlayer(Player player) { FootstepSound sound = GetSoundFromPlayerPosition(player); string mat = sound.ToString(); int x = (int)player.Bottom.X, y = (int)player.Bottom.Y; SoundEffectInstance Footstep(int randLength, float volume) => PlayFootstep($"{mat}/{mat}{_rand.NextNoRepeat(randLength)}", x, y, volume); switch (sound) { case FootstepSound.Grass: case FootstepSound.Mushroom: return(Footstep(5, 0.15f)); case FootstepSound.Water: return(Footstep(4, 1f)); case FootstepSound.SpiritTreeRock: case FootstepSound.SpiritTreeWood: case FootstepSound.Rock: return(Footstep(5, 0.7f)); case FootstepSound.Snow: return(Footstep(10, 0.45f)); case FootstepSound.LightDark: return(Footstep(10, 0.3f)); case FootstepSound.Wood: return(Footstep(5, 0.2f)); case FootstepSound.Sand: return(Footstep(8, 0.4f)); default: return(null); } }
protected override void UpdateActive() { if (CurrentTime == 0) { oPlayer.PlaySound("Ori/Stomp/seinStompFall" + _randActive.NextNoRepeat(3), 0.8f); NewAbilityProjectile <StompProjectile>(damage: Damage * 2); } if (abilities.airJump.Active) { return; } player.maxRunSpeed = 1f; player.runSlowdown = 8; player.gravity = Gravity; player.maxFallSpeed = MaxFallSpeed; oPlayer.immuneTimer = 12; }
internal void EndStomp() { oPlayer.PlaySound("Ori/Stomp/seinStompImpact" + _randEnd.NextNoRepeat(3), 0.9f); abilities.airJump.currentCount = 0; player.velocity = Vector2.Zero; Vector2 position = new Vector2(player.position.X, player.position.Y + 32); for (int i = 0; i < 25; i++) { Dust dust = Dust.NewDustDirect(position, 30, 15, DustID.Clentaminator_Cyan, 0f, 0f, 0, Color.White); dust.shader = GameShaders.Armor.GetSecondaryShader(19, Main.LocalPlayer); dust.velocity *= new Vector2(6, 1.5f); dust.velocity.Y = -Math.Abs(dust.velocity.Y); } PutOnCooldown(); NewAbilityProjectile <StompEnd>(damage: Damage); SetState(State.Inactive); }
protected override void UpdateActive() { player.velocity.Y = WallJumpVelocity.Y * _gravDirection; oPlayer.PlaySound("Ori/WallJump/seinWallJumps" + _rand.NextNoRepeat(5), 0.75f); }
internal override void Tick() { if (CanUse && input.bash.JustPressed) { if (CurrentChain == 0) { oPlayer.PlayLocalSound("Ori/Bash/seinBashStartA", 0.5f); } SetState(State.Starting); CurrentChain = 1; } else if (!InUse) { TickCooldown(); return; } if (oPlayer.IsGrounded || oPlayer.OnWall) { // Prevent any usage of Launch while not in air SetState(State.Inactive); return; } if (Starting) { if (CurrentTime > MaxLaunchDuration || CurrentTime > MinLaunchDuration && !input.bash.Current) { SetState(State.Active); } else if (CurrentChain > 1 && !input.bash.Current) { SetState(State.Inactive); } return; } if (!Active) { return; } if (oPlayer.IsGrounded || oPlayer.OnWall) { SetState(State.Inactive); } // Post-ending state depends on player input // Maybe too sensitive to rely on input packet if (!IsLocal || CurrentTime <= EndDuration) { return; } if (CurrentChain < MaxChain && input.bash.Current) { CurrentChain++; SetState(State.Starting); oPlayer.PlaySound("Ori/Bash/seinBashEnd" + _rand.NextNoRepeat(3), Level == 3 ? 0.15f : 0.35f); } else { End(); SetState(State.Inactive); oPlayer.PlaySound("Ori/Bash/seinBashEnd" + _rand.NextNoRepeat(3), 0.55f); } }
internal void StartDash() { _direction = (sbyte)(player.controlLeft ? -1 : player.controlRight ? 1 : player.direction); oPlayer.PlaySound("Ori/Dash/seinDash" + _rand.NextNoRepeat(3), 0.2f); player.pulley = false; }