XmdsVirtual.Event.cs 57 KB

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