Class Gem
Essence. It can be equipped to gem slots to provide special effects on skills and heroes.
Inheritance
object
UnityEngine.Object
UnityEngine.Component
UnityEngine.Behaviour
UnityEngine.MonoBehaviour
Mirror.NetworkBehaviour
Gem
Assembly: Dew.Core.dll
Syntax
public class Gem : Actor, ILogicUpdate, ICleanup, ICustomDestroyRoutine, IInteractable, IItem, IExcludeFromPool
Fields
ClientEvent_OnHandOwnerChanged
Declaration
public SafeAction<Hero, Hero> ClientEvent_OnHandOwnerChanged
Field Value
ClientEvent_OnOwnerChanged
Declaration
public SafeAction<Hero, Hero> ClientEvent_OnOwnerChanged
Field Value
ClientEvent_OnTempOwnerChanged
Declaration
public SafeAction<DewPlayer, DewPlayer> ClientEvent_OnTempOwnerChanged
Field Value
ClientGemEvent_OnCooldownReady
Declaration
public SafeAction ClientGemEvent_OnCooldownReady
Field Value
ClientGemEvent_OnCooldownReduced
Declaration
public SafeAction<float> ClientGemEvent_OnCooldownReduced
Field Value
ClientGemEvent_OnCooldownReducedByRatio
Declaration
public SafeAction<float> ClientGemEvent_OnCooldownReducedByRatio
Field Value
ClientGemEvent_OnCooldownStarted
Declaration
public SafeAction ClientGemEvent_OnCooldownStarted
Field Value
ClientGemEvent_OnFlash
Declaration
public SafeAction ClientGemEvent_OnFlash
Field Value
ClientGemEvent_OnQualityChanged
Declaration
public SafeAction<int, int> ClientGemEvent_OnQualityChanged
Field Value
cooldownTime
Declaration
[BoxGroup("Gem Settings", true, false, 0)]
[ShowIf("isCooldownEnabled", true)]
public ScalingValue cooldownTime
Field Value
enableStatBonus
Declaration
[BoxGroup("Gem Settings", true, false, 0)]
public bool enableStatBonus
Field Value
excludeFromPool
Declaration
[BoxGroup("Gem Settings", true, false, 0)]
public bool excludeFromPool
Field Value
GemMergeExponent
Declaration
public const float GemMergeExponent = 1
Field Value
icon
Declaration
[BoxGroup("Gem Settings", true, false, 0)]
public Sprite icon
Field Value
| Type |
Description |
| UnityEngine.Sprite |
|
isCooldownEnabled
Declaration
[BoxGroup("Gem Settings", true, false, 0)]
public bool isCooldownEnabled
Field Value
isRateLimited
Declaration
[BoxGroup("Gem Settings", true, false, 0)]
public bool isRateLimited
Field Value
rarity
Declaration
[BoxGroup("Gem Settings", true, false, 0)]
public Rarity rarity
Field Value
rateLimitCount
Declaration
[BoxGroup("Gem Settings", true, false, 0)]
[ShowIf("isRateLimited", true)]
public ScalingValue rateLimitCount
Field Value
rateLimitTime
Declaration
[BoxGroup("Gem Settings", true, false, 0)]
[ShowIf("isRateLimited", true)]
public ScalingValue rateLimitTime
Field Value
readyEffect
Declaration
[BoxGroup("Gem Settings", true, false, 0)]
[ShowIf("isCooldownEnabled", true)]
public GameObject readyEffect
Field Value
| Type |
Description |
| UnityEngine.GameObject |
|
setNumberDisplay
Declaration
[BoxGroup("Gem Settings", true, false, 0)]
[ShowIf("isRateLimited", true)]
public bool setNumberDisplay
Field Value
statBonus
Declaration
[BoxGroup("Gem Settings", true, false, 0)]
[ShowIf("enableStatBonus", true)]
public StatBonus statBonus
Field Value
Declaration
[BoxGroup("Gem Settings", true, false, 0)]
public DescriptionTags tags
Field Value
tvDefaultAllExceptSelf
Declaration
protected AbilityTargetValidatorWrapper tvDefaultAllExceptSelf
Field Value
tvDefaultHarmfulEffectTargets
Declaration
protected AbilityTargetValidatorWrapper tvDefaultHarmfulEffectTargets
Field Value
tvDefaultUsefulEffectTargets
Declaration
protected AbilityTargetValidatorWrapper tvDefaultUsefulEffectTargets
Field Value
Properties
canInteractWithMouse
Declaration
public bool canInteractWithMouse { get; }
Property Value
currentCooldown
Declaration
public float currentCooldown { get; }
Property Value
dismantleDreamDustOverride
Declaration
public int? dismantleDreamDustOverride { get; set; }
Property Value
dismantleProgress
Declaration
public float dismantleProgress { get; }
Property Value
effectiveLevel
Declaration
public int effectiveLevel { get; }
Property Value
fillAmount
Declaration
public float fillAmount { get; set; }
Property Value
focusDistance
Declaration
public float focusDistance { get; }
Property Value
handOwner
Declaration
public Hero handOwner { get; set; }
Property Value
interactPivot
Declaration
public Transform interactPivot { get; }
Property Value
| Type |
Description |
| UnityEngine.Transform |
|
isDestroyedOnRoomChange
Declaration
public override bool isDestroyedOnRoomChange { get; }
Property Value
Overrides
isLocked
Is this gem locked for local player?
Declaration
public bool isLocked { get; }
Property Value
isNotReadyByRateLimit
Is this gem not ready because of rate limit?
Declaration
public bool isNotReadyByRateLimit { get; }
Property Value
isValid
Returns true if gem is not destroyed, is active, and has owner.
Declaration
public bool isValid { get; }
Property Value
location
Location of this gem if equipped to a hero.
Declaration
public GemLocation location { get; set; }
Property Value
maxCooldown
Declaration
public float maxCooldown { get; }
Property Value
maxSellGold
Declaration
public int maxSellGold { get; set; }
Property Value
numberDisplay
Declaration
public int? numberDisplay { get; set; }
Property Value
owner
Declaration
public Hero owner { get; set; }
Property Value
quality
Declaration
[SaveVar(SaveVarFlags.Default)]
public int quality { get; set; }
Property Value
qualityType
Declaration
public Gem.QualityType qualityType { get; }
Property Value
sellGoldOverride
Declaration
public int? sellGoldOverride { get; set; }
Property Value
skill
Declaration
public SkillTrigger skill { get; set; }
Property Value
skipStartAnimation
Declaration
public bool skipStartAnimation { get; set; }
Property Value
tempOwner
Declaration
public DewPlayer tempOwner { get; set; }
Property Value
worldModel
Declaration
public ItemWorldModel worldModel { get; }
Property Value
| Type |
Description |
| ItemWorldModel |
|
Methods
ApplyCooldownReduction(float)
Declaration
public void ApplyCooldownReduction(float amount)
Parameters
| Type |
Name |
Description |
| float |
amount |
|
ApplyCooldownReductionByRatio(float)
Declaration
public void ApplyCooldownReductionByRatio(float ratio)
Parameters
| Type |
Name |
Description |
| float |
ratio |
|
Awake()
Declaration
protected override void Awake()
Overrides
CanInteract(Entity)
Declaration
public bool CanInteract(Entity entity)
Parameters
| Type |
Name |
Description |
| Entity |
entity |
|
Returns
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().
Declaration
public T CreateAbilityInstanceWithSource<T>(Actor source, Vector3 position, Quaternion? rotation, CastInfo info, Action<T> beforePrepare = null) where T : AbilityInstance
Parameters
| Type |
Name |
Description |
| Actor |
source |
|
| UnityEngine.Vector3 |
position |
|
| UnityEngine.Quaternion? |
rotation |
|
| CastInfo |
info |
|
| System.Action<T><T> |
beforePrepare |
|
Returns
Type Parameters
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().
Declaration
public Se_GenericEffectContainer CreateBasicEffectWithSource(Actor source, Entity victim, BasicEffect eff, float duration, string id, DuplicateEffectBehavior onDuplicate = DuplicateEffectBehavior.ReplacePrevious)
Parameters
Returns
| Type |
Description |
| 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().
Declaration
public T CreateStatusEffectWithSource<T>(Actor source, Entity victim, CastInfo info, Action<T> beforePrepare = null) where T : StatusEffect
Parameters
| Type |
Name |
Description |
| Actor |
source |
|
| Entity |
victim |
|
| CastInfo |
info |
|
| System.Action<T><T> |
beforePrepare |
|
Returns
Type Parameters
DismantleGem()
Declaration
public void DismantleGem()
GetBuyGold()
Declaration
Returns
GetBuyGold(Rarity, int)
Declaration
public static int GetBuyGold(Rarity rarity, int quality)
Parameters
| Type |
Name |
Description |
| Rarity |
rarity |
|
| int |
quality |
|
Returns
GetDismantleAmount(DewPlayer)
Declaration
public int GetDismantleAmount(DewPlayer player)
Parameters
Returns
GetGoldValue(Rarity, int)
Declaration
public static int GetGoldValue(Rarity rarity, int quality)
Parameters
| Type |
Name |
Description |
| Rarity |
rarity |
|
| int |
quality |
|
Returns
GetMergedQuality(int, int)
Declaration
public static int GetMergedQuality(int a, int b)
Parameters
| Type |
Name |
Description |
| int |
a |
|
| int |
b |
|
Returns
GetQualityType(float)
Declaration
public static Gem.QualityType GetQualityType(float quality)
Parameters
| Type |
Name |
Description |
| float |
quality |
|
Returns
GetSellGold()
Declaration
Returns
GetSellGold(Rarity, int)
Declaration
public static int GetSellGold(Rarity rarity, int quality)
Parameters
| Type |
Name |
Description |
| Rarity |
rarity |
|
| int |
quality |
|
Returns
GetValue(ScalingValue)
Gets value of the given scaling value using this gem's level and caster.
Declaration
public float GetValue(ScalingValue val)
Parameters
Returns
IsLockedFor(DewPlayer)
Declaration
public bool IsLockedFor(DewPlayer player)
Parameters
Returns
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.
Declaration
public virtual bool IsReady()
Returns
LogicUpdate(float)
Declaration
public override void LogicUpdate(float dt)
Parameters
| Type |
Name |
Description |
| float |
dt |
|
Overrides
NotifyUse()
Flash this gem in UI for highlighting or giving attention to player.
If this gem is rate-limited, it will decrement remaining use.
Declaration
OnCastComplete(EventInfoCast)
Called on server when equipped skill completes casting.
Declaration
protected virtual void OnCastComplete(EventInfoCast info)
Parameters
OnCastCompleteBeforePrepare(EventInfoCast)
Called on server when equipped skill creates ability instance before it is spawned and prepared.
Declaration
protected virtual void OnCastCompleteBeforePrepare(EventInfoCast info)
Parameters
OnDealDamage(EventInfoDamage)
Called on server when equipped skill deals damage.
Declaration
protected virtual void OnDealDamage(EventInfoDamage info)
Parameters
OnDoHeal(EventInfoHeal)
Called on server when equipped skill does heal.
Declaration
protected virtual void OnDoHeal(EventInfoHeal obj)
Parameters
OnEquipGem(Hero)
Called everywhere when this gem is picked up by hero.
Declaration
public virtual void OnEquipGem(Hero newOwner)
Parameters
| Type |
Name |
Description |
| Hero |
newOwner |
|
OnEquipSkill(SkillTrigger)
Called everywhere when this gem starts taking effect on skill.
Declaration
public virtual void OnEquipSkill(SkillTrigger newSkill)
Parameters
OnPrepare()
Declaration
protected override void OnPrepare()
Overrides
OnQualityChange(int, int)
Called everywhere when this gem's quality is changed.
Declaration
protected virtual void OnQualityChange(int oldQuality, int newQuality)
Parameters
| Type |
Name |
Description |
| int |
oldQuality |
|
| int |
newQuality |
|
OnStartClient()
Declaration
public override void OnStartClient()
Overrides
OnStartServer()
Declaration
public override void OnStartServer()
Overrides
OnUnequipGem(Hero)
Called everywhere when this gem is dropped by hero.
Declaration
public virtual void OnUnequipGem(Hero oldOwner)
Parameters
| Type |
Name |
Description |
| Hero |
oldOwner |
|
OnUnequipSkill(SkillTrigger)
Called everywhere when this gem stops taking effect on skill.
Declaration
public virtual void OnUnequipSkill(SkillTrigger oldSkill)
Parameters
ResetCooldown()
Declaration
public void ResetCooldown()
ShouldBeSavedWithRoom()
Declaration
public override bool ShouldBeSavedWithRoom()
Returns
Overrides
StartCooldown()
Declaration
public void StartCooldown()
Explicit Interface Implementations
IExcludeFromPool.excludeFromPool
Declaration
bool IExcludeFromPool.excludeFromPool { get; }
Returns
IInteractable.OnInteract(Entity, bool)
Declaration
void IInteractable.OnInteract(Entity entity, bool alt)
Parameters
| Type |
Name |
Description |
| Entity |
entity |
|
| bool |
alt |
|
IInteractable.priority
Declaration
int IInteractable.priority { get; }
Returns
IItem.owner
Declaration
Entity IItem.owner { get; set; }
Returns
IItem.rarity
Declaration
Rarity IItem.rarity { get; }
Returns
Implements
Extension Methods