Skip to content

Class: Gem ​

csharp
public class Gem : Actor, ILogicUpdate, ICleanup, ICustomDestroyRoutine, IInteractable, IItem, IExcludeFromPool

Fields ​

NameDeclarationDescription
ClientEvent_OnHandOwnerChangedpublic SafeAction<Hero, Hero> ClientEvent_OnHandOwnerChanged
ClientEvent_OnOwnerChangedpublic SafeAction<Hero, Hero> ClientEvent_OnOwnerChanged
ClientEvent_OnTempOwnerChangedpublic SafeAction<DewPlayer, DewPlayer> ClientEvent_OnTempOwnerChanged
ClientGemEvent_OnCooldownReadypublic SafeAction ClientGemEvent_OnCooldownReady
ClientGemEvent_OnCooldownReducedpublic SafeAction<float> ClientGemEvent_OnCooldownReduced
ClientGemEvent_OnCooldownReducedByRatiopublic SafeAction<float> ClientGemEvent_OnCooldownReducedByRatio
ClientGemEvent_OnCooldownStartedpublic SafeAction ClientGemEvent_OnCooldownStarted
ClientGemEvent_OnFlashpublic SafeAction ClientGemEvent_OnFlash
ClientGemEvent_OnQualityChangedpublic 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`
GemMergeExponentpublic 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`
tvDefaultAllExceptSelfprotected AbilityTargetValidatorWrapper tvDefaultAllExceptSelf
tvDefaultHarmfulEffectTargetsprotected AbilityTargetValidatorWrapper tvDefaultHarmfulEffectTargets
tvDefaultUsefulEffectTargetsprotected AbilityTargetValidatorWrapper tvDefaultUsefulEffectTargets

Properties ​

NameDeclarationDescription
canInteractWithMousepublic bool canInteractWithMouse { get; }
currentCooldownpublic float currentCooldown { get; }
dismantleDreamDustOverridepublic int? dismantleDreamDustOverride { get; set; }
dismantleProgresspublic float dismantleProgress { get; }
effectiveLevelpublic int effectiveLevel { get; }
fillAmountpublic float fillAmount { get; set; }
focusDistancepublic float focusDistance { get; }
handOwnerpublic Hero handOwner { get; set; }
interactPivotpublic Transform interactPivot { get; }
isDestroyedOnRoomChangepublic override bool isDestroyedOnRoomChange { get; }
isLockedpublic bool isLocked { get; }Is this gem locked for local player?
isNotReadyByRateLimitpublic bool isNotReadyByRateLimit { get; }Is this gem not ready because of rate limit?
isValidpublic bool isValid { get; }Returns true if gem is not destroyed, is active, and has owner.
locationpublic GemLocation location { get; set; }Location of this gem if equipped to a hero.
maxCooldownpublic float maxCooldown { get; }
maxSellGoldpublic int maxSellGold { get; set; }
numberDisplaypublic int? numberDisplay { get; set; }
ownerpublic Hero owner { get; set; }
quality`[SaveVar(SaveVarFlags.Default)]
public int quality { get; set; }`
qualityTypepublic Gem.QualityType qualityType { get; }
sellGoldOverridepublic int? sellGoldOverride { get; set; }
skillpublic SkillTrigger skill { get; set; }
skipStartAnimationpublic bool skipStartAnimation { get; set; }
tempOwnerpublic DewPlayer tempOwner { get; set; }
worldModelpublic ItemWorldModel worldModel { get; }

Methods ​

ApplyCooldownReduction(float) ​

csharp
public void ApplyCooldownReduction(float amount)

Parameters:

NameTypeDescription
amountfloat

ApplyCooldownReductionByRatio(float) ​

csharp
public void ApplyCooldownReductionByRatio(float ratio)

Parameters:

NameTypeDescription
ratiofloat

Awake() ​

csharp
protected override void Awake()

CanInteract(Entity) ​

csharp
public bool CanInteract(Entity entity)

Parameters:

NameTypeDescription
entityEntity

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().

csharp
public T CreateAbilityInstanceWithSource<T>(Actor source, Vector3 position, Quaternion? rotation, CastInfo info, Action<T> beforePrepare = null) where T : AbilityInstance

Parameters:

NameTypeDescription
sourceActor
positionUnityEngine.Vector3
rotationUnityEngine.Quaternion?
infoCastInfo
beforePrepareSystem.Action&lt;T&gt;&lt;T&gt;
``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().

csharp
public Se_GenericEffectContainer CreateBasicEffectWithSource(Actor source, Entity victim, BasicEffect eff, float duration, string id, DuplicateEffectBehavior onDuplicate = DuplicateEffectBehavior.ReplacePrevious)

Parameters:

NameTypeDescription
sourceActor
victimEntity
effBasicEffect
durationfloat
idstring
onDuplicateDuplicateEffectBehavior

Returns: Se_GenericEffectContainer

CreateStatusEffectWithSource&lt;T&gt;(Actor, Entity, CastInfo, Action&lt;T&gt;) ​

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().

