convert game playing..
This commit is contained in:
@@ -5,6 +5,7 @@ using BumpCombat.Combat;
|
||||
using BumpCombat.Constants;
|
||||
using BumpCombat.Core;
|
||||
using BumpCombat.Enemies;
|
||||
using BumpCombat.Progression;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
@@ -339,6 +340,13 @@ namespace BumpCombat.Player
|
||||
{
|
||||
UpdateTemporaryPlayerModifiers();
|
||||
|
||||
if (playerHealth != null && playerHealth.CurrentHealth <= 0f)
|
||||
{
|
||||
CancelArtifactInput();
|
||||
CancelExecution();
|
||||
return;
|
||||
}
|
||||
|
||||
if (playerHealth != null && playerHealth.IsHurtMovementLocked)
|
||||
{
|
||||
CancelArtifactInput();
|
||||
@@ -450,6 +458,7 @@ namespace BumpCombat.Player
|
||||
if (definition == null
|
||||
|| IsExecutingArtifact
|
||||
|| (dashController != null && dashController.IsDashing)
|
||||
|| (playerHealth != null && playerHealth.CurrentHealth <= 0f)
|
||||
|| (playerHealth != null && playerHealth.IsHurtMovementLocked)
|
||||
|| (charged && !IsArtifactChargeUnlocked))
|
||||
{
|
||||
@@ -546,7 +555,7 @@ namespace BumpCombat.Player
|
||||
return true;
|
||||
}
|
||||
|
||||
private int GetOwnedArtifactColorCount(ArtifactColor color)
|
||||
public int GetOwnedArtifactColorCount(ArtifactColor color)
|
||||
{
|
||||
int count = 0;
|
||||
for (int i = 0; i < ownedArtifacts.Count; i++)
|
||||
@@ -1168,6 +1177,7 @@ namespace BumpCombat.Player
|
||||
float nextHitAt = 0f;
|
||||
int hitIndex = 0;
|
||||
int hitCount = GetScheduledHitCount(duration, hitInterval);
|
||||
bool movementBlocked = false;
|
||||
while (elapsed < duration)
|
||||
{
|
||||
visual.transform.position = body.position
|
||||
@@ -1206,10 +1216,24 @@ namespace BumpCombat.Player
|
||||
|
||||
yield return new WaitForFixedUpdate();
|
||||
elapsed += Time.fixedDeltaTime;
|
||||
body.MovePosition(Vector2.Lerp(
|
||||
start,
|
||||
end,
|
||||
Mathf.Clamp01(elapsed / duration)));
|
||||
if (!movementBlocked
|
||||
&& playerController != null
|
||||
&& !playerController.IsTransitionLocked)
|
||||
{
|
||||
Vector2 intendedEnd = Vector2.Lerp(
|
||||
start,
|
||||
end,
|
||||
Mathf.Clamp01(elapsed / duration));
|
||||
Vector2 clampedEnd = playerController.ClampMovementToTerrain(
|
||||
body.position,
|
||||
intendedEnd);
|
||||
movementBlocked = (clampedEnd - intendedEnd).sqrMagnitude > 0.0001f;
|
||||
body.MovePosition(clampedEnd);
|
||||
}
|
||||
else if (playerController != null && playerController.IsTransitionLocked)
|
||||
{
|
||||
movementBlocked = true;
|
||||
}
|
||||
visual.transform.position = body.position
|
||||
+ GetCycloneShadowOffsetWorld();
|
||||
}
|
||||
@@ -1236,7 +1260,6 @@ namespace BumpCombat.Player
|
||||
hitIndex++;
|
||||
}
|
||||
|
||||
body.position = end;
|
||||
DestroyVisual(visual);
|
||||
EndExecution();
|
||||
}
|
||||
@@ -2190,6 +2213,134 @@ namespace BumpCombat.Player
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool TryEmitPassiveRelicEcho(
|
||||
Vector2 origin,
|
||||
Vector2 direction,
|
||||
float damageMultiplier)
|
||||
{
|
||||
ActiveArtifactDefinition definition = CurrentArtifact;
|
||||
if (definition == null
|
||||
|| definition.NormalDamage <= 0f
|
||||
|| damageMultiplier <= 0f
|
||||
|| definition.Effect == ActiveArtifactEffect.Pulse)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (direction.sqrMagnitude < MinimumDirectionSqrMagnitude)
|
||||
{
|
||||
direction = definition.Effect == ActiveArtifactEffect.ThunderCrash
|
||||
? GetThunderCrashDirection()
|
||||
: GetUseDirection();
|
||||
}
|
||||
direction.Normalize();
|
||||
int castIdentity = ++nextArtifactCastIdentity;
|
||||
float echoIgniteTickDamage = playerStats.CalculateDamage(
|
||||
definition.NormalIgniteTickDamage * damageMultiplier,
|
||||
definition.DamageTag);
|
||||
if (definition.Effect == ActiveArtifactEffect.ChainLightning)
|
||||
{
|
||||
EnemyController first = FindInitialChainTarget(origin, definition.NormalRange);
|
||||
if (first == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool applied = false;
|
||||
foreach (ChainStrike strike in PlanArcChain(definition, first, origin))
|
||||
{
|
||||
applied |= ApplyArtifactHit(
|
||||
strike.Enemy,
|
||||
definition,
|
||||
strike.Damage * damageMultiplier,
|
||||
(strike.End - strike.Start).normalized,
|
||||
strike.Knockback,
|
||||
true,
|
||||
false,
|
||||
echoIgniteTickDamage,
|
||||
castIdentity,
|
||||
true);
|
||||
}
|
||||
|
||||
return applied;
|
||||
}
|
||||
|
||||
Vector2 center = origin;
|
||||
Vector2 radii = new Vector2(definition.NormalRange, definition.NormalRange);
|
||||
float rayRange = definition.NormalRange;
|
||||
float rayHalfWidth = Mathf.Max(0.05f, definition.NormalWidth * 0.5f);
|
||||
switch (definition.Effect)
|
||||
{
|
||||
case ActiveArtifactEffect.Cyclone:
|
||||
center += GetCycloneHitCenterOffset(definition.NormalRange, false);
|
||||
radii = GetCycloneHitRadii(definition.NormalRange, false);
|
||||
break;
|
||||
case ActiveArtifactEffect.ThunderCrash:
|
||||
center = origin + direction * 0.45f;
|
||||
radii = GetThunderCrashHitRadii(definition.NormalRange, direction);
|
||||
break;
|
||||
}
|
||||
|
||||
List<EnemyController> enemies = FindNearestTargets(
|
||||
definition.Effect == ActiveArtifactEffect.Dash
|
||||
|| definition.Effect == ActiveArtifactEffect.Phoenix
|
||||
? origin + direction * (rayRange * 0.5f)
|
||||
: center,
|
||||
Mathf.Max(radii.x, radii.y, rayRange),
|
||||
null);
|
||||
int hitCount = 0;
|
||||
bool anyDamage = false;
|
||||
foreach (EnemyController enemy in enemies)
|
||||
{
|
||||
if (hitCount >= definition.NormalMaxTargets)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
Vector2 position = enemy.GroundAnchorPosition;
|
||||
Vector2 offset = position - origin;
|
||||
bool inside = definition.Effect switch
|
||||
{
|
||||
ActiveArtifactEffect.Dash or ActiveArtifactEffect.Phoenix =>
|
||||
Vector2.Dot(offset, direction) >= 0f
|
||||
&& Vector2.Dot(offset, direction) <= rayRange
|
||||
&& Mathf.Abs(Vector2.Dot(offset, new Vector2(-direction.y, direction.x))) <= rayHalfWidth,
|
||||
_ => GetEllipseDistance(position - center, radii) <= 1.0001f,
|
||||
};
|
||||
if (!inside)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Vector2 hitDirection = definition.Effect == ActiveArtifactEffect.Dash
|
||||
|| definition.Effect == ActiveArtifactEffect.Phoenix
|
||||
? direction
|
||||
: (position - center).normalized;
|
||||
if (hitDirection.sqrMagnitude < MinimumDirectionSqrMagnitude)
|
||||
{
|
||||
hitDirection = direction;
|
||||
}
|
||||
|
||||
bool damaged = ApplyArtifactHit(
|
||||
enemy,
|
||||
definition,
|
||||
definition.NormalDamage * damageMultiplier,
|
||||
hitDirection,
|
||||
definition.NormalKnockback,
|
||||
true,
|
||||
false,
|
||||
echoIgniteTickDamage,
|
||||
castIdentity,
|
||||
true);
|
||||
anyDamage |= damaged;
|
||||
if (damaged)
|
||||
{
|
||||
hitCount++;
|
||||
}
|
||||
}
|
||||
|
||||
return anyDamage;
|
||||
}
|
||||
private bool ApplyArtifactHit(
|
||||
EnemyController enemy,
|
||||
ActiveArtifactDefinition definition,
|
||||
@@ -2199,7 +2350,8 @@ namespace BumpCombat.Player
|
||||
bool showsHitFeedback = true,
|
||||
bool charged = false,
|
||||
float igniteTickDamage = 0f,
|
||||
int castIdentity = 0)
|
||||
int castIdentity = 0,
|
||||
bool passiveRelicEcho = false)
|
||||
{
|
||||
if (enemy == null || enemy.IsDead)
|
||||
{
|
||||
@@ -2219,7 +2371,9 @@ namespace BumpCombat.Player
|
||||
direction,
|
||||
knockback,
|
||||
definition.ArtifactColor,
|
||||
castIdentity);
|
||||
castIdentity,
|
||||
true,
|
||||
EnemyDamageSource.Player);
|
||||
if (result == EnemyArtifactHitResult.Rejected)
|
||||
{
|
||||
return false;
|
||||
@@ -2233,7 +2387,7 @@ namespace BumpCombat.Player
|
||||
|
||||
if (result == EnemyArtifactHitResult.Shielded)
|
||||
{
|
||||
if (enemy.LastArtifactContactCounted)
|
||||
if (!passiveRelicEcho && enemy.LastArtifactContactCounted)
|
||||
{
|
||||
CombatEvents.RaiseArtifactEffectiveHit(
|
||||
enemy.gameObject,
|
||||
@@ -2262,7 +2416,7 @@ namespace BumpCombat.Player
|
||||
igniteTickDamage);
|
||||
}
|
||||
|
||||
if (damageWasApplied)
|
||||
if (damageWasApplied && !passiveRelicEcho)
|
||||
{
|
||||
CombatEvents.RaiseArtifactEffectiveHit(
|
||||
enemy.gameObject,
|
||||
@@ -2283,7 +2437,7 @@ namespace BumpCombat.Player
|
||||
false,
|
||||
false,
|
||||
definition.DamageTag,
|
||||
definition.ArtifactId,
|
||||
passiveRelicEcho ? PassiveRelicController.EchoSourceId : definition.ArtifactId,
|
||||
false,
|
||||
result == EnemyArtifactHitResult.DamageApplied
|
||||
&& showsHitFeedback,
|
||||
|
||||
Reference in New Issue
Block a user