| using System; |
| using System; |
| using UnityEngine; |
| using UnityEngine; |
| |
| |
| public class StatusEffect : ScriptableObject |
| public class StatusEffect : ScriptableObject |
| { |
| { |
| public StatusEffect Clone() |
| public StatusEffect Clone() |
| { |
| { |
| return base.MemberwiseClone() as StatusEffect; |
| return base.MemberwiseClone() as StatusEffect; |
| } |
| } |
| |
| |
| public virtual bool CanAdd(Character character) |
| public virtual bool CanAdd(Character character) |
| { |
| { |
| return true; |
| return true; |
| } |
| } |
| |
| |
| public virtual void Setup(Character character) |
| public virtual void Setup(Character character) |
| { |
| { |
| this.m_character = character; |
| this.m_character = character; |
| if (!string.IsNullOrEmpty(this.m_startMessage)) |
| if (!string.IsNullOrEmpty(this.m_startMessage)) |
| { |
| { |
| this.m_character.Message(this.m_startMessageType, this.m_startMessage, 0, null); |
| this.m_character.Message(this.m_startMessageType, this.m_startMessage, 0, null); |
| } |
| } |
| this.TriggerStartEffects(); |
| this.TriggerStartEffects(); |
| } |
| } |
| |
| |
| public virtual void SetAttacker(Character attacker) |
| public virtual void SetAttacker(Character attacker) |
| { |
| { |
| } |
| } |
| |
| |
| public virtual string GetTooltipString() |
| public virtual string GetTooltipString() |
| { |
| { |
| return this.m_tooltip; |
| return this.m_tooltip; |
| } |
| } |
| |
| |
| protected virtual void OnApplicationQuit() |
| protected virtual void OnApplicationQuit() |
| { |
| { |
| this.m_startEffectInstances = null; |
| this.m_startEffectInstances = null; |
| } |
| } |
| |
| |
| public virtual void OnDestroy() |
| public virtual void OnDestroy() |
| { |
| { |
| this.RemoveStartEffects(); |
| this.RemoveStartEffects(); |
| } |
| } |
| |
| |
| protected void TriggerStartEffects() |
| protected void TriggerStartEffects() |
| { |
| { |
| this.RemoveStartEffects(); |
| this.RemoveStartEffects(); |
| float radius = this.m_character.GetRadius(); |
| float radius = this.m_character.GetRadius(); |
| int num = -1; |
| int num = -1; |
| Player player = this.m_character as Player; |
| Player player = this.m_character as Player; |
| if (player) |
| if (player) |
| { |
| { |
| num = player.GetPlayerModel(); |
| num = player.GetPlayerModel(); |
| } |
| } |
| this.m_startEffectInstances = this.m_startEffects.Create(this.m_character.GetCenterPoint(), this.m_character.transform.rotation, this.m_character.transform, radius * 2f, num); |
| this.m_startEffectInstances = this.m_startEffects.Create(this.m_character.GetCenterPoint(), this.m_character.transform.rotation, this.m_character.transform, radius * 2f, num); |
| } |
| } |
| |
| |
| private void RemoveStartEffects() |
| private void RemoveStartEffects() |
| { |
| { |
| if (this.m_startEffectInstances != null && ZNetScene.instance != null) |
| if (this.m_startEffectInstances != null && ZNetScene.instance != null) |
| { |
| { |
| foreach (GameObject gameObject in this.m_startEffectInstances) |
| foreach (GameObject gameObject in this.m_startEffectInstances) |
| { |
| { |
| if (gameObject) |
| if (gameObject) |
| { |
| { |
| ZNetView component = gameObject.GetComponent<ZNetView>(); |
| ZNetView component = gameObject.GetComponent<ZNetView>(); |
| if (component.IsValid()) |
| if (component.IsValid()) |
| { |
| { |
| component.ClaimOwnership(); |
| component.ClaimOwnership(); |
| component.Destroy(); |
| component.Destroy(); |
| } |
| } |
| } |
| } |
| } |
| } |
| this.m_startEffectInstances = null; |
| this.m_startEffectInstances = null; |
| } |
| } |
| } |
| } |
| |
| |
| public virtual void Stop() |
| public virtual void Stop() |
| { |
| { |
| this.RemoveStartEffects(); |
| this.RemoveStartEffects(); |
| this.m_stopEffects.Create(this.m_character.transform.position, this.m_character.transform.rotation, null, 1f, -1); |
| this.m_stopEffects.Create(this.m_character.transform.position, this.m_character.transform.rotation, null, 1f, -1); |
| if (!string.IsNullOrEmpty(this.m_stopMessage)) |
| if (!string.IsNullOrEmpty(this.m_stopMessage)) |
| { |
| { |
| this.m_character.Message(this.m_stopMessageType, this.m_stopMessage, 0, null); |
| this.m_character.Message(this.m_stopMessageType, this.m_stopMessage, 0, null); |
| } |
| } |
| } |
| } |
| |
| |
| public virtual void UpdateStatusEffect(float dt) |
| public virtual void UpdateStatusEffect(float dt) |
| { |
| { |
| this.m_time += dt; |
| this.m_time += dt; |
| if (this.m_repeatInterval > 0f && !string.IsNullOrEmpty(this.m_repeatMessage)) |
| if (this.m_repeatInterval > 0f && !string.IsNullOrEmpty(this.m_repeatMessage)) |
| { |
| { |
| this.m_msgTimer += dt; |
| this.m_msgTimer += dt; |
| if (this.m_msgTimer > this.m_repeatInterval) |
| if (this.m_msgTimer > this.m_repeatInterval) |
| { |
| { |
| this.m_msgTimer = 0f; |
| this.m_msgTimer = 0f; |
| this.m_character.Message(this.m_repeatMessageType, this.m_repeatMessage, 0, null); |
| this.m_character.Message(this.m_repeatMessageType, this.m_repeatMessage, 0, null); |
| } |
| } |
| } |
| } |
| } |
| } |
| |
| |
| public virtual bool IsDone() |
| public virtual bool IsDone() |
| { |
| { |
| return this.m_ttl > 0f && this.m_time > this.m_ttl; |
| return this.m_ttl > 0f && this.m_time > this.m_ttl; |
| } |
| } |
| |
| |
| public virtual void ResetTime() |
| public virtual void ResetTime() |
| { |
| { |
| this.m_time = 0f; |
| this.m_time = 0f; |
| } |
| } |
| |
| |
| public virtual void SetLevel(int itemLevel, float skillLevel) |
| public virtual void SetLevel(int itemLevel, float skillLevel) |
| { |
| { |
| } |
| } |
| |
| |
| public float GetDuration() |
| public float GetDuration() |
| { |
| { |
| return this.m_time; |
| return this.m_time; |
| } |
| } |
| |
| |
| public float GetRemaningTime() |
| public float GetRemaningTime() |
| { |
| { |
| return this.m_ttl - this.m_time; |
| return this.m_ttl - this.m_time; |
| } |
| } |
| |
| |
| public virtual string GetIconText() |
| public virtual string GetIconText() |
| { |
| { |
| if (this.m_ttl > 0f) |
| if (this.m_ttl > 0f) |
| { |
| { |
| return StatusEffect.GetTimeString(this.m_ttl - this.GetDuration(), false, false); |
| return StatusEffect.GetTimeString(this.m_ttl - this.GetDuration(), false, false); |
| } |
| } |
| return ""; |
| return ""; |
| } |
| } |
| |
| |
| public static string GetTimeString(float time, bool sufix = false, bool alwaysShowMinutes = false) |
| public static string GetTimeString(float time, bool sufix = false, bool alwaysShowMinutes = false) |
| { |
| { |
| if (time <= 0f) |
| if (time <= 0f) |
| { |
| { |
| return ""; |
| return ""; |
| } |
| } |
| int num = Mathf.CeilToInt(time); |
| int num = Mathf.CeilToInt(time); |
| int num2 = (int)((float)num / 60f); |
| int num2 = (int)((float)num / 60f); |
| int num3 = Mathf.Max(0, num - num2 * 60); |
| int num3 = Mathf.Max(0, num - num2 * 60); |
| if (sufix) |
| if (sufix) |
| { |
| { |
| if (num2 > 0 || alwaysShowMinutes) |
| if (num2 > 0 || alwaysShowMinutes) |
| { |
| { |
| return num2.ToString() + "m:" + num3.ToString("00") + "s"; |
| return num2.ToString() + "m:" + num3.ToString("00") + "s"; |
| } |
| } |
| return num3.ToString() + "s"; |
| return num3.ToString() + "s"; |
| } |
| } |
| else |
| else |
| { |
| { |
| if (num2 > 0 || alwaysShowMinutes) |
| if (num2 > 0 || alwaysShowMinutes) |
| { |
| { |
| return num2.ToString() + ":" + num3.ToString("00"); |
| return num2.ToString() + ":" + num3.ToString("00"); |
| } |
| } |
| return num3.ToString(); |
| return num3.ToString(); |
| } |
| } |
| } |
| } |
| |
| |
| public virtual void ModifyAttack(Skills.SkillType skill, ref HitData hitData) |
| public virtual void ModifyAttack(Skills.SkillType skill, ref HitData hitData) |
| { |
| { |
| } |
| } |
| |
| |
| public virtual void ModifyHealthRegen(ref float regenMultiplier) |
| public virtual void ModifyHealthRegen(ref float regenMultiplier) |
| { |
| { |
| } |
| } |
| |
| |
| public virtual void ModifyStaminaRegen(ref float staminaRegen) |
| public virtual void ModifyStaminaRegen(ref float staminaRegen) |
| { |
| { |
| } |
| } |
| |
| |
| public virtual void ModifyEitrRegen(ref float eitrRegen) |
| public virtual void ModifyEitrRegen(ref float eitrRegen) |
| { |
| { |
| } |
| } |
| |
| |
| public virtual void ModifyDamageMods(ref HitData.DamageModifiers modifiers) |
| public virtual void ModifyDamageMods(ref HitData.DamageModifiers modifiers) |
| { |
| { |
| } |
| } |
| |
| |
| public virtual void ModifyRaiseSkill(Skills.SkillType skill, ref float value) |
| public virtual void ModifyRaiseSkill(Skills.SkillType skill, ref float value) |
| { |
| { |
| } |
| } |
| |
| |
| public virtual void ModifySkillLevel(Skills.SkillType skill, ref float level) |
| public virtual void ModifySkillLevel(Skills.SkillType skill, ref float level) |
| { |
| { |
| } |
| } |
| |
| |
| . | public virtual void ModifySpeed(float baseSpeed, ref float speed) |
| public virtual void ModifySpeed(float baseSpeed, ref float speed, Character character, Vector3 dir) |
| { |
| { |
| } |
| } |
| |
| |
| public virtual void ModifyJump(Vector3 baseJump, ref Vector3 jump) |
| public virtual void ModifyJump(Vector3 baseJump, ref Vector3 jump) |
| { |
| { |
| } |
| } |
| |
| |
| public virtual void ModifyWalkVelocity(ref Vector3 vel) |
| public virtual void ModifyWalkVelocity(ref Vector3 vel) |
| { |
| { |
| } |
| } |
| |
| |
| public virtual void ModifyFallDamage(float baseDamage, ref float damage) |
| public virtual void ModifyFallDamage(float baseDamage, ref float damage) |
| { |
| { |
| } |
| } |
| |
| |
| public virtual void ModifyNoise(float baseNoise, ref float noise) |
| public virtual void ModifyNoise(float baseNoise, ref float noise) |
| { |
| { |
| } |
| } |
| |
| |
| public virtual void ModifyStealth(float baseStealth, ref float stealth) |
| public virtual void ModifyStealth(float baseStealth, ref float stealth) |
| { |
| { |
| } |
| } |
| |
| |
| public virtual void ModifyMaxCarryWeight(float baseLimit, ref float limit) |
| public virtual void ModifyMaxCarryWeight(float baseLimit, ref float limit) |
| { |
| { |
| } |
| } |
| |
| |
| public virtual void ModifyRunStaminaDrain(float baseDrain, ref float drain) |
| public virtual void ModifyRunStaminaDrain(float baseDrain, ref float drain) |
| { |
| { |
| } |
| } |
| |
| |
| public virtual void ModifyJumpStaminaUsage(float baseStaminaUse, ref float staminaUse) |
| public virtual void ModifyJumpStaminaUsage(float baseStaminaUse, ref float staminaUse) |
| . | |
| { |
| |
| } |
| |
| |
| |
| public virtual void ModifyAttackStaminaUsage(float baseStaminaUse, ref float staminaUse) |
| |
| { |
| |
| } |
| |
| |
| |
| public virtual void ModifyBlockStaminaUsage(float baseStaminaUse, ref float staminaUse) |
| |
| { |
| |
| } |
| |
| |
| |
| public virtual void ModifyDodgeStaminaUsage(float baseStaminaUse, ref float staminaUse) |
| |
| { |
| |
| } |
| |
| |
| |
| public virtual void ModifySwimStaminaUsage(float baseStaminaUse, ref float staminaUse) |
| |
| { |
| |
| } |
| |
| |
| |
| public virtual void ModifyHomeItemStaminaUsage(float baseStaminaUse, ref float staminaUse) |
| |
| { |
| |
| } |
| |
| |
| |
| public virtual void ModifySneakStaminaUsage(float baseStaminaUse, ref float staminaUse) |
| { |
| { |
| } |
| } |
| |
| |
| public virtual void OnDamaged(HitData hit, Character attacker) |
| public virtual void OnDamaged(HitData hit, Character attacker) |
| { |
| { |
| } |
| } |
| |
| |
| public bool HaveAttribute(StatusEffect.StatusAttribute value) |
| public bool HaveAttribute(StatusEffect.StatusAttribute value) |
| { |
| { |
| return (this.m_attributes & value) > StatusEffect.StatusAttribute.None; |
| return (this.m_attributes & value) > StatusEffect.StatusAttribute.None; |
| } |
| } |
| |
| |
| public int NameHash() |
| public int NameHash() |
| { |
| { |
| if (this.m_nameHash == 0) |
| if (this.m_nameHash == 0) |
| { |
| { |
| this.m_nameHash = base.name.GetStableHashCode(); |
| this.m_nameHash = base.name.GetStableHashCode(); |
| } |
| } |
| return this.m_nameHash; |
| return this.m_nameHash; |
| } |
| } |
| |
| |
| [Header("__Common__")] |
| [Header("__Common__")] |
| public string m_name = ""; |
| public string m_name = ""; |
| |
| |
| public string m_category = ""; |
| public string m_category = ""; |
| |
| |
| public Sprite m_icon; |
| public Sprite m_icon; |
| |
| |
| public bool m_flashIcon; |
| public bool m_flashIcon; |
| |
| |
| public bool m_cooldownIcon; |
| public bool m_cooldownIcon; |
| |
| |
| [TextArea] |
| [TextArea] |
| public string m_tooltip = ""; |
| public string m_tooltip = ""; |
| |
| |
| [BitMask(typeof(StatusEffect.StatusAttribute))] |
| [BitMask(typeof(StatusEffect.StatusAttribute))] |
| public StatusEffect.StatusAttribute m_attributes; |
| public StatusEffect.StatusAttribute m_attributes; |
| |
| |
| public MessageHud.MessageType m_startMessageType = MessageHud.MessageType.TopLeft; |
| public MessageHud.MessageType m_startMessageType = MessageHud.MessageType.TopLeft; |
| |
| |
| public string m_startMessage = ""; |
| public string m_startMessage = ""; |
| |
| |
| public MessageHud.MessageType m_stopMessageType = MessageHud.MessageType.TopLeft; |
| public MessageHud.MessageType m_stopMessageType = MessageHud.MessageType.TopLeft; |
| |
| |
| public string m_stopMessage = ""; |
| public string m_stopMessage = ""; |
| |
| |
| public MessageHud.MessageType m_repeatMessageType = MessageHud.MessageType.TopLeft; |
| public MessageHud.MessageType m_repeatMessageType = MessageHud.MessageType.TopLeft; |
| |
| |
| public string m_repeatMessage = ""; |
| public string m_repeatMessage = ""; |
| |
| |
| public float m_repeatInterval; |
| public float m_repeatInterval; |
| |
| |
| public float m_ttl; |
| public float m_ttl; |
| |
| |
| public EffectList m_startEffects = new EffectList(); |
| public EffectList m_startEffects = new EffectList(); |
| |
| |
| public EffectList m_stopEffects = new EffectList(); |
| public EffectList m_stopEffects = new EffectList(); |
| |
| |
| [Header("__Guardian power__")] |
| [Header("__Guardian power__")] |
| public float m_cooldown; |
| public float m_cooldown; |
| |
| |
| public string m_activationAnimation = "gpower"; |
| public string m_activationAnimation = "gpower"; |
| |
| |
| [NonSerialized] |
| [NonSerialized] |
| public bool m_isNew = true; |
| public bool m_isNew = true; |
| |
| |
| private float m_msgTimer; |
| private float m_msgTimer; |
| |
| |
| protected Character m_character; |
| protected Character m_character; |
| |
| |
| protected float m_time; |
| protected float m_time; |
| |
| |
| protected GameObject[] m_startEffectInstances; |
| protected GameObject[] m_startEffectInstances; |
| |
| |
| private int m_nameHash; |
| private int m_nameHash; |
| |
| |
| public enum StatusAttribute |
| public enum StatusAttribute |
| { |
| { |
| None, |
| None, |
| ColdResistance, |
| ColdResistance, |
| DoubleImpactDamage, |
| DoubleImpactDamage, |
| SailingPower = 4 |
| SailingPower = 4 |
| } |
| } |
| } |
| } |
| |
| |