csharp
public T CreateStatusEffectWithSource<T>(Actor source, Entity victim, CastInfo info, Action<T> beforePrepare = null) where T : StatusEffect

Parameters:

NameTypeDescription
sourceActor
victimEntity
infoCastInfo
beforePrepareSystem.Action&lt;T&gt;&lt;T&gt;
``T

Returns: T

DismantleGem() ​

csharp
public void DismantleGem()

GetBuyGold() ​

csharp
public int GetBuyGold()

Returns: int

GetBuyGold(Rarity, int) ​

csharp
public static int GetBuyGold(Rarity rarity, int quality)

Parameters:

NameTypeDescription
rarityRarity
qualityint

Returns: int

GetDismantleAmount(DewPlayer) ​

csharp
public int GetDismantleAmount(DewPlayer player)

Parameters:

NameTypeDescription
playerDewPlayer

Returns: int

GetGoldValue(Rarity, int) ​

csharp
public static int GetGoldValue(Rarity rarity, int quality)

Parameters:

NameTypeDescription
rarityRarity
qualityint

Returns: int

GetMergedQuality(int, int) ​

csharp
public static int GetMergedQuality(int a, int b)

Parameters:

NameTypeDescription
aint
bint

Returns: int

GetQualityType(float) ​

csharp
public static Gem.QualityType GetQualityType(float quality)

Parameters:

NameTypeDescription
qualityfloat

Returns: Gem.QualityType

GetSellGold() ​

csharp
public int GetSellGold()

Returns: int

GetSellGold(Rarity, int) ​

csharp
public static int GetSellGold(Rarity rarity, int quality)

Parameters:

NameTypeDescription
rarityRarity
qualityint

Returns: int

GetValue(ScalingValue) ​

Gets value of the given scaling value using this gem's level and caster.

csharp
public float GetValue(ScalingValue val)

Parameters:

NameTypeDescription
valScalingValue

Returns: float

IsLockedFor(DewPlayer) ​

csharp
public bool IsLockedFor(DewPlayer player)

Parameters:

NameTypeDescription
playerDewPlayer

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.

csharp
public virtual bool IsReady()

Returns: bool

LogicUpdate(float) ​

csharp
public override void LogicUpdate(float dt)

Parameters:

NameTypeDescription
dtfloat

NotifyUse() ​

Flash this gem in UI for highlighting or giving attention to player.If this gem is rate-limited, it will decrement remaining use.

csharp
public void NotifyUse()

OnCastComplete(EventInfoCast) ​

Called on server when equipped skill completes casting.

csharp
protected virtual void OnCastComplete(EventInfoCast info)

Parameters:

NameTypeDescription
infoEventInfoCast

OnCastCompleteBeforePrepare(EventInfoCast) ​

Called on server when equipped skill creates ability instance before it is spawned and prepared.

csharp
protected virtual void OnCastCompleteBeforePrepare(EventInfoCast info)

Parameters:

NameTypeDescription
infoEventInfoCast

OnDealDamage(EventInfoDamage) ​

Called on server when equipped skill deals damage.

csharp
protected virtual void OnDealDamage(EventInfoDamage info)

Parameters:

NameTypeDescription
infoEventInfoDamage

OnDoHeal(EventInfoHeal) ​

Called on server when equipped skill does heal.

csharp
protected virtual void OnDoHeal(EventInfoHeal obj)

Parameters:

NameTypeDescription
objEventInfoHeal

OnEquipGem(Hero) ​

Called everywhere when this gem is picked up by hero.

csharp
public virtual void OnEquipGem(Hero newOwner)

Parameters:

NameTypeDescription
newOwnerHero

OnEquipSkill(SkillTrigger) ​

Called everywhere when this gem starts taking effect on skill.

csharp
public virtual void OnEquipSkill(SkillTrigger newSkill)

Parameters:

NameTypeDescription
newSkillSkillTrigger

OnPrepare() ​

csharp
protected override void OnPrepare()

OnQualityChange(int, int) ​

Called everywhere when this gem's quality is changed.

csharp
protected virtual void OnQualityChange(int oldQuality, int newQuality)

Parameters:

NameTypeDescription
oldQualityint
newQualityint

OnStartClient() ​

csharp
public override void OnStartClient()

OnStartServer() ​

csharp
public override void OnStartServer()

OnUnequipGem(Hero) ​

Called everywhere when this gem is dropped by hero.

csharp
public virtual void OnUnequipGem(Hero oldOwner)

Parameters:

NameTypeDescription
oldOwnerHero

OnUnequipSkill(SkillTrigger) ​

Called everywhere when this gem stops taking effect on skill.

csharp
public virtual void OnUnequipSkill(SkillTrigger oldSkill)

Parameters:

NameTypeDescription
oldSkillSkillTrigger

ResetCooldown() ​

csharp
public void ResetCooldown()

ShouldBeSavedWithRoom() ​

csharp
public override bool ShouldBeSavedWithRoom()

Returns: bool

StartCooldown() ​

csharp
public void StartCooldown()

Maintained by the Shape of Dreams Modding Community