Data.cs 194 KB

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