XmdsVirtual.Event.cs 58 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889
  1. using CommonAI.Zone;
  2. using CommonAI.Zone.Instance;
  3. using CommonAI.Zone.Formula;
  4. using CommonLang;
  5. using System;
  6. using System.Collections;
  7. using System.Collections.Generic;
  8. using System.Linq;
  9. using System.Text;
  10. using XmdsCommon.Plugin;
  11. using XmdsCommonServer.Plugin.XmdsSkillTemplate.Skills;
  12. using CommonAI.Data;
  13. using XmdsCommonSkill.Plugin.CardSkill;
  14. using XmdsCommon.JSGModule.Interface;
  15. using CommonAI.ZoneServer.JSGModule;
  16. using XmdsCommonServer.Plugin.JSGXmdsModule;
  17. namespace XmdsCommonServer.Plugin
  18. {
  19. /// <summary>
  20. /// FileName: XmdsVirtual.cs
  21. /// Author: Alex.Yu
  22. /// Corporation:...
  23. /// Description:注册事件相关.
  24. /// DateTime: 2015/6/2 17:38:21
  25. /// </summary>
  26. partial class XmdsVirtual
  27. {
  28. //OnHitOther//
  29. readonly private List<OnHitHandler> mOnHitOtherLt = new List<OnHitHandler>();
  30. //OnHitDamage//
  31. readonly private List<OnHitHandler> mOnHitDamageLt = new List<OnHitHandler>();
  32. //OnBuffStart//
  33. readonly private List<OnBuffEventHandler> mOnBuffEventLt = new List<OnBuffEventHandler>();
  34. //OnCalDamage//
  35. readonly private List<OnCalDmageHandler> mOnCalDamageLt = new List<OnCalDmageHandler>();
  36. //OnLaunchSkillOver//
  37. readonly private List<OnLaunchSkillOverHandler> mOnLaunchSkillOverLt = new List<OnLaunchSkillOverHandler>();
  38. //OnGetAtkTarget//
  39. readonly private List<OnGetAtkTargetHandler> mOnGetAtkTargetLt = new List<OnGetAtkTargetHandler>();
  40. //OnGetSkillDamageInfo //
  41. readonly private List<OnGetSkillDamageInfo> mOnGetSkillDamageInfoLt = new List<OnGetSkillDamageInfo>();
  42. //IStateSkillEnd //
  43. readonly private List<OnStateSkillEnd> mOnStateSkillEndLt = new List<OnStateSkillEnd>();
  44. //ITryAddBuffEvent//
  45. readonly private List<OnTryAddBuff> mOnTryAddBuffLt = new List<OnTryAddBuff>();
  46. readonly private List<OnRemoveBuff> mOnRemoveBuffLt = new List<OnRemoveBuff>();
  47. //ISendBuffEvent
  48. //readonly private List<OnSendBuffEvent> mOnSendBuffEvent = new List<OnSendBuffEvent>();
  49. readonly private List<OnTrySendSpell> mOnTrySendSpellLt = new List<OnTrySendSpell>();
  50. readonly private List<OnSendSpellOverEvent> mSendSpellOverLt = new List<OnSendSpellOverEvent>();
  51. readonly private List<OnTryLaucnSkill> mOnTryLaunchSkillLt = new List<OnTryLaucnSkill>();
  52. //宠物给予人物的主动技能触发
  53. readonly private List<OnTriggerPetSkill> mOnTriggerPetSkillLt = new List<OnTriggerPetSkill>();
  54. //计算仇恨值.
  55. readonly private List<OnCalThreatValue> mOnCalThreatValueLt = new List<OnCalThreatValue>();
  56. //技能被打断事件监听
  57. readonly private List<OnSkillBlockEvnet> mOnSkillBlockList = new List<OnSkillBlockEvnet>();
  58. //加血事件
  59. readonly private List<OnAddOtherHPEvnet> mAddOtherHPList = new List<OnAddOtherHPEvnet>();
  60. //承担伤害监听
  61. readonly private List<OnShareMasterDmgEvent> mShareMasterDmgList = new List<OnShareMasterDmgEvent>();
  62. //扣定力
  63. readonly private List<OnReduceOtherMpEvnet> mReduceMPList = new List<OnReduceOtherMpEvnet>();
  64. //获得卡牌珠监听
  65. readonly private List<OnTryAddCardBallEvent> mTryAddCardBallList = new List<OnTryAddCardBallEvent>();
  66. //释放卡牌技能监听
  67. readonly private List<OnTriggerCardSkillEvent> mTriggerCardSkillList = new List<OnTriggerCardSkillEvent>();
  68. //击杀其他单位监听
  69. readonly private List<OnKillOtherUnitEvent> mKillOtherList = new List<OnKillOtherUnitEvent>();
  70. private HashMap<int, IHandle> mHandleMap = new HashMap<int, IHandle>();
  71. private int mHandleUUID = 0;
  72. public enum BuffEventType
  73. {
  74. None,
  75. Begin,
  76. End,
  77. Update,
  78. Hit,
  79. }
  80. public abstract class IHandle
  81. {
  82. public readonly GameSkill m_skill;
  83. public readonly bool mListenAll = false;
  84. public IHandle(GameSkill skill, bool listenAll)
  85. {
  86. this.m_skill = skill;
  87. this.mListenAll = listenAll;
  88. }
  89. }
  90. public class OnHitHandler : IHandle
  91. {
  92. public readonly IOnHit m_hit;
  93. public readonly bool ListenAllSkill = false;
  94. public int startDmgData; //开始计算伤害时的值
  95. public OnHitHandler(IOnHit hit, GameSkill skill, bool listenAll) : base(skill, listenAll)
  96. {
  97. m_hit = hit;
  98. this.ListenAllSkill = listenAll;
  99. }
  100. }
  101. class OnBuffEventHandler : IHandle
  102. {
  103. public readonly IOnBuffEvent m_tg;
  104. public readonly BuffEventType m_type;
  105. public OnBuffEventHandler(IOnBuffEvent tg, BuffEventType type, GameSkill skill) : base(skill, true)
  106. {
  107. m_tg = tg;
  108. m_type = type;
  109. }
  110. }
  111. public class OnCalDmageHandler : IHandle
  112. {
  113. public readonly ICalDamage m_cal;
  114. public readonly int skillDamageID;
  115. public OnCalDmageHandler(ICalDamage tg, GameSkill skill, bool listenAll, int skillDamageID) : base(skill, listenAll)
  116. {
  117. m_cal = tg;
  118. this.skillDamageID = skillDamageID;
  119. }
  120. public override string ToString()
  121. {
  122. return skillDamageID.ToString();
  123. }
  124. }
  125. class OnLaunchSkillOverHandler : IHandle
  126. {
  127. public readonly ILaunchSkillOver m_hand;
  128. public OnLaunchSkillOverHandler(ILaunchSkillOver tg, GameSkill skill, bool listenAll) : base(skill, listenAll)
  129. {
  130. m_hand = tg;
  131. }
  132. }
  133. class OnGetAtkTargetHandler : IHandle
  134. {
  135. public readonly IGetAtkTarget m_hand;
  136. public OnGetAtkTargetHandler(IGetAtkTarget tg, GameSkill skill, bool listenAll) : base(skill, listenAll)
  137. {
  138. m_hand = tg;
  139. }
  140. }
  141. class OnGetSkillDamageInfo : IHandle
  142. {
  143. public readonly IGetSkillDamageInfo m_hand;
  144. public OnGetSkillDamageInfo(IGetSkillDamageInfo tg, GameSkill skill, bool listenAll) : base(skill, listenAll)
  145. {
  146. m_hand = tg;
  147. }
  148. }
  149. class OnStateSkillEnd : IHandle
  150. {
  151. public readonly IStateSkillEnd m_hand;
  152. public OnStateSkillEnd(IStateSkillEnd tg, GameSkill skill, bool listenAll) : base(skill, listenAll)
  153. {
  154. m_hand = tg;
  155. }
  156. }
  157. class OnTryAddBuff : IHandle
  158. {
  159. public readonly ITryAddBuffEvent m_hand;
  160. public OnTryAddBuff(ITryAddBuffEvent tg, GameSkill skill, bool listenAll) : base(skill, listenAll)
  161. {
  162. m_hand = tg;
  163. }
  164. }
  165. class OnRemoveBuff : IHandle
  166. {
  167. public readonly IRemoveBuffEvent m_hand;
  168. public readonly int buffID;
  169. public OnRemoveBuff(IRemoveBuffEvent tg, int buffID, bool listenAll) : base(null, listenAll)
  170. {
  171. m_hand = tg;
  172. this.buffID = buffID;
  173. }
  174. }
  175. //class OnSendBuffEvent : IHandle
  176. // {
  177. // public readonly int listenBuffID;
  178. // public readonly ISendBuffEvent m_hand;
  179. // public OnSendBuffEvent(ISendBuffEvent tg, GameSkill skill, int listenBuffID = 0) : base(skill, false)
  180. // {
  181. // m_hand = tg;
  182. // this.listenBuffID = listenBuffID;
  183. // }
  184. // }
  185. class OnSendSpellOverEvent : IHandle
  186. {
  187. public readonly ISendSpellOverEvent m_hand;
  188. public readonly int mListSpellId;
  189. public OnSendSpellOverEvent(ISendSpellOverEvent tg, int spellId, GameSkill sk, bool listenAll = false) : base(sk, listenAll)
  190. {
  191. m_hand = tg;
  192. this.mListSpellId = spellId;
  193. }
  194. }
  195. class OnTrySendSpell : IHandle
  196. {
  197. public readonly ITrySendSpellEvent m_hand;
  198. public readonly int mListenSpellId;
  199. public OnTrySendSpell(ITrySendSpellEvent tg, GameSkill skill, int listenSpellId, bool listenAll) : base(skill, listenAll)
  200. {
  201. m_hand = tg;
  202. this.mListenSpellId = listenSpellId;
  203. }
  204. }
  205. class OnTryLaucnSkill : IHandle
  206. {
  207. public readonly ITryLaunchSkillEvent m_hand;
  208. public OnTryLaucnSkill(ITryLaunchSkillEvent tg, GameSkill skill, bool listenAll) : base(skill, listenAll)
  209. {
  210. m_hand = tg;
  211. }
  212. }
  213. class OnTriggerPetSkill : IHandle
  214. {
  215. public readonly ITriggerPetSkillEvent m_hand;
  216. public OnTriggerPetSkill(ITriggerPetSkillEvent tg, GameSkill skill, bool listenAll) : base(skill, listenAll)
  217. {
  218. m_hand = tg;
  219. }
  220. }
  221. class OnCalThreatValue : IHandle
  222. {
  223. public readonly ICalThreadValue m_hand;
  224. public OnCalThreatValue(ICalThreadValue tg, GameSkill skill, bool listenAll) : base(skill, listenAll)
  225. {
  226. m_hand = tg;
  227. }
  228. }
  229. class OnSkillBlockEvnet : IHandle
  230. {
  231. public readonly ISkillBlockEvent m_hand;
  232. public OnSkillBlockEvnet(ISkillBlockEvent handler, GameSkill skill, bool listenAll) : base(skill, listenAll)
  233. {
  234. this.m_hand = handler;
  235. }
  236. }
  237. class OnAddOtherHPEvnet : IHandle
  238. {
  239. public readonly IAddOtherHPEvent m_hand;
  240. public OnAddOtherHPEvnet(IAddOtherHPEvent handler, GameSkill skill) : base(skill, true)
  241. {
  242. this.m_hand = handler;
  243. }
  244. }
  245. protected class OnShareMasterDmgEvent : IHandle
  246. {
  247. public readonly IShareMasterDmgEvent m_hand;
  248. public OnShareMasterDmgEvent(IShareMasterDmgEvent handler, GameSkill skill) : base(skill, true)
  249. {
  250. this.m_hand = handler;
  251. }
  252. }
  253. class OnReduceOtherMpEvnet : IHandle
  254. {
  255. public readonly IReduceOtherMpEvent m_hand;
  256. public OnReduceOtherMpEvnet(IReduceOtherMpEvent handler, GameSkill skill) : base(skill, true)
  257. {
  258. this.m_hand = handler;
  259. }
  260. }
  261. class OnTryAddCardBallEvent : IHandle
  262. {
  263. public readonly CreateCardBallSource mType;
  264. public readonly ITryAddCardBallEvent m_hand;
  265. public OnTryAddCardBallEvent(ITryAddCardBallEvent handler, CreateCardBallSource type, bool listenAll = false) : base(null, listenAll)
  266. {
  267. this.m_hand = handler;
  268. this.mType = type;
  269. }
  270. }
  271. class OnTriggerCardSkillEvent : IHandle
  272. {
  273. public readonly CardType mPointCardType;
  274. public readonly ITriggerCardSkillEvent m_hand;
  275. public OnTriggerCardSkillEvent(ITriggerCardSkillEvent handler, GameSkill info, CardType cardType, bool listenAll = false) : base(info, listenAll)
  276. {
  277. this.m_hand = handler;
  278. this.mPointCardType = cardType;
  279. }
  280. }
  281. class OnKillOtherUnitEvent : IHandle
  282. {
  283. public readonly int maType;
  284. public readonly IOnKillOtherUnitEvent m_hand;
  285. public OnKillOtherUnitEvent(IOnKillOtherUnitEvent handler, GameSkill info, int type) : base(info, false)
  286. {
  287. this.m_hand = handler;
  288. this.maType = type;
  289. }
  290. }
  291. #region 事件监听.
  292. public delegate void OnHealEvent(XmdsVirtual attacker, XmdsVirtual hitter, int value, ref AtkResult result);
  293. public delegate void OnCombatStateChangeEvent(XmdsVirtual unit, bool status);
  294. /// <summary>
  295. /// 治愈回调.
  296. /// </summary>
  297. public event OnHealEvent OnHealEventHandle;
  298. /// <summary>
  299. /// 战斗状态变更.
  300. /// </summary>
  301. public event OnCombatStateChangeEvent OnCombatStateChangeHandle
  302. {
  303. add { event_OnCombatStateChangeHandle += value; }
  304. remove { event_OnCombatStateChangeHandle -= value; }
  305. }
  306. protected OnCombatStateChangeEvent event_OnCombatStateChangeHandle;
  307. #endregion
  308. #region 计算伤害时触发.
  309. public int RegistCalDamage(ICalDamage cal, GameSkill sk, bool listenAll, int skillDamageID = 0)
  310. {
  311. OnCalDmageHandler handle = new OnCalDmageHandler(cal, sk, listenAll, skillDamageID);
  312. int ret = HandleUUIDCreate();
  313. mOnCalDamageLt.Add(handle);
  314. mHandleMap.Add(ret, handle);
  315. return ret;
  316. }
  317. public bool UnRegistCalDamage(int handleUUID)
  318. {
  319. bool ret = false;
  320. IHandle handle = null;
  321. if (mHandleMap.TryGetValue(handleUUID, out handle))
  322. {
  323. if (handle != null && handle is OnCalDmageHandler)
  324. {
  325. ret = mOnCalDamageLt.Remove(handle as OnCalDmageHandler);
  326. mHandleMap.Remove(handleUUID);
  327. }
  328. }
  329. return ret;
  330. }
  331. #endregion
  332. #region 单位打到别人时开发.
  333. /// <summary>
  334. /// 单位打到别人时触发
  335. /// </summary>
  336. /// <param name="hit"></param>
  337. /// <param name="sk"></param>
  338. public int RegistOnHitOther(IOnHit hit, GameSkill sk, bool listenAll = false)
  339. {
  340. OnHitHandler handle = new OnHitHandler(hit, sk, listenAll);
  341. int ret = HandleUUIDCreate();
  342. mOnHitOtherLt.Add(handle);
  343. mHandleMap.Add(ret, handle);
  344. return ret;
  345. }
  346. public bool UnRegistOnHitOther(int handleUUID)
  347. {
  348. bool ret = false;
  349. IHandle handle = null;
  350. if (mHandleMap.TryGetValue(handleUUID, out handle))
  351. {
  352. if (handle != null && handle is OnHitHandler)
  353. {
  354. ret = mOnHitOtherLt.Remove(handle as OnHitHandler);
  355. mHandleMap.Remove(handleUUID);
  356. }
  357. }
  358. return ret;
  359. }
  360. #endregion
  361. #region 单位受到攻击时触发.
  362. /// <summary>
  363. /// 单位收到攻击时触发
  364. /// </summary>
  365. /// <param name="hit"></param>
  366. /// <param name="sk"></param>
  367. public int RegistOnHitDamage(IOnHit hit, GameSkill sk, bool listenAll = false)
  368. {
  369. OnHitHandler handle = new OnHitHandler(hit, sk, listenAll);
  370. mOnHitDamageLt.Add(handle);
  371. int ret = HandleUUIDCreate();
  372. mHandleMap.Add(ret, handle);
  373. return ret;
  374. }
  375. public bool UnRegistOnHitDamage(int handleUUID)
  376. {
  377. bool ret = false;
  378. IHandle handle = null;
  379. if (mHandleMap.TryGetValue(handleUUID, out handle))
  380. {
  381. if (handle != null && handle is OnHitHandler)
  382. {
  383. ret = mOnHitDamageLt.Remove(handle as OnHitHandler);
  384. mHandleMap.Remove(handleUUID);
  385. }
  386. }
  387. return ret;
  388. }
  389. #endregion
  390. #region BUFF触发.
  391. /// <summary>
  392. /// 注册监听BUFF相关事件.
  393. /// </summary>
  394. /// <param name="tg"></param>
  395. /// <param name="type"></param>
  396. /// <param name="sk"></param>
  397. /// <returns></returns>
  398. public int RegistBuffEvent(IOnBuffEvent tg, BuffEventType type, GameSkill sk)
  399. {
  400. OnBuffEventHandler handle = new OnBuffEventHandler(tg, type, sk);
  401. mOnBuffEventLt.Add(handle);
  402. int ret = HandleUUIDCreate();
  403. mHandleMap.Add(ret, handle);
  404. return ret;
  405. }
  406. public bool UnRegistBuffEvent(int handleUUID)
  407. {
  408. bool ret = false;
  409. IHandle handle = null;
  410. if (mHandleMap.TryGetValue(handleUUID, out handle))
  411. {
  412. if (handle != null && handle is OnBuffEventHandler)
  413. {
  414. ret = mOnBuffEventLt.Remove(handle as OnBuffEventHandler);
  415. mHandleMap.Remove(handleUUID);
  416. }
  417. }
  418. return ret;
  419. }
  420. #endregion
  421. #region 增加BUFF.
  422. /// <summary>
  423. /// 注册是否能添加BUFF判断事件.
  424. /// </summary>
  425. /// <returns></returns>
  426. public int RegistTryAddBuffEvent(ITryAddBuffEvent tg, GameSkill sk, bool listenAll = false)
  427. {
  428. OnTryAddBuff handle = new OnTryAddBuff(tg, sk, listenAll);
  429. mOnTryAddBuffLt.Add(handle);
  430. int ret = HandleUUIDCreate();
  431. mHandleMap.Add(ret, handle);
  432. return ret;
  433. }
  434. /** 注册给其他玩家添加buff时间 */
  435. //public int RegistSendBuffEvent(ISendBuffEvent tg, GameSkill sk, int listenBuffID = 0)
  436. //{
  437. // OnSendBuffEvent handle = new OnSendBuffEvent(tg, sk, listenBuffID);
  438. // mOnSendBuffEvent.Add(handle);
  439. // int ret = HandleUUIDCreate();
  440. // mHandleMap.Add(ret, handle);
  441. // return ret;
  442. //}
  443. /** 注册给其他玩家添加buff时间 */
  444. public int RegistRemoveBuffEvent(IRemoveBuffEvent tg, int buffID, bool listenAll = false)
  445. {
  446. OnRemoveBuff handle = new OnRemoveBuff(tg, buffID, listenAll);
  447. mOnRemoveBuffLt.Add(handle);
  448. int ret = HandleUUIDCreate();
  449. mHandleMap.Add(ret, handle);
  450. return ret;
  451. }
  452. /// <summary>
  453. /// 取消注册添加BUFF判断.
  454. /// </summary>
  455. /// <returns></returns>
  456. public bool UnRegistTryAddBuffEvent(int handleUUID)
  457. {
  458. bool ret = false;
  459. IHandle handle = null;
  460. if (mHandleMap.TryGetValue(handleUUID, out handle))
  461. {
  462. if (handle != null && handle is OnTryAddBuff)
  463. {
  464. ret = mOnTryAddBuffLt.Remove(handle as OnTryAddBuff);
  465. mHandleMap.Remove(handleUUID);
  466. }
  467. }
  468. return ret;
  469. }
  470. /// <summary>
  471. /// 取消发送BUFF监听.
  472. /// </summary>
  473. /// <returns></returns>
  474. //public bool UnRegistSendBuffEvent(int handleUUID)
  475. //{
  476. // bool ret = false;
  477. // IHandle handle = null;
  478. // if (mHandleMap.TryGetValue(handleUUID, out handle))
  479. // {
  480. // if (handle != null && handle is OnSendBuffEvent)
  481. // {
  482. // ret = mOnSendBuffEvent.Remove(handle as OnSendBuffEvent);
  483. // mHandleMap.Remove(handleUUID);
  484. // }
  485. // }
  486. // return ret;
  487. //}
  488. /// <summary>
  489. /// 取消注册添加BUFF判断.
  490. /// </summary>
  491. /// <returns></returns>
  492. public bool UnRegistRemoveBuffEvent(int handleUUID)
  493. {
  494. bool ret = false;
  495. IHandle handle = null;
  496. if (mHandleMap.TryGetValue(handleUUID, out handle))
  497. {
  498. if (handle != null && handle is OnRemoveBuff)
  499. {
  500. ret = mOnRemoveBuffLt.Remove(handle as OnRemoveBuff);
  501. mHandleMap.Remove(handleUUID);
  502. }
  503. }
  504. return ret;
  505. }
  506. #endregion
  507. #region 注册监听spell重定向.
  508. public int RegistTrySendSpellEvent(ITrySendSpellEvent tg, GameSkill sk, int listenSpellId = 0, bool listenAll = false)
  509. {
  510. OnTrySendSpell handle = new OnTrySendSpell(tg, sk, listenSpellId, listenAll);
  511. mOnTrySendSpellLt.Add(handle);
  512. int ret = HandleUUIDCreate();
  513. mHandleMap.Add(ret, handle);
  514. return ret;
  515. }
  516. public bool UnRegistTrySendSpellEvent(int handleUUID)
  517. {
  518. bool ret = false;
  519. IHandle handle = null;
  520. if (mHandleMap.TryGetValue(handleUUID, out handle))
  521. {
  522. if (handle != null && handle is OnTrySendSpell)
  523. {
  524. ret = mOnTrySendSpellLt.Remove(handle as OnTrySendSpell);
  525. mHandleMap.Remove(handleUUID);
  526. }
  527. }
  528. return ret;
  529. }
  530. public int RegistSendSpellOverEvent(ISendSpellOverEvent tg, int spellId, GameSkill sk, bool listAll = false)
  531. {
  532. OnSendSpellOverEvent handle = new OnSendSpellOverEvent(tg, spellId, sk, listAll);
  533. mSendSpellOverLt.Add(handle);
  534. int ret = HandleUUIDCreate();
  535. mHandleMap.Add(ret, handle);
  536. return ret;
  537. }
  538. public bool UnRegistSendSpellOverEvent(int handleUUID)
  539. {
  540. bool ret = false;
  541. IHandle handle = null;
  542. if (mHandleMap.TryGetValue(handleUUID, out handle))
  543. {
  544. if (handle != null && handle is OnSendSpellOverEvent)
  545. {
  546. ret = mSendSpellOverLt.Remove(handle as OnSendSpellOverEvent);
  547. mHandleMap.Remove(handleUUID);
  548. }
  549. }
  550. return ret;
  551. }
  552. #endregion
  553. #region 监听技能施放.
  554. public int RegistTryLaunchSkillEvent(ITryLaunchSkillEvent tg, GameSkill sk, bool listenAllSkill = false)
  555. {
  556. OnTryLaucnSkill handle = new OnTryLaucnSkill(tg, sk, listenAllSkill);
  557. mOnTryLaunchSkillLt.Add(handle);
  558. int ret = HandleUUIDCreate();
  559. mHandleMap.Add(ret, handle);
  560. return ret;
  561. }
  562. public bool UnRegistTryLaunchSkillEvent(int handleUUID)
  563. {
  564. bool ret = false;
  565. IHandle handle = null;
  566. if (mHandleMap.TryGetValue(handleUUID, out handle))
  567. {
  568. if (handle != null && handle is OnTryLaucnSkill)
  569. {
  570. ret = mOnTryLaunchSkillLt.Remove(handle as OnTryLaucnSkill);
  571. mHandleMap.Remove(handleUUID);
  572. }
  573. }
  574. return ret;
  575. }
  576. //ITriggerPetSkillEvent返回true,结束下层传递
  577. public int RegistTriggerPetSkillEvent(ITriggerPetSkillEvent tg, GameSkill sk, bool listenAllSkill = false)
  578. {
  579. OnTriggerPetSkill handle = new OnTriggerPetSkill(tg, sk, listenAllSkill);
  580. mOnTriggerPetSkillLt.Add(handle);
  581. int ret = HandleUUIDCreate();
  582. mHandleMap.Add(ret, handle);
  583. return ret;
  584. }
  585. public bool UnRegistTriggerPetSkillEvent(int handleUUID)
  586. {
  587. bool ret = false;
  588. IHandle handle = null;
  589. if (mHandleMap.TryGetValue(handleUUID, out handle))
  590. {
  591. if (handle != null && handle is OnTriggerPetSkill)
  592. {
  593. ret = mOnTriggerPetSkillLt.Remove(handle as OnTriggerPetSkill);
  594. mHandleMap.Remove(handleUUID);
  595. }
  596. }
  597. return ret;
  598. }
  599. #endregion
  600. #region 释放完技能后.
  601. /// <summary>
  602. /// 注册技能释放完毕的监听.
  603. /// </summary>
  604. /// <param name="call"></param>
  605. /// <param name="sk"></param>
  606. /// <returns></returns>
  607. public int RegistLaunchSkillOver(ILaunchSkillOver call, GameSkill sk, bool listenAllSkill = false)
  608. {
  609. OnLaunchSkillOverHandler handle = new OnLaunchSkillOverHandler(call, sk, listenAllSkill);
  610. int ret = HandleUUIDCreate();
  611. mOnLaunchSkillOverLt.Add(handle);
  612. mHandleMap.Add(ret, handle);
  613. return ret;
  614. }
  615. /// <summary>
  616. /// 反注册技能释放完毕的监听.
  617. /// </summary>
  618. /// <param name="call"></param>
  619. /// <param name="sk"></param>
  620. /// <returns></returns>
  621. public bool UnRegistLaunchSkillOver(int handleUUID)
  622. {
  623. bool ret = false;
  624. IHandle handle = null;
  625. if (mHandleMap.TryGetValue(handleUUID, out handle))
  626. {
  627. if (handle != null && handle is OnLaunchSkillOverHandler)
  628. {
  629. ret = mOnLaunchSkillOverLt.Remove(handle as OnLaunchSkillOverHandler);
  630. mHandleMap.Remove(handleUUID);
  631. }
  632. }
  633. return ret;
  634. }
  635. #endregion
  636. #region 获得攻击目标.
  637. /// <summary>
  638. /// 注册获取攻击目标监听.
  639. /// </summary>
  640. /// <param name="call"></param>
  641. /// <param name="sk"></param>
  642. /// <returns></returns>
  643. public int RegistGetAtkTarget(IGetAtkTarget call, GameSkill sk, bool listenAll)
  644. {
  645. OnGetAtkTargetHandler handle = new OnGetAtkTargetHandler(call, sk, listenAll);
  646. int ret = HandleUUIDCreate();
  647. mOnGetAtkTargetLt.Add(handle);
  648. mHandleMap.Add(ret, handle);
  649. return ret;
  650. }
  651. /// <summary>
  652. /// 反注册获取攻击目标监听.
  653. /// </summary>
  654. /// <param name="call"></param>
  655. /// <param name="sk"></param>
  656. /// <returns></returns>
  657. public bool UnRegistGetAtkTarget(int handleUUID)
  658. {
  659. bool ret = false;
  660. IHandle handle = null;
  661. if (mHandleMap.TryGetValue(handleUUID, out handle))
  662. {
  663. if (handle != null && handle is OnGetAtkTargetHandler)
  664. {
  665. ret = mOnGetAtkTargetLt.Remove(handle as OnGetAtkTargetHandler);
  666. mHandleMap.Remove(handleUUID);
  667. }
  668. }
  669. return ret;
  670. }
  671. #endregion
  672. #region 注册获得技能伤害.
  673. public int RegistGetSkillDamageInfo(IGetSkillDamageInfo call, GameSkill sk, bool listenAll)
  674. {
  675. OnGetSkillDamageInfo handle = new OnGetSkillDamageInfo(call, sk, listenAll);
  676. int ret = HandleUUIDCreate();
  677. mOnGetSkillDamageInfoLt.Add(handle);
  678. mHandleMap.Add(ret, handle);
  679. return ret;
  680. }
  681. public bool UnRegistGetSkillDamageInfo(int handleUUID)
  682. {
  683. bool ret = false;
  684. IHandle handle = null;
  685. if (mHandleMap.TryGetValue(handleUUID, out handle))
  686. {
  687. if (handle != null && handle is OnGetSkillDamageInfo)
  688. {
  689. ret = mOnGetSkillDamageInfoLt.Remove(handle as OnGetSkillDamageInfo);
  690. mHandleMap.Remove(handleUUID);
  691. }
  692. }
  693. return ret;
  694. }
  695. #endregion
  696. #region 技能结束监听.
  697. /// <summary>
  698. /// 注册技能结束监听.
  699. /// </summary>
  700. /// <param name="call"></param>
  701. /// <param name="sk"></param>
  702. /// <returns></returns>
  703. public int RegistStateSkillEndEvent(IStateSkillEnd call, GameSkill sk, bool listenAllSkill)
  704. {
  705. OnStateSkillEnd handle = new OnStateSkillEnd(call, sk, listenAllSkill);
  706. int ret = HandleUUIDCreate();
  707. mOnStateSkillEndLt.Add(handle);
  708. mHandleMap.Add(ret, handle);
  709. return ret;
  710. }
  711. /// <summary>
  712. /// 取消技能结束监听.
  713. /// </summary>
  714. /// <param name="handleUUID"></param>
  715. /// <returns></returns>
  716. public bool UnRegistStateSkillEndEvent(int handleUUID)
  717. {
  718. bool ret = false;
  719. IHandle handle = null;
  720. if (mHandleMap.TryGetValue(handleUUID, out handle))
  721. {
  722. if (handle != null && handle is OnStateSkillEnd)
  723. {
  724. ret = mOnStateSkillEndLt.Remove(handle as OnStateSkillEnd);
  725. mHandleMap.Remove(handleUUID);
  726. }
  727. }
  728. return ret;
  729. }
  730. #endregion
  731. #region 计算仇恨值监听.
  732. public int RegistCalThreatValue(ICalThreadValue call, GameSkill gs, bool listenAllSkill)
  733. {
  734. OnCalThreatValue handle = new OnCalThreatValue(call, gs, listenAllSkill);
  735. int ret = HandleUUIDCreate();
  736. mOnCalThreatValueLt.Add(handle);
  737. mHandleMap.Add(ret, handle);
  738. return ret;
  739. }
  740. public bool UnRegistCalThreatValue(int handleUUID)
  741. {
  742. bool ret = false;
  743. IHandle handle = null;
  744. if (mHandleMap.TryGetValue(handleUUID, out handle))
  745. {
  746. if (handle != null && handle is OnCalThreatValue)
  747. {
  748. ret = mOnCalThreatValueLt.Remove(handle as OnCalThreatValue);
  749. mHandleMap.Remove(handleUUID);
  750. }
  751. }
  752. return ret;
  753. }
  754. #endregion
  755. #region 技能被打断监听.
  756. public int RegistSkillBlockEvent(ISkillBlockEvent call, GameSkill gs)
  757. {
  758. OnSkillBlockEvnet handle = new OnSkillBlockEvnet(call, gs, true);
  759. int ret = HandleUUIDCreate();
  760. mOnSkillBlockList.Add(handle);
  761. mHandleMap.Add(ret, handle);
  762. return ret;
  763. }
  764. public bool UnRegistSkillBlockEvent(int handleUUID)
  765. {
  766. bool ret = false;
  767. IHandle handle = null;
  768. if (mHandleMap.TryGetValue(handleUUID, out handle))
  769. {
  770. if (handle != null && handle is OnSkillBlockEvnet)
  771. {
  772. ret = mOnSkillBlockList.Remove(handle as OnSkillBlockEvnet);
  773. mHandleMap.Remove(handleUUID);
  774. }
  775. }
  776. return ret;
  777. }
  778. public int RegistAddOtherHPEvent(IAddOtherHPEvent call, GameSkill gs)
  779. {
  780. OnAddOtherHPEvnet handle = new OnAddOtherHPEvnet(call, gs);
  781. int ret = HandleUUIDCreate();
  782. mAddOtherHPList.Add(handle);
  783. mHandleMap.Add(ret, handle);
  784. return ret;
  785. }
  786. public bool UnRegistAddOtherHPEvent(int handleUUID)
  787. {
  788. bool ret = false;
  789. IHandle handle = null;
  790. if (mHandleMap.TryGetValue(handleUUID, out handle))
  791. {
  792. if (handle != null && handle is OnAddOtherHPEvnet)
  793. {
  794. ret = mAddOtherHPList.Remove(handle as OnAddOtherHPEvnet);
  795. mHandleMap.Remove(handleUUID);
  796. }
  797. }
  798. return ret;
  799. }
  800. public int RegistShareMasterDmgEvent(IShareMasterDmgEvent call, GameSkill gs)
  801. {
  802. OnShareMasterDmgEvent handle = new OnShareMasterDmgEvent(call, gs);
  803. int ret = HandleUUIDCreate();
  804. mShareMasterDmgList.Add(handle);
  805. mHandleMap.Add(ret, handle);
  806. return ret;
  807. }
  808. public bool UnRegistShareMasterDmgEvent(int handleUUID)
  809. {
  810. bool ret = false;
  811. IHandle handle = null;
  812. if (mHandleMap.TryGetValue(handleUUID, out handle))
  813. {
  814. if (handle != null && handle is OnShareMasterDmgEvent)
  815. {
  816. ret = mShareMasterDmgList.Remove(handle as OnShareMasterDmgEvent);
  817. mHandleMap.Remove(handleUUID);
  818. }
  819. }
  820. return ret;
  821. }
  822. public int RegistReduceMPEvent(IReduceOtherMpEvent call, GameSkill gs)
  823. {
  824. OnReduceOtherMpEvnet handle = new OnReduceOtherMpEvnet(call, gs);
  825. int ret = HandleUUIDCreate();
  826. mReduceMPList.Add(handle);
  827. mHandleMap.Add(ret, handle);
  828. return ret;
  829. }
  830. public bool UnRegistReduceOtherMpEvent(int handleUUID)
  831. {
  832. bool ret = false;
  833. IHandle handle = null;
  834. if (mHandleMap.TryGetValue(handleUUID, out handle))
  835. {
  836. if (handle != null && handle is OnReduceOtherMpEvnet)
  837. {
  838. ret = mReduceMPList.Remove(handle as OnReduceOtherMpEvnet);
  839. mHandleMap.Remove(handleUUID);
  840. }
  841. }
  842. return ret;
  843. }
  844. public int RegistTryAddCardBallEvent(ITryAddCardBallEvent call, CreateCardBallSource type, bool listenAll = false)
  845. {
  846. OnTryAddCardBallEvent handle = new OnTryAddCardBallEvent(call, type, listenAll);
  847. int ret = HandleUUIDCreate();
  848. mTryAddCardBallList.Add(handle);
  849. mHandleMap.Add(ret, handle);
  850. return ret;
  851. }
  852. public bool UnRegistTryAddCardBallEvent(int handleUUID)
  853. {
  854. bool ret = false;
  855. IHandle handle = null;
  856. if (mHandleMap.TryGetValue(handleUUID, out handle))
  857. {
  858. if (handle != null && handle is OnTryAddCardBallEvent)
  859. {
  860. ret = mTryAddCardBallList.Remove(handle as OnTryAddCardBallEvent);
  861. mHandleMap.Remove(handleUUID);
  862. }
  863. }
  864. return ret;
  865. }
  866. public int RegistTriggerCardSkillEvent(ITriggerCardSkillEvent call, GameSkill info, CardType cardType, bool listenAll = false)
  867. {
  868. OnTriggerCardSkillEvent handle = new OnTriggerCardSkillEvent(call, info, cardType, listenAll);
  869. int ret = HandleUUIDCreate();
  870. mTriggerCardSkillList.Add(handle);
  871. mHandleMap.Add(ret, handle);
  872. return ret;
  873. }
  874. public bool UnRegistTriggerCardSkillEvent(int handleUUID)
  875. {
  876. bool ret = false;
  877. IHandle handle = null;
  878. if (mHandleMap.TryGetValue(handleUUID, out handle))
  879. {
  880. if (handle != null && handle is OnTriggerCardSkillEvent)
  881. {
  882. ret = mTriggerCardSkillList.Remove(handle as OnTriggerCardSkillEvent);
  883. mHandleMap.Remove(handleUUID);
  884. }
  885. }
  886. return ret;
  887. }
  888. public int RegistKillOtherEvent(IOnKillOtherUnitEvent call, GameSkill info, int monsterType)
  889. {
  890. OnKillOtherUnitEvent handle = new OnKillOtherUnitEvent(call, info, monsterType);
  891. int ret = HandleUUIDCreate();
  892. mKillOtherList.Add(handle);
  893. mHandleMap.Add(ret, handle);
  894. return ret;
  895. }
  896. public bool UnRegistKillOtherEvent(int handleUUID)
  897. {
  898. bool ret = false;
  899. IHandle handle = null;
  900. if (mHandleMap.TryGetValue(handleUUID, out handle))
  901. {
  902. if (handle != null && handle is OnKillOtherUnitEvent)
  903. {
  904. ret = mKillOtherList.Remove(handle as OnKillOtherUnitEvent);
  905. mHandleMap.Remove(handleUUID);
  906. }
  907. }
  908. return ret;
  909. }
  910. #endregion
  911. #region 事件派发.
  912. /// <summary>
  913. /// 分配handleID.
  914. /// </summary>
  915. /// <returns></returns>
  916. private int HandleUUIDCreate()
  917. {
  918. return ++mHandleUUID;
  919. }
  920. /// <summary>
  921. ///攻击者监听:打到其他单位.
  922. /// </summary>
  923. /// <param name="damage"></param>
  924. /// <param name="target"></param>
  925. /// <param name="source"></param>
  926. /// <returns></returns>
  927. private float DispatchHitOtherEvent(float damage, XmdsVirtual target, AttackSource source,
  928. ref XmdsVirtual.AtkResult result, DamageType damageType)
  929. {
  930. if (this.mUnit.IsActive)
  931. {
  932. float sourceDmg = damage;
  933. bool isEndDispatch = false;
  934. for (int i = mOnHitOtherLt.Count - 1; i >= 0; --i)
  935. {
  936. OnHitHandler hitend = mOnHitOtherLt[i];
  937. //伤害单一注册判断
  938. if (!hitend.ListenAllSkill && hitend.m_skill != null && source.Attack != null)
  939. {
  940. XmdsAttackProperties atkProp = source.Attack.Properties as XmdsAttackProperties;
  941. if (atkProp.SkillTemplateID != hitend.m_skill.SkillID)
  942. {
  943. hitend.startDmgData = 0;
  944. continue;
  945. }
  946. }
  947. damage = hitend.m_hit.Invoke(damage, target, this, source, ref result, damageType, hitend.m_skill, ref isEndDispatch);
  948. hitend.startDmgData = (int)damage;
  949. if (isEndDispatch)
  950. {
  951. break;
  952. }
  953. }
  954. //检测伤害输出异常
  955. if(JSGXmdsHackerModule.CheckAndPrintDmgWarn("HitOther-", this, target, sourceDmg, damage, source))
  956. {
  957. int startDmg = (int)sourceDmg;
  958. for (int i = mOnHitOtherLt.Count - 1; i >= 0; --i)
  959. {
  960. if(mOnHitOtherLt[i].startDmgData > 0 && startDmg != mOnHitOtherLt[i].startDmgData)
  961. {
  962. float rate = mOnHitOtherLt[i].startDmgData * 1.0f / startDmg;
  963. log.Warn("伤害细则:" + mOnHitOtherLt[i].m_hit.Target + ", " + startDmg + " -> " + mOnHitOtherLt[i].startDmgData + ", 倍率:" + rate);
  964. startDmg = mOnHitOtherLt[i].startDmgData;
  965. }
  966. }
  967. }
  968. }
  969. return damage;
  970. }
  971. /// <summary>
  972. ///受击者监听:受到伤害.
  973. /// </summary>
  974. /// <param name="damage"></param>
  975. /// <param name="attacker"></param>
  976. /// <param name="source"></param>
  977. /// skill - 造成伤害的技能信息,可能为空
  978. /// <returns></returns>
  979. private float DispatchHitDamageEvent(float damage, XmdsVirtual attacker, AttackSource source,
  980. ref XmdsVirtual.AtkResult result, DamageType damageType)
  981. {
  982. if (this.mUnit.IsActive && mOnHitDamageLt.Count > 0)
  983. {
  984. float sourceDmg = damage;
  985. bool isEndDispatch = false;
  986. for (int i = mOnHitDamageLt.Count - 1; i >= 0; --i)
  987. {
  988. if(i < 0 || i >= mOnHitDamageLt.Count)
  989. {
  990. int buffID = source.FromBuff == null ? 0 : source.FromBuff.ID;
  991. int spellID = source.FromSpell == null ? 0 : source.FromSpell.ID;
  992. log.Warn("DispatchHitDamageEvent监听改变: " + i + ", " + mOnHitDamageLt.Count + ", BuffID: " + buffID + ", spellID: " + spellID + ", "
  993. + this.mUnit.PlayerUUID);
  994. break;
  995. }
  996. OnHitHandler hitend = mOnHitDamageLt[i];
  997. if(!hitend.ListenAllSkill && hitend.m_skill != null && source.Attack != null)
  998. {
  999. XmdsAttackProperties atkProp = source.Attack.Properties as XmdsAttackProperties;
  1000. if (atkProp.SkillTemplateID != hitend.m_skill.SkillID)
  1001. {
  1002. continue;
  1003. }
  1004. }
  1005. damage = hitend.m_hit.Invoke(damage, this, attacker, source, ref result, damageType, hitend.m_skill, ref isEndDispatch);
  1006. JSGXmdsHackerModule.CheckAndPrintDmgWarn("HitDamage", attacker, this, sourceDmg, damage, source);
  1007. if (isEndDispatch)
  1008. {
  1009. break;
  1010. }
  1011. }
  1012. }
  1013. return CUtils.CastInt(damage);//四舍五入
  1014. }
  1015. /// <summary>
  1016. /// 派发技能成功释放事件.
  1017. /// </summary>
  1018. /// <param name="costEnergy"></param>
  1019. /// <param name="attacker"></param>
  1020. /// <param name="state"></param>
  1021. /// <returns></returns>
  1022. private int DispatchLaunchsSkillOverEvent(XmdsVirtual launcher, CommonAI.Zone.Instance.InstanceUnit.SkillState state)
  1023. {
  1024. if (launcher.mUnit.IsActive)
  1025. {
  1026. for (int i = 0; i < mOnLaunchSkillOverLt.Count; i++)
  1027. {
  1028. OnLaunchSkillOverHandler hitend = mOnLaunchSkillOverLt[i];
  1029. if (hitend.mListenAll || hitend.m_skill == null)
  1030. {
  1031. hitend.m_hand.Invoke(hitend.m_skill, launcher, state);
  1032. }
  1033. else if (hitend.m_skill.SkillID == state.ID)
  1034. {
  1035. hitend.m_hand.Invoke(hitend.m_skill, launcher, state);
  1036. }
  1037. }
  1038. }
  1039. return 0;
  1040. }
  1041. /// <summary>
  1042. /// 派发技能造成伤害事件.
  1043. /// </summary>
  1044. /// <param name="hitter"></param>
  1045. /// <param name="source"></param>
  1046. /// <param name="result"></param>
  1047. /// <returns></returns>
  1048. private int DispatchCalDamageEvent(XmdsVirtual hitter, AttackSource source, ref AtkResult result)
  1049. {
  1050. //特殊情况单位是技能触发伤害,则单位必须活着,如果是spell或BUFF无视单位自身状态.
  1051. XmdsAttackProperties prop = (source.Attack.Properties as XmdsAttackProperties);
  1052. if (this.mUnit.IsActive == false && prop.SkillTemplateID != XmdsCommonServer.Plugin.XmdsSkillTemplate.Skills.XmdsBattleSkill.DefaultSkillScriptID)
  1053. {
  1054. //单位已死亡,技能造成的伤害不算.
  1055. return 0;
  1056. }
  1057. int damage = 0;
  1058. if(prop.SkillTemplateID == XmdsCommonServer.Plugin.XmdsSkillTemplate.Skills.XmdsBattleSkill.DefaultSkillScriptID)
  1059. {
  1060. XmdsBattleSkill.mDefDamgageHandler.m_cal.Invoke(this, hitter, source, XmdsBattleSkill.mDefDamgageHandler.m_skill, ref result, ref damage);
  1061. //FormatLog(CommonLang.Log.LoggerLevel.INFO, "--【{0}】对目标【{1}】使用技能【{2}】效果 = 【{3}】", this.mInfo.Name, hitter.mInfo.Name, prop.SkillTemplateID, damage);
  1062. }
  1063. else if (prop.SkillTemplateID > 0)
  1064. {
  1065. bool isFind = false;
  1066. for (int i = mOnCalDamageLt.Count - 1; i >= 0; --i)
  1067. {
  1068. OnCalDmageHandler hand = mOnCalDamageLt[i];
  1069. //技能ID匹配时才执行回调.
  1070. if (hand.skillDamageID == prop.SkillTemplateID || hand.m_skill.SkillID == prop.SkillTemplateID)
  1071. {
  1072. isFind = true;
  1073. bool isEnd = hand.m_cal.Invoke(this, hitter, source, hand.m_skill, ref result, ref damage);
  1074. //FormatLog(CommonLang.Log.LoggerLevel.INFO, "【{0}】对目标【{1}】使用技能【{2}】效果 = 【{3}】", this.mInfo.Name, hitter.mInfo.Name, prop.SkillTemplateID, damage);
  1075. if (isEnd) { break; }
  1076. }
  1077. }
  1078. if(!isFind)
  1079. {
  1080. log.Error("配置监听事件异常--场景:" + this.mUnit.Parent.GetSceneID() + ", 唯一ID" + this.mUnit.PlayerUUID + ", 伤害ID:" + prop.SkillTemplateID
  1081. + ", 异常信息:" + JSGModule.GetAttackSourceDes(source) + ", 单位ID:" + this.mUnit.Info.ID + ", 技能监听:"
  1082. + mOnCalDamageLt.Count + ", 血量:" + this.mUnit.CurrentHP + ", 状态:" + this.mUnit.IsActive + ", " + this.GetDamageListens());
  1083. }
  1084. }
  1085. else if(prop.SkillTemplateID == 0)
  1086. {
  1087. log.Error("配置监听事件为0, 场景:" + this.mUnit.Parent.GetSceneID() + ", 唯一ID" + this.mUnit.PlayerUUID + ", 伤害ID: " + prop.SkillTemplateID
  1088. + ", " + JSGModule.GetAttackSourceDes(source));
  1089. }
  1090. return damage;
  1091. }
  1092. private string GetDamageListens()
  1093. {
  1094. string dmgList = "";
  1095. for (int i = mOnCalDamageLt.Count - 1; i >= 0; --i)
  1096. {
  1097. dmgList = dmgList + mOnCalDamageLt[i].skillDamageID + "#";
  1098. }
  1099. return dmgList;
  1100. }
  1101. /// <summary>
  1102. /// 分发BUFF相关事件.
  1103. /// </summary>
  1104. /// <param name="buff"></param>
  1105. /// <param name="type"></param>
  1106. /// <param name="result"></param>
  1107. /// <returns></returns>
  1108. private bool DispatchBuffEvent(InstanceUnit.BuffState buff, BuffEventType type, string result)
  1109. {
  1110. for (int i = mOnBuffEventLt.Count - 1; i >= 0; --i)
  1111. {
  1112. OnBuffEventHandler tg = mOnBuffEventLt[i];
  1113. if (tg.m_type == type)
  1114. {
  1115. tg.m_tg.Invoke(this, buff, result, tg.m_skill);
  1116. }
  1117. }
  1118. return true;
  1119. }
  1120. /// <summary>
  1121. /// 派发获得攻击单位事件.
  1122. /// </summary>
  1123. /// <param name="unit"></param>
  1124. /// <returns></returns>
  1125. private XmdsVirtual DispatchGetAtkUnitEvent(XmdsVirtual unit)
  1126. {
  1127. XmdsVirtual ret = unit;
  1128. if (this.mUnit.IsActive)
  1129. {
  1130. for (int i = mOnGetAtkTargetLt.Count - 1; i >= 0; --i)
  1131. {
  1132. OnGetAtkTargetHandler hitend = mOnGetAtkTargetLt[i];
  1133. ret = hitend.m_hand.Invoke(unit, hitend.m_skill);
  1134. }
  1135. }
  1136. return ret;
  1137. }
  1138. /// <summary>
  1139. /// 玩家离开怪物范围,mOnGetAtkTargetLt清掉
  1140. /// </summary>
  1141. /// <param name="unit"></param>
  1142. /// <returns></returns>
  1143. public void forceRemoveAtkTarget()
  1144. {
  1145. mOnGetAtkTargetLt.Clear();
  1146. }
  1147. /// <summary>
  1148. /// 派发技能伤害参数事件.
  1149. /// </summary>
  1150. /// <param name="skillDamagePer"></param>
  1151. /// <param name="skillDamageMod"></param>
  1152. /// <param name="attacker"></param>
  1153. /// <param name="hitter"></param>
  1154. /// <param name="source"></param>
  1155. public void DispatchSkillDamageEvent(XmdsVirtual attacker,XmdsVirtual hitter, AttackSource source)
  1156. {
  1157. for (int i = mOnGetSkillDamageInfoLt.Count - 1; i >= 0; --i)
  1158. {
  1159. OnGetSkillDamageInfo hitend = mOnGetSkillDamageInfoLt[i];
  1160. hitend.m_hand.Invoke(attacker, hitter, ref source, hitend.m_skill);
  1161. }
  1162. }
  1163. /// <summary>
  1164. /// 派发技能结束事件.
  1165. /// </summary>
  1166. /// <param name="owner"></param>
  1167. /// <param name="state"></param>
  1168. private void DispatchStateSkillEndEvent(XmdsVirtual owner, InstanceUnit.StateSkill state)
  1169. {
  1170. for (int i = 0; i < mOnStateSkillEndLt.Count; i++)
  1171. {
  1172. OnStateSkillEnd hitend = mOnStateSkillEndLt[i];
  1173. if (hitend.mListenAll || hitend.m_skill == null)
  1174. {
  1175. hitend.m_hand.Invoke(owner, state, hitend.m_skill);
  1176. }
  1177. else if (hitend.m_skill.SkillID == state.SkillData.ID)
  1178. {
  1179. hitend.m_hand.Invoke(owner, state, hitend.m_skill);
  1180. }
  1181. }
  1182. }
  1183. /// <summary>
  1184. /// 分发技能施放事件.
  1185. /// </summary>
  1186. /// <param name="st"></param>
  1187. private void DispatchTryLaunchSkillEvent(ref InstanceUnit.SkillState skill, ref bool result, ref InstanceUnit.LaunchSkillParam param)
  1188. {
  1189. bool ret = true;
  1190. for (int i = 0; i < mOnTryLaunchSkillLt.Count; i++)
  1191. {
  1192. OnTryLaucnSkill hitend = mOnTryLaunchSkillLt[i];
  1193. if (hitend.mListenAll || hitend.m_skill == null || hitend.m_skill.SkillID == skill.ID) //是否监听所有技能.
  1194. {
  1195. ret = hitend.m_hand.Invoke(hitend.m_skill, ref skill, this, ref param);
  1196. if (ret == false)
  1197. {
  1198. break;
  1199. }
  1200. }
  1201. }
  1202. result = ret;
  1203. }
  1204. /// <summary>
  1205. /// 分发宠物给人的技能施放事件.
  1206. /// </summary>
  1207. /// <param name="st"></param>
  1208. public bool DispatchTriggerPetSkillEvent(ref InstanceUnit.SkillState skill, ref InstanceUnit.LaunchSkillParam param)
  1209. {
  1210. for (int i = 0; i < mOnTriggerPetSkillLt.Count; i++)
  1211. {
  1212. OnTriggerPetSkill hitend = mOnTriggerPetSkillLt[i];
  1213. if (hitend.mListenAll || hitend.m_skill == null|| hitend.m_skill.SkillID == skill.ID) //是否监听所有技能.
  1214. {
  1215. if (hitend.m_hand.Invoke(hitend.m_skill, ref skill, this, ref param))
  1216. {
  1217. return true;
  1218. }
  1219. }
  1220. }
  1221. return false;
  1222. }
  1223. /// <summary>
  1224. /// 派发是否能添加BUFF事件.k
  1225. /// </summary>
  1226. /// <param name="template"></param>
  1227. /// <param name="hitter"></param>
  1228. /// <param name="result"></param>
  1229. private void DispatchTryAddBuffEvent(ref BuffTemplate template, XmdsVirtual hitter, ref bool result)
  1230. {
  1231. bool ret = true;
  1232. for (int i = mOnTryAddBuffLt.Count - 1; i >= 0; --i)
  1233. {
  1234. OnTryAddBuff hitend = mOnTryAddBuffLt[i];
  1235. ret = hitend.m_hand.Invoke(ref template, this, hitter, hitend.m_skill);
  1236. if (ret == false)
  1237. {
  1238. break;
  1239. }
  1240. }
  1241. result = ret;
  1242. }
  1243. /// <summary>
  1244. /// 派发移除buff
  1245. /// </summary>
  1246. /// <param name="template"></param>
  1247. /// <param name="hitter"></param>
  1248. /// <param name="result"></param>
  1249. private void DispatchRemoveBuffEvent(BuffTemplate template, XmdsVirtual player, BuffRemoveType type)
  1250. {
  1251. for (int i = mOnRemoveBuffLt.Count - 1; i >= 0; --i)
  1252. {
  1253. OnRemoveBuff hitend = mOnRemoveBuffLt[i];
  1254. if(hitend.mListenAll || hitend.buffID == template.ID)
  1255. {
  1256. if (hitend.m_hand.Invoke(ref template, this, type))
  1257. {
  1258. return;
  1259. }
  1260. }
  1261. }
  1262. }
  1263. /// <summary>
  1264. /// 派发添加BUFF事件.k
  1265. /// </summary>
  1266. /// <param name="template"></param>
  1267. /// <param name="hitter"></param>
  1268. /// <param name="result"></param>
  1269. //private void DispatchSendBuffEvent(BuffTemplate template, XmdsVirtual hitter)
  1270. // {
  1271. // for (int i = mOnSendBuffEvent.Count - 1; i >= 0; --i)
  1272. // {
  1273. // OnSendBuffEvent hitend = mOnSendBuffEvent[i];
  1274. // if(hitend.listenBuffID == 0 || hitend.listenBuffID == template.ID)
  1275. // {
  1276. // hitend.m_hand.Invoke(template, this, hitter);
  1277. // }
  1278. // }
  1279. // }
  1280. /** 分发技能被打断事件(暂时只有移动) */
  1281. public void DispatchSkillBlockEvent(InstanceUnit.StateSkill skill, InstanceUnit.State newState)
  1282. {
  1283. for (int i = mOnSkillBlockList.Count - 1; i >= 0; --i)
  1284. {
  1285. OnSkillBlockEvnet hitend = mOnSkillBlockList[i];
  1286. if (hitend.m_skill == null || skill.SkillData.TemplateID == hitend.m_skill.SkillID)
  1287. {
  1288. if(hitend.m_hand.Invoke(this, skill, newState))
  1289. {
  1290. break;
  1291. }
  1292. }
  1293. }
  1294. }
  1295. /** 分发加血事件 */
  1296. public int DispatchAddOtherHPEvent(int hp, InstanceUnit hitter, AttackSource source)
  1297. {
  1298. int finalHP = hp;
  1299. for (int i = mAddOtherHPList.Count - 1; i >= 0; --i)
  1300. {
  1301. OnAddOtherHPEvnet hitend = mAddOtherHPList[i];
  1302. if(hp > 0)
  1303. {
  1304. //扣血
  1305. if (hitend.m_hand.Invoke(hp, hitter, this.mUnit, source, out finalHP))
  1306. {
  1307. break;
  1308. }
  1309. }
  1310. else
  1311. {
  1312. //加血
  1313. if (hitend.m_hand.Invoke(hp, this.mUnit, hitter, source, out finalHP))
  1314. {
  1315. break;
  1316. }
  1317. }
  1318. }
  1319. return finalHP;
  1320. }
  1321. /** 分发宠物承担主人伤害事件 */
  1322. public int DispatchShareMasterDmgEvent(int shareDmg, InstanceUnit sender)
  1323. {
  1324. bool isEndDispatch = false;
  1325. for (int i = mShareMasterDmgList.Count - 1; i >= 0; --i)
  1326. {
  1327. OnShareMasterDmgEvent hitend = mShareMasterDmgList[i];
  1328. shareDmg = hitend.m_hand.Invoke(shareDmg, sender, this.mUnit, hitend.m_skill, ref isEndDispatch);
  1329. if (isEndDispatch)
  1330. {
  1331. break;
  1332. }
  1333. }
  1334. return shareDmg;
  1335. }
  1336. /** 分发扣定力事件 */
  1337. public void DispatchAddMPEvent(int mp, InstanceUnit hitter, out int finalMP, AttackSource source)
  1338. {
  1339. finalMP = mp;
  1340. for (int i = mReduceMPList.Count - 1; i >= 0; --i)
  1341. {
  1342. OnReduceOtherMpEvnet hitend = mReduceMPList[i];
  1343. if (hitend.m_hand.Invoke(mp, this.mUnit, hitter, out finalMP, source))
  1344. {
  1345. break;
  1346. }
  1347. }
  1348. }
  1349. /** 分发获得卡牌珠事件 */
  1350. public bool DispatchTryGetCardBallEvent(XmdsVirtual player, CreateCardBallSource type, CardType cardType)
  1351. {
  1352. for (int i = mTryAddCardBallList.Count - 1; i >= 0; --i)
  1353. {
  1354. OnTryAddCardBallEvent hitend = mTryAddCardBallList[i];
  1355. if (hitend.mListenAll || hitend.mType == type)
  1356. {
  1357. if(!hitend.m_hand.Invoke(this, type, cardType))
  1358. {
  1359. return false;
  1360. }
  1361. }
  1362. }
  1363. return true;
  1364. }
  1365. /** 分发释放卡牌技能事件 */
  1366. public bool DispatchTriggerCardSkillEvent(XmdsVirtual player, XmdsVirtual hitter, CardType cardType, int sameNums)
  1367. {
  1368. for (int i = mTriggerCardSkillList.Count - 1; i >= 0; --i)
  1369. {
  1370. OnTriggerCardSkillEvent hitend = mTriggerCardSkillList[i];
  1371. if (hitend.mListenAll || hitend.mPointCardType == cardType)
  1372. {
  1373. if (!hitend.m_hand.Invoke(this, hitter, hitend.m_skill, cardType, sameNums))
  1374. {
  1375. return false;
  1376. }
  1377. }
  1378. }
  1379. return true;
  1380. }
  1381. /** 分发释放卡牌技能事件 */
  1382. public bool DispatchKillOtherEvent(IVirtualUnit attacker, IVirtualUnit deader)
  1383. {
  1384. for (int i = mKillOtherList.Count - 1; i >= 0; --i)
  1385. {
  1386. OnKillOtherUnitEvent hitend = mKillOtherList[i];
  1387. if (deader.GetMaType() >= hitend.maType)
  1388. {
  1389. if (!hitend.m_hand.Invoke(attacker as XmdsVirtual, deader as XmdsVirtual, hitend.m_skill))
  1390. {
  1391. return false;
  1392. }
  1393. }
  1394. }
  1395. return true;
  1396. }
  1397. public void SetSkillActive(int skillTemplateID, bool active, bool pause_on_deactive = false)
  1398. {
  1399. if (this.mSkillHelper != null && this.mSkillHelper.mActiveSkills != null)
  1400. {
  1401. for (int i = 0; i < this.mSkillHelper.mActiveSkills.Count; i++)
  1402. {
  1403. UnitSkill skillInfo = this.mSkillHelper.mActiveSkills[i];
  1404. if(skillInfo != null && skillInfo.SkillID == skillTemplateID)
  1405. {
  1406. skillInfo.IsActive = active;
  1407. }
  1408. }
  1409. }
  1410. }
  1411. /// <summary>
  1412. /// 监听重定向spell.
  1413. /// </summary>
  1414. /// <param name="spt"></param>
  1415. private void DispatchTrySendSpellEvent(LaunchSpell launch, ref SpellTemplate spt, out JSGCreateSpellData createData, ref float startX, ref float startY)
  1416. {
  1417. createData = null;
  1418. for (int i = mOnTrySendSpellLt.Count - 1; i >= 0; --i)
  1419. {
  1420. OnTrySendSpell hitend = mOnTrySendSpellLt[i];
  1421. // 填了技能id,就只发送技能id=法术id的法术
  1422. bool process = hitend.mListenAll;
  1423. if(!process)
  1424. {
  1425. process = (hitend.mListenSpellId > 0) ? (hitend.mListenSpellId == launch.SpellID) : (hitend.m_skill.SkillID == spt.TemplateID);
  1426. }
  1427. if (process)
  1428. {
  1429. if(createData == null)
  1430. {
  1431. createData = new JSGCreateSpellData();
  1432. }
  1433. hitend.m_hand.Invoke(hitend.m_skill, this, launch, ref spt, ref createData, ref startX, ref startY);
  1434. }
  1435. }
  1436. }
  1437. /// <summary>
  1438. /// 监听spell释放完毕
  1439. /// </summary>
  1440. /// <param name="spt"></param>
  1441. public void DispatchSendSpellOverEvent(LaunchSpell launch, SpellTemplate spt, float startX, float startY)
  1442. {
  1443. for (int i = mSendSpellOverLt.Count - 1; i >= 0; --i)
  1444. {
  1445. OnSendSpellOverEvent hitend = mSendSpellOverLt[i];
  1446. // 填了技能id,就只发送技能id=法术id的法术
  1447. if (hitend.mListenAll || hitend.mListSpellId == spt.TemplateID)
  1448. {
  1449. hitend.m_hand.Invoke(launch, this, spt, hitend.m_skill, startX, startY);
  1450. }
  1451. }
  1452. }
  1453. private void DispatchCalThreatValueEvent(XmdsVirtual hitter, AttackSource source, ref AtkResult result)
  1454. {
  1455. for (int i = 0; i < mOnCalThreatValueLt.Count; i++)
  1456. {
  1457. OnCalThreatValue hitend = mOnCalThreatValueLt[i];
  1458. if (hitend.mListenAll || hitend.m_skill == null || hitend.m_skill.SkillID == ((source.Attack.Properties) as XmdsAttackProperties).SkillTemplateID)
  1459. {
  1460. hitend.m_hand.Invoke(this, hitter, source, hitend.m_skill, ref result);
  1461. }
  1462. }
  1463. }
  1464. #endregion
  1465. /// <summary>
  1466. /// 清理注册信息.
  1467. /// </summary>
  1468. public void ClearRegistEvent()
  1469. {
  1470. mHandleMap.Clear();
  1471. mOnHitOtherLt.Clear();
  1472. mOnHitDamageLt.Clear();
  1473. mOnBuffEventLt.Clear();
  1474. mOnCalDamageLt.Clear();
  1475. mOnLaunchSkillOverLt.Clear();
  1476. mOnGetAtkTargetLt.Clear();
  1477. mOnGetSkillDamageInfoLt.Clear();
  1478. mOnStateSkillEndLt.Clear();
  1479. mOnTryAddBuffLt.Clear();
  1480. //mOnSendBuffEvent.Clear();
  1481. mOnTrySendSpellLt.Clear();
  1482. mSendSpellOverLt.Clear();
  1483. mOnTryLaunchSkillLt.Clear();
  1484. mOnTriggerPetSkillLt.Clear();
  1485. mOnCalThreatValueLt.Clear();
  1486. mOnSkillBlockList.Clear();
  1487. mAddOtherHPList.Clear();
  1488. this.mOnRemoveBuffLt.Clear();
  1489. this.mTryAddCardBallList.Clear();
  1490. this.mReduceMPList.Clear();
  1491. this.mTriggerCardSkillList.Clear();
  1492. this.mShareMasterDmgList.Clear();
  1493. this.mKillOtherList.Clear();
  1494. mHandleUUID = 0;
  1495. }
  1496. /// <summary>
  1497. /// 删除技能相关事件.
  1498. /// </summary>
  1499. /// <param name="skillID"></param>
  1500. public void RemoveEventBySkillID(int skillID)
  1501. {
  1502. try
  1503. {
  1504. using (var removeList = ListObjectPool<int>.AllocAutoRelease())
  1505. {
  1506. foreach (KeyValuePair<int, IHandle> pair in mHandleMap)
  1507. {
  1508. if (pair.Value != null && pair.Value.m_skill != null && skillID == pair.Value.m_skill.SkillID)
  1509. {
  1510. removeList.Add(pair.Key);
  1511. }
  1512. }
  1513. for (int i = 0; i < removeList.Count; i++)
  1514. {
  1515. RemoveEventByUUID(removeList[i]);
  1516. }
  1517. }
  1518. }
  1519. catch (Exception error)
  1520. {
  1521. throw new Exception(error.StackTrace);
  1522. }
  1523. }
  1524. private void RemoveEventByUUID(int uuid)
  1525. {
  1526. IHandle handle = null;
  1527. if (mHandleMap.TryGetValue(uuid, out handle))
  1528. {
  1529. bool result = false;
  1530. if (handle is OnHitHandler)
  1531. {
  1532. bool result1 = UnRegistOnHitOther(uuid);
  1533. bool result2 = UnRegistOnHitDamage(uuid);
  1534. result = result1 | result2;
  1535. }
  1536. else if (handle is OnBuffEventHandler)
  1537. {
  1538. result = UnRegistBuffEvent(uuid);
  1539. }
  1540. else if (handle is OnCalDmageHandler)
  1541. {
  1542. result = UnRegistCalDamage(uuid);
  1543. }
  1544. else if (handle is OnLaunchSkillOverHandler)
  1545. {
  1546. result = UnRegistLaunchSkillOver(uuid);
  1547. }
  1548. else if (handle is OnGetAtkTargetHandler)
  1549. {
  1550. result = UnRegistGetAtkTarget(uuid);
  1551. }
  1552. else if (handle is OnGetSkillDamageInfo)
  1553. {
  1554. result = UnRegistGetSkillDamageInfo(uuid);
  1555. }
  1556. else if(handle is OnStateSkillEnd)
  1557. {
  1558. result = UnRegistStateSkillEndEvent(uuid);
  1559. }
  1560. else if (handle is OnTryAddBuff)
  1561. {
  1562. result = UnRegistTryAddBuffEvent(uuid);
  1563. }
  1564. else if(handle is OnRemoveBuff)
  1565. {
  1566. result = UnRegistRemoveBuffEvent(uuid);
  1567. }
  1568. else if(handle is OnSendSpellOverEvent)
  1569. {
  1570. result = UnRegistSendSpellOverEvent(uuid);
  1571. }
  1572. else if (handle is OnTrySendSpell)
  1573. {
  1574. result = UnRegistTrySendSpellEvent(uuid);
  1575. }
  1576. else if (handle is OnTryLaucnSkill)
  1577. {
  1578. result = UnRegistTryLaunchSkillEvent(uuid);
  1579. }
  1580. else if (handle is OnTriggerPetSkill)
  1581. {
  1582. result = UnRegistTriggerPetSkillEvent(uuid);
  1583. }
  1584. else if (handle is OnCalThreatValue)
  1585. {
  1586. result = UnRegistCalThreatValue(uuid);
  1587. }
  1588. else if(handle is OnSkillBlockEvnet)
  1589. {
  1590. result = UnRegistSkillBlockEvent(uuid);
  1591. }
  1592. else if(handle is OnAddOtherHPEvnet)
  1593. {
  1594. result = UnRegistAddOtherHPEvent(uuid);
  1595. }
  1596. else if(handle is OnReduceOtherMpEvnet)
  1597. {
  1598. result = UnRegistReduceOtherMpEvent(uuid);
  1599. }
  1600. else if(handle is OnTryAddCardBallEvent)
  1601. {
  1602. result = UnRegistTryAddCardBallEvent(uuid);
  1603. }
  1604. else if(handle is OnTriggerCardSkillEvent)
  1605. {
  1606. result = UnRegistTriggerCardSkillEvent(uuid);
  1607. }
  1608. else if(handle is OnShareMasterDmgEvent)
  1609. {
  1610. result = UnRegistShareMasterDmgEvent(uuid);
  1611. }
  1612. else if (handle is OnKillOtherUnitEvent)
  1613. {
  1614. result = UnRegistKillOtherEvent(uuid);
  1615. }
  1616. else
  1617. {
  1618. log.Error("RemoveEventByUUID not process type: " + handle);
  1619. }
  1620. }
  1621. }
  1622. }
  1623. }