Data.cs 194 KB

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