JSGCardInterface.cs 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using CommonAI.Data;
  7. using XmdsCommon.JSGModule;
  8. using XmdsCommon.JSGModule.Interface;
  9. using XmdsCommonServer.XLS.Data;
  10. using XmdsCommonServer.Plugin;
  11. using XmdsCommonServer.Plugin.CardSkill;
  12. using CommonAI.Zone.Formula;
  13. namespace XmdsCommonSkill.Plugin.CardSkill
  14. {
  15. /** 卡牌接口类 */
  16. public interface JSGCardInterface
  17. {
  18. }
  19. // 卡牌权重变更类型
  20. public enum CardRateChgType : byte
  21. {
  22. Add = 0,
  23. Del = 1,
  24. Set = 2,
  25. Double = 3,
  26. }
  27. // 卡牌强化类型
  28. public enum CardStrengthenType : byte
  29. {
  30. None = 0,
  31. Dmg = 1, // 普通伤害
  32. Heal = 2, // 治疗强化
  33. HuDun = 3, // 护盾强化
  34. Shield = 4, // 破定强化
  35. //LaunchSpell = 5, // 释放法术
  36. //RemoveCard_LaunchSpell= 6, // 移除当前获得的牌球,并释放法术
  37. //Dmg_Store = 7, // 特殊----蓄势:按层数叠加伤害, 需要三四球以上,并且新加的会修改所有的截至时间
  38. //Dmg_SpecialLayer = 8, // 特殊-XX之力:有叠层和最高层
  39. Max,
  40. }
  41. //卡牌珠生成原来
  42. public enum CreateCardBallSource : byte
  43. {
  44. Normal = 0, // 默认产生(攻击)
  45. CardLogic = 1, // 卡牌内部逻辑
  46. }
  47. // 获得卡牌信息
  48. public class GetCardData
  49. {
  50. public CardType cardType;
  51. public long time;
  52. public void Set(CardType card)
  53. {
  54. this.cardType = card;
  55. this.time = CommonLang.CUtils.localTimeMS;
  56. }
  57. public void ReSet()
  58. {
  59. this.cardType = CardType.Max;
  60. this.time = 0;
  61. }
  62. }
  63. // 卡牌本次强化效果
  64. public class CardStrengthData
  65. {
  66. public CardStrengthenType type = CardStrengthenType.None; // 效果类型
  67. public IntIntData data; // 强化效果附带信息1
  68. }
  69. // 卡牌下次强化规则
  70. public class CardLayerRule
  71. {
  72. public int uniqueID;
  73. public CardLayerType layerType;
  74. public int maxLayers;
  75. public CardLayerRule(int uniqueID, CardLayerType type, int maxLayer = 0)
  76. {
  77. this.uniqueID = uniqueID;
  78. this.layerType = type;
  79. this.maxLayers = maxLayer;
  80. }
  81. public bool IsValid()
  82. {
  83. if(layerType == CardLayerType.Layers)
  84. {
  85. return uniqueID > 0 && maxLayers > 0;
  86. }
  87. else if(layerType == CardLayerType.Replace)
  88. {
  89. return uniqueID > 0;
  90. }
  91. return true;
  92. }
  93. public override string ToString()
  94. {
  95. return uniqueID + "-" + layerType + "-" + maxLayers;
  96. }
  97. }
  98. // 下一次卡牌强化
  99. public class NextCardStrengthenInfo
  100. {
  101. //标识头
  102. public CardLayerRule layerRules;
  103. public CardType pointCard; // 如果为Max:表示全体增强
  104. public byte needSames; // <=0 不限制,否则为需要相同球数
  105. public DamageType needDmgType = DamageType.None; // 否则只能伤害技能触发
  106. public CardStrengthenType type; // 效果类型
  107. public int value1; // 强化效果附带信息1
  108. public int value2; // 强化附带效果2
  109. public long validTime; // 有效时间
  110. public int validTimes = -1; // 有效次数,<0无限次
  111. public int bindBuffID; // 针对那种绑定buff 的,效果消失同步buff消失
  112. public void Replace(NextCardStrengthenInfo data)
  113. {
  114. this.pointCard = data.pointCard;
  115. this.needSames = data.needSames;
  116. this.needDmgType = data.needDmgType;
  117. this.type = data.type;
  118. this.value1 = data.value1;
  119. this.value2 = data.value2;
  120. this.validTime = data.validTime;
  121. this.validTimes = data.validTimes;
  122. this.bindBuffID = data.bindBuffID;
  123. }
  124. public void AddLayers(NextCardStrengthenInfo data)
  125. {
  126. this.value1 = data.value1;
  127. this.value2 = Math.Min(this.value2 + data.value2, data.layerRules.maxLayers);
  128. this.validTime = data.validTime;
  129. this.validTimes = data.validTimes;
  130. }
  131. }
  132. //卡牌权重变更数据
  133. public class CardRateChgData
  134. {
  135. public int uniqueID; //绑定唯一id
  136. public CardType cardType;
  137. public CardRateChgType chgType;
  138. public bool isPrecent = true;
  139. public short value;
  140. public short validTimes = -1; // 有效次数,<0无限次
  141. public long validTime; // 有效时间
  142. public void copy(CardRateChgData data)
  143. {
  144. this.cardType = data.cardType;
  145. this.chgType = data.chgType;
  146. this.isPrecent = data.isPrecent;
  147. this.value = data.value;
  148. this.validTimes = data.validTimes;
  149. this.validTime = data.validTime;
  150. }
  151. }
  152. // 当前生成卡牌信息
  153. public class GenCardData
  154. {
  155. public CardType type;
  156. public byte nums;
  157. public GenCardData(CardType type, int nums)
  158. {
  159. this.type = type;
  160. this.nums = (byte)nums;
  161. }
  162. }
  163. // 卡牌打出结果
  164. public class CardTriggerResult
  165. {
  166. public CardType type;
  167. public byte sameNums;
  168. public byte[] cardData = new byte[(int)CardType.Max];
  169. }
  170. // 卡牌技能数据
  171. public class CardSkillData
  172. {
  173. public IJSGCardSkill skill;
  174. public CardType type;
  175. public int skillId;
  176. public short skilLv;
  177. private int weight;
  178. public DamageType dmgType = DamageType.None; //技能是否有伤害
  179. public CardSkillData(int skillId, CardType type)
  180. {
  181. this.skillId = skillId;
  182. this.type = type;
  183. }
  184. public void setWeight(XmdsVirtual unit)
  185. {
  186. if(this.type < CardType.Max)
  187. {
  188. this.weight = unit.MirrorProp.cardWeight[(int)this.type];
  189. }
  190. }
  191. public int GetWeight()
  192. {
  193. return this.weight;
  194. }
  195. }
  196. //触发卡牌技能延时数据
  197. public class TriggerCardSkillDelayData
  198. {
  199. public long validTime;
  200. public IJSGCardSkill skill;
  201. public XmdsVirtual launcher;
  202. public XmdsVirtual target;
  203. public CardSkillData skillData;
  204. public AttackSource source;
  205. public byte sames;
  206. public void init(IJSGCardSkill skill, XmdsVirtual launcher, XmdsVirtual target, AttackSource source, CardSkillData skillData, byte sames)
  207. {
  208. this.validTime = CommonLang.CUtils.localTimeMS + JSGCardModuleBase.S_TRIGGER_DLAY;
  209. this.skill = skill;
  210. this.launcher = launcher;
  211. this.target = target;
  212. this.source = source;
  213. this.skillData = skillData;
  214. this.sames = sames;
  215. }
  216. public void CheckTriggerSkill()
  217. {
  218. if(validTime <= 0 || validTime > CommonLang.CUtils.localTimeMS)
  219. {
  220. return;
  221. }
  222. this.validTime = 0;
  223. if(this.launcher != null && this.launcher.mUnit.IsActive)
  224. {
  225. this.skill.TriggerCardSkill(this.launcher, this.target, this.source, this.skillData, this.sames);
  226. // 分发触发事件
  227. this.launcher.DispatchTriggerCardSkillEvent(this.launcher, this.target, this.skillData.type, this.sames);
  228. }
  229. }
  230. }
  231. }