added "finish" button to dialogue UI, implementation of many, many trinket's effects, autot-argetting fix on death, added script for particles/player following
This commit is contained in:
@@ -75,6 +75,7 @@ namespace Beyond
|
||||
public bMeleeCombatInput MeleeCombatInput => m_meleeCombatInput;
|
||||
|
||||
// --- TRINKET SYSTEM INTEGRATION START ---
|
||||
// Initialize default values to 1f to prevent divide-by-zero or zero-stat issues on startup
|
||||
private TrinketManager.TrinketStats m_trinketStats = new TrinketManager.TrinketStats
|
||||
{
|
||||
healthMult = 1f,
|
||||
@@ -85,7 +86,8 @@ namespace Beyond
|
||||
faithRegenMult = 1f,
|
||||
attackSpeedMult = 1f,
|
||||
thornDamageMult = 1f,
|
||||
staminaMult = 1f
|
||||
staminaMult = 1f,
|
||||
soulfireDamageMult = 1f
|
||||
};
|
||||
|
||||
public TrinketManager.TrinketStats CurrentTrinketStats => m_trinketStats;
|
||||
@@ -93,29 +95,66 @@ namespace Beyond
|
||||
public void UpdateTrinketStats(TrinketManager.TrinketStats newStats)
|
||||
{
|
||||
m_trinketStats = newStats;
|
||||
// Force stats recalculation
|
||||
UpdatePlayerStatistics();
|
||||
|
||||
// 1. Recalculate Base Stats (Health/Faith/Stamina/Natural Regen)
|
||||
// This sets m_vController.healthRecovery to the base natural value (from Maturity/Brightness)
|
||||
UpdatePlayerStatistics();
|
||||
|
||||
// Apply immediate effects
|
||||
if (m_vController)
|
||||
// 2. Apply Speed & Animation Speed
|
||||
if (m_vController)
|
||||
{
|
||||
m_vController.speedMultiplier = m_trinketStats.speedMult;
|
||||
// 2. Apply Attack Speed (UI Method)
|
||||
|
||||
if (m_vController.animator)
|
||||
m_vController.animator.SetFloat("AttackSpeed", m_trinketStats.attackSpeedMult);
|
||||
|
||||
// --- HEALTH REGEN LOGIC START ---
|
||||
// Start with the base natural rate we just calculated in UpdatePlayerStatistics
|
||||
float totalRegenRate = m_vController.healthRecovery;
|
||||
float totalRegenCap = 1f; // Default 100% cap
|
||||
|
||||
// Add Passive Trinket Regen (e.g. "Growth" effect: Regen up to 50%)
|
||||
if (m_trinketStats.effectGrowth)
|
||||
{
|
||||
// Example: +2 HP/sec up to 50%
|
||||
totalRegenRate += 2f;
|
||||
totalRegenCap = 0.5f;
|
||||
}
|
||||
|
||||
// If you cast to bThirdPersonController, you can set the Cap
|
||||
if (m_vController is bThirdPersonController bController)
|
||||
{
|
||||
bController.healthRecoveryCap = totalRegenCap;
|
||||
}
|
||||
|
||||
// Update the final rate on the controller
|
||||
m_vController.SetHealthRecovery(totalRegenRate);
|
||||
// --- HEALTH REGEN LOGIC END ---
|
||||
}
|
||||
|
||||
// 3. Apply Damage Multiplier (NEW)
|
||||
// 3. Apply Damage Multipliers
|
||||
if (m_meleeManager)
|
||||
{
|
||||
// Calculate the base multiplier from stats
|
||||
// Start with the base multiplier from items
|
||||
float totalDamageMult = m_trinketStats.damageMult;
|
||||
totalDamageMult += 0.10f;
|
||||
|
||||
// Send to Melee Manager
|
||||
// "The Darkening": Bonus dmg
|
||||
if (m_trinketStats.effectDarkening)
|
||||
{
|
||||
totalDamageMult += 0.10f;
|
||||
}
|
||||
|
||||
// "Determination": Combo finish +5% damage
|
||||
// (Global application for now)
|
||||
if (m_trinketStats.effectDetermination)
|
||||
{
|
||||
totalDamageMult += 0.05f;
|
||||
}
|
||||
|
||||
// Send final value to your modified vMeleeManager
|
||||
// NOTE: Requires the SetGlobalDamageMultiplier method added to vMeleeManager
|
||||
m_meleeManager.SetGlobalDamageMultiplier(totalDamageMult);
|
||||
}
|
||||
|
||||
}
|
||||
// --- TRINKET SYSTEM INTEGRATION END ---
|
||||
|
||||
@@ -172,6 +211,7 @@ namespace Beyond
|
||||
private float faithBaseMaxValue = 100f;
|
||||
|
||||
private System.Action onMenuScrollClosed;
|
||||
// Updated Action signature to pass 3 floats for UI (Health, Faith, Stamina)
|
||||
public System.Action<float, float, float> onStatsUpdated;
|
||||
private UnityAction<Transform> onDialogueEnded;
|
||||
private bLockOn m_lockOn;
|
||||
@@ -231,28 +271,26 @@ namespace Beyond
|
||||
|
||||
private void OnDamageHit(vHitInfo arg0)
|
||||
{
|
||||
// Slow motion logic (existing)
|
||||
// Slow motion logic
|
||||
if (slowMoOnHtScale < 1f - float.Epsilon)
|
||||
{
|
||||
TimeController.Instance.Reset();
|
||||
}
|
||||
|
||||
// 1. Health Vampirism
|
||||
// 1. Health Vampirism (Vitality)
|
||||
if (m_trinketStats.effectHealthVampirism)
|
||||
{
|
||||
// Logic: Heal 2% of Player's Max Health per hit
|
||||
// Mathf.Max ensures we always heal at least 1 HP
|
||||
// Heal 2% of Max Health per hit, min 1 HP
|
||||
int healAmount = Mathf.Max(1, (int)(MaxHealth * 0.02f));
|
||||
m_vController.ChangeHealth(healAmount);
|
||||
}
|
||||
|
||||
// 2. Faith Vampirism
|
||||
// 2. Faith Vampirism (Trust)
|
||||
if (m_trinketStats.effectFaithVampirism)
|
||||
{
|
||||
// Logic: Add 1 Faith point per hit
|
||||
// Add 1 Faith point per hit
|
||||
UpdateFaithCurrentValue(1);
|
||||
}
|
||||
// ----------------------------
|
||||
}
|
||||
|
||||
private void OnConversationStarted(Transform transform)
|
||||
@@ -311,7 +349,7 @@ namespace Beyond
|
||||
controller.RemoveAnimatorTags();
|
||||
}
|
||||
|
||||
// ... [Audio Play Methods - kept same] ...
|
||||
// ... [Audio Play Methods] ...
|
||||
public void PlayNoFaithClip() { PlayRandomSound(m_noFaithClips); }
|
||||
private void PlayRandomSound(AudioClip[] sounds)
|
||||
{
|
||||
@@ -367,14 +405,32 @@ namespace Beyond
|
||||
public void OnReceivedDamage(vDamage damage)
|
||||
{
|
||||
if (m_cutScenePlaying) return;
|
||||
|
||||
// --- TRINKET DEFENSE CALCULATION ---
|
||||
// defenseMult of 0.9 means 90% damage taken (10% reduction)
|
||||
|
||||
// --- 1. DEFENSE CALCULATION ---
|
||||
// Example: 0.9 defenseMult = 90% damage taken (10% reduction)
|
||||
if (Mathf.Abs(m_trinketStats.defenseMult - 1f) > float.Epsilon)
|
||||
{
|
||||
damage.damageValue = (int)(damage.damageValue * m_trinketStats.defenseMult);
|
||||
}
|
||||
// -----------------------------------
|
||||
|
||||
// --- 2. THORN DAMAGE (Reflect Damage) ---
|
||||
if (m_trinketStats.thornDamageMult > 1f && damage.sender != null)
|
||||
{
|
||||
// Calculate reflect amount (Base damage * (Mult - 1))
|
||||
int thornVal = (int)(damage.damageValue * (m_trinketStats.thornDamageMult - 1f));
|
||||
|
||||
if (thornVal > 0)
|
||||
{
|
||||
vDamage reflectDmg = new vDamage(thornVal);
|
||||
reflectDmg.sender = transform;
|
||||
reflectDmg.damageType = "Thorns";
|
||||
reflectDmg.reaction_id = -1; // No flinch
|
||||
|
||||
// Uses Invector extension method to apply damage to sender
|
||||
damage.sender.gameObject.ApplyDamage(reflectDmg);
|
||||
}
|
||||
}
|
||||
// ----------------------------------------
|
||||
|
||||
#if UNITY_IOS && !UNITY_EDITOR
|
||||
HapticEngine.ImpactFeedbackHeavy();
|
||||
@@ -396,6 +452,8 @@ namespace Beyond
|
||||
if (m_Respawner) m_Respawner.SaveRespawnPoint();
|
||||
}
|
||||
|
||||
// ... [Quest and Attribute Methods] ...
|
||||
|
||||
public List<Quest> GetAllGuilts()
|
||||
{
|
||||
if (!m_questJournal)
|
||||
@@ -525,12 +583,14 @@ namespace Beyond
|
||||
// --- TRINKET INTEGRATION IN STATS CALCULATION ---
|
||||
|
||||
// 1. Calculate specific total multipliers for UI scaling
|
||||
// 1. Calculate specific total multipliers
|
||||
float totalHealthMult = finalMultiplier * m_trinketStats.healthMult;
|
||||
float totalFaithMult = finalMultiplier * m_trinketStats.faithMult;
|
||||
float totalStaminaMult = finalMultiplier * (m_trinketStats.staminaMult > 0 ? m_trinketStats.staminaMult : 1f); // Handle 0 default
|
||||
// Handle 0 default for Stamina
|
||||
float validStaminaMult = m_trinketStats.staminaMult > 0 ? m_trinketStats.staminaMult : 1f;
|
||||
float totalStaminaMult = finalMultiplier * validStaminaMult;
|
||||
|
||||
// 2. Capture Current Health Percentage BEFORE changes
|
||||
// This prevents the health bar from looking empty when Max HP increases
|
||||
float healthPercent = m_vController.maxHealth > 0 ? m_vController.currentHealth / m_vController.maxHealth : 1f;
|
||||
|
||||
// 3. Apply Stats
|
||||
@@ -544,12 +604,16 @@ namespace Beyond
|
||||
m_vController.maxHealth = newMaxHealth;
|
||||
|
||||
// Apply Proportional Current Health
|
||||
// We update the current health to match the previous percentage
|
||||
//m_vController.currentHealth = Mathf.RoundToInt(newMaxHealth * healthPercent);
|
||||
// Uses ChangeHealth() because currentHealth has a protected setter
|
||||
m_vController.ChangeHealth(Mathf.RoundToInt(newMaxHealth * healthPercent));
|
||||
|
||||
// Stamina
|
||||
m_vController.maxStamina = Mathf.Round(totalStaminaMult * staminaBaseMaxValue);
|
||||
m_vController.staminaRecovery = (finalMultiplier * staminaBaseRegenValue);
|
||||
|
||||
// Natural Health Recovery (From Maturity/Brightness)
|
||||
// We set the BASE here. UpdateTrinketStats will later add any trinket bonuses to this value.
|
||||
m_vController.healthRecovery = finalMultiplier * healthBaseRegenValue;
|
||||
|
||||
// ------------------------------------------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user