1
0

RevenantComponent.cs 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. using System.Numerics;
  2. using Content.Shared.Alert;
  3. using Content.Shared.FixedPoint;
  4. using Content.Shared.Store;
  5. using Content.Shared.Whitelist;
  6. using Robust.Shared.GameStates;
  7. using Robust.Shared.Prototypes;
  8. using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
  9. namespace Content.Shared.Revenant.Components;
  10. [RegisterComponent, NetworkedComponent]
  11. [AutoGenerateComponentState]
  12. public sealed partial class RevenantComponent : Component
  13. {
  14. /// <summary>
  15. /// The total amount of Essence the revenant has. Functions
  16. /// as health and is regenerated.
  17. /// </summary>
  18. [DataField, ViewVariables(VVAccess.ReadWrite)]
  19. [AutoNetworkedField]
  20. public FixedPoint2 Essence = 75;
  21. [DataField("stolenEssenceCurrencyPrototype", customTypeSerializer: typeof(PrototypeIdSerializer<CurrencyPrototype>))]
  22. public string StolenEssenceCurrencyPrototype = "StolenEssence";
  23. /// <summary>
  24. /// Prototype to spawn when the entity dies.
  25. /// </summary>
  26. [DataField("spawnOnDeathPrototype", customTypeSerializer:typeof(PrototypeIdSerializer<EntityPrototype>))]
  27. public string SpawnOnDeathPrototype = "Ectoplasm";
  28. /// <summary>
  29. /// The entity's current max amount of essence. Can be increased
  30. /// through harvesting player souls.
  31. /// </summary>
  32. [ViewVariables(VVAccess.ReadWrite), DataField("maxEssence")]
  33. public FixedPoint2 EssenceRegenCap = 75;
  34. /// <summary>
  35. /// The coefficient of damage taken to actual health lost.
  36. /// </summary>
  37. [ViewVariables(VVAccess.ReadWrite), DataField("damageToEssenceCoefficient")]
  38. public float DamageToEssenceCoefficient = 0.75f;
  39. /// <summary>
  40. /// The amount of essence passively generated per second.
  41. /// </summary>
  42. [ViewVariables(VVAccess.ReadWrite), DataField("essencePerSecond")]
  43. public FixedPoint2 EssencePerSecond = 0.5f;
  44. [ViewVariables]
  45. public float Accumulator = 0;
  46. // Here's the gist of the harvest ability:
  47. // Step 1: The revenant clicks on an entity to "search" for it's soul, which creates a doafter.
  48. // Step 2: After the doafter is completed, the soul is "found" and can be harvested.
  49. // Step 3: Clicking the entity again begins to harvest the soul, which causes the revenant to become vulnerable
  50. // Step 4: The second doafter for the harvest completes, killing the target and granting the revenant essence.
  51. #region Harvest Ability
  52. /// <summary>
  53. /// The duration of the soul search
  54. /// </summary>
  55. [DataField("soulSearchDuration")]
  56. public float SoulSearchDuration = 2.5f;
  57. /// <summary>
  58. /// The status effects applied after the ability
  59. /// the first float corresponds to amount of time the entity is stunned.
  60. /// the second corresponds to the amount of time the entity is made solid.
  61. /// </summary>
  62. [DataField("harvestDebuffs")]
  63. public Vector2 HarvestDebuffs = new(5, 5);
  64. /// <summary>
  65. /// The amount that is given to the revenant each time it's max essence is upgraded.
  66. /// </summary>
  67. [ViewVariables(VVAccess.ReadWrite), DataField("maxEssenceUpgradeAmount")]
  68. public float MaxEssenceUpgradeAmount = 10;
  69. #endregion
  70. //In the nearby radius, causes various objects to be thrown, messed with, and containers opened
  71. //Generally just causes a mess
  72. #region Defile Ability
  73. /// <summary>
  74. /// The amount of essence that is needed to use the ability.
  75. /// </summary>
  76. [ViewVariables(VVAccess.ReadWrite), DataField("defileCost")]
  77. public FixedPoint2 DefileCost = 30;
  78. /// <summary>
  79. /// The status effects applied after the ability
  80. /// the first float corresponds to amount of time the entity is stunned.
  81. /// the second corresponds to the amount of time the entity is made solid.
  82. /// </summary>
  83. [DataField("defileDebuffs")]
  84. public Vector2 DefileDebuffs = new(1, 4);
  85. /// <summary>
  86. /// The radius around the user that this ability affects
  87. /// </summary>
  88. [ViewVariables(VVAccess.ReadWrite), DataField("defileRadius")]
  89. public float DefileRadius = 3.5f;
  90. /// <summary>
  91. /// The amount of tiles that are uprooted by the ability
  92. /// </summary>
  93. [ViewVariables(VVAccess.ReadWrite), DataField("defileTilePryAmount")]
  94. public int DefileTilePryAmount = 15;
  95. /// <summary>
  96. /// The chance that an individual entity will have any of the effects
  97. /// happen to it.
  98. /// </summary>
  99. [ViewVariables(VVAccess.ReadWrite), DataField("defileEffectChance")]
  100. public float DefileEffectChance = 0.5f;
  101. #endregion
  102. #region Overload Lights Ability
  103. /// <summary>
  104. /// The amount of essence that is needed to use the ability.
  105. /// </summary>
  106. [ViewVariables(VVAccess.ReadWrite), DataField("overloadCost")]
  107. public FixedPoint2 OverloadCost = 40;
  108. /// <summary>
  109. /// The status effects applied after the ability
  110. /// the first float corresponds to amount of time the entity is stunned.
  111. /// the second corresponds to the amount of time the entity is made solid.
  112. /// </summary>
  113. [DataField("overloadDebuffs")]
  114. public Vector2 OverloadDebuffs = new(3, 8);
  115. /// <summary>
  116. /// The radius around the user that this ability affects
  117. /// </summary>
  118. [ViewVariables(VVAccess.ReadWrite), DataField("overloadRadius")]
  119. public float OverloadRadius = 5f;
  120. /// <summary>
  121. /// How close to the light the entity has to be in order to be zapped.
  122. /// </summary>
  123. [ViewVariables(VVAccess.ReadWrite), DataField("overloadZapRadius")]
  124. public float OverloadZapRadius = 2f;
  125. #endregion
  126. #region Blight Ability
  127. /// <summary>
  128. /// The amount of essence that is needed to use the ability.
  129. /// </summary>
  130. [ViewVariables(VVAccess.ReadWrite), DataField("blightCost")]
  131. public float BlightCost = 50;
  132. /// <summary>
  133. /// The status effects applied after the ability
  134. /// the first float corresponds to amount of time the entity is stunned.
  135. /// the second corresponds to the amount of time the entity is made solid.
  136. /// </summary>
  137. [DataField("blightDebuffs")]
  138. public Vector2 BlightDebuffs = new(2, 5);
  139. /// <summary>
  140. /// The radius around the user that this ability affects
  141. /// </summary>
  142. [ViewVariables(VVAccess.ReadWrite), DataField("blightRadius")]
  143. public float BlightRadius = 3.5f;
  144. #endregion
  145. #region Malfunction Ability
  146. /// <summary>
  147. /// The amount of essence that is needed to use the ability.
  148. /// </summary>
  149. [ViewVariables(VVAccess.ReadWrite), DataField("malfunctionCost")]
  150. public FixedPoint2 MalfunctionCost = 60;
  151. /// <summary>
  152. /// The status effects applied after the ability
  153. /// the first float corresponds to amount of time the entity is stunned.
  154. /// the second corresponds to the amount of time the entity is made solid.
  155. /// </summary>
  156. [DataField("malfunctionDebuffs")]
  157. public Vector2 MalfunctionDebuffs = new(2, 8);
  158. /// <summary>
  159. /// The radius around the user that this ability affects
  160. /// </summary>
  161. [ViewVariables(VVAccess.ReadWrite), DataField("malfunctionRadius")]
  162. public float MalfunctionRadius = 3.5f;
  163. /// <summary>
  164. /// Whitelist for entities that can be emagged by malfunction.
  165. /// Used to prevent ultra gamer things like ghost emagging chem or instantly launching the shuttle.
  166. /// </summary>
  167. [DataField]
  168. public EntityWhitelist? MalfunctionWhitelist;
  169. /// <summary>
  170. /// Whitelist for entities that can never be emagged by malfunction.
  171. /// </summary>
  172. [DataField]
  173. public EntityWhitelist? MalfunctionBlacklist;
  174. #endregion
  175. [DataField]
  176. public ProtoId<AlertPrototype> EssenceAlert = "Essence";
  177. #region Visualizer
  178. [DataField("state")]
  179. public string State = "idle";
  180. [DataField("corporealState")]
  181. public string CorporealState = "active";
  182. [DataField("stunnedState")]
  183. public string StunnedState = "stunned";
  184. [DataField("harvestingState")]
  185. public string HarvestingState = "harvesting";
  186. #endregion
  187. [DataField] public EntityUid? Action;
  188. }