Faction Test 100.4.0.0
This commit is contained in:
@@ -637,13 +637,13 @@ namespace Barotrauma
|
||||
switch (body.BodyShape)
|
||||
{
|
||||
case PhysicsBody.Shape.Circle:
|
||||
attack.DamageRange = body.radius;
|
||||
attack.DamageRange = body.Radius;
|
||||
break;
|
||||
case PhysicsBody.Shape.Capsule:
|
||||
attack.DamageRange = body.height / 2 + body.radius;
|
||||
attack.DamageRange = body.Height / 2 + body.Radius;
|
||||
break;
|
||||
case PhysicsBody.Shape.Rectangle:
|
||||
attack.DamageRange = new Vector2(body.width / 2.0f, body.height / 2.0f).Length();
|
||||
attack.DamageRange = new Vector2(body.Width / 2.0f, body.Height / 2.0f).Length();
|
||||
break;
|
||||
}
|
||||
attack.DamageRange = ConvertUnits.ToDisplayUnits(attack.DamageRange);
|
||||
@@ -778,6 +778,7 @@ namespace Barotrauma
|
||||
{
|
||||
var abilityAfflictionCharacter = new AbilityAfflictionCharacter(newAffliction, character);
|
||||
attacker.CheckTalents(AbilityEffectType.OnAddDamageAffliction, abilityAfflictionCharacter);
|
||||
newAffliction = abilityAfflictionCharacter.Affliction;
|
||||
}
|
||||
if (applyAffliction)
|
||||
{
|
||||
@@ -896,6 +897,12 @@ namespace Barotrauma
|
||||
{
|
||||
reEnableTimer = duration;
|
||||
}
|
||||
#if CLIENT
|
||||
if (Hidden && LightSource != null)
|
||||
{
|
||||
LightSource.Enabled = false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
public void ReEnable()
|
||||
@@ -1060,7 +1067,7 @@ namespace Barotrauma
|
||||
Vector2 forceWorld = attack.CalculateAttackPhase(attack.RootTransitionEasing);
|
||||
forceWorld.X *= character.AnimController.Dir;
|
||||
character.AnimController.MainLimb.body.ApplyLinearImpulse(character.Mass * forceWorld, character.SimPosition, maxVelocity: NetConfig.MaxPhysicsBodyVelocity);
|
||||
if (!attack.IsRunning)
|
||||
if (!attack.IsRunning && !attack.Ranged)
|
||||
{
|
||||
// Set the main collider where the body lands after the attack
|
||||
if (Vector2.DistanceSquared(character.AnimController.Collider.SimPosition, character.AnimController.MainLimb.body.SimPosition) > 0.1f * 0.1f)
|
||||
@@ -1189,12 +1196,30 @@ namespace Barotrauma
|
||||
statusEffect.HasTargetType(StatusEffect.TargetType.NearbyCharacters))
|
||||
{
|
||||
targets.Clear();
|
||||
targets.AddRange(statusEffect.GetNearbyTargets(WorldPosition, targets));
|
||||
statusEffect.AddNearbyTargets(WorldPosition, targets);
|
||||
statusEffect.Apply(actionType, deltaTime, character, targets);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (statusEffect.HasTargetType(StatusEffect.TargetType.Character))
|
||||
|
||||
if (statusEffect.HasTargetType(StatusEffect.TargetType.Contained) && character.Inventory is { } inventory)
|
||||
{
|
||||
foreach (Item item in inventory.AllItems)
|
||||
{
|
||||
if (statusEffect.TargetIdentifiers != null &&
|
||||
!statusEffect.TargetIdentifiers.Contains(item.Prefab.Identifier) &&
|
||||
statusEffect.TargetIdentifiers.None(id => item.HasTag(id)))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (statusEffect.TargetSlot > -1)
|
||||
{
|
||||
if (inventory.FindIndex(item) != statusEffect.TargetSlot) { continue; }
|
||||
}
|
||||
targets.Add(item);
|
||||
}
|
||||
}
|
||||
else if (statusEffect.HasTargetType(StatusEffect.TargetType.Character))
|
||||
{
|
||||
statusEffect.Apply(actionType, deltaTime, character, character, WorldPosition);
|
||||
}
|
||||
@@ -1237,7 +1262,8 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
private float blinkTimer;
|
||||
private float blinkPhase;
|
||||
public float BlinkPhase;
|
||||
public bool FreezeBlinkState;
|
||||
|
||||
private float TotalBlinkDurationOut => Params.BlinkDurationOut + Params.BlinkHoldTime;
|
||||
|
||||
@@ -1250,16 +1276,25 @@ namespace Barotrauma
|
||||
{
|
||||
if (blinkTimer > -TotalBlinkDurationOut)
|
||||
{
|
||||
blinkPhase -= deltaTime;
|
||||
if (blinkPhase > 0)
|
||||
if (!FreezeBlinkState)
|
||||
{
|
||||
BlinkPhase -= deltaTime;
|
||||
}
|
||||
if (BlinkPhase > 0)
|
||||
{
|
||||
// in
|
||||
float t = ToolBox.GetEasing(Params.BlinkTransitionIn, MathUtils.InverseLerp(1, 0, blinkPhase / Params.BlinkDurationIn));
|
||||
float t = ToolBox.GetEasing(Params.BlinkTransitionIn, MathUtils.InverseLerp(1, 0, BlinkPhase / Params.BlinkDurationIn));
|
||||
body.SmoothRotate(referenceRotation + MathHelper.ToRadians(Params.BlinkRotationIn) * Dir, Mass * Params.BlinkForce * t, wrapAngle: true);
|
||||
if (Params.UseTextureOffsetForBlinking)
|
||||
{
|
||||
#if CLIENT
|
||||
ActiveSprite.RelativeOrigin = Vector2.Lerp(Params.BlinkTextureOffsetOut, Params.BlinkTextureOffsetIn, t);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Math.Abs(blinkPhase) < Params.BlinkHoldTime)
|
||||
if (Math.Abs(BlinkPhase) < Params.BlinkHoldTime)
|
||||
{
|
||||
// hold
|
||||
body.SmoothRotate(referenceRotation + MathHelper.ToRadians(Params.BlinkRotationIn) * Dir, Mass * Params.BlinkForce, wrapAngle: true);
|
||||
@@ -1267,15 +1302,25 @@ namespace Barotrauma
|
||||
else
|
||||
{
|
||||
// out
|
||||
float t = ToolBox.GetEasing(Params.BlinkTransitionOut, MathUtils.InverseLerp(0, 1, -blinkPhase / TotalBlinkDurationOut));
|
||||
//float t = ToolBox.GetEasing(Params.BlinkTransitionOut, MathUtils.InverseLerp(0, 1, -blinkPhase / TotalBlinkDurationOut));
|
||||
float t = ToolBox.GetEasing(Params.BlinkTransitionOut, MathUtils.InverseLerp(0, 1, (-BlinkPhase - Params.BlinkHoldTime) / Params.BlinkDurationOut));
|
||||
body.SmoothRotate(referenceRotation + MathHelper.ToRadians(Params.BlinkRotationOut) * Dir, Mass * Params.BlinkForce * t, wrapAngle: true);
|
||||
if (Params.UseTextureOffsetForBlinking)
|
||||
{
|
||||
#if CLIENT
|
||||
ActiveSprite.RelativeOrigin = Vector2.Lerp(Params.BlinkTextureOffsetIn, Params.BlinkTextureOffsetOut, t);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// out
|
||||
blinkPhase = Params.BlinkDurationIn;
|
||||
if (!FreezeBlinkState)
|
||||
{
|
||||
BlinkPhase = Params.BlinkDurationIn;
|
||||
}
|
||||
body.SmoothRotate(referenceRotation + MathHelper.ToRadians(Params.BlinkRotationOut) * Dir, Mass * Params.BlinkForce, wrapAngle: true);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user