public float ApplyFatigue(float rawFatigue) { if (rawFatigue <= 0 || fsm.CurrentStateName == "Tired" || fsm.CurrentStateName == "DiveBomb") { return(0); } StatisticModificationResult result = statistics.Modify(StatisticType.Fatigue, rawFatigue, 0, statistics[StatisticType.MaxFatigue]); Debug.LogFormat("[L2ShieldBoss] Fatigue: {0} / {1}", result.currentValue, statistics[StatisticType.MaxFatigue]); if (result.currentValue >= statistics[StatisticType.MaxFatigue]) { fsm.CurrentStateName = "Tired"; statistics[StatisticType.Fatigue] = 0; } else if (fsm.CurrentStateName != "Knockback" && fsm.CurrentStateName != "DiveBomb") { anger += rawFatigue; } return(result.currentValue - result.previousValue); }
public float ConsumeEnergy(float value) { if (value < 0) { return(-1); } if (statistics[StatisticType.Sp] + statistics[StatisticType.Osp] < value) { return(-1); } float usedEnergy = 0; StatisticModificationResult result = statistics.Modify(StatisticType.Sp, -value, 0, statistics[StatisticType.MaxSp]); usedEnergy += result.previousValue - result.currentValue; value -= usedEnergy; if (value >= 1) { result = statistics.Modify(StatisticType.Osp, -value, 0, statistics[StatisticType.MaxOsp]); OverloadVFX.SetActive(false); usedEnergy += result.previousValue - result.currentValue; } return(usedEnergy); }
public override float ApplyDamage(float rawDamage) { Debug.Log(LogUtility.MakeLogStringFormat(name, "Take {0} damage.", rawDamage)); if (lastHit + invulnerableDuration > Time.time) { // still invulnerable return(0); } if (rawDamage <= 0) { return(0); } AudioManager.Singleton.PlayOnce("Hurt"); StatisticModificationResult result = statistics.Modify(StatisticType.Hp, -rawDamage, 0); if (result.currentValue <= 0) { AudioManager.Singleton.PlayOnce("Player_dead"); Dead(); } else if (result.currentValue <= 1f) { AudioManager.Singleton.PlayEvent("LowHealth"); } lastHit = Time.time; StartCoroutine(Blink()); return(result.previousValue - result.currentValue); }
public virtual float ApplyDamage(float rawDamage) { float damage = rawDamage; StatisticModificationResult result = statistics.Modify(StatisticType.Hp, -damage, 0); if (result.currentValue <= 0) { Dead(); } return(result.previousValue - result.currentValue); }
public bool ConsumeUltimateEnergy(float value) { StatisticModificationResult result = statistics.Modify(StatisticType.UltimateEnergy, -value, 0, statistics[StatisticType.MaxUltimateEnergy]); if (result.currentValue <= 0 && InFever) { InFever = false; FeverVFX.SetActive(false); GUIManager.Singleton.GetGUIWindow <GUIHUD>("HUD").DehighlightFeverBar(); TimeManager.Instance.EndFeverMotion(); AudioManager.Singleton.StopEvent("FeverMode"); } return(true); }
public override float ApplyDamage(float rawDamage) { if (IsInvulnerable) { return(0); } if (isEvading) { isEvading = false; if (IsGuarding) { Debug.LogFormat("[L2ShieldBoss] Blocked an incoming attack."); return(0); } return(ApplyFatigue(rawDamage * statistics.Sum(AttributeType.Fatigue_p0) * (1 + statistics.Sum(AttributeType.Fatigue_p1)))); } statistics[StatisticType.Fatigue] = 0; StatisticModificationResult result = statistics.Modify(StatisticType.Hp, -rawDamage, 0, statistics[StatisticType.MaxHp]); Debug.LogFormat("[L2ShieldBoss] HP: {0} / {1}", result.currentValue, statistics[StatisticType.MaxHp]); if (result.currentValue <= 0) { Dead(); } else if (!inRage && result.currentValue <= ragePercentage * statistics[StatisticType.MaxHp]) { inRage = true; fsm.CurrentStateName = "Rage"; } return(result.previousValue - result.currentValue); }
public bool AddKillCount(float amount) { StatisticModificationResult result = statistics.Modify(StatisticType.KsCount, amount, 0, statistics[StatisticType.MaxKs]); if (result.currentValue >= statistics[StatisticType.MaxKs]) { ActivateKillStreak(); } else { DeactivateKillStreak(); } lastKillStreakDecaySecond = Time.time; return(true); }
public bool AddUltimateEnergy(float amount) { StatisticModificationResult result = statistics.Modify(StatisticType.UltimateEnergy, amount, 0, statistics[StatisticType.MaxUltimateEnergy]); //TODO add max value effect if (result.currentValue >= statistics[StatisticType.MaxUltimateEnergy]) { GUIManager.Singleton.GetGUIWindow <GUIHUD>("HUD").HighlightFeverBar(); } else if (!InFever) { GUIManager.Singleton.GetGUIWindow <GUIHUD>("HUD").DehighlightFeverBar(); } float pitch = (statistics[StatisticType.UltimateEnergy] / statistics[StatisticType.MaxUltimateEnergy]); AudioManager.Singleton.PlayOnce("EnergyCharge", "Pitch", pitch); return(true); }
public float Heal(float rawHeal) { Debug.Log(LogUtility.MakeLogStringFormat(name, "Heal {0}.", rawHeal)); if (rawHeal <= 0) { return(0); } StatisticModificationResult result = statistics.Modify(StatisticType.Hp, rawHeal, 0, statistics[StatisticType.MaxHp]); if (result.currentValue >= 1 && result.currentValue < statistics[StatisticType.MaxHp]) { AudioManager.Singleton.StopEvent("LowHealth"); } return(result.previousValue - result.currentValue); }