Data.cs 193 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291
  1. 
  2. using System;
  3. using System.IO;
  4. using System.Text;
  5. using System.Collections.Generic;
  6. using System.Runtime.Serialization;
  7. using CommonAI.RTS.Manhattan;
  8. using CommonAI.RTS;
  9. using CommonLang.Vector;
  10. using CommonLang;
  11. using CommonLang.ByteOrder;
  12. using CommonLang.IO;
  13. using CommonLang.IO.Attribute;
  14. using CommonLang.Property;
  15. using CommonAI.Zone.Attributes;
  16. using CommonAI.Zone.UnitTriggers;
  17. using CommonAI.Zone.Instance;
  18. using CommonAI.Zone.ZoneEditor;
  19. using CommonAI.Zone.Helper;
  20. using CommonLang.Xml;
  21. using static CommonAI.Zone.AttackProp;
  22. using CommonLang.Log;
  23. using CommonAI.Data;
  24. namespace CommonAI.Zone
  25. {
  26. //---------------------------------------------------------------------------------//
  27. [MessageType(0x4000)]
  28. public class Config
  29. {
  30. [DescAttribute("系统帧率(服务端)", "系统")]
  31. public int SYSTEM_FPS = 30;
  32. [DescAttribute("全局重力", "全局")]
  33. public float GLOBAL_GRAVITY = 9.8f;
  34. [DescAttribute("全局挤开移动最大递归深度", "全局")]
  35. public uint GLOBAL_MOVE_IMPACT_DEPTH = 10;
  36. [DescAttribute("超出此同步范围,立即将坐标修正", "客户端")]
  37. public float CLIENT_UNIT_MOVE_MODIFY_MAX_RANGE = 20f;
  38. [DescAttribute("单位移动最慢速度(低于最慢速度表示不能移动)", "移动")]
  39. public float OBJECT_MOVE_TO_MIN_STEP_SEC = 0.3f;
  40. [DescAttribute("单位攻击范围是否包含身体半径", "战斗")]
  41. public bool OBJECT_ATTACK_RANGE_INCLUDE_BODYSIZE = false;
  42. [DescAttribute("单位间无碰撞总开关", "战斗")]
  43. public bool OBJECT_NONE_TOUCH = false;
  44. [DescAttribute("玩家无碰撞", "战斗")]
  45. public bool PLAYER_NONE_TOUCH = false;
  46. [DescAttribute("宠物跟随距离(靠近主人多少停止)", "战斗")]
  47. public float PET_FOLLOW_DISTANCE_MIN = 1.5f;
  48. [DescAttribute("宠物跟随距离(离主人多远时跟随)", "战斗")]
  49. public float PET_FOLLOW_DISTANCE_MAX = 2.5f;
  50. [DescAttribute("宠物强制跟随距离(距离太远,直接瞬移到主人)", "战斗")]
  51. public float PET_FOLLOW_DISTANCE_LIMIT = 12f;
  52. [DescAttribute("队员跟随距离(靠近主人多少停止)", "战斗")]
  53. public float TEAMER_FOLLOW_DISTANCE_MIN = 2f;
  54. [DescAttribute("队员跟随距离(离主人多远时跟随)", "战斗")]
  55. public float TEAMER_FOLLOW_DISTANCE_MAX = 4f;
  56. [DescAttribute("队员强制跟随距离(距离太远,直接瞬移到主人)", "战斗")]
  57. public float TEAMER_FOLLOW_DISTANCE_LIMIT = 8f;
  58. [DescAttribute("单位默认转身速度(弧度/秒)", "战斗")]
  59. public float UNIT_TURN_SPEED_SEC = 3.14f;
  60. [DescAttribute("单位允许被鞭尸", "战斗")]
  61. public bool UNIT_CAN_WHIPLASH_BODY = false;
  62. [DescAttribute("单位被击飞向上速度", "受击")]
  63. public float OBJECT_DAMAGE_FLY_ZSPEED_SEC = 10.0f;
  64. [DescAttribute("单位被击飞速度(距离/秒)", "受击")]
  65. public float OBJECT_DAMAGE_FLY_SPEED_SEC = 10.0f;
  66. [DescAttribute("单位被击飞加速度(距离/秒) => (速度=速度+加速度)", "受击")]
  67. public float OBJECT_DAMAGE_FLY_SPEED_ADD = 0f;
  68. [DescAttribute("单位被击飞阻力(每秒递减速度百分比)", "受击")]
  69. public float OBJECT_DAMAGE_FLY_SPEED_ACC = 0f;
  70. [DescAttribute("单位被击飞各项参数浮动值百分比", "受击")]
  71. public float OBJECT_DAMAGE_FLY_ARGS_FACTOR_PCT = 0f;
  72. [DescAttribute("单位受击时间(毫秒)", "受击")]
  73. public int OBJECT_DAMAGE_TIME_MS = 1000;
  74. [DescAttribute("每隔一段时间检测一下是否要追(防止抖动)", "AI")]
  75. public int AI_FOLLOW_AND_ATTACK_HOLD_TIME_MS = 1000;
  76. [DescAttribute("尝试追击过程中,调整射击范围(逃离)的比率", "AI")]
  77. public float AI_FOLLOW_AND_ATTACK_ADJUST_ESCAPE_PCT = 50;
  78. [DescAttribute("观察一定范围的触发器,固定时间固定检测周围变化", "AI")]
  79. public int AI_VIEW_TRIGGER_CHECK_TIME_MS = 1000;
  80. [DescAttribute("移动过程中每次AI变化的停顿时间", "AI")]
  81. public int AI_MOVE_AI_HOLD_TIME_MS = 1000;
  82. [DescAttribute("NPC每隔多长毫秒检测一次最大警戒距离", "AI")]
  83. public int AI_NPC_CHECK_IN_GUARD_LIMIT_TIME_MS = 500;
  84. [DescAttribute("NPC攻击间歇时,有多少几率检测旁边有人,并散开,防止堆积在一个点。(百分比)", "AI")]
  85. public float AI_NPC_ATTACK_IDLE_SCATTER_PCT = 25;
  86. [DescAttribute("仇恨列表上限", "AI")]
  87. public int AI_HATE_SYSTEM_CAPACITY_MS = 50;
  88. }
  89. [MessageType(0x410B)]
  90. [DescAttribute("地块定义信息")]
  91. [Expandable]
  92. public class TerrainDefinitionMap : IExternalizable, ICloneable
  93. {
  94. [DescAttribute("地块定义")]
  95. [Expandable]
  96. public class MapBlockBrush : ICloneable
  97. {
  98. [ColorValueAttribute]
  99. [Desc("颜色值ARGB", "Key")]
  100. public int Value = ColorValueAttribute.COLOR_GREEN;
  101. [Desc("是否阻挡", "Key")]
  102. public bool IsBlock = true;
  103. [Desc("名字")]
  104. public string Name = "";
  105. [Desc("注释")]
  106. public string Desc = "";
  107. [Desc("Tag")]
  108. public string Tag = "";
  109. public MapBlockBrush() { }
  110. public MapBlockBrush(int value, bool is_block, string name)
  111. {
  112. this.Value = value;
  113. this.IsBlock = is_block;
  114. this.Name = name;
  115. }
  116. public object Clone()
  117. {
  118. MapBlockBrush ret = new MapBlockBrush();
  119. ret.Value = this.Value;
  120. ret.IsBlock = this.IsBlock;
  121. ret.Name = this.Name;
  122. ret.Desc = this.Desc;
  123. ret.Tag = this.Tag;
  124. return ret;
  125. }
  126. public override string ToString()
  127. {
  128. return string.Format("[{1}] {2} : {0}", Value.ToString("X8"), IsBlock ? "Block" : "Cross", Name);
  129. }
  130. }
  131. [NotNull]
  132. [Desc("地块定义列表")]
  133. public List<MapBlockBrush> Brushes = new List<MapBlockBrush>();
  134. public TerrainDefinitionMap()
  135. {
  136. Brushes.Add(new MapBlockBrush(0, false, "NULL"));
  137. Brushes.Add(new MapBlockBrush(ColorValueAttribute.COLOR_GREEN, true, "Block"));
  138. Brushes.Add(new MapBlockBrush(ColorValueAttribute.COLOR_DARK_GRAY, false, "Safe"));
  139. }
  140. /// <summary>
  141. /// 去从
  142. /// </summary>
  143. public bool ContainsValue(int value)
  144. {
  145. foreach (var b in Brushes)
  146. {
  147. if (b.Value == value)
  148. {
  149. return true;
  150. }
  151. }
  152. return false;
  153. }
  154. public MapBlockBrush GetMapBlockBrush(int value)
  155. {
  156. foreach (var b in Brushes)
  157. {
  158. if (b.Value == value)
  159. {
  160. return b;
  161. }
  162. }
  163. return null;
  164. }
  165. public object Clone()
  166. {
  167. TerrainDefinitionMap ret = new TerrainDefinitionMap();
  168. ret.Brushes = CUtils.CloneList<MapBlockBrush>(this.Brushes);
  169. return ret;
  170. }
  171. public void WriteExternal(IOutputStream output)
  172. {
  173. output.PutS32(Brushes.Count);
  174. foreach (var v in this.Brushes)
  175. {
  176. output.PutS32(v.Value);
  177. output.PutBool(v.IsBlock);
  178. output.PutUTF(v.Name);
  179. output.PutUTF(v.Desc);
  180. output.PutUTF(v.Tag);
  181. }
  182. }
  183. public void ReadExternal(IInputStream input)
  184. {
  185. Brushes.Clear();
  186. int count = input.GetS32();
  187. for (int i = 0; i < count; i++)
  188. {
  189. var v = new MapBlockBrush();
  190. v.Value = input.GetS32();
  191. v.IsBlock = input.GetBool();
  192. v.Name = input.GetUTF();
  193. v.Desc = input.GetUTF();
  194. v.Tag = input.GetUTF();
  195. Brushes.Add(v);
  196. }
  197. }
  198. }
  199. [MessageType(0x410C)]
  200. [DescAttribute("动作定义信息")]
  201. [Expandable]
  202. public class UnitActionDefinitionMap : IExternalizable, ICloneable
  203. {
  204. [DescAttribute("动作定义")]
  205. [Expandable]
  206. public class UnitAction : ICloneable, IExternalizable
  207. {
  208. [DescAttribute("动作", "动作")]
  209. public UnitActionStatus Action = UnitActionStatus.Idle;
  210. [DescAttribute("动作序列", "动作")]
  211. public List<UnitActionKeyFrame> ActionQueue = new List<UnitActionKeyFrame>();
  212. public void WriteExternal(IOutputStream output)
  213. {
  214. output.PutEnum8(this.Action);
  215. output.PutStructList(this.ActionQueue);
  216. }
  217. public void ReadExternal(IInputStream input)
  218. {
  219. this.Action = input.GetEnum8<UnitActionStatus>();
  220. this.ActionQueue = input.GetStructList<UnitActionKeyFrame>();
  221. }
  222. public object Clone()
  223. {
  224. UnitAction ret = new UnitAction();
  225. ret.Action = this.Action;
  226. ret.ActionQueue = CUtils.CloneList(this.ActionQueue);
  227. return ret;
  228. }
  229. public override string ToString()
  230. {
  231. return string.Format("{0} : {1}", Action, CUtils.ListToString(ActionQueue));
  232. }
  233. }
  234. [DescAttribute("动作帧定义")]
  235. [Expandable]
  236. public class UnitActionKeyFrame : ICloneable, IExternalizable
  237. {
  238. [DescAttribute("动作名")]
  239. public string ActionName = "f_idle";
  240. [DescAttribute("播放时间(如果多段动作,则需要指定每段时间)")]
  241. public int TimeMS = 0;
  242. [DescAttribute("是否循环")]
  243. public bool Cycle = false;
  244. [DescAttribute("是否淡出")]
  245. public bool CrossFade = false;
  246. [DescAttribute("播放速度")]
  247. public float Speed = 1f;
  248. [DescAttribute("Tag")]
  249. public string Tag = "";
  250. public override string ToString()
  251. {
  252. return ActionName;
  253. }
  254. public void WriteExternal(IOutputStream output)
  255. {
  256. output.PutUTF(this.ActionName);
  257. output.PutS32(this.TimeMS);
  258. output.PutBool(this.Cycle);
  259. output.PutBool(this.CrossFade);
  260. output.PutF32(this.Speed);
  261. output.PutUTF(this.Tag);
  262. }
  263. public void ReadExternal(IInputStream input)
  264. {
  265. this.ActionName = input.GetUTF();
  266. this.TimeMS = input.GetS32();
  267. this.Cycle = input.GetBool();
  268. this.CrossFade = input.GetBool();
  269. this.Speed = input.GetF32();
  270. this.Tag = input.GetUTF();
  271. }
  272. public object Clone()
  273. {
  274. UnitActionKeyFrame ret = new UnitActionKeyFrame();
  275. ret.ActionName = this.ActionName;
  276. ret.TimeMS = this.TimeMS;
  277. ret.Cycle = this.Cycle;
  278. ret.CrossFade = this.CrossFade;
  279. ret.Speed = this.Speed;
  280. ret.Tag = this.Tag;
  281. return ret;
  282. }
  283. }
  284. [DescAttribute("动作集合")]
  285. public List<UnitAction> ActionMap = new List<UnitAction>();
  286. public void WriteExternal(IOutputStream output)
  287. {
  288. output.PutStructList(this.ActionMap);
  289. }
  290. public void ReadExternal(IInputStream input)
  291. {
  292. this.ActionMap = input.GetStructList<UnitAction>();
  293. }
  294. public object Clone()
  295. {
  296. UnitActionDefinitionMap ret = new UnitActionDefinitionMap();
  297. ret.ActionMap = CUtils.CloneList(this.ActionMap);
  298. return ret;
  299. }
  300. }
  301. //---------------------------------------------------------------------------------//
  302. /// <summary>
  303. /// 场景基础数据
  304. /// </summary>
  305. [MessageType(0x4001)]
  306. public class ZoneInfo : IExternalizable, ICloneable
  307. {
  308. public int TemplateID { get { return ID; } }
  309. [DescAttribute("ID", "", false)]
  310. public int ID;
  311. /// <summary>
  312. /// 地图总宽
  313. /// </summary>
  314. public int TotalWidth { get { return mXCount * mGridCellW; } }
  315. /// <summary>
  316. /// 地图总高
  317. /// </summary>
  318. public int TotalHeight { get { return mYCount * mGridCellH; } }
  319. /// <summary>
  320. /// 所有地图碰撞块信息
  321. /// </summary>
  322. public int[,] TerrainMatrix { get { return mTerrainMatrix; } }
  323. /// <summary>
  324. /// 地图碰撞格宽
  325. /// </summary>
  326. public int GridCellW { get { return mGridCellW; } }
  327. /// <summary>
  328. /// 地图碰撞格高
  329. /// </summary>
  330. public int GridCellH { get { return mGridCellH; } }
  331. /// <summary>
  332. /// 地图横向格子数
  333. /// </summary>
  334. public int XCount { get { return mXCount; } }
  335. /// <summary>
  336. /// 地图纵向格子数
  337. /// </summary>
  338. public int YCount { get { return mYCount; } }
  339. //------------------------------------------------------------
  340. [DescAttribute("", "", false)]
  341. public int[,] mTerrainMatrix;
  342. [DescAttribute("", "", false)]
  343. public int mXCount;
  344. [DescAttribute("", "", false)]
  345. public int mYCount;
  346. [DescAttribute("", "", false)]
  347. public int mGridCellW;
  348. [DescAttribute("", "", false)]
  349. public int mGridCellH;
  350. //------------------------------------------------------------
  351. public ZoneInfo(int xcount, int ycount, int gridW, int gridH)
  352. {
  353. this.mXCount = xcount;
  354. this.mYCount = ycount;
  355. this.mGridCellW = gridW;
  356. this.mGridCellH = gridH;
  357. this.mTerrainMatrix = new int[xcount, ycount];
  358. }
  359. public ZoneInfo() { }
  360. public int GetID()
  361. {
  362. return ID;
  363. }
  364. public object Clone()
  365. {
  366. ZoneInfo ret = new ZoneInfo();
  367. ret.ID = this.ID;
  368. ret.mXCount = this.mXCount;
  369. ret.mYCount = this.mYCount;
  370. ret.mGridCellW = this.mGridCellW;
  371. ret.mGridCellH = this.mGridCellH;
  372. ret.mTerrainMatrix = new int[mXCount, mYCount];
  373. for (int x = 0; x < mXCount; x++)
  374. {
  375. for (int y = 0; y < mYCount; y++)
  376. {
  377. ret.mTerrainMatrix[x, y] = this.mTerrainMatrix[x, y];
  378. }
  379. }
  380. return ret;
  381. }
  382. public bool TryGetFlag(int bx, int by, out int flag)
  383. {
  384. if (bx < mXCount && bx >= 0 && by < mYCount && by >= 0)
  385. {
  386. flag = mTerrainMatrix[bx, by];
  387. return true;
  388. }
  389. flag = 0;
  390. return false;
  391. }
  392. public void WriteExternal(IOutputStream output)
  393. {
  394. output.PutS32(ID);
  395. output.PutS32(mXCount);
  396. output.PutS32(mYCount);
  397. output.PutS32(mGridCellW);
  398. output.PutS32(mGridCellH);
  399. for (int x = 0; x < mXCount; x++)
  400. {
  401. for (int y = 0; y < mYCount; y++)
  402. {
  403. output.PutS32(mTerrainMatrix[x, y]);
  404. }
  405. }
  406. }
  407. public void ReadExternal(IInputStream input)
  408. {
  409. this.ID = input.GetS32();
  410. this.mXCount = input.GetS32();
  411. this.mYCount = input.GetS32();
  412. this.mGridCellW = input.GetS32();
  413. this.mGridCellH = input.GetS32();
  414. this.mTerrainMatrix = new int[mXCount, mYCount];
  415. for (int x = 0; x < mXCount; x++)
  416. {
  417. for (int y = 0; y < mYCount; y++)
  418. {
  419. this.mTerrainMatrix[x, y] = input.GetS32();
  420. }
  421. }
  422. }
  423. }
  424. //---------------------------------------------------------------------------------//
  425. #region __Templates_Data__
  426. //---------------------------------------------------------------------------------//
  427. /// <summary>
  428. /// 单位模板数据
  429. /// </summary>
  430. [MessageType(0x4002)]
  431. [DescAttribute("单位模板数据")]
  432. [TableClassAttribute("ID")]
  433. public class UnitInfo : ICloneable, ITemplateData, IExternalizable
  434. {
  435. protected static readonly Logger log = LoggerFactory.GetDefLogger();
  436. public int TemplateID { get { return ID; } }
  437. [XmlSerializable()]
  438. public string EditorPath { get; set; }
  439. /// <summary>
  440. /// 单位类型
  441. /// </summary>
  442. public enum UnitType : byte
  443. {
  444. [DescAttribute("玩家")]
  445. TYPE_PLAYER = 1,
  446. [DescAttribute("NPC")]
  447. TYPE_NPC = 2,
  448. [DescAttribute("怪物")]
  449. TYPE_MONSTER = 3,
  450. [DescAttribute("宠物")]
  451. TYPE_PET = 4,
  452. [DescAttribute("召唤物")]
  453. TYPE_SUMMON = 5,
  454. [DescAttribute("建筑")]
  455. TYPE_BUILDING = 6,
  456. [DescAttribute("脚本控制")]
  457. TYPE_MANUAL = 7,
  458. [DescAttribute("触发机关")]
  459. TYPE_TRIGGER = 8,
  460. [DescAttribute("中立无敌意")]
  461. TYPE_NEUTRALITY = 9,
  462. }
  463. //------------------------------------
  464. /// <summary>
  465. /// 单位类型
  466. /// </summary>
  467. [DescAttribute("单位类型", "基础")]
  468. public UnitType UType = UnitType.TYPE_MONSTER;
  469. [DescAttribute(
  470. "单位类型"
  471. + "\n PLAYER=1"
  472. + "\n NPC=2"
  473. + "\n MONSTER=3"
  474. + "\n PET=4"
  475. + "\n SUMMON=5"
  476. + "\n BUILDING=6"
  477. + "\n MANUAL=7"
  478. + "\n TRIGGER=8"
  479. + "\n NEUTRALITY=9",
  480. "基础")]
  481. public int UTypeAsInt { get { return (int)UType; } }
  482. public bool IsSummon { get { return UType == UnitType.TYPE_SUMMON; } }
  483. [DescAttribute("召唤类型", "基础")]
  484. [DependOnProperty("IsSummon")]
  485. public SummonType SumType = SummonType.none;
  486. /// <summary>
  487. /// 模板ID
  488. /// </summary>
  489. [DescAttribute("ID", "", false)]
  490. public int ID;
  491. /// <summary>
  492. /// 单位名字
  493. /// </summary>
  494. [LocalizationTextAttribute]
  495. [DescAttribute("单位名字", "基础")]
  496. public string Name;
  497. [DescAttribute("是否为精英怪", "基础")]
  498. public bool IsElite;
  499. //------------------------------------
  500. /// <summary>
  501. /// 对应的模型文件名
  502. /// </summary>
  503. [DescAttribute("对应的模型文件名", "资源")]
  504. [ResourceIDAttribute]
  505. public string FileName;
  506. [DescAttribute("怪物产生时触发的特效", "资源")]
  507. public LaunchEffect SpawnEffect;
  508. [DescAttribute("怪物脚底的特效", "资源")]
  509. public LaunchEffect FootCircleEffect;
  510. [DescAttribute("怪物死亡时触发的特效", "资源")]
  511. public LaunchEffect DeadEffect;
  512. [DescAttribute("怪物死亡动作播放结束后触发的特效", "资源")]
  513. public LaunchEffect DeadActionEffect;
  514. [DescAttribute("怪物烂掉时触发的特效", "资源")]
  515. public LaunchEffect RemovedEffect;
  516. [DescAttribute("怪物击碎时触发的特效", "资源")]
  517. public LaunchEffect CrushEffect;
  518. [DescAttribute("怪物受击时触发的特效", "资源")]
  519. public LaunchEffect DamageEffect;
  520. [DescAttribute("缩放比率", "资源")]
  521. public float BodyScale = 1;
  522. [DescAttribute("死亡的音效文件", "资源")]
  523. [ResourceIDAttribute]
  524. public string DeadAudioName;
  525. [DescAttribute("切换阵营特效", "资源-切阵营")]
  526. public LaunchEffect ChangeForceEffect;
  527. [DescAttribute("切换阵营音效文件", "资源-切阵营")]
  528. [ResourceIDAttribute]
  529. public string ChangeForceAudioName;
  530. [DescAttribute("破碎比例", "资源-破碎")]
  531. public int HitBreakPrecent;
  532. [DescAttribute("破碎特效", "资源-破碎")]
  533. public LaunchEffect HitBreakEffect;
  534. [DescAttribute("破碎音效文件", "资源-破碎")]
  535. [ResourceIDAttribute]
  536. public string HitBreakAudioName;
  537. //------------------------------------
  538. /// <summary>
  539. /// 身体高度
  540. /// </summary>
  541. [DescAttribute("身体高度", "战斗")]
  542. public float BodyHeight;
  543. /// <summary>
  544. /// 身体尺寸(半径)
  545. /// </summary>
  546. [DescAttribute("身体尺寸(半径)", "战斗")]
  547. public float BodySize = 1;
  548. /// <summary>
  549. /// 警戒距离范围
  550. /// </summary>
  551. [DescAttribute("身体受攻击尺寸(半径)", "战斗")]
  552. public float BodyHitSize = 1;
  553. //------------------------------------
  554. /// <summary>
  555. /// 警戒距离范围
  556. /// </summary>
  557. [DescAttribute("警戒距离范围", "战斗 - 警戒")]
  558. public float GuardRange = 5;
  559. [DescAttribute("最大警戒范围,超过此范围不追击,0表示无限", "战斗 - 警戒")]
  560. public float GuardRangeLimit = 20;
  561. [DescAttribute("分组警戒范围,如果此单位进入战斗,则传给相邻单位Add,0表示不传递", "战斗 - 警戒")]
  562. public float GuardRangeGroup = 5;
  563. public bool IdleRecover { get { return RecoveryIntervalMS > 0; } }
  564. [DescAttribute("恢复间隔(毫秒),脱离战斗后回血间隔时间", "战斗 - 恢复")]
  565. public int RecoveryIntervalMS = 10000;
  566. [DescAttribute("血量恢复/秒", "战斗 - 恢复")]
  567. [DependOnProperty("IdleRecover")]
  568. public int HealthRecoveryPoint = 0;
  569. [DescAttribute("法力恢复/秒", "战斗 - 恢复")]
  570. [DependOnProperty("IdleRecover")]
  571. public int ManaRecoveryPoint = 0;
  572. //------------------------------------
  573. [DescAttribute("体重(>=100不能被击飞)", "战斗")]
  574. public int Weight = 1;
  575. [DescAttribute("是否可移动", "战斗")]
  576. public bool IsMoveable = true;
  577. [DescAttribute("是否可转向", "战斗")]
  578. public bool IsTurnable = true;
  579. //------------------------------------
  580. /// <summary>
  581. /// 移动距离,像素或者码
  582. /// </summary>
  583. [DescAttribute("移动速度(距离/每秒)", "战斗")]
  584. public float MoveSpeedSEC = 6f;
  585. [DescAttribute("转身速度(弧度/秒)", "战斗")]
  586. public float TurnSpeedSEC = float.NaN;
  587. [DescAttribute("受击时间(毫秒)", "战斗")]
  588. public int DamageTimeMS = 10;
  589. //------------------------------------
  590. /// <summary>
  591. /// 此单位普通攻击技能
  592. /// </summary>
  593. [DescAttribute("此单位普通攻击技能", "技能")]
  594. public LaunchSkill BaseSkillID = new LaunchSkill();
  595. /// <summary>
  596. /// 此单位绑定的所有技能ID
  597. /// </summary>
  598. [DescAttribute("此单位绑定的所有技能ID", "技能")]
  599. public List<LaunchSkill> Skills = new List<LaunchSkill>();
  600. /// <summary>
  601. /// 触发类特效
  602. /// </summary>
  603. [DescAttribute("触发类", "技能")]
  604. public List<LaunchTrigger> Triggers = new List<LaunchTrigger>();
  605. //------------------------------------
  606. //------------------------------------
  607. [DescAttribute("法术发射高度(炮口高度)", "炮口")]
  608. public float LaunchSpellHeight;
  609. [DescAttribute("法术发射半径(炮口半径)", "炮口")]
  610. public float LaunchSpellRadius = 0;
  611. //------------------------------------
  612. [DescAttribute("死亡时释放法术(自爆)", "战斗")]
  613. public LaunchSpell DeadLaunchSpell = null;
  614. [DescAttribute("死亡时释放法术(灵魂出窍)", "战斗")]
  615. public LaunchSpell DeadDelayLaunchSpell = null;
  616. //------------------------------------
  617. [DescAttribute("血量", "战斗")]
  618. public int HealthPoint = 100;
  619. [DescAttribute("法力值", "战斗")]
  620. public int ManaPoint = 100;
  621. [DescAttribute("耐力值", "战斗")]
  622. public int StaminaPoint = 100;
  623. [DescAttribute("产生经验", "战斗")]
  624. public int GenExp;
  625. //------------------------------------
  626. /// <summary>
  627. /// 掉落道具列表
  628. /// </summary>
  629. [DescAttribute("掉落道具", "掉落")]
  630. public List<DropItemList> DropItemsSet = new List<DropItemList>();
  631. [DescAttribute("被杀死直接获得金币", "掉落")]
  632. public int DropMoney;
  633. //------------------------------------
  634. [DescAttribute("单位背包数量", "背包")]
  635. public int InventorySize = 1;
  636. [DescAttribute("进入战斗携带的道具列表(比如血瓶)", "背包")]
  637. public List<InventoryItem> InventoryList = new List<InventoryItem>();
  638. //------------------------------------
  639. /// <summary>
  640. /// 若是召唤类,则表示存活时间
  641. /// </summary>
  642. [DescAttribute("若是召唤类,则表示存活时间(毫秒)", "战斗")]
  643. public int LifeTimeMS;
  644. /// <summary>
  645. /// 单位出生延时时间,通常播放出生动画
  646. /// </summary>
  647. [DescAttribute("单位出生延时时间,通常播放出生动画(毫秒)", "战斗")]
  648. public int SpawnTimeMS;
  649. /// <summary>
  650. /// 持续时间
  651. /// </summary>
  652. [DescAttribute("单位死亡持续时间,即死亡后多长时间内可继续鞭尸(毫秒)", "战斗")]
  653. public int DeadTimeMS;
  654. /// <summary>
  655. ///
  656. /// </summary>
  657. [DescAttribute("单位死亡之后延迟时间(毫秒),播放 DeadDelayLaunchSpell 特效", "战斗")]
  658. public int DeadDelayTimeMS;
  659. /// <summary>
  660. ///
  661. /// </summary>
  662. [DescAttribute("播放 DeadDelayLaunchSpell 特效的数量", "战斗")]
  663. public int DeadDelaySpellNumber;
  664. public bool HasNumbers
  665. {
  666. get { return DeadDelaySpellNumber > 1; }
  667. }
  668. /// <summary>
  669. ///
  670. /// </summary>
  671. [DescAttribute("播放每一个 DeadDelayLaunchSpell 间隔的时间(单位:毫秒)", "战斗")]
  672. [DependOnProperty("HasNumbers")]
  673. public int DeadDelaySpellIntervalMS;
  674. /// <summary>
  675. /// 复活时间
  676. /// </summary>
  677. [DescAttribute("死亡后多久复活,0表示不能复活(毫秒)", "战斗")]
  678. public int RebirthTimeMS;
  679. //------------------------------------
  680. [DescAttribute("用户自定义标志", "脚本")]
  681. public string UserTag;
  682. //------------------------------------
  683. [DescAttribute("是否为动态创建单位,比如PVP或者根据玩家等级创建的单位", "扩展")]
  684. public bool IsDynamic = false;
  685. [DescAttribute("是否随机名字", "扩展")]
  686. public bool IsRandomName = false;
  687. //------------------------------------
  688. [DescAttribute("单位绑定触发事件ID", "事件")]
  689. [TemplatesIDAttribute(typeof(UnitEventTemplate))]
  690. public List<int> Events = new List<int>();
  691. //------------------------------------
  692. /// <summary>
  693. /// 用户自定义扩展属性
  694. /// </summary>
  695. [DescAttribute("扩展属性", "扩展")]
  696. [Expandable]
  697. [NotNull]
  698. public IUnitProperties Properties;
  699. //------------------------------------
  700. [DescAttribute("自定义字段", "属性", true)]
  701. public string[] Attributes;
  702. //------------------------------------
  703. public UnitInfo()
  704. {
  705. Properties = TemplateManager.Factory.CreateUnitProperties();
  706. }
  707. public int GetID()
  708. {
  709. return ID;
  710. }
  711. public override string ToString()
  712. {
  713. return Name + "(" + ID + ")";
  714. }
  715. public object Clone()
  716. {
  717. UnitInfo ret = new UnitInfo();
  718. ret.EditorPath = this.EditorPath;
  719. ret.UType = this.UType;
  720. ret.ID = this.ID;
  721. ret.Name = this.Name;
  722. ret.IsElite = this.IsElite;
  723. ret.FileName = this.FileName;
  724. ret.SpawnEffect = CUtils.TryClone<LaunchEffect>(this.SpawnEffect);
  725. ret.FootCircleEffect = CUtils.TryClone<LaunchEffect>(this.FootCircleEffect);
  726. ret.DeadEffect = CUtils.TryClone<LaunchEffect>(this.DeadEffect);
  727. ret.RemovedEffect = CUtils.TryClone<LaunchEffect>(this.RemovedEffect);
  728. ret.DeadActionEffect = CUtils.TryClone<LaunchEffect>(this.DeadActionEffect);
  729. ret.CrushEffect = CUtils.TryClone<LaunchEffect>(this.CrushEffect);
  730. ret.DamageEffect = CUtils.TryClone<LaunchEffect>(this.DamageEffect);
  731. ret.BodyScale = this.BodyScale;
  732. ret.DeadAudioName = this.DeadAudioName;
  733. ret.BodyHeight = this.BodyHeight;
  734. ret.BodySize = this.BodySize;
  735. ret.BodyHitSize = this.BodyHitSize;
  736. ret.GuardRange = this.GuardRange;
  737. ret.GuardRangeLimit = this.GuardRangeLimit;
  738. ret.GuardRangeGroup = this.GuardRangeGroup;
  739. ret.HealthRecoveryPoint = this.HealthRecoveryPoint;
  740. ret.ManaRecoveryPoint = this.ManaRecoveryPoint;
  741. ret.RecoveryIntervalMS = this.RecoveryIntervalMS;
  742. ret.Weight = this.Weight;
  743. ret.MoveSpeedSEC = this.MoveSpeedSEC;
  744. ret.TurnSpeedSEC = this.TurnSpeedSEC;
  745. ret.DamageTimeMS = this.DamageTimeMS;
  746. ret.IsMoveable = this.IsMoveable;
  747. ret.IsTurnable = this.IsTurnable;
  748. ret.BaseSkillID = CUtils.TryClone<LaunchSkill>(this.BaseSkillID);
  749. ret.Skills = CUtils.CloneList<LaunchSkill>(this.Skills);
  750. ret.Triggers = CUtils.CloneList<LaunchTrigger>(this.Triggers);
  751. ret.LaunchSpellHeight = this.LaunchSpellHeight;
  752. ret.LaunchSpellRadius = this.LaunchSpellRadius;
  753. ret.DeadLaunchSpell = this.DeadLaunchSpell;
  754. ret.DeadDelayLaunchSpell = this.DeadDelayLaunchSpell;
  755. ret.HealthPoint = this.HealthPoint;
  756. ret.ManaPoint = this.ManaPoint;
  757. ret.StaminaPoint = this.StaminaPoint;
  758. ret.GenExp = this.GenExp;
  759. ret.DropItemsSet = CUtils.CloneList<DropItemList>(this.DropItemsSet);
  760. ret.DropMoney = this.DropMoney;
  761. ret.InventorySize = this.InventorySize;
  762. ret.InventoryList = CUtils.CloneList<InventoryItem>(this.InventoryList);
  763. ret.LifeTimeMS = this.LifeTimeMS;
  764. ret.SpawnTimeMS = this.SpawnTimeMS;
  765. ret.DeadTimeMS = this.DeadTimeMS;
  766. ret.DeadDelayTimeMS = this.DeadDelayTimeMS;
  767. ret.DeadDelaySpellNumber = this.DeadDelaySpellNumber;
  768. ret.DeadDelaySpellIntervalMS = this.DeadDelaySpellIntervalMS;
  769. ret.RebirthTimeMS = this.RebirthTimeMS;
  770. ret.UserTag = this.UserTag;
  771. ret.IsDynamic = this.IsDynamic;
  772. ret.Events = new List<int>(this.Events);
  773. ret.Properties = CUtils.TryClone<IUnitProperties>(this.Properties);// (IUnitProperties)this.Properties.Clone();
  774. ret.Attributes = CUtils.CloneArray<string>(this.Attributes);
  775. ret.HitBreakPrecent = this.HitBreakPrecent;
  776. ret.HitBreakEffect = CUtils.TryClone<LaunchEffect>(this.HitBreakEffect);
  777. ret.ChangeForceEffect = CUtils.TryClone<LaunchEffect>(this.ChangeForceEffect);
  778. ret.ChangeForceAudioName = this.ChangeForceAudioName;
  779. ret.HitBreakPrecent = this.HitBreakPrecent;
  780. ret.HitBreakEffect = this.HitBreakEffect;
  781. ret.HitBreakAudioName = this.HitBreakAudioName;
  782. ret.IsRandomName = this.IsRandomName;
  783. ret.SumType = this.SumType;
  784. return ret;
  785. }
  786. public void WriteExternal(IOutputStream output)
  787. {
  788. output.PutUTF(this.EditorPath);
  789. output.PutEnum8(this.UType);
  790. output.PutS32(this.ID);
  791. output.PutUTF(this.Name);
  792. output.PutBool(this.IsElite);
  793. output.PutUTF(this.FileName);
  794. output.PutExt(this.SpawnEffect);
  795. output.PutExt(this.FootCircleEffect);
  796. output.PutExt(this.DeadEffect);
  797. output.PutExt(this.RemovedEffect);
  798. output.PutExt(this.DeadActionEffect);
  799. output.PutExt(this.CrushEffect);
  800. output.PutExt(this.DamageEffect);
  801. output.PutF32(this.BodyScale);
  802. output.PutUTF(this.DeadAudioName);
  803. output.PutF32(this.BodyHeight);
  804. output.PutF32(this.BodySize);
  805. output.PutF32(this.BodyHitSize);
  806. output.PutF32(this.GuardRange);
  807. output.PutF32(this.GuardRangeLimit);
  808. output.PutF32(this.GuardRangeGroup);
  809. output.PutS32(this.RecoveryIntervalMS);
  810. output.PutS32(this.HealthRecoveryPoint);
  811. output.PutS32(this.ManaRecoveryPoint);
  812. output.PutS32(this.Weight);
  813. output.PutF32(this.MoveSpeedSEC);
  814. output.PutF32(this.TurnSpeedSEC);
  815. output.PutS32(this.DamageTimeMS);
  816. output.PutBool(this.IsMoveable);
  817. output.PutBool(this.IsTurnable);
  818. output.PutExt(this.BaseSkillID);
  819. output.PutList<LaunchSkill>(this.Skills, output.PutExt);
  820. output.PutList<LaunchTrigger>(this.Triggers, output.PutExt);
  821. output.PutF32(this.LaunchSpellHeight);
  822. output.PutF32(this.LaunchSpellRadius);
  823. output.PutExt(this.DeadLaunchSpell);
  824. output.PutExt(this.DeadDelayLaunchSpell);
  825. output.PutS32(this.HealthPoint);
  826. output.PutS32(this.ManaPoint);
  827. output.PutS32(this.StaminaPoint);
  828. output.PutS32(this.GenExp);
  829. output.PutList<DropItemList>(this.DropItemsSet, output.PutExt);
  830. output.PutS32(this.DropMoney);
  831. output.PutS32(this.InventorySize);
  832. output.PutList<InventoryItem>(this.InventoryList, output.PutExt);
  833. output.PutS32(this.LifeTimeMS);
  834. output.PutS32(this.SpawnTimeMS);
  835. output.PutS32(this.DeadTimeMS);
  836. output.PutS32(this.DeadDelayTimeMS);
  837. output.PutS32(this.DeadDelaySpellNumber);
  838. output.PutS32(this.DeadDelaySpellIntervalMS);
  839. output.PutS32(this.RebirthTimeMS);
  840. output.PutUTF(this.UserTag);
  841. output.PutBool(this.IsDynamic);
  842. output.PutList(this.Events, output.PutS32);
  843. output.PutArray(this.Attributes, output.PutUTF);
  844. output.PutExt(this.Properties);
  845. //破碎,切阵营
  846. output.PutExt(this.ChangeForceEffect);
  847. output.PutUTF(this.ChangeForceAudioName);
  848. output.PutS32(this.HitBreakPrecent);
  849. output.PutExt(this.HitBreakEffect);
  850. output.PutUTF(this.HitBreakAudioName);
  851. // 随机名字
  852. output.PutBool(this.IsRandomName);
  853. output.PutEnum8(this.SumType);
  854. }
  855. public void ReadExternal(IInputStream input)
  856. {
  857. this.EditorPath = input.GetUTF();
  858. this.UType = input.GetEnum8<UnitType>();
  859. this.ID = input.GetS32();
  860. this.Name = input.GetUTF();
  861. this.IsElite = input.GetBool();
  862. this.FileName = input.GetUTF();
  863. this.SpawnEffect = input.GetExt<LaunchEffect>();
  864. this.FootCircleEffect = input.GetExt<LaunchEffect>();
  865. this.DeadEffect = input.GetExt<LaunchEffect>();
  866. this.RemovedEffect = input.GetExt<LaunchEffect>();
  867. this.DeadActionEffect = input.GetExt<LaunchEffect>();
  868. this.CrushEffect = input.GetExt<LaunchEffect>();
  869. this.DamageEffect = input.GetExt<LaunchEffect>();
  870. this.BodyScale = input.GetF32();
  871. this.DeadAudioName = input.GetUTF();
  872. this.BodyHeight = input.GetF32();
  873. this.BodySize = input.GetF32();
  874. this.BodyHitSize = input.GetF32();
  875. this.GuardRange = input.GetF32();
  876. this.GuardRangeLimit = input.GetF32();
  877. this.GuardRangeGroup = input.GetF32();
  878. this.RecoveryIntervalMS = input.GetS32();
  879. this.HealthRecoveryPoint = input.GetS32();
  880. this.ManaRecoveryPoint = input.GetS32();
  881. this.Weight = input.GetS32();
  882. this.MoveSpeedSEC = input.GetF32();
  883. this.TurnSpeedSEC = input.GetF32();
  884. this.DamageTimeMS = input.GetS32();
  885. this.IsMoveable = input.GetBool();
  886. this.IsTurnable = input.GetBool();
  887. this.BaseSkillID = input.GetExt<LaunchSkill>();
  888. this.Skills = input.GetList<LaunchSkill>(input.GetExt<LaunchSkill>);
  889. this.Triggers = input.GetList<LaunchTrigger>(input.GetExt<LaunchTrigger>);
  890. this.LaunchSpellHeight = input.GetF32();
  891. this.LaunchSpellRadius = input.GetF32();
  892. this.DeadLaunchSpell = input.GetExt<LaunchSpell>();
  893. this.DeadDelayLaunchSpell = input.GetExt<LaunchSpell>();
  894. this.HealthPoint = input.GetS32();
  895. this.ManaPoint = input.GetS32();
  896. this.StaminaPoint = input.GetS32();
  897. this.GenExp = input.GetS32();
  898. this.DropItemsSet = input.GetList<DropItemList>(input.GetExt<DropItemList>);
  899. this.DropMoney = input.GetS32();
  900. this.InventorySize = input.GetS32();
  901. this.InventoryList = input.GetList<InventoryItem>(input.GetExt<InventoryItem>);
  902. this.LifeTimeMS = input.GetS32();
  903. this.SpawnTimeMS = input.GetS32();
  904. this.DeadTimeMS = input.GetS32();
  905. this.DeadDelayTimeMS = input.GetS32();
  906. this.DeadDelaySpellNumber = input.GetS32();
  907. this.DeadDelaySpellIntervalMS = input.GetS32();
  908. this.RebirthTimeMS = input.GetS32();
  909. this.UserTag = input.GetUTF();
  910. this.IsDynamic = input.GetBool();
  911. this.Events = input.GetList<int>(input.GetS32);
  912. this.Attributes = input.GetUTFArray();
  913. this.Properties = input.GetExt<IUnitProperties>(this.Properties);
  914. this.ChangeForceEffect = input.GetExt<LaunchEffect>();
  915. this.ChangeForceAudioName = input.GetUTF();
  916. this.HitBreakPrecent = input.GetS32();
  917. this.HitBreakEffect = input.GetExt<LaunchEffect>();
  918. this.HitBreakAudioName = input.GetUTF();
  919. this.IsRandomName = input.GetBool();
  920. this.SumType = input.GetEnum8<SummonType>();
  921. if (UType == UnitType.TYPE_NPC && this.RecoveryIntervalMS > 0)
  922. {
  923. log.Info("NPC配置了恢复时间, 强行重置" + this.ID);
  924. this.RecoveryIntervalMS = 0;
  925. }
  926. }
  927. public LaunchSkill GetSkillByID(int skillID)
  928. {
  929. if (BaseSkillID != null && skillID == BaseSkillID.SkillID)
  930. {
  931. return BaseSkillID;
  932. }
  933. if (Skills != null)
  934. {
  935. for (int i = 0; i < Skills.Count; i++)
  936. {
  937. if (Skills[i].SkillID == skillID)
  938. {
  939. return Skills[i];
  940. }
  941. }
  942. }
  943. return null;
  944. }
  945. }
  946. //---------------------------------------------------------------------------------//
  947. /// <summary>
  948. /// 技能模板
  949. /// </summary>
  950. [MessageType(0x4003)]
  951. [DescAttribute("技能模板")]
  952. [TableClassAttribute("ID")]
  953. public class SkillTemplate : ICloneable, ITemplateData, IExternalizable
  954. {
  955. public int TemplateID { get { return ID; } }
  956. [XmlSerializable()]
  957. public string EditorPath { get; set; }
  958. // 技能ID
  959. [DescAttribute("ID", "", false)]
  960. public int ID;
  961. /// <summary>
  962. /// 技能名字
  963. /// </summary>
  964. [LocalizationTextAttribute]
  965. [DescAttribute("技能名字", "基础")]
  966. public string Name;
  967. [DescAttribute("技能冷却时间(毫秒)", "基础")]
  968. [DependOnProperty("IsCoolDownWithAction", false)]
  969. public int CoolDownMS = 6000;
  970. //------------------------------------
  971. [DescAttribute("技能图标", "资源")]
  972. public string IconName;
  973. //------------------------------------
  974. /// <summary>
  975. /// 攻击动作序列
  976. /// </summary>
  977. [DescAttribute("攻击动作序列", "动作")]
  978. [ListAttribute(typeof(UnitActionData))]
  979. public List<UnitActionData> ActionQueue = new List<UnitActionData>();
  980. [DescAttribute("以动作时间作为冷却时间, 普攻使用", "动作")]
  981. //只能普攻使用
  982. public bool IsCoolDownWithAction = false;
  983. [DescAttribute("可以打断其他技能和受击状态,受身技能", "动作")]
  984. public bool IsCounter = false;
  985. [DescAttribute("技能优先级,高优先级可打断低优先级", "动作")]
  986. public int ActionPriority = 0;
  987. [DescAttribute("动作播放速率", "动作")]
  988. public float ActionSpeedRate = 1f;
  989. [DescAttribute("技能释放期间,模型缩放(仅客户端有效)", "动作")]
  990. public float BodyScale = 1f;
  991. [DescAttribute("技能释放期间,可手动撤销", "动作")]
  992. public bool IsManuallyCancelable = false;
  993. [DescAttribute("忽略本技能释放中不可打断的时间段(只用作客户端显示用)", "动作")]
  994. public bool IgnoreMyUncancelable = false;
  995. //------------------------------------
  996. [DescAttribute("每次释放只做一个动作,多段攻击", "多段攻击")]
  997. public bool IsSingleAction = false;
  998. [DependOnProperty("IsSingleAction")]
  999. [DescAttribute("多段攻击间隔有效时间", "多段攻击")]
  1000. public int SingleActionCoolDownMS = 500;
  1001. //------------------------------------
  1002. [DescAttribute("攻击距离", "攻击范围")]
  1003. public float AttackRange = 3;
  1004. [DescAttribute("攻击角度范围(弧度)\n如果角度为0,则为单体攻击", "攻击范围")]
  1005. public float AttackAngle = 0;
  1006. [DescAttribute("单体攻击,只在目标处于攻击范围才产生伤害", "攻击范围")]
  1007. public bool AttackMustBeInRange = true;
  1008. [DescAttribute("保持攻击距离(NPC会保持一段距离再攻击)大于0启效", "攻击范围")]
  1009. public float AttackKeepRange = 0;
  1010. [DescAttribute("自动战斗,跟随目标", "攻击范围")]
  1011. public bool AutoFightFollower = false;
  1012. //------------------------------------
  1013. [DescAttribute("技能当前储存次数")]
  1014. public short CurUseTimes = -1;
  1015. [DescAttribute("法术是否从自己身上发出", "释放")]
  1016. public bool IsLaunchBody = true;
  1017. [DescAttribute("吟唱时间(毫秒)大于0启效", "释放")]
  1018. public int ChantTimeMS = 0;
  1019. //------------------------------------
  1020. public enum CastTarget : byte
  1021. {
  1022. [DescAttribute("敌人")]
  1023. Enemy = 0,
  1024. [DescAttribute("友军")]
  1025. Alias = 1,
  1026. [DescAttribute("自己")]
  1027. Self = 2,
  1028. [DescAttribute("宠物为主人")]
  1029. PetForMaster = 3,
  1030. [DescAttribute("任何单位")]
  1031. EveryOne = 4,
  1032. [DescAttribute("无类型")]
  1033. NA = 5,
  1034. [DescAttribute("除自己之外友军")]
  1035. AlliesExcludeSelf = 6,
  1036. [DescAttribute("包括自己友军")]
  1037. AlliesIncludeSelf = 7,
  1038. [DescAttribute("除自己之外所有")]
  1039. EveryOneExcludeSelf = 8,
  1040. [DescAttribute("自己和敌人")]
  1041. EnemyAndSelf = 9,
  1042. }
  1043. [DescAttribute("技能期望作用目标", "释放")]
  1044. public CastTarget ExpectTarget = CastTarget.Enemy;
  1045. //------------------------------------
  1046. public enum SelectRange : byte
  1047. {
  1048. [DescAttribute("无")]
  1049. NA,
  1050. [DescAttribute("圆形区域")]
  1051. Round,
  1052. [DescAttribute("直线")]
  1053. Line,
  1054. [DescAttribute("矩形区域")]
  1055. Rect,
  1056. [DescAttribute("扇形区域")]
  1057. Fan,
  1058. }
  1059. //------------------------------------
  1060. [DescAttribute("释放时是否选择方向", "释放范围")]
  1061. public bool IsSelectRange = false;
  1062. [DependOnProperty("IsSelectRange")]
  1063. [DescAttribute("选择方向类型", "释放范围")]
  1064. public SelectRange SelectRangeType = SelectRange.NA;
  1065. [DependOnProperty("IsSelectRange")]
  1066. [DescAttribute("选择方向尺寸", "释放范围")]
  1067. public float SelectRangeSize;
  1068. //------------------------------------
  1069. [DescAttribute("释放消耗血量", "消耗")]
  1070. public int CostHP;
  1071. [DescAttribute("释放消耗法力", "消耗")]
  1072. public int CostMP;
  1073. //------------------------------------
  1074. /// <summary>
  1075. /// 用户自定义扩展属性
  1076. /// </summary>
  1077. [DescAttribute("扩展属性", "扩展")]
  1078. [Expandable]
  1079. [NotNull]
  1080. public ISkillProperties Properties = TemplateManager.Factory.CreateSkillProperties();
  1081. //------------------------------------
  1082. public SkillTemplate() { }
  1083. public SkillTemplate(int id)
  1084. {
  1085. this.ID = id;
  1086. }
  1087. public int GetID()
  1088. {
  1089. return ID;
  1090. }
  1091. public override string ToString()
  1092. {
  1093. return Name + "(" + ID + ")";
  1094. }
  1095. public UnitActionData GetActionByName(string name)
  1096. {
  1097. foreach (UnitActionData act in ActionQueue)
  1098. {
  1099. if (name.Equals(act.ActionName))
  1100. {
  1101. return act;
  1102. }
  1103. }
  1104. return null;
  1105. }
  1106. public int ToUnitSkillTotalTime(float fastCastRate)
  1107. {
  1108. return (int)(this.CoolDownMS * Math.Max(0, 1f - fastCastRate));
  1109. }
  1110. public int ActionQueueTimeMS
  1111. {
  1112. get
  1113. {
  1114. int ret = 0;
  1115. for (int i = 0; i < ActionQueue.Count; i++)
  1116. {
  1117. ret += ActionQueue[i].TotalTimeMS;
  1118. }
  1119. return ret;
  1120. }
  1121. }
  1122. public int[] ActionQueueTimeArray
  1123. {
  1124. get
  1125. {
  1126. int[] ret = new int[ActionQueue.Count];
  1127. for (int i = ret.Length - 1; i >= 0; --i)
  1128. {
  1129. ret[i] = ActionQueue[i].TotalTimeMS;
  1130. }
  1131. return ret;
  1132. }
  1133. }
  1134. public object Clone()
  1135. {
  1136. SkillTemplate ret = new SkillTemplate();
  1137. ret.EditorPath = this.EditorPath;
  1138. ret.ID = this.ID;
  1139. ret.Name = this.Name;
  1140. ret.IconName = this.IconName;
  1141. ret.ActionQueue = CUtils.CloneList<UnitActionData>(this.ActionQueue);
  1142. ret.IsSingleAction = this.IsSingleAction;
  1143. ret.SingleActionCoolDownMS = this.SingleActionCoolDownMS;
  1144. ret.IsCoolDownWithAction = this.IsCoolDownWithAction;
  1145. ret.IsCounter = this.IsCounter;
  1146. ret.ActionPriority = this.ActionPriority;
  1147. ret.CoolDownMS = this.CoolDownMS;
  1148. ret.ActionSpeedRate = this.ActionSpeedRate;
  1149. ret.IsManuallyCancelable = this.IsManuallyCancelable;
  1150. ret.IgnoreMyUncancelable = this.IgnoreMyUncancelable;
  1151. ret.BodyScale = this.BodyScale;
  1152. ret.AttackRange = this.AttackRange;
  1153. ret.AttackAngle = this.AttackAngle;
  1154. ret.AttackMustBeInRange = this.AttackMustBeInRange;
  1155. ret.AttackKeepRange = this.AttackKeepRange;
  1156. ret.AutoFightFollower = this.AutoFightFollower;
  1157. ret.IsLaunchBody = this.IsLaunchBody;
  1158. ret.ChantTimeMS = this.ChantTimeMS;
  1159. ret.IsSelectRange = this.IsSelectRange;
  1160. ret.SelectRangeType = this.SelectRangeType;
  1161. ret.SelectRangeSize = this.SelectRangeSize;
  1162. ret.CostHP = this.CostHP;
  1163. ret.CostMP = this.CostMP;
  1164. ret.ExpectTarget = this.ExpectTarget;
  1165. //ret.CurUseTimes = this.CurUseTimes;
  1166. ret.Properties = CUtils.TryClone<ISkillProperties>(this.Properties);
  1167. return ret;
  1168. }
  1169. public void WriteExternal(IOutputStream output)
  1170. {
  1171. output.PutUTF(this.EditorPath);
  1172. output.PutS32(this.ID);
  1173. output.PutUTF(this.Name);
  1174. output.PutUTF(this.IconName);
  1175. output.PutList(this.ActionQueue, output.PutExt);
  1176. output.PutBool(this.IsSingleAction);
  1177. output.PutS32(this.SingleActionCoolDownMS);
  1178. output.PutBool(this.IsCoolDownWithAction);
  1179. output.PutBool(this.IsCounter);
  1180. output.PutS32(this.ActionPriority);
  1181. output.PutS32(this.CoolDownMS);
  1182. output.PutF32(this.ActionSpeedRate);
  1183. output.PutBool(this.IsManuallyCancelable);
  1184. output.PutBool(this.IgnoreMyUncancelable);
  1185. output.PutF32(this.BodyScale);
  1186. output.PutF32(this.AttackRange);
  1187. output.PutF32(this.AttackAngle);
  1188. output.PutBool(this.AttackMustBeInRange);
  1189. output.PutF32(this.AttackKeepRange);
  1190. output.PutBool(this.AutoFightFollower);
  1191. output.PutBool(this.IsLaunchBody);
  1192. output.PutS32(this.ChantTimeMS);
  1193. output.PutBool(this.IsSelectRange);
  1194. output.PutEnum8(this.SelectRangeType);
  1195. output.PutF32(this.SelectRangeSize);
  1196. output.PutS32(this.CostHP);
  1197. output.PutS32(this.CostMP);
  1198. output.PutEnum8(this.ExpectTarget);
  1199. output.PutS16(this.CurUseTimes);
  1200. output.PutExt(this.Properties);
  1201. }
  1202. public void ReadExternal(IInputStream input)
  1203. {
  1204. this.EditorPath = input.GetUTF();
  1205. this.ID = input.GetS32();
  1206. this.Name = input.GetUTF();
  1207. this.IconName = input.GetUTF();
  1208. this.ActionQueue = input.GetList<UnitActionData>(input.GetExt<UnitActionData>);
  1209. this.IsSingleAction = input.GetBool();
  1210. this.SingleActionCoolDownMS = input.GetS32();
  1211. this.IsCoolDownWithAction = input.GetBool();
  1212. this.IsCounter = input.GetBool();
  1213. this.ActionPriority = input.GetS32();
  1214. this.CoolDownMS = input.GetS32();
  1215. this.ActionSpeedRate = input.GetF32();
  1216. this.IsManuallyCancelable = input.GetBool();
  1217. this.IgnoreMyUncancelable = input.GetBool();
  1218. this.BodyScale = input.GetF32();
  1219. this.AttackRange = input.GetF32();
  1220. this.AttackAngle = input.GetF32();
  1221. this.AttackMustBeInRange = input.GetBool();
  1222. this.AttackKeepRange = input.GetF32();
  1223. this.AutoFightFollower = input.GetBool();
  1224. this.IsLaunchBody = input.GetBool();
  1225. this.ChantTimeMS = input.GetS32();
  1226. this.IsSelectRange = input.GetBool();
  1227. this.SelectRangeType = input.GetEnum8<SelectRange>();
  1228. this.SelectRangeSize = input.GetF32();
  1229. this.CostHP = input.GetS32();
  1230. this.CostMP = input.GetS32();
  1231. this.ExpectTarget = input.GetEnum8<CastTarget>();
  1232. this.CurUseTimes = input.GetS16();
  1233. this.Properties = input.GetExt<ISkillProperties>(this.Properties);
  1234. }
  1235. }
  1236. //---------------------------------------------------------------------------------//
  1237. /// <summary>
  1238. /// 单位动作模板
  1239. /// </summary>
  1240. [MessageType(0x4004)]
  1241. [DescAttribute("单位动作")]
  1242. [Expandable]
  1243. public class UnitActionData : ICloneable, IExternalizable
  1244. {
  1245. [DescAttribute("总动作时间(毫秒)", "Action")]
  1246. public int TotalTimeMS;
  1247. [DescAttribute("动作播放速率增加(加法)", "动作")]
  1248. public float ActionSpeedRate = 0.0f;
  1249. [DescAttribute("单一动作类型,0-普通, 1,蓄力动作,2-多段式动作", "Action")]
  1250. //蓄力动作,显示倒计时圈
  1251. //多段式动作,显示倒计时圈 + 倒计时
  1252. public ActionEnum SigleActionType;
  1253. [DescAttribute("动作名字, IsSingleAction=false才有效", "Action")]
  1254. public string ActionName;
  1255. [DependOnProperty("IsControlMoveable", true)]
  1256. [DescAttribute("移动动作名字", "Action")]
  1257. public string MoveActionName;
  1258. [DescAttribute("动作对应的特效,通常用作刀光", "Action")]
  1259. [ResourceIDAttribute]
  1260. public string ActionEffectFileName;
  1261. [DescAttribute("动作是否循环", "Action")]
  1262. public bool IsCycAction;
  1263. [DescAttribute("显示蓄力倒计时条时间(毫秒)", "Action")]
  1264. public int ShowChargeTimeMS = 0;
  1265. [DescAttribute("移动可取消动作", "状态")]
  1266. public bool IsCancelable = false;
  1267. [DescAttribute("技能可取消动作", "状态")]
  1268. public bool IsCancelableBySkill = false;
  1269. [DescAttribute("技能能否被下一段替代", "状态")]
  1270. public bool IsCancelBySkillNext = false;
  1271. [DescAttribute("是否进入霸体状态,不会被打断", "状态")]
  1272. public bool IsNoneBlock = false;
  1273. [DescAttribute("动作期间是否无碰撞", "状态")]
  1274. public bool IsNoneTouch = false;
  1275. [DescAttribute("动作中是否面向目标", "状态")]
  1276. public bool IsFaceToTarget = true;
  1277. [DescAttribute("动作是否隐身", "状态")]
  1278. public bool IsInvisible = false;
  1279. [DescAttribute("动作中是否可以控制移动", "状态")]
  1280. public bool IsControlMoveable = false;
  1281. [DescAttribute("动作中可以控制转向", "状态")]
  1282. public bool IsControlFaceable = false;
  1283. //新增动作对应Icon
  1284. [DescAttribute("是否换图", "资源")]
  1285. public bool IsChangeIcon = false;
  1286. [DescAttribute("图片名字", "资源")]
  1287. [DependOnProperty("IsChangeIcon", true)]
  1288. public string IconName;
  1289. [DescAttribute("攻击范围改变", "攻击范围")]
  1290. public AttackShape OverrideAttackShape;
  1291. /// <summary>
  1292. /// 所有关键帧
  1293. /// </summary>
  1294. [DescAttribute("所有关键帧", "关键帧")]
  1295. public List<KeyFrame> KeyFrames = new List<KeyFrame>();
  1296. public bool IsBodyHit
  1297. {
  1298. get
  1299. {
  1300. if (IsMoveToTarget) return false;
  1301. if (IsJumpToTarget) return false;
  1302. return BodyHit != null;
  1303. }
  1304. }
  1305. /// <summary>
  1306. /// 身体攻击判定
  1307. /// </summary>
  1308. [DependOnProperty("IsMoveToTarget", false)]
  1309. [DependOnProperty("IsJumpToTarget", false)]
  1310. [DescAttribute("身体攻击判定", "身体攻击")]
  1311. public AttackProp BodyHit;
  1312. [DependOnProperty("IsBodyHit")]
  1313. [DescAttribute("身体攻击判定范围", "身体攻击")]
  1314. public float BodyHitSize;
  1315. [DependOnProperty("IsBodyHit")]
  1316. [DescAttribute("身体攻击后立即切换动作", "身体攻击")]
  1317. public bool BodyHitNextAction;
  1318. [DescAttribute("移动到目标", "位移 - 冲锋")]
  1319. public bool IsMoveToTarget = false;
  1320. [DescAttribute("移动到目标速度", "位移 - 冲锋")]
  1321. [DependOnProperty("IsMoveToTarget")]
  1322. public float MoveToTargetSpeedSEC = 10;
  1323. [DescAttribute("移动到目标根据(距离/动作时间)来算速度,如果目标在原地,则原地跳跃。", "位移 - 跳跃")]
  1324. [DependOnProperty("IsMoveToTarget", false)]
  1325. public bool IsJumpToTarget = false;
  1326. [DescAttribute("跳跃高度", "位移 - 跳跃")]
  1327. [DependOnProperty("IsJumpToTarget")]
  1328. public float JumpToTargetHeightZ = 1;
  1329. [DescAttribute("在攻击范围内,如果位移则挤开目标", "碰撞")]
  1330. [DependOnProperty("IsMoveToTarget", false)]
  1331. [DependOnProperty("IsJumpToTarget", false)]
  1332. public bool BodyBlockOnAttackRange = false;
  1333. [DescAttribute("显示技能引导光圈(必须先打开扩展属性中的ShowLaunchGuide)", "控制")]
  1334. public bool IsShowSkillGuide = false;
  1335. [DescAttribute("增加技能按钮遮罩", "资源")]
  1336. public bool IsAddSkillBtnBlock = false;
  1337. [DescAttribute("动作的音效文件名", "资源")]
  1338. public string ActionAudioName;
  1339. [DescAttribute("动作的音效文件是否循环播放", "资源")]
  1340. public bool IsAudioLoop;
  1341. public UnitActionData() { }
  1342. public override string ToString()
  1343. {
  1344. return "动作: " + ActionName + " (" + TotalTimeMS + "(毫秒))";
  1345. }
  1346. public object Clone()
  1347. {
  1348. UnitActionData ret = new UnitActionData();
  1349. ret.TotalTimeMS = this.TotalTimeMS;
  1350. ret.ActionName = this.ActionName;
  1351. ret.ActionEffectFileName = this.ActionEffectFileName;
  1352. ret.IsCycAction = this.IsCycAction;
  1353. ret.IsCancelable = this.IsCancelable;
  1354. ret.IsCancelableBySkill = this.IsCancelableBySkill;
  1355. ret.IsCancelBySkillNext = this.IsCancelBySkillNext;
  1356. ret.IsNoneBlock = this.IsNoneBlock;
  1357. ret.IsNoneTouch = this.IsNoneTouch;
  1358. ret.IsFaceToTarget = this.IsFaceToTarget;
  1359. ret.IsInvisible = this.IsInvisible;
  1360. ret.IsControlMoveable = this.IsControlMoveable;
  1361. ret.IsControlFaceable = this.IsControlFaceable;
  1362. ret.IsChangeIcon = this.IsChangeIcon;
  1363. ret.IconName = this.IconName;
  1364. ret.OverrideAttackShape = CUtils.TryClone<AttackShape>(this.OverrideAttackShape);
  1365. ret.KeyFrames = CUtils.CloneList<KeyFrame>(this.KeyFrames);
  1366. ret.BodyHit = CUtils.TryClone<AttackProp>(this.BodyHit);
  1367. ret.BodyHitSize = this.BodyHitSize;
  1368. ret.BodyHitNextAction = this.BodyHitNextAction;
  1369. ret.IsMoveToTarget = this.IsMoveToTarget;
  1370. ret.MoveToTargetSpeedSEC = this.MoveToTargetSpeedSEC;
  1371. ret.IsJumpToTarget = this.IsJumpToTarget;
  1372. ret.JumpToTargetHeightZ = this.JumpToTargetHeightZ;
  1373. ret.BodyBlockOnAttackRange = this.BodyBlockOnAttackRange;
  1374. ret.IsShowSkillGuide = this.IsShowSkillGuide;
  1375. ret.SigleActionType = this.SigleActionType;
  1376. ret.MoveActionName = this.MoveActionName;
  1377. ret.ActionSpeedRate = this.ActionSpeedRate;
  1378. ret.IsAddSkillBtnBlock = this.IsAddSkillBtnBlock;
  1379. ret.ActionAudioName = this.ActionAudioName;
  1380. ret.IsAudioLoop = this.IsAudioLoop;
  1381. return ret;
  1382. }
  1383. public void WriteExternal(IOutputStream output)
  1384. {
  1385. output.PutS32(this.TotalTimeMS);
  1386. output.PutUTF(this.ActionName);
  1387. output.PutUTF(this.ActionEffectFileName);
  1388. output.PutBool(this.IsCycAction);
  1389. output.PutBool(this.IsCancelable);
  1390. output.PutBool(this.IsCancelableBySkill);
  1391. output.PutBool(this.IsCancelBySkillNext);
  1392. output.PutBool(this.IsNoneBlock);
  1393. output.PutBool(this.IsNoneTouch);
  1394. output.PutBool(this.IsFaceToTarget);
  1395. output.PutBool(this.IsInvisible);
  1396. output.PutBool(this.IsControlMoveable);
  1397. output.PutBool(this.IsControlFaceable);
  1398. output.PutBool(this.IsChangeIcon);
  1399. output.PutUTF(this.IconName);
  1400. output.PutExt(this.OverrideAttackShape);
  1401. output.PutList<KeyFrame>(this.KeyFrames, output.PutExt);
  1402. output.PutExt(this.BodyHit);
  1403. output.PutF32(this.BodyHitSize);
  1404. output.PutBool(this.BodyHitNextAction);
  1405. output.PutBool(this.IsMoveToTarget);
  1406. output.PutF32(this.MoveToTargetSpeedSEC);
  1407. output.PutBool(this.IsJumpToTarget);
  1408. output.PutF32(this.JumpToTargetHeightZ);
  1409. output.PutBool(this.BodyBlockOnAttackRange);
  1410. output.PutBool(this.IsShowSkillGuide);
  1411. output.PutEnum8(this.SigleActionType);
  1412. output.PutUTF(this.MoveActionName);
  1413. output.PutF32(this.ActionSpeedRate);
  1414. output.PutBool(this.IsAddSkillBtnBlock);
  1415. output.PutUTF(this.ActionAudioName);
  1416. output.PutBool(this.IsAudioLoop);
  1417. }
  1418. public void ReadExternal(IInputStream input)
  1419. {
  1420. this.TotalTimeMS = input.GetS32();
  1421. this.ActionName = input.GetUTF();
  1422. this.ActionEffectFileName = input.GetUTF();
  1423. this.IsCycAction = input.GetBool();
  1424. this.IsCancelable = input.GetBool();
  1425. this.IsCancelableBySkill = input.GetBool();
  1426. this.IsCancelBySkillNext = input.GetBool();
  1427. this.IsNoneBlock = input.GetBool();
  1428. this.IsNoneTouch = input.GetBool();
  1429. this.IsFaceToTarget = input.GetBool();
  1430. this.IsInvisible = input.GetBool();
  1431. this.IsControlMoveable = input.GetBool();
  1432. this.IsControlFaceable = input.GetBool();
  1433. this.IsChangeIcon = input.GetBool();
  1434. this.IconName = input.GetUTF();
  1435. this.OverrideAttackShape = input.GetExt<AttackShape>();
  1436. this.KeyFrames = input.GetList<KeyFrame>(input.GetExt<KeyFrame>);
  1437. this.BodyHit = input.GetExt<AttackProp>();
  1438. this.BodyHitSize = input.GetF32();
  1439. this.BodyHitNextAction = input.GetBool();
  1440. this.IsMoveToTarget = input.GetBool();
  1441. this.MoveToTargetSpeedSEC = input.GetF32();
  1442. this.IsJumpToTarget = input.GetBool();
  1443. this.JumpToTargetHeightZ = input.GetF32();
  1444. this.BodyBlockOnAttackRange = input.GetBool();
  1445. this.IsShowSkillGuide = input.GetBool();
  1446. this.SigleActionType = input.GetEnum8<ActionEnum>();
  1447. this.MoveActionName = input.GetUTF();
  1448. this.ActionSpeedRate = input.GetF32();
  1449. this.IsAddSkillBtnBlock = input.GetBool();
  1450. this.ActionAudioName = input.GetUTF();
  1451. this.IsAudioLoop = input.GetBool();
  1452. }
  1453. //------------------------------------------------------------
  1454. /// <summary>
  1455. /// 动作状态数据
  1456. /// </summary>
  1457. [MessageType(0x4107)]
  1458. [DescAttribute("动作关键帧数据")]
  1459. [Expandable]
  1460. public class StatusChange : ICloneable, IExternalizable
  1461. {
  1462. [DescAttribute("移动可取消动作", "状态")]
  1463. public bool IsCancelable = false;
  1464. [DescAttribute("技能可取消动作", "状态")]
  1465. public bool IsCancelableBySkill = false;
  1466. [DescAttribute("是否进入霸体状态,不会被打断", "状态")]
  1467. public bool IsNoneBlock = false;
  1468. [DescAttribute("动作期间是否无碰撞", "状态")]
  1469. public bool IsNoneTouch = false;
  1470. [DescAttribute("动作中是否面向目标", "状态")]
  1471. public bool IsFaceToTarget = false;
  1472. [DescAttribute("动作是否隐身", "状态")]
  1473. public bool IsInvisible = false;
  1474. [DescAttribute("动作中是否可以控制移动", "状态")]
  1475. public bool IsControlMoveable = false;
  1476. [DescAttribute("动作中可以控制转向", "状态")]
  1477. public bool IsControlFaceable = false;
  1478. public override string ToString()
  1479. {
  1480. return string.Format("{0}{1}{2}{3}{4}{5}{6}{7}",
  1481. IsCancelable ? "移动可取消," : "",
  1482. IsCancelableBySkill ? "技能可取消," : "",
  1483. IsNoneBlock ? "霸体," : "",
  1484. IsNoneTouch ? "无碰撞," : "",
  1485. IsFaceToTarget ? "面向目标," : "",
  1486. IsInvisible ? "隐身," : "",
  1487. IsControlMoveable ? "可控制移动," : "",
  1488. IsControlFaceable ? "可控制转向," : "");
  1489. }
  1490. public object Clone()
  1491. {
  1492. StatusChange ret = new StatusChange();
  1493. ret.IsCancelable = this.IsCancelable;
  1494. ret.IsCancelableBySkill = this.IsCancelableBySkill;
  1495. ret.IsNoneBlock = this.IsNoneBlock;
  1496. ret.IsNoneTouch = this.IsNoneTouch;
  1497. ret.IsFaceToTarget = this.IsFaceToTarget;
  1498. ret.IsInvisible = this.IsInvisible;
  1499. ret.IsControlMoveable = this.IsControlMoveable;
  1500. ret.IsControlFaceable = this.IsControlFaceable;
  1501. return ret;
  1502. }
  1503. public void WriteExternal(IOutputStream output)
  1504. {
  1505. output.PutBool(this.IsCancelable);
  1506. output.PutBool(this.IsCancelableBySkill);
  1507. output.PutBool(this.IsNoneBlock);
  1508. output.PutBool(this.IsNoneTouch);
  1509. output.PutBool(this.IsFaceToTarget);
  1510. output.PutBool(this.IsInvisible);
  1511. output.PutBool(this.IsControlMoveable);
  1512. output.PutBool(this.IsControlFaceable);
  1513. }
  1514. public void ReadExternal(IInputStream input)
  1515. {
  1516. this.IsCancelable = input.GetBool();
  1517. this.IsCancelableBySkill = input.GetBool();
  1518. this.IsNoneBlock = input.GetBool();
  1519. this.IsNoneTouch = input.GetBool();
  1520. this.IsFaceToTarget = input.GetBool();
  1521. this.IsInvisible = input.GetBool();
  1522. this.IsControlMoveable = input.GetBool();
  1523. this.IsControlFaceable = input.GetBool();
  1524. }
  1525. }
  1526. //------------------------------------------------------------
  1527. [MessageType(0x4108)]
  1528. [DescAttribute("动作攻击范围")]
  1529. [Expandable]
  1530. public class AttackShape : ICloneable, IExternalizable
  1531. {
  1532. public enum Shape : byte
  1533. {
  1534. [DescAttribute("单体")]
  1535. Single = CommonAI.Zone.Helper.AttackShape.Single,
  1536. [DescAttribute("圆形")]
  1537. Round = CommonAI.Zone.Helper.AttackShape.Round,
  1538. [DescAttribute("扇形")]
  1539. Fan = CommonAI.Zone.Helper.AttackShape.Fan,
  1540. [DescAttribute("胶囊条状")]
  1541. Strip = CommonAI.Zone.Helper.AttackShape.Strip,
  1542. [DescAttribute("胶囊射线(以原点出去)")]
  1543. StripRay = CommonAI.Zone.Helper.AttackShape.StripRay,
  1544. [DescAttribute("胶囊射线,接触到最近")]
  1545. StripRayTouchEnd = CommonAI.Zone.Helper.AttackShape.StripRayTouchEnd,
  1546. [DescAttribute("方形条状")]
  1547. RectStrip = CommonAI.Zone.Helper.AttackShape.RectStrip,
  1548. [DescAttribute("方形射线(以原点出去)")]
  1549. RectStripRay = CommonAI.Zone.Helper.AttackShape.RectStripRay,
  1550. [DescAttribute("横向胶囊条状")]
  1551. WideStrip = CommonAI.Zone.Helper.AttackShape.WideStrip,
  1552. [DescAttribute("圆环,中间是空的")]
  1553. Circle = CommonAI.Zone.Helper.AttackShape.Circle,
  1554. }
  1555. [DescAttribute("攻击范围类型", "攻击范围")]
  1556. public Shape AShape = Shape.Round;
  1557. [DescAttribute("半径(Round, Fan, Circle)长度(Strip, StripRay,StripRayTouchEnd, RectStrip, RectStripRay, LineToTarget, WideStrip)", "攻击范围")]
  1558. public float AttackRange = 1;
  1559. [DescAttribute("角度(Fan)", "攻击范围")]
  1560. [DependOnProperty("IsShapeFan")]
  1561. public float AttackAngle = 1;
  1562. [DescAttribute("宽度,粗度(Strip, StripRay,StripRayTouchEnd,RectStrip, RectStripRay, WideStrip),环粗度(Circle)", "攻击范围")]
  1563. [DependOnProperty("IsShapeStrip")]
  1564. public float StripWide = 1;
  1565. [DescAttribute("初始点偏移", "身体")]
  1566. public float OffsetRadius = 0;
  1567. public bool IsSingle { get { return AShape == Shape.Single; } }
  1568. public bool IsShapeFan { get { return AShape == Shape.Fan; } }
  1569. public bool IsShapeStrip
  1570. {
  1571. get
  1572. {
  1573. switch (AShape)
  1574. {
  1575. case Shape.Strip:
  1576. case Shape.StripRay:
  1577. case Shape.StripRayTouchEnd:
  1578. case Shape.Circle:
  1579. case Shape.RectStrip:
  1580. case Shape.RectStripRay:
  1581. case Shape.WideStrip:
  1582. return true;
  1583. }
  1584. return false;
  1585. }
  1586. }
  1587. public override string ToString()
  1588. {
  1589. return string.Format("重定向攻击范围:{0}", AShape);
  1590. }
  1591. public object Clone()
  1592. {
  1593. AttackShape ret = new AttackShape();
  1594. ret.AShape = this.AShape;
  1595. ret.AttackRange = this.AttackRange;
  1596. ret.AttackAngle = this.AttackAngle;
  1597. ret.StripWide = this.StripWide;
  1598. ret.OffsetRadius = this.OffsetRadius;
  1599. return ret;
  1600. }
  1601. public void WriteExternal(IOutputStream output)
  1602. {
  1603. output.PutEnum8(this.AShape);
  1604. output.PutF32(this.AttackRange);
  1605. output.PutF32(this.AttackAngle);
  1606. output.PutF32(this.StripWide);
  1607. output.PutF32(this.OffsetRadius);
  1608. }
  1609. public void ReadExternal(IInputStream input)
  1610. {
  1611. this.AShape = input.GetEnum8<Shape>();
  1612. this.AttackRange = input.GetF32();
  1613. this.AttackAngle = input.GetF32();
  1614. this.StripWide = input.GetF32();
  1615. this.OffsetRadius = input.GetF32();
  1616. }
  1617. }
  1618. //-------------------------------------------------------------------------------------
  1619. //------------------------------------------------------------
  1620. [MessageType(0x4109)]
  1621. [DescAttribute("动作攻击范围")]
  1622. [Expandable]
  1623. public class ThrowTarget : ICloneable, IExternalizable
  1624. {
  1625. public override string ToString()
  1626. {
  1627. return string.Format("重定向攻击范");
  1628. }
  1629. public object Clone()
  1630. {
  1631. ThrowTarget ret = new ThrowTarget();
  1632. return ret;
  1633. }
  1634. public void WriteExternal(IOutputStream output)
  1635. {
  1636. }
  1637. public void ReadExternal(IInputStream input)
  1638. {
  1639. }
  1640. }
  1641. //-------------------------------------------------------------------------------------
  1642. //------------------------------------------------------------
  1643. /// <summary>
  1644. /// 动作关键帧数据
  1645. /// </summary>
  1646. [MessageType(0x4104)]
  1647. [DescAttribute("动作关键帧数据")]
  1648. [Expandable]
  1649. public class KeyFrame : BaseKeyFrame, ICloneable, IExternalizable
  1650. {
  1651. /// <summary>
  1652. /// 关键帧产生的法术或远程道具单位模板ID
  1653. /// </summary>
  1654. [DescAttribute("关键帧产生的法术或远程道具单位模板ID")]
  1655. public LaunchSpell Spell;
  1656. /// <summary>
  1657. /// 当前关键帧特效
  1658. /// </summary>
  1659. [DescAttribute("当前关键帧特效ID")]
  1660. public LaunchEffect Effect;
  1661. /// <summary>
  1662. /// 攻击属性
  1663. /// </summary>
  1664. [DescAttribute("攻击属性ID")]
  1665. public AttackProp Attack;
  1666. /// <summary>
  1667. /// 对自己产生BUFF
  1668. /// </summary>
  1669. [DescAttribute("对自己产生BUFF")]
  1670. public LaunchBuff SelfBuff;
  1671. /// <summary>
  1672. /// 此动作关键帧产生的位移
  1673. /// </summary>
  1674. [DescAttribute("此动作关键帧产生的位移")]
  1675. public StartMove Move;
  1676. [DescAttribute("位移在有打击目标时是否生效")]
  1677. public bool hitTargetMoveEnable = true;
  1678. [DescAttribute("闪现位移")]
  1679. public BlinkMove Blink;
  1680. [DescAttribute("动作状态改变")]
  1681. public StatusChange ChangeStatus;
  1682. public KeyFrame() { }
  1683. public override string ToString()
  1684. {
  1685. return "Frame: @" + FrameMS;
  1686. }
  1687. public object Clone()
  1688. {
  1689. KeyFrame ret = new KeyFrame();
  1690. ret.FrameMS = base.FrameMS;
  1691. ret.Spell = CUtils.TryClone<LaunchSpell>(this.Spell);
  1692. ret.Effect = CUtils.TryClone<LaunchEffect>(this.Effect);
  1693. ret.Attack = CUtils.TryClone<AttackProp>(this.Attack);
  1694. ret.SelfBuff = CUtils.TryClone<LaunchBuff>(this.SelfBuff);
  1695. ret.Move = CUtils.TryClone<StartMove>(this.Move);
  1696. ret.hitTargetMoveEnable = this.hitTargetMoveEnable;
  1697. ret.Blink = CUtils.TryClone<BlinkMove>(this.Blink);
  1698. ret.ChangeStatus = CUtils.TryClone<StatusChange>(this.ChangeStatus);
  1699. return ret;
  1700. }
  1701. public void WriteExternal(IOutputStream output)
  1702. {
  1703. output.PutS32(base.FrameMS);
  1704. output.PutExt(this.Spell);
  1705. output.PutExt(this.Effect);
  1706. output.PutExt(this.Attack);
  1707. output.PutExt(this.SelfBuff);
  1708. output.PutExt(this.Move);
  1709. output.PutBool(this.hitTargetMoveEnable);
  1710. output.PutExt(this.Blink);
  1711. output.PutExt(this.ChangeStatus);
  1712. }
  1713. public void ReadExternal(IInputStream input)
  1714. {
  1715. base.FrameMS = input.GetS32();
  1716. this.Spell = input.GetExt<LaunchSpell>();
  1717. this.Effect = input.GetExt<LaunchEffect>();
  1718. this.Attack = input.GetExt<AttackProp>();
  1719. this.SelfBuff = input.GetExt<LaunchBuff>();
  1720. this.Move = input.GetExt<StartMove>();
  1721. this.hitTargetMoveEnable = input.GetBool();
  1722. this.Blink = input.GetExt<BlinkMove>();
  1723. this.ChangeStatus = input.GetExt<StatusChange>();
  1724. }
  1725. }
  1726. }
  1727. //---------------------------------------------------------------------------------//
  1728. /// <summary>
  1729. /// 单位行为触发器
  1730. /// </summary>
  1731. [MessageType(0x4010)]
  1732. [DescAttribute("单位行为触发器")]
  1733. [TableClassAttribute("ID")]
  1734. public class UnitTriggerTemplate : ICloneable, ITemplateData, IExternalizable
  1735. {
  1736. public int TemplateID { get { return ID; } }
  1737. [XmlSerializable()]
  1738. public string EditorPath { get; set; }
  1739. [DescAttribute("ID", "基础", false)]
  1740. public int ID;
  1741. [LocalizationTextAttribute]
  1742. [DescAttribute("触发器名字", "基础")]
  1743. public string Name;
  1744. [DescAttribute("触发器冷却时间", "基础")]
  1745. public int CoolDownTimeMS = 10000;
  1746. [DescAttribute("事件触发条件(所有的关系为与)", "条件")]
  1747. [ListAttribute(typeof(UnitTriggers.BaseTriggerEvent))]
  1748. public List<UnitTriggers.BaseTriggerEvent> Triggers = new List<UnitTriggers.BaseTriggerEvent>();
  1749. [DescAttribute("释放技能", "动作")]
  1750. public LaunchSkill DoSkill;
  1751. [DescAttribute("产生Buff", "动作")]
  1752. public LaunchBuff DoBuff;
  1753. [DescAttribute("产生法术", "动作")]
  1754. public LaunchSpell DoSpell;
  1755. [DescAttribute("产生特效(图形)", "动作")]
  1756. public LaunchEffect DoEffect;
  1757. /// <summary>
  1758. /// 召唤小弟
  1759. /// </summary>
  1760. [DescAttribute("召唤小弟", "动作")]
  1761. public SummonUnit DoSummon;
  1762. //------------------------------------
  1763. /// <summary>
  1764. /// 用户自定义扩展属性
  1765. /// </summary>
  1766. [DescAttribute("扩展属性", "扩展")]
  1767. [Expandable]
  1768. [NotNull]
  1769. public IUnitTriggerProperties Properties = TemplateManager.Factory.CreateTriggerProperties();
  1770. public override string ToString()
  1771. {
  1772. return Name + "(" + ID + ")";
  1773. }
  1774. public string FunctionText()
  1775. {
  1776. StringBuilder sb = new StringBuilder();
  1777. if (Triggers.Count > 0)
  1778. {
  1779. foreach (UnitTriggers.BaseTriggerEvent e in Triggers)
  1780. {
  1781. sb.Append(string.Format("{0}", e));
  1782. if (e != Triggers[Triggers.Count - 1])
  1783. {
  1784. sb.Append(" 并且 ");
  1785. }
  1786. }
  1787. if (DoSkill != null) sb.Append("," + DoSkill);
  1788. if (DoBuff != null) sb.Append("," + DoBuff);
  1789. if (DoSpell != null) sb.Append("," + DoSpell);
  1790. if (DoEffect != null) sb.Append("," + DoEffect);
  1791. }
  1792. return sb.ToString();
  1793. }
  1794. public object Clone()
  1795. {
  1796. UnitTriggerTemplate ret = new UnitTriggerTemplate();
  1797. ret.EditorPath = this.EditorPath;
  1798. ret.ID = this.ID;
  1799. ret.Name = this.Name;
  1800. ret.CoolDownTimeMS = this.CoolDownTimeMS;
  1801. ret.Triggers = CUtils.CloneList<UnitTriggers.BaseTriggerEvent>(this.Triggers);
  1802. ret.DoSkill = CUtils.TryClone<LaunchSkill>(this.DoSkill);
  1803. ret.DoBuff = CUtils.TryClone<LaunchBuff>(this.DoBuff);
  1804. ret.DoSpell = CUtils.TryClone<LaunchSpell>(this.DoSpell);
  1805. ret.DoEffect = CUtils.TryClone<LaunchEffect>(this.DoEffect);
  1806. ret.DoSummon = CUtils.TryClone<SummonUnit>(this.DoSummon);
  1807. return ret;
  1808. }
  1809. public void WriteExternal(IOutputStream output)
  1810. {
  1811. output.PutUTF(this.EditorPath);
  1812. output.PutS32(this.ID);
  1813. output.PutUTF(this.Name);
  1814. output.PutS32(this.CoolDownTimeMS);
  1815. output.PutList<UnitTriggers.BaseTriggerEvent>(this.Triggers, output.PutExt);
  1816. output.PutExt(this.DoSkill);
  1817. output.PutExt(this.DoBuff);
  1818. output.PutExt(this.DoSpell);
  1819. output.PutExt(this.DoEffect);
  1820. output.PutExt(this.DoSummon);
  1821. }
  1822. public void ReadExternal(IInputStream input)
  1823. {
  1824. this.EditorPath = input.GetUTF();
  1825. this.ID = input.GetS32();
  1826. this.Name = input.GetUTF();
  1827. this.CoolDownTimeMS = input.GetS32();
  1828. this.Triggers = input.GetListAny<UnitTriggers.BaseTriggerEvent>();
  1829. this.DoSkill = input.GetExt<LaunchSkill>();
  1830. this.DoBuff = input.GetExt<LaunchBuff>();
  1831. this.DoSpell = input.GetExt<LaunchSpell>();
  1832. this.DoEffect = input.GetExt<LaunchEffect>();
  1833. this.DoSummon = input.GetExt<SummonUnit>();
  1834. }
  1835. }
  1836. //---------------------------------------------------------------------------------//
  1837. /// <summary>
  1838. /// 法术/飞行道具模板
  1839. /// </summary>
  1840. [MessageType(0x4005)]
  1841. [DescAttribute("法术/飞行道具模板")]
  1842. [TableClassAttribute("ID")]
  1843. public class SpellTemplate : ICloneable, ITemplateData, IExternalizable
  1844. {
  1845. public int TemplateID { get { return ID; } }
  1846. [XmlSerializable()]
  1847. public string EditorPath { get; set; }
  1848. public enum MotionType : byte
  1849. {
  1850. [DescAttribute("在原地不动")]
  1851. Immovability = 1,
  1852. [DescAttribute("按直线运动")]
  1853. Straight = 2,
  1854. [DescAttribute("跟随目标,直到击中")]
  1855. Missile = 3,
  1856. [DescAttribute("向周围扩散")]
  1857. AOE = 4,
  1858. [DescAttribute("绑定发射者")]
  1859. Binding = 6,
  1860. [DescAttribute("绑定被攻击者")]
  1861. BindingTarget = 7,
  1862. [DescAttribute("炮弹类")]
  1863. Cannon = 8,
  1864. [DescAttribute("直接在目标坐标生效")]
  1865. SelectTarget = 9,
  1866. [DescAttribute("先按直线运动,过程中锁定目标")]
  1867. SeekerMissile = 10,
  1868. [DescAttribute("向周围扩散,绑定发射者")]
  1869. AOE_Binding = 11,
  1870. [DescAttribute("向周围扩散,绑定被攻击者")]
  1871. AOE_BindingTarget = 12,
  1872. [DescAttribute("锁定并命中目标,和SeekerMissile区别是没有过程,直接命中。")]
  1873. SeekerSelectTarget = 13,
  1874. [DescAttribute("发射者和目标绑定(Distance必须在范围内)")]
  1875. Chain = 14,
  1876. [DescAttribute("直接在自身坐标生效")]
  1877. SelectLauncher = 15,
  1878. [DescAttribute("回旋镖路径1(最终返回到发射者)")]
  1879. Boomerang1 = 16,
  1880. [DescAttribute("回旋镖路径2(最终返回到发射点)")]
  1881. Boomerang2 = 17,
  1882. [DescAttribute("狐火路径")]
  1883. Foxfire = 18,
  1884. [DescAttribute("先直线,后停留")]
  1885. StraightAndStop = 19,
  1886. [DescAttribute("追踪,可击中路径上的敌人")]
  1887. MissileAttackRoute = 20,
  1888. [DescAttribute("曲线追踪")]
  1889. CurveMissile = 21,
  1890. }
  1891. /// <summary>
  1892. /// 往客户端推送,是否包含坐标
  1893. /// </summary>
  1894. public bool IsLaunchSpellEventSyncPos
  1895. {
  1896. get
  1897. {
  1898. // 脱离运动类型的一些特殊字段
  1899. if(this.IsBindingOrbit)
  1900. {
  1901. return true;
  1902. }
  1903. switch (MType)
  1904. {
  1905. case SpellTemplate.MotionType.AOE_Binding:
  1906. case SpellTemplate.MotionType.AOE_BindingTarget:
  1907. case SpellTemplate.MotionType.Binding:
  1908. case SpellTemplate.MotionType.BindingTarget:
  1909. case SpellTemplate.MotionType.Chain:
  1910. return false;
  1911. case SpellTemplate.MotionType.SelectLauncher:
  1912. case SpellTemplate.MotionType.SelectTarget:
  1913. case SpellTemplate.MotionType.Immovability:
  1914. case SpellTemplate.MotionType.Cannon:
  1915. case SpellTemplate.MotionType.AOE:
  1916. case SpellTemplate.MotionType.Straight:
  1917. case SpellTemplate.MotionType.Missile:
  1918. case SpellTemplate.MotionType.Boomerang1:
  1919. case SpellTemplate.MotionType.Boomerang2:
  1920. case SpellTemplate.MotionType.SeekerMissile:
  1921. case SpellTemplate.MotionType.SeekerSelectTarget:
  1922. case SpellTemplate.MotionType.StraightAndStop:
  1923. case SpellTemplate.MotionType.MissileAttackRoute:
  1924. case SpellTemplate.MotionType.CurveMissile:
  1925. default:
  1926. return true;
  1927. }
  1928. }
  1929. }
  1930. [DescAttribute("ID", "", false)]
  1931. public int ID;
  1932. /// <summary>
  1933. /// 法术名字
  1934. /// </summary>
  1935. [DescAttribute("法术名字")]
  1936. [LocalizationTextAttribute]
  1937. public string Name;
  1938. /// <summary>
  1939. /// 生命周期,帧
  1940. /// </summary>
  1941. [DescAttribute("生命周期(毫秒)")]
  1942. public int LifeTimeMS = 1000;
  1943. [DescAttribute("客户端是否可见")]
  1944. public bool ClientVisible = true;
  1945. //--------------------------------------------
  1946. public enum Shape : byte
  1947. {
  1948. [DescAttribute("圆形(BodySize=半径尺寸)")]
  1949. Round = AttackShape.Round,
  1950. [DescAttribute("扇形(BodySize=半径尺寸;FanAngle=角度)")]
  1951. Fan = AttackShape.Fan,
  1952. [DescAttribute("胶囊条状(Distance=长度;RectWide=宽度)")]
  1953. Strip = AttackShape.Strip,
  1954. [DescAttribute("胶囊射线,以原点出去(Distance=长度;RectWide=宽度)")]
  1955. StripRay = AttackShape.StripRay,
  1956. [DescAttribute("胶囊射线,接触到最近(Distance=最大长度;RectWide=宽度)")]
  1957. StripRayTouchEnd = AttackShape.StripRayTouchEnd,
  1958. [DescAttribute("方形条状")]
  1959. RectStrip = CommonAI.Zone.Helper.AttackShape.RectStrip,
  1960. [DescAttribute("方形射线(以原点出去)")]
  1961. RectStripRay = CommonAI.Zone.Helper.AttackShape.RectStripRay,
  1962. [DescAttribute("横向胶囊条状")]
  1963. WideStrip = CommonAI.Zone.Helper.AttackShape.WideStrip,
  1964. [DescAttribute("连线类型(单体攻击),比如激光塔(Distance=判定距离)")]
  1965. LineToTarget = AttackShape.LineToTarget,
  1966. [DescAttribute("连线类型(单体攻击),比如伸出去的钩子(Distance=判定距离)")]
  1967. LineToStart = AttackShape.LineToStart,
  1968. [DescAttribute("圆环,中间是空的(BodySize=外环半径;BodySize-RectWide=内环半径)")]
  1969. Circle = CommonAI.Zone.Helper.AttackShape.Circle,
  1970. }
  1971. public bool IsShapeFan { get { return BodyShape == Shape.Fan; } }
  1972. public bool IsShapeStrip
  1973. {
  1974. get
  1975. {
  1976. switch (BodyShape)
  1977. {
  1978. case Shape.Strip:
  1979. case Shape.StripRay:
  1980. case Shape.StripRayTouchEnd:
  1981. case Shape.Circle:
  1982. case Shape.RectStrip:
  1983. case Shape.RectStripRay:
  1984. case Shape.WideStrip:
  1985. return true;
  1986. }
  1987. return false;
  1988. }
  1989. }
  1990. public bool IsShapeDistance
  1991. {
  1992. get
  1993. {
  1994. switch (BodyShape)
  1995. {
  1996. case Shape.Strip:
  1997. case Shape.StripRay:
  1998. case Shape.StripRayTouchEnd:
  1999. case Shape.LineToTarget:
  2000. case Shape.LineToStart:
  2001. case Shape.RectStrip:
  2002. case Shape.RectStripRay:
  2003. case Shape.WideStrip:
  2004. return true;
  2005. default:
  2006. return false;
  2007. }
  2008. }
  2009. }
  2010. //--------------------------------------------
  2011. [DescAttribute("攻击范围类型", "攻击范围")]
  2012. public Shape BodyShape = Shape.Round;
  2013. [DescAttribute("尺寸,半径(Round, Fan, Circle)", "攻击范围")]
  2014. public float BodySize = 1;
  2015. [DescAttribute("角度(Fan)", "攻击范围")]
  2016. [DependOnProperty("IsShapeFan")]
  2017. public float FanAngle;
  2018. [DescAttribute("宽度,粗度(Strip, StripRay,StripRayTouchEnd,RectStrip, RectStripRay,Circle, WideStrip)", "攻击范围")]
  2019. [DependOnProperty("IsShapeStrip")]
  2020. public float RectWide = 1;
  2021. [DescAttribute("长度(Strip, StripRay,StripRayTouchEnd, RectStrip, RectStripRay,LineToTarget, LineToStart, WideStrip)", "攻击范围")]
  2022. [DependOnProperty("IsShapeDistance")]
  2023. public float Distance = 10;
  2024. //--------------------------------------------
  2025. [DescAttribute("法术自身高度", "攻击范围")]
  2026. public float BodyHeight = 0;
  2027. //--------------------------------------------
  2028. /// <summary>
  2029. /// 运动类型
  2030. /// </summary>
  2031. [DescAttribute("运动类型", "运动")]
  2032. public MotionType MType = MotionType.Straight;
  2033. public bool IsMoveable
  2034. {
  2035. get
  2036. {
  2037. switch (MType)
  2038. {
  2039. case MotionType.Cannon:
  2040. case MotionType.Missile:
  2041. case MotionType.SeekerMissile:
  2042. case MotionType.Straight:
  2043. case MotionType.AOE:
  2044. case MotionType.AOE_Binding:
  2045. case MotionType.AOE_BindingTarget:
  2046. case MotionType.Boomerang1:
  2047. case MotionType.Boomerang2:
  2048. case MotionType.Foxfire:
  2049. case MotionType.StraightAndStop:
  2050. case MotionType.MissileAttackRoute:
  2051. case MotionType.CurveMissile:
  2052. return true;
  2053. }
  2054. return false;
  2055. }
  2056. }
  2057. public bool IsBinding
  2058. {
  2059. get
  2060. {
  2061. switch (MType)
  2062. {
  2063. case MotionType.Binding:
  2064. case MotionType.BindingTarget:
  2065. case MotionType.AOE_Binding:
  2066. case MotionType.AOE_BindingTarget:
  2067. return true;
  2068. }
  2069. return false;
  2070. }
  2071. }
  2072. public bool IsSeekingTarget
  2073. {
  2074. get
  2075. {
  2076. switch (MType)
  2077. {
  2078. case MotionType.SeekerMissile:
  2079. case MotionType.SeekerSelectTarget:
  2080. case MotionType.Foxfire:
  2081. case MotionType.MissileAttackRoute:
  2082. case MotionType.CurveMissile:
  2083. return true;
  2084. }
  2085. return false;
  2086. }
  2087. }
  2088. public bool IsAOE
  2089. {
  2090. get
  2091. {
  2092. switch (MType)
  2093. {
  2094. case MotionType.AOE:
  2095. case MotionType.AOE_Binding:
  2096. case MotionType.AOE_BindingTarget:
  2097. return true;
  2098. }
  2099. return false;
  2100. }
  2101. }
  2102. /// <summary>
  2103. /// 运动速度,AOE或者扩散类,缩放速度
  2104. /// </summary>
  2105. [DescAttribute("运动速度,AOE或者扩散类,缩放速度(距离 / 每秒)", "运动")]
  2106. [DependOnProperty("IsMoveable")]
  2107. public float MSpeedSEC = 15f;
  2108. [DescAttribute("加速度(距离/每秒)(最终速度=速度+加速度)", "运动")]
  2109. [DependOnProperty("IsMoveable")]
  2110. public float MSpeedAdd = 0f;
  2111. [DescAttribute("阻力(每秒递减速度百分比)", "运动")]
  2112. [DependOnProperty("IsMoveable")]
  2113. public float MSpeedAcc = 0f;
  2114. [DescAttribute("最大移动距离", "运动")]
  2115. public float MaxMoveDistance = 0f;
  2116. [DescAttribute("最大限速", "运动")]
  2117. [DependOnProperty("IsMoveable")]
  2118. public float MSpeed_MAX = 100f;
  2119. [DescAttribute("最小限速", "运动")]
  2120. [DependOnProperty("IsMoveable")]
  2121. public float MSpeed_MIN = -100f;
  2122. //--------------------------------------------
  2123. public enum AoeMotionType : byte
  2124. {
  2125. [DescAttribute("线性,递增或递减")]
  2126. Linear = 0,
  2127. [DescAttribute("正弦,单次周期为PI,象限0~1")]
  2128. Sine = 1,
  2129. }
  2130. [DescAttribute("AOE方式", "运动")]
  2131. [DependOnProperty("IsAOE")]
  2132. public AoeMotionType AOEMType = AoeMotionType.Linear;
  2133. //--------------------------------------------
  2134. /// <summary>
  2135. /// 转动速度
  2136. /// </summary>
  2137. [DescAttribute("自转转动速度(距离/每秒)", "运动")]
  2138. public float RotateSpeedSEC;
  2139. [DescAttribute("抛物线高度", "运动")]
  2140. public float ParabolaHeight = 0;
  2141. /// <summary>
  2142. ///
  2143. /// </summary>
  2144. [DescAttribute("暂时只给灵魂出窍的技能使用", "运动")]
  2145. public bool HeightUpdate;
  2146. //--------------------------------------------
  2147. public enum SeekingExpect : byte
  2148. {
  2149. [DescAttribute("搜索随机单位")]
  2150. Random,
  2151. [DescAttribute("搜索最近单位")]
  2152. Nearest,
  2153. [DescAttribute("搜索最远单位")]
  2154. Farthest,
  2155. [DescAttribute("搜索随机单位(忽略链中)")]
  2156. RandomIgnoreInChain,
  2157. [DescAttribute("搜索最近单位(忽略链中)")]
  2158. NearestIgnoreInChain,
  2159. [DescAttribute("搜索最远单位(忽略链中)")]
  2160. FarthestIgnoreInChain,
  2161. }
  2162. //--------------------------------------------
  2163. [DescAttribute("如果是自动搜敌导弹SeekerMissile,则表示搜索范围,如果是LineToTarget则表示伤害距离", "运动-自动跟踪")]
  2164. [DependOnProperty("IsSeekingTarget")]
  2165. public float SeekingRange = 10;
  2166. [DescAttribute("自动锁敌冷却时间(毫秒)", "运动-自动跟踪")]
  2167. [DependOnProperty("IsSeekingTarget")]
  2168. public int SeekingCooldownMS = 1000;
  2169. [DescAttribute("自动锁敌运动时,转角距离", "运动-自动跟踪")]
  2170. [DependOnProperty("IsSeekingTarget")]
  2171. public float SeekingTurningAngleSEC = 3f;
  2172. [DescAttribute("自动锁敌检测方式", "运动-自动跟踪")]
  2173. [DependOnProperty("IsSeekingTarget")]
  2174. public SeekingExpect SeekingExpectTarget = SeekingExpect.Random;
  2175. //--------------------------------------------
  2176. [DescAttribute("如果是绑定则围绕绑定者公转", "运动-绑定")]
  2177. [DependOnProperty("IsBinding")]
  2178. public bool IsBindingOrbit = false;
  2179. [DescAttribute("绑定公转距离", "运动-绑定")]
  2180. [DependOnProperty("IsBinding")]
  2181. public float OrbitDistance;
  2182. [DescAttribute("如果为绑定,是否绑定方向", "运动-绑定")]
  2183. [DependOnProperty("IsBinding")]
  2184. public bool IsBindingDirection = false;
  2185. //--------------------------------------------
  2186. //--------------------------------------------
  2187. [DescAttribute("最大影响(受击)单位,0表示无限制")]
  2188. public int MaxAffectUnit = 0;
  2189. //--------------------------------------------
  2190. /// <summary>
  2191. /// 击中就消失
  2192. /// </summary>
  2193. [DescAttribute("击中就消失(爆炸),和HitIntervalMS冲突", "关键帧")]
  2194. public bool HitOnExplosion;
  2195. [DescAttribute("击中就消失(爆炸)关键帧,适用于打到就爆和Cannon类法术", "关键帧")]
  2196. [DependOnProperty("HitOnExplosion")]
  2197. public KeyFrame HitOnExplosionKeyFrame;
  2198. /// <summary>
  2199. /// 每间隔多少帧就触发一次,0代表只造成一次伤害或效果
  2200. /// </summary>
  2201. [DescAttribute("每间隔多少时间就触发一次,0 适用于穿透性,但只对单位造成一次伤害(毫秒)", "关键帧")]
  2202. public int HitIntervalMS;
  2203. [DescAttribute("只造成一次触发的关键帧 or 每隔一段时间触发的关键帧", "关键帧")]
  2204. public KeyFrame HitIntervalKeyFrame;
  2205. /// <summary>
  2206. /// 按顺序触发的所有关键帧
  2207. /// </summary>
  2208. [DescAttribute("按顺序触发的所有关键帧", "关键帧")]
  2209. public List<KeyFrame> KeyFrames = new List<KeyFrame>();
  2210. //--------------------------------------------
  2211. /// <summary>
  2212. /// 模型名字或者Perfab名字
  2213. /// </summary>
  2214. [DescAttribute("模型名字或者Perfab名字", "资源")]
  2215. [ResourceIDAttribute]
  2216. public string FileName;
  2217. [DescAttribute("模型名字或者Perfab名字(起始)", "资源")]
  2218. [ResourceIDAttribute]
  2219. public string FileNameSpawn;
  2220. [DescAttribute("模型名字或者Perfab名字(结束)", "资源")]
  2221. [ResourceIDAttribute]
  2222. public string FileNameDestory;
  2223. [DescAttribute("是否循环播放动画", "资源")]
  2224. public bool IsCycAnim = true;
  2225. [DescAttribute("缩放比率", "资源")]
  2226. public float FileBodyScale = 1;
  2227. [DescAttribute("法术释放时,在目标点释放特效,可作为技能提示", "特效")]
  2228. public LaunchEffect TargetEffect;
  2229. [DescAttribute("法术期望作用目标", "目标")]
  2230. public SkillTemplate.CastTarget ExpectTarget = SkillTemplate.CastTarget.Enemy;
  2231. //------------------------------------
  2232. [DescAttribute("绑定目标不可操控时移除自己", "移除条件")]
  2233. public bool RemoveOnBindingUncontrollable = false;
  2234. [DescAttribute("绑定目标非技能状态时移除自己", "移除条件")]
  2235. public bool RemoveOnBindingSkillOver = false;
  2236. [DescAttribute("当Spell被移除停止释放它的技能", "移除条件")]
  2237. public bool StopBindingSkillOnRemoved = false;
  2238. //------------------------------------
  2239. //--------------------------------------------
  2240. public enum SpecialAdditionalEffect : byte
  2241. {
  2242. [DescAttribute("无")]
  2243. None = 0,
  2244. [DescAttribute("黑洞效果,牵引碰到的怪物")]
  2245. DarkHole = 1,
  2246. [DescAttribute("路径牵引效果")]
  2247. DragPath = 2,
  2248. }
  2249. public bool IsCanAddSpecialEffect
  2250. {
  2251. get
  2252. {
  2253. switch (MType)
  2254. {
  2255. case MotionType.Missile:
  2256. case MotionType.SeekerMissile:
  2257. case MotionType.Cannon:
  2258. case MotionType.Chain:
  2259. case MotionType.Boomerang1:
  2260. case MotionType.Boomerang2:
  2261. case MotionType.MissileAttackRoute:
  2262. case MotionType.CurveMissile:
  2263. return false;
  2264. }
  2265. return true;
  2266. }
  2267. }
  2268. [DescAttribute("法术的特殊效果", "特殊效果")]
  2269. [DependOnProperty("IsCanAddSpecialEffect")]
  2270. public SpecialAdditionalEffect SpecialEffect = SpecialAdditionalEffect.None;
  2271. [DescAttribute("特殊效果参数(黑洞的牵引速度)", "特殊效果")]
  2272. [DependOnProperty("IsCanAddSpecialEffect")]
  2273. public float SpecialEffectParam = 0;
  2274. // --
  2275. [DescAttribute("飞行时间(毫秒)", "运动(回旋路径, 滞空)")]
  2276. //[DependOnProperty("IsBoomerang")]
  2277. public int BoomerangFlyTime = 1000;
  2278. [DescAttribute("滞空时间(毫秒)", "运动(回旋路径, 滞空)")]
  2279. //[DependOnProperty("IsBoomerang")]
  2280. public int BoomerangHangtime = 1000;
  2281. public bool IsBoomerang
  2282. {
  2283. get
  2284. {
  2285. return MType == MotionType.Boomerang1 || MType == MotionType.Boomerang2;
  2286. }
  2287. }
  2288. /// <summary>
  2289. /// 用户自定义扩展属性
  2290. /// </summary>
  2291. [DescAttribute("扩展属性", "扩展")]
  2292. [Expandable]
  2293. [NotNull]
  2294. public ISpellProperties Properties = TemplateManager.Factory.CreateSpellProperties();
  2295. //------------------------------------
  2296. [DescAttribute("速度(原始动画/特效速度 * 速度)", "特效加速")]
  2297. public float EffectAddSpeed = 1;
  2298. [DescAttribute("特效中存在的动画,动画的名字", "特效加速")]
  2299. public string AnimtionName;
  2300. [DescAttribute("音效文件名", "音效")]
  2301. public string AudioName;
  2302. [DescAttribute("音效文件是否循环", "音效")]
  2303. public bool IsAudioLoop;
  2304. public SpellTemplate() { }
  2305. public int GetID()
  2306. {
  2307. return ID;
  2308. }
  2309. public override string ToString()
  2310. {
  2311. return Name + "(" + ID + ")";
  2312. }
  2313. public object Clone()
  2314. {
  2315. SpellTemplate ret = new SpellTemplate();
  2316. ret.EditorPath = this.EditorPath;
  2317. ret.ID = this.ID;
  2318. ret.Name = this.Name;
  2319. ret.LifeTimeMS = this.LifeTimeMS;
  2320. ret.ClientVisible = this.ClientVisible;
  2321. ret.BodyShape = this.BodyShape;
  2322. ret.BodySize = this.BodySize;
  2323. ret.FanAngle = this.FanAngle;
  2324. ret.RectWide = this.RectWide;
  2325. ret.BodyHeight = this.BodyHeight;
  2326. ret.Distance = this.Distance;
  2327. ret.MType = this.MType;
  2328. ret.MSpeedSEC = this.MSpeedSEC;
  2329. ret.MSpeedAdd = this.MSpeedAdd;
  2330. ret.MSpeedAcc = this.MSpeedAcc;
  2331. ret.MaxMoveDistance = this.MaxMoveDistance;
  2332. ret.MSpeed_MAX = this.MSpeed_MAX;
  2333. ret.MSpeed_MIN = this.MSpeed_MIN;
  2334. ret.RotateSpeedSEC = this.RotateSpeedSEC;
  2335. ret.ParabolaHeight = this.ParabolaHeight;
  2336. ret.HeightUpdate = this.HeightUpdate;
  2337. ret.AOEMType = this.AOEMType;
  2338. ret.SeekingRange = this.SeekingRange;
  2339. ret.SeekingCooldownMS = this.SeekingCooldownMS;
  2340. ret.SeekingTurningAngleSEC = this.SeekingTurningAngleSEC;
  2341. ret.SeekingExpectTarget = this.SeekingExpectTarget;
  2342. ret.MaxAffectUnit = this.MaxAffectUnit;
  2343. ret.IsBindingOrbit = this.IsBindingOrbit;
  2344. ret.OrbitDistance = this.OrbitDistance;
  2345. ret.IsBindingDirection = this.IsBindingDirection;
  2346. ret.HitOnExplosion = this.HitOnExplosion;
  2347. ret.HitOnExplosionKeyFrame = CUtils.TryClone<KeyFrame>(this.HitOnExplosionKeyFrame);
  2348. ret.HitIntervalMS = this.HitIntervalMS;
  2349. ret.HitIntervalKeyFrame = CUtils.TryClone<KeyFrame>(this.HitIntervalKeyFrame);
  2350. ret.KeyFrames = CUtils.CloneList<KeyFrame>(this.KeyFrames);
  2351. ret.FileName = this.FileName;
  2352. ret.FileNameSpawn = this.FileNameSpawn;
  2353. ret.FileNameDestory = this.FileNameDestory;
  2354. ret.IsCycAnim = this.IsCycAnim;
  2355. ret.FileBodyScale = this.FileBodyScale;
  2356. ret.TargetEffect = CUtils.TryClone<LaunchEffect>(this.TargetEffect);
  2357. ret.ExpectTarget = this.ExpectTarget;
  2358. ret.RemoveOnBindingUncontrollable = this.RemoveOnBindingUncontrollable;
  2359. ret.RemoveOnBindingSkillOver = this.RemoveOnBindingSkillOver;
  2360. ret.StopBindingSkillOnRemoved = this.StopBindingSkillOnRemoved;
  2361. ret.Properties = CUtils.TryClone<ISpellProperties>(this.Properties);
  2362. ret.SpecialEffect = this.SpecialEffect;
  2363. ret.SpecialEffectParam = this.SpecialEffectParam;
  2364. ret.BoomerangFlyTime = this.BoomerangFlyTime;
  2365. ret.BoomerangHangtime = this.BoomerangHangtime;
  2366. ret.EffectAddSpeed = this.EffectAddSpeed;
  2367. ret.AnimtionName = this.AnimtionName;
  2368. ret.AudioName = this.AudioName;
  2369. ret.IsAudioLoop = this.IsAudioLoop;
  2370. return ret;
  2371. }
  2372. public void WriteExternal(IOutputStream output)
  2373. {
  2374. output.PutUTF(this.EditorPath);
  2375. output.PutS32(this.ID);
  2376. output.PutUTF(this.Name);
  2377. output.PutS32(this.LifeTimeMS);
  2378. output.PutBool(this.ClientVisible);
  2379. output.PutEnum8(this.BodyShape);
  2380. output.PutF32(this.BodySize);
  2381. output.PutF32(this.FanAngle);
  2382. output.PutF32(this.RectWide);
  2383. output.PutF32(this.BodyHeight);
  2384. output.PutF32(this.Distance);
  2385. output.PutEnum8(this.MType);
  2386. output.PutF32(this.MSpeedSEC);
  2387. output.PutF32(this.MSpeedAdd);
  2388. output.PutF32(this.MSpeedAcc);
  2389. output.PutF32(this.MaxMoveDistance);
  2390. output.PutF32(this.MSpeed_MAX);
  2391. output.PutF32(this.MSpeed_MIN);
  2392. output.PutF32(this.RotateSpeedSEC);
  2393. output.PutF32(this.ParabolaHeight);
  2394. output.PutBool(this.HeightUpdate);
  2395. output.PutEnum8(this.AOEMType);
  2396. output.PutF32(this.SeekingRange);
  2397. output.PutS32(this.SeekingCooldownMS);
  2398. output.PutF32(this.SeekingTurningAngleSEC);
  2399. output.PutEnum8(this.SeekingExpectTarget);
  2400. output.PutS32(this.MaxAffectUnit);
  2401. output.PutBool(this.IsBindingOrbit);
  2402. output.PutF32(this.OrbitDistance);
  2403. output.PutBool(this.IsBindingDirection);
  2404. output.PutBool(this.HitOnExplosion);
  2405. output.PutExt(this.HitOnExplosionKeyFrame);
  2406. output.PutS32(this.HitIntervalMS);
  2407. output.PutExt(this.HitIntervalKeyFrame);
  2408. output.PutList<KeyFrame>(this.KeyFrames, output.PutExt);
  2409. output.PutUTF(this.FileName);
  2410. output.PutUTF(this.FileNameSpawn);
  2411. output.PutUTF(this.FileNameDestory);
  2412. output.PutBool(this.IsCycAnim);
  2413. output.PutF32(this.FileBodyScale);
  2414. output.PutExt(this.TargetEffect);
  2415. output.PutEnum8(this.ExpectTarget);
  2416. output.PutBool(this.RemoveOnBindingUncontrollable);
  2417. output.PutBool(this.RemoveOnBindingSkillOver);
  2418. output.PutBool(this.StopBindingSkillOnRemoved);
  2419. output.PutExt(this.Properties);
  2420. output.PutEnum8(this.SpecialEffect);
  2421. output.PutF32(this.SpecialEffectParam);
  2422. output.PutS32(this.BoomerangFlyTime);
  2423. output.PutS32(this.BoomerangHangtime);
  2424. output.PutF32(this.EffectAddSpeed);
  2425. output.PutUTF(this.AnimtionName);
  2426. output.PutUTF(this.AudioName);
  2427. output.PutBool(this.IsAudioLoop);
  2428. }
  2429. public void ReadExternal(IInputStream input)
  2430. {
  2431. this.EditorPath = input.GetUTF();
  2432. this.ID = input.GetS32();
  2433. this.Name = input.GetUTF();
  2434. this.LifeTimeMS = input.GetS32();
  2435. this.ClientVisible = input.GetBool();
  2436. this.BodyShape = input.GetEnum8<Shape>();
  2437. this.BodySize = input.GetF32();
  2438. this.FanAngle = input.GetF32();
  2439. this.RectWide = input.GetF32();
  2440. this.BodyHeight = input.GetF32();
  2441. this.Distance = input.GetF32();
  2442. this.MType = input.GetEnum8<MotionType>();
  2443. this.MSpeedSEC = input.GetF32();
  2444. this.MSpeedAdd = input.GetF32();
  2445. this.MSpeedAcc = input.GetF32();
  2446. this.MaxMoveDistance = input.GetF32();
  2447. this.MSpeed_MAX = input.GetF32();
  2448. this.MSpeed_MIN = input.GetF32();
  2449. this.RotateSpeedSEC = input.GetF32();
  2450. this.ParabolaHeight = input.GetF32();
  2451. this.HeightUpdate = input.GetBool();
  2452. this.AOEMType = input.GetEnum8<AoeMotionType>();
  2453. this.SeekingRange = input.GetF32();
  2454. this.SeekingCooldownMS = input.GetS32();
  2455. this.SeekingTurningAngleSEC = input.GetF32();
  2456. this.SeekingExpectTarget = input.GetEnum8<SeekingExpect>();
  2457. this.MaxAffectUnit = input.GetS32();
  2458. this.IsBindingOrbit = input.GetBool();
  2459. this.OrbitDistance = input.GetF32();
  2460. this.IsBindingDirection = input.GetBool();
  2461. this.HitOnExplosion = input.GetBool();
  2462. this.HitOnExplosionKeyFrame = input.GetExt<KeyFrame>();
  2463. this.HitIntervalMS = input.GetS32();
  2464. this.HitIntervalKeyFrame = input.GetExt<KeyFrame>();
  2465. this.KeyFrames = input.GetList<KeyFrame>(input.GetExt<KeyFrame>);
  2466. this.FileName = input.GetUTF();
  2467. this.FileNameSpawn = input.GetUTF();
  2468. this.FileNameDestory = input.GetUTF();
  2469. this.IsCycAnim = input.GetBool();
  2470. this.FileBodyScale = input.GetF32();
  2471. this.TargetEffect = input.GetExt<LaunchEffect>();
  2472. this.ExpectTarget = input.GetEnum8<SkillTemplate.CastTarget>();
  2473. this.RemoveOnBindingUncontrollable = input.GetBool();
  2474. this.RemoveOnBindingSkillOver = input.GetBool();
  2475. this.StopBindingSkillOnRemoved = input.GetBool();
  2476. this.Properties = input.GetExt<ISpellProperties>(this.Properties);
  2477. this.SpecialEffect = input.GetEnum8<SpecialAdditionalEffect>();
  2478. this.SpecialEffectParam = input.GetF32();
  2479. this.BoomerangFlyTime = input.GetS32();
  2480. this.BoomerangHangtime = input.GetS32();
  2481. this.EffectAddSpeed = input.GetF32();
  2482. this.AnimtionName = input.GetUTF();
  2483. this.AudioName = input.GetUTF();
  2484. this.IsAudioLoop = input.GetBool();
  2485. }
  2486. //------------------------------------------------------------
  2487. //------------------------------------------------------------
  2488. /// <summary>
  2489. /// 法术伤害或特效关键帧
  2490. /// </summary>
  2491. [MessageType(0x4105)]
  2492. [DescAttribute("法术伤害或特效关键帧")]
  2493. [Expandable]
  2494. public class KeyFrame : BaseKeyFrame, ICloneable, IExternalizable
  2495. {
  2496. /// <summary>
  2497. /// 触发的特效
  2498. /// </summary>
  2499. [DescAttribute("触发的特效")]
  2500. public LaunchEffect Effect;
  2501. /// <summary>
  2502. /// 触发新的法术
  2503. /// </summary>
  2504. [DescAttribute("触发新的法术")]
  2505. public LaunchSpell Spell;
  2506. /// <summary>
  2507. /// 攻击伤害
  2508. /// </summary>
  2509. [DescAttribute("攻击伤害")]
  2510. public AttackProp Attack;
  2511. /// <summary>
  2512. /// 召唤小弟
  2513. /// </summary>
  2514. [DescAttribute("召唤小弟")]
  2515. public SummonUnit Summon;
  2516. public KeyFrame() { }
  2517. public override string ToString()
  2518. {
  2519. if (Spell == null)
  2520. {
  2521. return "Frame: @" + FrameMS;
  2522. }
  2523. return "Frame: @" + FrameMS + ", " + Spell.ToString();
  2524. }
  2525. public object Clone()
  2526. {
  2527. KeyFrame ret = new KeyFrame();
  2528. ret.FrameMS = this.FrameMS;
  2529. ret.Spell = CUtils.TryClone<LaunchSpell>(this.Spell);
  2530. ret.Effect = CUtils.TryClone<LaunchEffect>(this.Effect);
  2531. ret.Attack = CUtils.TryClone<AttackProp>(this.Attack);
  2532. ret.Summon = CUtils.TryClone<SummonUnit>(this.Summon);
  2533. return ret;
  2534. }
  2535. public void WriteExternal(IOutputStream output)
  2536. {
  2537. output.PutS32(base.FrameMS);
  2538. output.PutExt(this.Spell);
  2539. output.PutExt(this.Effect);
  2540. output.PutExt(this.Attack);
  2541. output.PutExt(this.Summon);
  2542. }
  2543. public void ReadExternal(IInputStream input)
  2544. {
  2545. base.FrameMS = input.GetS32();
  2546. this.Spell = input.GetExt<LaunchSpell>();
  2547. this.Effect = input.GetExt<LaunchEffect>();
  2548. this.Attack = input.GetExt<AttackProp>();
  2549. this.Summon = input.GetExt<SummonUnit>();
  2550. }
  2551. }
  2552. }
  2553. //---------------------------------------------------------------------------------//
  2554. /// <summary>
  2555. /// BUFF类数据结构
  2556. /// </summary>
  2557. [MessageType(0x4006)]
  2558. [DescAttribute("BUFF类数据结构")]
  2559. [TableClassAttribute("ID")]
  2560. public class BuffTemplate : ICloneable, ITemplateData, IExternalizable
  2561. {
  2562. public int TemplateID { get { return ID; } }
  2563. [XmlSerializable()]
  2564. public string EditorPath { get; set; }
  2565. [DescAttribute("ID", "", false)]
  2566. public int ID;
  2567. [LocalizationTextAttribute]
  2568. [DescAttribute("Buff名字")]
  2569. public string Name;
  2570. [DescAttribute("技能图标", "资源")]
  2571. public string IconName;
  2572. [DescAttribute("需要同步客户端")]
  2573. public bool ClientVisible = true;
  2574. [DescAttribute("生命周期(毫秒)")]
  2575. public int LifeTimeMS;
  2576. //--------------------------------------------------------------
  2577. [DescAttribute("每间隔多少毫秒就触发一次", "关键帧")]
  2578. public int HitIntervalMS;
  2579. [DescAttribute("第0帧是否有效", "关键帧")]
  2580. public bool FirstTimeEnable = true;
  2581. [DescAttribute("每间隔时间触发一次的时候起效", "关键帧")]
  2582. public KeyFrame HitKeyFrame;
  2583. [DescAttribute("所有关键帧", "关键帧")]
  2584. public List<KeyFrame> KeyFrames = new List<KeyFrame>();
  2585. [DescAttribute("Buff结束关键帧", "关键帧")]
  2586. public KeyFrame EndKeyFrame;
  2587. //--------------------------------------------------------------
  2588. [DescAttribute("是否有害(Debuff),否则为有益(Buff)", "BUFF")]
  2589. public bool IsHarmful = false;
  2590. [DescAttribute("Buff是否可以主动取消", "BUFF")]
  2591. public bool IsCancelBySelf = false;
  2592. [DescAttribute("Buff是否允许多个实例", "BUFF")]
  2593. public bool IsDuplicating = false;
  2594. [DescAttribute("Buff施放者死亡立即移除", "BUFF")]
  2595. public bool IsRemoveOnSenderRemoved = true;
  2596. [DescAttribute("死亡立即移除", "BUFF")]
  2597. public bool IsRemoveOnDead = false;
  2598. //--------------------------------------------------------------
  2599. [DescAttribute("BUFF期间,强制单位进入BUFF特殊动作(即不会被其他动作打断)", "状态")]
  2600. public string LockStateAction;
  2601. [DescAttribute("是否隐身", "状态")]
  2602. public bool IsInvisible = false;
  2603. [DescAttribute("是否无敌", "状态")]
  2604. public bool IsInvincible = false;
  2605. [DescAttribute("是否沉默(只能释放BaseSkill)", "状态")]
  2606. public bool IsSilent = false;
  2607. [DescAttribute("是否沉默允许移动", "状态")]
  2608. public bool IsCanMove = true;
  2609. [DescAttribute("产生眩晕", "状态")]
  2610. public bool MakeStun = false;
  2611. [DescAttribute("免疫控制", "状态")]
  2612. public bool IgnoreControl = false;
  2613. [DescAttribute("单位被动触发系,一直绑定关系", "状态")]
  2614. public LaunchTrigger UnitTrigger;
  2615. //--------------------------------------------------------------
  2616. [DescAttribute("允许变身", "变身 - 造型")]
  2617. public bool MakeAvatar = false;
  2618. [DescAttribute("单位变身的模型文件名", "变身 - 造型")]
  2619. [ResourceIDAttribute]
  2620. [DependOnProperty("MakeAvatar")]
  2621. public string UnitFileName;
  2622. //--------------------------------------------------------------
  2623. [DescAttribute("允许改变技能", "变身 - 技能")]
  2624. public bool UnitChangeSkills = false;
  2625. [DescAttribute("此单位变身普通攻击技能", "变身 - 技能")]
  2626. [DependOnProperty("UnitChangeSkills")]
  2627. public LaunchSkill UnitBaseSkillID;
  2628. [DescAttribute("此单位变身绑定的所有技能ID", "变身 - 技能")]
  2629. [DependOnProperty("UnitChangeSkills")]
  2630. public List<LaunchSkill> UnitSkills = new List<LaunchSkill>();
  2631. [DescAttribute("变身改变技能时,保留的技能ID", "变身 - 技能")]
  2632. [TemplatesIDAttribute(typeof(SkillTemplate))]
  2633. [DependOnProperty("UnitChangeSkills")]
  2634. public List<int> UnitKeepSkillsID = new List<int>();
  2635. //--------------------------------------------------------------
  2636. //--------------------------------------------------------------
  2637. [DescAttribute("是否可堆叠层数", "堆叠")]
  2638. public bool IsOverlay = false;
  2639. [DescAttribute("最高可堆叠层数", "堆叠")]
  2640. [DependOnProperty("IsOverlay")]
  2641. public byte MaxOverlay = 1;
  2642. [DescAttribute("是否为被动系,则不显示在面板")]
  2643. public bool IsPassive = false;
  2644. public enum BindingPlayType : byte
  2645. {
  2646. [DescAttribute("一次性全部播放,配置多少,播放多少")]
  2647. All = 0,
  2648. [DescAttribute("根据层数去播放,那一层播放那一个")]
  2649. AppointOverLayer = 1,
  2650. [DescAttribute("包含层数,如果层数是2,会同时播放1和2的特效")]
  2651. IncludeOverLayer = 2,
  2652. }
  2653. [DescAttribute("BindingEffectList的播放模式(客户端用)", "特效")]
  2654. public BindingPlayType PlayType = BindingPlayType.All;
  2655. [DescAttribute("BUFF期间绑定特效(客户端用)", "特效")]
  2656. public LaunchEffect BindingEffect;
  2657. [DescAttribute("BUFF期间绑定特效集合(客户端用)", "特效")]
  2658. public List<LaunchEffect> BindingEffectList = new List<LaunchEffect>();
  2659. [DescAttribute("BUFF期间每层绑定特效(每层对应一个特效,客户端用)", "特效")]
  2660. [DependOnProperty("IsOverlay")]
  2661. public List<LaunchEffect> OverlayBindingEffect = new List<LaunchEffect>();
  2662. //--------------------------------------------------------------
  2663. [DescAttribute("互斥类型,同类型不能出现两个(非0有效)", "互斥")]
  2664. public int ExclusiveCatgory;
  2665. [DescAttribute("互斥优先级,如果优先级相等,则替换", "互斥")]
  2666. public int ExclusivePriority;
  2667. //--------------------------------------------------------------
  2668. [DescAttribute("Buff用户自定义扩展属性", "扩展")]
  2669. [Expandable]
  2670. [NotNull]
  2671. public IBuffProperties Properties;
  2672. [DescAttribute("自定义字段", "属性", true)]
  2673. public string[] Attributes;
  2674. //内部使用的一些字段,
  2675. [DescAttribute("强制加,跳过boss免控限制", "属性", true)]
  2676. public bool forceAdd;
  2677. public BuffTemplate()
  2678. {
  2679. this.Properties = TemplateManager.Factory.CreateBuffProperties();
  2680. }
  2681. public int GetID()
  2682. {
  2683. return ID;
  2684. }
  2685. public override string ToString()
  2686. {
  2687. return Name + "(" + ID + ")";
  2688. }
  2689. public object Clone()
  2690. {
  2691. BuffTemplate ret = new BuffTemplate();
  2692. ret.EditorPath = this.EditorPath;
  2693. ret.ID = this.ID;
  2694. ret.Name = this.Name;
  2695. ret.IconName = this.IconName;
  2696. ret.ClientVisible = this.ClientVisible;
  2697. ret.LifeTimeMS = this.LifeTimeMS;
  2698. ret.HitIntervalMS = this.HitIntervalMS;
  2699. ret.FirstTimeEnable = this.FirstTimeEnable;
  2700. ret.HitKeyFrame = CUtils.TryClone<KeyFrame>(this.HitKeyFrame);
  2701. ret.KeyFrames = CUtils.CloneList<KeyFrame>(this.KeyFrames);
  2702. ret.IsHarmful = this.IsHarmful;
  2703. ret.IsCancelBySelf = this.IsCancelBySelf;
  2704. ret.IsDuplicating = this.IsDuplicating;
  2705. ret.EndKeyFrame = CUtils.TryClone<KeyFrame>(this.EndKeyFrame);
  2706. ret.IsInvisible = this.IsInvisible;
  2707. ret.IsInvincible = this.IsInvincible;
  2708. ret.IsSilent = this.IsSilent;
  2709. ret.IsCanMove = this.IsCanMove;
  2710. ret.MakeStun = this.MakeStun;
  2711. ret.IgnoreControl = this.IgnoreControl;
  2712. ret.IsRemoveOnSenderRemoved = this.IsRemoveOnSenderRemoved;
  2713. ret.IsRemoveOnDead = this.IsRemoveOnDead;
  2714. ret.LockStateAction = this.LockStateAction;
  2715. ret.UnitTrigger = CUtils.TryClone<LaunchTrigger>(this.UnitTrigger);
  2716. ret.MakeAvatar = this.MakeAvatar;
  2717. ret.UnitFileName = this.UnitFileName;
  2718. ret.UnitChangeSkills = this.UnitChangeSkills;
  2719. ret.UnitBaseSkillID = CUtils.TryClone<LaunchSkill>(this.UnitBaseSkillID);
  2720. ret.UnitSkills = CUtils.CloneList<LaunchSkill>(this.UnitSkills);
  2721. ret.UnitKeepSkillsID = new List<int>(this.UnitKeepSkillsID);
  2722. ret.IsOverlay = this.IsOverlay;
  2723. ret.MaxOverlay = this.MaxOverlay;
  2724. ret.IsPassive = this.IsPassive;
  2725. ret.BindingEffect = CUtils.TryClone<LaunchEffect>(this.BindingEffect);
  2726. ret.PlayType = this.PlayType;
  2727. ret.BindingEffectList = CUtils.CloneList<LaunchEffect>(this.BindingEffectList);
  2728. ret.OverlayBindingEffect = CUtils.CloneList<LaunchEffect>(this.OverlayBindingEffect);
  2729. ret.ExclusiveCatgory = this.ExclusiveCatgory;
  2730. ret.ExclusivePriority = this.ExclusivePriority;
  2731. ret.Properties = CUtils.TryClone<IBuffProperties>(this.Properties);
  2732. ret.Attributes = CUtils.CloneArray<string>(this.Attributes);
  2733. ret.forceAdd = this.forceAdd;
  2734. return ret;
  2735. }
  2736. public void WriteExternal(IOutputStream output)
  2737. {
  2738. output.PutUTF(this.EditorPath);
  2739. output.PutS32(this.ID);
  2740. output.PutUTF(this.Name);
  2741. output.PutUTF(this.IconName);
  2742. output.PutS32(this.LifeTimeMS);
  2743. output.PutBool(this.ClientVisible);
  2744. output.PutS32(this.HitIntervalMS);
  2745. output.PutBool(this.FirstTimeEnable);
  2746. output.PutExt(this.HitKeyFrame);
  2747. output.PutList(this.KeyFrames, output.PutExt);
  2748. output.PutExt(this.EndKeyFrame);
  2749. output.PutBool(this.IsHarmful);
  2750. output.PutBool(this.IsCancelBySelf);
  2751. output.PutBool(this.IsDuplicating);
  2752. output.PutBool(this.IsInvisible);
  2753. output.PutBool(this.IsInvincible);
  2754. output.PutBool(this.IsSilent);
  2755. output.PutBool(this.IsCanMove);
  2756. output.PutBool(this.MakeStun);
  2757. output.PutBool(this.IgnoreControl);
  2758. output.PutBool(this.IsRemoveOnSenderRemoved);
  2759. output.PutBool(this.IsRemoveOnDead);
  2760. output.PutUTF(this.LockStateAction);
  2761. output.PutExt(this.UnitTrigger);
  2762. output.PutBool(this.MakeAvatar);
  2763. output.PutUTF(this.UnitFileName);
  2764. output.PutBool(this.UnitChangeSkills);
  2765. output.PutExt(this.UnitBaseSkillID);
  2766. output.PutList(this.UnitSkills, output.PutExt);
  2767. output.PutList(this.UnitKeepSkillsID, output.PutS32);
  2768. output.PutBool(this.IsOverlay);
  2769. output.PutU8(this.MaxOverlay);
  2770. output.PutBool(this.IsPassive);
  2771. output.PutExt(this.BindingEffect);
  2772. output.PutEnum8(this.PlayType);
  2773. output.PutList(this.BindingEffectList, output.PutExt);
  2774. output.PutList(this.OverlayBindingEffect, output.PutExt);
  2775. output.PutS32(this.ExclusiveCatgory);
  2776. output.PutS32(this.ExclusivePriority);
  2777. output.PutExt(this.Properties);
  2778. output.PutArray(this.Attributes, output.PutUTF);
  2779. output.PutBool(this.forceAdd);
  2780. }
  2781. public void ReadExternal(IInputStream input)
  2782. {
  2783. this.EditorPath = input.GetUTF();
  2784. this.ID = input.GetS32();
  2785. this.Name = input.GetUTF();
  2786. this.IconName = input.GetUTF();
  2787. this.LifeTimeMS = input.GetS32();
  2788. this.ClientVisible = input.GetBool();
  2789. this.HitIntervalMS = input.GetS32();
  2790. this.FirstTimeEnable = input.GetBool();
  2791. this.HitKeyFrame = input.GetExt<KeyFrame>();
  2792. this.KeyFrames = input.GetList<KeyFrame>(input.GetExt<KeyFrame>);
  2793. this.EndKeyFrame = input.GetExt<KeyFrame>();
  2794. this.IsHarmful = input.GetBool();
  2795. this.IsCancelBySelf = input.GetBool();
  2796. this.IsDuplicating = input.GetBool();
  2797. this.IsInvisible = input.GetBool();
  2798. this.IsInvincible = input.GetBool();
  2799. this.IsSilent = input.GetBool();
  2800. this.IsCanMove = input.GetBool();
  2801. this.MakeStun = input.GetBool();
  2802. this.IgnoreControl = input.GetBool();
  2803. this.IsRemoveOnSenderRemoved = input.GetBool();
  2804. this.IsRemoveOnDead = input.GetBool();
  2805. this.LockStateAction = input.GetUTF();
  2806. this.UnitTrigger = input.GetExt<LaunchTrigger>();
  2807. this.MakeAvatar = input.GetBool();
  2808. this.UnitFileName = input.GetUTF();
  2809. this.UnitChangeSkills = input.GetBool();
  2810. this.UnitBaseSkillID = input.GetExt<LaunchSkill>();
  2811. this.UnitSkills = input.GetList<LaunchSkill>(input.GetExt<LaunchSkill>);
  2812. this.UnitKeepSkillsID = input.GetList<int>(input.GetS32);
  2813. this.IsOverlay = input.GetBool();
  2814. this.MaxOverlay = input.GetU8();
  2815. this.IsPassive = input.GetBool();
  2816. this.BindingEffect = input.GetExt<LaunchEffect>();
  2817. this.PlayType = input.GetEnum8<BindingPlayType>();
  2818. this.BindingEffectList = input.GetList<LaunchEffect>(input.GetExt<LaunchEffect>);
  2819. this.OverlayBindingEffect = input.GetList<LaunchEffect>(input.GetExt<LaunchEffect>);
  2820. this.ExclusiveCatgory = input.GetS32();
  2821. this.ExclusivePriority = input.GetS32();
  2822. this.Properties = input.GetExt<IBuffProperties>(this.Properties);
  2823. this.Attributes = input.GetUTFArray();
  2824. this.forceAdd = input.GetBool();
  2825. }
  2826. //--------------------------------------------
  2827. //--------------------------------------------
  2828. /// <summary>
  2829. /// BUFF伤害或特效关键帧
  2830. /// </summary>
  2831. [MessageType(0x4106)]
  2832. [DescAttribute("BUFF伤害或特效关键帧")]
  2833. [Expandable]
  2834. public class KeyFrame : BaseKeyFrame, ICloneable, IExternalizable
  2835. {
  2836. /// <summary>
  2837. /// 触发的特效
  2838. /// </summary>
  2839. [DescAttribute("触发的特效")]
  2840. public LaunchEffect Effect;
  2841. /// <summary>
  2842. /// 触发新的法术
  2843. /// </summary>
  2844. [DescAttribute("触发新的法术")]
  2845. public LaunchSpell Spell;
  2846. /// <summary>
  2847. /// 攻击伤害
  2848. /// </summary>
  2849. [DescAttribute("攻击伤害")]
  2850. public AttackProp Attack;
  2851. /// <summary>
  2852. /// 直接使用道具
  2853. /// </summary>
  2854. [DescAttribute("直接使用道具")]
  2855. public UseItem Item;
  2856. /// <summary>
  2857. /// 直接使用道具
  2858. /// </summary>
  2859. [DescAttribute("场景添加道具")]
  2860. public BuffAddItem addItem;
  2861. public KeyFrame() { }
  2862. public override string ToString()
  2863. {
  2864. return "Frame: @" + FrameMS;
  2865. }
  2866. public object Clone()
  2867. {
  2868. KeyFrame ret = new KeyFrame();
  2869. ret.FrameMS = this.FrameMS;
  2870. ret.Spell = CUtils.TryClone<LaunchSpell>(this.Spell);
  2871. ret.Effect = CUtils.TryClone<LaunchEffect>(this.Effect);
  2872. ret.Attack = CUtils.TryClone<AttackProp>(this.Attack);
  2873. ret.Item = CUtils.TryClone<UseItem>(this.Item);
  2874. ret.addItem = CUtils.TryClone<BuffAddItem>(this.addItem);
  2875. return ret;
  2876. }
  2877. public void WriteExternal(IOutputStream output)
  2878. {
  2879. output.PutS32(base.FrameMS);
  2880. output.PutExt(this.Spell);
  2881. output.PutExt(this.Effect);
  2882. output.PutExt(this.Attack);
  2883. output.PutExt(this.Item);
  2884. output.PutExt(this.addItem);
  2885. }
  2886. public void ReadExternal(IInputStream input)
  2887. {
  2888. base.FrameMS = input.GetS32();
  2889. this.Spell = input.GetExt<LaunchSpell>();
  2890. this.Effect = input.GetExt<LaunchEffect>();
  2891. this.Attack = input.GetExt<AttackProp>();
  2892. this.Item = input.GetExt<UseItem>();
  2893. this.addItem = input.GetExt<BuffAddItem>();
  2894. }
  2895. }
  2896. }
  2897. //---------------------------------------------------------------------------------//
  2898. //---------------------------------------------------------------------------------//
  2899. /// <summary>
  2900. /// 掉落道具类数据结构
  2901. /// </summary>
  2902. [MessageType(0x4007)]
  2903. [DescAttribute("掉落道具类数据结构")]
  2904. [TableClassAttribute("ID")]
  2905. public class ItemTemplate : ICloneable, ITemplateData, IExternalizable
  2906. {
  2907. public int TemplateID { get { return ID; } }
  2908. [XmlSerializable()]
  2909. public string EditorPath { get; set; }
  2910. [DescAttribute("ID", "", false)]
  2911. public int ID;
  2912. [LocalizationTextAttribute]
  2913. [DescAttribute("掉落道具名字", "道具")]
  2914. public string Name;
  2915. [DescAttribute("掉落道具名字", "道具")]
  2916. public string IconName;
  2917. [DescAttribute("使用间隔时间(毫秒)", "道具")]
  2918. public int UseCoolDownTimeMS = 0;
  2919. [DescAttribute("场景显示的名字", "道具")]
  2920. public string DisplayName;
  2921. [DescAttribute("道具是否可被手动检取(如果手动检取,则不能直接走上去获得)", "捡取")]
  2922. public bool Pickable = false;
  2923. [DescAttribute("手动检取读条时间(毫秒)", "捡取")]
  2924. [DependOnProperty("Pickable")]
  2925. public int PickTimeMS = 2000;
  2926. [DescAttribute("拾取后删除", "捡取")]
  2927. public bool RemoveOnFinishPick = true;
  2928. [DescAttribute("最大拾取人数", "捡取")]
  2929. public byte maxPickPlayers = 0;
  2930. [DescAttribute("单人最大拾取次数", "捡取")]
  2931. public short maxPickTimes = 0;
  2932. [DescAttribute("掉落后多久可以获得(毫秒)", "掉落")]
  2933. public int GotCoolDownTimeMS = 500;
  2934. [DescAttribute("掉落道具全阵营有效", "掉落")]
  2935. public bool DropForAll;
  2936. [DescAttribute("掉落道具仅玩家有效", "掉落")]
  2937. public bool PlayerOnly = true;
  2938. [DescAttribute("获得即使用", "掉落")]
  2939. public bool GotOnUse = true;
  2940. [DescAttribute("掉落金币最小值", "掉落")]
  2941. public int DropMoneyMin = 0;
  2942. [DescAttribute("掉落金币最大值", "掉落")]
  2943. public int DropMoneyMax = 0;
  2944. [DescAttribute("获得后的特效(检取者)", "特效")]
  2945. public LaunchEffect GotEffect;
  2946. [DescAttribute("获得后的特效(自身)", "特效")]
  2947. public LaunchEffect GotEffectSelf;
  2948. [DescAttribute("掉落时的特效", "特效")]
  2949. public LaunchEffect DropEffect;
  2950. [ResourceIDAttribute]
  2951. [DescAttribute("资源模型名字", "资源")]
  2952. public string FileName;
  2953. [DescAttribute("拾取范围,半径", "资源")]
  2954. public float BodySize = 1f;
  2955. [DescAttribute("客户端可见", "资源")]
  2956. public bool ClientVisible = true;
  2957. [DescAttribute("道具产生后,持续时间(毫秒)", "掉落")]
  2958. public int LifeTimeMS = 10000;
  2959. [DescAttribute("道具产生后,显示截止时间戳(秒)", "掉落")]
  2960. public int LifeEndTime = 0;
  2961. [DescAttribute("道具飞到拾取者身上的插值(仅客户端表现用)", "掉落")]
  2962. public float FlyLerp = 0.1f;
  2963. [DescAttribute("是否显示持续时间 ", "掉落")]
  2964. public bool showLifeTime = false;
  2965. [DescAttribute("物品掉落的动画时长(毫秒)", "掉落")]
  2966. public float AnimatorTime = -1.0f;
  2967. [DescAttribute("仅做显示用", "掉落")]
  2968. public bool OnlyForShow = false;
  2969. [DescAttribute("模型上是否显示品质光柱", "掉落")]
  2970. public bool ShowQualityEffect = true;
  2971. [DescAttribute("使用后的特效", "特效")]
  2972. public LaunchEffect UseEffect;
  2973. [DescAttribute("使用后释放一个法术", "使用")]
  2974. public LaunchSpell UseSpell;
  2975. [DescAttribute("使用后召唤单位", "使用")]
  2976. public SummonUnit UseSummon;
  2977. [DescAttribute("使用后增加BUFF列表", "使用")]
  2978. [ListAttribute(typeof(LaunchBuff))]
  2979. public List<LaunchBuff> UseBuffs = new List<LaunchBuff>();
  2980. [DescAttribute("装备后增加BUFF列表", "装备")]
  2981. [ListAttribute(typeof(LaunchBuff))]
  2982. public List<LaunchBuff> EquipBuffs = new List<LaunchBuff>();
  2983. [DescAttribute("在背包内最大堆叠数量", "背包")]
  2984. public int MaxStackCount = 100;
  2985. [DescAttribute("最大持有数量,0表示无上限", "背包")]
  2986. public int HoldingLimit = 0;
  2987. [DescAttribute("是否在背包内可使用", "背包")]
  2988. public bool IsInventoryUseable = true;
  2989. [DescAttribute("是否可携带多个(包括堆叠)", "背包")]
  2990. public bool IsDuplicateInventory = true;
  2991. [DescAttribute("同步到服务器(可持久化保存的道具)", "背包")]
  2992. public bool SyncToServer = false;
  2993. [DescAttribute("背包道具使用读条(毫秒)", "背包")]
  2994. public int UseInProgressTimeMS = 0;
  2995. [DescAttribute("购买花费金币", "购买")]
  2996. public bool BuyCostMoney;
  2997. [DescAttribute("出售花费金币", "购买")]
  2998. public bool SellGotMoney;
  2999. [DescAttribute("是否弹出非物品类的二级面板", "显示")]
  3000. public bool IsPopPanel = false;
  3001. [DescAttribute("飞行特效", "妖气修为")]
  3002. public List<FlyEffect> Fly;
  3003. /// <summary>
  3004. /// 道具扩展属性
  3005. /// </summary>
  3006. [DescAttribute("道具扩展属性", "扩展")]
  3007. [Expandable]
  3008. [NotNull]
  3009. public IItemProperties Properties;
  3010. public ItemTemplate()
  3011. {
  3012. this.Properties = TemplateManager.Factory.CreateItemProperties();
  3013. }
  3014. public ItemTemplate(int id)
  3015. {
  3016. this.ID = id;
  3017. this.Properties = TemplateManager.Factory.CreateItemProperties();
  3018. }
  3019. public int GetID()
  3020. {
  3021. return ID;
  3022. }
  3023. public override string ToString()
  3024. {
  3025. return Name + "(" + ID + ")";
  3026. }
  3027. public object Clone()
  3028. {
  3029. ItemTemplate ret = new ItemTemplate();
  3030. ret.EditorPath = this.EditorPath;
  3031. ret.ID = this.ID;
  3032. ret.Name = this.Name;
  3033. ret.IconName = this.IconName;
  3034. ret.Pickable = this.Pickable;
  3035. ret.PickTimeMS = this.PickTimeMS;
  3036. ret.RemoveOnFinishPick = this.RemoveOnFinishPick;
  3037. ret.GotCoolDownTimeMS = this.GotCoolDownTimeMS;
  3038. ret.DropForAll = this.DropForAll;
  3039. ret.PlayerOnly = this.PlayerOnly;
  3040. ret.GotOnUse = this.GotOnUse;
  3041. ret.DropMoneyMin = this.DropMoneyMin;
  3042. ret.DropMoneyMax = this.DropMoneyMax;
  3043. ret.GotEffect = CUtils.TryClone<LaunchEffect>(this.GotEffect);
  3044. ret.GotEffectSelf = CUtils.TryClone<LaunchEffect>(this.GotEffectSelf);
  3045. ret.DropEffect = CUtils.TryClone<LaunchEffect>(this.DropEffect);
  3046. ret.FileName = this.FileName;
  3047. ret.BodySize = this.BodySize;
  3048. ret.ClientVisible = this.ClientVisible;
  3049. ret.LifeTimeMS = this.LifeTimeMS;
  3050. ret.UseEffect = CUtils.TryClone<LaunchEffect>(this.UseEffect);
  3051. ret.UseSpell = CUtils.TryClone<LaunchSpell>(this.UseSpell);
  3052. ret.UseSummon = CUtils.TryClone<SummonUnit>(this.UseSummon);
  3053. ret.UseBuffs = CUtils.CloneList<LaunchBuff>(this.UseBuffs);
  3054. ret.EquipBuffs = CUtils.CloneList<LaunchBuff>(this.EquipBuffs);
  3055. ret.MaxStackCount = this.MaxStackCount;
  3056. ret.HoldingLimit = this.HoldingLimit;
  3057. ret.IsInventoryUseable = this.IsInventoryUseable;
  3058. ret.UseCoolDownTimeMS = this.UseCoolDownTimeMS;
  3059. ret.IsDuplicateInventory = this.IsDuplicateInventory;
  3060. ret.SyncToServer = this.SyncToServer;
  3061. ret.UseInProgressTimeMS = this.UseInProgressTimeMS;
  3062. ret.FlyLerp = this.FlyLerp;
  3063. ret.showLifeTime = this.showLifeTime;
  3064. ret.AnimatorTime = this.AnimatorTime;
  3065. ret.LifeEndTime = this.LifeEndTime;
  3066. ret.IsPopPanel = this.IsPopPanel;
  3067. ret.Fly = CUtils.CloneList<FlyEffect>(this.Fly);
  3068. ret.Properties = CUtils.TryClone<IItemProperties>(this.Properties);
  3069. ret.maxPickPlayers = this.maxPickPlayers;
  3070. ret.maxPickTimes = this.maxPickTimes;
  3071. ret.OnlyForShow = this.OnlyForShow;
  3072. ret.DisplayName = this.DisplayName;
  3073. ret.ShowQualityEffect = this.ShowQualityEffect;
  3074. return ret;
  3075. }
  3076. public void WriteExternal(IOutputStream output)
  3077. {
  3078. output.PutUTF(this.EditorPath);
  3079. output.PutS32(this.ID);
  3080. output.PutUTF(this.Name);
  3081. output.PutUTF(this.IconName);
  3082. output.PutBool(this.Pickable);
  3083. output.PutS32(this.PickTimeMS);
  3084. output.PutBool(this.RemoveOnFinishPick);
  3085. output.PutS32(this.GotCoolDownTimeMS);
  3086. output.PutBool(this.DropForAll);
  3087. output.PutBool(this.PlayerOnly);
  3088. output.PutBool(this.GotOnUse);
  3089. output.PutS32(this.DropMoneyMin);
  3090. output.PutS32(this.DropMoneyMax);
  3091. output.PutExt(this.GotEffect);
  3092. output.PutExt(this.GotEffectSelf);
  3093. output.PutExt(this.DropEffect);
  3094. output.PutUTF(this.FileName);
  3095. output.PutF32(this.BodySize);
  3096. output.PutBool(this.ClientVisible);
  3097. output.PutS32(this.LifeTimeMS);
  3098. output.PutExt(this.UseEffect);
  3099. output.PutExt(this.UseSpell);
  3100. output.PutExt(this.UseSummon);
  3101. output.PutList(this.UseBuffs, output.PutExt);
  3102. output.PutList(this.EquipBuffs, output.PutExt);
  3103. output.PutS32(this.MaxStackCount);
  3104. output.PutS32(this.HoldingLimit);
  3105. output.PutBool(this.IsInventoryUseable);
  3106. output.PutS32(this.UseCoolDownTimeMS);
  3107. output.PutBool(this.IsDuplicateInventory);
  3108. output.PutBool(this.SyncToServer);
  3109. output.PutS32(this.UseInProgressTimeMS);
  3110. output.PutExt(this.Properties);
  3111. output.PutBool(this.showLifeTime);
  3112. output.PutF32(this.FlyLerp);
  3113. if (this.showLifeTime)
  3114. {
  3115. output.PutS32(this.LifeEndTime);
  3116. }
  3117. output.PutF32(this.AnimatorTime);
  3118. output.PutBool(this.IsPopPanel);
  3119. output.PutList<FlyEffect>(this.Fly, output.PutExt);
  3120. output.PutS16(this.maxPickTimes);
  3121. output.PutU8(this.maxPickPlayers);
  3122. output.PutBool(this.OnlyForShow);
  3123. output.PutUTF(this.DisplayName);
  3124. output.PutBool(this.ShowQualityEffect);
  3125. }
  3126. public void ReadExternal(IInputStream input)
  3127. {
  3128. this.EditorPath = input.GetUTF();
  3129. this.ID = input.GetS32();
  3130. this.Name = input.GetUTF();
  3131. this.IconName = input.GetUTF();
  3132. this.Pickable = input.GetBool();
  3133. this.PickTimeMS = input.GetS32();
  3134. this.RemoveOnFinishPick = input.GetBool();
  3135. this.GotCoolDownTimeMS = input.GetS32();
  3136. this.DropForAll = input.GetBool();
  3137. this.PlayerOnly = input.GetBool();
  3138. this.GotOnUse = input.GetBool();
  3139. this.DropMoneyMin = input.GetS32();
  3140. this.DropMoneyMax = input.GetS32();
  3141. this.GotEffect = input.GetExt<LaunchEffect>();
  3142. this.GotEffectSelf = input.GetExt<LaunchEffect>();
  3143. this.DropEffect = input.GetExt<LaunchEffect>();
  3144. this.FileName = input.GetUTF();
  3145. this.BodySize = input.GetF32();
  3146. this.ClientVisible = input.GetBool();
  3147. this.LifeTimeMS = input.GetS32();
  3148. this.UseEffect = input.GetExt<LaunchEffect>();
  3149. this.UseSpell = input.GetExt<LaunchSpell>();
  3150. this.UseSummon = input.GetExt<SummonUnit>();
  3151. this.UseBuffs = input.GetList<LaunchBuff>(input.GetExt<LaunchBuff>);
  3152. this.EquipBuffs = input.GetList<LaunchBuff>(input.GetExt<LaunchBuff>);
  3153. this.MaxStackCount = input.GetS32();
  3154. this.HoldingLimit = input.GetS32();
  3155. this.IsInventoryUseable = input.GetBool();
  3156. this.UseCoolDownTimeMS = input.GetS32();
  3157. this.IsDuplicateInventory = input.GetBool();
  3158. this.SyncToServer = input.GetBool();
  3159. this.UseInProgressTimeMS = input.GetS32();
  3160. this.Properties = input.GetExt<IItemProperties>(this.Properties);
  3161. this.showLifeTime = input.GetBool();
  3162. this.FlyLerp = input.GetF32();
  3163. if (this.showLifeTime)
  3164. {
  3165. this.LifeEndTime = input.GetS32();
  3166. }
  3167. this.AnimatorTime = input.GetF32();
  3168. this.IsPopPanel = input.GetBool();
  3169. this.Fly = input.GetList<FlyEffect>(input.GetExt<FlyEffect>);
  3170. this.maxPickTimes = input.GetS16();
  3171. this.maxPickPlayers = input.GetU8();
  3172. this.OnlyForShow = input.GetBool();
  3173. this.DisplayName = input.GetUTF();
  3174. this.ShowQualityEffect = input.GetBool();
  3175. }
  3176. }
  3177. [MessageType(0x4018)]
  3178. [DescAttribute("物品飞行特效")]
  3179. [Expandable]
  3180. public class FlyEffect : ICloneable, IExternalizable
  3181. {
  3182. [DescAttribute("特效名字")]
  3183. public string Name;
  3184. [DescAttribute("特效时长(秒数)")]
  3185. public float Time;
  3186. [DescAttribute("以玩家为目标点")]
  3187. public bool isActorPos;
  3188. [DescAttribute("是否绑定在节点上")]
  3189. public bool isBindPart;
  3190. [DescAttribute("特效飞至的部位")]
  3191. public string PartName;
  3192. [DescAttribute("特效拉升的高度")]
  3193. public float Height;
  3194. [DescAttribute("特效速度")]
  3195. public float Speed;
  3196. [DescAttribute("运行方向 0:原点 1:上 2:下 3:左 4:右 5:前 6:后")]
  3197. public byte RunDirection = 0;
  3198. [DescAttribute("音效文件名")]
  3199. public string AudioName;
  3200. [DescAttribute("是否到达玩家位置就删除特效")]
  3201. public bool IsGoToActorPosAndRemove;
  3202. [DescAttribute("特效和玩家之间的最小距离,小于等于这个距离,这个特效将会移除")]
  3203. [DependOnProperty("IsGoToActorPosAndRemove")]
  3204. public float MinDistance = 0.05f;
  3205. [DescAttribute("基于此节点激活间隔时长")]
  3206. public bool IsBeginActiveIntervalTime = false;
  3207. [DescAttribute("间隔时长,基于激活后的时间间隔")]
  3208. public float IntervalTime = -1;
  3209. [DescAttribute("此特效移除后,关联下一个特效的index")]
  3210. public int NextEffectIndex = -1;
  3211. [DescAttribute("此特效生成时,基于那个index特效的坐标")]
  3212. public int PosIndex = -1;
  3213. public object Clone()
  3214. {
  3215. FlyEffect ret = new FlyEffect();
  3216. ret.Name = this.Name;
  3217. ret.Time = this.Time;
  3218. ret.PartName = this.PartName;
  3219. ret.Height = this.Height;
  3220. ret.isActorPos = this.isActorPos;
  3221. ret.isBindPart = this.isBindPart;
  3222. ret.Speed = this.Speed;
  3223. ret.RunDirection = this.RunDirection;
  3224. ret.AudioName = this.AudioName;
  3225. ret.IsGoToActorPosAndRemove = this.IsGoToActorPosAndRemove;
  3226. ret.IsBeginActiveIntervalTime = this.IsBeginActiveIntervalTime;
  3227. ret.IntervalTime = this.IntervalTime;
  3228. ret.NextEffectIndex = this.NextEffectIndex;
  3229. ret.PosIndex = this.PosIndex;
  3230. return ret;
  3231. }
  3232. public void ReadExternal(IInputStream input)
  3233. {
  3234. this.Name = input.GetUTF();
  3235. this.Time = input.GetF32();
  3236. this.PartName = input.GetUTF();
  3237. this.Height = input.GetF32();
  3238. this.isActorPos = input.GetBool();
  3239. this.isBindPart = input.GetBool();
  3240. this.Speed = input.GetF32();
  3241. this.RunDirection = input.GetU8();
  3242. this.AudioName = input.GetUTF();
  3243. this.IsGoToActorPosAndRemove = input.GetBool();
  3244. this.IsBeginActiveIntervalTime = input.GetBool();
  3245. this.IntervalTime = input.GetF32();
  3246. this.NextEffectIndex = input.GetS32();
  3247. this.PosIndex = input.GetS32();
  3248. }
  3249. public void WriteExternal(IOutputStream output)
  3250. {
  3251. output.PutUTF(this.Name);
  3252. output.PutF32(this.Time);
  3253. output.PutUTF(this.PartName);
  3254. output.PutF32(this.Height);
  3255. output.PutBool(this.isActorPos);
  3256. output.PutBool(this.isBindPart);
  3257. output.PutF32(this.Speed);
  3258. output.PutU8(this.RunDirection);
  3259. output.PutUTF(this.AudioName);
  3260. output.PutBool(this.IsGoToActorPosAndRemove);
  3261. output.PutBool(this.IsBeginActiveIntervalTime);
  3262. output.PutF32(this.IntervalTime);
  3263. output.PutS32(this.NextEffectIndex);
  3264. output.PutS32(this.PosIndex);
  3265. }
  3266. }
  3267. //---------------------------------------------------------------------------------//
  3268. [MessageType(0x4015)]
  3269. [DescAttribute("单位事件触发")]
  3270. [TableClassAttribute("ID")]
  3271. public class UnitEventTemplate : ICloneable, ITemplateData, IExternalizable
  3272. {
  3273. public int TemplateID { get { return ID; } }
  3274. [XmlSerializable()]
  3275. public string EditorPath { get; set; }
  3276. [DescAttribute("ID", "", false)]
  3277. public int ID;
  3278. [LocalizationTextAttribute]
  3279. [DescAttribute("单位事件触发名字", "基础")]
  3280. public string Name;
  3281. [DescAttribute("所有事件", "基础", false)]
  3282. public List<UnitEvent> Events = new List<UnitEvent>();
  3283. public override string ToString()
  3284. {
  3285. return Name + "(" + ID + ")";
  3286. }
  3287. public object Clone()
  3288. {
  3289. UnitEventTemplate ret = new UnitEventTemplate();
  3290. ret.EditorPath = this.EditorPath;
  3291. ret.ID = this.ID;
  3292. ret.Name = this.Name;
  3293. ret.Events = CUtils.CloneList<UnitEvent>(this.Events);
  3294. return ret;
  3295. }
  3296. public void WriteExternal(IOutputStream output)
  3297. {
  3298. output.PutUTF(this.EditorPath);
  3299. output.PutS32(this.ID);
  3300. output.PutUTF(this.Name);
  3301. output.PutList(this.Events, output.PutExt);
  3302. }
  3303. public void ReadExternal(IInputStream input)
  3304. {
  3305. this.EditorPath = input.GetUTF();
  3306. this.ID = input.GetS32();
  3307. this.Name = input.GetUTF();
  3308. this.Events = input.GetList(input.GetExt<UnitEvent>);
  3309. }
  3310. public UnitEvent GetEvent(string name)
  3311. {
  3312. foreach (var e in Events)
  3313. {
  3314. if (e.Name == name) { return e; }
  3315. }
  3316. return null;
  3317. }
  3318. }
  3319. #endregion
  3320. //---------------------------------------------------------------------------------//
  3321. #region __Launch_Objects__
  3322. public abstract class BaseKeyFrame
  3323. {
  3324. [DescAttribute("关键帧时间(毫秒)")]
  3325. public int FrameMS;
  3326. }
  3327. /// <summary>
  3328. /// 技能或者法术产生的攻击属性
  3329. /// </summary>
  3330. [MessageType(0x4008)]
  3331. [DescAttribute("技能或者法术产生的攻击属性")]
  3332. [Expandable]
  3333. public class AttackProp : ISNData, ICloneable
  3334. {
  3335. /// <summary>
  3336. /// 攻击力
  3337. /// </summary>
  3338. [DescAttribute("攻击力")]
  3339. public int Attack;
  3340. [DescAttribute("产生受击", "Mask")]
  3341. public bool MaskDamage = false;
  3342. [DescAttribute("产生击飞", "Mask")]
  3343. [DependOnProperty("MaskDamage")]
  3344. public bool MaskHitFly = false;
  3345. [DescAttribute("产生击倒", "Mask")]
  3346. [DependOnProperty("MaskDamage")]
  3347. public bool MaskKnockDown = false;
  3348. [DescAttribute("此次攻击必命中,即使命中为0", "Mask")]
  3349. public bool MaskMustHit = false;
  3350. [DescAttribute("此次攻击必暴击,即使暴击为0", "Mask")]
  3351. public bool MaskMustCritical = false;
  3352. [DescAttribute("击中力度(大于目标体重才会产生受击)", "受击")]
  3353. [DependOnProperty("MaskDamage")]
  3354. public int Weight = 1;
  3355. [DescAttribute("单位被(受击、击倒、眩晕、混乱)持续时间(毫秒)" +
  3356. "\n * 此时间如果为0,首先选用单位DamageTimeMS,否则然后采用Config环境参数OBJECT_DAMAGE_TIME_MS替代之。" +
  3357. "\n * HitMove运动时间不计算在KnockOutTimeMS内。", "受击")]
  3358. [DependOnProperty("MaskDamage")]
  3359. public int KnockOutTimeMS = 0;
  3360. [DescAttribute("受击动作名", "受击")]
  3361. [DependOnProperty("MaskDamage")]
  3362. public string DamageActionName = null;
  3363. [DescAttribute("受击时,不再遭受其他攻击", "受击")]
  3364. [DependOnProperty("MaskDamage")]
  3365. public bool IsDamageProtect = false;
  3366. public bool IsHitMove { get { return MaskDamage && HitMove != null; } }
  3367. [DescAttribute("被击中后向后移动距离(包括击飞控制)", "受击")]
  3368. [DependOnProperty("MaskDamage")]
  3369. public StartMove HitMove;
  3370. public enum HitMoveType : byte
  3371. {
  3372. [DescAttribute("根据攻击者位置(台球碰撞)")]
  3373. BySenderPosition,
  3374. [DescAttribute("根据攻击者朝向(单向)")]
  3375. BySenderDirection,
  3376. [DescAttribute("根据攻击者朝向的左右边(摩西分海)")]
  3377. BySenderLeftRight,
  3378. [DescAttribute("位移至攻击者中心(向里吸)")]
  3379. ToSenderCenter,
  3380. [DescAttribute("位移至攻击者身边(向里吸)")]
  3381. ToSenderBodySize,
  3382. [DescAttribute("位移至攻击固定范围外")]
  3383. BySenderRange,
  3384. }
  3385. [DescAttribute("受击位移计算方式", "受击")]
  3386. [DependOnProperty("IsHitMove")]
  3387. public HitMoveType HitMoveMType = HitMoveType.BySenderPosition;
  3388. [DescAttribute("受击位移时对其他单位产生伤害", "受击")]
  3389. [DependOnProperty("IsHitMove")]
  3390. public AttackProp HitMoveBodyAttack;
  3391. [DescAttribute("基于被攻击者身体范围的增加范围", "受击")]
  3392. [DependOnProperty("IsHitMove")]
  3393. public float HitMoveBodyAttackSize = 1;
  3394. [DescAttribute("被击飞落地后产生伤害,或者位移结束产生伤害", "受击")]
  3395. [DependOnProperty("MaskDamage")]
  3396. [DependOnProperty("MaskHitFly")]
  3397. public AttackProp FlyFallenDownAttack;
  3398. [DescAttribute("被击中特效", "被击中")]
  3399. public LaunchEffect Effect;
  3400. [DescAttribute("被击中触发一个BUFF", "被击中")]
  3401. public LaunchBuff Buff;
  3402. [DescAttribute("被击中触发一个Spell", "被击中")]
  3403. public LaunchSpell Spell;
  3404. [DescAttribute("百分比概率击碎目标", "击碎")]
  3405. public float CrushPercent = 0;
  3406. [DescAttribute("击碎目标效果", "击碎")]
  3407. public LaunchEffect CrushEffect;
  3408. [DescAttribute("定帧时长", "客户端")]
  3409. public int StopFrameMS = 0;
  3410. [DescAttribute("定帧类型", "客户端")]
  3411. public string StopFrameAction;
  3412. /// <summary>
  3413. /// 用户自定义扩展属性
  3414. /// </summary>
  3415. [DescAttribute("用户自定义扩展属性", "扩展")]
  3416. [Expandable]
  3417. [NotNull]
  3418. public IAttackProperties Properties;
  3419. [DescAttribute("打死小怪是否击退", "受击")]
  3420. public KillHitMove killHitMove;
  3421. public AttackProp()
  3422. {
  3423. Properties = TemplateManager.Factory.CreateAttackProperties();
  3424. }
  3425. /// <summary>
  3426. /// 是否产生受击
  3427. /// </summary>
  3428. /// <returns></returns>
  3429. public bool IsDamage()
  3430. {
  3431. return MaskDamage || MaskHitFly || MaskKnockDown;
  3432. }
  3433. public override string ToString()
  3434. {
  3435. return "攻击";
  3436. }
  3437. public object Clone()
  3438. {
  3439. AttackProp ret = new AttackProp();
  3440. ret.SerialNumber = this.SerialNumber;
  3441. ret.Attack = this.Attack;
  3442. ret.MaskDamage = this.MaskDamage;
  3443. ret.MaskHitFly = this.MaskHitFly;
  3444. ret.MaskKnockDown = this.MaskKnockDown;
  3445. ret.MaskMustHit = this.MaskMustHit;
  3446. ret.MaskMustCritical = this.MaskMustCritical;
  3447. ret.Weight = this.Weight;
  3448. ret.KnockOutTimeMS = this.KnockOutTimeMS;
  3449. ret.IsDamageProtect = this.IsDamageProtect;
  3450. ret.DamageActionName = this.DamageActionName;
  3451. ret.Effect = CUtils.TryClone<LaunchEffect>(this.Effect);
  3452. ret.Buff = CUtils.TryClone<LaunchBuff>(this.Buff);
  3453. ret.Spell = CUtils.TryClone<LaunchSpell>(this.Spell);
  3454. ret.HitMove = CUtils.TryClone<StartMove>(this.HitMove);
  3455. ret.HitMoveMType = this.HitMoveMType;
  3456. ret.HitMoveBodyAttack = CUtils.TryClone<AttackProp>(this.HitMoveBodyAttack);
  3457. ret.HitMoveBodyAttackSize = this.HitMoveBodyAttackSize;
  3458. ret.FlyFallenDownAttack = CUtils.TryClone<AttackProp>(this.FlyFallenDownAttack);
  3459. ret.StopFrameMS = this.StopFrameMS;
  3460. ret.StopFrameAction = this.StopFrameAction;
  3461. ret.CrushPercent = this.CrushPercent;
  3462. ret.CrushEffect = CUtils.TryClone<LaunchEffect>(this.CrushEffect);
  3463. ret.Properties = CUtils.TryClone<IAttackProperties>(this.Properties);
  3464. ret.killHitMove = CUtils.TryClone<KillHitMove>(this.killHitMove);
  3465. return ret;
  3466. }
  3467. public override void WriteExternal(IOutputStream output)
  3468. {
  3469. base.WriteExternal(output);
  3470. output.PutS32(this.Attack);
  3471. output.PutBool(this.MaskDamage);
  3472. output.PutBool(this.MaskHitFly);
  3473. output.PutBool(this.MaskKnockDown);
  3474. output.PutBool(this.MaskMustHit);
  3475. output.PutBool(this.MaskMustCritical);
  3476. output.PutS32(this.Weight);
  3477. output.PutS32(this.KnockOutTimeMS);
  3478. output.PutBool(this.IsDamageProtect);
  3479. output.PutUTF(this.DamageActionName);
  3480. output.PutExt(this.Effect);
  3481. output.PutExt(this.Buff);
  3482. output.PutExt(this.Spell);
  3483. output.PutExt(this.HitMove);
  3484. output.PutEnum8(this.HitMoveMType);
  3485. output.PutExt(this.HitMoveBodyAttack);
  3486. output.PutF32(this.HitMoveBodyAttackSize);
  3487. output.PutExt(this.FlyFallenDownAttack);
  3488. output.PutS32(this.StopFrameMS);
  3489. output.PutUTF(this.StopFrameAction);
  3490. output.PutF32(this.CrushPercent);
  3491. output.PutExt(this.CrushEffect);
  3492. output.PutExt(this.Properties);
  3493. output.PutExt(this.killHitMove);
  3494. }
  3495. public override void ReadExternal(IInputStream input)
  3496. {
  3497. base.ReadExternal(input);
  3498. this.Attack = input.GetS32();
  3499. this.MaskDamage = input.GetBool();
  3500. this.MaskHitFly = input.GetBool();
  3501. this.MaskKnockDown = input.GetBool();
  3502. this.MaskMustHit = input.GetBool();
  3503. this.MaskMustCritical = input.GetBool();
  3504. this.Weight = input.GetS32();
  3505. this.KnockOutTimeMS = input.GetS32();
  3506. this.IsDamageProtect = input.GetBool();
  3507. this.DamageActionName = input.GetUTF();
  3508. this.Effect = input.GetExt<LaunchEffect>();
  3509. this.Buff = input.GetExt<LaunchBuff>();
  3510. this.Spell = input.GetExt<LaunchSpell>();
  3511. this.HitMove = input.GetExt<StartMove>();
  3512. this.HitMoveMType = input.GetEnum8<HitMoveType>();
  3513. this.HitMoveBodyAttack = input.GetExt<AttackProp>();
  3514. this.HitMoveBodyAttackSize = input.GetF32();
  3515. this.FlyFallenDownAttack = input.GetExt<AttackProp>();
  3516. this.StopFrameMS = input.GetS32();
  3517. this.StopFrameAction = input.GetUTF();
  3518. this.CrushPercent = input.GetF32();
  3519. this.CrushEffect = input.GetExt<LaunchEffect>();
  3520. this.Properties = input.GetExt<IAttackProperties>(this.Properties);
  3521. this.killHitMove = input.GetExt<KillHitMove>();
  3522. }
  3523. }
  3524. //---------------------------------------------------------------------------------//
  3525. /// <summary>
  3526. /// 触发特效,一般只用于显示
  3527. /// </summary>
  3528. [MessageType(0x4009)]
  3529. [DescAttribute("触发特效,一般只用于显示")]
  3530. [Expandable]
  3531. public class LaunchEffect : ISNData, ICloneable
  3532. {
  3533. public enum RunType : byte
  3534. {
  3535. [DescAttribute("默认,沒有運行")]
  3536. None = 0,
  3537. [DescAttribute("圓形,以綁定點未中心")]
  3538. Cycle_BindName = 1,
  3539. }
  3540. [DescAttribute("触发的特效名字")]
  3541. [ResourceIDAttribute]
  3542. public string Name;
  3543. [DescAttribute("触发特效是否绑定在特定单位")]
  3544. public bool BindBody = true;
  3545. [DescAttribute("绑定挂载点位置")]
  3546. public string BindPartName;
  3547. [DescAttribute("如果不为0,则特效以该尺寸缩放")]
  3548. public float ScaleToBodySize;
  3549. [DescAttribute("特效高度的偏移量")]
  3550. public float EffectHight = 0;
  3551. [DescAttribute("特效水平方向的偏移量x")]
  3552. public float EffectOffsetX = 0;
  3553. [DescAttribute("特效水平方向的偏移量x")]
  3554. public float EffectOffsetY = 0;
  3555. [DescAttribute("音效")]
  3556. [ResourceIDAttribute]
  3557. public string SoundName;
  3558. [DescAttribute("震屏时长(毫秒)", "震屏")]
  3559. public int EarthQuakeMS;
  3560. [DescAttribute("震屏幅度", "震屏")]
  3561. public float EarthQuakeXYZ;
  3562. [DescAttribute("自定义字段", "特效扩展")]
  3563. public string Tag;
  3564. [DescAttribute("摄像机动画名字")]
  3565. public string CameraAnimation;
  3566. [DescAttribute("特效持续时间,0表示只播放一次")]
  3567. public int EffectTimeMS = 0;
  3568. [DescAttribute("是否循环")]
  3569. public bool IsLoop = false;
  3570. [DescAttribute("是否同步施法者的Rotation")]
  3571. public bool IsSyncSenderRotation = false;
  3572. [DescAttribute("速度(原始动画/特效速度 * 速度)", "特效加速")]
  3573. public float EffectAddSpeed = 1;
  3574. [DescAttribute("特效中存在的动画,动画的名字", "特效加速")]
  3575. public string AnimtionName;
  3576. [DescAttribute("Buff運行方式")]
  3577. public RunType RType = RunType.None;
  3578. [DescAttribute("圆形运行参数设置")]
  3579. public CricleSpeedMode CricleMode;
  3580. public override string ToString()
  3581. {
  3582. return "触发特效:" + Name;
  3583. }
  3584. public object Clone()
  3585. {
  3586. LaunchEffect ret = new LaunchEffect();
  3587. ret.SerialNumber = this.SerialNumber;
  3588. ret.Name = this.Name;
  3589. ret.BindBody = this.BindBody;
  3590. ret.BindPartName = this.BindPartName;
  3591. ret.ScaleToBodySize = this.ScaleToBodySize;
  3592. ret.EffectHight = this.EffectHight;
  3593. ret.SoundName = this.SoundName;
  3594. ret.EarthQuakeMS = this.EarthQuakeMS;
  3595. ret.EarthQuakeXYZ = this.EarthQuakeXYZ;
  3596. ret.Tag = this.Tag;
  3597. ret.CameraAnimation = this.CameraAnimation;
  3598. ret.EffectTimeMS = this.EffectTimeMS;
  3599. ret.IsLoop = this.IsLoop;
  3600. ret.IsSyncSenderRotation = this.IsSyncSenderRotation;
  3601. ret.EffectAddSpeed = this.EffectAddSpeed;
  3602. ret.AnimtionName = this.AnimtionName;
  3603. ret.RType = this.RType;
  3604. ret.CricleMode = CUtils.TryClone<CricleSpeedMode>(this.CricleMode);
  3605. return ret;
  3606. }
  3607. public override void WriteExternal(IOutputStream output)
  3608. {
  3609. base.WriteExternal(output);
  3610. output.PutUTF(this.Name);
  3611. output.PutBool(this.BindBody);
  3612. output.PutUTF(this.BindPartName);
  3613. output.PutF32(this.ScaleToBodySize);
  3614. output.PutF32(this.EffectHight);
  3615. output.PutUTF(this.SoundName);
  3616. output.PutS32(this.EarthQuakeMS);
  3617. output.PutF32(this.EarthQuakeXYZ);
  3618. output.PutUTF(this.Tag);
  3619. output.PutUTF(this.CameraAnimation);
  3620. output.PutS32(this.EffectTimeMS);
  3621. output.PutBool(this.IsLoop);
  3622. output.PutBool(this.IsSyncSenderRotation);
  3623. output.PutF32(this.EffectAddSpeed);
  3624. output.PutUTF(this.AnimtionName);
  3625. output.PutEnum8(this.RType);
  3626. output.PutExt(this.CricleMode);
  3627. }
  3628. public override void ReadExternal(IInputStream input)
  3629. {
  3630. base.ReadExternal(input);
  3631. this.Name = input.GetUTF();
  3632. this.BindBody = input.GetBool();
  3633. this.BindPartName = input.GetUTF();
  3634. this.ScaleToBodySize = input.GetF32();
  3635. this.EffectHight = input.GetF32();
  3636. this.SoundName = input.GetUTF();
  3637. this.EarthQuakeMS = input.GetS32();
  3638. this.EarthQuakeXYZ = input.GetF32();
  3639. this.Tag = input.GetUTF();
  3640. this.CameraAnimation = input.GetUTF();
  3641. this.EffectTimeMS = input.GetS32();
  3642. this.IsLoop = input.GetBool();
  3643. this.IsSyncSenderRotation = input.GetBool();
  3644. this.EffectAddSpeed = input.GetF32();
  3645. this.AnimtionName = input.GetUTF();
  3646. this.RType = input.GetEnum8<RunType>();
  3647. this.CricleMode = input.GetExt<CricleSpeedMode>();
  3648. }
  3649. }
  3650. [MessageType(0x4017)]
  3651. [DescAttribute("围绕中心点圆形运行(美术工程有testpos脚本,方便快速调试)")]
  3652. [Expandable]
  3653. public class CricleSpeedMode : ISNData, ICloneable
  3654. {
  3655. [DescAttribute("挂节点的半径")]
  3656. public string[] EffectName;
  3657. [DescAttribute("挂节点的半径")]
  3658. public float Radius = 0;
  3659. [DescAttribute("点间距")]
  3660. public float Gap = 0;
  3661. [DescAttribute("弧度")]
  3662. public float Radian = 0;
  3663. [DescAttribute("圆点距离")]
  3664. public float CircleCenterDis = 0;
  3665. [DescAttribute("圆点距离2")]
  3666. public float CircleCenterDis2 = 0;
  3667. [DescAttribute("互斥度")]
  3668. public float Mutual = 0;
  3669. [DescAttribute("高度")]
  3670. public float Height = 0;
  3671. [DescAttribute("x轴弧度")]
  3672. public float X_Direction = 0;
  3673. [DescAttribute("y轴弧度")]
  3674. public float Y_Direction = 0;
  3675. [DescAttribute("z轴弧度")]
  3676. public float Z_Direction = 0;
  3677. [DescAttribute("旋转速度")]
  3678. public float RotationSpeed = 0;
  3679. public object Clone()
  3680. {
  3681. CricleSpeedMode ret = new CricleSpeedMode();
  3682. ret.SerialNumber = this.SerialNumber;
  3683. ret.EffectName = CUtils.CloneArray<string>(this.EffectName);
  3684. ret.Radius = this.Radius;
  3685. ret.Gap = this.Gap;
  3686. ret.Radian = this.Radian;
  3687. ret.CircleCenterDis = this.CircleCenterDis;
  3688. ret.CircleCenterDis2 = this.CircleCenterDis2;
  3689. ret.Mutual = this.Mutual;
  3690. ret.Height = this.Height;
  3691. ret.X_Direction = this.X_Direction;
  3692. ret.Y_Direction = this.Y_Direction;
  3693. ret.Z_Direction = this.Z_Direction;
  3694. ret.RotationSpeed = this.RotationSpeed;
  3695. return ret;
  3696. }
  3697. public override void WriteExternal(IOutputStream output)
  3698. {
  3699. base.WriteExternal(output);
  3700. output.PutArray(this.EffectName, output.PutUTF);
  3701. output.PutF32(this.Radius);
  3702. output.PutF32(this.Gap);
  3703. output.PutF32(this.Radian);
  3704. output.PutF32(this.CircleCenterDis);
  3705. output.PutF32(this.CircleCenterDis2);
  3706. output.PutF32(this.Mutual);
  3707. output.PutF32(this.Height);
  3708. output.PutF32(this.X_Direction);
  3709. output.PutF32(this.Y_Direction);
  3710. output.PutF32(this.Z_Direction);
  3711. output.PutF32(this.RotationSpeed);
  3712. }
  3713. public override void ReadExternal(IInputStream input)
  3714. {
  3715. base.ReadExternal(input);
  3716. this.EffectName = input.GetUTFArray();
  3717. this.Radius = input.GetF32();
  3718. this.Gap = input.GetF32();
  3719. this.Radian = input.GetF32();
  3720. this.CircleCenterDis = input.GetF32();
  3721. this.CircleCenterDis2 = input.GetF32();
  3722. this.Mutual = input.GetF32();
  3723. this.Height = input.GetF32();
  3724. this.X_Direction = input.GetF32();
  3725. this.Y_Direction = input.GetF32();
  3726. this.Z_Direction = input.GetF32();
  3727. this.RotationSpeed = input.GetF32();
  3728. }
  3729. }
  3730. //---------------------------------------------------------------------------------//
  3731. /// <summary>
  3732. /// 发起法术或者飞行道具
  3733. /// </summary>
  3734. [MessageType(0x400A)]
  3735. [DescAttribute("释技能")]
  3736. [Expandable]
  3737. public class LaunchSkill : ISNData, ICloneable
  3738. {
  3739. [DescAttribute("SkillID")]
  3740. [TemplateIDAttribute(typeof(SkillTemplate))]
  3741. public int SkillID;
  3742. [DescAttribute("释放技能权值-弃用")]
  3743. public int Priority;
  3744. [DescAttribute("AI自动释放技能-内部使用,不能设置")]
  3745. public bool AutoLaunch = true;
  3746. public LaunchSkill() { }
  3747. public LaunchSkill(int skillID)
  3748. {
  3749. this.SkillID = skillID;
  3750. }
  3751. public override string ToString()
  3752. {
  3753. return "触发技能:" + SkillID;
  3754. }
  3755. public object Clone()
  3756. {
  3757. LaunchSkill ret = new LaunchSkill();
  3758. ret.SerialNumber = this.SerialNumber;
  3759. ret.SkillID = this.SkillID;
  3760. ret.Priority = this.Priority;
  3761. ret.AutoLaunch = this.AutoLaunch;
  3762. return ret;
  3763. }
  3764. public override void WriteExternal(IOutputStream output)
  3765. {
  3766. base.WriteExternal(output);
  3767. output.PutS32(SkillID);
  3768. output.PutS32(Priority);
  3769. output.PutBool(AutoLaunch);
  3770. }
  3771. public override void ReadExternal(IInputStream input)
  3772. {
  3773. base.ReadExternal(input);
  3774. this.SkillID = input.GetS32();
  3775. this.Priority = input.GetS32();
  3776. this.AutoLaunch = input.GetBool();
  3777. }
  3778. }
  3779. //---------------------------------------------------------------------------------//
  3780. /// <summary>
  3781. /// 发起法术或者飞行道具
  3782. /// </summary>
  3783. [MessageType(0x400B)]
  3784. [DescAttribute("释放法术或者飞行道具")]
  3785. [Expandable]
  3786. public class LaunchSpell : ISNData, ICloneable
  3787. {
  3788. public enum PosType : byte
  3789. {
  3790. /// <summary>
  3791. /// 默认释放一个法术
  3792. /// </summary>
  3793. POS_TYPE_DEFAULT_SINGLE = 0,
  3794. /// <summary>
  3795. /// 随机范围内目标施放法术
  3796. /// </summary>
  3797. POS_TYPE_RANDOM_FOR_SPELL = 1,
  3798. /// <summary>
  3799. /// 打出圆环多个法术
  3800. /// </summary>
  3801. POS_TYPE_CYCLE = 2,
  3802. /// <summary>
  3803. /// 打出扇形多个法术
  3804. /// </summary>
  3805. POS_TYPE_FAN = 3,
  3806. /// <summary>
  3807. /// 随机方向
  3808. /// </summary>
  3809. POS_TYPE_RANDOM_DIRECTION = 4,
  3810. /// <summary>
  3811. /// 范围
  3812. /// </summary>
  3813. POS_TYPE_AREA = 5,
  3814. /// <summary>
  3815. /// 向同一个目标发射三个锁定法术
  3816. /// </summary>
  3817. POS_TYPE_TOSAMETARGET = 6,
  3818. /// <summary>
  3819. /// X型法术
  3820. /// </summary>
  3821. POS_TYPE_X = 7,
  3822. /// <summary>
  3823. /// 随机范围内施放法术
  3824. /// </summary>
  3825. POS_TYPE_RANDOM_POS = 8,
  3826. /// <summary>
  3827. /// 火箭飞弹
  3828. ///
  3829. /// </summary>
  3830. POS_TYPE_MANY_CANNON = 9,
  3831. }
  3832. /// <summary>
  3833. /// 触发新的法术
  3834. /// </summary>
  3835. [DescAttribute("触发新的法术")]
  3836. [TemplateIDAttribute(typeof(SpellTemplate))]
  3837. public int SpellID;
  3838. [DescAttribute("触发百分比")]
  3839. public float LaunchPercent = 100f;
  3840. /// <summary>
  3841. /// 触发新的法术运行方式
  3842. /// </summary>
  3843. [DescAttribute("触发新的法术运行方式")]
  3844. public PosType PType = PosType.POS_TYPE_DEFAULT_SINGLE;
  3845. /// <summary>
  3846. /// 触发新的法术数量
  3847. /// </summary>
  3848. [DescAttribute("法术范围")]
  3849. [DependOnProperty("HasSpellRange")]
  3850. public int SpellRange = 1;
  3851. public bool MultiLaunch { get { return PType != PosType.POS_TYPE_DEFAULT_SINGLE; } }
  3852. public bool HasSpellRange { get { return PType == PosType.POS_TYPE_RANDOM_FOR_SPELL || PType == PosType.POS_TYPE_RANDOM_POS; } }
  3853. /// <summary>
  3854. /// 触发新的法术数量
  3855. /// </summary>
  3856. [DescAttribute("触发新的法术数量")]
  3857. [DependOnProperty("MultiLaunch")]
  3858. public int Count = 1;
  3859. /// <summary>
  3860. /// 如果触发为扇形,则定义扇形范围
  3861. /// </summary>
  3862. [DescAttribute("扇形:扇形范围;X型:小角值")]
  3863. [DependOnProperty("MultiLaunch")]
  3864. public float Angle = 0;
  3865. [DescAttribute("发射初始角度")]
  3866. [DependOnProperty("MultiLaunch")]
  3867. public float StartAngle = 0;
  3868. public enum LaunchSpllSenderUnit : byte
  3869. {
  3870. [DescAttribute("默认")]
  3871. Sender = 0,
  3872. [DescAttribute("强制为施法者")]
  3873. Launcher = 1,
  3874. [DescAttribute("强制为被攻击者(只在Attack Launch Spell有效)")]
  3875. DamagedUnit = 2,
  3876. [DescAttribute("攻击者(在Buff中,buff的释加者)")]
  3877. AttackerUnit = 3,
  3878. }
  3879. [DescAttribute("发射者", "发射者")]
  3880. public LaunchSpllSenderUnit SenderUnit = LaunchSpllSenderUnit.Sender;
  3881. [DescAttribute("填True,下面无效,发射口是否以单位炮口作为参考", "炮口")]
  3882. public bool FromUnitBody = true;
  3883. [DescAttribute("法术发射高度(炮口高度)", "炮口")]
  3884. [DependOnProperty("FromUnitBody", false)]
  3885. public float LaunchSpellHeight;
  3886. [DescAttribute("法术发射半径(炮口半径)", "炮口")]
  3887. [DependOnProperty("FromUnitBody", false)]
  3888. public float LaunchSpellRadius = 0;
  3889. [DescAttribute("位置偏移类型")]
  3890. public XYModifyType xyModifyType = XYModifyType.Relative;
  3891. [DescAttribute("位置偏移X")]
  3892. public float xModify;
  3893. [DescAttribute("位置偏移Y")]
  3894. public float yModify;
  3895. [DescAttribute("连锁等级,只在技能中LaunchSpell有效(闪电链类数量,如果Spell launch spell ID一致,则传递此值)", "连锁")]
  3896. public int ChainLevel = 0;
  3897. [DescAttribute("自动锁定范围内目标", "自动锁定")]
  3898. public bool IsAutoSeekingTarget = false;
  3899. [DescAttribute("自动锁定范围内目标(范围)", "自动锁定")]
  3900. [DependOnProperty("IsAutoSeekingTarget")]
  3901. public float SeekingTargetRange = 10f;
  3902. [DescAttribute("自动锁定范围内目标(方式)", "自动锁定")]
  3903. [DependOnProperty("IsAutoSeekingTarget")]
  3904. public SpellTemplate.SeekingExpect SeekingTargetExpect = SpellTemplate.SeekingExpect.Random;
  3905. //是否是程序创建的法师
  3906. private bool mIsCodeCreate = false;
  3907. public LaunchSpell() { }
  3908. public LaunchSpell(bool codeCreate)
  3909. {
  3910. this.mIsCodeCreate = codeCreate;
  3911. }
  3912. public bool IsCodeCreate()
  3913. {
  3914. return this.mIsCodeCreate;
  3915. }
  3916. public override string ToString()
  3917. {
  3918. //return "( " + SpellID + ", " + Count + " )";
  3919. return "法术:" + this.SpellID + " 数量:" + Count;
  3920. }
  3921. public object Clone()
  3922. {
  3923. LaunchSpell ret = new LaunchSpell();
  3924. ret.SerialNumber = this.SerialNumber;
  3925. ret.SpellID = this.SpellID;
  3926. ret.LaunchPercent = this.LaunchPercent;
  3927. ret.PType = this.PType;
  3928. ret.Count = this.Count;
  3929. ret.Angle = this.Angle;
  3930. ret.StartAngle = this.StartAngle;
  3931. ret.FromUnitBody = this.FromUnitBody;
  3932. ret.LaunchSpellHeight = this.LaunchSpellHeight;
  3933. ret.LaunchSpellRadius = this.LaunchSpellRadius;
  3934. ret.ChainLevel = this.ChainLevel;
  3935. ret.SenderUnit = this.SenderUnit;
  3936. ret.IsAutoSeekingTarget = this.IsAutoSeekingTarget;
  3937. ret.SeekingTargetRange = this.SeekingTargetRange;
  3938. ret.SeekingTargetExpect = this.SeekingTargetExpect;
  3939. ret.SpellRange = this.SpellRange;
  3940. ret.xModify = this.xModify;
  3941. ret.yModify = this.yModify;
  3942. ret.xyModifyType = this.xyModifyType;
  3943. ret.mIsCodeCreate = this.mIsCodeCreate;
  3944. return ret;
  3945. }
  3946. public override void WriteExternal(IOutputStream output)
  3947. {
  3948. base.WriteExternal(output);
  3949. output.PutS32(this.SpellID);
  3950. output.PutF32(this.LaunchPercent);
  3951. output.PutEnum8(this.PType);
  3952. output.PutS32(this.Count);
  3953. output.PutF32(this.Angle);
  3954. output.PutF32(this.StartAngle);
  3955. output.PutBool(this.FromUnitBody);
  3956. output.PutF32(this.LaunchSpellHeight);
  3957. output.PutF32(this.LaunchSpellRadius);
  3958. output.PutS32(this.ChainLevel);
  3959. output.PutEnum8(this.SenderUnit);
  3960. output.PutBool(this.IsAutoSeekingTarget);
  3961. output.PutF32(this.SeekingTargetRange);
  3962. output.PutEnum8(this.SeekingTargetExpect);
  3963. output.PutS32(this.SpellRange);
  3964. output.PutF32(this.xModify);
  3965. output.PutF32(this.yModify);
  3966. output.PutEnum8(this.xyModifyType);
  3967. }
  3968. public override void ReadExternal(IInputStream input)
  3969. {
  3970. base.ReadExternal(input);
  3971. this.SpellID = input.GetS32();
  3972. this.LaunchPercent = input.GetF32();
  3973. this.PType = input.GetEnum8<PosType>();
  3974. this.Count = input.GetS32();
  3975. this.Angle = input.GetF32();
  3976. this.StartAngle = input.GetF32();
  3977. this.FromUnitBody = input.GetBool();
  3978. this.LaunchSpellHeight = input.GetF32();
  3979. this.LaunchSpellRadius = input.GetF32();
  3980. this.ChainLevel = input.GetS32();
  3981. this.SenderUnit = input.GetEnum8<LaunchSpllSenderUnit>();
  3982. this.IsAutoSeekingTarget = input.GetBool();
  3983. this.SeekingTargetRange = input.GetF32();
  3984. this.SeekingTargetExpect = input.GetEnum8<SpellTemplate.SeekingExpect>();
  3985. this.SpellRange = input.GetS32();
  3986. this.xModify = input.GetF32();
  3987. this.yModify = input.GetF32();
  3988. this.xyModifyType = input.GetEnum8<XYModifyType>();
  3989. }
  3990. public void GetXModify(InstanceUnit launcher, out float xChange, out float yChange)
  3991. {
  3992. if ((this.xModify != 0 || this.yModify != 0) && this.xyModifyType == Data.XYModifyType.Relative && launcher != null)
  3993. {
  3994. float degree = MathVector.getDegree(this.xModify, this.yModify);
  3995. float distance = (float)Math.Sqrt(this.xModify * this.xModify + this.yModify * this.yModify);
  3996. xChange = (float)(distance * Math.Cos(degree + launcher.Direction));
  3997. yChange = (float)(distance * Math.Sin(degree + launcher.Direction));
  3998. return;
  3999. }
  4000. else if (this.xyModifyType == Data.XYModifyType.Absolutely)
  4001. {
  4002. //不做处理
  4003. }
  4004. xChange = this.xModify;
  4005. yChange = this.yModify;
  4006. }
  4007. }
  4008. //---------------------------------------------------------------------------------//
  4009. /// <summary>
  4010. /// 发起BUFF
  4011. /// </summary>
  4012. [MessageType(0x400C)]
  4013. [DescAttribute("发起BUFF")]
  4014. [Expandable]
  4015. public class LaunchBuff : ISNData, ICloneable
  4016. {
  4017. /// <summary>
  4018. /// Buff模板ID
  4019. /// </summary>
  4020. [DescAttribute("Buff模板ID, 一般用BindEventID")]
  4021. [TemplateIDAttribute(typeof(BuffTemplate))]
  4022. public int BuffID;
  4023. [DescAttribute("触发百分比-废弃")]
  4024. public float LaunchPercent = 100f;
  4025. [DescAttribute("绑定事件id:有则去读事件表,忽视BuffID")]
  4026. [DependOnProperty("IsBindEventID")]
  4027. public int BindEventID;
  4028. public bool IsBindEventID { get { return this.BuffID == 0; } }
  4029. public LaunchBuff() { }
  4030. public LaunchBuff(int buffID) { this.BuffID = buffID; }
  4031. public override string ToString()
  4032. {
  4033. return "BUFF:" + BuffID + "_@_" + BindEventID;
  4034. }
  4035. public object Clone()
  4036. {
  4037. LaunchBuff ret = new LaunchBuff();
  4038. ret.SerialNumber = this.SerialNumber;
  4039. ret.BuffID = this.BuffID;
  4040. ret.BindEventID = this.BindEventID;
  4041. ret.LaunchPercent = this.LaunchPercent;
  4042. return ret;
  4043. }
  4044. public override void WriteExternal(IOutputStream output)
  4045. {
  4046. base.WriteExternal(output);
  4047. output.PutS32(BuffID);
  4048. output.PutF32(LaunchPercent);
  4049. output.PutS32(BindEventID);
  4050. }
  4051. public override void ReadExternal(IInputStream input)
  4052. {
  4053. base.ReadExternal(input);
  4054. this.BuffID = input.GetS32();
  4055. this.LaunchPercent = input.GetF32();
  4056. this.BindEventID = input.GetS32();
  4057. }
  4058. }
  4059. /// <summary>
  4060. /// 召唤单位
  4061. /// </summary>
  4062. [MessageType(0x400D)]
  4063. [DescAttribute("召唤单位")]
  4064. [Expandable]
  4065. public class SummonUnit : ISNData, ICloneable
  4066. {
  4067. [DescAttribute("召唤单位模板")]
  4068. [TemplateIDAttribute(typeof(UnitInfo))]
  4069. public int UnitTemplateID;
  4070. [DescAttribute("召唤单位等级")]
  4071. [TemplateLevelAttribute]
  4072. public int UnitLevel = 0;
  4073. [DescAttribute("召唤处产生数量")]
  4074. public int Count = 1;
  4075. [DescAttribute("召唤处产生特效")]
  4076. public LaunchEffect Effect;
  4077. public SummonUnit() { }
  4078. public SummonUnit(int templateID)
  4079. {
  4080. this.UnitTemplateID = templateID;
  4081. }
  4082. public override string ToString()
  4083. {
  4084. return "召唤单位:" + UnitTemplateID + " 数量:" + Count;
  4085. }
  4086. public object Clone()
  4087. {
  4088. SummonUnit ret = new SummonUnit();
  4089. ret.SerialNumber = this.SerialNumber;
  4090. ret.UnitTemplateID = this.UnitTemplateID;
  4091. ret.UnitLevel = this.UnitLevel;
  4092. ret.Count = this.Count;
  4093. ret.Effect = CUtils.TryClone<LaunchEffect>(this.Effect);
  4094. return ret;
  4095. }
  4096. public override void WriteExternal(IOutputStream output)
  4097. {
  4098. base.WriteExternal(output);
  4099. output.PutS32(UnitTemplateID);
  4100. output.PutS32(UnitLevel);
  4101. output.PutS32(Count);
  4102. output.PutExt(Effect);
  4103. }
  4104. public override void ReadExternal(IInputStream input)
  4105. {
  4106. base.ReadExternal(input);
  4107. this.UnitTemplateID = input.GetS32();
  4108. this.UnitLevel = input.GetS32();
  4109. this.Count = input.GetS32();
  4110. this.Effect = input.GetExt<LaunchEffect>();
  4111. }
  4112. }
  4113. [MessageType(0x4016)]
  4114. [DescAttribute("闪现移动")]
  4115. [Expandable]
  4116. public class BlinkMove : ICloneable, IExternalizable
  4117. {
  4118. [DescAttribute("移动距离", "移动")]
  4119. public float Distance = 5;
  4120. [DescAttribute("角度偏移", "移动")]
  4121. public float DirectionOffset;
  4122. [DescAttribute("移动方式", "移动")]
  4123. public BlinkMoveType MType = BlinkMoveType.MoveToForward;
  4124. [DescAttribute("忽略地形", "碰撞")]
  4125. public bool NoneTouchMap = false;
  4126. [DescAttribute("忽略单位", "碰撞")]
  4127. public bool NoneTouchObj = true;
  4128. [DescAttribute("闪现起始点特效", "特效")]
  4129. public LaunchEffect BeginEffect;
  4130. [DescAttribute("闪现目标点特效", "特效")]
  4131. public LaunchEffect TargetEffect;
  4132. public enum BlinkMoveType : byte
  4133. {
  4134. [DescAttribute("向身前移动")]
  4135. MoveToForward,
  4136. [DescAttribute("向身后移动")]
  4137. MoveToBackward,
  4138. [DescAttribute("向技能释放目标点移动")]
  4139. MoveToTargetPos,
  4140. [DescAttribute("向技能释放目标单位移动(面前)")]
  4141. MoveToTargetUnitFace,
  4142. [DescAttribute("向技能释放目标单位移动(背后)")]
  4143. MoveToTargetUnitBack,
  4144. }
  4145. public object Clone()
  4146. {
  4147. BlinkMove ret = new BlinkMove();
  4148. ret.Distance = this.Distance;
  4149. ret.DirectionOffset = this.DirectionOffset;
  4150. ret.MType = this.MType;
  4151. ret.NoneTouchMap = this.NoneTouchMap;
  4152. ret.NoneTouchObj = this.NoneTouchObj;
  4153. ret.BeginEffect = CUtils.TryClone<LaunchEffect>(this.BeginEffect);
  4154. ret.TargetEffect = CUtils.TryClone<LaunchEffect>(this.TargetEffect);
  4155. return ret;
  4156. }
  4157. public void WriteExternal(IOutputStream output)
  4158. {
  4159. output.PutF32(this.Distance);
  4160. output.PutF32(this.DirectionOffset);
  4161. output.PutEnum8(this.MType);
  4162. output.PutBool(this.NoneTouchMap);
  4163. output.PutBool(this.NoneTouchObj);
  4164. output.PutExt(this.BeginEffect);
  4165. output.PutExt(this.TargetEffect);
  4166. }
  4167. public void ReadExternal(IInputStream input)
  4168. {
  4169. this.Distance = input.GetF32();
  4170. this.DirectionOffset = input.GetF32();
  4171. this.MType = input.GetEnum8<BlinkMoveType>();
  4172. this.NoneTouchMap = input.GetBool();
  4173. this.NoneTouchObj = input.GetBool();
  4174. this.BeginEffect = input.GetExt<LaunchEffect>();
  4175. this.TargetEffect = input.GetExt<LaunchEffect>();
  4176. }
  4177. public override string ToString()
  4178. {
  4179. return "闪现移动";
  4180. }
  4181. }
  4182. /// <summary>
  4183. /// 移动距离
  4184. /// </summary>
  4185. [MessageType(0x400E)]
  4186. [DescAttribute("移动距离")]
  4187. [Expandable]
  4188. public class StartMove : ISNData, ICloneable
  4189. {
  4190. [DescAttribute("速度(距离/每秒)", "位移")]
  4191. public float SpeedSEC = 10f;
  4192. [DescAttribute("加速度(距离/每秒)(最终速度=速度+加速度)", "位移")]
  4193. public float SpeedAdd = 0f;
  4194. [DescAttribute("阻力(每秒递减速度百分比)", "位移")]
  4195. public float SpeedAcc = 0f;
  4196. [DescAttribute("被击飞的向上速度(距离/每秒)", "位移")]
  4197. public float ZSpeedSEC = 0f;
  4198. [DescAttribute("被击飞的向上移动最大距离(天花板高度)", "位移")]
  4199. [DependOnProperty("HasFly")]
  4200. public float ZLimit = 0f;
  4201. [DescAttribute("重设重力(非0有效)", "位移")]
  4202. [DependOnProperty("HasFly")]
  4203. public float OverrideGravity = 0f;
  4204. [DescAttribute("起始移动方向修正", "位移")]
  4205. public float Direction;
  4206. [DescAttribute("移动过程中是否忽略碰撞", "位移")]
  4207. public bool IsNoneTouch = false;
  4208. [DescAttribute("自身转动速度(距离/每秒)", "旋转")]
  4209. public float RotateSpeedSEC;
  4210. [DescAttribute("持续时间(毫秒),如果是击飞此处无效,击飞时间按落地时间计算,运动时间不计算在DamageTime内", "时间")]
  4211. [DependOnProperty("HasFly", false)]
  4212. public int KeepTimeMS = 500;
  4213. [DescAttribute("", "", false)]
  4214. public float ArgsFactor = 0;
  4215. public bool HasFly { get { return ZSpeedSEC != 0; } }
  4216. public StartMove() { }
  4217. public override string ToString()
  4218. {
  4219. return "移动速度:" + SpeedSEC + "(每秒) 持续:" + KeepTimeMS + "(毫秒)";
  4220. }
  4221. public object Clone()
  4222. {
  4223. StartMove ret = new StartMove();
  4224. ret.SerialNumber = this.SerialNumber;
  4225. ret.SpeedSEC = this.SpeedSEC;
  4226. ret.SpeedAdd = this.SpeedAdd;
  4227. ret.SpeedAcc = this.SpeedAcc;
  4228. ret.ZSpeedSEC = this.ZSpeedSEC;
  4229. ret.ZLimit = this.ZLimit;
  4230. ret.OverrideGravity = this.OverrideGravity;
  4231. ret.Direction = this.Direction;
  4232. ret.IsNoneTouch = this.IsNoneTouch;
  4233. ret.RotateSpeedSEC = this.RotateSpeedSEC;
  4234. ret.KeepTimeMS = this.KeepTimeMS;
  4235. ret.ArgsFactor = this.ArgsFactor;
  4236. return ret;
  4237. }
  4238. public override void WriteExternal(IOutputStream output)
  4239. {
  4240. base.WriteExternal(output);
  4241. output.PutF32(this.SpeedSEC);
  4242. output.PutF32(this.SpeedAdd);
  4243. output.PutF32(this.SpeedAcc);
  4244. output.PutF32(this.ZSpeedSEC);
  4245. output.PutF32(this.ZLimit);
  4246. output.PutF32(this.OverrideGravity);
  4247. output.PutF32(this.Direction);
  4248. output.PutBool(this.IsNoneTouch);
  4249. output.PutF32(this.RotateSpeedSEC);
  4250. output.PutS32(this.KeepTimeMS);
  4251. output.PutF32(this.ArgsFactor);
  4252. }
  4253. public override void ReadExternal(IInputStream input)
  4254. {
  4255. base.ReadExternal(input);
  4256. this.SpeedSEC = input.GetF32();
  4257. this.SpeedAdd = input.GetF32();
  4258. this.SpeedAcc = input.GetF32();
  4259. this.ZSpeedSEC = input.GetF32();
  4260. this.ZLimit = input.GetF32();
  4261. this.OverrideGravity = input.GetF32();
  4262. this.Direction = input.GetF32();
  4263. this.IsNoneTouch = input.GetBool();
  4264. this.RotateSpeedSEC = input.GetF32();
  4265. this.KeepTimeMS = input.GetS32();
  4266. this.ArgsFactor = input.GetF32();
  4267. }
  4268. }
  4269. /// <summary>
  4270. /// 道具掉落
  4271. /// </summary>
  4272. [MessageType(0x400F)]
  4273. [DescAttribute("道具掉落")]
  4274. [Expandable]
  4275. public class DropItem : ISNData, ICloneable
  4276. {
  4277. /// <summary>
  4278. /// 掉落道具模板ID
  4279. /// </summary>
  4280. [DescAttribute("掉落道具模板ID")]
  4281. [TemplateIDAttribute(typeof(ItemTemplate))]
  4282. public int ItemTemplateID;
  4283. /// <summary>
  4284. /// 掉落数量
  4285. /// </summary>
  4286. [DescAttribute("掉落数量")]
  4287. public int DropCount = 1;
  4288. /// <summary>
  4289. /// 掉落道具百分比
  4290. /// </summary>
  4291. [DescAttribute("掉落道具百分比")]
  4292. public float DropPercent;
  4293. [DescAttribute("掉落位置随机范围点")]
  4294. public float DropPosRange = 0;
  4295. public DropItem() { }
  4296. public DropItem(int itemID, float percent)
  4297. {
  4298. this.ItemTemplateID = itemID;
  4299. this.DropPercent = percent;
  4300. }
  4301. public override string ToString()
  4302. {
  4303. return "道具掉落:" + ItemTemplateID + " 掉率:" + DropPercent + "%";
  4304. }
  4305. public object Clone()
  4306. {
  4307. DropItem ret = new DropItem();
  4308. ret.SerialNumber = this.SerialNumber;
  4309. ret.ItemTemplateID = this.ItemTemplateID;
  4310. ret.DropCount = this.DropCount;
  4311. ret.DropPercent = this.DropPercent;
  4312. ret.DropPosRange = this.DropPosRange;
  4313. return ret;
  4314. }
  4315. public override void WriteExternal(IOutputStream output)
  4316. {
  4317. base.WriteExternal(output);
  4318. output.PutS32(ItemTemplateID);
  4319. output.PutS32(DropCount);
  4320. output.PutF32(DropPercent);
  4321. output.PutF32(DropPosRange);
  4322. }
  4323. public override void ReadExternal(IInputStream input)
  4324. {
  4325. base.ReadExternal(input);
  4326. this.ItemTemplateID = input.GetS32();
  4327. this.DropCount = input.GetS32();
  4328. this.DropPercent = input.GetF32();
  4329. this.DropPosRange = input.GetF32();
  4330. }
  4331. }
  4332. /// <summary>
  4333. /// 道具掉落
  4334. /// </summary>
  4335. [MessageType(0x4013)]
  4336. [DescAttribute("道具掉落列表")]
  4337. [Expandable]
  4338. public class DropItemList : ISNData, ICloneable
  4339. {
  4340. /// <summary>
  4341. /// 掉落道具模板ID
  4342. /// </summary>
  4343. [DescAttribute("掉落道具模板列表")]
  4344. public List<DropItem> DropItems = new List<DropItem>();
  4345. public DropItemList() { }
  4346. public override string ToString()
  4347. {
  4348. return "道具掉落:" + DropItems.Count + "个物品中的一个";
  4349. }
  4350. public object Clone()
  4351. {
  4352. DropItemList ret = new DropItemList();
  4353. ret.SerialNumber = this.SerialNumber;
  4354. ret.DropItems = CUtils.CloneList<DropItem>(this.DropItems);
  4355. return ret;
  4356. }
  4357. public override void WriteExternal(IOutputStream output)
  4358. {
  4359. base.WriteExternal(output);
  4360. output.PutList<DropItem>(DropItems, output.PutExt);
  4361. }
  4362. public override void ReadExternal(IInputStream input)
  4363. {
  4364. base.ReadExternal(input);
  4365. this.DropItems = input.GetList<DropItem>(input.GetExt<DropItem>);
  4366. }
  4367. }
  4368. [MessageType(0x4012)]
  4369. [DescAttribute("道具使用")]
  4370. [Expandable]
  4371. public class UseItem : ISNData, ICloneable
  4372. {
  4373. /// <summary>
  4374. /// 掉落道具模板ID
  4375. /// </summary>
  4376. [DescAttribute("道具模板ID")]
  4377. [TemplateIDAttribute(typeof(ItemTemplate))]
  4378. public int ItemTemplateID;
  4379. public UseItem() { }
  4380. public UseItem(int itemID)
  4381. {
  4382. this.ItemTemplateID = itemID;
  4383. }
  4384. public override string ToString()
  4385. {
  4386. return "使用道具:" + ItemTemplateID;
  4387. }
  4388. public object Clone()
  4389. {
  4390. UseItem ret = new UseItem();
  4391. ret.SerialNumber = this.SerialNumber;
  4392. ret.ItemTemplateID = this.ItemTemplateID;
  4393. return ret;
  4394. }
  4395. public override void WriteExternal(IOutputStream output)
  4396. {
  4397. base.WriteExternal(output);
  4398. output.PutS32(this.ItemTemplateID);
  4399. }
  4400. public override void ReadExternal(IInputStream input)
  4401. {
  4402. base.ReadExternal(input);
  4403. this.ItemTemplateID = input.GetS32();
  4404. }
  4405. }
  4406. /// <summary>
  4407. /// 击杀击退
  4408. /// </summary>
  4409. [MessageType(0x4027)]
  4410. [DescAttribute("击杀击退")]
  4411. [Expandable]
  4412. public class KillHitMove : ISNData, ICloneable
  4413. {
  4414. [DescAttribute("是否生效")]
  4415. public bool enable = false;
  4416. [DependOnProperty("enable")]
  4417. [DescAttribute("受击位移计算方式", "受击")]
  4418. public HitMoveType moveType = HitMoveType.BySenderDirection;
  4419. public object Clone()
  4420. {
  4421. KillHitMove ret = new KillHitMove();
  4422. ret.enable = this.enable;
  4423. ret.moveType = this.moveType;
  4424. return ret;
  4425. }
  4426. public override string ToString()
  4427. {
  4428. return "是否生效:" + enable;
  4429. }
  4430. public override void WriteExternal(IOutputStream output)
  4431. {
  4432. base.WriteExternal(output);
  4433. output.PutBool(this.enable);
  4434. output.PutEnum8(this.moveType);
  4435. //output.PutEnum32
  4436. }
  4437. public override void ReadExternal(IInputStream input)
  4438. {
  4439. base.ReadExternal(input);
  4440. this.enable = input.GetBool();
  4441. this.moveType = input.GetEnum8<HitMoveType>();
  4442. }
  4443. }
  4444. [MessageType(0x4028)]
  4445. [DescAttribute("场景增加道具")]
  4446. [Expandable]
  4447. public class BuffAddItem : ISNData, ICloneable
  4448. {
  4449. public enum PosType : byte
  4450. {
  4451. [DescAttribute("buff触发位置")]
  4452. HitBuffPos = 1,
  4453. [DescAttribute("绑定者位置")]
  4454. BindUnitPos = 2,
  4455. [DescAttribute("指定位置")]
  4456. PointPos = 3,
  4457. }
  4458. /// </summary>
  4459. [DescAttribute("生成类型")]
  4460. public PosType posType = PosType.HitBuffPos;
  4461. /// <summary>
  4462. /// 掉落道具模板ID
  4463. /// </summary>
  4464. [DescAttribute("道具模板ID")]
  4465. [TemplateIDAttribute(typeof(ItemTemplate))]
  4466. public int ItemTemplateID;
  4467. public bool IsPointXY { get { return posType == PosType.PointPos; } }
  4468. //记录位置信息
  4469. [DependOnProperty("IsPointXY")]
  4470. [DescAttribute("指定位置X")]
  4471. public float pointX;
  4472. [DependOnProperty("IsPointXY")]
  4473. [DescAttribute("指定位置Y")]
  4474. public float pointY;
  4475. public BuffAddItem() { }
  4476. public override string ToString()
  4477. {
  4478. return "生成道具:" + ItemTemplateID;
  4479. }
  4480. public object Clone()
  4481. {
  4482. BuffAddItem ret = new BuffAddItem();
  4483. ret.SerialNumber = this.SerialNumber;
  4484. ret.ItemTemplateID = this.ItemTemplateID;
  4485. ret.pointX = this.pointX;
  4486. ret.pointY = this.pointY;
  4487. ret.posType = this.posType;
  4488. return ret;
  4489. }
  4490. public override void WriteExternal(IOutputStream output)
  4491. {
  4492. base.WriteExternal(output);
  4493. output.PutS32(this.ItemTemplateID);
  4494. output.PutEnum8(this.posType);
  4495. output.PutF32(this.pointX);
  4496. output.PutF32(this.pointY);
  4497. }
  4498. public override void ReadExternal(IInputStream input)
  4499. {
  4500. base.ReadExternal(input);
  4501. this.ItemTemplateID = input.GetS32();
  4502. this.posType = input.GetEnum8<PosType>();
  4503. this.pointX = input.GetF32();
  4504. this.pointY = input.GetF32();
  4505. }
  4506. }
  4507. /// <summary>
  4508. /// 单位被动触发
  4509. /// </summary>
  4510. [MessageType(0x4011)]
  4511. [DescAttribute("单位被动触发")]
  4512. [Expandable]
  4513. public class LaunchTrigger : ISNData, ICloneable
  4514. {
  4515. [DescAttribute("触发器ID")]
  4516. [TemplateIDAttribute(typeof(UnitTriggerTemplate))]
  4517. public int TriggerTemplateID;
  4518. [DescAttribute("开启")]
  4519. public bool Active = true;
  4520. public LaunchTrigger() { }
  4521. public LaunchTrigger(int id)
  4522. {
  4523. this.TriggerTemplateID = id;
  4524. }
  4525. public override string ToString()
  4526. {
  4527. return "单位触发:" + TriggerTemplateID;
  4528. }
  4529. public object Clone()
  4530. {
  4531. LaunchTrigger ret = new LaunchTrigger();
  4532. ret.SerialNumber = this.SerialNumber;
  4533. ret.TriggerTemplateID = this.TriggerTemplateID;
  4534. ret.Active = this.Active;
  4535. return ret;
  4536. }
  4537. public override void WriteExternal(IOutputStream output)
  4538. {
  4539. base.WriteExternal(output);
  4540. output.PutS32(TriggerTemplateID);
  4541. output.PutBool(Active);
  4542. }
  4543. public override void ReadExternal(IInputStream input)
  4544. {
  4545. base.ReadExternal(input);
  4546. this.TriggerTemplateID = input.GetS32();
  4547. this.Active = input.GetBool();
  4548. }
  4549. }
  4550. /// <summary>
  4551. /// 携带道具
  4552. /// </summary>
  4553. [MessageType(0x4014)]
  4554. [DescAttribute("单位携带道具")]
  4555. [Expandable]
  4556. public class InventoryItem : IExternalizable, ICloneable
  4557. {
  4558. [TemplateIDAttribute(typeof(ItemTemplate))]
  4559. [DescAttribute("道具模板ID")]
  4560. public int ItemTemplateID;
  4561. [DescAttribute("数量ID")]
  4562. public int Count;
  4563. public override string ToString()
  4564. {
  4565. return "携带道具:" + ItemTemplateID + "x" + Count;
  4566. }
  4567. public object Clone()
  4568. {
  4569. InventoryItem ret = new InventoryItem();
  4570. ret.ItemTemplateID = this.ItemTemplateID;
  4571. ret.Count = this.Count;
  4572. return ret;
  4573. }
  4574. public void WriteExternal(IOutputStream output)
  4575. {
  4576. output.PutS32(ItemTemplateID);
  4577. output.PutS32(Count);
  4578. }
  4579. public void ReadExternal(IInputStream input)
  4580. {
  4581. this.ItemTemplateID = input.GetS32();
  4582. this.Count = input.GetS32();
  4583. }
  4584. }
  4585. [MessageType(0x410A)]
  4586. [DescAttribute("单位组阵型")]
  4587. [Expandable]
  4588. public class TeamFormation : IExternalizable, ICloneable
  4589. {
  4590. public enum Formation : byte
  4591. {
  4592. [DescAttribute("随机")]
  4593. Random = 0,
  4594. [DescAttribute("方阵")]
  4595. Square = 1,
  4596. [DescAttribute("以中心点放射出去的圆阵")]
  4597. Round = 2,
  4598. [DescAttribute("圆环")]
  4599. Cycle = 3,
  4600. [DescAttribute("蜂窝阵")]
  4601. Beehive = 4,
  4602. [DescAttribute("直线")]
  4603. Line = 5,
  4604. }
  4605. public bool IsSquare { get { return this.TFormation == Formation.Square; } }
  4606. [DescAttribute("阵型")]
  4607. public Formation TFormation = Formation.Random;
  4608. [DescAttribute("单位间距,间距不计算身体半径,0表示按最大身体计算")]
  4609. public float SpacingSize = 5;
  4610. [DescAttribute("方阵: 每行固定人数,0表示行列相等")]
  4611. [DependOnProperty("IsSquare")]
  4612. public int SquareEachRowCount = 0;
  4613. public object Clone()
  4614. {
  4615. TeamFormation ret = new TeamFormation();
  4616. ret.TFormation = this.TFormation;
  4617. ret.SpacingSize = this.SpacingSize;
  4618. ret.SquareEachRowCount = this.SquareEachRowCount;
  4619. return ret;
  4620. }
  4621. public void WriteExternal(IOutputStream output)
  4622. {
  4623. output.PutEnum8(this.TFormation);
  4624. output.PutF32(this.SpacingSize);
  4625. output.PutS32(this.SquareEachRowCount);
  4626. }
  4627. public void ReadExternal(IInputStream input)
  4628. {
  4629. this.TFormation = input.GetEnum8<Formation>();
  4630. this.SpacingSize = input.GetF32();
  4631. this.SquareEachRowCount = input.GetS32();
  4632. }
  4633. public override string ToString()
  4634. {
  4635. return string.Format("阵型:{0}", TFormation);
  4636. }
  4637. }
  4638. #endregion
  4639. //---------------------------------------------------------------------------------//
  4640. }