/// <summary> /// Returns the RunRate that is sent to the client as myRunRate /// </summary> public float GetRunRate() { var burden = 0.0f; // assuming burden only applies to players... if (this is Player player) { var strength = Strength.Current; var capacity = EncumbranceSystem.EncumbranceCapacity((int)strength, player.AugmentationIncreasedCarryingCapacity); burden = EncumbranceSystem.GetBurden(capacity, EncumbranceVal ?? 0); // TODO: find this exact formula in client // technically this would be based on when the player releases / presses the movement key after stamina > 0 if (player.IsExhausted) { burden = 3.0f; } } var runSkill = GetCreatureSkill(Skill.Run).Current; var runRate = MovementSystem.GetRunRate(burden, (int)runSkill, 1.0f); return((float)runRate); }
public void HandleActionJump(JumpPack jump) { var strength = Strength.Current; var capacity = EncumbranceSystem.EncumbranceCapacity((int)strength, 0); // TODO: augs var burden = EncumbranceSystem.GetBurden(capacity, EncumbranceVal ?? 0); // calculate stamina cost for this jump var staminaCost = MovementSystem.JumpStaminaCost(jump.Extent, burden, false); //Console.WriteLine($"Strength: {strength}, Capacity: {capacity}, Encumbrance: {EncumbranceVal ?? 0}, Burden: {burden}, StaminaCost: {staminaCost}"); // TODO: ensure player has enough stamina to jump UpdateVitalDelta(Stamina, -staminaCost); //Console.WriteLine($"Jump velocity: {jump.Velocity}"); // set jump velocity PhysicsObj.set_velocity(jump.Velocity, true); // this shouldn't be needed, but without sending this update motion / simulated movement event beforehand, // running forward and then performing a charged jump does an uncharged shallow arc jump instead // this hack fixes that... var movementData = new MovementData(this); movementData.IsAutonomous = true; movementData.MovementType = MovementType.Invalid; movementData.Invalid = new MovementInvalid(movementData); EnqueueBroadcast(new GameMessageUpdateMotion(this, movementData)); // broadcast jump EnqueueBroadcast(new GameMessageVectorUpdate(this)); }
public void HandleActionJump(JumpPack jump) { StartJump = new ACE.Entity.Position(Location); //Console.WriteLine($"JumpPack: Velocity: {jump.Velocity}, Extent: {jump.Extent}"); var strength = Strength.Current; var capacity = EncumbranceSystem.EncumbranceCapacity((int)strength, AugmentationIncreasedCarryingCapacity); var burden = EncumbranceSystem.GetBurden(capacity, EncumbranceVal ?? 0); // calculate stamina cost for this jump var extent = Math.Clamp(jump.Extent, 0.0f, 1.0f); var staminaCost = MovementSystem.JumpStaminaCost(extent, burden, PKTimerActive); //Console.WriteLine($"Strength: {strength}, Capacity: {capacity}, Encumbrance: {EncumbranceVal ?? 0}, Burden: {burden}, StaminaCost: {staminaCost}"); // ensure player has enough stamina to jump /*if (staminaCost > Stamina.Current) * { * // get adjusted power * extent = MovementSystem.GetJumpPower(Stamina.Current, burden, false); * * staminaCost = (int)Stamina.Current; * * // adjust jump velocity * var velocityZ = MovementSystem.GetJumpHeight(burden, GetCreatureSkill(Skill.Jump).Current, extent, 1.0f); * * jump.Velocity.Z = velocityZ; * }*/ IsJumping = true; LastJumpTime = DateTime.UtcNow; UpdateVitalDelta(Stamina, -staminaCost); IsJumping = false; //Console.WriteLine($"Jump velocity: {jump.Velocity}"); // set jump velocity // TODO: have server verify / scale magnitude PhysicsObj.set_velocity(jump.Velocity, true); // this shouldn't be needed, but without sending this update motion / simulated movement event beforehand, // running forward and then performing a charged jump does an uncharged shallow arc jump instead // this hack fixes that... var movementData = new MovementData(this); movementData.IsAutonomous = true; movementData.MovementType = MovementType.Invalid; movementData.Invalid = new MovementInvalid(movementData); EnqueueBroadcast(new GameMessageUpdateMotion(this, movementData)); // broadcast jump EnqueueBroadcast(new GameMessageVectorUpdate(this)); }
/// <summary> /// Returns a modifier for a player's Run, Jump, Melee Defense, and Missile Defense skills if they are overburdened /// </summary> public override float GetBurdenMod() { var strength = Strength.Current; var capacity = EncumbranceSystem.EncumbranceCapacity((int)strength, AugmentationIncreasedCarryingCapacity); var burden = EncumbranceSystem.GetBurden(capacity, EncumbranceVal ?? 0); var burdenMod = EncumbranceSystem.GetBurdenMod(burden); //Console.WriteLine($"Burden mod: {burdenMod}"); return(burdenMod); }
public void HandleActionJump(JumpPack jump) { var strength = GetCreatureAttribute(PropertyAttribute.Strength).Current; var capacity = EncumbranceSystem.EncumbranceCapacity((int)strength, 0); // TODO: augs var burden = EncumbranceSystem.GetBurden(capacity, EncumbranceVal ?? 0); // calculate stamina cost for this jump var staminaCost = MovementSystem.JumpStaminaCost(jump.Extent, burden, false); //Console.WriteLine($"Strength: {strength}, Capacity: {capacity}, Encumbrance: {EncumbranceVal ?? 0}, Burden: {burden}, StaminaCost: {staminaCost}"); // TODO: ensure player has enough stamina to jump UpdateVitalDelta(Stamina, -staminaCost); }
public void HandleActionJump(JumpPack jump) { StartJump = new ACE.Entity.Position(Location); //Console.WriteLine($"JumpPack: Velocity: {jump.Velocity}, Extent: {jump.Extent}"); var strength = Strength.Current; var capacity = EncumbranceSystem.EncumbranceCapacity((int)strength, AugmentationIncreasedCarryingCapacity); var burden = EncumbranceSystem.GetBurden(capacity, EncumbranceVal ?? 0); // calculate stamina cost for this jump var extent = Math.Clamp(jump.Extent, 0.0f, 1.0f); var staminaCost = MovementSystem.JumpStaminaCost(extent, burden, PKTimerActive); //Console.WriteLine($"Strength: {strength}, Capacity: {capacity}, Encumbrance: {EncumbranceVal ?? 0}, Burden: {burden}, StaminaCost: {staminaCost}"); // ensure player has enough stamina to jump /*if (staminaCost > Stamina.Current) * { * // get adjusted power * extent = MovementSystem.GetJumpPower(Stamina.Current, burden, false); * * staminaCost = (int)Stamina.Current; * * // adjust jump velocity * var velocityZ = MovementSystem.GetJumpHeight(burden, GetCreatureSkill(Skill.Jump).Current, extent, 1.0f); * * jump.Velocity.Z = velocityZ; * }*/ IsJumping = true; LastJumpTime = DateTime.UtcNow; UpdateVitalDelta(Stamina, -staminaCost); IsJumping = false; //Console.WriteLine($"Jump velocity: {jump.Velocity}"); // TODO: have server verify / scale magnitude if (FastTick) { if (!PhysicsObj.IsMovingOrAnimating) { //PhysicsObj.UpdateTime = PhysicsTimer.CurrentTime - Physics.PhysicsGlobals.MinQuantum; PhysicsObj.UpdateTime = PhysicsTimer.CurrentTime; } // perform jump in physics engine PhysicsObj.TransientState &= ~(Physics.TransientStateFlags.Contact | Physics.TransientStateFlags.WaterContact); PhysicsObj.calc_acceleration(); PhysicsObj.set_on_walkable(false); PhysicsObj.set_local_velocity(jump.Velocity, false); if (CombatMode == CombatMode.Magic && MagicState.IsCasting) { FailCast(); } } else { PhysicsObj.UpdateTime = PhysicsTimer.CurrentTime; // set jump velocity //var glob_velocity = Vector3.Transform(jump.Velocity, Location.Rotation); //PhysicsObj.set_velocity(glob_velocity, true); // perform jump in physics engine PhysicsObj.TransientState &= ~(Physics.TransientStateFlags.Contact | Physics.TransientStateFlags.WaterContact); PhysicsObj.calc_acceleration(); PhysicsObj.set_on_walkable(false); PhysicsObj.set_local_velocity(jump.Velocity, false); } // this shouldn't be needed, but without sending this update motion / simulated movement event beforehand, // running forward and then performing a charged jump does an uncharged shallow arc jump instead // this hack fixes that... var movementData = new MovementData(this); movementData.IsAutonomous = true; movementData.MovementType = MovementType.Invalid; movementData.Invalid = new MovementInvalid(movementData); EnqueueBroadcast(new GameMessageUpdateMotion(this, movementData)); // broadcast jump EnqueueBroadcast(new GameMessageVectorUpdate(this)); if (MagicState.IsCasting && RecordCast.Enabled) { RecordCast.OnJump(jump); } }