Class: Gem
- Namespace:
Global - Assembly:
Dew.Core.dll - Inheritance / Derived: DewNetworkBehaviour → Actor
public class Gem : Actor, ILogicUpdate, ICleanup, ICustomDestroyRoutine, IInteractable, IItem, IExcludeFromPoolFields
| Name | Declaration | Description |
|---|---|---|
ClientEvent_OnHandOwnerChanged | public SafeAction<Hero, Hero> ClientEvent_OnHandOwnerChanged | |
ClientEvent_OnOwnerChanged | public SafeAction<Hero, Hero> ClientEvent_OnOwnerChanged | |
ClientEvent_OnTempOwnerChanged | public SafeAction<DewPlayer, DewPlayer> ClientEvent_OnTempOwnerChanged | |
ClientGemEvent_OnCooldownReady | public SafeAction ClientGemEvent_OnCooldownReady | |
ClientGemEvent_OnCooldownReduced | public SafeAction<float> ClientGemEvent_OnCooldownReduced | |
ClientGemEvent_OnCooldownReducedByRatio | public SafeAction<float> ClientGemEvent_OnCooldownReducedByRatio | |
ClientGemEvent_OnCooldownStarted | public SafeAction ClientGemEvent_OnCooldownStarted | |
ClientGemEvent_OnFlash | public SafeAction ClientGemEvent_OnFlash | |
ClientGemEvent_OnQualityChanged | public SafeAction<int, int> ClientGemEvent_OnQualityChanged | |
cooldownTime | `[BoxGroup("Gem Settings", true, false, 0)] | |
| [ShowIf("isCooldownEnabled", true)] | ||
| public ScalingValue cooldownTime` | ||
enableStatBonus | `[BoxGroup("Gem Settings", true, false, 0)] | |
| public bool enableStatBonus` | ||
excludeFromPool | `[BoxGroup("Gem Settings", true, false, 0)] | |
| public bool excludeFromPool` | ||
GemMergeExponent | public const float GemMergeExponent = 1 | |
icon | `[BoxGroup("Gem Settings", true, false, 0)] | |
| public Sprite icon` | ||
isCooldownEnabled | `[BoxGroup("Gem Settings", true, false, 0)] | |
| public bool isCooldownEnabled` | ||
isRateLimited | `[BoxGroup("Gem Settings", true, false, 0)] | |
| public bool isRateLimited` | ||
rarity | `[BoxGroup("Gem Settings", true, false, 0)] | |
| public Rarity rarity` | ||
rateLimitCount | `[BoxGroup("Gem Settings", true, false, 0)] | |
| [ShowIf("isRateLimited", true)] | ||
| public ScalingValue rateLimitCount` | ||
rateLimitTime | `[BoxGroup("Gem Settings", true, false, 0)] | |
| [ShowIf("isRateLimited", true)] | ||
| public ScalingValue rateLimitTime` | ||
readyEffect | `[BoxGroup("Gem Settings", true, false, 0)] | |
| [ShowIf("isCooldownEnabled", true)] | ||
| public GameObject readyEffect` | ||
setNumberDisplay | `[BoxGroup("Gem Settings", true, false, 0)] | |
| [ShowIf("isRateLimited", true)] | ||
| public bool setNumberDisplay` | ||
statBonus | `[BoxGroup("Gem Settings", true, false, 0)] | |
| [ShowIf("enableStatBonus", true)] | ||
| public StatBonus statBonus` | ||
tags | `[BoxGroup("Gem Settings", true, false, 0)] | |
| public DescriptionTags tags` | ||
tvDefaultAllExceptSelf | protected AbilityTargetValidatorWrapper tvDefaultAllExceptSelf | |
tvDefaultHarmfulEffectTargets | protected AbilityTargetValidatorWrapper tvDefaultHarmfulEffectTargets | |
tvDefaultUsefulEffectTargets | protected AbilityTargetValidatorWrapper tvDefaultUsefulEffectTargets |
Properties
| Name | Declaration | Description |
|---|---|---|
canInteractWithMouse | public bool canInteractWithMouse { get; } | |
currentCooldown | public float currentCooldown { get; } | |
dismantleDreamDustOverride | public int? dismantleDreamDustOverride { get; set; } | |
dismantleProgress | public float dismantleProgress { get; } | |
effectiveLevel | public int effectiveLevel { get; } | |
fillAmount | public float fillAmount { get; set; } | |
focusDistance | public float focusDistance { get; } | |
handOwner | public Hero handOwner { get; set; } | |
interactPivot | public Transform interactPivot { get; } | |
isDestroyedOnRoomChange | public override bool isDestroyedOnRoomChange { get; } | |
isLocked | public bool isLocked { get; } | Is this gem locked for local player? |
isNotReadyByRateLimit | public bool isNotReadyByRateLimit { get; } | Is this gem not ready because of rate limit? |
isValid | public bool isValid { get; } | Returns true if gem is not destroyed, is active, and has owner. |
location | public GemLocation location { get; set; } | Location of this gem if equipped to a hero. |
maxCooldown | public float maxCooldown { get; } | |
maxSellGold | public int maxSellGold { get; set; } | |
numberDisplay | public int? numberDisplay { get; set; } | |
owner | public Hero owner { get; set; } | |
quality | `[SaveVar(SaveVarFlags.Default)] | |
| public int quality { get; set; }` | ||
qualityType | public Gem.QualityType qualityType { get; } | |
sellGoldOverride | public int? sellGoldOverride { get; set; } | |
skill | public SkillTrigger skill { get; set; } | |
skipStartAnimation | public bool skipStartAnimation { get; set; } | |
tempOwner | public DewPlayer tempOwner { get; set; } | |
worldModel | public ItemWorldModel worldModel { get; } |
Methods
ApplyCooldownReduction(float)
public void ApplyCooldownReduction(float amount)Parameters:
| Name | Type | Description |
|---|---|---|
amount | float |
ApplyCooldownReductionByRatio(float)
public void ApplyCooldownReductionByRatio(float ratio)Parameters:
| Name | Type | Description |
|---|---|---|
ratio | float |
Awake()
protected override void Awake()CanInteract(Entity)
public bool CanInteract(Entity entity)Parameters:
| Name | Type | Description |
|---|---|---|
entity | Entity |
Returns: bool
CreateAbilityInstanceWithSource<T>(Actor, Vector3, Quaternion?, CastInfo, Action<T>)
Create an ability instance on behalf of source actor, but make it inherit this gem's quality. You MUST ensure source will not be destroyed before calling this. Call this right after instance spawn or use Actor.LockDestroy().
public T CreateAbilityInstanceWithSource<T>(Actor source, Vector3 position, Quaternion? rotation, CastInfo info, Action<T> beforePrepare = null) where T : AbilityInstanceParameters:
| Name | Type | Description |
|---|---|---|
source | Actor | |
position | UnityEngine.Vector3 | |
rotation | UnityEngine.Quaternion? | |
info | CastInfo | |
beforePrepare | System.Action<T><T> | |
| `` | T |
Returns: T
CreateBasicEffectWithSource(Actor, Entity, BasicEffect, float, string, DuplicateEffectBehavior)
Create a basic effect container on behalf of source actor. You MUST ensure source will not be destroyed before calling this. Call this right after instance spawn or use Actor.LockDestroy().
public Se_GenericEffectContainer CreateBasicEffectWithSource(Actor source, Entity victim, BasicEffect eff, float duration, string id, DuplicateEffectBehavior onDuplicate = DuplicateEffectBehavior.ReplacePrevious)Parameters:
| Name | Type | Description |
|---|---|---|
source | Actor | |
victim | Entity | |
eff | BasicEffect | |
duration | float | |
id | string | |
onDuplicate | DuplicateEffectBehavior |
Returns: Se_GenericEffectContainer
CreateStatusEffectWithSource<T>(Actor, Entity, CastInfo, Action<T>)
Create a status effect on behalf of source actor, but make it inherit this gem's quality. You MUST ensure source will not be destroyed before calling this. Call this right after instance spawn or use Actor.LockDestroy().
public T CreateStatusEffectWithSource<T>(Actor source, Entity victim, CastInfo info, Action<T> beforePrepare = null) where T : StatusEffectParameters:
| Name | Type | Description |
|---|---|---|
source | Actor | |
victim | Entity | |
info | CastInfo | |
beforePrepare | System.Action<T><T> | |
| `` | T |
Returns: T
DismantleGem()
public void DismantleGem()GetBuyGold()
public int GetBuyGold()Returns: int
GetBuyGold(Rarity, int)
public static int GetBuyGold(Rarity rarity, int quality)Parameters:
| Name | Type | Description |
|---|---|---|
rarity | Rarity | |
quality | int |
Returns: int
GetDismantleAmount(DewPlayer)
public int GetDismantleAmount(DewPlayer player)Parameters:
| Name | Type | Description |
|---|---|---|
player | DewPlayer |
Returns: int
GetGoldValue(Rarity, int)
public static int GetGoldValue(Rarity rarity, int quality)Parameters:
| Name | Type | Description |
|---|---|---|
rarity | Rarity | |
quality | int |
Returns: int
GetMergedQuality(int, int)
public static int GetMergedQuality(int a, int b)Parameters:
| Name | Type | Description |
|---|---|---|
a | int | |
b | int |
Returns: int
GetQualityType(float)
public static Gem.QualityType GetQualityType(float quality)Parameters:
| Name | Type | Description |
|---|---|---|
quality | float |
Returns: Gem.QualityType
GetSellGold()
public int GetSellGold()Returns: int
GetSellGold(Rarity, int)
public static int GetSellGold(Rarity rarity, int quality)Parameters:
| Name | Type | Description |
|---|---|---|
rarity | Rarity | |
quality | int |
Returns: int
GetValue(ScalingValue)
Gets value of the given scaling value using this gem's level and caster.
public float GetValue(ScalingValue val)Parameters:
| Name | Type | Description |
|---|---|---|
val | ScalingValue |
Returns: float
IsLockedFor(DewPlayer)
public bool IsLockedFor(DewPlayer player)Parameters:
| Name | Type | Description |
|---|---|---|
player | DewPlayer |
Returns: bool
IsReady()
Is this gem ready? By default this checks if the gem is cooled down and has at least 1 use left (rate-limit).This must return the same value everywhere(server/clients) for consistent behavior.
public virtual bool IsReady()Returns: bool
LogicUpdate(float)
public override void LogicUpdate(float dt)Parameters:
| Name | Type | Description |
|---|---|---|
dt | float |
NotifyUse()
Flash this gem in UI for highlighting or giving attention to player.If this gem is rate-limited, it will decrement remaining use.
public void NotifyUse()OnCastComplete(EventInfoCast)
Called on server when equipped skill completes casting.
protected virtual void OnCastComplete(EventInfoCast info)Parameters:
| Name | Type | Description |
|---|---|---|
info | EventInfoCast |
OnCastCompleteBeforePrepare(EventInfoCast)
Called on server when equipped skill creates ability instance before it is spawned and prepared.
protected virtual void OnCastCompleteBeforePrepare(EventInfoCast info)Parameters:
| Name | Type | Description |
|---|---|---|
info | EventInfoCast |
OnDealDamage(EventInfoDamage)
Called on server when equipped skill deals damage.
protected virtual void OnDealDamage(EventInfoDamage info)Parameters:
| Name | Type | Description |
|---|---|---|
info | EventInfoDamage |
OnDoHeal(EventInfoHeal)
Called on server when equipped skill does heal.
protected virtual void OnDoHeal(EventInfoHeal obj)Parameters:
| Name | Type | Description |
|---|---|---|
obj | EventInfoHeal |
OnEquipGem(Hero)
Called everywhere when this gem is picked up by hero.
public virtual void OnEquipGem(Hero newOwner)Parameters:
| Name | Type | Description |
|---|---|---|
newOwner | Hero |
OnEquipSkill(SkillTrigger)
Called everywhere when this gem starts taking effect on skill.
public virtual void OnEquipSkill(SkillTrigger newSkill)Parameters:
| Name | Type | Description |
|---|---|---|
newSkill | SkillTrigger |
OnPrepare()
protected override void OnPrepare()OnQualityChange(int, int)
Called everywhere when this gem's quality is changed.
protected virtual void OnQualityChange(int oldQuality, int newQuality)Parameters:
| Name | Type | Description |
|---|---|---|
oldQuality | int | |
newQuality | int |
OnStartClient()
public override void OnStartClient()OnStartServer()
public override void OnStartServer()OnUnequipGem(Hero)
Called everywhere when this gem is dropped by hero.
public virtual void OnUnequipGem(Hero oldOwner)Parameters:
| Name | Type | Description |
|---|---|---|
oldOwner | Hero |
OnUnequipSkill(SkillTrigger)
Called everywhere when this gem stops taking effect on skill.
public virtual void OnUnequipSkill(SkillTrigger oldSkill)Parameters:
| Name | Type | Description |
|---|---|---|
oldSkill | SkillTrigger |
ResetCooldown()
public void ResetCooldown()ShouldBeSavedWithRoom()
public override bool ShouldBeSavedWithRoom()Returns: bool
StartCooldown()
public void StartCooldown()