Data.cs 194 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308
  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 DeadAnimationEndEffect;
  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. public LaunchEffect ChangeForceEffect;
  529. [DescAttribute("破碎比例", "资源")]
  530. public int HitBreakPrecent;
  531. [DescAttribute("破碎特效", "资源")]
  532. public LaunchEffect HitBreakEffect;
  533. [DescAttribute("预加载资源列表", "资源")]
  534. public string PreloadResources;
  535. //------------------------------------
  536. /// <summary>
  537. /// 身体高度
  538. /// </summary>
  539. [DescAttribute("身体高度", "战斗")]
  540. public float BodyHeight;
  541. /// <summary>
  542. /// 身体尺寸(半径)
  543. /// </summary>
  544. [DescAttribute("身体尺寸(半径)", "战斗")]
  545. public float BodySize = 1;
  546. /// <summary>
  547. /// 警戒距离范围
  548. /// </summary>
  549. [DescAttribute("身体受攻击尺寸(半径)", "战斗")]
  550. public float BodyHitSize = 1;
  551. //------------------------------------
  552. /// <summary>
  553. /// 警戒距离范围
  554. /// </summary>
  555. [DescAttribute("警戒距离范围", "战斗 - 警戒")]
  556. public float GuardRange = 5;
  557. [DescAttribute("最大警戒范围,超过此范围不追击,0表示无限", "战斗 - 警戒")]
  558. public float GuardRangeLimit = 20;
  559. [DescAttribute("分组警戒范围,如果此单位进入战斗,则传给相邻单位Add,0表示不传递", "战斗 - 警戒")]
  560. public float GuardRangeGroup = 5;
  561. public bool IdleRecover { get { return RecoveryIntervalMS > 0; } }
  562. [DescAttribute("恢复间隔(毫秒),脱离战斗后回血间隔时间", "战斗 - 恢复")]
  563. public int RecoveryIntervalMS = 10000;
  564. [DescAttribute("血量恢复/秒", "战斗 - 恢复")]
  565. [DependOnProperty("IdleRecover")]
  566. public int HealthRecoveryPoint = 0;
  567. [DescAttribute("法力恢复/秒", "战斗 - 恢复")]
  568. [DependOnProperty("IdleRecover")]
  569. public int ManaRecoveryPoint = 0;
  570. //------------------------------------
  571. [DescAttribute("体重(>=100不能被击飞)", "战斗")]
  572. public int Weight = 1;
  573. [DescAttribute("是否可移动", "战斗")]
  574. public bool IsMoveable = true;
  575. [DescAttribute("是否可转向", "战斗")]
  576. public bool IsTurnable = true;
  577. //------------------------------------
  578. /// <summary>
  579. /// 移动距离,像素或者码
  580. /// </summary>
  581. [DescAttribute("移动速度(距离/每秒)", "战斗")]
  582. public float MoveSpeedSEC = 6f;
  583. [DescAttribute("转身速度(弧度/秒)", "战斗")]
  584. public float TurnSpeedSEC = float.NaN;
  585. [DescAttribute("受击时间(毫秒)", "战斗")]
  586. public int DamageTimeMS = 10;
  587. //------------------------------------
  588. /// <summary>
  589. /// 此单位普通攻击技能
  590. /// </summary>
  591. [DescAttribute("此单位普通攻击技能", "技能")]
  592. public LaunchSkill BaseSkillID = new LaunchSkill();
  593. /// <summary>
  594. /// 此单位绑定的所有技能ID
  595. /// </summary>
  596. [ListAttribute(typeof(LaunchSkill))]
  597. [DescAttribute("此单位绑定的所有技能ID", "技能")]
  598. public List<LaunchSkill> Skills = new List<LaunchSkill>();
  599. /// <summary>
  600. /// 触发类特效
  601. /// </summary>
  602. [ListAttribute(typeof(LaunchTrigger))]
  603. [DescAttribute("触发类", "技能")]
  604. public List<LaunchTrigger> Triggers = new List<LaunchTrigger>();
  605. //------------------------------------
  606. //------------------------------------
  607. [DescAttribute("法术发射高度(炮口高度)", "炮口")]
  608. public float LaunchSpellHeight;
  609. [DescAttribute("法术发射半径(炮口半径)", "炮口")]
  610. public float LaunchSpellRadius = 0;
  611. //------------------------------------
  612. [DescAttribute("死亡时释放法术(自爆)", "战斗")]
  613. public LaunchSpell DeadLaunchSpell = null;
  614. [DescAttribute("死亡时释放法术(灵魂出窍)", "战斗")]
  615. public LaunchSpell DeadDelayLaunchSpell = null;
  616. //------------------------------------
  617. [DescAttribute("血量", "战斗")]
  618. public int HealthPoint = 100;
  619. [DescAttribute("法力值", "战斗")]
  620. public int ManaPoint = 100;
  621. [DescAttribute("耐力值", "战斗")]
  622. public int StaminaPoint = 100;
  623. [DescAttribute("产生经验", "战斗")]
  624. public int GenExp;
  625. //------------------------------------
  626. /// <summary>
  627. /// 掉落道具列表
  628. /// </summary>
  629. [ListAttribute(typeof(DropItemList))]
  630. [DescAttribute("掉落道具", "掉落")]
  631. public List<DropItemList> DropItemsSet = new List<DropItemList>();
  632. [DescAttribute("被杀死直接获得金币", "掉落")]
  633. public int DropMoney;
  634. //------------------------------------
  635. [DescAttribute("单位背包数量", "背包")]
  636. public int InventorySize = 1;
  637. [ListAttribute(typeof(InventoryItem))]
  638. [DescAttribute("进入战斗携带的道具列表(比如血瓶)", "背包")]
  639. public List<InventoryItem> InventoryList = new List<InventoryItem>();
  640. //------------------------------------
  641. /// <summary>
  642. /// 若是召唤类,则表示存活时间
  643. /// </summary>
  644. [DescAttribute("若是召唤类,则表示存活时间(毫秒)", "战斗")]
  645. public int LifeTimeMS;
  646. /// <summary>
  647. /// 单位出生延时时间,通常播放出生动画
  648. /// </summary>
  649. [DescAttribute("单位出生延时时间,通常播放出生动画(毫秒)", "战斗")]
  650. public int SpawnTimeMS;
  651. /// <summary>
  652. /// 持续时间
  653. /// </summary>
  654. [DescAttribute("单位死亡持续时间,即死亡后多长时间内可继续鞭尸(毫秒)", "战斗")]
  655. public int DeadTimeMS;
  656. /// <summary>
  657. ///
  658. /// </summary>
  659. [DescAttribute("单位死亡之后延迟时间(毫秒),播放 DeadDelayLaunchSpell 特效", "战斗")]
  660. public int DeadDelayTimeMS;
  661. /// <summary>
  662. ///
  663. /// </summary>
  664. [DescAttribute("播放 DeadDelayLaunchSpell 特效的数量", "战斗")]
  665. public int DeadDelaySpellNumber;
  666. public bool HasNumbers
  667. {
  668. get { return DeadDelaySpellNumber > 1; }
  669. }
  670. /// <summary>
  671. ///
  672. /// </summary>
  673. [DescAttribute("播放每一个 DeadDelayLaunchSpell 间隔的时间(单位:毫秒)", "战斗")]
  674. [DependOnProperty("HasNumbers")]
  675. public int DeadDelaySpellIntervalMS;
  676. /// <summary>
  677. /// 复活时间
  678. /// </summary>
  679. [DescAttribute("死亡后多久复活,0表示不能复活(毫秒)", "战斗")]
  680. public int RebirthTimeMS;
  681. //------------------------------------
  682. [DescAttribute("用户自定义标志", "脚本")]
  683. public string UserTag;
  684. //------------------------------------
  685. [DescAttribute("是否为动态创建单位,比如PVP或者根据玩家等级创建的单位", "扩展")]
  686. public bool IsDynamic = false;
  687. [DescAttribute("是否随机名字", "扩展")]
  688. public bool IsRandomName = false;
  689. //------------------------------------
  690. [DescAttribute("单位绑定触发事件ID", "事件")]
  691. [TemplatesIDAttribute(typeof(UnitEventTemplate))]
  692. public List<int> Events = new List<int>();
  693. //------------------------------------
  694. /// <summary>
  695. /// 用户自定义扩展属性
  696. /// </summary>
  697. [DescAttribute("扩展属性", "扩展")]
  698. [Expandable]
  699. [NotNull]
  700. public IUnitProperties Properties;
  701. //------------------------------------
  702. [DescAttribute("自定义字段", "属性", true)]
  703. public string[] Attributes;
  704. //------------------------------------
  705. public UnitInfo()
  706. {
  707. Properties = TemplateManager.Factory.CreateUnitProperties();
  708. }
  709. public int GetID()
  710. {
  711. return ID;
  712. }
  713. public override string ToString()
  714. {
  715. return Name + "(" + ID + ")";
  716. }
  717. public object Clone()
  718. {
  719. UnitInfo ret = new UnitInfo();
  720. ret.EditorPath = this.EditorPath;
  721. ret.UType = this.UType;
  722. ret.ID = this.ID;
  723. ret.Name = this.Name;
  724. ret.IsElite = this.IsElite;
  725. ret.FileName = this.FileName;
  726. ret.SpawnEffect = CUtils.TryClone<LaunchEffect>(this.SpawnEffect);
  727. ret.FootCircleEffect = CUtils.TryClone<LaunchEffect>(this.FootCircleEffect);
  728. ret.DeadEffect = CUtils.TryClone<LaunchEffect>(this.DeadEffect);
  729. ret.RemovedEffect = CUtils.TryClone<LaunchEffect>(this.RemovedEffect);
  730. ret.DeadAnimationEndEffect = CUtils.TryClone<LaunchEffect>(this.DeadAnimationEndEffect);
  731. ret.CrushEffect = CUtils.TryClone<LaunchEffect>(this.CrushEffect);
  732. ret.DamageEffect = CUtils.TryClone<LaunchEffect>(this.DamageEffect);
  733. ret.BodyScale = this.BodyScale;
  734. ret.BodyHeight = this.BodyHeight;
  735. ret.BodySize = this.BodySize;
  736. ret.BodyHitSize = this.BodyHitSize;
  737. ret.GuardRange = this.GuardRange;
  738. ret.GuardRangeLimit = this.GuardRangeLimit;
  739. ret.GuardRangeGroup = this.GuardRangeGroup;
  740. ret.HealthRecoveryPoint = this.HealthRecoveryPoint;
  741. ret.ManaRecoveryPoint = this.ManaRecoveryPoint;
  742. ret.RecoveryIntervalMS = this.RecoveryIntervalMS;
  743. ret.Weight = this.Weight;
  744. ret.MoveSpeedSEC = this.MoveSpeedSEC;
  745. ret.TurnSpeedSEC = this.TurnSpeedSEC;
  746. ret.DamageTimeMS = this.DamageTimeMS;
  747. ret.IsMoveable = this.IsMoveable;
  748. ret.IsTurnable = this.IsTurnable;
  749. ret.BaseSkillID = CUtils.TryClone<LaunchSkill>(this.BaseSkillID);
  750. ret.Skills = CUtils.CloneList<LaunchSkill>(this.Skills);
  751. ret.Triggers = CUtils.CloneList<LaunchTrigger>(this.Triggers);
  752. ret.LaunchSpellHeight = this.LaunchSpellHeight;
  753. ret.LaunchSpellRadius = this.LaunchSpellRadius;
  754. ret.DeadLaunchSpell = this.DeadLaunchSpell;
  755. ret.DeadDelayLaunchSpell = this.DeadDelayLaunchSpell;
  756. ret.HealthPoint = this.HealthPoint;
  757. ret.ManaPoint = this.ManaPoint;
  758. ret.StaminaPoint = this.StaminaPoint;
  759. ret.GenExp = this.GenExp;
  760. ret.DropItemsSet = CUtils.CloneList<DropItemList>(this.DropItemsSet);
  761. ret.DropMoney = this.DropMoney;
  762. ret.InventorySize = this.InventorySize;
  763. ret.InventoryList = CUtils.CloneList<InventoryItem>(this.InventoryList);
  764. ret.LifeTimeMS = this.LifeTimeMS;
  765. ret.SpawnTimeMS = this.SpawnTimeMS;
  766. ret.DeadTimeMS = this.DeadTimeMS;
  767. ret.DeadDelayTimeMS = this.DeadDelayTimeMS;
  768. ret.DeadDelaySpellNumber = this.DeadDelaySpellNumber;
  769. ret.DeadDelaySpellIntervalMS = this.DeadDelaySpellIntervalMS;
  770. ret.RebirthTimeMS = this.RebirthTimeMS;
  771. ret.UserTag = this.UserTag;
  772. ret.IsDynamic = this.IsDynamic;
  773. ret.Events = new List<int>(this.Events);
  774. ret.Properties = CUtils.TryClone<IUnitProperties>(this.Properties);// (IUnitProperties)this.Properties.Clone();
  775. ret.Attributes = CUtils.CloneArray<string>(this.Attributes);
  776. ret.HitBreakPrecent = this.HitBreakPrecent;
  777. ret.HitBreakEffect = CUtils.TryClone<LaunchEffect>(this.HitBreakEffect);
  778. ret.ChangeForceEffect = CUtils.TryClone<LaunchEffect>(this.ChangeForceEffect);
  779. ret.HitBreakPrecent = this.HitBreakPrecent;
  780. ret.HitBreakEffect = this.HitBreakEffect;
  781. ret.IsRandomName = this.IsRandomName;
  782. ret.SumType = this.SumType;
  783. ret.PreloadResources = this.PreloadResources;
  784. return ret;
  785. }
  786. public void WriteExternal(IOutputStream output)
  787. {
  788. output.PutUTF(this.EditorPath);
  789. output.PutEnum8(this.UType);
  790. output.PutS32(this.ID);
  791. output.PutUTF(this.Name);
  792. output.PutBool(this.IsElite);
  793. output.PutUTF(this.FileName);
  794. output.PutExt(this.SpawnEffect);
  795. output.PutExt(this.FootCircleEffect);
  796. output.PutExt(this.DeadEffect);
  797. output.PutExt(this.RemovedEffect);
  798. output.PutExt(this.DeadAnimationEndEffect);
  799. output.PutExt(this.CrushEffect);
  800. output.PutExt(this.DamageEffect);
  801. output.PutF32(this.BodyScale);
  802. output.PutF32(this.BodyHeight);
  803. output.PutF32(this.BodySize);
  804. output.PutF32(this.BodyHitSize);
  805. output.PutF32(this.GuardRange);
  806. output.PutF32(this.GuardRangeLimit);
  807. output.PutF32(this.GuardRangeGroup);
  808. output.PutS32(this.RecoveryIntervalMS);
  809. output.PutS32(this.HealthRecoveryPoint);
  810. output.PutS32(this.ManaRecoveryPoint);
  811. output.PutS32(this.Weight);
  812. output.PutF32(this.MoveSpeedSEC);
  813. output.PutF32(this.TurnSpeedSEC);
  814. output.PutS32(this.DamageTimeMS);
  815. output.PutBool(this.IsMoveable);
  816. output.PutBool(this.IsTurnable);
  817. output.PutExt(this.BaseSkillID);
  818. output.PutList<LaunchSkill>(this.Skills, output.PutExt);
  819. output.PutList<LaunchTrigger>(this.Triggers, output.PutExt);
  820. output.PutF32(this.LaunchSpellHeight);
  821. output.PutF32(this.LaunchSpellRadius);
  822. output.PutExt(this.DeadLaunchSpell);
  823. output.PutExt(this.DeadDelayLaunchSpell);
  824. output.PutS32(this.HealthPoint);
  825. output.PutS32(this.ManaPoint);
  826. output.PutS32(this.StaminaPoint);
  827. output.PutS32(this.GenExp);
  828. output.PutList<DropItemList>(this.DropItemsSet, output.PutExt);
  829. output.PutS32(this.DropMoney);
  830. output.PutS32(this.InventorySize);
  831. output.PutList<InventoryItem>(this.InventoryList, output.PutExt);
  832. output.PutS32(this.LifeTimeMS);
  833. output.PutS32(this.SpawnTimeMS);
  834. output.PutS32(this.DeadTimeMS);
  835. output.PutS32(this.DeadDelayTimeMS);
  836. output.PutS32(this.DeadDelaySpellNumber);
  837. output.PutS32(this.DeadDelaySpellIntervalMS);
  838. output.PutS32(this.RebirthTimeMS);
  839. output.PutUTF(this.UserTag);
  840. output.PutBool(this.IsDynamic);
  841. output.PutList(this.Events, output.PutS32);
  842. output.PutArray(this.Attributes, output.PutUTF);
  843. output.PutExt(this.Properties);
  844. //破碎,切阵营
  845. output.PutExt(this.ChangeForceEffect);
  846. output.PutS32(this.HitBreakPrecent);
  847. output.PutExt(this.HitBreakEffect);
  848. // 随机名字
  849. output.PutBool(this.IsRandomName);
  850. output.PutEnum8(this.SumType);
  851. output.PutUTF(this.PreloadResources);
  852. }
  853. public void ReadExternal(IInputStream input)
  854. {
  855. this.EditorPath = input.GetUTF();
  856. this.UType = input.GetEnum8<UnitType>();
  857. this.ID = input.GetS32();
  858. this.Name = input.GetUTF();
  859. this.IsElite = input.GetBool();
  860. this.FileName = input.GetUTF();
  861. this.SpawnEffect = input.GetExt<LaunchEffect>();
  862. this.FootCircleEffect = input.GetExt<LaunchEffect>();
  863. this.DeadEffect = input.GetExt<LaunchEffect>();
  864. this.RemovedEffect = input.GetExt<LaunchEffect>();
  865. this.DeadAnimationEndEffect = input.GetExt<LaunchEffect>();
  866. this.CrushEffect = input.GetExt<LaunchEffect>();
  867. this.DamageEffect = input.GetExt<LaunchEffect>();
  868. this.BodyScale = input.GetF32();
  869. this.BodyHeight = input.GetF32();
  870. this.BodySize = input.GetF32();
  871. this.BodyHitSize = input.GetF32();
  872. this.GuardRange = input.GetF32();
  873. this.GuardRangeLimit = input.GetF32();
  874. this.GuardRangeGroup = input.GetF32();
  875. this.RecoveryIntervalMS = input.GetS32();
  876. this.HealthRecoveryPoint = input.GetS32();
  877. this.ManaRecoveryPoint = input.GetS32();
  878. this.Weight = input.GetS32();
  879. this.MoveSpeedSEC = input.GetF32();
  880. this.TurnSpeedSEC = input.GetF32();
  881. this.DamageTimeMS = input.GetS32();
  882. this.IsMoveable = input.GetBool();
  883. this.IsTurnable = input.GetBool();
  884. this.BaseSkillID = input.GetExt<LaunchSkill>();
  885. this.Skills = input.GetList<LaunchSkill>(input.GetExt<LaunchSkill>);
  886. this.Triggers = input.GetList<LaunchTrigger>(input.GetExt<LaunchTrigger>);
  887. this.LaunchSpellHeight = input.GetF32();
  888. this.LaunchSpellRadius = input.GetF32();
  889. this.DeadLaunchSpell = input.GetExt<LaunchSpell>();
  890. this.DeadDelayLaunchSpell = input.GetExt<LaunchSpell>();
  891. this.HealthPoint = input.GetS32();
  892. this.ManaPoint = input.GetS32();
  893. this.StaminaPoint = input.GetS32();
  894. this.GenExp = input.GetS32();
  895. this.DropItemsSet = input.GetList<DropItemList>(input.GetExt<DropItemList>);
  896. this.DropMoney = input.GetS32();
  897. this.InventorySize = input.GetS32();
  898. this.InventoryList = input.GetList<InventoryItem>(input.GetExt<InventoryItem>);
  899. this.LifeTimeMS = input.GetS32();
  900. this.SpawnTimeMS = input.GetS32();
  901. this.DeadTimeMS = input.GetS32();
  902. this.DeadDelayTimeMS = input.GetS32();
  903. this.DeadDelaySpellNumber = input.GetS32();
  904. this.DeadDelaySpellIntervalMS = input.GetS32();
  905. this.RebirthTimeMS = input.GetS32();
  906. this.UserTag = input.GetUTF();
  907. this.IsDynamic = input.GetBool();
  908. this.Events = input.GetList<int>(input.GetS32);
  909. this.Attributes = input.GetUTFArray();
  910. this.Properties = input.GetExt<IUnitProperties>(this.Properties);
  911. this.ChangeForceEffect = input.GetExt<LaunchEffect>();
  912. this.HitBreakPrecent = input.GetS32();
  913. this.HitBreakEffect = input.GetExt<LaunchEffect>();
  914. this.IsRandomName = input.GetBool();
  915. this.SumType = input.GetEnum8<SummonType>();
  916. this.PreloadResources = input.GetUTF();
  917. if (UType == UnitType.TYPE_NPC && this.RecoveryIntervalMS > 0)
  918. {
  919. log.Debug("NPC配置了恢复时间, 强行重置" + this.ID);
  920. this.RecoveryIntervalMS = 0;
  921. }
  922. }
  923. public LaunchSkill GetSkillByID(int skillID)
  924. {
  925. if (BaseSkillID != null && skillID == BaseSkillID.SkillID)
  926. {
  927. return BaseSkillID;
  928. }
  929. if (Skills != null)
  930. {
  931. for (int i = 0; i < Skills.Count; i++)
  932. {
  933. if (Skills[i].SkillID == skillID)
  934. {
  935. return Skills[i];
  936. }
  937. }
  938. }
  939. return null;
  940. }
  941. }
  942. //---------------------------------------------------------------------------------//
  943. /// <summary>
  944. /// 技能模板
  945. /// </summary>
  946. [MessageType(0x4003)]
  947. [DescAttribute("技能模板")]
  948. [TableClassAttribute("ID")]
  949. public class SkillTemplate : ICloneable, ITemplateData, IExternalizable
  950. {
  951. public int TemplateID { get { return ID; } }
  952. [XmlSerializable()]
  953. public string EditorPath { get; set; }
  954. // 技能ID
  955. [DescAttribute("ID", "", false)]
  956. public int ID;
  957. /// <summary>
  958. /// 技能名字
  959. /// </summary>
  960. [LocalizationTextAttribute]
  961. [DescAttribute("技能名字", "基础")]
  962. public string Name;
  963. [DescAttribute("技能冷却时间(毫秒)", "基础")]
  964. [DependOnProperty("IsCoolDownWithAction", false)]
  965. public int CoolDownMS = 6000;
  966. //------------------------------------
  967. [DescAttribute("技能图标", "资源")]
  968. public string IconName;
  969. //------------------------------------
  970. /// <summary>
  971. /// 攻击动作序列
  972. /// </summary>
  973. [DescAttribute("攻击动作序列", "动作")]
  974. [ListAttribute(typeof(UnitActionData))]
  975. public List<UnitActionData> ActionQueue = new List<UnitActionData>();
  976. [DescAttribute("以动作时间作为冷却时间, 普攻使用", "动作")]
  977. //只能普攻使用
  978. public bool IsCoolDownWithAction = false;
  979. [DescAttribute("可以打断其他技能和受击状态,受身技能", "动作")]
  980. public bool IsCounter = false;
  981. [DescAttribute("技能优先级,高优先级可打断低优先级", "动作")]
  982. public int ActionPriority = 0;
  983. [DescAttribute("动作播放速率", "动作")]
  984. public float ActionSpeedRate = 1f;
  985. [DescAttribute("技能释放期间,模型缩放(仅客户端有效)", "动作")]
  986. public float BodyScale = 1f;
  987. [DescAttribute("技能释放期间,可手动撤销", "动作")]
  988. public bool IsManuallyCancelable = false;
  989. [DescAttribute("忽略本技能释放中不可打断的时间段(只用作客户端显示用)", "动作")]
  990. public bool IgnoreMyUncancelable = false;
  991. //------------------------------------
  992. [DescAttribute("每次释放只做一个动作,多段攻击", "多段攻击")]
  993. public bool IsSingleAction = false;
  994. [DependOnProperty("IsSingleAction")]
  995. [DescAttribute("多段攻击间隔有效时间", "多段攻击")]
  996. public int SingleActionCoolDownMS = 500;
  997. //------------------------------------
  998. [DescAttribute("攻击距离", "攻击范围")]
  999. public float AttackRange = 3;
  1000. [DescAttribute("攻击角度范围(弧度)\n如果角度为0,则为单体攻击", "攻击范围")]
  1001. public float AttackAngle = 0;
  1002. [DescAttribute("单体攻击,只在目标处于攻击范围才产生伤害", "攻击范围")]
  1003. public bool AttackMustBeInRange = true;
  1004. [DescAttribute("保持攻击距离(NPC会保持一段距离再攻击)大于0启效", "攻击范围")]
  1005. public float AttackKeepRange = 0;
  1006. [DescAttribute("自动战斗,跟随目标", "攻击范围")]
  1007. public bool AutoFightFollower = false;
  1008. //------------------------------------
  1009. [DescAttribute("技能当前储存次数")]
  1010. public short CurUseTimes = -1;
  1011. [DescAttribute("法术是否从自己身上发出", "释放")]
  1012. public bool IsLaunchBody = true;
  1013. [DescAttribute("吟唱时间(毫秒)大于0启效", "释放")]
  1014. public int ChantTimeMS = 0;
  1015. //------------------------------------
  1016. public enum CastTarget : byte
  1017. {
  1018. [DescAttribute("敌人")]
  1019. Enemy = 0,
  1020. [DescAttribute("友军")]
  1021. Alias = 1,
  1022. [DescAttribute("自己")]
  1023. Self = 2,
  1024. [DescAttribute("宠物为主人")]
  1025. PetForMaster = 3,
  1026. [DescAttribute("任何单位")]
  1027. EveryOne = 4,
  1028. [DescAttribute("无类型")]
  1029. NA = 5,
  1030. [DescAttribute("除自己之外友军")]
  1031. AlliesExcludeSelf = 6,
  1032. [DescAttribute("包括自己友军")]
  1033. AlliesIncludeSelf = 7,
  1034. [DescAttribute("除自己之外所有")]
  1035. EveryOneExcludeSelf = 8,
  1036. [DescAttribute("自己和敌人")]
  1037. EnemyAndSelf = 9,
  1038. }
  1039. [DescAttribute("技能期望作用目标", "释放")]
  1040. public CastTarget ExpectTarget = CastTarget.Enemy;
  1041. //------------------------------------
  1042. public enum SelectRange : byte
  1043. {
  1044. [DescAttribute("无")]
  1045. NA,
  1046. [DescAttribute("圆形区域")]
  1047. Round,
  1048. [DescAttribute("直线")]
  1049. Line,
  1050. [DescAttribute("矩形区域")]
  1051. Rect,
  1052. [DescAttribute("扇形区域")]
  1053. Fan,
  1054. }
  1055. //------------------------------------
  1056. [DescAttribute("释放时是否选择方向", "释放范围")]
  1057. public bool IsSelectRange = false;
  1058. [DependOnProperty("IsSelectRange")]
  1059. [DescAttribute("选择方向类型", "释放范围")]
  1060. public SelectRange SelectRangeType = SelectRange.NA;
  1061. [DependOnProperty("IsSelectRange")]
  1062. [DescAttribute("选择方向尺寸", "释放范围")]
  1063. public float SelectRangeSize;
  1064. //------------------------------------
  1065. [DescAttribute("释放消耗血量", "消耗")]
  1066. public int CostHP;
  1067. [DescAttribute("释放消耗法力", "消耗")]
  1068. public int CostMP;
  1069. //------------------------------------
  1070. /// <summary>
  1071. /// 用户自定义扩展属性
  1072. /// </summary>
  1073. [DescAttribute("扩展属性", "扩展")]
  1074. [Expandable]
  1075. [NotNull]
  1076. public ISkillProperties Properties = TemplateManager.Factory.CreateSkillProperties();
  1077. //------------------------------------
  1078. public SkillTemplate() { }
  1079. public SkillTemplate(int id)
  1080. {
  1081. this.ID = id;
  1082. }
  1083. public int GetID()
  1084. {
  1085. return ID;
  1086. }
  1087. public override string ToString()
  1088. {
  1089. return Name + "(" + ID + ")";
  1090. }
  1091. public UnitActionData GetActionByName(string name)
  1092. {
  1093. foreach (UnitActionData act in ActionQueue)
  1094. {
  1095. if (name.Equals(act.ActionName))
  1096. {
  1097. return act;
  1098. }
  1099. }
  1100. return null;
  1101. }
  1102. public int ToUnitSkillTotalTime(float fastCastRate)
  1103. {
  1104. return (int)(this.CoolDownMS * Math.Max(0, 1f - fastCastRate));
  1105. }
  1106. public int ActionQueueTimeMS
  1107. {
  1108. get
  1109. {
  1110. int ret = 0;
  1111. for (int i = 0; i < ActionQueue.Count; i++)
  1112. {
  1113. ret += ActionQueue[i].TotalTimeMS;
  1114. }
  1115. return ret;
  1116. }
  1117. }
  1118. public int[] ActionQueueTimeArray
  1119. {
  1120. get
  1121. {
  1122. int[] ret = new int[ActionQueue.Count];
  1123. for (int i = ret.Length - 1; i >= 0; --i)
  1124. {
  1125. ret[i] = ActionQueue[i].TotalTimeMS;
  1126. }
  1127. return ret;
  1128. }
  1129. }
  1130. public object Clone()
  1131. {
  1132. SkillTemplate ret = new SkillTemplate();
  1133. ret.EditorPath = this.EditorPath;
  1134. ret.ID = this.ID;
  1135. ret.Name = this.Name;
  1136. ret.IconName = this.IconName;
  1137. ret.ActionQueue = CUtils.CloneList<UnitActionData>(this.ActionQueue);
  1138. ret.IsSingleAction = this.IsSingleAction;
  1139. ret.SingleActionCoolDownMS = this.SingleActionCoolDownMS;
  1140. ret.IsCoolDownWithAction = this.IsCoolDownWithAction;
  1141. ret.IsCounter = this.IsCounter;
  1142. ret.ActionPriority = this.ActionPriority;
  1143. ret.CoolDownMS = this.CoolDownMS;
  1144. ret.ActionSpeedRate = this.ActionSpeedRate;
  1145. ret.IsManuallyCancelable = this.IsManuallyCancelable;
  1146. ret.IgnoreMyUncancelable = this.IgnoreMyUncancelable;
  1147. ret.BodyScale = this.BodyScale;
  1148. ret.AttackRange = this.AttackRange;
  1149. ret.AttackAngle = this.AttackAngle;
  1150. ret.AttackMustBeInRange = this.AttackMustBeInRange;
  1151. ret.AttackKeepRange = this.AttackKeepRange;
  1152. ret.AutoFightFollower = this.AutoFightFollower;
  1153. ret.IsLaunchBody = this.IsLaunchBody;
  1154. ret.ChantTimeMS = this.ChantTimeMS;
  1155. ret.IsSelectRange = this.IsSelectRange;
  1156. ret.SelectRangeType = this.SelectRangeType;
  1157. ret.SelectRangeSize = this.SelectRangeSize;
  1158. ret.CostHP = this.CostHP;
  1159. ret.CostMP = this.CostMP;
  1160. ret.ExpectTarget = this.ExpectTarget;
  1161. //ret.CurUseTimes = this.CurUseTimes;
  1162. ret.Properties = CUtils.TryClone<ISkillProperties>(this.Properties);
  1163. return ret;
  1164. }
  1165. public void WriteExternal(IOutputStream output)
  1166. {
  1167. output.PutUTF(this.EditorPath);
  1168. output.PutS32(this.ID);
  1169. output.PutUTF(this.Name);
  1170. output.PutUTF(this.IconName);
  1171. output.PutList(this.ActionQueue, output.PutExt);
  1172. output.PutBool(this.IsSingleAction);
  1173. output.PutS32(this.SingleActionCoolDownMS);
  1174. output.PutBool(this.IsCoolDownWithAction);
  1175. output.PutBool(this.IsCounter);
  1176. output.PutS32(this.ActionPriority);
  1177. output.PutS32(this.CoolDownMS);
  1178. output.PutF32(this.ActionSpeedRate);
  1179. output.PutBool(this.IsManuallyCancelable);
  1180. output.PutBool(this.IgnoreMyUncancelable);
  1181. output.PutF32(this.BodyScale);
  1182. output.PutF32(this.AttackRange);
  1183. output.PutF32(this.AttackAngle);
  1184. output.PutBool(this.AttackMustBeInRange);
  1185. output.PutF32(this.AttackKeepRange);
  1186. output.PutBool(this.AutoFightFollower);
  1187. output.PutBool(this.IsLaunchBody);
  1188. output.PutS32(this.ChantTimeMS);
  1189. output.PutBool(this.IsSelectRange);
  1190. output.PutEnum8(this.SelectRangeType);
  1191. output.PutF32(this.SelectRangeSize);
  1192. output.PutS32(this.CostHP);
  1193. output.PutS32(this.CostMP);
  1194. output.PutEnum8(this.ExpectTarget);
  1195. output.PutS16(this.CurUseTimes);
  1196. output.PutExt(this.Properties);
  1197. }
  1198. public void ReadExternal(IInputStream input)
  1199. {
  1200. this.EditorPath = input.GetUTF();
  1201. this.ID = input.GetS32();
  1202. this.Name = input.GetUTF();
  1203. this.IconName = input.GetUTF();
  1204. this.ActionQueue = input.GetList<UnitActionData>(input.GetExt<UnitActionData>);
  1205. this.IsSingleAction = input.GetBool();
  1206. this.SingleActionCoolDownMS = input.GetS32();
  1207. this.IsCoolDownWithAction = input.GetBool();
  1208. this.IsCounter = input.GetBool();
  1209. this.ActionPriority = input.GetS32();
  1210. this.CoolDownMS = input.GetS32();
  1211. this.ActionSpeedRate = input.GetF32();
  1212. this.IsManuallyCancelable = input.GetBool();
  1213. this.IgnoreMyUncancelable = input.GetBool();
  1214. this.BodyScale = input.GetF32();
  1215. this.AttackRange = input.GetF32();
  1216. this.AttackAngle = input.GetF32();
  1217. this.AttackMustBeInRange = input.GetBool();
  1218. this.AttackKeepRange = input.GetF32();
  1219. this.AutoFightFollower = input.GetBool();
  1220. this.IsLaunchBody = input.GetBool();
  1221. this.ChantTimeMS = input.GetS32();
  1222. this.IsSelectRange = input.GetBool();
  1223. this.SelectRangeType = input.GetEnum8<SelectRange>();
  1224. this.SelectRangeSize = input.GetF32();
  1225. this.CostHP = input.GetS32();
  1226. this.CostMP = input.GetS32();
  1227. this.ExpectTarget = input.GetEnum8<CastTarget>();
  1228. this.CurUseTimes = input.GetS16();
  1229. this.Properties = input.GetExt<ISkillProperties>(this.Properties);
  1230. }
  1231. }
  1232. //---------------------------------------------------------------------------------//
  1233. /// <summary>
  1234. /// 单位动作模板
  1235. /// </summary>
  1236. [MessageType(0x4004)]
  1237. [DescAttribute("单位动作")]
  1238. [Expandable]
  1239. public class UnitActionData : ICloneable, IExternalizable
  1240. {
  1241. [DescAttribute("总动作时间(毫秒)", "Action")]
  1242. public int TotalTimeMS;
  1243. [DescAttribute("动作播放速率增加(加法)", "动作")]
  1244. public float ActionSpeedRate = 0.0f;
  1245. [DescAttribute("单一动作类型,0-普通, 1,蓄力动作,2-多段式动作", "Action")]
  1246. //蓄力动作,显示倒计时圈
  1247. //多段式动作,显示倒计时圈 + 倒计时
  1248. public ActionEnum SigleActionType;
  1249. [DescAttribute("动作名字, IsSingleAction=false才有效", "Action")]
  1250. public string ActionName;
  1251. [DependOnProperty("IsControlMoveable", true)]
  1252. [DescAttribute("移动动作名字", "Action")]
  1253. public string MoveActionName;
  1254. [DescAttribute("动作对应的特效,通常用作刀光", "Action")]
  1255. [ResourceIDAttribute]
  1256. public string ActionEffectFileName;
  1257. [DescAttribute("动作是否循环", "Action")]
  1258. public bool IsCycAction;
  1259. [DescAttribute("显示蓄力倒计时条时间(毫秒)", "Action")]
  1260. public int ShowChargeTimeMS = 0;
  1261. [DescAttribute("移动可取消动作", "状态")]
  1262. public bool IsCancelable = false;
  1263. [DescAttribute("技能可取消动作", "状态")]
  1264. public bool IsCancelableBySkill = false;
  1265. [DescAttribute("技能能否被下一段替代", "状态")]
  1266. public bool IsCancelBySkillNext = false;
  1267. [DescAttribute("是否进入霸体状态,不会被打断", "状态")]
  1268. public bool IsNoneBlock = false;
  1269. [DescAttribute("动作期间是否无碰撞", "状态")]
  1270. public bool IsNoneTouch = false;
  1271. [DescAttribute("动作中是否面向目标", "状态")]
  1272. public bool IsFaceToTarget = true;
  1273. [DescAttribute("动作是否隐身", "状态")]
  1274. public bool IsInvisible = false;
  1275. [DescAttribute("动作中是否可以控制移动", "状态")]
  1276. public bool IsControlMoveable = false;
  1277. [DescAttribute("动作中可以控制转向", "状态")]
  1278. public bool IsControlFaceable = false;
  1279. //新增动作对应Icon
  1280. [DescAttribute("是否换图", "资源")]
  1281. public bool IsChangeIcon = false;
  1282. [DescAttribute("图片名字", "资源")]
  1283. [DependOnProperty("IsChangeIcon", true)]
  1284. public string IconName;
  1285. [DescAttribute("攻击范围改变", "攻击范围")]
  1286. public AttackShape OverrideAttackShape;
  1287. /// <summary>
  1288. /// 所有关键帧
  1289. /// </summary>
  1290. [ListAttribute(typeof(KeyFrame))]
  1291. [DescAttribute("所有关键帧", "关键帧")]
  1292. public List<KeyFrame> KeyFrames = new List<KeyFrame>();
  1293. public bool IsBodyHit
  1294. {
  1295. get
  1296. {
  1297. if (IsMoveToTarget) return false;
  1298. if (IsJumpToTarget) return false;
  1299. return BodyHit != null;
  1300. }
  1301. }
  1302. /// <summary>
  1303. /// 身体攻击判定
  1304. /// </summary>
  1305. [DependOnProperty("IsMoveToTarget", false)]
  1306. [DependOnProperty("IsJumpToTarget", false)]
  1307. [DescAttribute("身体攻击判定", "身体攻击")]
  1308. public AttackProp BodyHit;
  1309. [DependOnProperty("IsBodyHit")]
  1310. [DescAttribute("身体攻击判定范围", "身体攻击")]
  1311. public float BodyHitSize;
  1312. [DependOnProperty("IsBodyHit")]
  1313. [DescAttribute("身体攻击后立即切换动作", "身体攻击")]
  1314. public bool BodyHitNextAction;
  1315. [DescAttribute("移动到目标", "位移 - 冲锋")]
  1316. public bool IsMoveToTarget = false;
  1317. [DescAttribute("移动到目标速度", "位移 - 冲锋")]
  1318. [DependOnProperty("IsMoveToTarget")]
  1319. public float MoveToTargetSpeedSEC = 10;
  1320. [DescAttribute("移动到目标根据(距离/动作时间)来算速度,如果目标在原地,则原地跳跃。", "位移 - 跳跃")]
  1321. [DependOnProperty("IsMoveToTarget", false)]
  1322. public bool IsJumpToTarget = false;
  1323. [DescAttribute("跳跃高度", "位移 - 跳跃")]
  1324. [DependOnProperty("IsJumpToTarget")]
  1325. public float JumpToTargetHeightZ = 1;
  1326. [DescAttribute("在攻击范围内,如果位移则挤开目标", "碰撞")]
  1327. [DependOnProperty("IsMoveToTarget", false)]
  1328. [DependOnProperty("IsJumpToTarget", false)]
  1329. public bool BodyBlockOnAttackRange = false;
  1330. [DescAttribute("显示技能引导光圈(必须先打开扩展属性中的ShowLaunchGuide)", "控制")]
  1331. public bool IsShowSkillGuide = false;
  1332. [DescAttribute("增加技能按钮遮罩", "资源")]
  1333. public bool IsAddSkillBtnBlock = false;
  1334. [DescAttribute("动作的音效文件名", "资源")]
  1335. public string ActionAudioName;
  1336. [DescAttribute("动作的音效文件是否循环播放", "资源")]
  1337. public bool IsAudioLoop;
  1338. public UnitActionData() { }
  1339. public override string ToString()
  1340. {
  1341. return "动作: " + ActionName + " (" + TotalTimeMS + "(毫秒))";
  1342. }
  1343. public object Clone()
  1344. {
  1345. UnitActionData ret = new UnitActionData();
  1346. ret.ShowChargeTimeMS = this.ShowChargeTimeMS;
  1347. ret.TotalTimeMS = this.TotalTimeMS;
  1348. ret.ActionName = this.ActionName;
  1349. ret.ActionEffectFileName = this.ActionEffectFileName;
  1350. ret.IsCycAction = this.IsCycAction;
  1351. ret.IsCancelable = this.IsCancelable;
  1352. ret.IsCancelableBySkill = this.IsCancelableBySkill;
  1353. ret.IsCancelBySkillNext = this.IsCancelBySkillNext;
  1354. ret.IsNoneBlock = this.IsNoneBlock;
  1355. ret.IsNoneTouch = this.IsNoneTouch;
  1356. ret.IsFaceToTarget = this.IsFaceToTarget;
  1357. ret.IsInvisible = this.IsInvisible;
  1358. ret.IsControlMoveable = this.IsControlMoveable;
  1359. ret.IsControlFaceable = this.IsControlFaceable;
  1360. ret.IsChangeIcon = this.IsChangeIcon;
  1361. ret.IconName = this.IconName;
  1362. ret.OverrideAttackShape = CUtils.TryClone<AttackShape>(this.OverrideAttackShape);
  1363. ret.KeyFrames = CUtils.CloneList<KeyFrame>(this.KeyFrames);
  1364. ret.BodyHit = CUtils.TryClone<AttackProp>(this.BodyHit);
  1365. ret.BodyHitSize = this.BodyHitSize;
  1366. ret.BodyHitNextAction = this.BodyHitNextAction;
  1367. ret.IsMoveToTarget = this.IsMoveToTarget;
  1368. ret.MoveToTargetSpeedSEC = this.MoveToTargetSpeedSEC;
  1369. ret.IsJumpToTarget = this.IsJumpToTarget;
  1370. ret.JumpToTargetHeightZ = this.JumpToTargetHeightZ;
  1371. ret.BodyBlockOnAttackRange = this.BodyBlockOnAttackRange;
  1372. ret.IsShowSkillGuide = this.IsShowSkillGuide;
  1373. ret.SigleActionType = this.SigleActionType;
  1374. ret.MoveActionName = this.MoveActionName;
  1375. ret.ActionSpeedRate = this.ActionSpeedRate;
  1376. ret.IsAddSkillBtnBlock = this.IsAddSkillBtnBlock;
  1377. ret.ActionAudioName = this.ActionAudioName;
  1378. ret.IsAudioLoop = this.IsAudioLoop;
  1379. return ret;
  1380. }
  1381. public void WriteExternal(IOutputStream output)
  1382. {
  1383. output.PutS32(this.TotalTimeMS);
  1384. output.PutS32(this.ShowChargeTimeMS);
  1385. output.PutUTF(this.ActionName);
  1386. output.PutUTF(this.ActionEffectFileName);
  1387. output.PutBool(this.IsCycAction);
  1388. output.PutBool(this.IsCancelable);
  1389. output.PutBool(this.IsCancelableBySkill);
  1390. output.PutBool(this.IsCancelBySkillNext);
  1391. output.PutBool(this.IsNoneBlock);
  1392. output.PutBool(this.IsNoneTouch);
  1393. output.PutBool(this.IsFaceToTarget);
  1394. output.PutBool(this.IsInvisible);
  1395. output.PutBool(this.IsControlMoveable);
  1396. output.PutBool(this.IsControlFaceable);
  1397. output.PutBool(this.IsChangeIcon);
  1398. output.PutUTF(this.IconName);
  1399. output.PutExt(this.OverrideAttackShape);
  1400. output.PutList<KeyFrame>(this.KeyFrames, output.PutExt);
  1401. output.PutExt(this.BodyHit);
  1402. output.PutF32(this.BodyHitSize);
  1403. output.PutBool(this.BodyHitNextAction);
  1404. output.PutBool(this.IsMoveToTarget);
  1405. output.PutF32(this.MoveToTargetSpeedSEC);
  1406. output.PutBool(this.IsJumpToTarget);
  1407. output.PutF32(this.JumpToTargetHeightZ);
  1408. output.PutBool(this.BodyBlockOnAttackRange);
  1409. output.PutBool(this.IsShowSkillGuide);
  1410. output.PutEnum8(this.SigleActionType);
  1411. output.PutUTF(this.MoveActionName);
  1412. output.PutF32(this.ActionSpeedRate);
  1413. output.PutBool(this.IsAddSkillBtnBlock);
  1414. output.PutUTF(this.ActionAudioName);
  1415. output.PutBool(this.IsAudioLoop);
  1416. }
  1417. public void ReadExternal(IInputStream input)
  1418. {
  1419. this.TotalTimeMS = input.GetS32();
  1420. this.ShowChargeTimeMS = input.GetS32();
  1421. this.ActionName = input.GetUTF();
  1422. this.ActionEffectFileName = input.GetUTF();
  1423. this.IsCycAction = input.GetBool();
  1424. this.IsCancelable = input.GetBool();
  1425. this.IsCancelableBySkill = input.GetBool();
  1426. this.IsCancelBySkillNext = input.GetBool();
  1427. this.IsNoneBlock = input.GetBool();
  1428. this.IsNoneTouch = input.GetBool();
  1429. this.IsFaceToTarget = input.GetBool();
  1430. this.IsInvisible = input.GetBool();
  1431. this.IsControlMoveable = input.GetBool();
  1432. this.IsControlFaceable = input.GetBool();
  1433. this.IsChangeIcon = input.GetBool();
  1434. this.IconName = input.GetUTF();
  1435. this.OverrideAttackShape = input.GetExt<AttackShape>();
  1436. this.KeyFrames = input.GetList<KeyFrame>(input.GetExt<KeyFrame>);
  1437. this.BodyHit = input.GetExt<AttackProp>();
  1438. this.BodyHitSize = input.GetF32();
  1439. this.BodyHitNextAction = input.GetBool();
  1440. this.IsMoveToTarget = input.GetBool();
  1441. this.MoveToTargetSpeedSEC = input.GetF32();
  1442. this.IsJumpToTarget = input.GetBool();
  1443. this.JumpToTargetHeightZ = input.GetF32();
  1444. this.BodyBlockOnAttackRange = input.GetBool();
  1445. this.IsShowSkillGuide = input.GetBool();
  1446. this.SigleActionType = input.GetEnum8<ActionEnum>();
  1447. this.MoveActionName = input.GetUTF();
  1448. this.ActionSpeedRate = input.GetF32();
  1449. this.IsAddSkillBtnBlock = input.GetBool();
  1450. this.ActionAudioName = input.GetUTF();
  1451. this.IsAudioLoop = input.GetBool();
  1452. }
  1453. //------------------------------------------------------------
  1454. /// <summary>
  1455. /// 动作状态数据
  1456. /// </summary>
  1457. [MessageType(0x4107)]
  1458. [DescAttribute("动作关键帧数据")]
  1459. [Expandable]
  1460. public class StatusChange : ICloneable, IExternalizable
  1461. {
  1462. [DescAttribute("移动可取消动作", "状态")]
  1463. public bool IsCancelable = false;
  1464. [DescAttribute("技能可取消动作", "状态")]
  1465. public bool IsCancelableBySkill = false;
  1466. [DescAttribute("是否进入霸体状态,不会被打断", "状态")]
  1467. public bool IsNoneBlock = false;
  1468. [DescAttribute("动作期间是否无碰撞", "状态")]
  1469. public bool IsNoneTouch = false;
  1470. [DescAttribute("动作中是否面向目标", "状态")]
  1471. public bool IsFaceToTarget = false;
  1472. [DescAttribute("动作是否隐身", "状态")]
  1473. public bool IsInvisible = false;
  1474. [DescAttribute("动作中是否可以控制移动", "状态")]
  1475. public bool IsControlMoveable = false;
  1476. [DescAttribute("动作中可以控制转向", "状态")]
  1477. public bool IsControlFaceable = false;
  1478. public override string ToString()
  1479. {
  1480. return string.Format("{0}{1}{2}{3}{4}{5}{6}{7}",
  1481. IsCancelable ? "移动可取消," : "",
  1482. IsCancelableBySkill ? "技能可取消," : "",
  1483. IsNoneBlock ? "霸体," : "",
  1484. IsNoneTouch ? "无碰撞," : "",
  1485. IsFaceToTarget ? "面向目标," : "",
  1486. IsInvisible ? "隐身," : "",
  1487. IsControlMoveable ? "可控制移动," : "",
  1488. IsControlFaceable ? "可控制转向," : "");
  1489. }
  1490. public object Clone()
  1491. {
  1492. StatusChange ret = new StatusChange();
  1493. ret.IsCancelable = this.IsCancelable;
  1494. ret.IsCancelableBySkill = this.IsCancelableBySkill;
  1495. ret.IsNoneBlock = this.IsNoneBlock;
  1496. ret.IsNoneTouch = this.IsNoneTouch;
  1497. ret.IsFaceToTarget = this.IsFaceToTarget;
  1498. ret.IsInvisible = this.IsInvisible;
  1499. ret.IsControlMoveable = this.IsControlMoveable;
  1500. ret.IsControlFaceable = this.IsControlFaceable;
  1501. return ret;
  1502. }
  1503. public void WriteExternal(IOutputStream output)
  1504. {
  1505. output.PutBool(this.IsCancelable);
  1506. output.PutBool(this.IsCancelableBySkill);
  1507. output.PutBool(this.IsNoneBlock);
  1508. output.PutBool(this.IsNoneTouch);
  1509. output.PutBool(this.IsFaceToTarget);
  1510. output.PutBool(this.IsInvisible);
  1511. output.PutBool(this.IsControlMoveable);
  1512. output.PutBool(this.IsControlFaceable);
  1513. }
  1514. public void ReadExternal(IInputStream input)
  1515. {
  1516. this.IsCancelable = input.GetBool();
  1517. this.IsCancelableBySkill = input.GetBool();
  1518. this.IsNoneBlock = input.GetBool();
  1519. this.IsNoneTouch = input.GetBool();
  1520. this.IsFaceToTarget = input.GetBool();
  1521. this.IsInvisible = input.GetBool();
  1522. this.IsControlMoveable = input.GetBool();
  1523. this.IsControlFaceable = input.GetBool();
  1524. }
  1525. }
  1526. //------------------------------------------------------------
  1527. [MessageType(0x4108)]
  1528. [DescAttribute("动作攻击范围")]
  1529. [Expandable]
  1530. public class AttackShape : ICloneable, IExternalizable
  1531. {
  1532. public enum Shape : byte
  1533. {
  1534. [DescAttribute("单体")]
  1535. Single = CommonAI.Zone.Helper.AttackShape.Single,
  1536. [DescAttribute("圆形")]
  1537. Round = CommonAI.Zone.Helper.AttackShape.Round,
  1538. [DescAttribute("扇形")]
  1539. Fan = CommonAI.Zone.Helper.AttackShape.Fan,
  1540. [DescAttribute("胶囊条状")]
  1541. Strip = CommonAI.Zone.Helper.AttackShape.Strip,
  1542. [DescAttribute("胶囊射线(以原点出去)")]
  1543. StripRay = CommonAI.Zone.Helper.AttackShape.StripRay,
  1544. [DescAttribute("胶囊射线,接触到最近")]
  1545. StripRayTouchEnd = CommonAI.Zone.Helper.AttackShape.StripRayTouchEnd,
  1546. [DescAttribute("方形条状")]
  1547. RectStrip = CommonAI.Zone.Helper.AttackShape.RectStrip,
  1548. [DescAttribute("方形射线(以原点出去)")]
  1549. RectStripRay = CommonAI.Zone.Helper.AttackShape.RectStripRay,
  1550. [DescAttribute("横向胶囊条状")]
  1551. WideStrip = CommonAI.Zone.Helper.AttackShape.WideStrip,
  1552. [DescAttribute("圆环,中间是空的")]
  1553. Circle = CommonAI.Zone.Helper.AttackShape.Circle,
  1554. }
  1555. [DescAttribute("攻击范围类型", "攻击范围")]
  1556. public Shape AShape = Shape.Round;
  1557. [DescAttribute("半径(Round, Fan, Circle)长度(Strip, StripRay,StripRayTouchEnd, RectStrip, RectStripRay, LineToTarget, WideStrip)", "攻击范围")]
  1558. public float AttackRange = 1;
  1559. [DescAttribute("角度(Fan)", "攻击范围")]
  1560. [DependOnProperty("IsShapeFan")]
  1561. public float AttackAngle = 1;
  1562. [DescAttribute("宽度,粗度(Strip, StripRay,StripRayTouchEnd,RectStrip, RectStripRay, WideStrip),环粗度(Circle)", "攻击范围")]
  1563. [DependOnProperty("IsShapeStrip")]
  1564. public float StripWide = 1;
  1565. [DescAttribute("初始点偏移", "身体")]
  1566. public float OffsetRadius = 0;
  1567. public bool IsSingle { get { return AShape == Shape.Single; } }
  1568. public bool IsShapeFan { get { return AShape == Shape.Fan; } }
  1569. public bool IsShapeStrip
  1570. {
  1571. get
  1572. {
  1573. switch (AShape)
  1574. {
  1575. case Shape.Strip:
  1576. case Shape.StripRay:
  1577. case Shape.StripRayTouchEnd:
  1578. case Shape.Circle:
  1579. case Shape.RectStrip:
  1580. case Shape.RectStripRay:
  1581. case Shape.WideStrip:
  1582. return true;
  1583. }
  1584. return false;
  1585. }
  1586. }
  1587. public override string ToString()
  1588. {
  1589. return string.Format("重定向攻击范围:{0}", AShape);
  1590. }
  1591. public object Clone()
  1592. {
  1593. AttackShape ret = new AttackShape();
  1594. ret.AShape = this.AShape;
  1595. ret.AttackRange = this.AttackRange;
  1596. ret.AttackAngle = this.AttackAngle;
  1597. ret.StripWide = this.StripWide;
  1598. ret.OffsetRadius = this.OffsetRadius;
  1599. return ret;
  1600. }
  1601. public void WriteExternal(IOutputStream output)
  1602. {
  1603. output.PutEnum8(this.AShape);
  1604. output.PutF32(this.AttackRange);
  1605. output.PutF32(this.AttackAngle);
  1606. output.PutF32(this.StripWide);
  1607. output.PutF32(this.OffsetRadius);
  1608. }
  1609. public void ReadExternal(IInputStream input)
  1610. {
  1611. this.AShape = input.GetEnum8<Shape>();
  1612. this.AttackRange = input.GetF32();
  1613. this.AttackAngle = input.GetF32();
  1614. this.StripWide = input.GetF32();
  1615. this.OffsetRadius = input.GetF32();
  1616. }
  1617. }
  1618. //-------------------------------------------------------------------------------------
  1619. //------------------------------------------------------------
  1620. [MessageType(0x4109)]
  1621. [DescAttribute("动作攻击范围")]
  1622. [Expandable]
  1623. public class ThrowTarget : ICloneable, IExternalizable
  1624. {
  1625. public override string ToString()
  1626. {
  1627. return string.Format("重定向攻击范");
  1628. }
  1629. public object Clone()
  1630. {
  1631. ThrowTarget ret = new ThrowTarget();
  1632. return ret;
  1633. }
  1634. public void WriteExternal(IOutputStream output)
  1635. {
  1636. }
  1637. public void ReadExternal(IInputStream input)
  1638. {
  1639. }
  1640. }
  1641. //-------------------------------------------------------------------------------------
  1642. //------------------------------------------------------------
  1643. /// <summary>
  1644. /// 动作关键帧数据
  1645. /// </summary>
  1646. [MessageType(0x4104)]
  1647. [DescAttribute("动作关键帧数据")]
  1648. [Expandable]
  1649. public class KeyFrame : BaseKeyFrame, ICloneable, IExternalizable
  1650. {
  1651. /// <summary>
  1652. /// 关键帧产生的法术或远程道具单位模板ID
  1653. /// </summary>
  1654. [DescAttribute("关键帧产生的法术或远程道具单位模板ID")]
  1655. public LaunchSpell Spell;
  1656. /// <summary>
  1657. /// 当前关键帧特效
  1658. /// </summary>
  1659. [DescAttribute("当前关键帧特效ID")]
  1660. public LaunchEffect Effect;
  1661. /// <summary>
  1662. /// 攻击属性
  1663. /// </summary>
  1664. [DescAttribute("攻击属性ID")]
  1665. public AttackProp Attack;
  1666. /// <summary>
  1667. /// 对自己产生BUFF
  1668. /// </summary>
  1669. [DescAttribute("对自己产生BUFF")]
  1670. public LaunchBuff SelfBuff;
  1671. /// <summary>
  1672. /// 此动作关键帧产生的位移
  1673. /// </summary>
  1674. [DescAttribute("此动作关键帧产生的位移")]
  1675. public StartMove Move;
  1676. [DescAttribute("位移在有打击目标时是否生效")]
  1677. public bool hitTargetMoveEnable = true;
  1678. [DescAttribute("闪现位移")]
  1679. public BlinkMove Blink;
  1680. [DescAttribute("动作状态改变")]
  1681. public StatusChange ChangeStatus;
  1682. public KeyFrame() { }
  1683. public override string ToString()
  1684. {
  1685. return "Frame: @" + FrameMS;
  1686. }
  1687. public object Clone()
  1688. {
  1689. KeyFrame ret = new KeyFrame();
  1690. ret.FrameMS = base.FrameMS;
  1691. ret.Spell = CUtils.TryClone<LaunchSpell>(this.Spell);
  1692. ret.Effect = CUtils.TryClone<LaunchEffect>(this.Effect);
  1693. ret.Attack = CUtils.TryClone<AttackProp>(this.Attack);
  1694. ret.SelfBuff = CUtils.TryClone<LaunchBuff>(this.SelfBuff);
  1695. ret.Move = CUtils.TryClone<StartMove>(this.Move);
  1696. ret.hitTargetMoveEnable = this.hitTargetMoveEnable;
  1697. ret.Blink = CUtils.TryClone<BlinkMove>(this.Blink);
  1698. ret.ChangeStatus = CUtils.TryClone<StatusChange>(this.ChangeStatus);
  1699. return ret;
  1700. }
  1701. public void WriteExternal(IOutputStream output)
  1702. {
  1703. output.PutS32(base.FrameMS);
  1704. output.PutExt(this.Spell);
  1705. output.PutExt(this.Effect);
  1706. output.PutExt(this.Attack);
  1707. output.PutExt(this.SelfBuff);
  1708. output.PutExt(this.Move);
  1709. output.PutBool(this.hitTargetMoveEnable);
  1710. output.PutExt(this.Blink);
  1711. output.PutExt(this.ChangeStatus);
  1712. }
  1713. public void ReadExternal(IInputStream input)
  1714. {
  1715. base.FrameMS = input.GetS32();
  1716. this.Spell = input.GetExt<LaunchSpell>();
  1717. this.Effect = input.GetExt<LaunchEffect>();
  1718. this.Attack = input.GetExt<AttackProp>();
  1719. this.SelfBuff = input.GetExt<LaunchBuff>();
  1720. this.Move = input.GetExt<StartMove>();
  1721. this.hitTargetMoveEnable = input.GetBool();
  1722. this.Blink = input.GetExt<BlinkMove>();
  1723. this.ChangeStatus = input.GetExt<StatusChange>();
  1724. }
  1725. }
  1726. }
  1727. //---------------------------------------------------------------------------------//
  1728. /// <summary>
  1729. /// 单位行为触发器
  1730. /// </summary>
  1731. [MessageType(0x4010)]
  1732. [DescAttribute("单位行为触发器")]
  1733. [TableClassAttribute("ID")]
  1734. public class UnitTriggerTemplate : ICloneable, ITemplateData, IExternalizable
  1735. {
  1736. public int TemplateID { get { return ID; } }
  1737. [XmlSerializable()]
  1738. public string EditorPath { get; set; }
  1739. [DescAttribute("ID", "基础", false)]
  1740. public int ID;
  1741. [LocalizationTextAttribute]
  1742. [DescAttribute("触发器名字", "基础")]
  1743. public string Name;
  1744. [DescAttribute("触发器冷却时间", "基础")]
  1745. public int CoolDownTimeMS = 10000;
  1746. [DescAttribute("事件触发条件(所有的关系为与)", "条件")]
  1747. [ListAttribute(typeof(UnitTriggers.BaseTriggerEvent))]
  1748. public List<UnitTriggers.BaseTriggerEvent> Triggers = new List<UnitTriggers.BaseTriggerEvent>();
  1749. [DescAttribute("释放技能", "动作")]
  1750. public LaunchSkill DoSkill;
  1751. [DescAttribute("产生Buff", "动作")]
  1752. public LaunchBuff DoBuff;
  1753. [DescAttribute("产生法术", "动作")]
  1754. public LaunchSpell DoSpell;
  1755. [DescAttribute("产生特效(图形)", "动作")]
  1756. public LaunchEffect DoEffect;
  1757. /// <summary>
  1758. /// 召唤小弟
  1759. /// </summary>
  1760. [DescAttribute("召唤小弟", "动作")]
  1761. public SummonUnit DoSummon;
  1762. //------------------------------------
  1763. /// <summary>
  1764. /// 用户自定义扩展属性
  1765. /// </summary>
  1766. [DescAttribute("扩展属性", "扩展")]
  1767. [Expandable]
  1768. [NotNull]
  1769. public IUnitTriggerProperties Properties = TemplateManager.Factory.CreateTriggerProperties();
  1770. public override string ToString()
  1771. {
  1772. return Name + "(" + ID + ")";
  1773. }
  1774. public string FunctionText()
  1775. {
  1776. StringBuilder sb = new StringBuilder();
  1777. if (Triggers.Count > 0)
  1778. {
  1779. foreach (UnitTriggers.BaseTriggerEvent e in Triggers)
  1780. {
  1781. sb.Append(string.Format("{0}", e));
  1782. if (e != Triggers[Triggers.Count - 1])
  1783. {
  1784. sb.Append(" 并且 ");
  1785. }
  1786. }
  1787. if (DoSkill != null) sb.Append("," + DoSkill);
  1788. if (DoBuff != null) sb.Append("," + DoBuff);
  1789. if (DoSpell != null) sb.Append("," + DoSpell);
  1790. if (DoEffect != null) sb.Append("," + DoEffect);
  1791. }
  1792. return sb.ToString();
  1793. }
  1794. public object Clone()
  1795. {
  1796. UnitTriggerTemplate ret = new UnitTriggerTemplate();
  1797. ret.EditorPath = this.EditorPath;
  1798. ret.ID = this.ID;
  1799. ret.Name = this.Name;
  1800. ret.CoolDownTimeMS = this.CoolDownTimeMS;
  1801. ret.Triggers = CUtils.CloneList<UnitTriggers.BaseTriggerEvent>(this.Triggers);
  1802. ret.DoSkill = CUtils.TryClone<LaunchSkill>(this.DoSkill);
  1803. ret.DoBuff = CUtils.TryClone<LaunchBuff>(this.DoBuff);
  1804. ret.DoSpell = CUtils.TryClone<LaunchSpell>(this.DoSpell);
  1805. ret.DoEffect = CUtils.TryClone<LaunchEffect>(this.DoEffect);
  1806. ret.DoSummon = CUtils.TryClone<SummonUnit>(this.DoSummon);
  1807. return ret;
  1808. }
  1809. public void WriteExternal(IOutputStream output)
  1810. {
  1811. output.PutUTF(this.EditorPath);
  1812. output.PutS32(this.ID);
  1813. output.PutUTF(this.Name);
  1814. output.PutS32(this.CoolDownTimeMS);
  1815. output.PutList<UnitTriggers.BaseTriggerEvent>(this.Triggers, output.PutExt);
  1816. output.PutExt(this.DoSkill);
  1817. output.PutExt(this.DoBuff);
  1818. output.PutExt(this.DoSpell);
  1819. output.PutExt(this.DoEffect);
  1820. output.PutExt(this.DoSummon);
  1821. }
  1822. public void ReadExternal(IInputStream input)
  1823. {
  1824. this.EditorPath = input.GetUTF();
  1825. this.ID = input.GetS32();
  1826. this.Name = input.GetUTF();
  1827. this.CoolDownTimeMS = input.GetS32();
  1828. this.Triggers = input.GetListAny<UnitTriggers.BaseTriggerEvent>();
  1829. this.DoSkill = input.GetExt<LaunchSkill>();
  1830. this.DoBuff = input.GetExt<LaunchBuff>();
  1831. this.DoSpell = input.GetExt<LaunchSpell>();
  1832. this.DoEffect = input.GetExt<LaunchEffect>();
  1833. this.DoSummon = input.GetExt<SummonUnit>();
  1834. }
  1835. }
  1836. //---------------------------------------------------------------------------------//
  1837. /// <summary>
  1838. /// 法术/飞行道具模板
  1839. /// </summary>
  1840. [MessageType(0x4005)]
  1841. [DescAttribute("法术/飞行道具模板")]
  1842. [TableClassAttribute("ID")]
  1843. public class SpellTemplate : ICloneable, ITemplateData, IExternalizable
  1844. {
  1845. public int TemplateID { get { return ID; } }
  1846. [XmlSerializable()]
  1847. public string EditorPath { get; set; }
  1848. public enum MotionType : byte
  1849. {
  1850. [DescAttribute("在原地不动")]
  1851. Immovability = 1,
  1852. [DescAttribute("按直线运动")]
  1853. Straight = 2,
  1854. [DescAttribute("跟随目标,直到击中")]
  1855. Missile = 3,
  1856. [DescAttribute("向周围扩散")]
  1857. AOE = 4,
  1858. [DescAttribute("绑定发射者")]
  1859. Binding = 6,
  1860. [DescAttribute("绑定被攻击者")]
  1861. BindingTarget = 7,
  1862. [DescAttribute("炮弹类")]
  1863. Cannon = 8,
  1864. [DescAttribute("直接在目标坐标生效")]
  1865. SelectTarget = 9,
  1866. [DescAttribute("先按直线运动,过程中锁定目标")]
  1867. SeekerMissile = 10,
  1868. [DescAttribute("向周围扩散,绑定发射者")]
  1869. AOE_Binding = 11,
  1870. [DescAttribute("向周围扩散,绑定被攻击者")]
  1871. AOE_BindingTarget = 12,
  1872. [DescAttribute("锁定并命中目标,和SeekerMissile区别是没有过程,直接命中。")]
  1873. SeekerSelectTarget = 13,
  1874. [DescAttribute("发射者和目标绑定(Distance必须在范围内)")]
  1875. Chain = 14,
  1876. [DescAttribute("直接在自身坐标生效")]
  1877. SelectLauncher = 15,
  1878. [DescAttribute("回旋镖路径1(最终返回到发射者)")]
  1879. Boomerang1 = 16,
  1880. [DescAttribute("回旋镖路径2(最终返回到发射点)")]
  1881. Boomerang2 = 17,
  1882. [DescAttribute("狐火路径")]
  1883. Foxfire = 18,
  1884. [DescAttribute("先直线,后停留")]
  1885. StraightAndStop = 19,
  1886. [DescAttribute("追踪,可击中路径上的敌人")]
  1887. MissileAttackRoute = 20,
  1888. [DescAttribute("曲线追踪")]
  1889. CurveMissile = 21,
  1890. }
  1891. /// <summary>
  1892. /// 往客户端推送,是否包含坐标
  1893. /// </summary>
  1894. public bool IsLaunchSpellEventSyncPos
  1895. {
  1896. get
  1897. {
  1898. // 脱离运动类型的一些特殊字段
  1899. if(this.IsBindingOrbit)
  1900. {
  1901. return true;
  1902. }
  1903. switch (MType)
  1904. {
  1905. case SpellTemplate.MotionType.AOE_Binding:
  1906. case SpellTemplate.MotionType.AOE_BindingTarget:
  1907. case SpellTemplate.MotionType.Binding:
  1908. case SpellTemplate.MotionType.BindingTarget:
  1909. case SpellTemplate.MotionType.Chain:
  1910. return false;
  1911. case SpellTemplate.MotionType.SelectLauncher:
  1912. case SpellTemplate.MotionType.SelectTarget:
  1913. case SpellTemplate.MotionType.Immovability:
  1914. case SpellTemplate.MotionType.Cannon:
  1915. case SpellTemplate.MotionType.AOE:
  1916. case SpellTemplate.MotionType.Straight:
  1917. case SpellTemplate.MotionType.Missile:
  1918. case SpellTemplate.MotionType.Boomerang1:
  1919. case SpellTemplate.MotionType.Boomerang2:
  1920. case SpellTemplate.MotionType.SeekerMissile:
  1921. case SpellTemplate.MotionType.SeekerSelectTarget:
  1922. case SpellTemplate.MotionType.StraightAndStop:
  1923. case SpellTemplate.MotionType.MissileAttackRoute:
  1924. case SpellTemplate.MotionType.CurveMissile:
  1925. default:
  1926. return true;
  1927. }
  1928. }
  1929. }
  1930. [DescAttribute("ID", "", false)]
  1931. public int ID;
  1932. /// <summary>
  1933. /// 法术名字
  1934. /// </summary>
  1935. [DescAttribute("法术名字")]
  1936. [LocalizationTextAttribute]
  1937. public string Name;
  1938. /// <summary>
  1939. /// 生命周期,帧
  1940. /// </summary>
  1941. [DescAttribute("生命周期(毫秒)")]
  1942. public int LifeTimeMS = 1000;
  1943. [DescAttribute("客户端是否可见")]
  1944. public bool ClientVisible = true;
  1945. //--------------------------------------------
  1946. public enum Shape : byte
  1947. {
  1948. [DescAttribute("圆形(BodySize=半径尺寸)")]
  1949. Round = AttackShape.Round,
  1950. [DescAttribute("扇形(BodySize=半径尺寸;FanAngle=角度)")]
  1951. Fan = AttackShape.Fan,
  1952. [DescAttribute("胶囊条状(Distance=长度;RectWide=宽度)")]
  1953. Strip = AttackShape.Strip,
  1954. [DescAttribute("胶囊射线,以原点出去(Distance=长度;RectWide=宽度)")]
  1955. StripRay = AttackShape.StripRay,
  1956. [DescAttribute("胶囊射线,接触到最近(Distance=最大长度;RectWide=宽度)")]
  1957. StripRayTouchEnd = AttackShape.StripRayTouchEnd,
  1958. [DescAttribute("方形条状")]
  1959. RectStrip = CommonAI.Zone.Helper.AttackShape.RectStrip,
  1960. [DescAttribute("方形射线(以原点出去)")]
  1961. RectStripRay = CommonAI.Zone.Helper.AttackShape.RectStripRay,
  1962. [DescAttribute("横向胶囊条状")]
  1963. WideStrip = CommonAI.Zone.Helper.AttackShape.WideStrip,
  1964. [DescAttribute("连线类型(单体攻击),比如激光塔(Distance=判定距离)")]
  1965. LineToTarget = AttackShape.LineToTarget,
  1966. [DescAttribute("连线类型(单体攻击),比如伸出去的钩子(Distance=判定距离)")]
  1967. LineToStart = AttackShape.LineToStart,
  1968. [DescAttribute("圆环,中间是空的(BodySize=外环半径;BodySize-RectWide=内环半径)")]
  1969. Circle = CommonAI.Zone.Helper.AttackShape.Circle,
  1970. }
  1971. public bool IsShapeFan { get { return BodyShape == Shape.Fan; } }
  1972. public bool IsShapeStrip
  1973. {
  1974. get
  1975. {
  1976. switch (BodyShape)
  1977. {
  1978. case Shape.Strip:
  1979. case Shape.StripRay:
  1980. case Shape.StripRayTouchEnd:
  1981. case Shape.Circle:
  1982. case Shape.RectStrip:
  1983. case Shape.RectStripRay:
  1984. case Shape.WideStrip:
  1985. return true;
  1986. }
  1987. return false;
  1988. }
  1989. }
  1990. public bool IsShapeDistance
  1991. {
  1992. get
  1993. {
  1994. switch (BodyShape)
  1995. {
  1996. case Shape.Strip:
  1997. case Shape.StripRay:
  1998. case Shape.StripRayTouchEnd:
  1999. case Shape.LineToTarget:
  2000. case Shape.LineToStart:
  2001. case Shape.RectStrip:
  2002. case Shape.RectStripRay:
  2003. case Shape.WideStrip:
  2004. return true;
  2005. default:
  2006. return false;
  2007. }
  2008. }
  2009. }
  2010. //--------------------------------------------
  2011. [DescAttribute("攻击范围类型", "攻击范围")]
  2012. public Shape BodyShape = Shape.Round;
  2013. [DescAttribute("尺寸,半径(Round, Fan, Circle)", "攻击范围")]
  2014. public float BodySize = 1;
  2015. [DescAttribute("角度(Fan)", "攻击范围")]
  2016. [DependOnProperty("IsShapeFan")]
  2017. public float FanAngle;
  2018. [DescAttribute("宽度,粗度(Strip, StripRay,StripRayTouchEnd,RectStrip, RectStripRay,Circle, WideStrip)", "攻击范围")]
  2019. [DependOnProperty("IsShapeStrip")]
  2020. public float RectWide = 1;
  2021. [DescAttribute("长度(Strip, StripRay,StripRayTouchEnd, RectStrip, RectStripRay,LineToTarget, LineToStart, WideStrip)", "攻击范围")]
  2022. [DependOnProperty("IsShapeDistance")]
  2023. public float Distance = 10;
  2024. //--------------------------------------------
  2025. [DescAttribute("法术自身高度", "攻击范围")]
  2026. public float BodyHeight = 0;
  2027. //--------------------------------------------
  2028. /// <summary>
  2029. /// 运动类型
  2030. /// </summary>
  2031. [DescAttribute("运动类型", "运动")]
  2032. public MotionType MType = MotionType.Straight;
  2033. public bool IsMoveable
  2034. {
  2035. get
  2036. {
  2037. switch (MType)
  2038. {
  2039. case MotionType.Cannon:
  2040. case MotionType.Missile:
  2041. case MotionType.SeekerMissile:
  2042. case MotionType.Straight:
  2043. case MotionType.AOE:
  2044. case MotionType.AOE_Binding:
  2045. case MotionType.AOE_BindingTarget:
  2046. case MotionType.Boomerang1:
  2047. case MotionType.Boomerang2:
  2048. case MotionType.Foxfire:
  2049. case MotionType.StraightAndStop:
  2050. case MotionType.MissileAttackRoute:
  2051. case MotionType.CurveMissile:
  2052. return true;
  2053. }
  2054. return false;
  2055. }
  2056. }
  2057. public bool IsBinding
  2058. {
  2059. get
  2060. {
  2061. switch (MType)
  2062. {
  2063. case MotionType.Binding:
  2064. case MotionType.BindingTarget:
  2065. case MotionType.AOE_Binding:
  2066. case MotionType.AOE_BindingTarget:
  2067. return true;
  2068. }
  2069. return false;
  2070. }
  2071. }
  2072. public bool IsSeekingTarget
  2073. {
  2074. get
  2075. {
  2076. switch (MType)
  2077. {
  2078. case MotionType.SeekerMissile:
  2079. case MotionType.SeekerSelectTarget:
  2080. case MotionType.Foxfire:
  2081. case MotionType.MissileAttackRoute:
  2082. case MotionType.CurveMissile:
  2083. return true;
  2084. }
  2085. return false;
  2086. }
  2087. }
  2088. public bool IsAOE
  2089. {
  2090. get
  2091. {
  2092. switch (MType)
  2093. {
  2094. case MotionType.AOE:
  2095. case MotionType.AOE_Binding:
  2096. case MotionType.AOE_BindingTarget:
  2097. return true;
  2098. }
  2099. return false;
  2100. }
  2101. }
  2102. /// <summary>
  2103. /// 运动速度,AOE或者扩散类,缩放速度
  2104. /// </summary>
  2105. [DescAttribute("运动速度,AOE或者扩散类,缩放速度(距离 / 每秒)", "运动")]
  2106. [DependOnProperty("IsMoveable")]
  2107. public float MSpeedSEC = 15f;
  2108. [DescAttribute("加速度(距离/每秒)(最终速度=速度+加速度)", "运动")]
  2109. [DependOnProperty("IsMoveable")]
  2110. public float MSpeedAdd = 0f;
  2111. [DescAttribute("阻力(每秒递减速度百分比)", "运动")]
  2112. [DependOnProperty("IsMoveable")]
  2113. public float MSpeedAcc = 0f;
  2114. [DescAttribute("最大移动距离", "运动")]
  2115. public float MaxMoveDistance = 0f;
  2116. [DescAttribute("最大限速", "运动")]
  2117. [DependOnProperty("IsMoveable")]
  2118. public float MSpeed_MAX = 100f;
  2119. [DescAttribute("最小限速", "运动")]
  2120. [DependOnProperty("IsMoveable")]
  2121. public float MSpeed_MIN = -100f;
  2122. //--------------------------------------------
  2123. public enum AoeMotionType : byte
  2124. {
  2125. [DescAttribute("线性,递增或递减")]
  2126. Linear = 0,
  2127. [DescAttribute("正弦,单次周期为PI,象限0~1")]
  2128. Sine = 1,
  2129. }
  2130. [DescAttribute("AOE方式", "运动")]
  2131. [DependOnProperty("IsAOE")]
  2132. public AoeMotionType AOEMType = AoeMotionType.Linear;
  2133. //--------------------------------------------
  2134. /// <summary>
  2135. /// 转动速度
  2136. /// </summary>
  2137. [DescAttribute("自转转动速度(距离/每秒)", "运动")]
  2138. public float RotateSpeedSEC;
  2139. [DescAttribute("抛物线高度", "运动")]
  2140. public float ParabolaHeight = 0;
  2141. /// <summary>
  2142. ///
  2143. /// </summary>
  2144. [DescAttribute("暂时只给灵魂出窍的技能使用", "运动")]
  2145. public bool HeightUpdate;
  2146. //--------------------------------------------
  2147. public enum SeekingExpect : byte
  2148. {
  2149. [DescAttribute("搜索随机单位")]
  2150. Random,
  2151. [DescAttribute("搜索最近单位")]
  2152. Nearest,
  2153. [DescAttribute("搜索最远单位")]
  2154. Farthest,
  2155. [DescAttribute("搜索随机单位(忽略链中)")]
  2156. RandomIgnoreInChain,
  2157. [DescAttribute("搜索最近单位(忽略链中)")]
  2158. NearestIgnoreInChain,
  2159. [DescAttribute("搜索最远单位(忽略链中)")]
  2160. FarthestIgnoreInChain,
  2161. }
  2162. //--------------------------------------------
  2163. [DescAttribute("如果是自动搜敌导弹SeekerMissile,则表示搜索范围,如果是LineToTarget则表示伤害距离", "运动-自动跟踪")]
  2164. [DependOnProperty("IsSeekingTarget")]
  2165. public float SeekingRange = 10;
  2166. [DescAttribute("自动锁敌冷却时间(毫秒)", "运动-自动跟踪")]
  2167. [DependOnProperty("IsSeekingTarget")]
  2168. public int SeekingCooldownMS = 1000;
  2169. [DescAttribute("自动锁敌运动时,转角距离", "运动-自动跟踪")]
  2170. [DependOnProperty("IsSeekingTarget")]
  2171. public float SeekingTurningAngleSEC = 3f;
  2172. [DescAttribute("自动锁敌检测方式", "运动-自动跟踪")]
  2173. [DependOnProperty("IsSeekingTarget")]
  2174. public SeekingExpect SeekingExpectTarget = SeekingExpect.Random;
  2175. //--------------------------------------------
  2176. [DescAttribute("如果是绑定则围绕绑定者公转", "运动-绑定")]
  2177. [DependOnProperty("IsBinding")]
  2178. public bool IsBindingOrbit = false;
  2179. [DescAttribute("绑定公转距离", "运动-绑定")]
  2180. [DependOnProperty("IsBinding")]
  2181. public float OrbitDistance;
  2182. [DescAttribute("如果为绑定,是否绑定方向", "运动-绑定")]
  2183. [DependOnProperty("IsBinding")]
  2184. public bool IsBindingDirection = false;
  2185. //--------------------------------------------
  2186. //--------------------------------------------
  2187. [DescAttribute("最大影响(受击)单位,0表示无限制")]
  2188. public int MaxAffectUnit = 0;
  2189. //--------------------------------------------
  2190. /// <summary>
  2191. /// 击中就消失
  2192. /// </summary>
  2193. [DescAttribute("击中就消失(爆炸),和HitIntervalMS冲突", "关键帧")]
  2194. public bool HitOnExplosion;
  2195. [DescAttribute("击中就消失(爆炸)关键帧,适用于打到就爆和Cannon类法术", "关键帧")]
  2196. [DependOnProperty("HitOnExplosion")]
  2197. public KeyFrame HitOnExplosionKeyFrame;
  2198. /// <summary>
  2199. /// 每间隔多少帧就触发一次,0代表只造成一次伤害或效果
  2200. /// </summary>
  2201. [DescAttribute("每间隔多少时间就触发一次,0 适用于穿透性,但只对单位造成一次伤害(毫秒)", "关键帧")]
  2202. public int HitIntervalMS;
  2203. [DescAttribute("只造成一次触发的关键帧 or 每隔一段时间触发的关键帧", "关键帧")]
  2204. public KeyFrame HitIntervalKeyFrame;
  2205. /// <summary>
  2206. /// 按顺序触发的所有关键帧
  2207. /// </summary>
  2208. [ListAttribute(typeof(KeyFrame))]
  2209. [DescAttribute("按顺序触发的所有关键帧", "关键帧")]
  2210. public List<KeyFrame> KeyFrames = new List<KeyFrame>();
  2211. //--------------------------------------------
  2212. /// <summary>
  2213. /// 模型名字或者Perfab名字
  2214. /// </summary>
  2215. [DescAttribute("模型名字或者Perfab名字", "资源")]
  2216. [ResourceIDAttribute]
  2217. public string FileName;
  2218. [DescAttribute("模型名字或者Perfab名字(起始)", "资源")]
  2219. [ResourceIDAttribute]
  2220. public string FileNameSpawn;
  2221. [DescAttribute("模型名字或者Perfab名字(结束)", "资源")]
  2222. [ResourceIDAttribute]
  2223. public string FileNameDestory;
  2224. [DescAttribute("是否循环播放动画", "资源")]
  2225. public bool IsCycAnim = true;
  2226. [DescAttribute("缩放比率", "资源")]
  2227. public float FileBodyScale = 1;
  2228. [DescAttribute("法术释放时,在目标点释放特效,可作为技能提示", "特效")]
  2229. public LaunchEffect TargetEffect;
  2230. [DescAttribute("法术期望作用目标", "目标")]
  2231. public SkillTemplate.CastTarget ExpectTarget = SkillTemplate.CastTarget.Enemy;
  2232. //------------------------------------
  2233. [DescAttribute("绑定目标不可操控时移除自己", "移除条件")]
  2234. public bool RemoveOnBindingUncontrollable = false;
  2235. [DescAttribute("绑定目标非技能状态时移除自己", "移除条件")]
  2236. public bool RemoveOnBindingSkillOver = false;
  2237. [DescAttribute("当Spell被移除停止释放它的技能", "移除条件")]
  2238. public bool StopBindingSkillOnRemoved = false;
  2239. //------------------------------------
  2240. //--------------------------------------------
  2241. public enum SpecialAdditionalEffect : byte
  2242. {
  2243. [DescAttribute("无")]
  2244. None = 0,
  2245. [DescAttribute("黑洞效果,牵引碰到的怪物")]
  2246. DarkHole = 1,
  2247. [DescAttribute("路径牵引效果")]
  2248. DragPath = 2,
  2249. }
  2250. public bool IsCanAddSpecialEffect
  2251. {
  2252. get
  2253. {
  2254. switch (MType)
  2255. {
  2256. case MotionType.Missile:
  2257. case MotionType.SeekerMissile:
  2258. case MotionType.Cannon:
  2259. case MotionType.Chain:
  2260. case MotionType.Boomerang1:
  2261. case MotionType.Boomerang2:
  2262. case MotionType.MissileAttackRoute:
  2263. case MotionType.CurveMissile:
  2264. return false;
  2265. }
  2266. return true;
  2267. }
  2268. }
  2269. [DescAttribute("法术的特殊效果", "特殊效果")]
  2270. [DependOnProperty("IsCanAddSpecialEffect")]
  2271. public SpecialAdditionalEffect SpecialEffect = SpecialAdditionalEffect.None;
  2272. [DescAttribute("特殊效果参数(黑洞的牵引速度)", "特殊效果")]
  2273. [DependOnProperty("IsCanAddSpecialEffect")]
  2274. public float SpecialEffectParam = 0;
  2275. // --
  2276. [DescAttribute("飞行时间(毫秒)", "运动(回旋路径, 滞空)")]
  2277. //[DependOnProperty("IsBoomerang")]
  2278. public int BoomerangFlyTime = 1000;
  2279. [DescAttribute("滞空时间(毫秒)", "运动(回旋路径, 滞空)")]
  2280. //[DependOnProperty("IsBoomerang")]
  2281. public int BoomerangHangtime = 1000;
  2282. public bool IsBoomerang
  2283. {
  2284. get
  2285. {
  2286. return MType == MotionType.Boomerang1 || MType == MotionType.Boomerang2;
  2287. }
  2288. }
  2289. /// <summary>
  2290. /// 用户自定义扩展属性
  2291. /// </summary>
  2292. [DescAttribute("扩展属性", "扩展")]
  2293. [Expandable]
  2294. [NotNull]
  2295. public ISpellProperties Properties = TemplateManager.Factory.CreateSpellProperties();
  2296. //------------------------------------
  2297. [DescAttribute("速度(原始动画/特效速度 * 速度)", "特效加速")]
  2298. public float EffectAddSpeed = 1;
  2299. [DescAttribute("特效中存在的动画,动画的名字", "特效加速")]
  2300. public string AnimtionName;
  2301. [DescAttribute("音效文件名", "音效")]
  2302. public string AudioName;
  2303. [DescAttribute("音效文件是否循环", "音效")]
  2304. public bool IsAudioLoop;
  2305. public SpellTemplate() { }
  2306. public int GetID()
  2307. {
  2308. return ID;
  2309. }
  2310. public override string ToString()
  2311. {
  2312. return Name + "(" + ID + ")";
  2313. }
  2314. public object Clone()
  2315. {
  2316. SpellTemplate ret = new SpellTemplate();
  2317. ret.EditorPath = this.EditorPath;
  2318. ret.ID = this.ID;
  2319. ret.Name = this.Name;
  2320. ret.LifeTimeMS = this.LifeTimeMS;
  2321. ret.ClientVisible = this.ClientVisible;
  2322. ret.BodyShape = this.BodyShape;
  2323. ret.BodySize = this.BodySize;
  2324. ret.FanAngle = this.FanAngle;
  2325. ret.RectWide = this.RectWide;
  2326. ret.BodyHeight = this.BodyHeight;
  2327. ret.Distance = this.Distance;
  2328. ret.MType = this.MType;
  2329. ret.MSpeedSEC = this.MSpeedSEC;
  2330. ret.MSpeedAdd = this.MSpeedAdd;
  2331. ret.MSpeedAcc = this.MSpeedAcc;
  2332. ret.MaxMoveDistance = this.MaxMoveDistance;
  2333. ret.MSpeed_MAX = this.MSpeed_MAX;
  2334. ret.MSpeed_MIN = this.MSpeed_MIN;
  2335. ret.RotateSpeedSEC = this.RotateSpeedSEC;
  2336. ret.ParabolaHeight = this.ParabolaHeight;
  2337. ret.HeightUpdate = this.HeightUpdate;
  2338. ret.AOEMType = this.AOEMType;
  2339. ret.SeekingRange = this.SeekingRange;
  2340. ret.SeekingCooldownMS = this.SeekingCooldownMS;
  2341. ret.SeekingTurningAngleSEC = this.SeekingTurningAngleSEC;
  2342. ret.SeekingExpectTarget = this.SeekingExpectTarget;
  2343. ret.MaxAffectUnit = this.MaxAffectUnit;
  2344. ret.IsBindingOrbit = this.IsBindingOrbit;
  2345. ret.OrbitDistance = this.OrbitDistance;
  2346. ret.IsBindingDirection = this.IsBindingDirection;
  2347. ret.HitOnExplosion = this.HitOnExplosion;
  2348. ret.HitOnExplosionKeyFrame = CUtils.TryClone<KeyFrame>(this.HitOnExplosionKeyFrame);
  2349. ret.HitIntervalMS = this.HitIntervalMS;
  2350. ret.HitIntervalKeyFrame = CUtils.TryClone<KeyFrame>(this.HitIntervalKeyFrame);
  2351. ret.KeyFrames = CUtils.CloneList<KeyFrame>(this.KeyFrames);
  2352. ret.FileName = this.FileName;
  2353. ret.FileNameSpawn = this.FileNameSpawn;
  2354. ret.FileNameDestory = this.FileNameDestory;
  2355. ret.IsCycAnim = this.IsCycAnim;
  2356. ret.FileBodyScale = this.FileBodyScale;
  2357. ret.TargetEffect = CUtils.TryClone<LaunchEffect>(this.TargetEffect);
  2358. ret.ExpectTarget = this.ExpectTarget;
  2359. ret.RemoveOnBindingUncontrollable = this.RemoveOnBindingUncontrollable;
  2360. ret.RemoveOnBindingSkillOver = this.RemoveOnBindingSkillOver;
  2361. ret.StopBindingSkillOnRemoved = this.StopBindingSkillOnRemoved;
  2362. ret.Properties = CUtils.TryClone<ISpellProperties>(this.Properties);
  2363. ret.SpecialEffect = this.SpecialEffect;
  2364. ret.SpecialEffectParam = this.SpecialEffectParam;
  2365. ret.BoomerangFlyTime = this.BoomerangFlyTime;
  2366. ret.BoomerangHangtime = this.BoomerangHangtime;
  2367. ret.EffectAddSpeed = this.EffectAddSpeed;
  2368. ret.AnimtionName = this.AnimtionName;
  2369. ret.AudioName = this.AudioName;
  2370. ret.IsAudioLoop = this.IsAudioLoop;
  2371. return ret;
  2372. }
  2373. public void WriteExternal(IOutputStream output)
  2374. {
  2375. output.PutUTF(this.EditorPath);
  2376. output.PutS32(this.ID);
  2377. output.PutUTF(this.Name);
  2378. output.PutS32(this.LifeTimeMS);
  2379. output.PutBool(this.ClientVisible);
  2380. output.PutEnum8(this.BodyShape);
  2381. output.PutF32(this.BodySize);
  2382. output.PutF32(this.FanAngle);
  2383. output.PutF32(this.RectWide);
  2384. output.PutF32(this.BodyHeight);
  2385. output.PutF32(this.Distance);
  2386. output.PutEnum8(this.MType);
  2387. output.PutF32(this.MSpeedSEC);
  2388. output.PutF32(this.MSpeedAdd);
  2389. output.PutF32(this.MSpeedAcc);
  2390. output.PutF32(this.MaxMoveDistance);
  2391. output.PutF32(this.MSpeed_MAX);
  2392. output.PutF32(this.MSpeed_MIN);
  2393. output.PutF32(this.RotateSpeedSEC);
  2394. output.PutF32(this.ParabolaHeight);
  2395. output.PutBool(this.HeightUpdate);
  2396. output.PutEnum8(this.AOEMType);
  2397. output.PutF32(this.SeekingRange);
  2398. output.PutS32(this.SeekingCooldownMS);
  2399. output.PutF32(this.SeekingTurningAngleSEC);
  2400. output.PutEnum8(this.SeekingExpectTarget);
  2401. output.PutS32(this.MaxAffectUnit);
  2402. output.PutBool(this.IsBindingOrbit);
  2403. output.PutF32(this.OrbitDistance);
  2404. output.PutBool(this.IsBindingDirection);
  2405. output.PutBool(this.HitOnExplosion);
  2406. output.PutExt(this.HitOnExplosionKeyFrame);
  2407. output.PutS32(this.HitIntervalMS);
  2408. output.PutExt(this.HitIntervalKeyFrame);
  2409. output.PutList<KeyFrame>(this.KeyFrames, output.PutExt);
  2410. output.PutUTF(this.FileName);
  2411. output.PutUTF(this.FileNameSpawn);
  2412. output.PutUTF(this.FileNameDestory);
  2413. output.PutBool(this.IsCycAnim);
  2414. output.PutF32(this.FileBodyScale);
  2415. output.PutExt(this.TargetEffect);
  2416. output.PutEnum8(this.ExpectTarget);
  2417. output.PutBool(this.RemoveOnBindingUncontrollable);
  2418. output.PutBool(this.RemoveOnBindingSkillOver);
  2419. output.PutBool(this.StopBindingSkillOnRemoved);
  2420. output.PutExt(this.Properties);
  2421. output.PutEnum8(this.SpecialEffect);
  2422. output.PutF32(this.SpecialEffectParam);
  2423. output.PutS32(this.BoomerangFlyTime);
  2424. output.PutS32(this.BoomerangHangtime);
  2425. output.PutF32(this.EffectAddSpeed);
  2426. output.PutUTF(this.AnimtionName);
  2427. output.PutUTF(this.AudioName);
  2428. output.PutBool(this.IsAudioLoop);
  2429. }
  2430. public void ReadExternal(IInputStream input)
  2431. {
  2432. this.EditorPath = input.GetUTF();
  2433. this.ID = input.GetS32();
  2434. this.Name = input.GetUTF();
  2435. this.LifeTimeMS = input.GetS32();
  2436. this.ClientVisible = input.GetBool();
  2437. this.BodyShape = input.GetEnum8<Shape>();
  2438. this.BodySize = input.GetF32();
  2439. this.FanAngle = input.GetF32();
  2440. this.RectWide = input.GetF32();
  2441. this.BodyHeight = input.GetF32();
  2442. this.Distance = input.GetF32();
  2443. this.MType = input.GetEnum8<MotionType>();
  2444. this.MSpeedSEC = input.GetF32();
  2445. this.MSpeedAdd = input.GetF32();
  2446. this.MSpeedAcc = input.GetF32();
  2447. this.MaxMoveDistance = input.GetF32();
  2448. this.MSpeed_MAX = input.GetF32();
  2449. this.MSpeed_MIN = input.GetF32();
  2450. this.RotateSpeedSEC = input.GetF32();
  2451. this.ParabolaHeight = input.GetF32();
  2452. this.HeightUpdate = input.GetBool();
  2453. this.AOEMType = input.GetEnum8<AoeMotionType>();
  2454. this.SeekingRange = input.GetF32();
  2455. this.SeekingCooldownMS = input.GetS32();
  2456. this.SeekingTurningAngleSEC = input.GetF32();
  2457. this.SeekingExpectTarget = input.GetEnum8<SeekingExpect>();
  2458. this.MaxAffectUnit = input.GetS32();
  2459. this.IsBindingOrbit = input.GetBool();
  2460. this.OrbitDistance = input.GetF32();
  2461. this.IsBindingDirection = input.GetBool();
  2462. this.HitOnExplosion = input.GetBool();
  2463. this.HitOnExplosionKeyFrame = input.GetExt<KeyFrame>();
  2464. this.HitIntervalMS = input.GetS32();
  2465. this.HitIntervalKeyFrame = input.GetExt<KeyFrame>();
  2466. this.KeyFrames = input.GetList<KeyFrame>(input.GetExt<KeyFrame>);
  2467. this.FileName = input.GetUTF();
  2468. this.FileNameSpawn = input.GetUTF();
  2469. this.FileNameDestory = input.GetUTF();
  2470. this.IsCycAnim = input.GetBool();
  2471. this.FileBodyScale = input.GetF32();
  2472. this.TargetEffect = input.GetExt<LaunchEffect>();
  2473. this.ExpectTarget = input.GetEnum8<SkillTemplate.CastTarget>();
  2474. this.RemoveOnBindingUncontrollable = input.GetBool();
  2475. this.RemoveOnBindingSkillOver = input.GetBool();
  2476. this.StopBindingSkillOnRemoved = input.GetBool();
  2477. this.Properties = input.GetExt<ISpellProperties>(this.Properties);
  2478. this.SpecialEffect = input.GetEnum8<SpecialAdditionalEffect>();
  2479. this.SpecialEffectParam = input.GetF32();
  2480. this.BoomerangFlyTime = input.GetS32();
  2481. this.BoomerangHangtime = input.GetS32();
  2482. this.EffectAddSpeed = input.GetF32();
  2483. this.AnimtionName = input.GetUTF();
  2484. this.AudioName = input.GetUTF();
  2485. this.IsAudioLoop = input.GetBool();
  2486. }
  2487. //------------------------------------------------------------
  2488. //------------------------------------------------------------
  2489. /// <summary>
  2490. /// 法术伤害或特效关键帧
  2491. /// </summary>
  2492. [MessageType(0x4105)]
  2493. [DescAttribute("法术伤害或特效关键帧")]
  2494. [Expandable]
  2495. public class KeyFrame : BaseKeyFrame, ICloneable, IExternalizable
  2496. {
  2497. /// <summary>
  2498. /// 触发的特效
  2499. /// </summary>
  2500. [DescAttribute("触发的特效")]
  2501. public LaunchEffect Effect;
  2502. /// <summary>
  2503. /// 触发新的法术
  2504. /// </summary>
  2505. [DescAttribute("触发新的法术")]
  2506. public LaunchSpell Spell;
  2507. /// <summary>
  2508. /// 攻击伤害
  2509. /// </summary>
  2510. [DescAttribute("攻击伤害")]
  2511. public AttackProp Attack;
  2512. /// <summary>
  2513. /// 召唤小弟
  2514. /// </summary>
  2515. [DescAttribute("召唤小弟")]
  2516. public SummonUnit Summon;
  2517. public KeyFrame() { }
  2518. public override string ToString()
  2519. {
  2520. if (Spell == null)
  2521. {
  2522. return "Frame: @" + FrameMS;
  2523. }
  2524. return "Frame: @" + FrameMS + ", " + Spell.ToString();
  2525. }
  2526. public object Clone()
  2527. {
  2528. KeyFrame ret = new KeyFrame();
  2529. ret.FrameMS = this.FrameMS;
  2530. ret.Spell = CUtils.TryClone<LaunchSpell>(this.Spell);
  2531. ret.Effect = CUtils.TryClone<LaunchEffect>(this.Effect);
  2532. ret.Attack = CUtils.TryClone<AttackProp>(this.Attack);
  2533. ret.Summon = CUtils.TryClone<SummonUnit>(this.Summon);
  2534. return ret;
  2535. }
  2536. public void WriteExternal(IOutputStream output)
  2537. {
  2538. output.PutS32(base.FrameMS);
  2539. output.PutExt(this.Spell);
  2540. output.PutExt(this.Effect);
  2541. output.PutExt(this.Attack);
  2542. output.PutExt(this.Summon);
  2543. }
  2544. public void ReadExternal(IInputStream input)
  2545. {
  2546. base.FrameMS = input.GetS32();
  2547. this.Spell = input.GetExt<LaunchSpell>();
  2548. this.Effect = input.GetExt<LaunchEffect>();
  2549. this.Attack = input.GetExt<AttackProp>();
  2550. this.Summon = input.GetExt<SummonUnit>();
  2551. }
  2552. }
  2553. }
  2554. //---------------------------------------------------------------------------------//
  2555. /// <summary>
  2556. /// BUFF类数据结构
  2557. /// </summary>
  2558. [MessageType(0x4006)]
  2559. [DescAttribute("BUFF类数据结构")]
  2560. [TableClassAttribute("ID")]
  2561. public class BuffTemplate : ICloneable, ITemplateData, IExternalizable
  2562. {
  2563. public int TemplateID { get { return ID; } }
  2564. [XmlSerializable()]
  2565. public string EditorPath { get; set; }
  2566. [DescAttribute("ID", "", false)]
  2567. public int ID;
  2568. [LocalizationTextAttribute]
  2569. [DescAttribute("Buff名字")]
  2570. public string Name;
  2571. [DescAttribute("技能图标", "资源")]
  2572. public string IconName;
  2573. [DescAttribute("需要同步客户端")]
  2574. public bool ClientVisible = true;
  2575. [DescAttribute("生命周期(毫秒)")]
  2576. public int LifeTimeMS;
  2577. //--------------------------------------------------------------
  2578. [DescAttribute("每间隔多少毫秒就触发一次", "关键帧")]
  2579. public int HitIntervalMS;
  2580. [DescAttribute("第0帧是否有效", "关键帧")]
  2581. public bool FirstTimeEnable = true;
  2582. [DescAttribute("每间隔时间触发一次的时候起效", "关键帧")]
  2583. public KeyFrame HitKeyFrame;
  2584. [ListAttribute(typeof(KeyFrame))]
  2585. [DescAttribute("所有关键帧", "关键帧")]
  2586. public List<KeyFrame> KeyFrames = new List<KeyFrame>();
  2587. [DescAttribute("Buff结束关键帧", "关键帧")]
  2588. public KeyFrame EndKeyFrame;
  2589. //--------------------------------------------------------------
  2590. [DescAttribute("是否有害(Debuff),否则为有益(Buff)", "BUFF")]
  2591. public bool IsHarmful = false;
  2592. [DescAttribute("Buff是否可以主动取消", "BUFF")]
  2593. public bool IsCancelBySelf = false;
  2594. [DescAttribute("Buff是否允许多个实例", "BUFF")]
  2595. public bool IsDuplicating = false;
  2596. [DescAttribute("Buff施放者死亡立即移除", "BUFF")]
  2597. public bool IsRemoveOnSenderRemoved = true;
  2598. [DescAttribute("死亡立即移除", "BUFF")]
  2599. public bool IsRemoveOnDead = false;
  2600. //--------------------------------------------------------------
  2601. [DescAttribute("BUFF期间,强制单位进入BUFF特殊动作(即不会被其他动作打断)", "状态")]
  2602. public string LockStateAction;
  2603. [DescAttribute("是否隐身", "状态")]
  2604. public bool IsInvisible = false;
  2605. [DescAttribute("是否无敌", "状态")]
  2606. public bool IsInvincible = false;
  2607. [DescAttribute("是否沉默(只能释放BaseSkill)", "状态")]
  2608. public bool IsSilent = false;
  2609. [DescAttribute("是否沉默允许移动", "状态")]
  2610. public bool IsCanMove = true;
  2611. [DescAttribute("产生眩晕", "状态")]
  2612. public bool MakeStun = false;
  2613. [DescAttribute("免疫控制", "状态")]
  2614. public bool IgnoreControl = false;
  2615. [DescAttribute("单位被动触发系,一直绑定关系", "状态")]
  2616. public LaunchTrigger UnitTrigger;
  2617. //--------------------------------------------------------------
  2618. [DescAttribute("允许变身", "变身 - 造型")]
  2619. public bool MakeAvatar = false;
  2620. [DescAttribute("单位变身的模型文件名", "变身 - 造型")]
  2621. [ResourceIDAttribute]
  2622. [DependOnProperty("MakeAvatar")]
  2623. public string UnitFileName;
  2624. //--------------------------------------------------------------
  2625. [DescAttribute("允许改变技能", "变身 - 技能")]
  2626. public bool UnitChangeSkills = false;
  2627. [DescAttribute("此单位变身普通攻击技能", "变身 - 技能")]
  2628. [DependOnProperty("UnitChangeSkills")]
  2629. public LaunchSkill UnitBaseSkillID;
  2630. [ListAttribute(typeof(LaunchSkill))]
  2631. [DescAttribute("此单位变身绑定的所有技能ID", "变身 - 技能")]
  2632. [DependOnProperty("UnitChangeSkills")]
  2633. public List<LaunchSkill> UnitSkills = new List<LaunchSkill>();
  2634. [DescAttribute("变身改变技能时,保留的技能ID", "变身 - 技能")]
  2635. [TemplatesIDAttribute(typeof(SkillTemplate))]
  2636. [DependOnProperty("UnitChangeSkills")]
  2637. public List<int> UnitKeepSkillsID = new List<int>();
  2638. //--------------------------------------------------------------
  2639. //--------------------------------------------------------------
  2640. [DescAttribute("是否可堆叠层数", "堆叠")]
  2641. public bool IsOverlay = false;
  2642. [DescAttribute("最高可堆叠层数", "堆叠")]
  2643. [DependOnProperty("IsOverlay")]
  2644. public byte MaxOverlay = 1;
  2645. [DescAttribute("是否为被动系,则不显示在面板")]
  2646. public bool IsPassive = false;
  2647. public enum BindingPlayType : byte
  2648. {
  2649. [DescAttribute("一次性全部播放,配置多少,播放多少")]
  2650. All = 0,
  2651. [DescAttribute("根据层数去播放,那一层播放那一个")]
  2652. AppointOverLayer = 1,
  2653. [DescAttribute("包含层数,如果层数是2,会同时播放1和2的特效")]
  2654. IncludeOverLayer = 2,
  2655. }
  2656. [DescAttribute("BindingEffectList的播放模式(客户端用)", "特效")]
  2657. public BindingPlayType PlayType = BindingPlayType.All;
  2658. [DescAttribute("BUFF期间绑定特效(客户端用)", "特效")]
  2659. public LaunchEffect BindingEffect;
  2660. [ListAttribute(typeof(LaunchEffect))]
  2661. [DescAttribute("BUFF期间绑定特效集合(客户端用)", "特效")]
  2662. public List<LaunchEffect> BindingEffectList = new List<LaunchEffect>();
  2663. [ListAttribute(typeof(LaunchEffect))]
  2664. [DescAttribute("BUFF期间每层绑定特效(每层对应一个特效,客户端用)", "特效")]
  2665. [DependOnProperty("IsOverlay")]
  2666. public List<LaunchEffect> OverlayBindingEffect = new List<LaunchEffect>();
  2667. //--------------------------------------------------------------
  2668. [DescAttribute("互斥类型,同类型不能出现两个(非0有效)", "互斥")]
  2669. public int ExclusiveCatgory;
  2670. [DescAttribute("互斥优先级,如果优先级相等,则替换", "互斥")]
  2671. public int ExclusivePriority;
  2672. //--------------------------------------------------------------
  2673. [DescAttribute("Buff用户自定义扩展属性", "扩展")]
  2674. [Expandable]
  2675. [NotNull]
  2676. public IBuffProperties Properties;
  2677. [DescAttribute("自定义字段", "属性", true)]
  2678. public string[] Attributes;
  2679. //内部使用的一些字段,
  2680. [DescAttribute("强制加,跳过boss免控限制", "属性", true)]
  2681. public bool forceAdd;
  2682. public BuffTemplate()
  2683. {
  2684. this.Properties = TemplateManager.Factory.CreateBuffProperties();
  2685. }
  2686. public int GetID()
  2687. {
  2688. return ID;
  2689. }
  2690. public override string ToString()
  2691. {
  2692. return Name + "(" + ID + ")";
  2693. }
  2694. public object Clone()
  2695. {
  2696. BuffTemplate ret = new BuffTemplate();
  2697. ret.EditorPath = this.EditorPath;
  2698. ret.ID = this.ID;
  2699. ret.Name = this.Name;
  2700. ret.IconName = this.IconName;
  2701. ret.ClientVisible = this.ClientVisible;
  2702. ret.LifeTimeMS = this.LifeTimeMS;
  2703. ret.HitIntervalMS = this.HitIntervalMS;
  2704. ret.FirstTimeEnable = this.FirstTimeEnable;
  2705. ret.HitKeyFrame = CUtils.TryClone<KeyFrame>(this.HitKeyFrame);
  2706. ret.KeyFrames = CUtils.CloneList<KeyFrame>(this.KeyFrames);
  2707. ret.IsHarmful = this.IsHarmful;
  2708. ret.IsCancelBySelf = this.IsCancelBySelf;
  2709. ret.IsDuplicating = this.IsDuplicating;
  2710. ret.EndKeyFrame = CUtils.TryClone<KeyFrame>(this.EndKeyFrame);
  2711. ret.IsInvisible = this.IsInvisible;
  2712. ret.IsInvincible = this.IsInvincible;
  2713. ret.IsSilent = this.IsSilent;
  2714. ret.IsCanMove = this.IsCanMove;
  2715. ret.MakeStun = this.MakeStun;
  2716. ret.IgnoreControl = this.IgnoreControl;
  2717. ret.IsRemoveOnSenderRemoved = this.IsRemoveOnSenderRemoved;
  2718. ret.IsRemoveOnDead = this.IsRemoveOnDead;
  2719. ret.LockStateAction = this.LockStateAction;
  2720. ret.UnitTrigger = CUtils.TryClone<LaunchTrigger>(this.UnitTrigger);
  2721. ret.MakeAvatar = this.MakeAvatar;
  2722. ret.UnitFileName = this.UnitFileName;
  2723. ret.UnitChangeSkills = this.UnitChangeSkills;
  2724. ret.UnitBaseSkillID = CUtils.TryClone<LaunchSkill>(this.UnitBaseSkillID);
  2725. ret.UnitSkills = CUtils.CloneList<LaunchSkill>(this.UnitSkills);
  2726. ret.UnitKeepSkillsID = new List<int>(this.UnitKeepSkillsID);
  2727. ret.IsOverlay = this.IsOverlay;
  2728. ret.MaxOverlay = this.MaxOverlay;
  2729. ret.IsPassive = this.IsPassive;
  2730. ret.BindingEffect = CUtils.TryClone<LaunchEffect>(this.BindingEffect);
  2731. ret.PlayType = this.PlayType;
  2732. ret.BindingEffectList = CUtils.CloneList<LaunchEffect>(this.BindingEffectList);
  2733. ret.OverlayBindingEffect = CUtils.CloneList<LaunchEffect>(this.OverlayBindingEffect);
  2734. ret.ExclusiveCatgory = this.ExclusiveCatgory;
  2735. ret.ExclusivePriority = this.ExclusivePriority;
  2736. ret.Properties = CUtils.TryClone<IBuffProperties>(this.Properties);
  2737. ret.Attributes = CUtils.CloneArray<string>(this.Attributes);
  2738. ret.forceAdd = this.forceAdd;
  2739. return ret;
  2740. }
  2741. public void WriteExternal(IOutputStream output)
  2742. {
  2743. output.PutUTF(this.EditorPath);
  2744. output.PutS32(this.ID);
  2745. output.PutUTF(this.Name);
  2746. output.PutUTF(this.IconName);
  2747. output.PutS32(this.LifeTimeMS);
  2748. output.PutBool(this.ClientVisible);
  2749. output.PutS32(this.HitIntervalMS);
  2750. output.PutBool(this.FirstTimeEnable);
  2751. output.PutExt(this.HitKeyFrame);
  2752. output.PutList(this.KeyFrames, output.PutExt);
  2753. output.PutExt(this.EndKeyFrame);
  2754. output.PutBool(this.IsHarmful);
  2755. output.PutBool(this.IsCancelBySelf);
  2756. output.PutBool(this.IsDuplicating);
  2757. output.PutBool(this.IsInvisible);
  2758. output.PutBool(this.IsInvincible);
  2759. output.PutBool(this.IsSilent);
  2760. output.PutBool(this.IsCanMove);
  2761. output.PutBool(this.MakeStun);
  2762. output.PutBool(this.IgnoreControl);
  2763. output.PutBool(this.IsRemoveOnSenderRemoved);
  2764. output.PutBool(this.IsRemoveOnDead);
  2765. output.PutUTF(this.LockStateAction);
  2766. output.PutExt(this.UnitTrigger);
  2767. output.PutBool(this.MakeAvatar);
  2768. output.PutUTF(this.UnitFileName);
  2769. output.PutBool(this.UnitChangeSkills);
  2770. output.PutExt(this.UnitBaseSkillID);
  2771. output.PutList(this.UnitSkills, output.PutExt);
  2772. output.PutList(this.UnitKeepSkillsID, output.PutS32);
  2773. output.PutBool(this.IsOverlay);
  2774. output.PutU8(this.MaxOverlay);
  2775. output.PutBool(this.IsPassive);
  2776. output.PutExt(this.BindingEffect);
  2777. output.PutEnum8(this.PlayType);
  2778. output.PutList(this.BindingEffectList, output.PutExt);
  2779. output.PutList(this.OverlayBindingEffect, output.PutExt);
  2780. output.PutS32(this.ExclusiveCatgory);
  2781. output.PutS32(this.ExclusivePriority);
  2782. output.PutExt(this.Properties);
  2783. output.PutArray(this.Attributes, output.PutUTF);
  2784. output.PutBool(this.forceAdd);
  2785. }
  2786. public void ReadExternal(IInputStream input)
  2787. {
  2788. this.EditorPath = input.GetUTF();
  2789. this.ID = input.GetS32();
  2790. this.Name = input.GetUTF();
  2791. this.IconName = input.GetUTF();
  2792. this.LifeTimeMS = input.GetS32();
  2793. this.ClientVisible = input.GetBool();
  2794. this.HitIntervalMS = input.GetS32();
  2795. this.FirstTimeEnable = input.GetBool();
  2796. this.HitKeyFrame = input.GetExt<KeyFrame>();
  2797. this.KeyFrames = input.GetList<KeyFrame>(input.GetExt<KeyFrame>);
  2798. this.EndKeyFrame = input.GetExt<KeyFrame>();
  2799. this.IsHarmful = input.GetBool();
  2800. this.IsCancelBySelf = input.GetBool();
  2801. this.IsDuplicating = input.GetBool();
  2802. this.IsInvisible = input.GetBool();
  2803. this.IsInvincible = input.GetBool();
  2804. this.IsSilent = input.GetBool();
  2805. this.IsCanMove = input.GetBool();
  2806. this.MakeStun = input.GetBool();
  2807. this.IgnoreControl = input.GetBool();
  2808. this.IsRemoveOnSenderRemoved = input.GetBool();
  2809. this.IsRemoveOnDead = input.GetBool();
  2810. this.LockStateAction = input.GetUTF();
  2811. this.UnitTrigger = input.GetExt<LaunchTrigger>();
  2812. this.MakeAvatar = input.GetBool();
  2813. this.UnitFileName = input.GetUTF();
  2814. this.UnitChangeSkills = input.GetBool();
  2815. this.UnitBaseSkillID = input.GetExt<LaunchSkill>();
  2816. this.UnitSkills = input.GetList<LaunchSkill>(input.GetExt<LaunchSkill>);
  2817. this.UnitKeepSkillsID = input.GetList<int>(input.GetS32);
  2818. this.IsOverlay = input.GetBool();
  2819. this.MaxOverlay = input.GetU8();
  2820. this.IsPassive = input.GetBool();
  2821. this.BindingEffect = input.GetExt<LaunchEffect>();
  2822. this.PlayType = input.GetEnum8<BindingPlayType>();
  2823. this.BindingEffectList = input.GetList<LaunchEffect>(input.GetExt<LaunchEffect>);
  2824. this.OverlayBindingEffect = input.GetList<LaunchEffect>(input.GetExt<LaunchEffect>);
  2825. this.ExclusiveCatgory = input.GetS32();
  2826. this.ExclusivePriority = input.GetS32();
  2827. this.Properties = input.GetExt<IBuffProperties>(this.Properties);
  2828. this.Attributes = input.GetUTFArray();
  2829. this.forceAdd = input.GetBool();
  2830. }
  2831. //--------------------------------------------
  2832. //--------------------------------------------
  2833. /// <summary>
  2834. /// BUFF伤害或特效关键帧
  2835. /// </summary>
  2836. [MessageType(0x4106)]
  2837. [DescAttribute("BUFF伤害或特效关键帧")]
  2838. [Expandable]
  2839. public class KeyFrame : BaseKeyFrame, ICloneable, IExternalizable
  2840. {
  2841. /// <summary>
  2842. /// 触发的特效
  2843. /// </summary>
  2844. [DescAttribute("触发的特效")]
  2845. public LaunchEffect Effect;
  2846. /// <summary>
  2847. /// 触发新的法术
  2848. /// </summary>
  2849. [DescAttribute("触发新的法术")]
  2850. public LaunchSpell Spell;
  2851. /// <summary>
  2852. /// 攻击伤害
  2853. /// </summary>
  2854. [DescAttribute("攻击伤害")]
  2855. public AttackProp Attack;
  2856. /// <summary>
  2857. /// 直接使用道具
  2858. /// </summary>
  2859. [DescAttribute("直接使用道具")]
  2860. public UseItem Item;
  2861. /// <summary>
  2862. /// 直接使用道具
  2863. /// </summary>
  2864. [DescAttribute("场景添加道具")]
  2865. public BuffAddItem addItem;
  2866. public KeyFrame() { }
  2867. public override string ToString()
  2868. {
  2869. return "Frame: @" + FrameMS;
  2870. }
  2871. public object Clone()
  2872. {
  2873. KeyFrame ret = new KeyFrame();
  2874. ret.FrameMS = this.FrameMS;
  2875. ret.Spell = CUtils.TryClone<LaunchSpell>(this.Spell);
  2876. ret.Effect = CUtils.TryClone<LaunchEffect>(this.Effect);
  2877. ret.Attack = CUtils.TryClone<AttackProp>(this.Attack);
  2878. ret.Item = CUtils.TryClone<UseItem>(this.Item);
  2879. ret.addItem = CUtils.TryClone<BuffAddItem>(this.addItem);
  2880. return ret;
  2881. }
  2882. public void WriteExternal(IOutputStream output)
  2883. {
  2884. output.PutS32(base.FrameMS);
  2885. output.PutExt(this.Spell);
  2886. output.PutExt(this.Effect);
  2887. output.PutExt(this.Attack);
  2888. output.PutExt(this.Item);
  2889. output.PutExt(this.addItem);
  2890. }
  2891. public void ReadExternal(IInputStream input)
  2892. {
  2893. base.FrameMS = input.GetS32();
  2894. this.Spell = input.GetExt<LaunchSpell>();
  2895. this.Effect = input.GetExt<LaunchEffect>();
  2896. this.Attack = input.GetExt<AttackProp>();
  2897. this.Item = input.GetExt<UseItem>();
  2898. this.addItem = input.GetExt<BuffAddItem>();
  2899. }
  2900. }
  2901. }
  2902. //---------------------------------------------------------------------------------//
  2903. //---------------------------------------------------------------------------------//
  2904. /// <summary>
  2905. /// 掉落道具类数据结构
  2906. /// </summary>
  2907. [MessageType(0x4007)]
  2908. [DescAttribute("掉落道具类数据结构")]
  2909. [TableClassAttribute("ID")]
  2910. public class ItemTemplate : ICloneable, ITemplateData, IExternalizable
  2911. {
  2912. public int TemplateID { get { return ID; } }
  2913. [XmlSerializable()]
  2914. public string EditorPath { get; set; }
  2915. [DescAttribute("ID", "", false)]
  2916. public int ID;
  2917. [LocalizationTextAttribute]
  2918. [DescAttribute("掉落道具名字", "道具")]
  2919. public string Name;
  2920. [DescAttribute("掉落道具名字", "道具")]
  2921. public string IconName;
  2922. [DescAttribute("使用间隔时间(毫秒)", "道具")]
  2923. public int UseCoolDownTimeMS = 0;
  2924. [DescAttribute("场景显示的名字", "道具")]
  2925. public string DisplayName;
  2926. [DescAttribute("道具是否可被手动检取(如果手动检取,则不能直接走上去获得)", "捡取")]
  2927. public bool Pickable = false;
  2928. [DescAttribute("手动检取读条时间(毫秒)", "捡取")]
  2929. [DependOnProperty("Pickable")]
  2930. public int PickTimeMS = 2000;
  2931. [DescAttribute("拾取后删除", "捡取")]
  2932. public bool RemoveOnFinishPick = true;
  2933. [DescAttribute("最大拾取人数", "捡取")]
  2934. public byte maxPickPlayers = 0;
  2935. [DescAttribute("单人最大拾取次数", "捡取")]
  2936. public short maxPickTimes = 0;
  2937. [DescAttribute("掉落后多久可以获得(毫秒)", "掉落")]
  2938. public int GotCoolDownTimeMS = 500;
  2939. [DescAttribute("掉落道具全阵营有效", "掉落")]
  2940. public bool DropForAll;
  2941. [DescAttribute("掉落道具仅玩家有效", "掉落")]
  2942. public bool PlayerOnly = true;
  2943. [DescAttribute("获得即使用", "掉落")]
  2944. public bool GotOnUse = true;
  2945. [DescAttribute("掉落金币最小值", "掉落")]
  2946. public int DropMoneyMin = 0;
  2947. [DescAttribute("掉落金币最大值", "掉落")]
  2948. public int DropMoneyMax = 0;
  2949. [DescAttribute("获得后的特效(检取者)", "特效")]
  2950. public LaunchEffect GotEffect;
  2951. [DescAttribute("获得后的特效(自身)", "特效")]
  2952. public LaunchEffect GotEffectSelf;
  2953. [DescAttribute("掉落时的特效", "特效")]
  2954. public LaunchEffect DropEffect;
  2955. [ResourceIDAttribute]
  2956. [DescAttribute("资源模型名字", "资源")]
  2957. public string FileName;
  2958. [DescAttribute("拾取范围,半径", "资源")]
  2959. public float BodySize = 1f;
  2960. [DescAttribute("客户端可见", "资源")]
  2961. public bool ClientVisible = true;
  2962. [DescAttribute("道具产生后,持续时间(毫秒)", "掉落")]
  2963. public int LifeTimeMS = 10000;
  2964. [DescAttribute("道具产生后,显示截止时间戳(秒)", "掉落")]
  2965. public int LifeEndTime = 0;
  2966. [DescAttribute("道具飞到拾取者身上的插值(仅客户端表现用)", "掉落")]
  2967. public float FlyLerp = 0.1f;
  2968. [DescAttribute("是否显示持续时间 ", "掉落")]
  2969. public bool showLifeTime = false;
  2970. [DescAttribute("物品掉落的动画时长(毫秒)", "掉落")]
  2971. public float AnimatorTime = -1.0f;
  2972. [DescAttribute("仅做显示用", "掉落")]
  2973. public bool OnlyForShow = false;
  2974. [DescAttribute("模型上是否显示品质光柱", "掉落")]
  2975. public bool ShowQualityEffect = true;
  2976. [DescAttribute("使用后的特效", "特效")]
  2977. public LaunchEffect UseEffect;
  2978. [DescAttribute("使用后释放一个法术", "使用")]
  2979. public LaunchSpell UseSpell;
  2980. [DescAttribute("使用后召唤单位", "使用")]
  2981. public SummonUnit UseSummon;
  2982. [DescAttribute("使用后增加BUFF列表", "使用")]
  2983. [ListAttribute(typeof(LaunchBuff))]
  2984. public List<LaunchBuff> UseBuffs = new List<LaunchBuff>();
  2985. [DescAttribute("装备后增加BUFF列表", "装备")]
  2986. [ListAttribute(typeof(LaunchBuff))]
  2987. public List<LaunchBuff> EquipBuffs = new List<LaunchBuff>();
  2988. [DescAttribute("在背包内最大堆叠数量", "背包")]
  2989. public int MaxStackCount = 100;
  2990. [DescAttribute("最大持有数量,0表示无上限", "背包")]
  2991. public int HoldingLimit = 0;
  2992. [DescAttribute("是否在背包内可使用", "背包")]
  2993. public bool IsInventoryUseable = true;
  2994. [DescAttribute("是否可携带多个(包括堆叠)", "背包")]
  2995. public bool IsDuplicateInventory = true;
  2996. [DescAttribute("同步到服务器(可持久化保存的道具)", "背包")]
  2997. public bool SyncToServer = false;
  2998. [DescAttribute("背包道具使用读条(毫秒)", "背包")]
  2999. public int UseInProgressTimeMS = 0;
  3000. [DescAttribute("购买花费金币", "购买")]
  3001. public bool BuyCostMoney;
  3002. [DescAttribute("出售花费金币", "购买")]
  3003. public bool SellGotMoney;
  3004. [DescAttribute("是否弹出非物品类的二级面板", "显示")]
  3005. public bool IsPopPanel = false;
  3006. [ListAttribute(typeof(FlyEffect))]
  3007. [DescAttribute("飞行特效", "妖气修为")]
  3008. public List<FlyEffect> Fly;
  3009. /// <summary>
  3010. /// 道具扩展属性
  3011. /// </summary>
  3012. [DescAttribute("道具扩展属性", "扩展")]
  3013. [Expandable]
  3014. [NotNull]
  3015. public IItemProperties Properties;
  3016. public ItemTemplate()
  3017. {
  3018. this.Properties = TemplateManager.Factory.CreateItemProperties();
  3019. }
  3020. public ItemTemplate(int id)
  3021. {
  3022. this.ID = id;
  3023. this.Properties = TemplateManager.Factory.CreateItemProperties();
  3024. }
  3025. public int GetID()
  3026. {
  3027. return ID;
  3028. }
  3029. public override string ToString()
  3030. {
  3031. return Name + "(" + ID + ")";
  3032. }
  3033. public object Clone()
  3034. {
  3035. ItemTemplate ret = new ItemTemplate();
  3036. ret.EditorPath = this.EditorPath;
  3037. ret.ID = this.ID;
  3038. ret.Name = this.Name;
  3039. ret.IconName = this.IconName;
  3040. ret.Pickable = this.Pickable;
  3041. ret.PickTimeMS = this.PickTimeMS;
  3042. ret.RemoveOnFinishPick = this.RemoveOnFinishPick;
  3043. ret.GotCoolDownTimeMS = this.GotCoolDownTimeMS;
  3044. ret.DropForAll = this.DropForAll;
  3045. ret.PlayerOnly = this.PlayerOnly;
  3046. ret.GotOnUse = this.GotOnUse;
  3047. ret.DropMoneyMin = this.DropMoneyMin;
  3048. ret.DropMoneyMax = this.DropMoneyMax;
  3049. ret.GotEffect = CUtils.TryClone<LaunchEffect>(this.GotEffect);
  3050. ret.GotEffectSelf = CUtils.TryClone<LaunchEffect>(this.GotEffectSelf);
  3051. ret.DropEffect = CUtils.TryClone<LaunchEffect>(this.DropEffect);
  3052. ret.FileName = this.FileName;
  3053. ret.BodySize = this.BodySize;
  3054. ret.ClientVisible = this.ClientVisible;
  3055. ret.LifeTimeMS = this.LifeTimeMS;
  3056. ret.UseEffect = CUtils.TryClone<LaunchEffect>(this.UseEffect);
  3057. ret.UseSpell = CUtils.TryClone<LaunchSpell>(this.UseSpell);
  3058. ret.UseSummon = CUtils.TryClone<SummonUnit>(this.UseSummon);
  3059. ret.UseBuffs = CUtils.CloneList<LaunchBuff>(this.UseBuffs);
  3060. ret.EquipBuffs = CUtils.CloneList<LaunchBuff>(this.EquipBuffs);
  3061. ret.MaxStackCount = this.MaxStackCount;
  3062. ret.HoldingLimit = this.HoldingLimit;
  3063. ret.IsInventoryUseable = this.IsInventoryUseable;
  3064. ret.UseCoolDownTimeMS = this.UseCoolDownTimeMS;
  3065. ret.IsDuplicateInventory = this.IsDuplicateInventory;
  3066. ret.SyncToServer = this.SyncToServer;
  3067. ret.UseInProgressTimeMS = this.UseInProgressTimeMS;
  3068. ret.FlyLerp = this.FlyLerp;
  3069. ret.showLifeTime = this.showLifeTime;
  3070. ret.AnimatorTime = this.AnimatorTime;
  3071. ret.LifeEndTime = this.LifeEndTime;
  3072. ret.IsPopPanel = this.IsPopPanel;
  3073. ret.Fly = CUtils.CloneList<FlyEffect>(this.Fly);
  3074. ret.Properties = CUtils.TryClone<IItemProperties>(this.Properties);
  3075. ret.maxPickPlayers = this.maxPickPlayers;
  3076. ret.maxPickTimes = this.maxPickTimes;
  3077. ret.OnlyForShow = this.OnlyForShow;
  3078. ret.DisplayName = this.DisplayName;
  3079. ret.ShowQualityEffect = this.ShowQualityEffect;
  3080. return ret;
  3081. }
  3082. public void WriteExternal(IOutputStream output)
  3083. {
  3084. output.PutUTF(this.EditorPath);
  3085. output.PutS32(this.ID);
  3086. output.PutUTF(this.Name);
  3087. output.PutUTF(this.IconName);
  3088. output.PutBool(this.Pickable);
  3089. output.PutS32(this.PickTimeMS);
  3090. output.PutBool(this.RemoveOnFinishPick);
  3091. output.PutS32(this.GotCoolDownTimeMS);
  3092. output.PutBool(this.DropForAll);
  3093. output.PutBool(this.PlayerOnly);
  3094. output.PutBool(this.GotOnUse);
  3095. output.PutS32(this.DropMoneyMin);
  3096. output.PutS32(this.DropMoneyMax);
  3097. output.PutExt(this.GotEffect);
  3098. output.PutExt(this.GotEffectSelf);
  3099. output.PutExt(this.DropEffect);
  3100. output.PutUTF(this.FileName);
  3101. output.PutF32(this.BodySize);
  3102. output.PutBool(this.ClientVisible);
  3103. output.PutS32(this.LifeTimeMS);
  3104. output.PutExt(this.UseEffect);
  3105. output.PutExt(this.UseSpell);
  3106. output.PutExt(this.UseSummon);
  3107. output.PutList(this.UseBuffs, output.PutExt);
  3108. output.PutList(this.EquipBuffs, output.PutExt);
  3109. output.PutS32(this.MaxStackCount);
  3110. output.PutS32(this.HoldingLimit);
  3111. output.PutBool(this.IsInventoryUseable);
  3112. output.PutS32(this.UseCoolDownTimeMS);
  3113. output.PutBool(this.IsDuplicateInventory);
  3114. output.PutBool(this.SyncToServer);
  3115. output.PutS32(this.UseInProgressTimeMS);
  3116. output.PutExt(this.Properties);
  3117. output.PutBool(this.showLifeTime);
  3118. output.PutF32(this.FlyLerp);
  3119. if (this.showLifeTime)
  3120. {
  3121. output.PutS32(this.LifeEndTime);
  3122. }
  3123. output.PutF32(this.AnimatorTime);
  3124. output.PutBool(this.IsPopPanel);
  3125. output.PutList<FlyEffect>(this.Fly, output.PutExt);
  3126. output.PutS16(this.maxPickTimes);
  3127. output.PutU8(this.maxPickPlayers);
  3128. output.PutBool(this.OnlyForShow);
  3129. output.PutUTF(this.DisplayName);
  3130. output.PutBool(this.ShowQualityEffect);
  3131. }
  3132. public void ReadExternal(IInputStream input)
  3133. {
  3134. this.EditorPath = input.GetUTF();
  3135. this.ID = input.GetS32();
  3136. this.Name = input.GetUTF();
  3137. this.IconName = input.GetUTF();
  3138. this.Pickable = input.GetBool();
  3139. this.PickTimeMS = input.GetS32();
  3140. this.RemoveOnFinishPick = input.GetBool();
  3141. this.GotCoolDownTimeMS = input.GetS32();
  3142. this.DropForAll = input.GetBool();
  3143. this.PlayerOnly = input.GetBool();
  3144. this.GotOnUse = input.GetBool();
  3145. this.DropMoneyMin = input.GetS32();
  3146. this.DropMoneyMax = input.GetS32();
  3147. this.GotEffect = input.GetExt<LaunchEffect>();
  3148. this.GotEffectSelf = input.GetExt<LaunchEffect>();
  3149. this.DropEffect = input.GetExt<LaunchEffect>();
  3150. this.FileName = input.GetUTF();
  3151. this.BodySize = input.GetF32();
  3152. this.ClientVisible = input.GetBool();
  3153. this.LifeTimeMS = input.GetS32();
  3154. this.UseEffect = input.GetExt<LaunchEffect>();
  3155. this.UseSpell = input.GetExt<LaunchSpell>();
  3156. this.UseSummon = input.GetExt<SummonUnit>();
  3157. this.UseBuffs = input.GetList<LaunchBuff>(input.GetExt<LaunchBuff>);
  3158. this.EquipBuffs = input.GetList<LaunchBuff>(input.GetExt<LaunchBuff>);
  3159. this.MaxStackCount = input.GetS32();
  3160. this.HoldingLimit = input.GetS32();
  3161. this.IsInventoryUseable = input.GetBool();
  3162. this.UseCoolDownTimeMS = input.GetS32();
  3163. this.IsDuplicateInventory = input.GetBool();
  3164. this.SyncToServer = input.GetBool();
  3165. this.UseInProgressTimeMS = input.GetS32();
  3166. this.Properties = input.GetExt<IItemProperties>(this.Properties);
  3167. this.showLifeTime = input.GetBool();
  3168. this.FlyLerp = input.GetF32();
  3169. if (this.showLifeTime)
  3170. {
  3171. this.LifeEndTime = input.GetS32();
  3172. }
  3173. this.AnimatorTime = input.GetF32();
  3174. this.IsPopPanel = input.GetBool();
  3175. this.Fly = input.GetList<FlyEffect>(input.GetExt<FlyEffect>);
  3176. this.maxPickTimes = input.GetS16();
  3177. this.maxPickPlayers = input.GetU8();
  3178. this.OnlyForShow = input.GetBool();
  3179. this.DisplayName = input.GetUTF();
  3180. this.ShowQualityEffect = input.GetBool();
  3181. }
  3182. }
  3183. [MessageType(0x4018)]
  3184. [DescAttribute("物品飞行特效")]
  3185. [Expandable]
  3186. public class FlyEffect : ICloneable, IExternalizable
  3187. {
  3188. [DescAttribute("特效名字")]
  3189. public string Name;
  3190. [DescAttribute("特效时长(秒数)")]
  3191. public float Time;
  3192. [DescAttribute("以玩家为目标点")]
  3193. public bool isActorPos;
  3194. [DescAttribute("是否绑定在节点上")]
  3195. public bool isBindPart;
  3196. [DescAttribute("特效飞至的部位")]
  3197. public string PartName;
  3198. [DescAttribute("特效拉升的高度")]
  3199. public float Height;
  3200. [DescAttribute("特效速度")]
  3201. public float Speed;
  3202. [DescAttribute("运行方向 0:原点 1:上 2:下 3:左 4:右 5:前 6:后")]
  3203. public byte RunDirection = 0;
  3204. [DescAttribute("音效文件名")]
  3205. public string AudioName;
  3206. [DescAttribute("是否到达玩家位置就删除特效")]
  3207. public bool IsGoToActorPosAndRemove;
  3208. [DescAttribute("特效和玩家之间的最小距离,小于等于这个距离,这个特效将会移除")]
  3209. [DependOnProperty("IsGoToActorPosAndRemove")]
  3210. public float MinDistance = 0.05f;
  3211. [DescAttribute("基于此节点激活间隔时长")]
  3212. public bool IsBeginActiveIntervalTime = false;
  3213. [DescAttribute("间隔时长,基于激活后的时间间隔")]
  3214. public float IntervalTime = -1;
  3215. [DescAttribute("此特效移除后,关联下一个特效的index")]
  3216. public int NextEffectIndex = -1;
  3217. [DescAttribute("此特效生成时,基于那个index特效的坐标")]
  3218. public int PosIndex = -1;
  3219. public object Clone()
  3220. {
  3221. FlyEffect ret = new FlyEffect();
  3222. ret.Name = this.Name;
  3223. ret.Time = this.Time;
  3224. ret.PartName = this.PartName;
  3225. ret.Height = this.Height;
  3226. ret.isActorPos = this.isActorPos;
  3227. ret.isBindPart = this.isBindPart;
  3228. ret.Speed = this.Speed;
  3229. ret.RunDirection = this.RunDirection;
  3230. ret.AudioName = this.AudioName;
  3231. ret.IsGoToActorPosAndRemove = this.IsGoToActorPosAndRemove;
  3232. ret.IsBeginActiveIntervalTime = this.IsBeginActiveIntervalTime;
  3233. ret.IntervalTime = this.IntervalTime;
  3234. ret.NextEffectIndex = this.NextEffectIndex;
  3235. ret.PosIndex = this.PosIndex;
  3236. return ret;
  3237. }
  3238. public void ReadExternal(IInputStream input)
  3239. {
  3240. this.Name = input.GetUTF();
  3241. this.Time = input.GetF32();
  3242. this.PartName = input.GetUTF();
  3243. this.Height = input.GetF32();
  3244. this.isActorPos = input.GetBool();
  3245. this.isBindPart = input.GetBool();
  3246. this.Speed = input.GetF32();
  3247. this.RunDirection = input.GetU8();
  3248. this.AudioName = input.GetUTF();
  3249. this.IsGoToActorPosAndRemove = input.GetBool();
  3250. this.IsBeginActiveIntervalTime = input.GetBool();
  3251. this.IntervalTime = input.GetF32();
  3252. this.NextEffectIndex = input.GetS32();
  3253. this.PosIndex = input.GetS32();
  3254. }
  3255. public void WriteExternal(IOutputStream output)
  3256. {
  3257. output.PutUTF(this.Name);
  3258. output.PutF32(this.Time);
  3259. output.PutUTF(this.PartName);
  3260. output.PutF32(this.Height);
  3261. output.PutBool(this.isActorPos);
  3262. output.PutBool(this.isBindPart);
  3263. output.PutF32(this.Speed);
  3264. output.PutU8(this.RunDirection);
  3265. output.PutUTF(this.AudioName);
  3266. output.PutBool(this.IsGoToActorPosAndRemove);
  3267. output.PutBool(this.IsBeginActiveIntervalTime);
  3268. output.PutF32(this.IntervalTime);
  3269. output.PutS32(this.NextEffectIndex);
  3270. output.PutS32(this.PosIndex);
  3271. }
  3272. }
  3273. //---------------------------------------------------------------------------------//
  3274. [MessageType(0x4015)]
  3275. [DescAttribute("单位事件触发")]
  3276. [TableClassAttribute("ID")]
  3277. public class UnitEventTemplate : ICloneable, ITemplateData, IExternalizable
  3278. {
  3279. public int TemplateID { get { return ID; } }
  3280. [XmlSerializable()]
  3281. public string EditorPath { get; set; }
  3282. [DescAttribute("ID", "", false)]
  3283. public int ID;
  3284. [LocalizationTextAttribute]
  3285. [DescAttribute("单位事件触发名字", "基础")]
  3286. public string Name;
  3287. [ListAttribute(typeof(UnitEvent))]
  3288. [DescAttribute("所有事件", "基础", false)]
  3289. public List<UnitEvent> Events = new List<UnitEvent>();
  3290. public override string ToString()
  3291. {
  3292. return Name + "(" + ID + ")";
  3293. }
  3294. public object Clone()
  3295. {
  3296. UnitEventTemplate ret = new UnitEventTemplate();
  3297. ret.EditorPath = this.EditorPath;
  3298. ret.ID = this.ID;
  3299. ret.Name = this.Name;
  3300. ret.Events = CUtils.CloneList<UnitEvent>(this.Events);
  3301. return ret;
  3302. }
  3303. public void WriteExternal(IOutputStream output)
  3304. {
  3305. output.PutUTF(this.EditorPath);
  3306. output.PutS32(this.ID);
  3307. output.PutUTF(this.Name);
  3308. output.PutList(this.Events, output.PutExt);
  3309. }
  3310. public void ReadExternal(IInputStream input)
  3311. {
  3312. this.EditorPath = input.GetUTF();
  3313. this.ID = input.GetS32();
  3314. this.Name = input.GetUTF();
  3315. this.Events = input.GetList(input.GetExt<UnitEvent>);
  3316. }
  3317. public UnitEvent GetEvent(string name)
  3318. {
  3319. foreach (var e in Events)
  3320. {
  3321. if (e.Name == name) { return e; }
  3322. }
  3323. return null;
  3324. }
  3325. }
  3326. #endregion
  3327. //---------------------------------------------------------------------------------//
  3328. #region __Launch_Objects__
  3329. public abstract class BaseKeyFrame
  3330. {
  3331. [DescAttribute("关键帧时间(毫秒)")]
  3332. public int FrameMS;
  3333. }
  3334. /// <summary>
  3335. /// 技能或者法术产生的攻击属性
  3336. /// </summary>
  3337. [MessageType(0x4008)]
  3338. [DescAttribute("技能或者法术产生的攻击属性")]
  3339. [Expandable]
  3340. public class AttackProp : ISNData, ICloneable
  3341. {
  3342. /// <summary>
  3343. /// 攻击力
  3344. /// </summary>
  3345. [DescAttribute("攻击力")]
  3346. public int Attack;
  3347. [DescAttribute("产生受击", "Mask")]
  3348. public bool MaskDamage = false;
  3349. [DescAttribute("产生击飞", "Mask")]
  3350. [DependOnProperty("MaskDamage")]
  3351. public bool MaskHitFly = false;
  3352. [DescAttribute("产生击倒", "Mask")]
  3353. [DependOnProperty("MaskDamage")]
  3354. public bool MaskKnockDown = false;
  3355. [DescAttribute("此次攻击必命中,即使命中为0", "Mask")]
  3356. public bool MaskMustHit = false;
  3357. [DescAttribute("此次攻击必暴击,即使暴击为0", "Mask")]
  3358. public bool MaskMustCritical = false;
  3359. [DescAttribute("击中力度(大于目标体重才会产生受击)", "受击")]
  3360. [DependOnProperty("MaskDamage")]
  3361. public int Weight = 1;
  3362. [DescAttribute("单位被(受击、击倒、眩晕、混乱)持续时间(毫秒)" +
  3363. "\n * 此时间如果为0,首先选用单位DamageTimeMS,否则然后采用Config环境参数OBJECT_DAMAGE_TIME_MS替代之。" +
  3364. "\n * HitMove运动时间不计算在KnockOutTimeMS内。", "受击")]
  3365. [DependOnProperty("MaskDamage")]
  3366. public int KnockOutTimeMS = 0;
  3367. [DescAttribute("受击动作名", "受击")]
  3368. [DependOnProperty("MaskDamage")]
  3369. public string DamageActionName = null;
  3370. [DescAttribute("受击时,不再遭受其他攻击", "受击")]
  3371. [DependOnProperty("MaskDamage")]
  3372. public bool IsDamageProtect = false;
  3373. public bool IsHitMove { get { return MaskDamage && HitMove != null; } }
  3374. [DescAttribute("被击中后向后移动距离(包括击飞控制)", "受击")]
  3375. [DependOnProperty("MaskDamage")]
  3376. public StartMove HitMove;
  3377. public enum HitMoveType : byte
  3378. {
  3379. [DescAttribute("根据攻击者位置(台球碰撞)")]
  3380. BySenderPosition,
  3381. [DescAttribute("根据攻击者朝向(单向)")]
  3382. BySenderDirection,
  3383. [DescAttribute("根据攻击者朝向的左右边(摩西分海)")]
  3384. BySenderLeftRight,
  3385. [DescAttribute("位移至攻击者中心(向里吸)")]
  3386. ToSenderCenter,
  3387. [DescAttribute("位移至攻击者身边(向里吸)")]
  3388. ToSenderBodySize,
  3389. [DescAttribute("位移至攻击固定范围外")]
  3390. BySenderRange,
  3391. }
  3392. [DescAttribute("受击位移计算方式", "受击")]
  3393. [DependOnProperty("IsHitMove")]
  3394. public HitMoveType HitMoveMType = HitMoveType.BySenderPosition;
  3395. [DescAttribute("受击位移时对其他单位产生伤害", "受击")]
  3396. [DependOnProperty("IsHitMove")]
  3397. public AttackProp HitMoveBodyAttack;
  3398. [DescAttribute("基于被攻击者身体范围的增加范围", "受击")]
  3399. [DependOnProperty("IsHitMove")]
  3400. public float HitMoveBodyAttackSize = 1;
  3401. [DescAttribute("被击飞落地后产生伤害,或者位移结束产生伤害", "受击")]
  3402. [DependOnProperty("MaskDamage")]
  3403. [DependOnProperty("MaskHitFly")]
  3404. public AttackProp FlyFallenDownAttack;
  3405. [DescAttribute("被击中特效", "被击中")]
  3406. public LaunchEffect Effect;
  3407. [DescAttribute("被击中触发一个BUFF", "被击中")]
  3408. public LaunchBuff Buff;
  3409. [DescAttribute("被击中触发一个Spell", "被击中")]
  3410. public LaunchSpell Spell;
  3411. [DescAttribute("百分比概率击碎目标", "击碎")]
  3412. public float CrushPercent = 0;
  3413. [DescAttribute("击碎目标效果", "击碎")]
  3414. public LaunchEffect CrushEffect;
  3415. [DescAttribute("定帧时长", "客户端")]
  3416. public int StopFrameMS = 0;
  3417. [DescAttribute("定帧类型", "客户端")]
  3418. public string StopFrameAction;
  3419. /// <summary>
  3420. /// 用户自定义扩展属性
  3421. /// </summary>
  3422. [DescAttribute("用户自定义扩展属性", "扩展")]
  3423. [Expandable]
  3424. [NotNull]
  3425. public IAttackProperties Properties;
  3426. [DescAttribute("打死小怪是否击退", "受击")]
  3427. public KillHitMove killHitMove;
  3428. public AttackProp()
  3429. {
  3430. Properties = TemplateManager.Factory.CreateAttackProperties();
  3431. }
  3432. /// <summary>
  3433. /// 是否产生受击
  3434. /// </summary>
  3435. /// <returns></returns>
  3436. public bool IsDamage()
  3437. {
  3438. return MaskDamage || MaskHitFly || MaskKnockDown;
  3439. }
  3440. public override string ToString()
  3441. {
  3442. return "攻击";
  3443. }
  3444. public object Clone()
  3445. {
  3446. AttackProp ret = new AttackProp();
  3447. ret.SerialNumber = this.SerialNumber;
  3448. ret.Attack = this.Attack;
  3449. ret.MaskDamage = this.MaskDamage;
  3450. ret.MaskHitFly = this.MaskHitFly;
  3451. ret.MaskKnockDown = this.MaskKnockDown;
  3452. ret.MaskMustHit = this.MaskMustHit;
  3453. ret.MaskMustCritical = this.MaskMustCritical;
  3454. ret.Weight = this.Weight;
  3455. ret.KnockOutTimeMS = this.KnockOutTimeMS;
  3456. ret.IsDamageProtect = this.IsDamageProtect;
  3457. ret.DamageActionName = this.DamageActionName;
  3458. ret.Effect = CUtils.TryClone<LaunchEffect>(this.Effect);
  3459. ret.Buff = CUtils.TryClone<LaunchBuff>(this.Buff);
  3460. ret.Spell = CUtils.TryClone<LaunchSpell>(this.Spell);
  3461. ret.HitMove = CUtils.TryClone<StartMove>(this.HitMove);
  3462. ret.HitMoveMType = this.HitMoveMType;
  3463. ret.HitMoveBodyAttack = CUtils.TryClone<AttackProp>(this.HitMoveBodyAttack);
  3464. ret.HitMoveBodyAttackSize = this.HitMoveBodyAttackSize;
  3465. ret.FlyFallenDownAttack = CUtils.TryClone<AttackProp>(this.FlyFallenDownAttack);
  3466. ret.StopFrameMS = this.StopFrameMS;
  3467. ret.StopFrameAction = this.StopFrameAction;
  3468. ret.CrushPercent = this.CrushPercent;
  3469. ret.CrushEffect = CUtils.TryClone<LaunchEffect>(this.CrushEffect);
  3470. ret.Properties = CUtils.TryClone<IAttackProperties>(this.Properties);
  3471. ret.killHitMove = CUtils.TryClone<KillHitMove>(this.killHitMove);
  3472. return ret;
  3473. }
  3474. public override void WriteExternal(IOutputStream output)
  3475. {
  3476. base.WriteExternal(output);
  3477. output.PutS32(this.Attack);
  3478. output.PutBool(this.MaskDamage);
  3479. output.PutBool(this.MaskHitFly);
  3480. output.PutBool(this.MaskKnockDown);
  3481. output.PutBool(this.MaskMustHit);
  3482. output.PutBool(this.MaskMustCritical);
  3483. output.PutS32(this.Weight);
  3484. output.PutS32(this.KnockOutTimeMS);
  3485. output.PutBool(this.IsDamageProtect);
  3486. output.PutUTF(this.DamageActionName);
  3487. output.PutExt(this.Effect);
  3488. output.PutExt(this.Buff);
  3489. output.PutExt(this.Spell);
  3490. output.PutExt(this.HitMove);
  3491. output.PutEnum8(this.HitMoveMType);
  3492. output.PutExt(this.HitMoveBodyAttack);
  3493. output.PutF32(this.HitMoveBodyAttackSize);
  3494. output.PutExt(this.FlyFallenDownAttack);
  3495. output.PutS32(this.StopFrameMS);
  3496. output.PutUTF(this.StopFrameAction);
  3497. output.PutF32(this.CrushPercent);
  3498. output.PutExt(this.CrushEffect);
  3499. output.PutExt(this.Properties);
  3500. output.PutExt(this.killHitMove);
  3501. }
  3502. public override void ReadExternal(IInputStream input)
  3503. {
  3504. base.ReadExternal(input);
  3505. this.Attack = input.GetS32();
  3506. this.MaskDamage = input.GetBool();
  3507. this.MaskHitFly = input.GetBool();
  3508. this.MaskKnockDown = input.GetBool();
  3509. this.MaskMustHit = input.GetBool();
  3510. this.MaskMustCritical = input.GetBool();
  3511. this.Weight = input.GetS32();
  3512. this.KnockOutTimeMS = input.GetS32();
  3513. this.IsDamageProtect = input.GetBool();
  3514. this.DamageActionName = input.GetUTF();
  3515. this.Effect = input.GetExt<LaunchEffect>();
  3516. this.Buff = input.GetExt<LaunchBuff>();
  3517. this.Spell = input.GetExt<LaunchSpell>();
  3518. this.HitMove = input.GetExt<StartMove>();
  3519. this.HitMoveMType = input.GetEnum8<HitMoveType>();
  3520. this.HitMoveBodyAttack = input.GetExt<AttackProp>();
  3521. this.HitMoveBodyAttackSize = input.GetF32();
  3522. this.FlyFallenDownAttack = input.GetExt<AttackProp>();
  3523. this.StopFrameMS = input.GetS32();
  3524. this.StopFrameAction = input.GetUTF();
  3525. this.CrushPercent = input.GetF32();
  3526. this.CrushEffect = input.GetExt<LaunchEffect>();
  3527. this.Properties = input.GetExt<IAttackProperties>(this.Properties);
  3528. this.killHitMove = input.GetExt<KillHitMove>();
  3529. }
  3530. }
  3531. //---------------------------------------------------------------------------------//
  3532. /// <summary>
  3533. /// 触发特效,一般只用于显示
  3534. /// </summary>
  3535. [MessageType(0x4009)]
  3536. [DescAttribute("触发特效,一般只用于显示")]
  3537. [Expandable]
  3538. public class LaunchEffect : ISNData, ICloneable
  3539. {
  3540. public enum RunType : byte
  3541. {
  3542. [DescAttribute("默认,沒有運行")]
  3543. None = 0,
  3544. [DescAttribute("圓形,以綁定點未中心")]
  3545. Cycle_BindName = 1,
  3546. }
  3547. [DescAttribute("触发的特效名字")]
  3548. [ResourceIDAttribute]
  3549. public string Name;
  3550. [DescAttribute("触发特效是否绑定在特定单位")]
  3551. public bool BindBody = true;
  3552. [DescAttribute("绑定挂载点位置")]
  3553. public string BindPartName;
  3554. [DescAttribute("如果不为0,则特效以该尺寸缩放")]
  3555. public float ScaleToBodySize;
  3556. [DescAttribute("特效高度的偏移量")]
  3557. public float EffectHight = 0;
  3558. [DescAttribute("特效水平方向的偏移量x")]
  3559. public float EffectOffsetX = 0;
  3560. [DescAttribute("特效水平方向的偏移量x")]
  3561. public float EffectOffsetY = 0;
  3562. [DescAttribute("音效")]
  3563. [ResourceIDAttribute]
  3564. public string SoundName;
  3565. [DescAttribute("震屏时长(毫秒)", "震屏")]
  3566. public int EarthQuakeMS;
  3567. [DescAttribute("震屏幅度", "震屏")]
  3568. public float EarthQuakeXYZ;
  3569. [DescAttribute("自定义字段", "特效扩展")]
  3570. public string Tag;
  3571. [DescAttribute("摄像机动画名字")]
  3572. public string CameraAnimation;
  3573. [DescAttribute("特效持续时间,0表示只播放一次")]
  3574. public int EffectTimeMS = 0;
  3575. [DescAttribute("是否循环")]
  3576. public bool IsLoop = false;
  3577. [DescAttribute("是否同步施法者的Rotation")]
  3578. public bool IsSyncSenderRotation = false;
  3579. [DescAttribute("速度(原始动画/特效速度 * 速度)", "特效加速")]
  3580. public float EffectAddSpeed = 1;
  3581. [DescAttribute("特效中存在的动画,动画的名字", "特效加速")]
  3582. public string AnimtionName;
  3583. [DescAttribute("Buff運行方式")]
  3584. public RunType RType = RunType.None;
  3585. [DescAttribute("圆形运行参数设置")]
  3586. public CricleSpeedMode CricleMode;
  3587. public override string ToString()
  3588. {
  3589. return "触发特效:" + Name;
  3590. }
  3591. public object Clone()
  3592. {
  3593. LaunchEffect ret = new LaunchEffect();
  3594. ret.SerialNumber = this.SerialNumber;
  3595. ret.Name = this.Name;
  3596. ret.BindBody = this.BindBody;
  3597. ret.BindPartName = this.BindPartName;
  3598. ret.ScaleToBodySize = this.ScaleToBodySize;
  3599. ret.EffectHight = this.EffectHight;
  3600. ret.EffectOffsetX = this.EffectOffsetX;
  3601. ret.EffectOffsetY = this.EffectOffsetY;
  3602. ret.SoundName = this.SoundName;
  3603. ret.EarthQuakeMS = this.EarthQuakeMS;
  3604. ret.EarthQuakeXYZ = this.EarthQuakeXYZ;
  3605. ret.Tag = this.Tag;
  3606. ret.CameraAnimation = this.CameraAnimation;
  3607. ret.EffectTimeMS = this.EffectTimeMS;
  3608. ret.IsLoop = this.IsLoop;
  3609. ret.IsSyncSenderRotation = this.IsSyncSenderRotation;
  3610. ret.EffectAddSpeed = this.EffectAddSpeed;
  3611. ret.AnimtionName = this.AnimtionName;
  3612. ret.RType = this.RType;
  3613. ret.CricleMode = CUtils.TryClone<CricleSpeedMode>(this.CricleMode);
  3614. return ret;
  3615. }
  3616. public override void WriteExternal(IOutputStream output)
  3617. {
  3618. base.WriteExternal(output);
  3619. output.PutUTF(this.Name);
  3620. output.PutBool(this.BindBody);
  3621. output.PutUTF(this.BindPartName);
  3622. output.PutF32(this.ScaleToBodySize);
  3623. output.PutF32(this.EffectHight);
  3624. output.PutF32(this.EffectOffsetX);
  3625. output.PutF32(this.EffectOffsetY);
  3626. output.PutUTF(this.SoundName);
  3627. output.PutS32(this.EarthQuakeMS);
  3628. output.PutF32(this.EarthQuakeXYZ);
  3629. output.PutUTF(this.Tag);
  3630. output.PutUTF(this.CameraAnimation);
  3631. output.PutS32(this.EffectTimeMS);
  3632. output.PutBool(this.IsLoop);
  3633. output.PutBool(this.IsSyncSenderRotation);
  3634. output.PutF32(this.EffectAddSpeed);
  3635. output.PutUTF(this.AnimtionName);
  3636. output.PutEnum8(this.RType);
  3637. output.PutExt(this.CricleMode);
  3638. }
  3639. public override void ReadExternal(IInputStream input)
  3640. {
  3641. base.ReadExternal(input);
  3642. this.Name = input.GetUTF();
  3643. this.BindBody = input.GetBool();
  3644. this.BindPartName = input.GetUTF();
  3645. this.ScaleToBodySize = input.GetF32();
  3646. this.EffectHight = input.GetF32();
  3647. this.EffectOffsetX = input.GetF32();
  3648. this.EffectOffsetY = 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. }