Passivity.lua 337 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507
  1. local floor = math.floor
  2. local max = math.max
  3. local min = math.min
  4. --local RoleDataName = RoleDataName
  5. --local BattleLogic = BattleLogic
  6. --local BattleUtil = BattleUtil
  7. --local BattleEventName = BattleEventName
  8. --local BuffName = BuffName
  9. --属性编号
  10. -- local BattlePropList = {
  11. -- RoleDataName.Attack,
  12. -- RoleDataName.PhysicalDefence,
  13. -- RoleDataName.MagicDefence,
  14. -- RoleDataName.Speed,
  15. -- RoleDataName.DamageBocusFactor,
  16. -- RoleDataName.DamageReduceFactor,
  17. -- RoleDataName.Hit,
  18. -- RoleDataName.Dodge,
  19. -- RoleDataName.Crit,
  20. -- RoleDataName.CritDamageFactor,
  21. -- RoleDataName.TreatFacter,
  22. -- RoleDataName.MaxHp,
  23. -- RoleDataName.Hp,
  24. -- RoleDataName.CureFacter,
  25. -- RoleDataName.Tenacity,
  26. -- RoleDataName.InitRage,
  27. -- }
  28. PassiveManager = {}
  29. PassiveManager.passiveCountList = {
  30. [0] = {},
  31. [1] = {}
  32. }
  33. function PassiveManager.Init()
  34. PassiveManager.passiveCountList = {
  35. [0] = {},
  36. [1] = {}
  37. }
  38. end
  39. local NormalMaxLayer = 100000
  40. local function Slot2Idx(slot)
  41. if slot == 0 then
  42. return 1
  43. elseif slot == 1 then
  44. return 2
  45. elseif slot == 3 then
  46. return 3
  47. end
  48. end
  49. local function clearBuffPredicate(buff, type)
  50. local flag = false
  51. if type == 1 then --持续恢复
  52. flag = buff.type == BuffName.HOT
  53. elseif type == 2 then --护盾
  54. flag = buff.type == BuffName.Shield
  55. elseif type == 3 then --增益状态
  56. flag = buff.isBuff == true
  57. elseif type == 4 then --减益状态
  58. flag = buff.isDeBuff == true
  59. elseif type == 5 then --持续伤害
  60. flag = buff.type == BuffName.DOT
  61. elseif type == 6 then --负面状态(控制状态、减益状态和持续伤害状态)
  62. flag = buff.type == BuffName.Control or buff.isDeBuff or buff.type == BuffName.DOT
  63. or (buff.type ==BuffName.Brand and buff.flag == BrandType.curse)
  64. end
  65. if flag == nil then
  66. flag = false
  67. end
  68. local sign="false"
  69. if flag then sign = "true" end
  70. BattleLogManager.Log(
  71. "clearBuffPredicate:"..buff.type.." caltype:"..type,
  72. "flag:", sign
  73. )
  74. if buff.type ==BuffName.Brand then
  75. BattleLogManager.Log(
  76. "clearBuffPredicate: Brand "..buff.type,
  77. "buff.flag :", buff.flag
  78. )
  79. end
  80. return flag
  81. end
  82. -- 规范技能目标 1 对方 2 自己 3对方自己
  83. local function EffectTargetFunc(_target,targetFunc,enemyFunc,args,defaltfunc)
  84. if _target==1 then
  85. if enemyFunc then enemyFunc(args) end
  86. elseif _target==2 then
  87. if targetFunc then targetFunc(args) end
  88. elseif _target==3 then
  89. if enemyFunc then enemyFunc(args) end
  90. if targetFunc then targetFunc(args) end
  91. else
  92. if defaltfunc then defaltfunc(args) end
  93. end
  94. return _target==1 or _target==2 or _target==3
  95. end
  96. --被动技能表
  97. local passivityList
  98. passivityList = {
  99. --发动技能时,[a]的概率将[b]*[c]算作[d]计算
  100. --a[float],b[属性],c[float],d[属性]
  101. [1] = function(role, args, delay)
  102. local f1 = args[1]
  103. local pro1 = args[2]
  104. local f2 = args[3]
  105. local pro2 = args[4]
  106. local OnSkillCast = function(skill)
  107. BattleLogic.WaitForTrigger(delay, function ()
  108. BattleUtil.RandomAction2(f1, function ()
  109. local duration = 0
  110. for i=1, skill.effectList.size do
  111. duration = max(duration, skill.effectList.buffer[i].duration)
  112. end
  113. role:AddPropertyTransfer(BattlePropList[pro1], f2, BattlePropList[pro2], 2, duration + BattleLogic.GameDeltaTime * 2)
  114. end)
  115. end)
  116. end
  117. role.Event:AddEvent(BattleEventName.SkillCast, OnSkillCast)
  118. end,
  119. --发动技能后,[a]的概率对敌方随机1名施加攻击*[c]的[d]伤害。
  120. --a[float],c[float],d[伤害类型]
  121. [2] = function(role, args, delay)
  122. local f1 = args[1]
  123. local f2 = args[2]
  124. local dt = args[3]
  125. local OnSkillCastEnd = function(skill)
  126. BattleLogic.WaitForTrigger(delay, function ()
  127. BattleUtil.RandomAction2(f1, function ()
  128. local arr = BattleUtil.ChooseTarget(role, 20001)
  129. if arr[1] then
  130. BattleUtil.CalDamage(nil, role, arr[1], dt, f2)
  131. end
  132. end)
  133. end)
  134. end
  135. role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
  136. end,
  137. --发动技能后,[c]使仇恨目标受到治疗效果降低[a],持续[b]
  138. --a[float],b[int],c[float]
  139. [3] = function(role, args, delay)
  140. local f1 = args[1]
  141. local f2 = args[2]
  142. local f3 = args[3]
  143. local OnSkillCastEnd = function(skill)
  144. BattleLogic.WaitForTrigger(delay, function ()
  145. BattleUtil.RandomAction2(f3, function ()
  146. local arr = BattleUtil.ChooseTarget(role, 40000)
  147. if arr[1] then
  148. arr[1]:AddBuff(Buff.Create(role, BuffName.PropertyChange, f2, RoleDataName.CureFacter, f1, 3))
  149. end
  150. end)
  151. end)
  152. end
  153. role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
  154. end,
  155. --发动技能后,[d]改变自身[a]属性[b],持续[c]秒
  156. --a[属性],b[float],c[int],d[改变类型]
  157. [4] = function(role, args, delay)
  158. local pro = args[1]
  159. local f1 = args[2]
  160. local f2 = args[3]
  161. local ct = args[4]
  162. local OnSkillCastEnd = function(skill)
  163. role:AddBuff(Buff.Create(role, BuffName.PropertyChange, f2, BattlePropList[pro], f1, ct))
  164. end
  165. role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
  166. end,
  167. --发动技能后,[a]的概率回复攻击最高的1人的[b]*[c]血量,持续[d]秒。
  168. --a[float],b[属性],c[float],d[int]
  169. [5] = function(role, args, delay)
  170. local f1 = args[1]
  171. local pro = args[2]
  172. local f2 = args[3]
  173. local f3 = args[4]
  174. local OnSkillCastEnd = function(skill)
  175. BattleLogic.WaitForTrigger(delay, function ()
  176. BattleUtil.RandomAction2(f1, function ()
  177. local arr = BattleUtil.ChooseTarget(role, 10321)
  178. if arr[1] then
  179. local val = floor(BattleUtil.FP_Mul(f2, role:GetRoleData(BattlePropList[pro])))
  180. arr[1]:AddBuff(Buff.Create(role, BuffName.HOT, f3, 1, val))
  181. end
  182. end)
  183. end)
  184. end
  185. role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
  186. end,
  187. --发动技能后,[a]的概率提升随机角色的[b]*[c]的[d],持续[e]秒。
  188. --a[float],b[属性],c[float],d[属性],e[int]
  189. [6] = function(role, args, delay)
  190. local f1 = args[1]
  191. local pro1 = args[2]
  192. local f2 = args[3]
  193. local pro2 = args[4]
  194. local f3 = args[5]
  195. local OnSkillCastEnd = function(skill)
  196. BattleLogic.WaitForTrigger(delay, function ()
  197. BattleUtil.RandomAction2(f1, function ()
  198. local arr = BattleUtil.ChooseTarget(role, 10001)
  199. if arr[1] then
  200. local val = floor(BattleUtil.FP_Mul(f2, role:GetRoleData(BattlePropList[pro1])))
  201. arr[1]:AddBuff(Buff.Create(role, BuffName.PropertyChange, f3, BattlePropList[pro2], val, 1))
  202. end
  203. end)
  204. end)
  205. end
  206. role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
  207. end,
  208. --使用回复技能时,[a]的概率提高恢复效果[b]。
  209. --a[float],b[float]
  210. [7] = function(role, args, delay)
  211. local f1 = args[1]
  212. local f2 = args[2]
  213. local OnPassiveTreating = function(treatingFunc)
  214. BattleLogic.WaitForTrigger(delay, function ()
  215. BattleUtil.RandomAction2(f1, function ()
  216. treatingFunc(f2, CountTypeName.AddPencent)
  217. end)
  218. end)
  219. end
  220. role.Event:AddEvent(BattleEventName.PassiveTreating, OnPassiveTreating)
  221. end,
  222. --受击后,[a]的概率,回复自身的[b]*[c]的血量
  223. --a[float],b[属性],c[float]
  224. [8] = function(role, args, delay)
  225. local f1 = args[1]
  226. local pro = args[2]
  227. local f2 = args[3]
  228. local OnBeHit = function(treatingFunc)
  229. BattleLogic.WaitForTrigger(delay, function ()
  230. BattleUtil.RandomAction2(f1, function ()
  231. local val = floor(BattleUtil.FP_Mul(f2, role:GetRoleData(BattlePropList[pro])))
  232. BattleUtil.CalTreat(role, role, val)
  233. end)
  234. end)
  235. end
  236. role.Event:AddEvent(BattleEventName.RoleBeHit, OnBeHit)
  237. end,
  238. --受击后,[a]对攻击者造成的攻击*[c]的持续伤害,持续[d]秒。
  239. --a[float],c[float],d[int]
  240. [9] = function(role, args, delay)
  241. local f1 = args[1]
  242. local f2 = args[2]
  243. local f3 = args[3]
  244. local triggerUid = {}
  245. local OnBeHit = function(atkRole)
  246. BattleLogic.WaitForTrigger(delay, function ()
  247. if atkRole.isTeam then
  248. return
  249. end
  250. if triggerUid[atkRole.uid] then --加入限定避免循环触发
  251. return
  252. end
  253. BattleUtil.RandomAction2(f1, function ()
  254. atkRole:AddBuff(Buff.Create(role, BuffName.DOT, f3, 1, 0, 1, f2))
  255. triggerUid[atkRole.uid] = atkRole.uid
  256. BattleLogic.WaitForTrigger(f3+1, function ()
  257. triggerUid[atkRole.uid] = nil
  258. end)
  259. end)
  260. end)
  261. end
  262. role.Event:AddEvent(BattleEventName.RoleBeHit, OnBeHit)
  263. end,
  264. --受击时[e],[a]的概率将[b]*[c]算作[d]计算
  265. --a[float],b[属性],c[float],d[属性],e[伤害类型]
  266. [10] = function(role, args, delay)
  267. local f1 = args[1]
  268. local pro1 = args[2]
  269. local f2 = args[3]
  270. local pro2 = args[4]
  271. local dt = args[5]
  272. local OnRoleBeDamagedBefore = function(atkRole, func, damageType)
  273. BattleLogic.WaitForTrigger(delay, function ()
  274. if damageType == dt then
  275. BattleUtil.RandomAction2(f1, function ()
  276. role:AddPropertyTransfer(BattlePropList[pro1], f2, BattlePropList[pro2], 2, BattleLogic.GameDeltaTime)
  277. end)
  278. end
  279. end)
  280. end
  281. role.Event:AddEvent(BattleEventName.RoleBeDamagedBefore, OnRoleBeDamagedBefore)
  282. end,
  283. --受击时,有[a]的概率抵消[b]*[c]的攻击。
  284. --a[float],b[属性],c[float]
  285. [11] = function(role, args, delay)
  286. local f1 = args[1]
  287. local pro = args[2]
  288. local f2 = args[3]
  289. local OnPassiveDamaging = function(damagingFunc, atkRole, damage)
  290. BattleLogic.WaitForTrigger(delay, function ()
  291. BattleUtil.RandomAction2(f1, function ()
  292. damagingFunc(floor(BattleUtil.FP_Mul(f2, role:GetRoleData(BattlePropList[pro]))))
  293. end)
  294. end)
  295. end
  296. role.Event:AddEvent(BattleEventName.PassiveBeDamaging, OnPassiveDamaging)
  297. end,
  298. --受击后,有[a]的概率对敌方全体造成攻击*[c]的[d]伤害
  299. --a[float],c[float],d[伤害类型]
  300. [12] = function(role, args, delay)
  301. local f1 = args[1]
  302. local f2 = args[2]
  303. local dt = args[3]
  304. local lastTrigger = 0
  305. local OnBeHit = function(atkRole)
  306. BattleLogic.WaitForTrigger(delay, function ()
  307. if atkRole.isTeam then
  308. return
  309. end
  310. lastTrigger = lastTrigger + 1
  311. if lastTrigger > 1 then --加入限定避免循环触发
  312. return
  313. end
  314. BattleUtil.RandomAction2(f1, function ()
  315. local arr = BattleUtil.ChooseTarget(role, 20000)
  316. for i=1, #arr do
  317. BattleUtil.CalDamage(nil, role, arr[i], dt, f2)
  318. end
  319. end)
  320. lastTrigger = 0
  321. end)
  322. end
  323. role.Event:AddEvent(BattleEventName.RoleBeHit, OnBeHit)
  324. end,
  325. --受击后,有[a]的概率对随机1人造成[b]*[c]的真实伤害。
  326. --a[float],b[属性],c[float]
  327. [13] = function(role, args, delay)
  328. local f1 = args[1]
  329. local pro = args[2]
  330. local f2 = args[3]
  331. local lastTrigger = 0
  332. local OnBeHit = function(atkRole)
  333. BattleLogic.WaitForTrigger(delay, function ()
  334. if atkRole.isTeam then
  335. return
  336. end
  337. lastTrigger = lastTrigger + 1
  338. if lastTrigger > 1 then --加入限定避免循环触发
  339. return
  340. end
  341. BattleUtil.RandomAction2(f1, function ()
  342. local arr = BattleUtil.ChooseTarget(role, 20001)
  343. if arr[1] then
  344. local val = floor(BattleUtil.FP_Mul(f2, role:GetRoleData(BattlePropList[pro])))
  345. BattleUtil.ApplyDamage(nil, role, arr[1], val)
  346. end
  347. end)
  348. lastTrigger = 0
  349. end)
  350. end
  351. role.Event:AddEvent(BattleEventName.RoleBeHit, OnBeHit)
  352. end,
  353. --受击后[f],[a]的概率将[b]*[c]算作[d]计算,持续[e]秒。
  354. --a[float],b[属性],c[float],d[属性],e[int],f[伤害类型]
  355. [14] = function(role, args, delay)
  356. local f1 = args[1]
  357. local pro1 = args[2]
  358. local f2 = args[3]
  359. local pro2 = args[4]
  360. local f3 = args[5]
  361. local dt = args[6]
  362. local OnBeHit = function(atkRole, damage, bCrit, finalDmg, damageType)
  363. BattleLogic.WaitForTrigger(delay, function ()
  364. if damageType == dt then
  365. BattleUtil.RandomAction2(f1, function ()
  366. role:AddPropertyTransfer(BattlePropList[pro1], f2, BattlePropList[pro2], 2, f3)
  367. end)
  368. end
  369. end)
  370. end
  371. role.Event:AddEvent(BattleEventName.RoleBeHit, OnBeHit)
  372. end,
  373. --免疫[a]属性伤害。
  374. --a[属性类型]
  375. [15] = function(role, args, delay)
  376. local pt = args[1]
  377. local elementDamageReduceFactor
  378. if pt == 1 then
  379. elementDamageReduceFactor = RoleDataName.FireDamageReduceFactor
  380. elseif pt == 2 then
  381. elementDamageReduceFactor = RoleDataName.WindDamageReduceFactor
  382. elseif pt == 3 then
  383. elementDamageReduceFactor = RoleDataName.IceDamageReduceFactor
  384. elseif pt == 4 then
  385. elementDamageReduceFactor = RoleDataName.LandDamageReduceFactor
  386. elseif pt == 5 then
  387. elementDamageReduceFactor = RoleDataName.LightDamageReduceFactor
  388. elseif pt == 6 then
  389. elementDamageReduceFactor = RoleDataName.DarkDamageReduceFactor
  390. end
  391. role.data:AddValue(elementDamageReduceFactor, 10000)
  392. end,
  393. --发动技能后,[a]的概率将[b]*[c]算作[d]计算,持续[e]秒。
  394. --a[float],b[属性],c[float],d[属性],e[int]
  395. [16] = function(role, args, delay)
  396. local f1 = args[1]
  397. local pro1 = args[2]
  398. local f2 = args[3]
  399. local pro2 = args[4]
  400. local f3 = args[5]
  401. local OnSkillCastEnd = function(skill)
  402. BattleLogic.WaitForTrigger(delay, function ()
  403. BattleUtil.RandomAction2(f1, function ()
  404. role:AddPropertyTransfer(BattlePropList[pro1], f2, BattlePropList[pro2], 2, f3)
  405. end)
  406. end)
  407. end
  408. role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
  409. end,
  410. --发动技能后,[d]改变仇恨目标[a]属性[b],持续[c]秒
  411. --a[属性],b[int],c[int],d[改变类型]
  412. [17] = function(role, args, delay)
  413. local pro1 = args[1]
  414. local f1 = args[2]
  415. local f2 = args[3]
  416. local ct = args[4]
  417. local OnSkillCastEnd = function(skill)
  418. BattleLogic.WaitForTrigger(delay, function ()
  419. local arr = BattleUtil.ChooseTarget(role, 40000)
  420. if arr[1] then
  421. arr[1]:AddBuff(Buff.Create(role, BuffName.PropertyChange, f2, BattlePropList[pro1], f1, ct))
  422. end
  423. end)
  424. end
  425. role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
  426. end,
  427. --发动技能后,[d]改变己方全体[a]属性[b],持续[c]秒
  428. --a[属性],b[int],c[int],d[改变类型]
  429. [18] = function(role, args, delay)
  430. local pro1 = args[1]
  431. local f1 = args[2]
  432. local f2 = args[3]
  433. local ct = args[4]
  434. local OnSkillCastEnd = function(skill)
  435. BattleLogic.WaitForTrigger(delay, function ()
  436. local arr = BattleUtil.ChooseTarget(role, 10000)
  437. for i=1, #arr do
  438. arr[i]:AddBuff(Buff.Create(role, BuffName.PropertyChange, f2, BattlePropList[pro1], f1, ct))
  439. end
  440. end)
  441. end
  442. role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
  443. end,
  444. --受到治疗效果提高[a]。
  445. --a[float]
  446. [19] = function(role, args, delay)
  447. local f1 = args[1]
  448. role.data:AddValue(RoleDataName.CureFacter, f1)
  449. end,
  450. --[b]造成的持续伤害时间延长[a]。
  451. --a[int],b[改变类型]
  452. [20] = function(role, args, delay)
  453. local f1 = args[1]
  454. local ct = args[2]
  455. local OnBuffCaster = function(buff)
  456. if buff.type == BuffName.DOT then
  457. if ct == 1 then --加算
  458. buff.duration = buff.duration + f1
  459. elseif ct == 2 then --乘加算(百分比属性加算)
  460. buff.duration = buff.duration * (1 + f1)
  461. elseif ct == 3 then --减算
  462. buff.duration = buff.duration - f1
  463. elseif ct == 4 then --乘减算(百分比属性减算)
  464. buff.duration = buff.duration * (1 - f1)
  465. end
  466. end
  467. end
  468. role.Event:AddEvent(BattleEventName.BuffCaster, OnBuffCaster)
  469. end,
  470. --自身增益效果超过[a]时,技能伤害提升[b]。
  471. --a[int],b[float]
  472. [21] = function(role, args, delay)
  473. local i1 = args[1]
  474. local f1 = args[2]
  475. local count = 0
  476. local targetBuff
  477. local active = count > i1
  478. local OnBuffStart = function(buff)
  479. if buff.isBuff then
  480. count = count + 1
  481. if count > i1 and not active then
  482. active = true
  483. targetBuff = Buff.Create(role, BuffName.PropertyChange, 0, RoleDataName.DamageBocusFactor, f1, 1)
  484. targetBuff.isBuff = false --自身不算增益
  485. role:AddBuff(targetBuff)
  486. end
  487. end
  488. end
  489. local OnBuffEnd = function(buff)
  490. if buff.isBuff then
  491. count = count - 1
  492. if count <= i1 and active then
  493. active = false
  494. if targetBuff then
  495. targetBuff.disperse = true
  496. end
  497. end
  498. end
  499. end
  500. role.Event:AddEvent(BattleEventName.BuffStart, OnBuffStart)
  501. role.Event:AddEvent(BattleEventName.BuffEnd, OnBuffEnd)
  502. end,
  503. --血量低于[a]时,[b]概率触发控制免疫,持续[c]秒。每场战斗只能触发1次。
  504. --a[float],b[float],c[int]
  505. [22] = function(role, args, delay)
  506. local f1 = args[1]
  507. local f2 = args[2]
  508. local f3 = args[3]
  509. local triggerCount = 0
  510. local OnBeHit = function(atkRole)
  511. BattleLogic.WaitForTrigger(delay, function ()
  512. if BattleUtil.GetHPPencent(role) < f1 then
  513. if triggerCount < 1 then
  514. BattleUtil.RandomAction2(f2, function ()
  515. role:AddBuff(Buff.Create(role, BuffName.Immune, f3, 1))
  516. triggerCount = triggerCount + 1
  517. end)
  518. end
  519. end
  520. end)
  521. end
  522. role.Event:AddEvent(BattleEventName.RoleBeHit, OnBeHit)
  523. end,
  524. --死亡时,立即回复己方全体[a]*[b]的血量。
  525. --a[属性],b[float]
  526. [23] = function(role, args, delay)
  527. local pro = args[1]
  528. local f1 = args[2]
  529. local OnDead = function(atkRole)
  530. BattleLogic.WaitForTrigger(delay, function ()
  531. local arr = BattleUtil.ChooseTarget(role, 10000)
  532. for i=1, #arr do
  533. local val = floor(BattleUtil.FP_Mul(f1, role:GetRoleData(BattlePropList[pro])))
  534. BattleUtil.CalTreat(role, arr[i], val)
  535. end
  536. end)
  537. end
  538. role.Event:AddEvent(BattleEventName.RoleDead, OnDead)
  539. end,
  540. --控制效果命中后,[a]的概率施加[c]的[d]伤害
  541. --a[float],c[float],d[伤害类型]
  542. [24] = function(role, args, delay)
  543. local f1 = args[1]
  544. local f2 = args[2]
  545. local dt = args[3]
  546. local OnBuffCaster = function(buff)
  547. BattleLogic.WaitForTrigger(delay, function ()
  548. if buff.type == BuffName.Control then
  549. BattleUtil.RandomAction2(f1, function ()
  550. BattleUtil.CalDamage(nil, role, buff.target, dt, f2)
  551. end)
  552. end
  553. end)
  554. end
  555. role.Event:AddEvent(BattleEventName.BuffCaster, OnBuffCaster)
  556. end,
  557. --控制效果命中后,[a]对全体造成[c]的[d]伤害。
  558. --a[float],c[float],d[伤害类型]
  559. [25] = function(role, args, delay)
  560. local f1 = args[1]
  561. local f2 = args[2]
  562. local dt = args[3]
  563. local OnBuffCaster = function(buff)
  564. BattleLogic.WaitForTrigger(delay, function ()
  565. if buff.type == BuffName.Control then
  566. BattleUtil.RandomAction2(f1, function ()
  567. local arr = BattleUtil.ChooseTarget(buff.target, 10000)
  568. for i=1, #arr do
  569. BattleUtil.CalDamage(nil, role, arr[i], dt, f2)
  570. end
  571. end)
  572. end
  573. end)
  574. end
  575. role.Event:AddEvent(BattleEventName.BuffCaster, OnBuffCaster)
  576. end,
  577. --造成的伤害暴击后,[a]施加攻击*[c]的[d]持续伤害,持续[e]秒。
  578. --a[float],c[float],d[伤害类型],e[int]
  579. [26] = function(role, args, delay)
  580. local f1 = args[1]
  581. local f2 = args[2]
  582. local dt = args[3]
  583. local f3 = args[4]
  584. local triggerUid = {}
  585. local OnRoleCrit = function(defRole)
  586. BattleLogic.WaitForTrigger(delay, function ()
  587. if triggerUid[defRole.uid] then --加入限定避免循环触发
  588. return
  589. end
  590. BattleUtil.RandomAction2(f1, function ()
  591. defRole:AddBuff(Buff.Create(role, BuffName.DOT, f3, 1, 0, dt, f2))
  592. triggerUid[defRole.uid] = defRole.uid
  593. BattleLogic.WaitForTrigger(f3+1, function ()
  594. triggerUid[defRole.uid] = nil
  595. end)
  596. end)
  597. end)
  598. end
  599. role.Event:AddEvent(BattleEventName.RoleCrit, OnRoleCrit)
  600. end,
  601. --造成的伤害暴击后,[a]的概率回复自身[b]*[c]的血量
  602. --a[float],b[属性],c[float]
  603. [27] = function(role, args, delay)
  604. local f1 = args[1]
  605. local pro = args[2]
  606. local f2 = args[3]
  607. local OnRoleCrit = function(defRole)
  608. BattleLogic.WaitForTrigger(delay, function ()
  609. BattleUtil.RandomAction2(f1, function ()
  610. local val = floor(BattleUtil.FP_Mul(f2, role:GetRoleData(BattlePropList[pro])))
  611. BattleUtil.CalTreat(role, role, val)
  612. end)
  613. end)
  614. end
  615. role.Event:AddEvent(BattleEventName.RoleCrit, OnRoleCrit)
  616. end,
  617. --对血量高于[a]的敌人伤害提高[b]。
  618. --a[float],b[float]
  619. [28] = function(role, args, delay)
  620. local f1 = args[1]
  621. local f2 = args[2]
  622. local OnPassiveDamaging = function(damagingFunc, defRole, damage)
  623. BattleLogic.WaitForTrigger(delay, function ()
  624. if BattleUtil.GetHPPencent(defRole) > f1 then
  625. damagingFunc(-floor(f2 * damage))
  626. end
  627. end)
  628. end
  629. role.Event:AddEvent(BattleEventName.PassiveDamaging, OnPassiveDamaging)
  630. end,
  631. --对血量低于[a]的敌人伤害提高[b]。
  632. --a[float],b[float]
  633. [29] = function(role, args, delay)
  634. local f1 = args[1]
  635. local f2 = args[2]
  636. local OnPassiveDamaging = function(damagingFunc, defRole, damage)
  637. BattleLogic.WaitForTrigger(delay, function ()
  638. if BattleUtil.GetHPPencent(defRole) < f1 then
  639. damagingFunc(-floor(f2 * damage))
  640. end
  641. end)
  642. end
  643. role.Event:AddEvent(BattleEventName.PassiveDamaging, OnPassiveDamaging)
  644. end,
  645. --发动技能后,[d]改变敌方全体[a]属性[b],持续[c]秒
  646. --a[属性],b[float],c[int],d[改变类型]
  647. [30] = function(role, args, delay)
  648. local pro = args[1]
  649. local f1 = args[2]
  650. local f2 = args[3]
  651. local ct = args[4]
  652. local OnSkillCastEnd = function(skill)
  653. BattleLogic.WaitForTrigger(delay, function ()
  654. local arr = BattleUtil.ChooseTarget(role, 20000)
  655. for i=1, #arr do
  656. arr[i]:AddBuff(Buff.Create(role, BuffName.PropertyChange, f2, BattlePropList[pro], f1, ct))
  657. end
  658. end)
  659. end
  660. role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
  661. end,
  662. --发动技能后,有[a]的概率眩晕敌方其中1人,持续[b]秒。
  663. --a[float],b[int]
  664. [31] = function(role, args, delay)
  665. local f1 = args[1]
  666. local f2 = args[2]
  667. local OnSkillCastEnd = function(skill)
  668. BattleLogic.WaitForTrigger(delay, function ()
  669. local arr = BattleUtil.ChooseTarget(role, 20001)
  670. if arr[1] then
  671. BattleUtil.RandomControl(f1, 1, role, arr[1], f2)
  672. end
  673. end)
  674. end
  675. role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
  676. end,
  677. --持续伤害效果命中后,[d]改变自身[a]属性[b],持续[c]秒
  678. --a[属性],b[float],c[int],d[改变类型]
  679. [32] = function(role, args, delay)
  680. local pro = args[1]
  681. local f1 = args[2]
  682. local f2 = args[3]
  683. local ct = args[4]
  684. local OnBuffCaster = function(buff)
  685. BattleLogic.WaitForTrigger(delay, function ()
  686. if buff.type == BuffName.DOT then
  687. role:AddBuff(Buff.Create(role, BuffName.PropertyChange, f2, BattlePropList[pro], f1, ct))
  688. end
  689. end)
  690. end
  691. role.Event:AddEvent(BattleEventName.BuffCaster, OnBuffCaster)
  692. end,
  693. --[d]改变自身[a]属性[b],持续[c]秒
  694. --a[属性],b[float],c[int],d[改变类型]
  695. [33] = function(role, args, delay)
  696. local pro = args[1]
  697. local f1 = args[2]
  698. local f2 = args[3]
  699. local ct = args[4]
  700. role:AddBuff(Buff.Create(role, BuffName.PropertyChange, f2, BattlePropList[pro], f1, ct))
  701. end,
  702. --造成伤害时,额外增加[a]点伤害。
  703. --a[int]
  704. [34] = function(role, args, delay)
  705. local f1 = args[1]
  706. local OnPassiveDamaging = function(damagingFunc)
  707. BattleLogic.WaitForTrigger(delay, function ()
  708. damagingFunc(-f1)
  709. end)
  710. end
  711. role.Event:AddEvent(BattleEventName.PassiveDamaging, OnPassiveDamaging)
  712. end,
  713. --进入战斗[a]秒后,造成的伤害提升[b],持续[c]秒
  714. --a[int],b[float],c[int]
  715. [35] = function(role, args, delay)
  716. local f1 = args[1]
  717. local f2 = args[2]
  718. local f3 = args[3]
  719. BattleLogic.WaitForTrigger(f1, function ()
  720. role:AddBuff(Buff.Create(role, BuffName.PropertyChange, f3, RoleDataName.DamageBocusFactor, f2, 1))
  721. end)
  722. end,
  723. --进入战斗[a]秒后,[d]改变[b]属性[c],持续[e]秒
  724. --a[int],b[属性],c[int],d[改变类型],e[int]
  725. [36] = function(role, args, delay)
  726. local f1 = args[1]
  727. local pro = args[2]
  728. local f2 = args[3]
  729. local ct = args[4]
  730. local f3 = args[5]
  731. BattleLogic.WaitForTrigger(f1, function ()
  732. role:AddBuff(Buff.Create(role, BuffName.PropertyChange, f3, BattlePropList[pro], f2, ct))
  733. end)
  734. end,
  735. --进入战斗[a]秒后,免疫控制效果,持续[b]秒
  736. --a[int],b[int]
  737. [37] = function(role, args, delay)
  738. local f1 = args[1]
  739. local f2 = args[2]
  740. BattleLogic.WaitForTrigger(f1, function ()
  741. role:AddBuff(Buff.Create(role, BuffName.Immune, f2, 1))
  742. end)
  743. end,
  744. --每[a]秒,[d]改变[b]的[c],[g改变[e]的[f],最高叠加[h]层 (举例:每5秒,扣除10%的生命,提高5%的速度, 最高叠加5层)
  745. --a[int],b[float],c[属性],d[改变类型],e[float],f[属性],g[改变类型],h[int]
  746. [38] = function(role, args, delay)
  747. local f1 = args[1]
  748. local f2 = args[2]
  749. local pro1 = args[3]
  750. local ct1 = args[4]
  751. local f3 = args[5]
  752. local pro2 = args[6]
  753. local ct2 = args[7]
  754. local i1 = args[8]
  755. local auraBuff = Buff.Create(role, BuffName.Aura, 0, function (r)
  756. local changeBuff1 = Buff.Create(r, BuffName.PropertyChange, 0, BattlePropList[pro1], f2, ct1)
  757. changeBuff1.cover = true
  758. changeBuff1.maxLayer = i1
  759. local changeBuff2 = Buff.Create(r, BuffName.PropertyChange, 0, BattlePropList[pro2], f3, ct2)
  760. changeBuff2.cover = true
  761. changeBuff2.maxLayer = i1
  762. r:AddBuff(changeBuff1)
  763. r:AddBuff(changeBuff2)
  764. end)
  765. auraBuff.interval = f1
  766. role:AddBuff(auraBuff)
  767. end,
  768. --进入战斗后,每[a]秒回复[b]生命
  769. --a[int],b[int]
  770. [39] = function(role, args, delay)
  771. local f1 = args[1]
  772. local f2 = args[2]
  773. local auraBuff = Buff.Create(role, BuffName.Aura, 0, function (r)
  774. BattleUtil.CalTreat(r, r, f2)
  775. end)
  776. auraBuff.interval = f1
  777. role:AddBuff(auraBuff)
  778. end,
  779. --被指定[a]造成伤害时,回复[b]生命
  780. --a[职业],b[int]
  781. [40] = function(role, args, delay)
  782. local i1 = args[1]
  783. local f1 = args[2]
  784. local OnBeHit = function(atkRole)
  785. BattleLogic.WaitForTrigger(delay, function ()
  786. if atkRole.isTeam then
  787. return
  788. end
  789. if atkRole.roleData.professionId == i1 then
  790. BattleUtil.CalTreat(role, role, f1)
  791. end
  792. end)
  793. end
  794. role.Event:AddEvent(BattleEventName.RoleBeHit, OnBeHit)
  795. end,
  796. --造成伤害时,将伤害的[a]%转化为自身生命
  797. --a[float]
  798. [41] = function(role, args, delay)
  799. local f1 = args[1]
  800. local OnDamage = function(defRole, damage, bCrit, finalDmg)
  801. BattleLogic.WaitForTrigger(delay, function ()
  802. BattleUtil.CalTreat(role, role, floor(f1 * finalDmg))
  803. end)
  804. end
  805. role.Event:AddEvent(BattleEventName.RoleDamage, OnDamage)
  806. end,
  807. --造成暴击伤害时,有[a]的概率造成[b]的暴击伤害。
  808. --a[float],b[float]
  809. [42] = function(role, args, delay)
  810. local f1 = args[1]
  811. local f2 = args[2]
  812. local OnPassiveCriting = function(crit)
  813. BattleLogic.WaitForTrigger(delay, function ()
  814. BattleUtil.RandomAction2(f1, function ()
  815. crit(f2)
  816. end)
  817. end)
  818. end
  819. role.Event:AddEvent(BattleEventName.PassiveCriting, OnPassiveCriting)
  820. end,
  821. --发动技能后,[d]改变仇恨目标[a]属性[b],持续整场战斗,属性最多可改变[c]
  822. --a[属性],b[float],c[float],d[改变类型]
  823. [43] = function(role, args, delay)
  824. local pro = args[1]
  825. local f1 = args[2]
  826. local i1 = args[3]
  827. local ct = args[4]
  828. local OnSkillCastEnd = function(skill)
  829. BattleLogic.WaitForTrigger(delay, function ()
  830. local arr = BattleUtil.ChooseTarget(role, 40000)
  831. if arr[1] then
  832. local buff = Buff.Create(role, BuffName.PropertyChange, 0, BattlePropList[pro], f1, ct)
  833. buff.cover = true
  834. buff.maxLayer = i1
  835. arr[1]:AddBuff(buff)
  836. end
  837. end)
  838. end
  839. role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
  840. end,
  841. --发动技能后,[a]的概率[e]改变自身[b]属性[c],持续[d]秒。
  842. --a[float],b[属性],c[float],d[int],e[改变类型]
  843. [44] = function(role, args, delay)
  844. local f1 = args[1]
  845. local pro = args[2]
  846. local f2 = args[3]
  847. local f3 = args[4]
  848. local ct = args[5]
  849. local OnSkillCastEnd = function(skill)
  850. BattleLogic.WaitForTrigger(delay, function ()
  851. BattleUtil.RandomAction2(f1, function ()
  852. role:AddBuff(Buff.Create(role, BuffName.PropertyChange, f3, BattlePropList[pro], f2, ct))
  853. end)
  854. end)
  855. end
  856. role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
  857. end,
  858. --免疫[a]次[b]控制状态。
  859. --a[int],b[控制类型]
  860. [45] = function(role, args, delay)
  861. local i1 = args[1]
  862. local ct = args[2]
  863. local triggerCount = 0
  864. role.buffFilter:Add(function(buff)
  865. local isTarget = buff.type == BuffName.Control and (ct == 0 or buff.ctrlType == ct)
  866. if isTarget then
  867. triggerCount = triggerCount + 1
  868. return i1 == 0 or (i1 > 0 and triggerCount <= i1)
  869. else
  870. return isTarget
  871. end
  872. end)
  873. end,
  874. --免疫[a]持续伤害状态。
  875. --a[持续伤害类型]
  876. [46] = function(role, args, delay)
  877. local dt = args[1]
  878. role.buffFilter:Add(function(buff)
  879. return buff.type == BuffName.DOT and (dt == 0 or buff.damageType == dt)
  880. end)
  881. end,
  882. --战斗中,[c]改变[a]属性[b]。
  883. --a[属性],b[float],c[改变类型]
  884. [47] = function(role, args, delay)
  885. local pro = args[1]
  886. local f1 = args[2]
  887. local ct = args[3]
  888. if ct == 1 then --加算
  889. role.data:AddValue(BattlePropList[pro], f1)
  890. elseif ct == 2 then --乘加算(百分比属性加算)
  891. role.data:AddPencentValue(BattlePropList[pro], f1)
  892. elseif ct == 3 then --减算
  893. role.data:SubValue(BattlePropList[pro], f1)
  894. elseif ct == 4 then --乘减算(百分比属性减算)
  895. role.data:SubPencentValue(BattlePropList[pro], f1)
  896. end
  897. end,
  898. --战斗中,[c]改变[a]属性[b],[f]改变[d]属性[e]。
  899. --a[属性],b[float],c[改变类型],d[属性],e[float],f[改变类型]
  900. [48] = function(role, args, delay)
  901. local pro = args[1]
  902. local f1 = args[2]
  903. local ct = args[3]
  904. local pro2 = args[4]
  905. local f2 = args[5]
  906. local ct2 = args[6]
  907. if ct == 1 then --加算
  908. role.data:AddValue(BattlePropList[pro], f1)
  909. elseif ct == 2 then --乘加算(百分比属性加算)
  910. role.data:AddPencentValue(BattlePropList[pro], f1)
  911. elseif ct == 3 then --减算
  912. role.data:SubValue(BattlePropList[pro], f1)
  913. elseif ct == 4 then --乘减算(百分比属性减算)
  914. role.data:SubPencentValue(BattlePropList[pro], f1)
  915. end
  916. if ct2 == 1 then --加算
  917. role.data:AddValue(BattlePropList[pro2], f2)
  918. elseif ct2 == 2 then --乘加算(百分比属性加算)
  919. role.data:AddPencentValue(BattlePropList[pro2], f2)
  920. elseif ct2 == 3 then --减算
  921. role.data:SubValue(BattlePropList[pro2], f2)
  922. elseif ct2 == 4 then --乘减算(百分比属性减算)
  923. role.data:SubPencentValue(BattlePropList[pro2], f2)
  924. end
  925. end,
  926. --发动技能后,[a]概率[e]改变敌方全体[b]属性[c],持续[d]秒
  927. --a[float],b[属性],c[float],d[int],e[改变类型]
  928. [49] = function(role, args, delay)
  929. local f1 = args[1]
  930. local pro = args[2]
  931. local f2 = args[3]
  932. local f3 = args[4]
  933. local ct = args[5]
  934. local OnSkillCastEnd = function(skill)
  935. BattleLogic.WaitForTrigger(delay, function ()
  936. BattleUtil.RandomAction2(f1, function ()
  937. local arr = BattleUtil.ChooseTarget(role, 20000)
  938. for i=1, #arr do
  939. arr[i]:AddBuff(Buff.Create(role, BuffName.PropertyChange, f3, BattlePropList[pro], f2, ct))
  940. end
  941. end)
  942. end)
  943. end
  944. role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
  945. end,
  946. --战斗中,每[a]秒增加[b]%的异妖能量
  947. --a[int],b[float]
  948. [50] = function(role, args, delay)
  949. local f1 = args[1]
  950. local f2 = args[2]
  951. local auraBuff = Buff.Create(role, BuffName.Aura, 0, function (r)
  952. --BattleLogic.AddMP(role.camp, f2 * 100)
  953. end)
  954. auraBuff.interval = f1
  955. BattleLogic.BuffMgr:AddBuff(role, auraBuff)
  956. end,
  957. --战斗中,初始拥有[a]%的异妖能量
  958. --a[float]
  959. [51] = function(role, args, delay)
  960. local f1 = args[1]
  961. --BattleLogic.AddMP(role.camp, f1 * 100)
  962. end,
  963. --战斗中,队伍每损失[a]%的生命值,增加[b]%的异妖能量
  964. --a[float],b[float]
  965. [52] = function(role, args, delay)
  966. local f1 = args[1]
  967. local f2 = args[2]
  968. local maxHp = 0
  969. local curHp = 0
  970. if f1 == 0 then
  971. return
  972. end
  973. local curHpGears = 0
  974. local arr = BattleUtil.ChooseTarget(role, 10000)
  975. for i=1, #arr do
  976. curHp = curHp + arr[i]:GetRoleData(RoleDataName.Hp)
  977. maxHp = maxHp + arr[i]:GetRoleData(RoleDataName.MaxHp)
  978. end
  979. local auraBuff = Buff.Create(role, BuffName.Aura, 0, function (r)
  980. local hp = 0
  981. for i=1, #arr do
  982. hp = hp + arr[i]:GetRoleData(RoleDataName.Hp)
  983. end
  984. if hp < curHp then
  985. local gears = floor((maxHp - hp) / (f1 * maxHp))
  986. if gears > curHpGears then
  987. --BattleLogic.AddMP(role.camp, f2 * (gears - curHpGears) * 100)
  988. curHpGears = gears
  989. end
  990. curHp = hp
  991. end
  992. end)
  993. auraBuff.interval = 0
  994. BattleLogic.BuffMgr:AddBuff(role, auraBuff)
  995. end,
  996. --战斗中,治疗技能有概率额外造成[a]%的治疗,概率等于自身暴击率。
  997. --a[float]
  998. [53] = function(role, args, delay)
  999. local f1 = args[1]
  1000. local OnPassiveTreating = function(treatingFunc)
  1001. BattleLogic.WaitForTrigger(delay, function ()
  1002. BattleUtil.RandomAction2(role:GetRoleData(RoleDataName.Crit), function ()
  1003. treatingFunc(f1, CountTypeName.AddPencent)
  1004. end)
  1005. end)
  1006. end
  1007. role.Event:AddEvent(BattleEventName.PassiveTreating, OnPassiveTreating)
  1008. end,
  1009. --受击后,有[a]的概率对攻击者造成眩晕,持续[b]秒。
  1010. --a[float],b[int]
  1011. [54] = function(role, args, delay)
  1012. local f1 = args[1]
  1013. local f2 = args[2]
  1014. local OnBeHit = function(atkRole, damage, bCrit, finalDmg, damageType)
  1015. BattleLogic.WaitForTrigger(delay, function ()
  1016. if atkRole.isTeam then
  1017. return
  1018. end
  1019. BattleUtil.RandomControl(f1, 1, role, atkRole, f2)
  1020. end)
  1021. end
  1022. role.Event:AddEvent(BattleEventName.RoleBeHit, OnBeHit)
  1023. end,
  1024. --造成伤害时,有[a]的概率立即造成攻击[b]%的伤害。
  1025. --a[float],b[float]
  1026. [55] = function(role, args, delay)
  1027. local f1 = args[1]
  1028. local f2 = args[2]
  1029. local lastTrigger = 0
  1030. local OnDamage = function(defRole, damage, bCrit, finalDmg)
  1031. BattleLogic.WaitForTrigger(delay, function ()
  1032. lastTrigger = lastTrigger + 1
  1033. if lastTrigger > 1 then --加入限定避免循环触发
  1034. return
  1035. end
  1036. BattleUtil.RandomAction2(f1, function ()
  1037. local val = floor(BattleUtil.FP_Mul(role:GetRoleData(RoleDataName.Attack), f2))
  1038. BattleUtil.ApplyDamage(nil, role, defRole, val)
  1039. end)
  1040. lastTrigger = 0
  1041. end)
  1042. end
  1043. role.Event:AddEvent(BattleEventName.RoleHit, OnDamage)
  1044. end,
  1045. --造成暴击时,额外造成目标最大生命值[a]%的伤害。(目标最大生命值伤害总上限为施法者2.5倍攻击)
  1046. --a[float]
  1047. [56] = function(role, args, delay)
  1048. local f1 = args[1]
  1049. local lastTrigger = 0
  1050. local OnRoleCrit = function(defRole)
  1051. BattleLogic.WaitForTrigger(delay, function ()
  1052. lastTrigger = lastTrigger + 1
  1053. if lastTrigger > 1 then --加入限定避免循环触发
  1054. return
  1055. end
  1056. local ar1 = BattleUtil.FP_Mul(defRole:GetRoleData(RoleDataName.MaxHp), f1)
  1057. local ar2 = BattleUtil.FP_Mul(role:GetRoleData(RoleDataName.Attack), 2.5)
  1058. BattleUtil.ApplyDamage(nil, role, defRole, floor(min(ar1, ar2)))
  1059. lastTrigger = 0
  1060. end)
  1061. end
  1062. role.Event:AddEvent(BattleEventName.RoleCrit, OnRoleCrit)
  1063. end,
  1064. --发动技能时,若技能目标与自身发动的上一个技能目标相同,则增加[a]%的伤害,最多叠加[b]层。
  1065. --a[float],b[int]
  1066. [57] = function(role, args, delay)
  1067. local f1 = args[1]
  1068. local i2 = args[2]
  1069. local damageDic = {}
  1070. local lastDamageDic = {}
  1071. local OnSkillCastEnd = function(skill)
  1072. for k in pairs(damageDic) do
  1073. if lastDamageDic[k] then
  1074. damageDic[k] = damageDic[k] + 1
  1075. end
  1076. end
  1077. lastDamageDic = damageDic
  1078. damageDic = {}
  1079. end
  1080. local OnPassiveDamaging = function(damagingFunc, defRole, damage)
  1081. if lastDamageDic[defRole] then
  1082. local layer = i2 == 0 and lastDamageDic[defRole] or min(i2, lastDamageDic[defRole])
  1083. damagingFunc(-floor(f1 * layer * damage))
  1084. damageDic[defRole] = lastDamageDic[defRole]
  1085. else
  1086. damageDic[defRole] = 1
  1087. end
  1088. end
  1089. role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
  1090. role.Event:AddEvent(BattleEventName.PassiveDamaging, OnPassiveDamaging)
  1091. end,
  1092. --发动技能后,每个敌方角色有[a]概率获得[b],每秒造成[c]%的[d]伤害,持续[e]秒。
  1093. --a[float],b[持续伤害类型],c[float],d[伤害类型],e[int]
  1094. [58] = function(role, args, delay)
  1095. local f1 = args[1]
  1096. local d1 = args[2]
  1097. local f2 = args[3]
  1098. local dt = args[4]
  1099. local f3 = args[5]
  1100. local OnSkillCastEnd = function(skill)
  1101. BattleLogic.WaitForTrigger(delay, function ()
  1102. local arr = BattleUtil.ChooseTarget(role, 20000)
  1103. for i=1, #arr do
  1104. BattleUtil.RandomAction2(f1, function ()--
  1105. arr[i]:AddBuff(Buff.Create(role, BuffName.DOT, f3, 1, d1, dt, f2))
  1106. end)
  1107. end
  1108. end)
  1109. end
  1110. role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
  1111. end,
  1112. --每隔[a]秒,抵挡一个负面状态。(控制 dot 减益)
  1113. --a[int]
  1114. [59] = function(role, args, delay)
  1115. local f1 = args[1]
  1116. local count = 0
  1117. role.buffFilter:Add(function(buff)
  1118. local b = buff.isDeBuff or buff.type == BuffName.DOT or buff.type == BuffName.Control
  1119. if b then
  1120. count = count + 1
  1121. end
  1122. return b and count <= 1
  1123. end)
  1124. local auraBuff = Buff.Create(role, BuffName.Aura, 0, function (r)
  1125. count = 0
  1126. end)
  1127. auraBuff.interval = f1
  1128. BattleLogic.BuffMgr:AddBuff(role, auraBuff)
  1129. end,
  1130. --我方生命最低的其他角色受到技能攻击后,自身[a]的概率对攻击者造成攻击[b]%的[c]伤害,并造成[d],持续[e]秒。若自身处于沉默或眩晕状态,则不会触发。播放攻击特效,特效时间[f]秒。
  1131. --a[float],b[float],c[伤害类型],d[控制状态],e[int],f[float]
  1132. [60] = function(role, args, delay)
  1133. local f1 = args[1]
  1134. local f2 = args[2]
  1135. local dt = args[3]
  1136. local ct = args[4]
  1137. local f3 = args[5]
  1138. local f4 = args[6]
  1139. local triggerUid = {}
  1140. BattleLogic.Event:AddEvent(BattleEventName.RoleBeDamaged, function (defRole, atkRole, damage, bCrit, finalDmg, damageType, dotType)
  1141. BattleLogic.WaitForTrigger(delay, function ()
  1142. if atkRole.isTeam or role:IsDead() or dotType then
  1143. return
  1144. end
  1145. if triggerUid[atkRole.uid] then --加入限定避免循环触发
  1146. return
  1147. end
  1148. if not BattleLogic.BuffMgr:HasBuff(role, BuffName.Control, function (buff) return buff.ctrlType == 1 or buff.ctrlType == 2 end) then
  1149. local arr = BattleUtil.ChooseTarget(role, 10110)
  1150. local target
  1151. if arr[1] then
  1152. if arr[1] == role and arr[2] then
  1153. target = arr[2]
  1154. else
  1155. target = arr[1]
  1156. end
  1157. end
  1158. if defRole == target then
  1159. BattleUtil.RandomAction2(f1, function ()--
  1160. role.Event:DispatchEvent(BattleEventName.RoleViewBullet, f4, atkRole)
  1161. BattleLogic.WaitForTrigger(f4, function ()
  1162. triggerUid[atkRole.uid] = atkRole.uid
  1163. BattleUtil.CalDamage(nil, role, atkRole, dt, f2)
  1164. BattleUtil.RandomControl(1, ct, role, atkRole, f3)
  1165. triggerUid[atkRole.uid] = nil
  1166. end)
  1167. end)
  1168. end
  1169. end
  1170. end)
  1171. end)
  1172. end,
  1173. --自身受到的非暴击伤害,可以转化[a]%的伤害为自身攻击,持续[b]秒。上限自身攻击的[c]%。
  1174. --a[float],b[int],c[float]
  1175. [61] = function(role, args, delay)
  1176. local f1 = args[1]
  1177. local f2 = args[2]
  1178. local f3 = args[3]
  1179. local OnBeHit = function(atkRole, damage, bCrit, finalDmg, damageType)
  1180. if not bCrit then
  1181. local ar1 = BattleUtil.FP_Mul(role:GetRoleData(RoleDataName.Attack), f3)
  1182. local ar2 = BattleUtil.FP_Mul(damage, f1)
  1183. role:AddBuff(Buff.Create(role, BuffName.PropertyChange, f2, RoleDataName.Attack, floor(min(ar1, ar2)), 1))
  1184. end
  1185. end
  1186. role.Event:AddEvent(BattleEventName.RoleBeHit, OnBeHit)
  1187. end,
  1188. --发动技能后,有[a]的概率为自身及相邻加持[b][c]%的护盾,持续[d]秒。
  1189. --a[float],b[属性],c[float],d[int]
  1190. [62] = function(role, args, delay)
  1191. local f1 = args[1]
  1192. local pro = args[2]
  1193. local f2 = args[3]
  1194. local f3 = args[4]
  1195. local OnSkillCastEnd = function(skill)
  1196. BattleLogic.WaitForTrigger(delay, function ()
  1197. BattleUtil.RandomAction2(f1, function ()
  1198. local list = RoleManager.GetNeighbor(role, 1)
  1199. for i=1, #list do
  1200. local val = floor(BattleUtil.FP_Mul(role:GetRoleData(BattlePropList[pro]), f2))
  1201. list[i]:AddBuff(Buff.Create(role, BuffName.Shield, f3, ShieldTypeName.NormalReduce, val, 0))
  1202. end
  1203. end)
  1204. end)
  1205. end
  1206. role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
  1207. end,
  1208. --自身拥有护盾时,我方角色每次释放技能后,有[a]概率回复[b]%的[c]的治疗。
  1209. --a[float],b[float],c[属性]
  1210. [63] = function(role, args, delay)
  1211. local f1 = args[1]
  1212. local f2 = args[2]
  1213. local pro1 = args[3]
  1214. BattleLogic.Event:AddEvent(BattleEventName.SkillCastEnd, function (skill)
  1215. BattleLogic.WaitForTrigger(delay, function ()
  1216. if skill.owner.isTeam then
  1217. return
  1218. end
  1219. if skill.owner.camp == role.camp then
  1220. if BattleLogic.BuffMgr:HasBuff(role, BuffName.Shield, function (buff) return true end) then
  1221. BattleUtil.RandomAction2(f1, function ()
  1222. local val = floor(BattleUtil.FP_Mul(role:GetRoleData(BattlePropList[pro1]), f2))
  1223. BattleUtil.CalTreat(role, skill.owner, val)
  1224. end)
  1225. end
  1226. end
  1227. end)
  1228. end)
  1229. end,
  1230. --基于生命损失的百分比,受到的伤害降低[b]%。
  1231. --a[float]
  1232. [64] = function(role, args, delay)
  1233. local f1 = args[1]
  1234. local OnPassiveDamaging = function(damagingFunc, atkRole, damage)
  1235. damagingFunc(floor(BattleUtil.FP_Mul(f1, damage,1-BattleUtil.GetHPPencent(role))))
  1236. end
  1237. role.Event:AddEvent(BattleEventName.PassiveBeDamaging, OnPassiveDamaging)
  1238. end,
  1239. --我方角色死亡时,对击杀者造成[a]%的[b]伤害,令其眩晕,持续[c]秒。
  1240. --a[float],b[伤害类型],c[int]
  1241. [65] = function(role, args, delay)
  1242. local f1 = args[1]
  1243. local dt = args[2]
  1244. local f2 = args[3]
  1245. BattleLogic.Event:AddEvent(BattleEventName.BattleRoleDead, function (defRole, atkRole)
  1246. if role:IsDead() or atkRole.isTeam then
  1247. return
  1248. end
  1249. if defRole.camp == role.camp then
  1250. BattleUtil.CalDamage(nil, role, atkRole, dt, f1)
  1251. BattleUtil.RandomControl(1, ControlType.Dizzy, role, atkRole, f2)
  1252. end
  1253. end)
  1254. end,
  1255. --免疫减益状态。
  1256. --无
  1257. [66] = function(role, args, delay)
  1258. role.buffFilter:Add(function(buff)
  1259. return buff.isDeBuff
  1260. end)
  1261. end,
  1262. --敌方累计发动[a]次技能,有[b]概率发动(发动特效),对敌方全体造成眩晕效果,持续[c]秒。然后清空累计次数。播放攻击特效,特效时间[d]秒。
  1263. --a[int],b[float],c[float]
  1264. [67] = function(role, args, delay)
  1265. local i1 = args[1]
  1266. local f1 = args[2]
  1267. local f2 = args[3]
  1268. local f3 = args[4]
  1269. local count = 0
  1270. BattleLogic.Event:AddEvent(BattleEventName.SkillCast, function (skill)
  1271. BattleLogic.WaitForTrigger(delay, function ()
  1272. if skill.owner.isTeam or role:IsDead() then
  1273. return
  1274. end
  1275. if skill.owner.camp ~= role.camp then
  1276. count = count + 1
  1277. if count == i1 then
  1278. BattleUtil.RandomAction2(f1, function ()--
  1279. role.Event:DispatchEvent(BattleEventName.AOE, 1-role.camp)
  1280. BattleLogic.WaitForTrigger(f3, function ()
  1281. local arr = BattleUtil.ChooseTarget(role, 20000)
  1282. for i=1, #arr do
  1283. BattleUtil.RandomControl(1, ControlType.Dizzy, role, arr[i], f2)
  1284. end
  1285. end)
  1286. end)
  1287. count = 0
  1288. end
  1289. end
  1290. end)
  1291. end)
  1292. end,
  1293. --受到伤害后,[a]概率为自身施加[b]的[c]%的护盾。持续[d]秒。
  1294. --a[float],b[属性],c[float],d[int]
  1295. [68] = function(role, args, delay)
  1296. local f1 = args[1]
  1297. local pro1 = args[2]
  1298. local f2 = args[3]
  1299. local f3 = args[4]
  1300. local OnBeHit = function(atkRole, damage, bCrit, finalDmg, damageType)
  1301. BattleLogic.WaitForTrigger(delay, function ()
  1302. BattleUtil.RandomAction2(f1, function ()
  1303. local val = floor(BattleUtil.FP_Mul(role:GetRoleData(BattlePropList[pro1]), f2))
  1304. role:AddBuff(Buff.Create(role, BuffName.Shield, f3, ShieldTypeName.NormalReduce, val, 0))
  1305. end)
  1306. end)
  1307. end
  1308. role.Event:AddEvent(BattleEventName.RoleBeHit, OnBeHit)
  1309. end,
  1310. --造成暴击时,额外造成目标最大生命值[a]%的伤害。造成伤害时,有[a]的概率立即造成攻击[b]%的伤害,该伤害造成的暴击伤害不会触发额外最大生命值伤害。(效果55+效果56)(目标最大生命值伤害总上限为施法者5倍攻击)
  1311. --a[float],b[float],c[float]
  1312. [69] = function(role, args, delay)
  1313. local f1 = args[1]
  1314. local f2 = args[2]
  1315. local f3 = args[3]
  1316. local lastTrigger = 0
  1317. local OnDamage = function(defRole, damage, bCrit, finalDmg)
  1318. BattleLogic.WaitForTrigger(delay, function ()
  1319. lastTrigger = lastTrigger + 1
  1320. if lastTrigger > 1 then --加入限定避免循环触发
  1321. return
  1322. end
  1323. if bCrit then
  1324. local ar1 = BattleUtil.FP_Mul(defRole:GetRoleData(RoleDataName.MaxHp), f1)
  1325. local ar2 = BattleUtil.FP_Mul(role:GetRoleData(RoleDataName.Attack), 5)
  1326. BattleUtil.ApplyDamage(nil, role, defRole, floor(min(ar1, ar2)))
  1327. else
  1328. BattleUtil.RandomAction2(f2, function ()
  1329. local val = floor(BattleUtil.FP_Mul(role:GetRoleData(RoleDataName.Attack), f3))
  1330. BattleUtil.ApplyDamage(nil, role, defRole, val)
  1331. end)
  1332. end
  1333. lastTrigger = 0
  1334. end)
  1335. end
  1336. role.Event:AddEvent(BattleEventName.RoleDamage, OnDamage)
  1337. end,
  1338. --击杀每个敌人会永久增加[a]%的[b],持续[c]秒。(0表示永久)(不可驱散)
  1339. --a[float],b[属性],c[int]
  1340. [70] = function(role, args, delay)
  1341. local f1 = args[1]
  1342. local pro = args[2]
  1343. local f2 = args[3]
  1344. local OnKill = function(defRole)
  1345. local buff = Buff.Create(role, BuffName.PropertyChange, f2, BattlePropList[pro], f1, 2)
  1346. buff.cover = true
  1347. buff.clear = false
  1348. role:AddBuff(buff)
  1349. end
  1350. role.Event:AddEvent(BattleEventName.RoleKill, OnKill)
  1351. end,
  1352. --受击后,[a]对攻击者造成自身[c]%的[d]伤害。
  1353. --a[float],c[float],d[伤害类型]
  1354. [71] = function(role, args, delay)
  1355. local f1 = args[1]
  1356. local f2 = args[2]
  1357. local dt = args[3]
  1358. local lastTrigger = 0
  1359. local OnBeHit = function(atkRole, damage, bCrit, finalDmg, damageType)
  1360. BattleLogic.WaitForTrigger(delay, function ()
  1361. if atkRole.isTeam then
  1362. return
  1363. end
  1364. lastTrigger = lastTrigger + 1
  1365. if lastTrigger > 1 then --加入限定避免循环触发
  1366. return
  1367. end
  1368. BattleUtil.RandomAction2(f1, function ()
  1369. BattleUtil.CalDamage(nil, role, atkRole, dt, f2)
  1370. end)
  1371. lastTrigger = 0
  1372. end)
  1373. end
  1374. role.Event:AddEvent(BattleEventName.RoleBeHit, OnBeHit)
  1375. end,
  1376. --造成的伤害暴击时,有[a]概率在计算伤害时额外计算[b]的暴击伤害。
  1377. --a[float],b[float]
  1378. [72] = function(role, args, delay)
  1379. local f1 = args[1]
  1380. local f2 = args[2]
  1381. local OnPassiveCriting = function(crit)
  1382. BattleLogic.WaitForTrigger(delay, function ()
  1383. BattleUtil.RandomAction2(f1, function ()
  1384. crit(role:GetRoleData(RoleDataName.CritDamageFactor)+f2)
  1385. end)
  1386. end)
  1387. end
  1388. role.Event:AddEvent(BattleEventName.PassiveCriting, OnPassiveCriting)
  1389. end,
  1390. --释放技能时,自己损失[a]%当前生命值,为此次技能增加等量伤害。
  1391. --a[float]
  1392. [73] = function(role, args, delay)
  1393. local f1 = args[1]
  1394. local hp=0
  1395. local OnPassiveDamaging = function(damagingFunc, defRole, damage)
  1396. damagingFunc(-hp)
  1397. end
  1398. local OnSkillCast, OnSkillCastEnd
  1399. OnSkillCast = function(skill)
  1400. hp = floor(BattleUtil.FP_Mul(role:GetRoleData(RoleDataName.Hp), f1))
  1401. role.data:SubValue(RoleDataName.Hp, hp)
  1402. role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
  1403. role.Event:AddEvent(BattleEventName.PassiveDamaging, OnPassiveDamaging)
  1404. end
  1405. OnSkillCastEnd = function(skill)
  1406. BattleLogic.WaitForTrigger(BattleLogic.GameDeltaTime, function () --延迟一帧移除事件,防止触发帧和结束帧为同一帧时,被动未移除
  1407. role.Event:RemoveEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
  1408. role.Event:RemoveEvent(BattleEventName.PassiveDamaging, OnPassiveDamaging)
  1409. end)
  1410. end
  1411. role.Event:AddEvent(BattleEventName.SkillCast, OnSkillCast)
  1412. end,
  1413. --死亡时,为所有我方角色增加[a]%的[b]属性,持续[c]秒。
  1414. --a[float],b[属性],c[int]
  1415. [74] = function(role, args, delay)
  1416. local f1 = args[1]
  1417. local pro = args[2]
  1418. local f2 = args[3]
  1419. local OnDead = function(atkRole)
  1420. local arr = BattleUtil.ChooseTarget(role, 10000)
  1421. for i=1, #arr do
  1422. arr[i]:AddBuff(Buff.Create(role, BuffName.PropertyChange, f2, BattlePropList[pro], f1, 2))
  1423. end
  1424. end
  1425. role.Event:AddEvent(BattleEventName.RoleDead, OnDead)
  1426. end,
  1427. --boss每受到([a]*印记层数)点伤害,为自身永久增加一层印记,每层印记为自身增加[b]点攻击,[c]点护甲和[d]点魔抗。【不可驱散】
  1428. --a[int],b[int],c[int],d[int]
  1429. [75] = function(role, args, delay)
  1430. local i1 = args[1]
  1431. local i2 = args[2]
  1432. local i3 = args[3]
  1433. local i4 = args[4]
  1434. if i1 <= 0 then return end --防止死循环
  1435. local total = 0
  1436. local layer = 0
  1437. local OnBeDamaged = function(atkRole, damage, bCrit, finalDmg, damageType)
  1438. total = total + damage
  1439. local count = 0
  1440. while total >= i1 * layer do
  1441. total = total - i1 * layer
  1442. layer = layer + 1
  1443. count = count + 1
  1444. end
  1445. if count > 0 then
  1446. local buff1 = Buff.Create(role, BuffName.PropertyChange, 0, BattlePropList[1], i2 * count, 1)
  1447. buff1.cover = true
  1448. buff1.layer = count
  1449. buff1.clear = false
  1450. local buff2 = Buff.Create(role, BuffName.PropertyChange, 0, BattlePropList[2], i3 * count, 1)
  1451. buff2.cover = true
  1452. buff2.layer = count
  1453. buff2.clear = false
  1454. local buff3 = Buff.Create(role, BuffName.PropertyChange, 0, BattlePropList[3], i4 * count, 1)
  1455. buff3.cover = true
  1456. buff3.layer = count
  1457. buff3.clear = false
  1458. role:AddBuff(buff1)
  1459. role:AddBuff(buff2)
  1460. role:AddBuff(buff3)
  1461. end
  1462. end
  1463. role.Event:AddEvent(BattleEventName.RoleBeDamaged, OnBeDamaged)
  1464. end,
  1465. --战斗中,若自己是[a],[d]改变[b]属性[c]。
  1466. --a[职业],b[属性],c[float],d[改变类型]
  1467. [76] = function(role, args, delay)
  1468. local i1 = args[1]
  1469. local pro = args[2]
  1470. local f1 = args[3]
  1471. local ct = args[4]
  1472. if role.roleData.professionId == i1 then
  1473. if ct == 1 then --加算
  1474. role.data:AddValue(BattlePropList[pro], f1)
  1475. elseif ct == 2 then --乘加算(百分比属性加算)
  1476. role.data:AddPencentValue(BattlePropList[pro], f1)
  1477. elseif ct == 3 then --减算
  1478. role.data:SubValue(BattlePropList[pro], f1)
  1479. elseif ct == 4 then --乘减算(百分比属性减算)
  1480. role.data:SubPencentValue(BattlePropList[pro], f1)
  1481. end
  1482. end
  1483. end,
  1484. --战斗开始时,为自身施加[a]*[b]的护盾,持续[c]秒(0为无限)。
  1485. --a[属性],b[float],c[int]
  1486. [77] = function(role, args, delay)
  1487. local pro1 = args[1]
  1488. local f1 = args[2]
  1489. local f2 = args[3]
  1490. local val = floor(BattleUtil.FP_Mul(f1, role:GetRoleData(BattlePropList[pro1])))
  1491. role:AddBuff(Buff.Create(role, BuffName.Shield, f2, ShieldTypeName.NormalReduce, val, 0))
  1492. end,
  1493. --战斗开始时,为自身回复[a]*[b]的血量。
  1494. --a[属性],b[float]
  1495. [78] = function(role, args, delay)
  1496. local pro = args[1]
  1497. local f1 = args[2]
  1498. local val = floor(BattleUtil.FP_Mul(f1, role:GetRoleData(BattlePropList[pro])))
  1499. BattleUtil.CalTreat(role, role, val)
  1500. end,
  1501. --战斗结束时,为自身回复[a]*[b]的血量。
  1502. --a[属性],b[float]
  1503. [79] = function(role, args, delay)
  1504. local pro = args[1]
  1505. local f1 = args[2]
  1506. local OnEnd = function(order)
  1507. if order == BattleLogic.TotalOrder then
  1508. local val = floor(BattleUtil.FP_Mul(f1, role:GetRoleData(BattlePropList[pro])))
  1509. BattleUtil.CalTreat(role, role, val)
  1510. end
  1511. end
  1512. BattleLogic.Event:AddEvent(BattleEventName.BattleOrderEnd, OnEnd)
  1513. end,
  1514. --战斗中,若自己是[a],[d]改变[b]属性[c]。-- 2020/3/6 高鑫
  1515. --a[元素],b[属性],c[float],d[改变类型]
  1516. [80] = function(role, args, delay)
  1517. local i1 = args[1]
  1518. local pro = args[2]
  1519. local f1 = args[3]
  1520. local ct = args[4]
  1521. if role.roleData.element == i1 then
  1522. if ct == 1 then --加算
  1523. role.data:AddValue(BattlePropList[pro], f1)
  1524. elseif ct == 2 then --乘加算(百分比属性加算)
  1525. role.data:AddPencentValue(BattlePropList[pro], f1)
  1526. elseif ct == 3 then --减算
  1527. role.data:SubValue(BattlePropList[pro], f1)
  1528. elseif ct == 4 then --乘减算(百分比属性减算)
  1529. role.data:SubPencentValue(BattlePropList[pro], f1)
  1530. end
  1531. end
  1532. end,
  1533. -- [a]增加[b], [c]改变
  1534. -- a[属性]b[float]
  1535. [90] = function(role, args, delay)
  1536. local pro = args[1]
  1537. local f1 = args[2]
  1538. local ct = args[3]
  1539. role.data:CountValue(BattlePropList[pro], f1, ct)
  1540. end,
  1541. -- 技能伤害增加[a]%,[b]改变
  1542. -- a[float]b[改变类型]
  1543. [91] = function(role, args, delay)
  1544. local f1 = args[1]
  1545. local ct = args[2]
  1546. local passivityDamaging = function(func, caster, damage)
  1547. if func then
  1548. local dd = BattleUtil.CountValue(damage, f1, ct) - damage
  1549. func(-floor(BattleUtil.ErrorCorrection(dd)))
  1550. end
  1551. end
  1552. local OnSkillCast = function(skill)
  1553. if skill.type == BattleSkillType.Special then
  1554. role.Event:AddEvent(BattleEventName.PassiveDamaging, passivityDamaging)
  1555. end
  1556. end
  1557. local OnSkillCastEnd = function(skill)
  1558. if skill.type == BattleSkillType.Special then
  1559. role.Event:RemoveEvent(BattleEventName.PassiveDamaging, passivityDamaging)
  1560. end
  1561. end
  1562. role.Event:AddEvent(BattleEventName.SkillCast, OnSkillCast)
  1563. role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
  1564. end,
  1565. -- (直接伤害(目前没有明确定义直接伤害))直接伤害击杀目标自身增加[a]点怒气
  1566. -- a[int]
  1567. [92] = function(role, args, delay)
  1568. local i1 = args[1]
  1569. local OnRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill)
  1570. -- local buff = Buff.Create(role, BuffName.PropertyChange, 0, BattlePropList[pro], i1, 1)
  1571. -- buff.cover = true -- 可以叠加
  1572. -- buff.clear = false -- 不可驱散
  1573. -- role:AddBuff(buff)
  1574. if skill and not skill.isAdd and defRole:IsDead() and BattleUtil.CheckIsNoDead(defRole) then
  1575. role:AddRage(i1, CountTypeName.Add)
  1576. end
  1577. end
  1578. role.Event:AddEvent(BattleEventName.RoleHit, OnRoleHit)
  1579. end,
  1580. -- 技能治疗量增加[a]
  1581. -- a[float]
  1582. [93] = function(role, args, delay)
  1583. local f1 = args[1]
  1584. local passiveTreating = function(func, caster)
  1585. if func then func(f1, CountTypeName.AddPencent) end
  1586. end
  1587. local OnSkillCast = function(skill)
  1588. if skill.type == BattleSkillType.Special then
  1589. role.Event:AddEvent(BattleEventName.PassiveTreating, passiveTreating)
  1590. end
  1591. end
  1592. local OnSkillCastEnd = function(skill)
  1593. if skill.type == BattleSkillType.Special then
  1594. role.Event:RemoveEvent(BattleEventName.PassiveTreating, passiveTreating)
  1595. end
  1596. end
  1597. role.Event:AddEvent(BattleEventName.SkillCast, OnSkillCast)
  1598. role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
  1599. end,
  1600. -- 全体上阵武将增加[a][b] [c]改变
  1601. -- a[float]b[属性]c[改变类型]
  1602. [94] = function(role, args, delay)
  1603. local f1 = args[1]
  1604. local pro = args[2]
  1605. local ct = args[3]
  1606. local list = RoleManager.Query(function(v) return role.camp == v.camp end)
  1607. for _, r in pairs(list) do
  1608. r.data:CountValue(BattlePropList[pro], f1, ct)
  1609. end
  1610. end,
  1611. -- 行动后增加[a]点怒气
  1612. -- a[int]
  1613. [95] = function(role, args, delay)
  1614. local i1 = args[1]
  1615. -- 行动结束后
  1616. local onTurnEnd = function()
  1617. role:AddRage(i1, CountTypeName.Add)
  1618. end
  1619. role.Event:AddEvent(BattleEventName.RoleTurnEnd, onTurnEnd)
  1620. end,
  1621. -- 普攻伤害增加[a]%[b]改变
  1622. -- a[float]b[改变类型]
  1623. [96] = function(role, args, delay)
  1624. local f1 = args[1]
  1625. local ct = args[2]
  1626. local passivityDamaging = function(func, caster, damage)
  1627. if func then
  1628. local dd = BattleUtil.CountValue(damage, f1, ct) - damage
  1629. func(-floor(BattleUtil.ErrorCorrection(dd)))
  1630. end
  1631. end
  1632. local OnSkillCast = function(skill)
  1633. if skill.type == BattleSkillType.Normal then
  1634. role.Event:AddEvent(BattleEventName.PassiveDamaging, passivityDamaging)
  1635. end
  1636. end
  1637. local OnSkillCastEnd = function(skill)
  1638. if skill.type == BattleSkillType.Normal then
  1639. role.Event:RemoveEvent(BattleEventName.PassiveDamaging, passivityDamaging)
  1640. end
  1641. end
  1642. role.Event:AddEvent(BattleEventName.SkillCast, OnSkillCast)
  1643. role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
  1644. end,
  1645. -- 释放技能有[a]%对全体造成[c]%[d]伤害
  1646. -- a[float]b[int]c[float]d[伤害类型]
  1647. [97] = function(role, args, delay)
  1648. local f1 = args[1]
  1649. local f2 = args[2]
  1650. local dt = args[3]
  1651. -- 释放技能后
  1652. local onSkillEnd = function(skill)
  1653. BattleLogic.WaitForTrigger(delay, function ()
  1654. if skill and skill.type == BattleSkillType.Special then
  1655. BattleUtil.RandomAction2(f1, function()
  1656. BattleLogic.WaitForTrigger(0.1, function()
  1657. local list = RoleManager.Query(function(v)
  1658. return v.camp == (role.camp + 1) % 2
  1659. end)
  1660. for _, r in ipairs(list) do
  1661. BattleUtil.CalDamage(nil, role, r, dt, f2)
  1662. end
  1663. end)
  1664. end)
  1665. end
  1666. end)
  1667. end
  1668. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd)
  1669. end,
  1670. -- 释放技能[a]概率不消耗怒气
  1671. -- a[float]
  1672. [98] = function(role, args, delay)
  1673. local f1 = args[1]
  1674. local onRageCost = function(noCostRate, costRage, func)
  1675. local dRate = f1
  1676. local dCost = 0
  1677. if func then func(dRate, dCost) end
  1678. end
  1679. role.Event:AddEvent(BattleEventName.RoleRageCost, onRageCost)
  1680. end,
  1681. -- 技能直接伤害的[a]%治疗友方生命最少队友。
  1682. -- a[float]
  1683. [99] = function(role, args, delay)
  1684. local f1 = args[1]
  1685. local allDamage = 0
  1686. local OnHit = function(atkRole, damage, bCrit, finalDmg, damageType, skill)
  1687. if skill and skill.type == BattleSkillType.Special then
  1688. allDamage = allDamage + finalDmg
  1689. end
  1690. end
  1691. local function onSkillCast(skill)
  1692. if skill.type == BattleSkillType.Special then
  1693. allDamage = 0
  1694. role.Event:AddEvent(BattleEventName.RoleHit, OnHit)
  1695. end
  1696. end
  1697. local function onSkillCastEnd(skill)
  1698. if skill.type == BattleSkillType.Special then
  1699. role.Event:RemoveEvent(BattleEventName.RoleHit, OnHit)
  1700. local arr = RoleManager.Query(function (r) return r.camp == role.camp end)
  1701. BattleUtil.SortByHpFactor(arr, 1)
  1702. -- 检测技能伤害治疗加成
  1703. local f = BattleUtil.CheckSkillDamageHeal(f1, role, arr[1])
  1704. -- 治疗血量最低队友实际伤害的f1%
  1705. BattleUtil.ApplyTreat(role, arr[1], floor(BattleUtil.ErrorCorrection(allDamage*f)))
  1706. -- 清空伤害记录
  1707. allDamage = 0
  1708. end
  1709. end
  1710. role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
  1711. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillCastEnd)
  1712. end,
  1713. -- 释放技能不消耗怒气几率[a]改变[b]%
  1714. -- a[改变类型]b[float]
  1715. [100] = function(role, args, delay)
  1716. local ct = args[1]
  1717. local f1 = args[2]
  1718. local onRageCost = function(noCostRate, costRage, func)
  1719. local dRate = BattleUtil.CountValue(noCostRate, f1, ct) - noCostRate
  1720. dRate = BattleUtil.ErrorCorrection(dRate)
  1721. local dCost = 0
  1722. if func then func(dRate, dCost) end
  1723. end
  1724. role.Event:AddEvent(BattleEventName.RoleRageCost, onRageCost)
  1725. end,
  1726. -- 释放技能技能[a]概率[b]改变[c]%
  1727. -- a[控制状态]b[改变类型]c[float]
  1728. [101] = function(role, args, delay)
  1729. local ctl = args[1]
  1730. local ct = args[2]
  1731. local f1 = args[3]
  1732. local onSkillControl = function(func, ctrl)
  1733. if ctrl == ctl then
  1734. if func then func(f1, ct) end
  1735. end
  1736. end
  1737. local onSkillCast = function(skill)
  1738. if skill.type == BattleSkillType.Special then
  1739. role.Event:AddEvent(BattleEventName.PassiveRandomControl, onSkillControl)
  1740. end
  1741. end
  1742. local onSkillCastEnd = function(skill)
  1743. if skill.type == BattleSkillType.Special then
  1744. role.Event:RemoveEvent(BattleEventName.PassiveRandomControl, onSkillControl)
  1745. end
  1746. end
  1747. role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
  1748. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillCastEnd)
  1749. end,
  1750. -- 释放技能后追加[a]次普攻
  1751. -- a[int]
  1752. [102] = function(role, args, delay)
  1753. local i1 = args[1]
  1754. -- 释放技能后
  1755. local onSkillEnd = function(skill)
  1756. if skill.type == BattleSkillType.Special then
  1757. for i = 1, i1 do
  1758. role:AddSkill(BattleSkillType.Normal, false, true, nil)
  1759. end
  1760. end
  1761. end
  1762. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd)
  1763. end,
  1764. -- 直接伤害每次击杀目标增加[a]%的[b]可叠加持续至战斗结束[c]改变
  1765. -- a[float]b[属性]c[改变类型]
  1766. [103] = function(role, args, delay)
  1767. local f1 = args[1]
  1768. local pro = args[2]
  1769. local ct = args[3]
  1770. -- 释放技能后
  1771. local onRoleHit = function(defRole)
  1772. if defRole:IsDead() and BattleUtil.CheckIsNoDead(defRole) then
  1773. local buff = Buff.Create(role, BuffName.PropertyChange, 0, BattlePropList[pro], f1, ct)
  1774. -- buff.cover = true
  1775. role:AddBuff(buff)
  1776. end
  1777. end
  1778. role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit)
  1779. end,
  1780. -- 释放技能后给除自己外己方生命最少的武将附加无敌盾持续[b]回合(只剩自己则不加)
  1781. --b[属性]
  1782. [104] = function(role, args, delay)
  1783. local i1 = args[1]
  1784. -- 释放技能后
  1785. local onSkillEnd = function(skill)
  1786. if skill.type == BattleSkillType.Special then
  1787. local list = RoleManager.Query(function(v) return v.camp == role.camp end)
  1788. BattleUtil.SortByHpFactor(list, 1)
  1789. local target = nil
  1790. for i = 1, #list do
  1791. if not list[i]:IsRealDead() and list[i] ~= role then
  1792. target = list[i]
  1793. break
  1794. end
  1795. end
  1796. if target then
  1797. target:AddBuff(Buff.Create(role, BuffName.Shield, i1, ShieldTypeName.AllReduce, 0, 0))
  1798. end
  1799. end
  1800. end
  1801. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd)
  1802. end,
  1803. -- 释放技能后增加友方全体[a]点怒气
  1804. -- a[int]
  1805. [105] = function(role, args, delay)
  1806. local i1 = args[1]
  1807. -- 释放技能后
  1808. local onSkillEnd = function(skill)
  1809. if skill.type == BattleSkillType.Special then
  1810. local list = RoleManager.Query(function(v) return v.camp == role.camp end)
  1811. for i = 1, #list do
  1812. local r = list[i]
  1813. r:AddRage(i1, CountTypeName.Add)
  1814. end
  1815. end
  1816. end
  1817. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd)
  1818. end,
  1819. -- 受到直接伤害[a]%治疗友方[b]最少[c]个单位
  1820. -- a[float]b[属性]c[int]
  1821. [106] = function(role, args, delay)
  1822. local f1 = args[1]
  1823. local pro = args[2]
  1824. local i1 = args[3]
  1825. local onBeHit = function(caster, damage)
  1826. local list = RoleManager.Query(function(v) return v.camp == role.camp end)
  1827. list = BattleUtil.SortByProp(list, BattlePropList[pro], 1)
  1828. for i = 1, i1 do
  1829. local r = list[i]
  1830. if r and not r:IsRealDead() then
  1831. local treatValue = floor(BattleUtil.ErrorCorrection(f1 * damage))
  1832. BattleUtil.ApplyTreat(role, r, treatValue)
  1833. end
  1834. end
  1835. end
  1836. role.Event:AddEvent(BattleEventName.RoleBeHit, onBeHit)
  1837. end,
  1838. -- 释放技能后自身回[a]点怒气
  1839. -- a[int]
  1840. [107] = function(role, args, delay)
  1841. local i1 = args[1]
  1842. -- 释放技能后
  1843. local onSkillEnd = function(skill)
  1844. if skill.type == BattleSkillType.Special then
  1845. role:AddRage(i1, CountTypeName.Add)
  1846. end
  1847. end
  1848. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd)
  1849. end,
  1850. -- 受到技能或普攻直接伤害的[a]%反弹给攻击者
  1851. -- a[float]
  1852. [108] = function(role, args, delay)
  1853. local f1 = args[1]
  1854. local onBeHit = function(caster, damage, bCrit, finalDmg, damageType, skill)
  1855. if skill then --技能造成的直接伤害
  1856. local rDamage = f1 * damage
  1857. -- 计算被动技能额外加乘
  1858. local cl = {}
  1859. local function _CallBack(v, ct)
  1860. if v then
  1861. table.insert(cl, {v, ct})
  1862. end
  1863. end
  1864. role.Event:DispatchEvent(BattleEventName.PassiveRebackDamage, _CallBack)
  1865. caster.Event:DispatchEvent(BattleEventName.PassiveBeRebackDamage, _CallBack)
  1866. rDamage = floor(BattleUtil.ErrorCorrection(BattleUtil.CountChangeList(rDamage, cl)))
  1867. if rDamage ~= 0 then
  1868. BattleUtil.ApplyDamage(nil, role, caster, rDamage)
  1869. end
  1870. end
  1871. end
  1872. role.Event:AddEvent(BattleEventName.RoleBeHit, onBeHit)
  1873. end,
  1874. -- 受到普通攻击或直接伤害时回复自身[a]点怒气
  1875. -- a[int]
  1876. [109] = function(role, args, delay)
  1877. local i1 = args[1]
  1878. local onBeSkillCastEnd = function(skill)
  1879. if skill.type == BattleSkillType.Normal then
  1880. role:AddRage(i1, CountTypeName.Add)
  1881. end
  1882. end
  1883. role.Event:AddEvent(BattleEventName.BeSkillCastEnd, onBeSkillCastEnd)
  1884. end,
  1885. -- 释放技能后降低目标[a]点怒气
  1886. -- a[int]
  1887. [110] = function(role, args, delay)
  1888. local i1 = args[1]
  1889. -- 释放技能后
  1890. local onSkillEnd = function(skill)
  1891. if skill.type == BattleSkillType.Special then
  1892. local list = skill:GetDirectTargetsNoMiss()
  1893. if list then
  1894. for i = 1, #list do
  1895. list[i]:AddRage(i1, CountTypeName.Sub)
  1896. end
  1897. end
  1898. end
  1899. end
  1900. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd)
  1901. end,
  1902. -- 被击杀时[a]%概率[b]敌方武将[c]回合
  1903. -- a[float]b[控制状态]c[int]
  1904. [111] = function(role, args, delay)
  1905. local f1 = args[1]
  1906. local ctl = args[2]
  1907. local i1 = args[3]
  1908. local onRoleBeDamaged = function(caster, damage, bCrit, finalDmg, damageType, dotType, skill)
  1909. if role:IsDead() and skill then
  1910. BattleUtil.RandomControl(f1, ctl, role, caster, i1)
  1911. end
  1912. end
  1913. role.Event:AddEvent(BattleEventName.RoleBeDamaged, onRoleBeDamaged)
  1914. end,
  1915. -- 战斗第[a]回合造成伤害必定暴击
  1916. -- a[int]
  1917. [112] = function(role, args, delay)
  1918. local i1 = args[1]
  1919. local function onRoleDamageAfter(target)
  1920. target.isFlagCrit = false
  1921. role.Event:RemoveEvent(BattleEventName.RoleDamageAfter, onRoleDamageAfter)
  1922. end
  1923. local function onRoleDamageBefore(target)
  1924. if BattleLogic.GetCurRound() == i1 then
  1925. target.isFlagCrit = true
  1926. role.Event:AddEvent(BattleEventName.RoleDamageAfter, onRoleDamageAfter)
  1927. end
  1928. end
  1929. role.Event:AddEvent(BattleEventName.RoleDamageBefore, onRoleDamageBefore)
  1930. end,
  1931. -- 追加的普攻[a]%概率暴击
  1932. -- a[float]
  1933. [113] = function(role, args, delay)
  1934. local f1 = args[1]
  1935. local function onSkillCast(skill)
  1936. if skill.type == BattleSkillType.Normal and skill.isAdd then
  1937. role.data:AddValue(RoleDataName.Crit, f1)
  1938. end
  1939. end
  1940. role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
  1941. local function onSkillCastEnd(skill)
  1942. if skill.type == BattleSkillType.Normal and skill.isAdd then
  1943. role.data:SubValue(RoleDataName.Crit, f1)
  1944. end
  1945. end
  1946. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillCastEnd)
  1947. end,
  1948. -- 直接伤害击杀目标后追加[a]次普攻
  1949. -- a[int]
  1950. [114] = function(role, args, delay)
  1951. local i1 = args[1]
  1952. -- 释放技能后
  1953. local onRoleHit = function(target)
  1954. if target:IsDead() and BattleUtil.CheckIsNoDead(target) then
  1955. for i = 1, i1 do
  1956. role:AddSkill(BattleSkillType.Normal, false, true, nil)
  1957. end
  1958. end
  1959. end
  1960. role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit)
  1961. end,
  1962. -- 战斗第[a]回合增加[c]%的自身伤害持续[e]回合,[f]改变
  1963. -- a[int]c[float]e[int]f[改变]
  1964. [115] = function(role, args, delay)
  1965. local i1 = args[1]
  1966. local f1 = args[2]
  1967. local i2 = args[3] or 1
  1968. local ct = args[4]
  1969. -- 如果是技能的伤害则判断加成
  1970. local onPassiveDamaging = function(func, target, damage, skill)
  1971. if skill then
  1972. local dd = BattleUtil.CountValue(damage, f1, ct) - damage
  1973. if func then func(-floor(BattleUtil.ErrorCorrection(dd))) end
  1974. end
  1975. end
  1976. BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, function(curRound)
  1977. -- 第i1回合开始
  1978. if curRound == i1 then
  1979. role.Event:AddEvent(BattleEventName.PassiveDamaging, onPassiveDamaging)
  1980. end
  1981. -- 第i1+i2回合结束
  1982. if curRound == i1 + i2 then
  1983. role.Event:RemoveEvent(BattleEventName.PassiveDamaging, onPassiveDamaging)
  1984. end
  1985. end)
  1986. end,
  1987. -- 直接伤害击杀目标回复自身[a]%的[b]
  1988. -- a[float]
  1989. [116] = function(role, args, delay)
  1990. local f1 = args[1]
  1991. -- 释放技能后
  1992. local onRoleHit = function(target)
  1993. if target:IsDead() and BattleUtil.CheckIsNoDead(target) then
  1994. local treat = floor(BattleUtil.FP_Mul(role:GetRoleData(RoleDataName.MaxHp), f1))
  1995. BattleUtil.CalTreat(role, role, treat)
  1996. end
  1997. end
  1998. role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit)
  1999. end,
  2000. -- 技能目标每[a]改变[b]个,技能伤害增加[c]%,[d]改变
  2001. -- a[改变类型]b[int]c[float]d[改变类型]
  2002. [117] = function(role, args, delay)
  2003. local ct = args[1] -- 对方阵营中死亡数量(目前没有用到)
  2004. local i1 = args[2]
  2005. local f1 = args[3]
  2006. local ct2 = args[4]
  2007. -- 每次释放技能时提前计算额外加成的伤害
  2008. local extra = 0
  2009. local onSkillCast = function(skill)
  2010. extra = 0
  2011. if skill and skill.type == BattleSkillType.Special then
  2012. -- local roleList =RoleManager.Query(function (r) return r.camp ~= role.camp end)
  2013. -- local deadNum = 6 - #roleList
  2014. -- local level = math.floor(deadNum/i1)
  2015. -- extra = BattleUtil.ErrorCorrection(level * f1)
  2016. -- 改变值 = 技能最大目标数 - 当前目标数
  2017. local maxNum = skill:GetMaxTargetNum()
  2018. local curNum = #skill:GetDirectTargets()
  2019. local lessNum = max(maxNum - curNum, 0)
  2020. local level = math.floor(lessNum/i1)
  2021. extra = BattleUtil.ErrorCorrection(level * f1)
  2022. end
  2023. end
  2024. role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
  2025. -- 如果是技能的伤害则判断加成
  2026. local onPassiveDamaging = function(func, target, damage, skill)
  2027. if skill and skill.type == BattleSkillType.Special then
  2028. local dd = BattleUtil.CountValue(damage, extra, ct2) - damage
  2029. if func then func(-floor(BattleUtil.ErrorCorrection(dd))) end
  2030. end
  2031. end
  2032. role.Event:AddEvent(BattleEventName.PassiveDamaging, onPassiveDamaging)
  2033. end,
  2034. -- 每次释放技能,技能伤害增加[a]%,无限叠加释放普攻时清除加成,[b]改变
  2035. -- a[float]b[改变类型]
  2036. [118] = function(role, args, delay)
  2037. local f1 = args[1]
  2038. local ct = args[2]
  2039. local af = 0
  2040. local onSkillCast = function(skill)
  2041. if skill.type == BattleSkillType.Normal and not skill.isAdd then
  2042. af = 0
  2043. elseif skill.type == BattleSkillType.Special then
  2044. af = af + f1
  2045. end
  2046. end
  2047. role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
  2048. -- 如果是技能的伤害则判断加成
  2049. local onPassiveDamaging = function(func, target, damage, skill)
  2050. if skill and skill.type == BattleSkillType.Special then
  2051. local dd = BattleUtil.CountValue(damage, af, ct) - damage
  2052. if func then func(-floor(BattleUtil.ErrorCorrection(dd))) end
  2053. end
  2054. end
  2055. role.Event:AddEvent(BattleEventName.PassiveDamaging, onPassiveDamaging)
  2056. end,
  2057. -- 普攻后[a]改变自身[b]%的[c]持续[d]回合可叠加
  2058. -- a[改变类型]b[float]c[属性]d[int]
  2059. [119] = function(role, args, delay)
  2060. local ct = args[1]
  2061. local f1 = args[2]
  2062. local pro = args[3]
  2063. local i1 = args[4]
  2064. -- 释放技能后
  2065. local onSkillEnd = function(skill)
  2066. if skill.type == BattleSkillType.Normal then
  2067. local buff = Buff.Create(role, BuffName.PropertyChange, i1, BattlePropList[pro], f1, ct)
  2068. buff.cover = true
  2069. role:AddBuff(buff)
  2070. end
  2071. end
  2072. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd)
  2073. end,
  2074. -- 受到直接伤害[a]%治疗友方全体
  2075. -- a[float]
  2076. [120] = function(role, args, delay)
  2077. local f1 = args[1]
  2078. local onBeHit = function(caster, damage)
  2079. local list = RoleManager.Query(function(v) return v.camp == role.camp end)
  2080. for i = 1, #list do
  2081. local r = list[i]
  2082. if r and not r:IsDead() then
  2083. local treatValue = floor(BattleUtil.ErrorCorrection(f1 * damage))
  2084. BattleUtil.ApplyTreat(role, r, treatValue)
  2085. end
  2086. end
  2087. end
  2088. role.Event:AddEvent(BattleEventName.RoleBeHit, onBeHit)
  2089. end,
  2090. -- 普攻后回复[a]点怒气
  2091. -- a[int]
  2092. [121] = function(role, args, delay)
  2093. local i1 = args[1]
  2094. -- 释放技能后
  2095. local onSkillEnd = function(skill)
  2096. if skill.type == BattleSkillType.Normal then
  2097. role:AddRage(i1, CountTypeName.Add)
  2098. end
  2099. end
  2100. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd)
  2101. end,
  2102. -- 释放技能后给己方前排武将附加减伤盾持续时间[a]改变[b]回合
  2103. -- a[改变类型]b[int]
  2104. [122] = function(role, args, delay)
  2105. local ct = args[1]
  2106. local i1 = args[2]
  2107. -- 释放技能后
  2108. local onSkillEnd = function(skill)
  2109. if skill.type == BattleSkillType.Special then
  2110. local list = RoleManager.Query(function(v) return v.camp == role.camp and v.position <= 3 end)
  2111. for _, role in ipairs(list) do
  2112. BattleLogic.BuffMgr:QueryBuff(role, function(buff)
  2113. if buff.type == BuffName.Shield and buff.shieldType == ShieldTypeName.RateReduce then
  2114. buff:ChangeBuffDuration(ct, i1)
  2115. end
  2116. end)
  2117. end
  2118. end
  2119. end
  2120. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd)
  2121. end,
  2122. -- 释放技能后给己方前排附加减伤盾效果[a]改变[b]%
  2123. -- a[改变类型]b[float]
  2124. [123] = function(role, args, delay)
  2125. local ct = args[1]
  2126. local f1 = args[2]
  2127. -- 释放技能后
  2128. local onSkillEnd = function(skill)
  2129. if skill.type == BattleSkillType.Special then
  2130. local list = RoleManager.Query(function(v) return v.camp == role.camp and v.position <= 3 end)
  2131. for _, role in ipairs(list) do
  2132. BattleLogic.BuffMgr:QueryBuff(role, function(buff)
  2133. if buff.type == BuffName.Shield and buff.shieldType == ShieldTypeName.RateReduce then
  2134. buff:ChangeShieldValue(ct, f1)
  2135. end
  2136. end)
  2137. end
  2138. end
  2139. end
  2140. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd)
  2141. end,
  2142. -- 释放技能后回复己方后排[a]点怒气
  2143. -- a[int]
  2144. [124] = function(role, args, delay)
  2145. local i1 = args[1]
  2146. -- 释放技能后
  2147. local onSkillEnd = function(skill)
  2148. if skill.type == BattleSkillType.Special then
  2149. local list = RoleManager.Query(function(v) return v.position > 3 end)
  2150. for _, r in ipairs(list) do
  2151. r:AddRage(i1, CountTypeName.Add)
  2152. end
  2153. end
  2154. end
  2155. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd)
  2156. end,
  2157. -- 直接伤害击杀目标下回合攻击[a]%暴击(TODO:目前为增加[a]%)
  2158. -- a[float]
  2159. [125] = function(role, args, delay)
  2160. local f1 = args[1]
  2161. -- 释放技能后
  2162. local onRoleHit = function(target)
  2163. if target:IsDead() and BattleUtil.CheckIsNoDead(target) then
  2164. local buff = Buff.Create(role, BuffName.PropertyChange, 1, RoleDataName.Crit, f1, CountTypeName.Add)
  2165. role:AddBuff(buff)
  2166. end
  2167. end
  2168. role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit)
  2169. end,
  2170. -- 战斗中生命每减少[c]%,[d]就[e]改变[f]%
  2171. -- c[float]d[属性]e[改变类型]f[float]
  2172. [126] = function(role, args, delay)
  2173. local f1 = args[1]
  2174. local pro = args[2]
  2175. local dt = args[3]
  2176. local f2 = args[4]
  2177. local curLevel = 0
  2178. -- 释放技能后
  2179. local onRoleBeDamaged = function(caster, damage)
  2180. local levelDamage = floor(role:GetRoleData(RoleDataName.MaxHp)*f1)
  2181. local lostDamage = role:GetRoleData(RoleDataName.MaxHp) - role:GetRoleData(RoleDataName.Hp)
  2182. local level = floor(lostDamage/levelDamage)
  2183. if level > curLevel then
  2184. local dl = level - curLevel
  2185. for i = 1, dl do
  2186. local buff = Buff.Create(role, BuffName.PropertyChange, 0, BattlePropList[pro], f2, dt)
  2187. buff.cover = true
  2188. role:AddBuff(buff)
  2189. end
  2190. curLevel = level
  2191. end
  2192. end
  2193. role.Event:AddEvent(BattleEventName.RoleBeDamaged, onRoleBeDamaged)
  2194. end,
  2195. -- 与48相同
  2196. -- [127] = {},
  2197. -- 普攻后降低目标[b]点怒气
  2198. -- a[int]
  2199. [128] = function(role, args, delay)
  2200. local i1 = args[1]
  2201. -- 普攻后
  2202. local onSkillEnd = function(skill)
  2203. if skill.type == BattleSkillType.Normal then
  2204. local list = skill:GetDirectTargetsNoMiss()
  2205. if list then
  2206. for _, r in ipairs(list) do
  2207. r:AddRage(i1, CountTypeName.Sub)
  2208. end
  2209. end
  2210. end
  2211. end
  2212. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd)
  2213. end,
  2214. -- TODO
  2215. -- 全体蜀国武将增加[a]%[b]
  2216. -- a[float]b[属性]
  2217. -- [129] = {},
  2218. -- 死亡后持续战斗两回合期间受伤不致死,[a]回合后自动死亡。期间技能伤害降低[b]%无法触发追击效果且死后无法被复活。受到伤害[c]改变
  2219. -- a[int]b[float]c[改变类型]
  2220. [130] = function(role, args, delay)
  2221. local i1 = args[1]
  2222. local f1 = args[2]
  2223. local ct = args[3]
  2224. -- 角色死亡时
  2225. local onRoleDead = function()
  2226. -- -- 暂时不能死
  2227. -- role:SetDeadFilter(false)
  2228. -- -- 伤害降低
  2229. -- local function onPassiveDamaging(func, target, damage, skill)
  2230. -- if skill and skill.type == BattleSkillType.Special then
  2231. -- local dd = BattleUtil.CountValue(damage, f1, 4) - damage
  2232. -- if func then func(-floor(BattleUtil.ErrorCorrection(dd))) end
  2233. -- end
  2234. -- end
  2235. -- role.Event:AddEvent(BattleEventName.PassiveDamaging, onPassiveDamaging)
  2236. -- -- 自动死亡
  2237. -- local counter = 0
  2238. -- local function onRoleTurnEnd()
  2239. -- counter = counter + 1
  2240. -- if counter == i1 then
  2241. -- -- 可以去死了
  2242. -- role:SetDeadFilter(true)
  2243. -- -- 但是不能复活了
  2244. -- role:SetReliveFilter(false)
  2245. -- -- 移除事件
  2246. -- role.Event:RemoveEvent(BattleEventName.RoleTurnEnd, onRoleTurnEnd)
  2247. -- role.Event:RemoveEvent(BattleEventName.PassiveDamaging, onPassiveDamaging)
  2248. -- end
  2249. -- end
  2250. -- role.Event:AddEvent(BattleEventName.RoleTurnEnd, onRoleTurnEnd)
  2251. local buff = Buff.Create(role, BuffName.NoDead, i1, f1, ct, false)
  2252. BattleLogic.BuffMgr:AddBuff(role, buff)
  2253. end
  2254. role.Event:AddEvent(BattleEventName.RoleDead, onRoleDead)
  2255. end,
  2256. -- 敌方每[a]改变[b]人自身伤害就[d]改变[e]% (敌方每死亡i1个则自身属性改变)
  2257. -- a[改变类型]b[int]d[改变类型]e[float]
  2258. [131] = function(role, args, delay)
  2259. local ct1 = args[1]
  2260. local i1 = args[2]
  2261. local ct2 = args[3]
  2262. local f1 = args[4]
  2263. local deadNum = 0
  2264. local extra = 0
  2265. -- 释放技能后
  2266. local OnDead = function(deadRole)
  2267. if deadRole.camp == (role.camp + 1)%2 then
  2268. deadNum = deadNum + 1
  2269. if deadNum >= i1 then
  2270. deadNum = 0
  2271. extra = extra + f1
  2272. -- local buff = Buff.Create(role, BuffName.PropertyChange, 0, BattlePropList[pro], f1, ct2)
  2273. -- role:AddBuff(buff)
  2274. end
  2275. end
  2276. end
  2277. BattleLogic.Event:AddEvent(BattleEventName.BattleRoleDead, OnDead)
  2278. local passivityDamaging = function(func, caster, damage, skill)
  2279. if skill then
  2280. if func then
  2281. local dd = BattleUtil.CountValue(damage, extra, ct2) - damage
  2282. func(-floor(BattleUtil.ErrorCorrection(dd)))
  2283. end
  2284. end
  2285. end
  2286. role.Event:AddEvent(BattleEventName.PassiveDamaging, passivityDamaging)
  2287. end,
  2288. -- 直接伤害每次击杀目标增加自身伤害[a]%,[b]改变,可叠加持续至战斗结束
  2289. -- a[float]b[改变类型]
  2290. [132] = function(role, args, delay)
  2291. local f1 = args[1]
  2292. local ct = args[2]
  2293. local killNum = 0
  2294. local extra = 0
  2295. -- 击杀数量累加
  2296. local OnRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill)
  2297. if skill and defRole:IsDead() and BattleUtil.CheckIsNoDead(defRole) then
  2298. killNum = killNum + 1
  2299. end
  2300. end
  2301. role.Event:AddEvent(BattleEventName.RoleHit, OnRoleHit)
  2302. -- 释放技能时计算额外伤害
  2303. local OnSkillCast = function(skill)
  2304. if skill then
  2305. extra = f1 * killNum
  2306. end
  2307. end
  2308. role.Event:AddEvent(BattleEventName.SkillCast, OnSkillCast)
  2309. -- 造成伤害时判断额外伤害
  2310. local passivityDamaging = function(func, caster, damage, skill)
  2311. if skill then
  2312. if func then
  2313. local dd = BattleUtil.CountValue(damage, extra, ct) - damage
  2314. func(-floor(BattleUtil.ErrorCorrection(dd)))
  2315. end
  2316. end
  2317. end
  2318. role.Event:AddEvent(BattleEventName.PassiveDamaging, passivityDamaging)
  2319. end,
  2320. -- 攻击时若目标[a]则当次攻击自身[b],[c]改变[d]%
  2321. -- a[持续伤害状态]b[属性]c[改变类型]d[float}
  2322. [133] = function(role, args, delay)
  2323. local dot = args[1]
  2324. local pro = args[2]
  2325. local ct = args[3]
  2326. local f1 = args[4]
  2327. local index, tran
  2328. local OnRoleDamageBefore = function(target)
  2329. if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function(buff) return buff.damageType == dot end) then
  2330. index, tran = role:AddPropertyTransfer(BattlePropList[pro], f1, BattlePropList[pro], ct)
  2331. end
  2332. end
  2333. local OnRoleDamageAfter = function()
  2334. if index and tran then
  2335. role:RemovePropertyTransfer(index, tran)
  2336. end
  2337. end
  2338. role.Event:AddEvent(BattleEventName.RoleDamageBefore, OnRoleDamageBefore)
  2339. role.Event:AddEvent(BattleEventName.RoleDamageAfter, OnRoleDamageAfter)
  2340. end,
  2341. -- 释放技能技能[a]概率[b]改变[c]%
  2342. -- a[持续伤害状态]b[改变类型]c[float]
  2343. [134] = function(role, args, delay)
  2344. local dot = args[1]
  2345. local ct = args[2]
  2346. local f1 = args[3]
  2347. local onSkillControl = function(func, dotType)
  2348. if dotType == dot then
  2349. if func then func(f1, ct) end
  2350. end
  2351. end
  2352. local onSkillCast = function(skill)
  2353. if skill.type == BattleSkillType.Special then
  2354. role.Event:AddEvent(BattleEventName.PassiveRandomDot, onSkillControl)
  2355. end
  2356. end
  2357. -- 技能后后
  2358. local onSkillCastEnd = function(skill)
  2359. if skill.type == BattleSkillType.Special then
  2360. role.Event:RemoveEvent(BattleEventName.PassiveRandomDot, onSkillControl)
  2361. end
  2362. end
  2363. role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
  2364. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillCastEnd)
  2365. end,
  2366. -- 普攻有[a]%概率使目标[b]持续[c]回合(每回合造成攻击者20%攻击力的伤害)
  2367. -- a[float]b[持续伤害状态]c[int]
  2368. [135] = function(role, args, delay)
  2369. local f1 = args[1]
  2370. local dot = args[2]
  2371. local i1 = args[3]
  2372. -- 普攻后
  2373. local onSkillEnd = function(skill)
  2374. if skill.type == BattleSkillType.Normal then
  2375. local list = skill:GetDirectTargetsNoMiss()
  2376. if list then
  2377. local attack = role:GetRoleData(RoleDataName.Attack)
  2378. local damage = floor(BattleUtil.ErrorCorrection(attack * 0.2))
  2379. for _, r in ipairs(list) do
  2380. BattleUtil.RandomDot(f1, dot, role, r, i1, 1, damage)
  2381. end
  2382. end
  2383. end
  2384. end
  2385. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd)
  2386. end,
  2387. -- 受到普攻有[a]%概率使攻击者[b]持续[c]回合(每回合造成攻击者20%攻击力的伤害)
  2388. -- a[float]b[持续伤害状态]c[int]
  2389. [136] = function(role, args, delay)
  2390. local f1 = args[1]
  2391. local dot = args[2]
  2392. local i1 = args[3]
  2393. -- 普攻后
  2394. local onSkillEnd = function(skill)
  2395. if skill.type == BattleSkillType.Normal then
  2396. local caster = skill.owner
  2397. local attack = role:GetRoleData(RoleDataName.Attack)
  2398. local damage = floor(BattleUtil.ErrorCorrection(attack * 0.2))
  2399. BattleUtil.RandomDot(f1, dot, role, caster, i1, 1, damage)
  2400. end
  2401. end
  2402. role.Event:AddEvent(BattleEventName.BeSkillCastEnd, onSkillEnd)
  2403. end,
  2404. -- 释放技能后给目标附加治疗效果每回合回复[a]的[b]%点生命持续[c]回合
  2405. -- a[属性]b[float]c[int]
  2406. [137] = function(role, args, delay)
  2407. local pro = args[1]
  2408. local f1 = args[2]
  2409. local i1 = args[3]
  2410. -- 技能后后
  2411. local onSkillEnd = function(skill)
  2412. if skill.type == BattleSkillType.Special then
  2413. local list = skill:GetDirectTargetsNoMiss()
  2414. if list then
  2415. local tv = floor(BattleUtil.ErrorCorrection(role:GetRoleData(pro) * f1))
  2416. for _, r in ipairs(list) do
  2417. local auraBuff = Buff.Create(role, BuffName.HOT, i1, 1, tv)
  2418. auraBuff.interval = 1
  2419. r:AddBuff(auraBuff)
  2420. end
  2421. end
  2422. end
  2423. end
  2424. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd)
  2425. end,
  2426. -- 释放普攻后给目标附加治疗效果每回合回复[a]的[b]%点生命持续[c]回合
  2427. -- a[属性]b[float]c[int]
  2428. [138] = function(role, args, delay)
  2429. local pro = args[1]
  2430. local f1 = args[2]
  2431. local i1 = args[3]
  2432. -- 技能后后
  2433. local onSkillEnd = function(skill)
  2434. if skill.type == BattleSkillType.Normal then
  2435. local list = skill:GetDirectTargetsNoMiss()
  2436. if list then
  2437. local tv = floor(BattleUtil.ErrorCorrection(role:GetRoleData(pro) * f1))
  2438. for _, r in ipairs(list) do
  2439. local auraBuff = Buff.Create(role, BuffName.HOT, i1, 1, tv)
  2440. auraBuff.interval = 1
  2441. r:AddBuff(auraBuff)
  2442. end
  2443. end
  2444. end
  2445. end
  2446. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd)
  2447. end,
  2448. -- TODO
  2449. -- 释放技能后给目标附加治疗效果[a]改变[b]%
  2450. -- a[改变类型]b[float]
  2451. [139] = function(role, args, delay)
  2452. local dt = args[1]
  2453. local f1 = args[2]
  2454. local tFactor = function(factorFunc)
  2455. factorFunc(f1, dt)
  2456. end
  2457. role.Event:AddEvent(BattleEventName.SkillCast, function(skill)
  2458. if skill.type == BattleSkillType.Special then
  2459. role.Event:AddEvent(BattleEventName.PassiveTreatingFactor, tFactor)
  2460. end
  2461. end)
  2462. role.Event:AddEvent(BattleEventName.SkillCastEnd, function(skill)
  2463. if skill.type == BattleSkillType.Special then
  2464. role.Event:RemoveEvent(BattleEventName.PassiveTreatingFactor, tFactor)
  2465. end
  2466. end)
  2467. end,
  2468. -- 受到[a]状态敌人攻击时受到伤害[b]改变[c]%
  2469. -- a[持续伤害状态]b[改变类型]c[float]
  2470. [140] = function(role, args, delay)
  2471. local dot = args[1]
  2472. local ct = args[2]
  2473. local f1 = args[3]
  2474. local onPassiveBeDamaging = function(func, caster, damage)
  2475. if BattleLogic.BuffMgr:HasBuff(caster, BuffName.DOT, function(buff) return buff.damageType == dot end) then
  2476. local dmgDeduction = damage - floor(BattleUtil.ErrorCorrection(BattleUtil.CountValue(damage, f1, ct)))
  2477. if func then func(dmgDeduction) end
  2478. end
  2479. end
  2480. role.Event:AddEvent(BattleEventName.PassiveBeDamaging, onPassiveBeDamaging)
  2481. end,
  2482. -- 战斗第[a]回合无敌
  2483. -- a[int]
  2484. [141] = function(role, args, delay)
  2485. local i1 = args[1]
  2486. local buff
  2487. BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, function(curRound)
  2488. -- 第i1回合开始
  2489. if curRound == i1 then
  2490. buff = Buff.Create(role, BuffName.Shield, 0, ShieldTypeName.AllReduce, 0, 0)
  2491. buff.clear = false
  2492. role:AddBuff(buff)
  2493. end
  2494. if curRound == i1 + 1 then
  2495. if buff then
  2496. buff.disperse = true
  2497. end
  2498. end
  2499. end)
  2500. end,
  2501. -- 释放技能时如目标处于[a]状态则伤害的[b]%转化为生命治疗自己
  2502. -- a[持续伤害状态]b[float]
  2503. [142] = function(role, args, delay)
  2504. local dot = args[1]
  2505. local f1 = args[2]
  2506. local onHit = function(target, damage, bCrit, finalDmg)
  2507. if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function(buff) return buff.damageType == dot end) then
  2508. BattleUtil.ApplyTreat(role, role, floor(BattleUtil.ErrorCorrection(finalDmg * f1)))
  2509. end
  2510. end
  2511. local onSkillCast = function(skill)
  2512. if skill.type == BattleSkillType.Special then
  2513. role.Event:AddEvent(BattleEventName.RoleHit, onHit)
  2514. end
  2515. end
  2516. -- 技能后后
  2517. local onSkillCastEnd = function(skill)
  2518. if skill.type == BattleSkillType.Special then
  2519. role.Event:RemoveEvent(BattleEventName.RoleHit, onHit)
  2520. end
  2521. end
  2522. role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
  2523. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillCastEnd)
  2524. end,
  2525. -- 释放技能时如目标处于[a]状态则[b]的概率[c]改变[d]%
  2526. -- a[持续伤害状态]b[控制状态]c[改变类型]d[float]
  2527. [143] = function(role, args, delay)
  2528. local dot = args[1]
  2529. local ctrl = args[2]
  2530. local ct = args[3]
  2531. local f1 = args[4]
  2532. local onSkillControl = function(func, ctrl2, target)
  2533. if ctrl2 == ctrl then
  2534. if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function(b) return b.damageType == dot end) then
  2535. if func then func(f1, ct) end
  2536. end
  2537. end
  2538. end
  2539. local onSkillCast = function(skill)
  2540. if skill.type == BattleSkillType.Special then
  2541. role.Event:AddEvent(BattleEventName.PassiveRandomControl, onSkillControl)
  2542. end
  2543. end
  2544. -- 技能后后
  2545. local onSkillCastEnd = function(skill)
  2546. if skill.type == BattleSkillType.Special then
  2547. role.Event:RemoveEvent(BattleEventName.PassiveRandomControl, onSkillControl)
  2548. end
  2549. end
  2550. role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
  2551. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillCastEnd)
  2552. end,
  2553. -- 死亡时释放[a]次技能
  2554. -- a[int]
  2555. [144] = function(role, args, delay)
  2556. local i1 = args[1]
  2557. local function onRoleDead()
  2558. for i = 1, i1 do
  2559. -- 插入一个技能,该技能优先级较高
  2560. role:InsertSkill(BattleSkillType.Special, false, true, nil)
  2561. end
  2562. end
  2563. role.Event:AddEvent(BattleEventName.RoleDead, onRoleDead)
  2564. end,
  2565. -- 技能对[a]目标[b]额外提升[c]%(当次),[d]改变
  2566. -- a[持续伤害状态]b[属性]c[float]d[改变类型]
  2567. [145] = function(role, args, delay)
  2568. local dot = args[1]
  2569. local pro = args[2]
  2570. local f1 = args[3]
  2571. local ct = args[4]
  2572. local index, tran
  2573. local OnRoleDamageBefore = function(target, factorFunc, damageType, skill)
  2574. if skill and skill.type == BattleSkillType.Special and
  2575. BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function(buff) return buff.damageType == dot end) then
  2576. index, tran = role:AddPropertyTransfer(BattlePropList[pro], f1, BattlePropList[pro], ct)
  2577. end
  2578. end
  2579. local OnRoleDamageAfter = function()
  2580. if index and tran then
  2581. role:RemovePropertyTransfer(index, tran)
  2582. end
  2583. end
  2584. role.Event:AddEvent(BattleEventName.RoleDamageBefore, OnRoleDamageBefore)
  2585. role.Event:AddEvent(BattleEventName.RoleDamageAfter, OnRoleDamageAfter)
  2586. end,
  2587. -- 普攻对[a]目标伤害额外增加[b]%(当次),[c]改变
  2588. -- a[持续伤害状态]b[float]c[改变类型]
  2589. [146] = function(role, args, delay)
  2590. local dot = args[1]
  2591. local f1 = args[2]
  2592. local ct = args[3]
  2593. local onPassiveDamaging = function(damagingFunc, defRole, damage)
  2594. if BattleLogic.BuffMgr:HasBuff(defRole, BuffName.DOT, function(buff) return buff.damageType == dot end) then
  2595. if damagingFunc then
  2596. local dd = BattleUtil.CountValue(damage, f1, ct) - damage
  2597. damagingFunc(-floor(BattleUtil.ErrorCorrection(dd)))
  2598. end
  2599. end
  2600. end
  2601. local onSkillCast = function(skill)
  2602. if skill.type == BattleSkillType.Normal then
  2603. role.Event:AddEvent(BattleEventName.PassiveDamaging, onPassiveDamaging)
  2604. end
  2605. end
  2606. local onSkillCastEnd = function(skill)
  2607. if skill.type == BattleSkillType.Normal then
  2608. role.Event:RemoveEvent(BattleEventName.PassiveDamaging, onPassiveDamaging)
  2609. end
  2610. end
  2611. role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
  2612. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillCastEnd)
  2613. end,
  2614. -- 受到攻击有[a]%概率使攻击者[b](每回合造成被击者自身20%攻击力的伤害)持续[c]回合
  2615. -- a[float]b[持续伤害状态]c[int]
  2616. [147] = function(role, args, delay)
  2617. local f1 = args[1]
  2618. local dot = args[2]
  2619. local i1 = args[3]
  2620. -- 技能后后
  2621. local onRoleBeHit = function(caster)
  2622. local attack = role:GetRoleData(RoleDataName.Attack)
  2623. local damage = floor(BattleUtil.ErrorCorrection(attack * 0.2))
  2624. BattleUtil.RandomDot(f1, dot, role, caster, i1, 1, damage)
  2625. end
  2626. role.Event:AddEvent(BattleEventName.RoleBeHit, onRoleBeHit)
  2627. end,
  2628. -- 直接伤害击杀[a]目标回复[b]%的最大生命
  2629. -- a[持续伤害状态]b[float]
  2630. [148] = function(role, args, delay)
  2631. local dot = args[1]
  2632. local f1 = args[2]
  2633. local function onHit(target)
  2634. if target:IsDead() and BattleUtil.CheckIsNoDead(target) then
  2635. local maxHp = role:GetRoleData(RoleDataName.MaxHp)
  2636. local value = floor(BattleUtil.ErrorCorrection(maxHp* f1))
  2637. BattleUtil.ApplyTreat(role, role, value)
  2638. end
  2639. role.Event:RemoveEvent(BattleEventName.RoleHit, onHit)
  2640. end
  2641. local onDamaging = function(func, target)
  2642. if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function(buff) return buff.damageType == dot end) then
  2643. role.Event:AddEvent(BattleEventName.RoleHit, onHit)
  2644. end
  2645. end
  2646. role.Event:AddEvent(BattleEventName.PassiveDamaging, onDamaging)
  2647. end,
  2648. -- 技能攻击的目标如本回合直接攻击过自己则对其造成伤害增加[a]%(如目标[b]则伤害增加[c]%)[d]改变
  2649. -- a[float]b[持续伤害状态]c[float]d[改变类型]
  2650. [149] = function(role, args, delay)
  2651. local f1 = args[1]
  2652. local dot = args[2]
  2653. local f2 = args[3]
  2654. local ct = args[4]
  2655. local attor = {}
  2656. local onRoleBeHit = function(caster)
  2657. if not attor[caster.position] then
  2658. attor[caster.position] = 1
  2659. end
  2660. end
  2661. role.Event:AddEvent(BattleEventName.RoleBeHit, onRoleBeHit)
  2662. local onBattleRoundChange = function(func, caster)
  2663. attor = {}
  2664. end
  2665. BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, onBattleRoundChange)
  2666. -- 被动技能加伤害
  2667. local onDamaging = function(func, target, damage, skill)
  2668. if attor[target.position] and skill and skill.type == BattleSkillType.Special and func then
  2669. local df = f1
  2670. if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function(buff) return buff.damageType == dot end) then
  2671. df = f2
  2672. end
  2673. local dd = BattleUtil.CountValue(damage, df, ct) - damage
  2674. func(-floor(BattleUtil.ErrorCorrection(dd)))
  2675. end
  2676. end
  2677. role.Event:AddEvent(BattleEventName.PassiveDamaging, onDamaging)
  2678. end,
  2679. -- 技能对[a]目标当次伤害提升[b]%,[c]改变
  2680. -- a[持续伤害状态]b[flaot]c[改变类型]
  2681. [150] = function(role, args, delay)
  2682. local dot = args[1]
  2683. local f1 = args[2]
  2684. local ct = args[3]
  2685. local onPassiveDamaging = function(damagingFunc, defRole, damage)
  2686. if BattleLogic.BuffMgr:HasBuff(defRole, BuffName.DOT, function(buff) return buff.damageType == dot end) then
  2687. if damagingFunc then
  2688. local dd = BattleUtil.CountValue(damage, f1, ct) - damage
  2689. damagingFunc(-floor(BattleUtil.ErrorCorrection(dd)))
  2690. end
  2691. end
  2692. end
  2693. local onSkillCast = function(skill)
  2694. if skill.type == BattleSkillType.Special then
  2695. role.Event:AddEvent(BattleEventName.PassiveDamaging, onPassiveDamaging)
  2696. end
  2697. end
  2698. local onSkillCastEnd = function(skill)
  2699. if skill.type == BattleSkillType.Special then
  2700. role.Event:RemoveEvent(BattleEventName.PassiveDamaging, onPassiveDamaging)
  2701. end
  2702. end
  2703. role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
  2704. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillCastEnd)
  2705. end,
  2706. -- 释放普通攻击如目标[a],且血量低于[b]%则有[c]%概率秒杀
  2707. -- a[持续伤害状态]b[float]c[float]
  2708. [151] = function(role, args, delay)
  2709. local dot = args[1]
  2710. local f1 = args[2]
  2711. local f2 = args[3]
  2712. --
  2713. local onRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill)
  2714. BattleLogic.WaitForTrigger(delay, function ()
  2715. if skill and skill.type == BattleSkillType.Normal and not defRole:IsDead() then
  2716. if BattleLogic.BuffMgr:HasBuff(defRole, BuffName.DOT, function (buff) return dot == 0 or buff.damageType == dot end) then
  2717. -- 检测被动技能对秒杀参数得影响
  2718. local bf, kf = BattleUtil.CheckSeckill(f1, f2, role, defRole)
  2719. --
  2720. local ft = defRole:GetRoleData(RoleDataName.Hp)/defRole:GetRoleData(RoleDataName.MaxHp)
  2721. if ft < bf then
  2722. BattleUtil.RandomAction2(kf, function()
  2723. -- 秒杀
  2724. BattleUtil.Seckill(skill, role, defRole)
  2725. end)
  2726. end
  2727. end
  2728. end
  2729. end)
  2730. end
  2731. role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit)
  2732. end,
  2733. -- 释放技能有[a]%概率附加[b]效果持续[c]回合
  2734. -- a[float]b[控制状态]c[int]
  2735. [152] = function(role, args, delay)
  2736. local f1 = args[1]
  2737. local ctrl = args[2]
  2738. local i1 = args[3]
  2739. -- 技能后后
  2740. local onSkillCastEnd = function(skill)
  2741. if skill.type == BattleSkillType.Special then
  2742. local targets = skill:GetDirectTargetsNoMiss()
  2743. if targets then
  2744. for _, r in ipairs(targets) do
  2745. BattleUtil.RandomControl(f1, ctrl, role, r, i1)
  2746. end
  2747. end
  2748. end
  2749. end
  2750. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillCastEnd)
  2751. end,
  2752. -- 直接伤害击杀目标回复自身[a]点怒气
  2753. -- a[int]
  2754. [153] = function(role, args, delay)
  2755. local i1 = args[1]
  2756. local onHit = function(target, damage, bCrit, finalDmg)
  2757. if target:IsDead() and BattleUtil.CheckIsNoDead(target) then
  2758. role:AddRage(i1, CountTypeName.Add)
  2759. end
  2760. end
  2761. role.Event:AddEvent(BattleEventName.RoleHit, onHit)
  2762. end,
  2763. -- 复活友方第[a]位阵亡的英雄并回复其[b]%的生命每场战斗触发[c]次
  2764. -- a[int]b[float]c[int]
  2765. [154] = function(role, args, delay)
  2766. local i1 = args[1]
  2767. local f1 = args[2]
  2768. local i2 = args[3]-- 无意义(第几个死亡的人只能有一个)
  2769. local counter = 0
  2770. local onRoleRealDead = function(deadRole)
  2771. if deadRole.camp == role.camp then
  2772. counter = counter + 1
  2773. if counter == i1 then
  2774. deadRole:SetRelive(f1)
  2775. end
  2776. end
  2777. end
  2778. BattleLogic.Event:AddEvent(BattleEventName.RoleRealDead, onRoleRealDead)
  2779. end,
  2780. -- 目标血量每降低[c]%(只看当前血量),对其治疗量就[e]改变[f]%
  2781. -- c[float]e[改变类型]f[float]
  2782. [155] = function(role, args, delay)
  2783. local f1 = args[1]
  2784. local ct = args[2]
  2785. local f2 = args[3]
  2786. local function onPassiveTreatingFactor(treatFactorFunc, targetRole)
  2787. local lf = targetRole:GetRoleData(RoleDataName.Hp)/targetRole:GetRoleData(RoleDataName.MaxHp)
  2788. local df = 1 - lf -- 血量降低百分比 = 1 - 当前血量百分比
  2789. local level = floor(df/f1)
  2790. if treatFactorFunc then
  2791. treatFactorFunc(BattleUtil.ErrorCorrection(level*f2), ct)
  2792. end
  2793. end
  2794. role.Event:AddEvent(BattleEventName.PassiveTreatingFactor, onPassiveTreatingFactor)
  2795. end,
  2796. -- 受到普攻后降低攻击自己武将的[c]点怒气
  2797. -- c[int]
  2798. [156] = function(role, args, delay)
  2799. local i1 = args[1]
  2800. local onBeSkillCastEnd = function(skill)
  2801. if skill.type == BattleSkillType.Normal then
  2802. skill.owner:AddRage(i1, CountTypeName.Sub)
  2803. end
  2804. end
  2805. role.Event:AddEvent(BattleEventName.BeSkillCastEnd, onBeSkillCastEnd)
  2806. end,
  2807. -- 减伤盾减伤比例[a]改变[b]%
  2808. -- a[改变类型]b[float]
  2809. [157] = function(role, args, delay)
  2810. local ct = args[1]
  2811. local f1 = args[2]
  2812. local OnBuffCaster = function(buff)
  2813. if buff.type == BuffName.Shield and buff.shieldType == ShieldTypeName.RateReduce then
  2814. buff:ChangeShieldValue(ct, f1)
  2815. end
  2816. end
  2817. role.Event:AddEvent(BattleEventName.BuffCaster, OnBuffCaster)
  2818. end,
  2819. -- 释放技能后回复当前本方阵容最靠前武将[a]点怒气
  2820. -- a[int]
  2821. [158] = function(role, args, delay)
  2822. local i1 = args[1]
  2823. local onSkillCastEnd = function(skill)
  2824. if skill.type == BattleSkillType.Special then
  2825. local list = RoleManager.Query(function(v) return v.camp == role.camp end)
  2826. table.sort(list, function(a, b)
  2827. return a.position < b.position
  2828. end)
  2829. for i= 1, #list do
  2830. if list[i] and not list[i]:IsRealDead() then
  2831. list[i]:AddRage(i1, CountTypeName.Add)
  2832. break
  2833. end
  2834. end
  2835. end
  2836. end
  2837. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillCastEnd)
  2838. end,
  2839. -- [a]伤害[b]改变[c]%(技能效果111专属被动)
  2840. -- a[持续伤害状态]b[改变类型]c[float]
  2841. [159] = function(role, args, delay)
  2842. local dot = args[1]
  2843. local ct = args[2]
  2844. local f1 = args[3]
  2845. local onSkillEffectBefore = function(skill, e, func)
  2846. if skill.type == BattleSkillType.Special then
  2847. if e.type == 111 then -- 当前只对技能效果103生效
  2848. if e.args[2] == dot then
  2849. local factor = BattleUtil.ErrorCorrection(BattleUtil.CountValue(e.args[3], f1, ct))
  2850. e.args[3] = factor
  2851. if func then func(e) end
  2852. end
  2853. end
  2854. end
  2855. end
  2856. role.Event:AddEvent(BattleEventName.SkillEffectBefore, onSkillEffectBefore)
  2857. end,
  2858. -- 受到普攻是有[a]%概率给攻击者附加[b],每回合对目标造成自身攻击的[c]%伤害,持续[d]回合
  2859. -- a[float]b[持续伤害状态]c[float]d[int]
  2860. [160] = function(role, args, delay)
  2861. local f1 = args[1]
  2862. local dot = args[2]
  2863. local f2 = args[3]
  2864. local i1 = args[3]
  2865. -- 技能后后
  2866. local onBeSkillCastEnd = function(skill)
  2867. if skill.type == BattleSkillType.Normal then
  2868. local attack = role:GetRoleData(RoleDataName.Attack)
  2869. local damage = floor(BattleUtil.ErrorCorrection(attack * f2))
  2870. BattleUtil.RandomDot(f1, dot, role, skill.owner, i1, 1, damage)
  2871. end
  2872. end
  2873. role.Event:AddEvent(BattleEventName.BeSkillCastEnd, onBeSkillCastEnd)
  2874. end,
  2875. -- 攻击目标时目标身上每有1种异常状态(包括麻痹、眩晕、沉默、灼烧、中毒)都会使对其造成的直接伤害提高,异常状态数量乘以[a]%。
  2876. -- a[float]
  2877. [161] = function(role, args, delay)
  2878. local f1 = args[1]
  2879. local function onPassiveDamaging(damagingFunc, target, damage)
  2880. local list = BattleLogic.BuffMgr:GetBuff(target, function(buff)
  2881. return buff.type == BuffName.DOT or buff.type == BuffName.Control
  2882. end)
  2883. if list and damagingFunc then
  2884. local num = #list
  2885. local dd = BattleUtil.CountValue(damage, f1 * num, CountTypeName.AddPencent) - damage
  2886. damagingFunc(-floor(BattleUtil.ErrorCorrection(dd)))
  2887. end
  2888. end
  2889. role.Event:AddEvent(BattleEventName.PassiveDamaging, onPassiveDamaging)
  2890. end,
  2891. -- 当敌方目标处于链接符状态(主动技能110效果)时受到链接符传导效果提高[a]%
  2892. -- a[float]
  2893. [162] = function(role, args, delay)
  2894. local f1 = args[1]
  2895. local onCurse_ShareDamage = function(func)
  2896. if func then func(f1, CountTypeName.Add) end
  2897. end
  2898. role.Event:AddEvent(BattleEventName.Curse_ShareDamage, onCurse_ShareDamage)
  2899. end,
  2900. -- 每当对方拥有链接符的目标死亡时,都会使己方输出型武将技能伤害提高[a]%([b]元素输出武将提高[c]%)
  2901. -- a[float]b[元素]c[float]
  2902. [163] = function(role, args, delay)
  2903. local f1 = args[1]
  2904. local ele = args[2]
  2905. local f2 = args[3]
  2906. -- 死亡数量
  2907. local num = 0
  2908. local onBattleRoleDead = function(defRole)
  2909. --
  2910. if BattleLogic.BuffMgr:HasBuff(defRole, BuffName.Curse, function(buff) return buff.curseType == CurseTypeName.ShareDamage end) then
  2911. num = num + 1
  2912. end
  2913. end
  2914. BattleLogic.Event:AddEvent(BattleEventName.BattleRoleDead, onBattleRoleDead)
  2915. --
  2916. local cNum = 0 -- 释放技能前记录此次技能提高伤害的目标数量,防止单次技能伤害不一致的问题
  2917. local function onSkillCast()
  2918. cNum = num
  2919. end
  2920. BattleLogic.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
  2921. -- 技能伤害提高
  2922. local function onPassiveDamaging(damagingFunc, atkRole, defRole, damage, skill)
  2923. if atkRole.professionId == 2 and atkRole.camp == role.camp and skill and skill.type == BattleSkillType.Special then
  2924. -- 地元素特殊
  2925. local f = atkRole.element == ele and f2 or f1
  2926. local dd = BattleUtil.CountValue(damage, f * cNum, CountTypeName.AddPencent) - damage
  2927. damagingFunc(-floor(BattleUtil.ErrorCorrection(dd)))
  2928. end
  2929. end
  2930. BattleLogic.Event:AddEvent(BattleEventName.PassiveDamaging, onPassiveDamaging)
  2931. end,
  2932. -- 爆伤减免增加[a]%,[b]改变
  2933. -- a[float]b[改变类型]
  2934. [164] = function(role, args, delay)
  2935. local f1 = args[1]
  2936. local ct = args[2]
  2937. local function onCritDamageReduceFactor(damagingFunc, atkRole, defRole)
  2938. if defRole == role then
  2939. if damagingFunc then
  2940. damagingFunc(f1, ct)
  2941. end
  2942. end
  2943. end
  2944. role.Event:AddEvent(BattleEventName.CritDamageReduceFactor, onCritDamageReduceFactor)
  2945. end,
  2946. -- 战斗中生命每减少[a]%,自身伤害就[b]改变[c]%,减少为[d]改变
  2947. -- a[float]b[改变类型]c[float]d[改变类型]
  2948. [165] = function(role, args, delay)
  2949. local f1 = args[1]
  2950. local ct = args[2]
  2951. local f2 = args[3]
  2952. local ct2 = args[4] -- 废物参数
  2953. -- 释放技能后
  2954. local onPassiveDamaging = function(damagingFunc, defRole, damage, skill)
  2955. local levelDamage = floor(role:GetRoleData(RoleDataName.MaxHp)*f1)
  2956. local lostDamage = role:GetRoleData(RoleDataName.MaxHp) - role:GetRoleData(RoleDataName.Hp)
  2957. local level = floor(lostDamage/levelDamage)
  2958. local dd = BattleUtil.CountValue(damage, f2*level, ct) - damage
  2959. damagingFunc(-floor(BattleUtil.ErrorCorrection(dd)))
  2960. end
  2961. role.Event:AddEvent(BattleEventName.PassiveDamaging, onPassiveDamaging)
  2962. end,
  2963. -- 普通攻击时如目标处于[a]状态则伤害的[b]%转化为生命治疗自己
  2964. -- a[持续伤害状态]b[float]
  2965. [166] = function(role, args, delay)
  2966. local dot = args[1]
  2967. local f1 = args[2]
  2968. local onHit = function(target, damage, bCrit, finalDmg)
  2969. if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function(buff) return buff.damageType == dot end) then
  2970. BattleUtil.ApplyTreat(role, role, floor(BattleUtil.ErrorCorrection(finalDmg * f1)))
  2971. end
  2972. end
  2973. local onSkillCast = function(skill)
  2974. if skill.type == BattleSkillType.Normal then
  2975. role.Event:AddEvent(BattleEventName.RoleHit, onHit)
  2976. end
  2977. end
  2978. -- 技能后后
  2979. local onSkillCastEnd = function(skill)
  2980. if skill.type == BattleSkillType.Normal then
  2981. role.Event:RemoveEvent(BattleEventName.RoleHit, onHit)
  2982. end
  2983. end
  2984. role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
  2985. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillCastEnd)
  2986. end,
  2987. -- 如果目标数量大于[a]个,增加自身[b]点怒气
  2988. -- a[int]b[int]
  2989. [167] = function(role, args, delay)
  2990. local i1 = args[1]
  2991. local i2 = args[2]
  2992. -- 释放技能后
  2993. local onSkillEnd = function(skill)
  2994. local targets = skill:GetDirectTargets()
  2995. if targets and #targets > i1 then
  2996. role:AddRage(i2, 1)
  2997. end
  2998. end
  2999. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd)
  3000. end,
  3001. -- 释放技能后给当前血量最少的2名队友附加无敌吸血盾持续[a]回合
  3002. -- a[int]
  3003. [168] = function(role, args, delay)
  3004. local i1 = args[1]
  3005. -- 释放技能后
  3006. local onSkillEnd = function(skill)
  3007. if skill.type == BattleSkillType.Special then
  3008. local list = RoleManager.Query(function(v) return v.camp == role.camp end)
  3009. BattleUtil.SortByProp(list, RoleDataName.Hp, 1)
  3010. local index = 0
  3011. for i = 1, #list do
  3012. if not list[i]:IsRealDead() and index < 2 then
  3013. index = index + 1
  3014. -- 吸血率%25 策划说写死
  3015. list[i]:AddBuff(Buff.Create(role, BuffName.Shield, i1, ShieldTypeName.AllReduce, 0.25, 0))
  3016. end
  3017. end
  3018. end
  3019. end
  3020. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd)
  3021. end,
  3022. -- 行动后增加自身[a]%的[b](可叠加持续至结束)
  3023. -- a[float]b[属性]
  3024. [169] = function(role, args, delay)
  3025. local f1 = args[1]
  3026. local pro = args[2]
  3027. -- 行动结束后
  3028. local onTurnEnd = function()
  3029. local buff = Buff.Create(role, BuffName.PropertyChange, 0, BattlePropList[pro], f1, CountTypeName.AddPencent)
  3030. role:AddBuff(buff)
  3031. end
  3032. role.Event:AddEvent(BattleEventName.RoleTurnEnd, onTurnEnd)
  3033. end,
  3034. -- 击杀目标后对敌方血量百分比最低两名角色造成[a]%[b]伤害
  3035. -- a[float]b[伤害类型]
  3036. [170] = function(role, args, delay)
  3037. local f1 = args[1]
  3038. local dt = args[2]
  3039. -- 直接伤害后
  3040. local onRoleHit = function(target, damage, bCrit, finalDmg, damageType, skill)
  3041. if skill and not skill.isAdd and target:IsDead() and BattleUtil.CheckIsNoDead(target) then
  3042. local list = RoleManager.Query(function(v) return v.camp ~= role.camp end)
  3043. BattleUtil.SortByHpFactor(list, 1)
  3044. local index = 0
  3045. for i = 1, #list do
  3046. if not list[i]:IsDead() and index < 2 then
  3047. index = index + 1
  3048. BattleUtil.CalDamage(nil, role, list[i], dt, f1)
  3049. end
  3050. end
  3051. end
  3052. end
  3053. role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit)
  3054. end,
  3055. -- 攻击目标越少[a]对每个目标提升概率越高,提升概率为[b]%除以被击者的总数,提升为[c]改变
  3056. -- a[控制状态]b[float]c[改变类型]
  3057. [172] = function(role, args, delay)
  3058. local ctrl = args[1]
  3059. local f1 = args[2]
  3060. local ct = args[3]
  3061. local af = 0
  3062. local onSkillCast = function(skill)
  3063. local targets = skill:GetDirectTargets()
  3064. if targets and #targets > 0 then
  3065. af = BattleUtil.ErrorCorrection(f1/#targets)
  3066. end
  3067. end
  3068. role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
  3069. local onPassiveRandomControl = function(func, ctrl2)
  3070. if ctrl == 0 or ctrl == ctrl2 then
  3071. if func then func(af, ct) end
  3072. end
  3073. end
  3074. role.Event:AddEvent(BattleEventName.PassiveRandomControl, onPassiveRandomControl)
  3075. end,
  3076. -- 反弹伤害增加[a]%,[b]改变
  3077. -- a[float]b[改变类型]
  3078. [173] = function(role, args, delay)
  3079. local f1 = args[1]
  3080. local ct = args[2]
  3081. local onPassiveRebackDamage = function(func)
  3082. if func then func(f1, ct) end
  3083. end
  3084. role.Event:AddEvent(BattleEventName.PassiveRebackDamage, onPassiveRebackDamage)
  3085. end,
  3086. -- 技能直接伤害治疗生命最少队友治疗量提升[a]%,[b]改变
  3087. -- a[float]b[改变类型]
  3088. [174] = function(role, args, delay)
  3089. local f1 = args[1]
  3090. local ct = args[2]
  3091. local onPassiveSkillDamageHeal = function(func)
  3092. if func then func(f1, ct) end
  3093. end
  3094. role.Event:AddEvent(BattleEventName.PassiveSkillDamageHeal, onPassiveSkillDamageHeal)
  3095. end,
  3096. -- 释放技能时,对己方生命最少武将治疗效果额外提升[a],[b]改变
  3097. -- a[float]b[改变类型]
  3098. [175] = function(role, args, delay)
  3099. local f1 = args[1]
  3100. local ct = args[2]
  3101. local onPassiveTreatingFactor = function(func, target)
  3102. local arr = RoleManager.Query(function (r) return r.camp == role.camp end)
  3103. BattleUtil.SortByHpFactor(arr, 1)
  3104. if arr and arr[1] and arr[1] == target then
  3105. if func then func(f1, ct) end
  3106. end
  3107. end
  3108. local function onSkillCast(skill)
  3109. if skill.type == BattleSkillType.Special then
  3110. role.Event:AddEvent(BattleEventName.PassiveTreatingFactor, onPassiveTreatingFactor)
  3111. end
  3112. end
  3113. local function onSkillCastEnd(skill)
  3114. if skill.type == BattleSkillType.Special then
  3115. role.Event:RemoveEvent(BattleEventName.PassiveTreatingFactor, onPassiveTreatingFactor)
  3116. end
  3117. end
  3118. role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
  3119. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillCastEnd)
  3120. end,
  3121. -- 减伤盾抵抗效果提升[a]%,抵抗效果[b]增加,提升效果由所有受益目标平分。
  3122. -- a[float]b[改变类型]
  3123. [176] = function(role, args, delay)
  3124. local f1 = args[1]
  3125. local ct = args[2]
  3126. local af = 0
  3127. local onSkillCast = function(skill)
  3128. local targets = skill.effectTargets[2]
  3129. if targets and #targets > 0 then
  3130. af = BattleUtil.ErrorCorrection(f1/#targets)
  3131. end
  3132. end
  3133. role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
  3134. local onPassiveShield = function(func, shieldType)
  3135. if shieldType == ShieldTypeName.RateReduce then
  3136. if func then func(af, ct) end
  3137. end
  3138. end
  3139. role.Event:AddEvent(BattleEventName.PassiveShield, onPassiveShield)
  3140. end,
  3141. -- 技能治疗效果提升[a]%, 同时为每个技能目标附加减伤盾,减伤效果[b]%,持续[c]回合
  3142. -- a[float]b[float]c[int]
  3143. [177] = function(role, args, delay)
  3144. local f1 = args[1]
  3145. local f2 = args[2]
  3146. local i1 = args[3]
  3147. local onPassiveTreatingFactor = function(func, target)
  3148. if func then func(f1, 1) end
  3149. end
  3150. local function onSkillCast(skill)
  3151. if skill.type == BattleSkillType.Special then
  3152. role.Event:AddEvent(BattleEventName.PassiveTreatingFactor, onPassiveTreatingFactor)
  3153. end
  3154. end
  3155. local function onSkillCastEnd(skill)
  3156. if skill.type == BattleSkillType.Special then
  3157. role.Event:RemoveEvent(BattleEventName.PassiveTreatingFactor, onPassiveTreatingFactor)
  3158. -- 对每个目标附加减伤盾
  3159. local targets = skill:GetDirectTargets()
  3160. for _, target in ipairs(targets) do
  3161. target:AddBuff(Buff.Create(role, BuffName.Shield, i1, ShieldTypeName.RateReduce, f2, 0))
  3162. end
  3163. end
  3164. end
  3165. role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
  3166. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillCastEnd)
  3167. end,
  3168. -- 攻击目标越少[a]对每个目标提升概率越高,提升率等于[b]%除以被攻击者的总数,[c]改变
  3169. -- a[持续伤害状态]b[float]c[改变类型]
  3170. [178] = function(role, args, delay)
  3171. local dot = args[1]
  3172. local f1 = args[2]
  3173. local ct = args[3]
  3174. local af = 0
  3175. local onSkillCast = function(skill)
  3176. local targets = skill:GetDirectTargets()
  3177. if targets and #targets > 0 then
  3178. af = BattleUtil.ErrorCorrection(f1/#targets)
  3179. end
  3180. end
  3181. role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
  3182. local onPassiveRandomDot = function(func, dot2)
  3183. if dot == dot2 then
  3184. if func then func(af, ct) end
  3185. end
  3186. end
  3187. role.Event:AddEvent(BattleEventName.PassiveRandomDot, onPassiveRandomDot)
  3188. end,
  3189. -- 对别人造成的中毒伤害的[a]%用于治疗自己
  3190. -- a[float]
  3191. [179] = function(role, args, delay)
  3192. local f1 = args[1]
  3193. local dot = DotType.Poison
  3194. local onRoleDamage = function(defRole, damage, bCrit, finalDmg, damageType, dotType, skill)
  3195. if dotType == dot then
  3196. BattleUtil.ApplyTreat(role, role, floor(BattleUtil.ErrorCorrection(finalDmg * f1)))
  3197. end
  3198. end
  3199. role.Event:AddEvent(BattleEventName.RoleDamage, onRoleDamage)
  3200. end,
  3201. -- 受到[a]效果概率降低[b]%,[c]改变
  3202. -- a[控制状态]b[float]c[改变类型]
  3203. [180] = function(role, args, delay)
  3204. local ctrl = args[1]
  3205. local f1 = args[2]
  3206. local ct = args[3]
  3207. local onPassiveBeRandomControl = function(func, ctrl2, target)
  3208. if ctrl == 0 or ctrl == ctrl2 then
  3209. if func then func(f1, ct) end
  3210. end
  3211. end
  3212. role.Event:AddEvent(BattleEventName.PassiveBeRandomControl, onPassiveBeRandomControl)
  3213. end,
  3214. -- 攻击单体目标时额外降低目标[a]点怒气
  3215. -- a[int]
  3216. [181] = function(role, args, delay)
  3217. local i1 = args[1]
  3218. local function onSkillCastEnd(skill)
  3219. -- 对每个目标附加减伤盾
  3220. local targets = skill:GetDirectTargetsNoMiss()
  3221. if targets and #targets == 1 then
  3222. targets[1]:AddRage(i1, CountTypeName.Sub)
  3223. end
  3224. end
  3225. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillCastEnd)
  3226. end,
  3227. -- 攻击目标越少[a]对每个目标的伤害越高,伤害提升量等于[b]%除以由于自身攻击受到该效果的敌人的总数,[c]改变
  3228. -- a[持续伤害状态]b[float]c[改变类型]
  3229. [182] = function(role, args, delay)
  3230. local dot = args[1]
  3231. local f1 = args[2]
  3232. local ct = args[3]
  3233. local af = 0
  3234. local onSkillCast = function(skill)
  3235. local targets = skill:GetDirectTargets()
  3236. if targets and #targets > 0 then
  3237. af = BattleUtil.ErrorCorrection(f1/#targets)
  3238. end
  3239. end
  3240. role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
  3241. local onPassiveRandomDot = function(func, dot2, damage)
  3242. if dot == dot2 then
  3243. if func then func(nil, nil, af, ct) end
  3244. end
  3245. end
  3246. role.Event:AddEvent(BattleEventName.PassiveRandomDot, onPassiveRandomDot)
  3247. end,
  3248. -- 有该技能角色,释放技能造成的[a]效果附加封治疗效果,该状态武将无法回复生命
  3249. -- a[持续伤害状态]
  3250. [183] = function(role, args, delay)
  3251. local dot = args[1]
  3252. local onBuffCaster = function(buff)
  3253. if buff.type == BuffName.DOT and buff.damageType == dot then
  3254. BattleUtil.RandomControl(1, ControlType.NoHeal, role, buff.target, buff.duration)
  3255. end
  3256. end
  3257. role.Event:AddEvent(BattleEventName.BuffCaster, onBuffCaster)
  3258. end,
  3259. -- [a]状态延长[b]回合
  3260. -- a[持续伤害状态]b[int]
  3261. [184] = function(role, args, delay)
  3262. local dot = args[1]
  3263. local i1 = args[2]
  3264. local onBuffCaster = function(buff)
  3265. if buff.type == BuffName.DOT and buff.damageType == dot then
  3266. buff:ChangeBuffDuration(CountTypeName.Add, i1)
  3267. end
  3268. end
  3269. role.Event:AddEvent(BattleEventName.BuffCaster, onBuffCaster)
  3270. end,
  3271. -- 直接伤害击杀目标对仇恨目标造成[a]%物理伤害
  3272. -- a[float]
  3273. [185] = function(role, args, delay)
  3274. local f1 = args[1]
  3275. local onRoleHit = function(target)
  3276. if target:IsDead() and BattleUtil.CheckIsNoDead(target) then
  3277. local target = RoleManager.GetAliveAggro(role)
  3278. BattleUtil.CalDamage(nil, role, target, 1, f1)
  3279. end
  3280. end
  3281. role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit)
  3282. end,
  3283. -- 直接伤害击杀目标对仇恨目标追加一次造成[a]%物理伤害的技能
  3284. -- a[float]
  3285. -- [185] = function(role, args, delay)
  3286. -- local f1 = args[1]
  3287. -- local onRoleHit = function(target)
  3288. -- if target:IsDead() then
  3289. -- local skill = {
  3290. -- role.skill[1], -- 技能id
  3291. -- {
  3292. -- 400000, -- chooseId
  3293. -- role.skill[2][2], -- 效果时间
  3294. -- {1, f1, 1} -- 效果id及参数
  3295. -- }
  3296. -- }
  3297. -- SkillManager.AddSkill(role, skill, BattleSkillType.Normal, nil, true, false)
  3298. -- end
  3299. -- end
  3300. -- role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit)
  3301. -- end,
  3302. -- 攻击纵排目标时额外降低目标[a]点怒气
  3303. -- a[int]
  3304. [186] = function(role, args, delay)
  3305. local i1 = args[1]
  3306. local onSkillCastEnd = function(skill)
  3307. local effectGroup = skill.effectList.buffer[1]
  3308. local chooseId = effectGroup.chooseId
  3309. local chooseLimit = floor(chooseId / 10000) % 10
  3310. if chooseLimit == 3 then -- 打纵列
  3311. local targets = skill:GetDirectTargetsNoMiss()
  3312. if targets then
  3313. for _, r in ipairs(targets) do
  3314. r:AddRage(i1, CountTypeName.Sub)
  3315. end
  3316. end
  3317. end
  3318. end
  3319. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillCastEnd)
  3320. end,
  3321. -- 普攻[a]%概率暴击
  3322. -- a[float]
  3323. [187] = function(role, args, delay)
  3324. local f1 = args[1]
  3325. local function onSkillCast(skill)
  3326. if skill.type == BattleSkillType.Normal then
  3327. role.data:AddValue(RoleDataName.Crit, f1)
  3328. end
  3329. end
  3330. role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
  3331. local function onSkillCastEnd(skill)
  3332. if skill.type == BattleSkillType.Normal then
  3333. role.data:SubValue(RoleDataName.Crit, f1)
  3334. end
  3335. end
  3336. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillCastEnd)
  3337. end,
  3338. -- 受到伤害降低[a]%(与减伤盾同效果)并且将自身受到非致命伤害平分给自身及己方当前生命最高的两名武将(被平摊武将有无敌也会受到伤害)降低伤害[b]改变
  3339. -- a[float]b[改变类型]
  3340. [188] = function(role, args, delay)
  3341. local f1 = args[1]
  3342. local ct = args[2]
  3343. local onFinalBeDamage = function(damagingFunc, atkRole, damage, skill, dotType, bCrit, damageType)
  3344. -- 伤害降低
  3345. local finalDamage = BattleUtil.CountValue(damage, f1, ct)
  3346. local curHp = role:GetRoleData(RoleDataName.Hp)
  3347. -- 不是致死伤害
  3348. if finalDamage < curHp then
  3349. -- 找到除自身外的血量最高的两人
  3350. local list = RoleManager.Query(function(v)
  3351. return v.camp == role.camp and v.position ~= role.position
  3352. end)
  3353. local ff = 1 -- 分摊比
  3354. -- 检测被动对分摊比的影响
  3355. local cl = {}
  3356. local function _CallBack(v, ct)
  3357. if v then
  3358. table.insert(cl, {v, ct})
  3359. end
  3360. end
  3361. role.Event:DispatchEvent(BattleEventName.PassiveDamageShare, _CallBack)
  3362. atkRole.Event:DispatchEvent(BattleEventName.PassiveDamageBeShare, _CallBack)
  3363. ff = BattleUtil.CountChangeList(ff, cl)
  3364. -- 计算分摊伤害
  3365. local fenDamage = finalDamage * ff -- 需要分摊的总伤害
  3366. list = BattleUtil.SortByProp(list, RoleDataName.Hp, 0)
  3367. local targets = {role, list[1], list[2]}
  3368. local fd = floor(BattleUtil.ErrorCorrection(fenDamage/#targets)) -- 每个人需要分摊的伤害
  3369. -- 自身伤害
  3370. if damagingFunc then
  3371. local unFenDamage = floor(BattleUtil.ErrorCorrection(finalDamage * (1 - ff))) -- 不被分摊的伤害
  3372. damagingFunc(floor(BattleUtil.ErrorCorrection(damage - (unFenDamage + fd))))
  3373. end
  3374. -- 平分给别人
  3375. if fd > 0 then
  3376. for i = 2, #targets do
  3377. BattleUtil.FinalDamage(skill, atkRole, targets[i], fd, nil, 0, dotType)
  3378. end
  3379. end
  3380. end
  3381. end
  3382. role.Event:AddEvent(BattleEventName.FinalBeDamage, onFinalBeDamage)
  3383. end,
  3384. -- 有该技能角色,造成的[a]效果会使目标无法获得无敌盾和无敌吸血盾效果
  3385. -- a[持续伤害状态]
  3386. [189] = function(role, args, delay)
  3387. local dot = args[1]
  3388. local onBuffCaster = function(buff)
  3389. if buff.type == BuffName.DOT and buff.damageType == dot then
  3390. buff.target:AddBuff(Buff.Create(role, BuffName.Immune, buff.duration, 3))
  3391. end
  3392. end
  3393. role.Event:AddEvent(BattleEventName.BuffCaster, onBuffCaster)
  3394. end,
  3395. -- 所有攻击优先攻击敌方[a]最少的单位
  3396. -- a[属性]
  3397. [190] = function(role, args, delay)
  3398. local pro = args[1]
  3399. local function onSkillTargetCheck(func)
  3400. local list = RoleManager.Query(function(r)
  3401. return r.camp == (role.camp + 1) % 2
  3402. end)
  3403. list = BattleUtil.SortByProp(list, BattlePropList[pro], 1)
  3404. if list and #list > 0 then
  3405. if func then func({list[1]}) end
  3406. end
  3407. end
  3408. role.Event:AddEvent(BattleEventName.SkillTargetCheck, onSkillTargetCheck)
  3409. end,
  3410. -- 技能直接伤害[a]%转化为生命治疗自己
  3411. -- a[float]
  3412. [191] = function(role, args, delay)
  3413. local f1 = args[1]
  3414. local onHit = function(target, damage, bCrit, finalDmg, dtype, skill)
  3415. if skill and skill.type == BattleSkillType.Special then
  3416. -- 检测技能伤害治疗加成
  3417. local f = BattleUtil.CheckSkillDamageHeal(f1, role, target)
  3418. -- 治疗自己
  3419. BattleUtil.ApplyTreat(role, role, floor(BattleUtil.ErrorCorrection(finalDmg * f)))
  3420. end
  3421. end
  3422. role.Event:AddEvent(BattleEventName.RoleHit, onHit)
  3423. end,
  3424. -- 武将怒气小于[a]点时不会释放技能,释放技能消耗当前所有怒气超过4怒气部分每额外消耗1点怒气技能伤害增加[b]%
  3425. -- a[int]b[float]
  3426. [192] = function(role, args, delay)
  3427. local i1 = args[1]
  3428. local f1 = args[2]
  3429. -- 提高技能释放怒气值
  3430. role.SuperSkillRage = i1
  3431. --
  3432. local allRage = 0
  3433. local function onRoleRageCost(rage, rate, func)
  3434. allRage = role.Rage
  3435. local deltaRage = allRage - role.SuperSkillRage
  3436. if func then
  3437. func(0, deltaRage)
  3438. end
  3439. end
  3440. role.Event:AddEvent(BattleEventName.RoleRageCost, onRoleRageCost)
  3441. -- 释放技能后
  3442. local onPassiveDamaging = function(damagingFunc, defRole, damage, skill, dotType)
  3443. if skill and skill.type == BattleSkillType.Special then
  3444. local deltaRage = allRage - 4
  3445. if deltaRage > 0 then
  3446. local dd = BattleUtil.CountValue(damage, f1 * deltaRage, 2) - damage
  3447. damagingFunc(-floor(BattleUtil.ErrorCorrection(dd)))
  3448. end
  3449. end
  3450. end
  3451. role.Event:AddEvent(BattleEventName.PassiveDamaging, onPassiveDamaging)
  3452. end,
  3453. -- 对己方生命最少的三个武将治疗效果额外提升治疗武将攻击的[a]%,提升为[b]改变
  3454. -- a[float]b[改变类型]
  3455. [193] = function(role, args, delay)
  3456. local f1 = args[1]
  3457. local ct = args[2]
  3458. local OnPassiveTreating = function(treatingFunc, target)
  3459. local arr = RoleManager.Query(function (r) return r.camp == role.camp end)
  3460. BattleUtil.SortByHpFactor(arr, 1)
  3461. if not arr then return end
  3462. for i = 1, 3 do
  3463. if arr[i] and arr[i] == target then
  3464. local atk = role:GetRoleData(RoleDataName.Attack)
  3465. treatingFunc(atk * f1, ct)
  3466. end
  3467. end
  3468. end
  3469. role.Event:AddEvent(BattleEventName.PassiveTreating, OnPassiveTreating)
  3470. end,
  3471. -- 攻击有概率清除敌方武将无敌盾和无敌吸血盾,攻击目标越少,清除概率越高,对每个受击者清除概率等于[a]%除以受击者的总数
  3472. -- a[float]
  3473. [194] = function(role, args, delay)
  3474. local f1 = args[1]
  3475. local OnRoleDamageBefore = function(defRole, factorFunc, damageType, skill)
  3476. BattleLogic.WaitForTrigger(delay, function ()
  3477. local targets = skill:GetDirectTargets()
  3478. if not targets or #targets == 0 then return end
  3479. local cf = f1/#targets
  3480. for _, target in ipairs(targets) do
  3481. BattleUtil.RandomAction2(cf, function()
  3482. BattleLogic.BuffMgr:ClearBuff(target, function(buff)
  3483. return buff.type == BuffName.Shield and buff.shieldType == ShieldTypeName.AllReduce
  3484. end)
  3485. end)
  3486. end
  3487. end)
  3488. end
  3489. role.Event:AddEvent(BattleEventName.RoleDamageBefore, OnRoleDamageBefore)
  3490. end,
  3491. -- 首回合免疫[a]效果
  3492. -- a[控制状态]
  3493. [195] = function(role, args, delay)
  3494. local ctrl = args[1]
  3495. local immune = function(buff)
  3496. return buff.type == BuffName.Control and (ctrl == 0 or buff.ctrlType == ctrl)
  3497. end
  3498. BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, function(curRound)
  3499. -- 第i1回合开始
  3500. if curRound == 1 then
  3501. role.buffFilter:Add(immune)
  3502. end
  3503. -- 第i1+i2回合结束
  3504. if curRound == 2 then
  3505. for i = 1, role.buffFilter.size do
  3506. if role.buffFilter.buffer[i] == immune then
  3507. role.buffFilter:Remove(i)
  3508. break
  3509. end
  3510. end
  3511. end
  3512. end)
  3513. end,
  3514. -- 对敌方造成伤害如被分摊其分摊比降低[a]%
  3515. -- a[float]
  3516. [196] = function(role, args, delay)
  3517. local f1 = args[1]
  3518. local onDamageBeShare = function(func)
  3519. if func then func(f1, CountTypeName.Sub) end
  3520. end
  3521. role.Event:AddEvent(BattleEventName.PassiveDamageBeShare, onDamageBeShare)
  3522. end,
  3523. -- 技能直接击杀敌方目标时有[a]%概率获得目标剩余所有怒气(输出武将佩戴)
  3524. -- a[float]
  3525. [197] = function(role, args, delay)
  3526. local f1 = args[1]
  3527. local onRoleHit = function(target, damage, bCrit, finalDmg, damageType, skill)
  3528. BattleLogic.WaitForTrigger(delay, function ()
  3529. if skill and skill.type == BattleSkillType.Special and target:IsDead() and BattleUtil.CheckIsNoDead(target) then
  3530. BattleUtil.RandomAction2(f1, function()
  3531. role:AddRage(target.Rage, CountTypeName.Add)
  3532. end)
  3533. end
  3534. end)
  3535. end
  3536. role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit)
  3537. end,
  3538. -- 受到的[a]效果伤害降低[b]%(与减伤盾原理相同)[c]改变
  3539. -- a[持续伤害状态]b[float]c[改变类型]
  3540. [198] = function(role, args, delay)
  3541. local dot = args[1]
  3542. local f1 = args[2]
  3543. local ct = args[3]
  3544. -- 释放技能后
  3545. local onPassiveBeDamaging = function(damagingFunc, defRole, damage, skill, dotType)
  3546. if dotType and (dotType == dot or dot == 0) then
  3547. local dd = damage - BattleUtil.CountValue(damage, f1, ct)
  3548. damagingFunc(floor(BattleUtil.ErrorCorrection(dd)))
  3549. end
  3550. end
  3551. role.Event:AddEvent(BattleEventName.PassiveBeDamaging, onPassiveBeDamaging)
  3552. end,
  3553. --每回合最多受到自身生命上限[a]%的伤害(该伤害为来自武将的直接伤害)
  3554. --a[float]
  3555. [199] = function(role, args, delay)
  3556. local f1 = args[1]
  3557. local curDamage = 0
  3558. local function onRoundChange()
  3559. curDamage = 0
  3560. end
  3561. BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, onRoundChange)
  3562. local function onFinalBeDamage(damagingFunc, atkRole, damage, skill, dotType, bCrit, damageType)
  3563. local maxDamage = role:GetRoleData(RoleDataName.MaxHp) * f1
  3564. curDamage = curDamage + damage
  3565. if curDamage > maxDamage then
  3566. -- 计算免除的伤害值
  3567. local md = curDamage - maxDamage
  3568. if md > damage then
  3569. md = damage
  3570. end
  3571. if damagingFunc then damagingFunc(md) end
  3572. end
  3573. end
  3574. role.Event:AddEvent(BattleEventName.FinalBeDamage, onFinalBeDamage)
  3575. end,
  3576. -- 同阵营武将受到直接伤害时该伤害[a]%转移给有此锦囊的武将转移伤害属于直接伤害(无法触发任何特性)
  3577. -- a[float]
  3578. [200] = function(role, args, delay)
  3579. local f1 = args[1]
  3580. local onFinalDamage = function(damagingFunc, atkRole, defRole, damage, skill, dotType, bCrit, damageType)
  3581. if skill and role.position ~= defRole.position and defRole.camp == role.camp and defRole.element == role.element then
  3582. local shareDamage = floor(BattleUtil.ErrorCorrection(damage * f1))
  3583. -- 被攻击武将自身伤害
  3584. if damagingFunc then
  3585. damagingFunc(shareDamage)
  3586. end
  3587. -- 分担伤害
  3588. BattleUtil.ApplyDamage(nil, atkRole, role, shareDamage)
  3589. end
  3590. end
  3591. BattleLogic.Event:AddEvent(BattleEventName.FinalDamage, onFinalDamage)
  3592. end,
  3593. -- 初始怒气增加[a]点并且目标血量低于[b]%时即有概率秒杀(对应秒杀技能)
  3594. -- a[int]b[float]
  3595. [201] = function(role, args, delay)
  3596. local i1 = args[1]
  3597. local f1 = args[2]
  3598. role:AddRage(i1, CountTypeName.Add)
  3599. local function onPassiveSeckill(func)
  3600. if func then func(f1, CountTypeName.Cover) end
  3601. end
  3602. role.Event:AddEvent(BattleEventName.PassiveSeckill, onPassiveSeckill)
  3603. end,
  3604. -- 秒杀概率增加[a]%直接伤害击杀的[b]目标有[c]%概率无法复活触发秒杀的目标[d]%无法复活,秒杀概率[e]改变
  3605. -- a[float]b[持续伤害状态]c[float]d[float]e[改变类型]
  3606. [202] = function(role, args, delay)
  3607. local f1 = args[1]
  3608. local dot = args[2]
  3609. local f2 = args[3]
  3610. local f3 = args[4]
  3611. local ct = args[5]
  3612. -- 秒杀概率增加
  3613. local function onPassiveSeckill(func)
  3614. if func then func(nil, nil, f1, ct) end
  3615. end
  3616. role.Event:AddEvent(BattleEventName.PassiveSeckill, onPassiveSeckill)
  3617. -- 直接伤害概率无法复活
  3618. local function onRoleHit(target)
  3619. BattleLogic.WaitForTrigger(delay, function ()
  3620. if target:IsDead() then
  3621. if not BattleLogic.BuffMgr:HasBuff(role, BuffName.DOT, function (buff) return buff.damageType == dot or dot == 0 end) then
  3622. BattleUtil.RandomAction2(f2, function()
  3623. target:SetReliveFilter(false)
  3624. end)
  3625. end
  3626. end
  3627. end)
  3628. end
  3629. role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit)
  3630. -- 秒杀概率无法复活
  3631. local function onSecKill(target)
  3632. BattleUtil.RandomAction2(f3, function()
  3633. target:SetReliveFilter(false)
  3634. end)
  3635. end
  3636. role.Event:AddEvent(BattleEventName.Seckill, onSecKill)
  3637. end,
  3638. -- 初始怒气增加[a]点敌方处于连接符状态的目标在回合结束时有[b]概率减少[c]点怒气
  3639. -- a[int]b[int]
  3640. [203] = function(role, args, delay)
  3641. local i1 = args[1]
  3642. local f1 = args[2]
  3643. local i2 = args[3]
  3644. -- 初始怒气增加
  3645. role:AddRage(i1, CountTypeName.Add)
  3646. -- 死亡数量
  3647. local onRoleTurnEnd = function(target)
  3648. BattleLogic.WaitForTrigger(delay, function ()
  3649. if not target:IsDead() and BattleLogic.BuffMgr:HasBuff(target, BuffName.Curse, function(buff) return buff.curseType == CurseTypeName.ShareDamage end) then
  3650. BattleUtil.RandomAction2(f1, function()
  3651. target:AddRage(i2, CountTypeName.Sub)
  3652. end)
  3653. end
  3654. end)
  3655. end
  3656. BattleLogic.Event:AddEvent(BattleEventName.RoleTurnEnd, onRoleTurnEnd)
  3657. end,
  3658. -- 敌方处于连接符状态的目标在获得无敌盾时有[a]%概率获取失败
  3659. -- a[float]
  3660. [204] = function(role, args, delay)
  3661. local f1 = args[1]
  3662. -- 死亡数量
  3663. local onRoleAddBuffMiss = function(func, target, buff)
  3664. -- 无敌盾
  3665. if buff.type == BuffName.Shield and buff.shieldType == ShieldTypeName.AllReduce then
  3666. -- 有连接符
  3667. if BattleLogic.BuffMgr:HasBuff(target, BuffName.Curse, function(buff) return buff.curseType == CurseTypeName.ShareDamage end) then
  3668. -- 提高miss概率
  3669. if func then func(f1, CountTypeName.Add) end
  3670. end
  3671. end
  3672. end
  3673. BattleLogic.Event:AddEvent(BattleEventName.RoleAddBuffMiss, onRoleAddBuffMiss)
  3674. end,
  3675. -- 伤害增加[a]%,[b]改变
  3676. -- a[float]b[改变类型]
  3677. [205] = function(role, args, delay)
  3678. local f1 = args[1]
  3679. local ct = args[2]
  3680. local passivityDamaging = function(func, caster, damage, skill)
  3681. if skill and func then
  3682. local dd = BattleUtil.CountValue(damage, f1, ct) - damage
  3683. func(-floor(BattleUtil.ErrorCorrection(dd)))
  3684. end
  3685. end
  3686. role.Event:AddEvent(BattleEventName.PassiveDamaging, passivityDamaging)
  3687. end,
  3688. --技能治疗系数[a]改变[b]%(作用于主动技能效果103)
  3689. --a[改变类型]b[float]
  3690. [206] = function(role, args, delay)
  3691. local ct = args[1]
  3692. local f1 = args[2]
  3693. local onSkillEffectBefore = function(skill, e, func)
  3694. if skill.type == BattleSkillType.Special then
  3695. if e.type == 103 then -- 当前只对技能效果103生效
  3696. local factor = BattleUtil.ErrorCorrection(BattleUtil.CountValue(e.args[3], f1, ct))
  3697. e.args[3] = factor
  3698. if func then func(e) end
  3699. end
  3700. end
  3701. end
  3702. role.Event:AddEvent(BattleEventName.SkillEffectBefore, onSkillEffectBefore)
  3703. end,
  3704. -- 释放技能有[a]%几率对敌方后排造成[b]%[c]伤害
  3705. -- a[float]b[float]c[伤害类型]
  3706. [207] = function(role, args, delay)
  3707. local f1 = args[1]
  3708. local f2 = args[2]
  3709. local dt = args[3]
  3710. -- 释放技能后
  3711. local onSkillEnd = function(skill)
  3712. BattleLogic.WaitForTrigger(delay, function ()
  3713. if skill.type == BattleSkillType.Special then
  3714. BattleUtil.RandomAction2(f1, function()
  3715. BattleLogic.WaitForTrigger(0.1, function()
  3716. local list = RoleManager.Query(function(v)
  3717. return v.camp == (role.camp + 1) % 2 and v.position > 3
  3718. end)
  3719. for _, r in ipairs(list) do
  3720. BattleUtil.CalDamage(nil, role, r, dt, f2)
  3721. end
  3722. end)
  3723. end)
  3724. end
  3725. end)
  3726. end
  3727. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd)
  3728. end,
  3729. -- 如果自身是[a],则[d]改变[b]的[c],[g改变[e]的[f]
  3730. -- a[位置],b[float],c[属性],d[改变类型],e[float],f[属性],g[改变类型]
  3731. [208] = function(role, args, delay)
  3732. local i1 = args[1]
  3733. local f1 = args[2]
  3734. local pro1 = args[3]
  3735. local ct1 = args[4]
  3736. local f2 = args[5]
  3737. local pro2 = args[6]
  3738. local ct2 = args[7]
  3739. if BattleUtil.GetRolePosType(role.position) == i1 then
  3740. BattleUtil.AddProp(role, pro1, f1, ct1)
  3741. BattleUtil.AddProp(role, pro2, f2, ct2)
  3742. end
  3743. end,
  3744. -- 我方[a]武将全部阵亡后,如果自身是[a],则[d]改变[b]的[c]
  3745. -- a[位置],b[位置],c[float],d[属性],e[改变类型]
  3746. [209] = function(role, args, delay)
  3747. local i1 = args[1]
  3748. local i2 = args[2]
  3749. local f1 = args[3]
  3750. local pro = args[4]
  3751. local ct = args[5]
  3752. local function _OnRoleRealDead(deadRole)
  3753. if role.camp == deadRole.camp then
  3754. local list = BattleUtil.GetRoleListByPosType(role.camp, i1)
  3755. if not list or #list == 0 then
  3756. if BattleUtil.GetRolePosType(role.position) == i2 then
  3757. BattleUtil.AddProp(role, pro, f1, ct)
  3758. -- 移除事件监听
  3759. BattleLogic.Event:RemoveEvent(BattleEventName.RoleRealDead, _OnRoleRealDead)
  3760. end
  3761. end
  3762. end
  3763. end
  3764. BattleLogic.Event:AddEvent(BattleEventName.RoleRealDead, _OnRoleRealDead)
  3765. end,
  3766. -- 如果自身是[a]和[b]武将则[e]改变[c]的[d]
  3767. -- a[类型],b[类型],c[float],d[属性],e[改变类型]
  3768. [210] = function(role, args, delay)
  3769. local pf1 = args[1]
  3770. local pf2 = args[2]
  3771. local f1 = args[3]
  3772. local pro = args[4]
  3773. local ct = args[5]
  3774. if role.professionId == pf1 or role.professionId == pf2 then
  3775. BattleUtil.AddProp(role, pro, f1, ct)
  3776. end
  3777. end,
  3778. -- 第[a]回合开始时,如果自身血量最低,则恢复[b]*[c]的血量
  3779. -- a[int],b[属性],c[float]
  3780. [211] = function(role, args, delay)
  3781. if PassiveManager.passiveCountList[role.camp][211] and PassiveManager.passiveCountList[role.camp][211] > 0 then
  3782. return
  3783. end
  3784. PassiveManager.passiveCountList[role.camp][211] = 1
  3785. local round = args[1]
  3786. local pro = args[2]
  3787. local f1 = args[3]
  3788. local function onRoundChange(curRound)
  3789. if curRound == round then
  3790. local list = RoleManager.Query(function(r) return r.camp == role.camp end)
  3791. list = BattleUtil.SortByProp(list, RoleDataName.Hp, 1)
  3792. local base = list[1]:GetRoleData(BattlePropList[pro])
  3793. local value = floor(BattleUtil.ErrorCorrection(base* f1))
  3794. BattleUtil.ApplyTreat(list[1], list[1], value)
  3795. end
  3796. end
  3797. BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, onRoundChange)
  3798. end,
  3799. -- 战斗开始时, 自身血量高于[a]%, 则[d]改变[b]的[c]
  3800. -- a[float],b[float],c[属性],d[改变类型]
  3801. [212] = function(role, args, delay)
  3802. local f1 = args[1]
  3803. local f2 = args[2]
  3804. local pro = args[3]
  3805. local ct = args[4]
  3806. local hp = role:GetRoleData(RoleDataName.Hp)
  3807. local maxHp = role:GetRoleData(RoleDataName.MaxHp)
  3808. if hp/maxHp >= f1 then
  3809. BattleUtil.AddProp(role, pro, f2, ct)
  3810. end
  3811. end,
  3812. -- 战斗开始时,回复自身[a]点怒气 --
  3813. -- a[int]
  3814. [213] = function(role, args, delay)
  3815. local i1 = args[1]
  3816. local function onRoundChange(curRound)
  3817. if curRound == 1 then
  3818. role:AddRage(i1, CountTypeName.Add)
  3819. -- BattleLogic.Event:RemoveEvent(BattleEventName.BattleRoundChange, onRoundChange)
  3820. end
  3821. end
  3822. BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, onRoundChange)
  3823. end,
  3824. -- 同阵营只会有一个生效
  3825. -- 第[a]回合中,敌人受到的任何伤害会对其他敌人造成该伤害[b]%的伤害
  3826. -- a[float],b[float]
  3827. [214] = function(role, args, delay)
  3828. if PassiveManager.passiveCountList[role.camp][214] and PassiveManager.passiveCountList[role.camp][214] > 0 then
  3829. return
  3830. end
  3831. PassiveManager.passiveCountList[role.camp][214] = 1
  3832. local i1 = args[1]
  3833. local f1 = args[2]
  3834. local function OnDamage(func, atkRole, defRole, damage, skill, dotType, bCrit, damageType)
  3835. if defRole.camp ~= role.camp then
  3836. if skill or dotType then
  3837. local list = RoleManager.Query(function(r) return r.camp == defRole.camp and r ~= defRole end)
  3838. for _, r in ipairs(list) do
  3839. local dd = floor(BattleUtil.ErrorCorrection(damage* f1))
  3840. BattleUtil.ApplyDamage(nil, role, r, dd)
  3841. end
  3842. end
  3843. end
  3844. end
  3845. local function onRoundChange(curRound)
  3846. if curRound == i1 then
  3847. BattleLogic.Event:AddEvent(BattleEventName.FinalDamage, OnDamage)
  3848. elseif curRound == i1 + 1 then
  3849. BattleLogic.Event:RemoveEvent(BattleEventName.FinalDamage, OnDamage)
  3850. -- BattleLogic.Event:RemoveEvent(BattleEventName.BattleRoundChange, onRoundChange)
  3851. end
  3852. end
  3853. BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, onRoundChange)
  3854. end,
  3855. -- 战斗开始时,使随机一名敌人受到的伤害增加[a]%,持续[b]回合。持续期间目标敌人死亡时,转移给另一名随机敌人
  3856. -- a[float],b[int]
  3857. [215] = function(role, args, delay)
  3858. if PassiveManager.passiveCountList[role.camp][215] and PassiveManager.passiveCountList[role.camp][215] > 0 then
  3859. return
  3860. end
  3861. PassiveManager.passiveCountList[role.camp][215] = 1
  3862. local f1 = args[1]
  3863. local i1 = args[2]
  3864. local target
  3865. local function RandomTarget()
  3866. local list = RoleManager.Query(function(r)
  3867. return r.camp ~= role.camp
  3868. end)
  3869. if #list < 1 then return end
  3870. local index = Random.RangeInt(1, #list)
  3871. target = list[index]
  3872. end
  3873. -- 伤害增加
  3874. local function _OnPassiveDamaging(damagingFunc, atkRole, defRole, damage)
  3875. if defRole == target then
  3876. local dd = floor(BattleUtil.ErrorCorrection(damage* f1))
  3877. if damagingFunc then damagingFunc(-dd) end
  3878. end
  3879. end
  3880. -- 死亡重新随机
  3881. local function _OnRoleRealDead(deadRole)
  3882. if deadRole == target then
  3883. RandomTarget()
  3884. end
  3885. end
  3886. --
  3887. local function onRoundChange(curRound)
  3888. if curRound == 1 then
  3889. RandomTarget()
  3890. BattleLogic.Event:AddEvent(BattleEventName.PassiveDamaging, _OnPassiveDamaging)
  3891. BattleLogic.Event:AddEvent(BattleEventName.RoleRealDead, _OnRoleRealDead)
  3892. elseif curRound == i1 + 1 then
  3893. target = nil
  3894. BattleLogic.Event:RemoveEvent(BattleEventName.PassiveDamaging, _OnPassiveDamaging)
  3895. BattleLogic.Event:RemoveEvent(BattleEventName.RoleRealDead, _OnRoleRealDead)
  3896. -- BattleLogic.Event:RemoveEvent(BattleEventName.BattleRoundChange, onRoundChange)
  3897. end
  3898. end
  3899. BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, onRoundChange)
  3900. end,
  3901. -- 第[a]回合开始时,对敌方全体造成目标最大生命值[b]%的伤害,并有[c]%概率造成[d]效果,持续[e]回合。
  3902. -- a[int],b[float],c[float],d[控制类型],e[int]
  3903. [216] = function(role, args, delay)
  3904. if PassiveManager.passiveCountList[role.camp][216] and PassiveManager.passiveCountList[role.camp][216] > 0 then
  3905. return
  3906. end
  3907. PassiveManager.passiveCountList[role.camp][216] = 1
  3908. local i1 = args[1]
  3909. local f1 = args[2]
  3910. local f2 = args[3]
  3911. local ctrl = args[4]
  3912. local i2 = args[5]
  3913. local function onRoundChange(curRound)
  3914. if curRound == i1 then
  3915. local list = RoleManager.Query(function(r) return r.camp ~= role.camp end)
  3916. for _, r in ipairs(list) do
  3917. --
  3918. local dd = floor(BattleUtil.ErrorCorrection(r:GetRoleData(RoleDataName.MaxHp)* f1))
  3919. local das = BattleUtil.PreCountShield(r, dd) -- 计算护盾吸收后的伤害值
  3920. local hp = r:GetRoleData(RoleDataName.Hp)
  3921. -- 有瑕疵,百分比减伤盾可能出现剩余血量不为1的问题
  3922. if das > hp then -- 护盾后伤害值依然致死
  3923. dd = dd - das + hp - 1
  3924. end
  3925. BattleUtil.ApplyDamage(nil, role, r, dd)
  3926. --概率控制
  3927. BattleUtil.RandomControl(f2, ctrl, role, r, i2)
  3928. end
  3929. end
  3930. end
  3931. BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, onRoundChange)
  3932. end,
  3933. -- 战斗结束时,恢复自身[a]的损失血量
  3934. -- a[float]
  3935. [217] = function(role, args, delay)
  3936. local f1 = args[1]
  3937. local function onBeforeBattleEnd()
  3938. if not role:IsDead() then
  3939. local maxHp = BattleUtil.ErrorCorrection(role:GetRoleData(RoleDataName.MaxHp))
  3940. local hp = BattleUtil.ErrorCorrection(role:GetRoleData(RoleDataName.Hp))
  3941. local dd = floor((maxHp - hp) * f1)
  3942. BattleUtil.ApplyTreat(role, role, dd)
  3943. end
  3944. end
  3945. BattleLogic.Event:AddEvent(BattleEventName.BeforeBattleEnd, onBeforeBattleEnd)
  3946. end,
  3947. --[218] 用 79实现
  3948. -- 敌方首次释放技能时,自身获得[a]*[b]的护盾,持续[c]回合
  3949. -- a[属性],b[float],c[int]
  3950. [219] = function(role, args, delay)
  3951. local pro = args[1]
  3952. local f1 = args[2]
  3953. local i1 = args[3]
  3954. local counter = 0
  3955. local function _OnSkillCast(skill)
  3956. if counter == 0 and skill.owner.camp ~= role.camp and skill.type == BattleSkillType.Special then
  3957. local dd = floor(BattleUtil.ErrorCorrection(role:GetRoleData(BattlePropList[pro])*f1))
  3958. local buff = Buff.Create(skill.owner, BuffName.Shield, i1, ShieldTypeName.NormalReduce, dd, 0)
  3959. role:AddBuff(buff)
  3960. counter = counter + 1
  3961. -- BattleLogic.Event:RemoveEvent(BattleEventName.SkillCast, _OnSkillCast)
  3962. end
  3963. end
  3964. BattleLogic.Event:AddEvent(BattleEventName.SkillCast, _OnSkillCast)
  3965. end,
  3966. -- 每当敌方英雄死亡时,自身[d]改变[b]的[c],[g改变[e]的[f]
  3967. -- b[float],c[属性],d[改变类型],e[float],f[属性],g[改变类型]
  3968. [220] = function(role, args, delay)
  3969. local f1 = args[1]
  3970. local pro1 = args[2]
  3971. local ct1 = args[3]
  3972. local f2 = args[4]
  3973. local pro2 = args[5]
  3974. local ct2 = args[6]
  3975. local function _OnRoleRealDead(deadRole)
  3976. if role.camp ~= deadRole.camp then
  3977. BattleUtil.AddProp(role, pro1, f1, ct1)
  3978. BattleUtil.AddProp(role, pro2, f2, ct2)
  3979. end
  3980. end
  3981. BattleLogic.Event:AddEvent(BattleEventName.RoleRealDead, _OnRoleRealDead)
  3982. end,
  3983. -- 我方武将造成伤害时,[a]概率降低目标[b]%的[c]。若同时拥有效果222,则降低的属性加给伤害者。
  3984. -- a[float],b[float],c[属性]
  3985. [221] = function(role, args, delay)
  3986. local rand = args[1]
  3987. local f1 = args[2]
  3988. local pro = args[3]
  3989. role:AddBuff(Buff.Create(role, BuffName.Brand, 0, "YUAN")) -- 鸳
  3990. --
  3991. local function _OnRoleHit(target)
  3992. BattleLogic.WaitForTrigger(delay, function ()
  3993. BattleUtil.RandomAction2(rand, function()
  3994. local buff = Buff.Create(role, BuffName.PropertyChange, 0, BattlePropList[pro], f1, CountTypeName.Sub)
  3995. buff.cover = true
  3996. buff.maxLayer = 1
  3997. target:AddBuff(buff)
  3998. -- BattleUtil.AddProp(target, pro, f1, CountTypeName.Sub)
  3999. if BattleLogic.BuffMgr:HasBuff(role, BuffName.Brand, function(buff) return buff.flag == "YANG" end) then
  4000. local buff = Buff.Create(role, BuffName.PropertyChange, 0, BattlePropList[pro], f1, CountTypeName.Add)
  4001. buff.cover = true
  4002. buff.maxLayer = 1
  4003. role:AddBuff(buff)
  4004. -- BattleUtil.AddProp(role, pro, f1, CountTypeName.Add)
  4005. end
  4006. end)
  4007. end)
  4008. end
  4009. role.Event:AddEvent(BattleEventName.RoleHit, _OnRoleHit)
  4010. end,
  4011. -- 我方武将造成伤害时,[a]概率降低目标[b]%的[c]。若同时拥有效果221,则降低的属性加给伤害者。
  4012. -- a[float],b[float],c[属性]
  4013. [222] = function(role, args, delay)
  4014. local rand = args[1]
  4015. local f1 = args[2]
  4016. local pro = args[3]
  4017. role:AddBuff(Buff.Create(role, BuffName.Brand, 0, "YANG")) -- 鸯
  4018. --
  4019. local function _OnRoleHit(target)
  4020. BattleLogic.WaitForTrigger(delay, function ()
  4021. BattleUtil.RandomAction2(rand, function()
  4022. local buff = Buff.Create(role, BuffName.PropertyChange, 0, BattlePropList[pro], f1, CountTypeName.Sub)
  4023. buff.cover = true
  4024. buff.maxLayer = 1
  4025. target:AddBuff(buff)
  4026. -- BattleUtil.AddProp(target, pro, f1, CountTypeName.Sub)
  4027. if BattleLogic.BuffMgr:HasBuff(role, BuffName.Brand, function(buff) return buff.flag == "YUAN" end) then
  4028. local buff = Buff.Create(role, BuffName.PropertyChange, 0, BattlePropList[pro], f1, CountTypeName.Add)
  4029. buff.cover = true
  4030. buff.maxLayer = 1
  4031. role:AddBuff(buff)
  4032. -- BattleUtil.AddProp(role, pro, f1, CountTypeName.Add)
  4033. end
  4034. end)
  4035. end)
  4036. end
  4037. role.Event:AddEvent(BattleEventName.RoleHit, _OnRoleHit)
  4038. end,
  4039. -- 普攻时,[a]概率附加[b]效果,每回合造成攻击[c]%的伤害,持续[d]秒。
  4040. -- a[float],b[持续伤害效果],c[float],d[int]
  4041. [223] = function(role, args, delay)
  4042. local rand = args[1]
  4043. local dot = args[2]
  4044. local f1 = args[3]
  4045. local i1 = args[3]
  4046. local function _OnRoleHit(target, damage, _, finalDmg, _, skill)
  4047. BattleLogic.WaitForTrigger(delay, function ()
  4048. -- BattleUtil.RandomDot(rand, dot, role, target, i1, 1, )
  4049. if skill and skill.type == BattleSkillType.Normal then
  4050. BattleUtil.RandomAction2(rand, function()
  4051. target:AddBuff(Buff.Create(role, BuffName.DOT, i1, 1, dot, 2, f1))
  4052. end)
  4053. end
  4054. end)
  4055. end
  4056. role.Event:AddEvent(BattleEventName.RoleHit, _OnRoleHit)
  4057. end,
  4058. -- 我方武将造成伤害时,[a]概率附加攻击[b]%的真伤。
  4059. -- a[float],b[float]
  4060. [224] = function(role, args, delay)
  4061. local rand = args[1]
  4062. local f1 = args[2]
  4063. local function _OnRoleHit(target)
  4064. BattleLogic.WaitForTrigger(delay, function ()
  4065. BattleUtil.RandomAction2(rand, function()
  4066. -- local dd = floor(BattleUtil.ErrorCorrection(role:GetRoleData(RoleDataName.Attack)*f1))
  4067. BattleUtil.CalDamage(nil, role, target, 1, f1, 1)
  4068. end)
  4069. end)
  4070. end
  4071. role.Event:AddEvent(BattleEventName.RoleHit, _OnRoleHit)
  4072. end,
  4073. --
  4074. [225] = function(role, args, delay)
  4075. --王振兴添加
  4076. local f1 = args[1]
  4077. local pro1 = args[2]
  4078. local ct1 = args[3]
  4079. local maxNum = args[4]
  4080. -- 紫+橙
  4081. local num = OutDataManager.GetOutData(role.camp, OutDataName.MisteryLiquidUsedTimes)
  4082. num = min(maxNum, num)
  4083. BattleUtil.AddProp(role, pro1, f1 * num, ct1)
  4084. end,
  4085. -- 斩杀生命低于[a]的敌人
  4086. -- a[float]
  4087. [226] = function(role, args, delay)
  4088. local f1 = args[1]
  4089. --
  4090. local onRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill)
  4091. if skill and not defRole:IsDead() then
  4092. -- 检测被动技能对秒杀参数得影响
  4093. local bf, kf = BattleUtil.CheckSeckill(f1, 0, role, defRole)
  4094. --
  4095. local ft = defRole:GetRoleData(RoleDataName.Hp)/defRole:GetRoleData(RoleDataName.MaxHp)
  4096. if ft < bf then
  4097. -- 秒杀
  4098. BattleUtil.Seckill(skill, role, defRole)
  4099. end
  4100. end
  4101. end
  4102. role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit)
  4103. end,
  4104. -- 杀敌回复自身[a]*[b]的血量
  4105. -- a[属性],b[float]
  4106. [227] = function(role, args, delay)
  4107. local pro = args[1]
  4108. local f1 = args[2]
  4109. -- 杀敌回血
  4110. local onRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill)
  4111. if skill and defRole:IsDead() then
  4112. -- 回血
  4113. local dd = floor(BattleUtil.ErrorCorrection(role:GetRoleData(BattlePropList[pro])*f1))
  4114. BattleUtil.ApplyTreat(role, role, dd)
  4115. end
  4116. end
  4117. role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit)
  4118. end,
  4119. -- 敌人生命越高,造成的伤害越高,最高[a]%
  4120. -- a[float]
  4121. [228] = function(role, args, delay)
  4122. local f1 = args[1]
  4123. local OnPassiveDamaging = function(damagingFunc, target, damage)
  4124. damagingFunc(-floor(BattleUtil.FP_Mul(f1, damage, BattleUtil.GetHPPencent(target))))
  4125. end
  4126. role.Event:AddEvent(BattleEventName.PassiveDamaging, OnPassiveDamaging)
  4127. end,
  4128. -- 自己血量越低,造成伤害越高,最多[a]%
  4129. -- a[float]
  4130. [229] = function(role, args, delay)
  4131. local f1 = args[1]
  4132. local OnPassiveDamaging = function(damagingFunc, target, damage)
  4133. damagingFunc(-floor(BattleUtil.FP_Mul(f1, damage, 1 - BattleUtil.GetHPPencent(role))))
  4134. end
  4135. role.Event:AddEvent(BattleEventName.PassiveDamaging, OnPassiveDamaging)
  4136. end,
  4137. -- 同阵营只生效一次
  4138. -- 敌方武将[c]改变[a]的[b]
  4139. -- a[float],b[属性],c[改变类型]
  4140. [230] = function(role, args, delay)
  4141. if PassiveManager.passiveCountList[role.camp][230] and PassiveManager.passiveCountList[role.camp][230] > 0 then
  4142. return
  4143. end
  4144. PassiveManager.passiveCountList[role.camp][230] = 1
  4145. local f1 = args[1]
  4146. local pro = args[2]
  4147. local ct = args[3]
  4148. local function _OnRoundChange(curRound)
  4149. if curRound == 1 then
  4150. local list = RoleManager.Query(function(r)
  4151. return r.camp ~= role.camp
  4152. end)
  4153. for _, r in ipairs(list) do
  4154. BattleUtil.AddProp(r, pro, f1, ct)
  4155. end
  4156. -- BattleLogic.Event:RemoveEvent(BattleEventName.BattleRoundChange, _OnRoundChange)
  4157. end
  4158. end
  4159. BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, _OnRoundChange)
  4160. end,
  4161. -- 我方[a]武将每回合[d]改变[b]的[c],可叠加
  4162. -- a[元素],b[float],c[属性],d[改变类型]
  4163. [231] = function(role, args, delay)
  4164. local ele = args[1]
  4165. local f1 = args[2]
  4166. local pro = args[3]
  4167. local ct = args[4]
  4168. local function _OnRoundChange(curRound)
  4169. if role.element == ele then
  4170. BattleUtil.AddProp(role, pro, f1, ct)
  4171. end
  4172. end
  4173. BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, _OnRoundChange)
  4174. end,
  4175. -- 我方[a]武将每回合恢复[b]的损失血量
  4176. -- a[元素],b[float]
  4177. [232] = function(role, args, delay)
  4178. local ele = args[1]
  4179. local f1 = args[2]
  4180. local function _OnRoundChange(curRound)
  4181. if role.element == ele then
  4182. local maxHp = BattleUtil.ErrorCorrection(role:GetRoleData(RoleDataName.MaxHp))
  4183. local hp = BattleUtil.ErrorCorrection(role:GetRoleData(RoleDataName.Hp))
  4184. local dd = floor((maxHp - hp) * f1)
  4185. BattleUtil.ApplyTreat(role, role, dd)
  4186. end
  4187. end
  4188. BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, _OnRoundChange)
  4189. end,
  4190. -- 我方[a]武将每回合获得[b]*[c]的护盾,持续[d]回合
  4191. -- a[元素],b[属性],c[float],d[int]
  4192. [233] = function(role, args, delay)
  4193. local ele = args[1]
  4194. local pro = args[2]
  4195. local f1 = args[3]
  4196. local i1 = args[4]
  4197. local function _OnRoundChange(curRound)
  4198. if role.element == ele then
  4199. local dd = floor(BattleUtil.ErrorCorrection(role:GetRoleData(BattlePropList[pro])*f1))
  4200. local buff = Buff.Create(role, BuffName.Shield, i1, ShieldTypeName.NormalReduce, dd, 0)
  4201. role:AddBuff(buff)
  4202. end
  4203. end
  4204. BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, _OnRoundChange)
  4205. end,
  4206. -- 我方[a]武将每回合[b]概率回复[c]点怒气
  4207. -- a[元素],b[float],c[int]
  4208. [234] = function(role, args, delay)
  4209. local ele = args[1]
  4210. local f1 = args[2]
  4211. local i1 = args[3]
  4212. local function _OnRoundChange(curRound)
  4213. BattleLogic.WaitForTrigger(delay, function ()
  4214. if role.element == ele then
  4215. BattleUtil.RandomAction2(f1, function()
  4216. role:AddRage(i1, CountTypeName.Add)
  4217. end)
  4218. end
  4219. end)
  4220. end
  4221. BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, _OnRoundChange)
  4222. end,
  4223. -- 我方每有一个[a]武将,自身[d]改变[b]的[c],可叠加(第一回合开始时生效)
  4224. -- a[元素],b[float],c[属性],d[改变类型]
  4225. [235] = function(role, args, delay)
  4226. local ele = args[1]
  4227. local f1 = args[2]
  4228. local pro = args[3]
  4229. local ct = args[4]
  4230. local function _OnRoundChange(curRound)
  4231. if curRound == 1 then
  4232. local list = RoleManager.Query(function(r)
  4233. return r.camp == role.camp and r.element == ele
  4234. end)
  4235. --
  4236. local num = #list
  4237. BattleUtil.AddProp(role, pro, f1*num, ct)
  4238. end
  4239. end
  4240. BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, _OnRoundChange)
  4241. end,
  4242. -- 猎妖之路专属
  4243. -- 根据同时拥有夜明珠的数量获得效果:2个:[c]改变[a]的[b];3个:[f]改变[d]的[e];4个:[i]改变[g]的[h]
  4244. -- a[float],b[属性],c[改变类型],d[float],e[属性],f[改变类型],g[float],h[属性],i[改变类型]
  4245. [237] = function(role, args, delay)
  4246. local f1 = args[1]
  4247. local pro1 = args[2]
  4248. local ct1 = args[3]
  4249. local f2 = args[4]
  4250. local pro2 = args[5]
  4251. local ct2 = args[6]
  4252. local f3 = args[7]
  4253. local pro3 = args[8]
  4254. local ct3 = args[9]
  4255. local num = OutDataManager.GetOutData(role.camp, OutDataName.DarkGlowBallNum)
  4256. if num >= 2 then
  4257. BattleUtil.AddProp(role, pro1, f1, ct1)
  4258. end
  4259. if num >= 3 then
  4260. BattleUtil.AddProp(role, pro2, f2, ct2)
  4261. end
  4262. if num >= 4 then
  4263. BattleUtil.AddProp(role, pro3, f3, ct3)
  4264. end
  4265. end,
  4266. -- 猎妖之路专属
  4267. -- 在大闹天空的第[a]层中,我方武将[d]改变[b]的[c],[g改变[e]的[f]
  4268. -- a[位置],b[float],c[属性],d[改变类型],e[float],f[属性],g[改变类型]
  4269. [238] = function(role, args, delay)
  4270. local flr = args[1]
  4271. local f1 = args[2]
  4272. local pro1 = args[3]
  4273. local ct1 = args[4]
  4274. local f2 = args[5]
  4275. local pro2 = args[6]
  4276. local ct2 = args[7]
  4277. if OutDataManager.GetOutData(role.camp, OutDataName.DaNaoTianGongFloor) == flr then
  4278. BattleUtil.AddProp(role, pro1, f1, ct1)
  4279. BattleUtil.AddProp(role, pro2, f2, ct2)
  4280. end
  4281. end,
  4282. -- 猎妖之路专属
  4283. -- 每有一件紫色品质以上的战利品,我方武将[d]改变[b]的[c],[g改变[e]的[f],最多[h]层
  4284. -- b[float],c[属性],d[改变类型],e[float],f[属性],g[改变类型],h[int]
  4285. [239] = function(role, args, delay)
  4286. local f1 = args[1]
  4287. local pro1 = args[2]
  4288. local ct1 = args[3]
  4289. local f2 = args[4]
  4290. local pro2 = args[5]
  4291. local ct2 = args[6]
  4292. local maxNum = args[7]
  4293. -- 紫+橙
  4294. local num = OutDataManager.GetOutData(role.camp, OutDataName.PerpleGloryItemNum) + OutDataManager.GetOutData(role.camp, OutDataName.OrangeGloryItemNum)
  4295. num = min(maxNum, num)
  4296. BattleUtil.AddProp(role, pro1, f1 * num, ct1)
  4297. BattleUtil.AddProp(role, pro2, f2 * num, ct2)
  4298. end,
  4299. -- 猎妖之路专属
  4300. -- 每使用一次神秘药水,我方武将[c]改变[a]的[b],最多[d]层
  4301. -- a[float],b[属性],c[改变类型],d[int]
  4302. [240] = function(role, args, delay)
  4303. local f1 = args[1]
  4304. local pro1 = args[2]
  4305. local ct1 = args[3]
  4306. local maxNum = args[4]
  4307. -- 紫+橙
  4308. local num = OutDataManager.GetOutData(role.camp, OutDataName.MisteryLiquidUsedTimes)
  4309. num = min(maxNum, num)
  4310. BattleUtil.AddProp(role, pro1, f1 * num, ct1)
  4311. end,
  4312. -- 每当友方英雄死亡时,自身[d]改变[b]的[c],[g]改变[e]的[f]
  4313. -- b[float],c[属性],d[改变类型],e[float],f[属性],g[改变类型]
  4314. [241] = function(role, args, delay)
  4315. local f1 = args[1]
  4316. local pro1 = args[2]
  4317. local ct1 = args[3]
  4318. local f2 = args[4]
  4319. local pro2 = args[5]
  4320. local ct2 = args[6]
  4321. local function _OnRoleRealDead(deadRole)
  4322. if role.camp == deadRole.camp then
  4323. BattleUtil.AddProp(role, pro1, f1, ct1)
  4324. BattleUtil.AddProp(role, pro2, f2, ct2)
  4325. end
  4326. end
  4327. BattleLogic.Event:AddEvent(BattleEventName.RoleRealDead, _OnRoleRealDead)
  4328. end,
  4329. --> 战斗开始时, 敌方所有人[a]属性[b]改变[c], 持续[d]回合
  4330. [304] = function(role, args, delay)
  4331. local _a = args[1]
  4332. local _b = args[2]
  4333. local _c = args[3]
  4334. local _d = args[4]
  4335. local function _OnRoundChange(curRound)
  4336. if curRound == 1 then
  4337. local list = RoleManager.Query(function(r)
  4338. return r.camp ~= role.camp
  4339. end)
  4340. for _, r in ipairs(list) do
  4341. local buff = Buff.Create(role, BuffName.PropertyChange, _d, BattlePropList[_a], _c, _b)
  4342. r:AddBuff(buff)
  4343. buff.clear =false
  4344. end
  4345. end
  4346. end
  4347. BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, _OnRoundChange)
  4348. end,
  4349. --> 战斗开始时, 己方所有人[a]属性[b]改变[c], 持续[d]回合
  4350. [327] = function(role, args, delay)
  4351. local _a = args[1]
  4352. local _b = args[2]
  4353. local _c = args[3]
  4354. local _d = args[4]
  4355. local function _OnRoundChange(curRound)
  4356. if curRound == 1 then
  4357. local list = RoleManager.Query(function(r)
  4358. return r.camp == role.camp
  4359. end)
  4360. for _, r in ipairs(list) do
  4361. r:AddBuff(Buff.Create(role, BuffName.PropertyChange, _d, BattlePropList[_a], _c, _b))
  4362. end
  4363. end
  4364. end
  4365. BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, _OnRoundChange)
  4366. end,
  4367. --> 每回合开始时, 若自己血量大于50%, 则自己[a]属性[b]改变[c], 反之则[d]属性[e]改变[f]
  4368. [300] = function(role, args, delay)
  4369. local _a = args[1]
  4370. local _b = args[2]
  4371. local _c = args[3]
  4372. local _d = args[4]
  4373. local _e = args[5]
  4374. local _f = args[6]
  4375. local ishighOnPer = true
  4376. local isFirstChange = true
  4377. local function _OnRoundChange(curRound)
  4378. if not isFirstChange then
  4379. if ishighOnPer then
  4380. BattleUtil.RevertProp(role, _a, _c, _b)
  4381. else
  4382. BattleUtil.RevertProp(role, _d, _f, _e)
  4383. end
  4384. end
  4385. if role:GetRoleData(RoleDataName.Hp) > BattleUtil.ErrorCorrection(role:GetRoleData(RoleDataName.MaxHp) / 2) then
  4386. BattleUtil.AddProp(role, _a, _c, _b)
  4387. ishighOnPer = true
  4388. else
  4389. BattleUtil.AddProp(role, _d, _f, _e)
  4390. ishighOnPer = false
  4391. end
  4392. isFirstChange = false
  4393. end
  4394. BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, _OnRoundChange)
  4395. end,
  4396. --> 攻击时, 有[a]概率使[b]目标的[c]属性[d]改变[e], 持续[f]回合
  4397. [324] = function(role, args, delay)
  4398. local _a = args[1]
  4399. local _b = args[2]
  4400. local _c = args[3]
  4401. local _d = args[4]
  4402. local _e = args[5]
  4403. local _f = args[6]
  4404. local isCover = true
  4405. local coverLayer = 1
  4406. --RoleManager.LogArgs("324",args)
  4407. local onRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill)
  4408. BattleLogic.WaitForTrigger(delay, function ()
  4409. BattleUtil.RandomAction2(_a, function()
  4410. if skill and not defRole:IsDead() then
  4411. local buff = Buff.Create(role, BuffName.PropertyChange, _f, _c, _e, _d)
  4412. local dfbuff = Buff.Create(defRole, BuffName.PropertyChange, _f, _c, _e, _d)
  4413. buff.cover = isCover -- 非叠加buff
  4414. dfbuff.cover = isCover -- 非叠加buff
  4415. buff.maxLayer = coverLayer-- 叠加层数
  4416. dfbuff.maxLayer = coverLayer -- 叠加层数
  4417. if _b == 1 then
  4418. defRole:AddBuff(dfbuff)
  4419. -- dfbuff:OnTrigger()
  4420. elseif _b == 2 then
  4421. role:AddBuff(buff)
  4422. elseif _b == 3 then
  4423. defRole:AddBuff(dfbuff)
  4424. role:AddBuff(buff)
  4425. -- dfbuff:OnTrigger()
  4426. else
  4427. dfbuff.disperse = true
  4428. buff.disperse = true
  4429. end
  4430. -- buff:OnTrigger()
  4431. end
  4432. end)
  4433. end)
  4434. end
  4435. role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit)
  4436. end,
  4437. --> 攻击时, 目标若有[a]控制状态, 则[b]目标[c]属性临时[d]改变[e]
  4438. [305] = function(role, args, delay)
  4439. local _a = args[1]
  4440. local _b = args[2]
  4441. local _c = args[3]
  4442. local _d = args[4]
  4443. local _e = args[5]
  4444. local onRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill)
  4445. if BattleLogic.BuffMgr:HasBuff(defRole, BuffName.Control, function(buff) return (buff.ctrlType == _a or _a == 0) end) then
  4446. if _b == 1 then
  4447. BattleUtil.AddProp(defRole, _c, _e, _d)
  4448. elseif _b == 2 then
  4449. BattleUtil.AddProp(role, _c, _e, _d)
  4450. elseif _b == 3 then
  4451. BattleUtil.AddProp(defRole, _c, _e, _d)
  4452. BattleUtil.AddProp(role, _c, _e, _d)
  4453. end
  4454. end
  4455. end
  4456. role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit)
  4457. end,
  4458. --> 攻击时, 目标若有[a]属性状态, 则[b]目标[c]属性临时[d]改变[e]
  4459. [307] = function(role, args, delay)
  4460. local _a = args[1]
  4461. local _b = args[2]
  4462. local _c = args[3]
  4463. local _d = args[4]
  4464. local _e = args[5]
  4465. -- RoleManager.LogArgs("307",args)
  4466. local isAdd = false
  4467. local _defRole = nil
  4468. local _defRoles = {}
  4469. local onRoleHit = function(defRole, damageType, f, skill)
  4470. if BattleLogic.BuffMgr:HasBuff(defRole, BuffName.PropertyChange, function(buff) return (buff.propertyChangeType == _a or _a == 0) end) then
  4471. if _b == 1 then
  4472. BattleUtil.AddProp(defRole, _c, _e, _d)
  4473. table.insert(_defRoles, defRole)
  4474. elseif _b == 2 then
  4475. BattleUtil.AddProp(role, _c, _e, _d)
  4476. _defRole = defRole
  4477. elseif _b == 3 then
  4478. BattleUtil.AddProp(defRole, _c, _e, _d)
  4479. BattleUtil.AddProp(role, _c, _e, _d)
  4480. _defRole = defRole
  4481. end
  4482. isAdd =true
  4483. end
  4484. end
  4485. role.Event:AddEvent(BattleEventName.RoleDamageBefore, onRoleHit)
  4486. local RoleDamageAfter = function(SkillRole)
  4487. if isAdd then
  4488. --RoleManager.LogCa("revert 307")
  4489. if _b == 1 then
  4490. if #_defRoles > 0 then
  4491. for i = 1, #_defRoles do
  4492. if not _defRoles[i]:IsRealDead() then
  4493. BattleUtil.RevertProp(_defRoles[i], _c, _e, _d)
  4494. end
  4495. end
  4496. _defRoles = nil
  4497. _defRoles = {}
  4498. isAdd=false
  4499. end
  4500. elseif _b == 2 then
  4501. BattleUtil.RevertProp(role, _c, _e, _d)
  4502. isAdd=false
  4503. elseif _b == 3 then
  4504. if _defRole ~=nil and not _defRole:IsRealDead() then
  4505. BattleUtil.RevertProp(_defRole, _c, _e, _d)
  4506. isAdd=false
  4507. end
  4508. BattleUtil.RevertProp(role, _c, _e, _d)
  4509. isAdd=false
  4510. end
  4511. end
  4512. end
  4513. role.Event:AddEvent(BattleEventName.RoleTurnEnd, RoleDamageAfter)
  4514. end,
  4515. --> new 攻击时, 技能目标被"冰封结界"冰冻概率变为[a],每当目标被附加[b]控制状态或[c]属性状态时, 增加自己[d]和[e]属性[f],持续[g]回合(可叠加10层),
  4516. --> new 如果目标的[h]控制状态被解除, 会对全体敌方单位造成自己攻击力[i]的[j]伤害
  4517. [308] = function(role, args, delay)
  4518. -- local _a = args[1] 0.1
  4519. -- local _b = args[2] 8
  4520. -- local _c = args[3] 1
  4521. -- local _d = args[4] 22
  4522. -- local _e = args[5] 9
  4523. -- local _f = args[6] 0.03
  4524. -- local _g = args[7] 2
  4525. -- local _h = args[8] 8 --
  4526. -- local _i = args[9] 0.2
  4527. -- local _j = args[10] 2
  4528. -- local _k = args[11]
  4529. local _a = args[1]
  4530. local _b = args[2]
  4531. local _c = args[3]
  4532. local _d = args[4]
  4533. local _e = args[5]
  4534. local _f = args[6]
  4535. local _g = args[7]
  4536. local _h = args[8]
  4537. local _i = args[9]
  4538. local _j = args[10]
  4539. local _k = args[11]
  4540. --> 提高敌方被冰冻概率10%(该效果不可驱散),
  4541. --> 敌方武将每被冰冻或减速一次提高自身攻击和暴击10.2%,可叠加持续2回合(上限10层),
  4542. --> 如果打碎敌方的冰冻效果会对全体敌方武将造成孙权攻击20%的伤害
  4543. local onRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill)
  4544. -- local onBuffEnd = function(buff)
  4545. -- if buff.type == BuffName.Control and buff.ctrlType == _i then
  4546. -- local list = RoleManager.Query(function(v) return role.camp ~= v.camp end)
  4547. -- local damage = BattleUtil.FP_Mul(role:GetRoleData(RoleDataName.Attack), _j)
  4548. -- for k, v in ipairs(list) do
  4549. -- BattleUtil.ApplyDamage(nil, role, v, damage)
  4550. -- end
  4551. -- end
  4552. -- end
  4553. -- defRole.Event:AddEvent(BattleEventName.BuffEnd, onBuffEnd)
  4554. -- LogError("control attack:"..defRole.roleId)
  4555. if BattleLogic.BuffMgr:HasBuff(defRole, BuffName.Control, function(buff) return buff.ctrlType == ControlType.Frozen end) then
  4556. local bufflist = BattleLogic.BuffMgr:GetBuff(defRole, function(buff)
  4557. return buff.type == BuffName.Control and buff.ctrlType == ControlType.Frozen
  4558. end)
  4559. local frozenBuff = bufflist[1]
  4560. --> 共3次击碎
  4561. if frozenBuff.frozen_beHitTimes == 2 then
  4562. local list = RoleManager.Query(function(v) return role.camp ~= v.camp end)
  4563. local damage = BattleUtil.FP_Mul(role:GetRoleData(RoleDataName.Attack), _i)
  4564. for k, v in ipairs(list) do
  4565. BattleUtil.ApplyDamage(nil, role, v, damage)--damage
  4566. end
  4567. end
  4568. end
  4569. end
  4570. local function _OnRoundChange(curRound)
  4571. if curRound == 1 then
  4572. local list = RoleManager.Query(function(v) return role.camp ~= v.camp end)
  4573. -- 我方击碎产生效果
  4574. local mylist = RoleManager.Query(function(v) return role.camp == v.camp end)
  4575. for k, role in ipairs(mylist) do
  4576. role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit)
  4577. end
  4578. for k, v in ipairs(list) do
  4579. local onBuffStart = function(_buff)
  4580. if (_buff.type == BuffName.Control and _buff.ctrlType == _b) or (_buff.type == BuffName.PropertyChange and _buff.propertyChangeType == _c) then
  4581. local buff = Buff.Create(role, BuffName.PropertyChange, _g, BattlePropList[_d], _f, CountTypeName.Add)
  4582. buff.cover = true
  4583. buff.maxLayer = 10
  4584. role:AddBuff(buff)
  4585. buff = Buff.Create(role, BuffName.PropertyChange, _g, BattlePropList[_e], _f, CountTypeName.Add)
  4586. buff.cover = true
  4587. buff.maxLayer = 10
  4588. role:AddBuff(buff)
  4589. end
  4590. end
  4591. --冰封结界修正概率 a
  4592. local onBuffProbabilityChange =function(_buffFrozen)
  4593. if _buffFrozen.propertyName == RoleDataName.AttackAddition and _buffFrozen.propertyChangeType == PropertyChangeType.Icebound then
  4594. _buffFrozen.probaFrozenFix = _a
  4595. end
  4596. end
  4597. v.Event:AddEvent(BattleEventName.BuffStart, onBuffProbabilityChange)
  4598. v.Event:AddEvent(BattleEventName.BuffStart, onBuffStart)
  4599. end
  4600. end
  4601. end
  4602. BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, _OnRoundChange)
  4603. end,
  4604. --> 攻击时, 若目标存在[a]或[b]持续伤害状态, 则[c]目标的[d]属性临时[e]改变[f]
  4605. [309] = function(role, args, delay)
  4606. local _a = args[1]
  4607. local _b = args[2]
  4608. local _c = args[3]
  4609. local _d = args[4] --22
  4610. local _e = args[5]
  4611. local _f = args[6] --10
  4612. --RoleManager.LogArgs("309",args)
  4613. local isAdd = false
  4614. local onRoleHit = function(defRole, factorFunc, damageType, skill)
  4615. if BattleLogic.BuffMgr:HasBuff(defRole, BuffName.DOT, function(buff) return (buff.damageType == _a or buff.damageType == _b) end) then
  4616. if _c == 1 then
  4617. BattleUtil.AddProp(defRole, _d, _f, _e)
  4618. isAdd = true
  4619. elseif _c == 2 then
  4620. BattleUtil.AddProp(role, _d, _f, _e)
  4621. isAdd = true
  4622. elseif _c == 3 then
  4623. BattleUtil.AddProp(defRole, _d, _f, _e)
  4624. BattleUtil.AddProp(role, _d, _f, _e)
  4625. isAdd = true
  4626. end
  4627. end
  4628. end
  4629. role.Event:AddEvent(BattleEventName.RoleDamageBefore, onRoleHit)
  4630. local onRoleDamageAfter = function (defRole, damageFunc, fixDamage)
  4631. if isAdd then
  4632. if _c == 1 then
  4633. BattleUtil.RevertProp(defRole, _d, _f, _e)
  4634. isAdd = false
  4635. elseif _c == 2 then
  4636. BattleUtil.RevertProp(role, _d, _f, _e)
  4637. isAdd = false
  4638. elseif _c == 3 then
  4639. BattleUtil.RevertProp(defRole, _d, _f, _e)
  4640. BattleUtil.RevertProp(role, _d, _f, _e)
  4641. isAdd = false
  4642. end
  4643. end
  4644. end
  4645. role.Event:AddEvent(BattleEventName.RoleDamageAfter, onRoleDamageAfter)
  4646. end,
  4647. --> 攻击时, 有[a]概率为目标附加1个【标识】,最多[b]层(自己的叠加上限),每个【标识】使自己的[c]属性[d]改变[e],
  4648. -- [f]个及以上【标识】使携带者的[g]属性[h]改变[i]
  4649. [320] = function(role, args, delay)
  4650. local _a = args[1] -- 1
  4651. local _b = args[2] -- 10
  4652. local _c = args[3] -- 22
  4653. local _d = args[4] -- 1
  4654. local _e = args[5] -- 0.03
  4655. local _f = args[6] -- 3
  4656. local _g = args[7] -- 6
  4657. local _h = args[8] -- 3
  4658. local _i = args[9] -- 0.3
  4659. --RoleManager.LogArgs("320",args)
  4660. local function getEmenySignNum()
  4661. local list = RoleManager.Query(function(v) return role.camp ~= v.camp and not role:IsRealDead() end)
  4662. local totalSignNum = 0
  4663. for k, v in ipairs(list) do
  4664. local brandSignList = BattleLogic.BuffMgr:GetBuff(v, function(buff)
  4665. return buff.type == BuffName.Brand and buff.flag == BrandType.Sign
  4666. end)
  4667. if brandSignList and #brandSignList > 0 then
  4668. totalSignNum = totalSignNum + brandSignList[1].layer
  4669. end
  4670. end
  4671. --LogError("totalSignNum:"..totalSignNum)
  4672. return totalSignNum
  4673. end
  4674. local onRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill)
  4675. BattleLogic.WaitForTrigger(delay, function ()
  4676. BattleUtil.RandomAction2(_a, function()
  4677. local brand = Buff.Create(defRole, BuffName.Brand, 0, BrandType.Sign)
  4678. -- brand.maxLayer = _b
  4679. brand.clear = false
  4680. brand.startFunc= function()
  4681. if getEmenySignNum() <= _b then
  4682. BattleUtil.AddProp(role, _c, _e, _d)
  4683. end
  4684. local brandSignList = BattleLogic.BuffMgr:GetBuff(defRole, function(buff)
  4685. return buff.type == BuffName.Brand and buff.flag == BrandType.Sign
  4686. end)
  4687. if brandSignList and #brandSignList > 0 then
  4688. if brandSignList[1].layer == _f then
  4689. --LogError("layer add f:"..brandSignList[1].layer)
  4690. BattleUtil.AddProp(defRole, _g, _i, _h)
  4691. end
  4692. end
  4693. end
  4694. brand.endFunc = function ()
  4695. local signs=getEmenySignNum()
  4696. if brand.disperse or brand.caster.isRealDead then
  4697. if signs <= _b then
  4698. for i=1, brand.layer do
  4699. BattleUtil.RevertProp(role, _c, _e, _d)
  4700. end
  4701. else
  4702. --多余层数还原
  4703. local del_signs = brand.layer + _b - signs
  4704. if del_signs > 0 then
  4705. for i=1, del_signs do
  4706. BattleUtil.RevertProp(role, _c, _e, _d)
  4707. end
  4708. end
  4709. end
  4710. local brandSignList = BattleLogic.BuffMgr:GetBuff(brand.caster, function(buff)
  4711. return buff.type == BuffName.Brand and buff.flag == BrandType.Sign
  4712. end)
  4713. if brandSignList and #brandSignList > 0 then
  4714. if brandSignList[1].layer < _f then
  4715. --LogError("revert one f:"..brandSignList[1].layer)
  4716. BattleUtil.RevertProp(brand.caster, _g, _i, _h)
  4717. end
  4718. end
  4719. end
  4720. end
  4721. defRole:AddBuff(brand)
  4722. brand.duration = 0 --永久存在
  4723. end)
  4724. end)
  4725. end
  4726. role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit)
  4727. end,
  4728. --> 攻击时, 若目标的生命大于等于[a], 则[b]目标的[c]属性临时[d]改变[e]
  4729. [321] = function(role, args, delay)
  4730. local _a = args[1]
  4731. local _b = args[2]
  4732. local _c = args[3]
  4733. local _d = args[4]
  4734. local _e = args[5]
  4735. local onRoleDamageBefore = function(defRole, damage, bCrit, finalDmg, damageType, skill)
  4736. local hpPercent = BattleUtil.ErrorCorrection(defRole:GetRoleData(RoleDataName.Hp) / defRole:GetRoleData(RoleDataName.MaxHp))
  4737. if hpPercent >= _a then
  4738. if _b == 1 then
  4739. BattleUtil.AddProp(defRole, _c, _e, _d)
  4740. elseif _b == 2 then
  4741. BattleUtil.AddProp(role, _c, _e, _d)
  4742. elseif _b == 3 then
  4743. BattleUtil.AddProp(defRole, _c, _e, _d)
  4744. BattleUtil.AddProp(role, _c, _e, _d)
  4745. end
  4746. local OnSkillCastEndOnce = nil
  4747. OnSkillCastEndOnce = function(skill)
  4748. role.Event:RemoveEvent(BattleEventName.SkillCastEnd, OnSkillCastEndOnce)
  4749. --还原属性
  4750. if _b == 1 then
  4751. BattleUtil.RevertProp(defRole, _c, _e, _d)
  4752. elseif _b == 2 then
  4753. BattleUtil.RevertProp(role, _c, _e, _d)
  4754. elseif _b == 3 then
  4755. BattleUtil.RevertProp(defRole, _c, _e, _d)
  4756. BattleUtil.RevertProp(role, _c, _e, _d)
  4757. end
  4758. end
  4759. role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEndOnce)
  4760. end
  4761. end
  4762. role.Event:AddEvent(BattleEventName.RoleDamageBefore, onRoleDamageBefore)
  4763. end,
  4764. --> 攻击时, 若目标的生命小于[a], 则[b]目标的[c]属性临时[d]改变[e]
  4765. [345] = function(role, args, delay)
  4766. local _a = args[1]
  4767. local _b = args[2]
  4768. local _c = args[3]
  4769. local _d = args[4]
  4770. local _e = args[5] -- +100
  4771. -- RoleManager.LogArgs("345",args)
  4772. local onRoleHit = function( defRole, factorFunc, damageType, skill,baseFactor)
  4773. local hpPercent = defRole:GetRoleData(RoleDataName.Hp) / defRole:GetRoleData(RoleDataName.MaxHp)
  4774. -- LogError("per"..hpPercent)
  4775. if hpPercent < _a then
  4776. if _b == 1 then
  4777. BattleUtil.AddProp(defRole, _c, _e+0.0001, _d)
  4778. -- LogError("add ".._c)
  4779. elseif _b == 2 then
  4780. BattleUtil.AddProp(role, _c, _e+0.0001, _d)
  4781. -- LogError("add ".._c)
  4782. elseif _b == 3 then
  4783. BattleUtil.AddProp(defRole, _c, _e+0.0001, _d)
  4784. BattleUtil.AddProp(role, _c, _e+0.0001, _d)
  4785. -- LogError("add ".._c)
  4786. end
  4787. -- LogError("add"..hpPercent)
  4788. local OnSkillCastEndOnce = nil
  4789. OnSkillCastEndOnce = function(skill)
  4790. role.Event:RemoveEvent(BattleEventName.SkillCastEnd, OnSkillCastEndOnce)
  4791. --还原属性
  4792. if _b == 1 then
  4793. BattleUtil.RevertProp(defRole, _c, _e, _d)
  4794. elseif _b == 2 then
  4795. BattleUtil.RevertProp(role, _c, _e, _d)
  4796. elseif _b == 3 then
  4797. BattleUtil.RevertProp(defRole, _c, _e, _d)
  4798. BattleUtil.RevertProp(role, _c, _e, _d)
  4799. end
  4800. end
  4801. role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEndOnce)
  4802. end
  4803. end
  4804. role.Event:AddEvent(BattleEventName.RoleDamageBefore, onRoleHit)
  4805. end,
  4806. --> 攻击时, 若目标的生命小于[a], 则[b]概率为[c]目标附加[d]属性状态, [e]改变[f], 持续[g]回合
  4807. [322] = function(role, args, delay)
  4808. local _a = args[1]
  4809. local _b = args[2]
  4810. local _c = args[3]
  4811. local _d = args[4]
  4812. local _e = args[5]
  4813. local _f = args[6]
  4814. local _g = args[7]
  4815. -- RoleManager.LogArgs("322",args)
  4816. local isCover = true
  4817. local coverLayer = 1
  4818. local onRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill)
  4819. BattleLogic.WaitForTrigger(delay, function ()
  4820. local hpPercent = BattleUtil.ErrorCorrection(defRole:GetRoleData(RoleDataName.Hp) / defRole:GetRoleData(RoleDataName.MaxHp))
  4821. if hpPercent < _a then
  4822. BattleUtil.RandomAction2(_b, function()
  4823. if skill and not defRole:IsDead() then
  4824. local buff = Buff.Create(role, BuffName.PropertyChange, _g, PropertyChangeTypeMap[_d], _f, _e, _d)
  4825. local buff_2 = Buff.Create(role, BuffName.PropertyChange, _g, PropertyChangeTypeMap[_d], _f, _e, _d)
  4826. buff.maxLayer = coverLayer
  4827. buff_2.maxLayer = coverLayer
  4828. buff.cover = isCover
  4829. buff_2.cover = isCover
  4830. if _c == 1 then
  4831. defRole:AddBuff(buff_2)
  4832. buff_2:OnStart()
  4833. elseif _c == 2 then
  4834. role:AddBuff(buff)
  4835. buff:OnStart()
  4836. elseif _c == 3 then
  4837. defRole:AddBuff(buff_2)
  4838. role:AddBuff(buff)
  4839. buff_2:OnStart()
  4840. buff:OnStart()
  4841. else
  4842. buff.disperse = true
  4843. buff_2.disperse = true
  4844. end
  4845. end
  4846. end)
  4847. end
  4848. end)
  4849. end
  4850. role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit)
  4851. end,
  4852. --> 攻击时, 若目标的速度小于自己, 则[a]目标的[b]属性临时[c]改变[d]
  4853. [326] = function(role, args, delay)
  4854. local _a = args[1]
  4855. local _b = args[2]
  4856. local _c = args[3]
  4857. local _d = args[4]
  4858. local onRoleDamageBefore = function(defRole, damage, bCrit, finalDmg, damageType, skill)
  4859. if defRole:GetRoleData(RoleDataName.Speed) < role:GetRoleData(RoleDataName.Speed) then
  4860. if _a == 1 then
  4861. BattleUtil.AddProp(defRole, _b, _d, _c)
  4862. elseif _a == 2 then
  4863. BattleUtil.AddProp(role, _b, _d, _c)
  4864. elseif _a == 3 then
  4865. BattleUtil.AddProp(defRole, _b, _d, _c)
  4866. BattleUtil.AddProp(role, _b, _d, _c)
  4867. end
  4868. local OnSkillCastEndOnce = nil
  4869. OnSkillCastEndOnce = function(skill)
  4870. role.Event:RemoveEvent(BattleEventName.SkillCastEnd, OnSkillCastEndOnce)
  4871. --还原属性
  4872. if _a == 1 then
  4873. BattleUtil.RevertProp(defRole, _b, _d, _c)
  4874. elseif _a == 2 then
  4875. BattleUtil.RevertProp(role, _b, _d, _c)
  4876. elseif _a == 3 then
  4877. BattleUtil.RevertProp(defRole, _b, _d, _c)
  4878. BattleUtil.RevertProp(role, _b, _d, _c)
  4879. end
  4880. end
  4881. role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEndOnce)
  4882. end
  4883. end
  4884. role.Event:AddEvent(BattleEventName.RoleDamageBefore, onRoleDamageBefore)
  4885. end,
  4886. --> 攻击时, 若目标是[a]阵营, 则[b]目标的[c]属性临时[d]改变[e]
  4887. [342] = function(role, args, delay)
  4888. local _a = args[1]
  4889. local _b = args[2]
  4890. local _c = args[3]
  4891. local _d = args[4]
  4892. local _e = args[5]
  4893. local triggered=false
  4894. local onRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill)
  4895. if defRole.roleData.element == _a then
  4896. if _b == 1 then
  4897. BattleUtil.AddProp(defRole, _c, _e, _d)
  4898. elseif _b == 2 then
  4899. BattleUtil.AddProp(role, _c, _e, _d)
  4900. elseif _b == 3 then
  4901. BattleUtil.AddProp(defRole, _c, _e, _d)
  4902. BattleUtil.AddProp(role, _c, _e, _d)
  4903. end
  4904. triggered=true
  4905. end
  4906. end
  4907. local onRoleHitRevert = function(damagingFunc, defRole, damage, skill, dotType, bCrit, damageType)
  4908. if defRole.roleData.element == _a and triggered then
  4909. if _b == 1 then
  4910. BattleUtil.RevertProp(defRole, _c, _e, _d)
  4911. elseif _b == 2 then
  4912. BattleUtil.RevertProp(role, _c, _e, _d)
  4913. elseif _b == 3 then
  4914. BattleUtil.RevertProp(defRole, _c, _e, _d)
  4915. BattleUtil.RevertProp(role, _c, _e, _d)
  4916. end
  4917. triggered=false
  4918. end
  4919. end
  4920. role.Event:AddEvent(BattleEventName.FinalDamage, onRoleHitRevert)
  4921. role.Event:AddEvent(BattleEventName.RoleDamageBefore, onRoleHit)
  4922. end,
  4923. --> 为自己添加魔种
  4924. --> 攻击时, 有[a]概率清除任意己方单位的一个[b]清除状态, 并为其附加一层【魔种】, 最多[c]层, 每层魔种使携带者[d]属性[e]改变[f], 无法驱散一直存在
  4925. [349] = function(role, args, delay)
  4926. local _a = args[1] -- 0.3
  4927. local _b = args[2] -- 6
  4928. local _c = args[3] -- 5
  4929. local _d = args[4] -- 22
  4930. local _e = args[5] -- 1
  4931. local _f = args[6] -- 0.05
  4932. --每次攻击可转化次数 目前固定为 1次
  4933. local TurnOnce = 1
  4934. -- RoleManager.LogArgs("349",args)
  4935. local function getNum()
  4936. local totalSignNum = 0
  4937. local brandSignList = BattleLogic.BuffMgr:GetBuff(role, function(buff)
  4938. return buff.type == BuffName.Brand and buff.flag == BrandType.MagicSeed
  4939. end)
  4940. if brandSignList and #brandSignList > 0 then
  4941. totalSignNum = brandSignList[1].layer
  4942. end
  4943. return totalSignNum
  4944. end
  4945. local searchFunc = function(role)
  4946. local list = BattleLogic.BuffMgr:GetBuff(role, function (buff)
  4947. return buff.type == BuffName.Control or buff.isDeBuff or buff.type == BuffName.DOT
  4948. end)
  4949. return list and #list > 0
  4950. end
  4951. local onRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill)
  4952. if TurnOnce <=0 then
  4953. return
  4954. else
  4955. TurnOnce = TurnOnce - 1
  4956. end
  4957. BattleLogic.WaitForTrigger(delay, function ()
  4958. local clearBuff = nil
  4959. local clearRole = nil
  4960. local list = RoleManager.Query(searchFunc,false)
  4961. list = BattleUtil.ShufferRoles(list,1)
  4962. if not list or #list==0 then return end
  4963. for k, v in ipairs(list) do
  4964. local bList = BattleLogic.BuffMgr:GetBuff(v, function (buff)
  4965. return clearBuffPredicate(buff, _b) and buff.clear
  4966. end)
  4967. if #bList > 0 then
  4968. clearBuff = bList[1]
  4969. clearRole = v
  4970. break
  4971. end
  4972. end
  4973. if clearBuff then
  4974. BattleUtil.RandomAction2(_a, function()
  4975. BattleLogic.BuffMgr:ClearBuff(clearRole, function (buff)
  4976. return clearBuff == buff and buff.clear
  4977. end)
  4978. if getNum() < _c then
  4979. local brand = Buff.Create(role, BuffName.Brand, 0, BrandType.MagicSeed)
  4980. brand.maxLayer = _c
  4981. brand.clear = false
  4982. brand.endFunc = function ()
  4983. BattleUtil.RevertProp(role, _d, _f * brand.layer, _e)
  4984. end
  4985. brand.cover = true
  4986. role:AddBuff(brand)
  4987. brand.startFunc =function()
  4988. BattleUtil.AddProp(role, _d, _f * brand.layer, _e)
  4989. end
  4990. else
  4991. local brand2 = Buff.Create(role, BuffName.Brand, 1, BrandType.MagicSeed)
  4992. brand2.clear = true
  4993. brand2.cover = false
  4994. role:AddBuff(brand2)
  4995. end
  4996. end)
  4997. end
  4998. end)
  4999. end
  5000. role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit)
  5001. local onRoleStart = function()
  5002. TurnOnce = 1
  5003. end
  5004. role.Event:AddEvent(BattleEventName.RoleTurnStart, onRoleStart)
  5005. end,
  5006. --> 攻击后, 自己的[a]属性[b]改变[c],可叠加,持续[d]回合
  5007. [301] = function(role, args, delay)
  5008. local _a = args[1]
  5009. local _b = args[2]
  5010. local _c = args[3]
  5011. local _d = args[4]
  5012. local onSkillLastEffectTrigger = function(skill)
  5013. local buff = Buff.Create(role, BuffName.PropertyChange, _d, BattlePropList[_a], _c, _b)
  5014. buff.cover = false
  5015. buff.maxLayer = 0
  5016. role:AddBuff(buff)
  5017. end
  5018. role.Event:AddEvent(BattleEventName.SkillLastEffectTrigger, onSkillLastEffectTrigger)
  5019. end,
  5020. --> 释放[a]号技能时, 有[b]概率使技能目标的[c]属性[d]改变[e], 可叠加, 持续[f]回合
  5021. [306] = function(role, args, delay)
  5022. local _a = args[1] -- 1
  5023. local _b = args[2] -- 1
  5024. local _c = args[3] -- 9
  5025. local _d = args[4] -- 1
  5026. local _e = args[5] -- 0.2
  5027. local _f = args[6] -- 2
  5028. local OnSkillCast = function(skill)
  5029. BattleLogic.WaitForTrigger(delay, function ()
  5030. if skill.ext_slot == _a then
  5031. BattleUtil.RandomAction2(_b, function ()
  5032. local targets = skill:GetDirectTargets()
  5033. if not targets or #targets == 0 then return end
  5034. for _, target in ipairs(targets) do
  5035. local buff = Buff.Create(role, BuffName.PropertyChange, _f, BattlePropList[_c], _e, _d)
  5036. --buff.cover = true
  5037. target:AddBuff(buff)
  5038. buff.maxLayer = NormalMaxLayer
  5039. end
  5040. end)
  5041. end
  5042. end)
  5043. end
  5044. role.Event:AddEvent(BattleEventName.SkillCast, OnSkillCast)
  5045. end,
  5046. --> 释放[a]号技能时, 若目标是[b]阵营, 则[c]目标的[d]属性临时[e]改变[f]
  5047. [310] = function(role, args, delay)
  5048. local _a = args[1]
  5049. local _b = args[2]
  5050. local _c = args[3]
  5051. local _d = args[4]
  5052. local _e = args[5]
  5053. local _f = args[6]
  5054. local isAdded = false
  5055. local targets =nil
  5056. local AddEnemyProp =function(skill)
  5057. targets = skill:GetDirectTargets()
  5058. if not targets or #targets == 0 then return end
  5059. for _, target in ipairs(targets) do
  5060. if target.roleData.element == _b then
  5061. BattleUtil.AddProp(target, _d, _f, _e)
  5062. end
  5063. end
  5064. end
  5065. local RevertEnemyProp=function()
  5066. if not targets or #targets == 0 then return end
  5067. for _, target in ipairs(targets) do
  5068. if target.roleData.element == _b and not target:IsRealDead() then
  5069. BattleUtil.RevertProp(target, _d, _f, _e)
  5070. end
  5071. end
  5072. end
  5073. local OnSkillCast = function(skill)
  5074. if skill.ext_slot == _a then
  5075. if _c == 1 then
  5076. AddEnemyProp(skill)
  5077. isAdded=true
  5078. elseif _c == 2 then
  5079. BattleUtil.AddProp(role, _d, _f, _e)
  5080. isAdded=true
  5081. elseif _c == 3 then
  5082. AddEnemyProp(skill)
  5083. BattleUtil.AddProp(role, _d, _f, _e)
  5084. isAdded=true
  5085. end
  5086. end
  5087. end
  5088. role.Event:AddEvent(BattleEventName.SkillCast, OnSkillCast)
  5089. -- 还原属性
  5090. local OnSkillCastEnd = function(skill)
  5091. if isAdded then
  5092. if _c == 1 then
  5093. RevertEnemyProp()
  5094. isAdded=false
  5095. elseif _c == 2 then
  5096. BattleUtil.RevertProp(role, _d, _f, _e)
  5097. isAdded=false
  5098. elseif _c == 3 then
  5099. RevertEnemyProp()
  5100. BattleUtil.RevertProp(role, _d, _f, _e)
  5101. isAdded=false
  5102. end
  5103. end
  5104. end
  5105. role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
  5106. end,
  5107. --> 释放[a]号技能时, 若目标是[b]阵营, 则有[c]概率为目标附加[d]控制状态,持续[e]回合
  5108. [311] = function(role, args, delay)
  5109. local _a = args[1]
  5110. local _b = args[2]
  5111. local _c = args[3]
  5112. local _d = args[4]
  5113. local _e = args[5]
  5114. local _f = args[6]
  5115. local OnSkillCast = function(skill)
  5116. if skill.ext_slot == _a then
  5117. local targets = skill:GetDirectTargets()
  5118. if not targets or #targets == 0 then return end
  5119. for _, target in ipairs(targets) do
  5120. if target.roleData.element == _b then
  5121. BattleUtil.RandomControl(_c, _d, role, target, _e)
  5122. end
  5123. end
  5124. end
  5125. end
  5126. role.Event:AddEvent(BattleEventName.SkillCast, OnSkillCast)
  5127. end,
  5128. --> 释放[a]号技能时, 若击杀目标, 则[b]几率使目标无法复活
  5129. [323] = function(role, args, delay)
  5130. local _a = args[1]
  5131. local _b = args[2]
  5132. local OnRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill)
  5133. BattleLogic.WaitForTrigger(delay, function ()
  5134. if defRole:IsDead() then
  5135. BattleUtil.RandomAction2(_b, function()
  5136. defRole:SetReliveFilter(false)
  5137. end)
  5138. end
  5139. end)
  5140. end
  5141. local OnSkillCast = function(skill)
  5142. if skill.ext_slot == _a then
  5143. role.Event:AddEvent(BattleEventName.RoleHit, OnRoleHit)
  5144. end
  5145. end
  5146. role.Event:AddEvent(BattleEventName.SkillCast, OnSkillCast)
  5147. local OnSkillCastEnd = function(skill)
  5148. if skill.ext_slot == _a then
  5149. role.Event:RemoveEvent(BattleEventName.RoleHit, OnRoleHit)
  5150. end
  5151. end
  5152. role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
  5153. end,
  5154. --> 释放[a]号技能时, 有[b]概率对处目标外的随机[c]个敌方单位造成攻击[d]的[e]伤害
  5155. [333] = function(role, args, delay)
  5156. local _a = args[1]
  5157. local _b = args[2]
  5158. local _c = args[3]
  5159. local _d = args[4]
  5160. local _e = args[5]
  5161. local OnRoleDamageBefore = function(defRole, factorFunc, damageType, skill,baseFactor)
  5162. BattleLogic.WaitForTrigger(delay, function ()
  5163. -- local onRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill)
  5164. -- local OnSkillFirstEffectTrigger = function(skill)
  5165. if skill.ext_slot == _a then
  5166. BattleUtil.RandomAction2(_b, function()
  5167. local targets = skill:GetDirectTargets()
  5168. if not targets or #targets == 0 then return end
  5169. local list = RoleManager.Query(function(v) return role.camp ~= v.camp end)
  5170. local otherRole = {}
  5171. for index, value in ipairs(list) do
  5172. local isHave = false
  5173. for _, target in ipairs(targets) do
  5174. if value == target then
  5175. isHave = true
  5176. end
  5177. end
  5178. if not isHave then
  5179. table.insert(otherRole, value)
  5180. end
  5181. end
  5182. if #otherRole > 0 then
  5183. Random.RandomList(otherRole)
  5184. local num = math.min(_c, #otherRole)
  5185. for i = 1, num do
  5186. if otherRole[i] then
  5187. -- 记录技能伤害
  5188. local dif = baseFactor*_d
  5189. BattleUtil.CalSimpleDamage(nil, role, otherRole[i],damageType,dif)
  5190. -- BattleUtil.TriggerDamage(nil, role, otherRole[i], floor(damage * _d))
  5191. -- BattleUtil.ApplyDamage(nil, role, otherRole[i], floor(role:GetRoleData(RoleDataName.Attack) * _d))
  5192. end
  5193. end
  5194. end
  5195. end)
  5196. end
  5197. end)
  5198. end
  5199. -- role.Event:AddEvent(BattleEventName.SkillFirstEffectTrigger, OnSkillFirstEffectTrigger)
  5200. role.Event:AddEvent(BattleEventName.RoleDamageBefore, OnRoleDamageBefore)
  5201. -- role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit)
  5202. end,
  5203. --> 释放[a]号技能时, 有[b]概率使[c]目标附加[d]控制状态, , 持续[e]回合
  5204. [334] = function(role, args, delay)
  5205. local _a = args[1] --1
  5206. local _b = args[2] --0.5
  5207. local _c = args[3] --1
  5208. local _d = args[4] --10
  5209. local _e = args[5] --2
  5210. local OnSkillCast = function(skill)
  5211. BattleLogic.WaitForTrigger(delay, function ()
  5212. if skill.ext_slot == _a then
  5213. local target1 = function()
  5214. BattleUtil.RandomAction2(_b, function()
  5215. local targets = skill:GetDirectTargets()
  5216. if not targets or #targets == 0 then return end
  5217. for _, target in ipairs(targets) do
  5218. BattleUtil.RandomControl(1, _d, role, target, _e)
  5219. end
  5220. end)
  5221. end
  5222. local target2 = function()
  5223. BattleUtil.RandomControl(_b, _d, role, role, _e)
  5224. end
  5225. if _c == 1 then
  5226. target1()
  5227. elseif _c == 2 then
  5228. target2()
  5229. end
  5230. end
  5231. end)
  5232. end
  5233. role.Event:AddEvent(BattleEventName.SkillCast, OnSkillCast)
  5234. end,
  5235. --> 受到攻击时, [a]概率触发【反击】,对攻击者造成攻击[b]的[c]型伤害
  5236. [302] = function(role, args, delay)
  5237. local _a = args[1]
  5238. local _b = args[2]
  5239. local _c = args[3]
  5240. role.isHoldBeatingBack = true
  5241. local OnBeHit = nil
  5242. --> RoleBeHit受击正常是会触发一次(按之前的逻辑) 加个skillcast reset 确保一下
  5243. OnBeHit = function(atkRole, damage, bCrit, finalDmg, damageType, skill, transType)
  5244. --自己或者自己阵营的人攻击自己不造成反击
  5245. if atkRole.camp == role.camp then
  5246. return
  5247. end
  5248. -- BattleLogic.WaitForTrigger(delay, function ()
  5249. if not skill.isAdd then --混乱状态不造成反击
  5250. return
  5251. end
  5252. if role.isHoldBeatingBack then
  5253. BattleUtil.RandomAction2(_a, function ()
  5254. --是否是混乱状态的反击(特殊处理)
  5255. role.ctrl_chaos_beatBack = true
  5256. --修改伤害百分比(临时处理写死,可优化)
  5257. -- 由于仅修改原始参数每次修改会叠加 所以增加镜像数据镜像 原始数据不会修改
  5258. -- BattleUtil.ChangeBaseSkillDamage(role,_b,_c,1)
  5259. local cloneArrary = BattleUtil.cloneTable(role.skillArray)
  5260. BattleUtil.ChangeSkillArrayDamage(cloneArrary,_b,_c,1)
  5261. role:InsertSkill(SkillBaseType.Physical, false, {[1] = {atkRole}}, cloneArrary[1], SkillSubType.BeatBack)
  5262. --BattleUtil.CalDamage(nil, role, atkRole, _c, _b)
  5263. -- BattleUtil.TirggerOnceAtEvent(role,
  5264. -- function(_role,args)
  5265. -- BattleUtil.RevertBaseSkillDamage(_role)
  5266. -- end,
  5267. -- BattleEventName.RoleDamageAfter,nil)
  5268. end
  5269. )
  5270. role.isHoldBeatingBack = false
  5271. end
  5272. -- end)
  5273. end
  5274. role.Event:AddEvent(BattleEventName.RoleBeHit, OnBeHit)
  5275. local OnSkillCast = function(skill)
  5276. role.isHoldBeatingBack = true
  5277. end
  5278. role.Event:AddEvent(BattleEventName.SkillCast, OnSkillCast)
  5279. end,
  5280. --> 受到攻击时, [a]概率为攻击者附加[b]持续伤害状态, 每回合减少相当于施法者[c]属性[d]的生命, 持续[e]回合
  5281. [315] = function(role, args, delay)
  5282. local _a = args[1]
  5283. local _b = args[2]
  5284. local _c = args[3]
  5285. local _d = args[4]
  5286. local _e = args[5]
  5287. local OnBeHit = function(atkRole, damage, bCrit, finalDmg, damageType)
  5288. BattleLogic.WaitForTrigger(delay, function ()
  5289. local hitblood = floor(role:GetRoleData(BattlePropList[_c]) * _d)
  5290. BattleUtil.RandomDot(_a, _b, role, atkRole, _e, 1, hitblood, function(buff)
  5291. buff.isRealDamage = true
  5292. end)
  5293. --[[
  5294. BattleUtil.RandomAction2(_a, function ()
  5295. local hitblood = floor(role:GetRoleData(BattlePropList[_c]) * _d)
  5296. local dot = Buff.Create(role, BuffName.DOT, _e, 1, _b, hitblood)
  5297. dot.isRealDamage = true
  5298. atkRole:AddBuff(dot)
  5299. end)
  5300. ]]
  5301. end)
  5302. end
  5303. role.Event:AddEvent(BattleEventName.RoleBeHit, OnBeHit)
  5304. end,
  5305. --> 受到攻击时, 如果目标是[a]职业, 则[b]属性临时[c]改变[d]
  5306. [303] = function(role, args, delay)
  5307. local _a = args[1] --3
  5308. local _b = args[2] --6
  5309. local _c = args[3] --1
  5310. local _d = args[4] --0.15
  5311. local OnBeHit = function( atkRole, factorFunc, damageType, skill,baseFactor,defRole)
  5312. if atkRole.professionId == _a then
  5313. BattleUtil.AddProp(role, _b, _d, _c)
  5314. BattleUtil.TirggerOnceAtEvent(role,function(_role,args)
  5315. BattleUtil.RevertProp(_role, _b, _d, _c)
  5316. end
  5317. ,BattleEventName.RoleBeDamagedAfter,nil)
  5318. end
  5319. end
  5320. role.Event:AddEvent(BattleEventName.RoleBeDamagedBefore, OnBeHit)
  5321. end,
  5322. --> 受到攻击时, 增加[a]点怒气, 最多[b]点怒气
  5323. [318] = function(role, args, delay)
  5324. local _a = args[1]
  5325. local _b = args[2]
  5326. local OnBeHit = function(atkRole, damage, bCrit, finalDmg, damageType)
  5327. local brand = Buff.Create(role, BuffName.Brand, 0, BrandType.Angry)
  5328. brand.layer = _a
  5329. brand.maxLayer = _b
  5330. brand.endFunc = function ()
  5331. end
  5332. role:AddBuff(brand)
  5333. end
  5334. role.Event:AddEvent(BattleEventName.RoleBeHit, OnBeHit)
  5335. end,
  5336. --> 受到攻击时, 伤害不会超过自己[a]属性的[b]
  5337. [331] = function(role, args, delay)
  5338. local _a = args[1]
  5339. local _b = args[2]
  5340. local function onFinalBeDamage(damagingFunc, atkRole, damage, skill, dotType, bCrit, damageType)
  5341. local maxDamage = floor(role:GetRoleData(BattlePropList[_a]) * _b)
  5342. if damage > maxDamage then
  5343. -- 计算免除的伤害值
  5344. local md = damage - maxDamage
  5345. if damagingFunc then damagingFunc(md) end
  5346. end
  5347. end
  5348. role.Event:AddEvent(BattleEventName.FinalBeDamage, onFinalBeDamage)
  5349. end,
  5350. --> 受到攻击时, 有[a]概率给攻击者附加【诅咒】, 在[b]回合后给攻击者造成受击者[c]属性[d]的伤害, 诅咒可同时存在多个
  5351. [346] = function(role, args, delay)
  5352. local _a = args[1]
  5353. local _b = args[2]
  5354. local _c = args[3]
  5355. local _d = args[4]
  5356. local OnBeHit = function(atkRole, damage, bCrit, finalDmg, damageType)
  5357. BattleLogic.WaitForTrigger(delay, function ()
  5358. BattleUtil.RandomAction2(_a, function()
  5359. local brand = Buff.Create(role, BuffName.Brand, _b, BrandType.curse)
  5360. brand.TriggerFunc = function()
  5361. local damage = floor(role:GetRoleData(BattlePropList[_c]) * _d)
  5362. BattleUtil.ApplyDamage(nil, role, atkRole, damage, nil, nil, BuffDamageType.Curse, false)
  5363. end
  5364. brand:SetInterval(_b)
  5365. brand.cover = false
  5366. atkRole:AddBuff(brand)
  5367. -- local auraBuff = Buff.Create(role, BuffName.Aura, _b, function (target)
  5368. -- BattleUtil.ApplyDamage(nil, role, atkRole, floor(role:GetRoleData(BattlePropList[_c]) * _d))
  5369. -- end)
  5370. -- auraBuff.interval = _b
  5371. -- atkRole:AddBuff(auraBuff)
  5372. end)
  5373. end)
  5374. end
  5375. role.Event:AddEvent(BattleEventName.RoleBeHit, OnBeHit)
  5376. end,
  5377. --> 普通攻击时, 有[a]概率为[b]目标附加[c]属性状态, [d]改变[e], 持续[f]回合
  5378. [330] = function(role, args, delay)
  5379. local _a = args[1]
  5380. local _b = args[2]
  5381. local _c = args[3]
  5382. local _d = args[4]
  5383. local _e = args[5]
  5384. local _f = args[6]
  5385. local OnRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill)
  5386. BattleLogic.WaitForTrigger(delay, function ()
  5387. if skill.ext_slot == 0 then
  5388. if not defRole:IsDead() then
  5389. BattleUtil.RandomAction2(_a, function()
  5390. defRole:AddBuff(Buff.Create(role, BuffName.PropertyChange, _f, PropertyChangeTypeMap[_c], _e, _d, _c))
  5391. end)
  5392. end
  5393. end
  5394. end)
  5395. end
  5396. role.Event:AddEvent(BattleEventName.RoleHit, OnRoleHit)
  5397. end,
  5398. --> 普通攻击时, 为己方生命最低的单位恢复相当于自身[a]属性[b]的生命
  5399. [329] = function(role, args, delay)
  5400. local _a = args[1]
  5401. local _b = args[2]
  5402. local OnRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill)
  5403. if skill.ext_slot == 0 then
  5404. local list = RoleManager.Query(function(v) return role.camp == v.camp end)
  5405. if list and #list > 0 then
  5406. local livemin = nil
  5407. local minhp = 100000000
  5408. for _, r in pairs(list) do
  5409. local hp = r:GetRoleData(RoleDataName.Hp)
  5410. if hp < minhp then
  5411. minhp = hp
  5412. livemin = r
  5413. end
  5414. end
  5415. local hp = floor(role:GetRoleData(BattlePropList[_a]) * _b)
  5416. if livemin then
  5417. BattleUtil.ApplyTreat(role, livemin, hp)
  5418. end
  5419. end
  5420. end
  5421. end
  5422. role.Event:AddEvent(BattleEventName.RoleHit, OnRoleHit)
  5423. end,
  5424. --> 普通攻击时, 有[a]概率给目标附加【诅咒】, 在[b]回合后给携带者造成施法者[c]属性[d]的伤害, 诅咒可同时存在多个
  5425. [344] = function(role, args, delay)
  5426. local _a = args[1]
  5427. local _b = args[2]
  5428. local _c = args[3]
  5429. local _d = args[4]
  5430. local OnRoleHit = function(atkRole, damage, bCrit, finalDmg, damageType, skill)
  5431. BattleLogic.WaitForTrigger(delay, function ()
  5432. if skill.ext_slot == 0 then
  5433. BattleUtil.RandomAction2(_a, function()
  5434. local brand = Buff.Create(role, BuffName.Brand, _b, BrandType.curse)
  5435. brand.TriggerFunc=function()
  5436. local damage = floor(role:GetRoleData(BattlePropList[_c]) * _d)
  5437. --诅咒类型的buff伤害没有克制
  5438. BattleUtil.ApplyDamage(nil, role, atkRole, damage, nil, nil, BuffDamageType.Curse, false)
  5439. end
  5440. brand:SetInterval(_b)
  5441. brand.cover = false
  5442. atkRole:AddBuff(brand)
  5443. end)
  5444. end
  5445. end)
  5446. end
  5447. role.Event:AddEvent(BattleEventName.RoleHit, OnRoleHit)
  5448. end,
  5449. --> 自己死亡时, 为己方所有单位恢复相当于自身[a]属性[b]的生命, 只能触发[c]次
  5450. [328] = function(role, args, delay)
  5451. local _a = args[1]
  5452. local _b = args[2]
  5453. local _c = args[3]
  5454. local OnDead = nil
  5455. local cnt = 0
  5456. OnDead = function(atkRole)
  5457. local list = RoleManager.Query(function(v) return role.camp == v.camp end)
  5458. for i=1, #list do
  5459. local val = floor(BattleUtil.FP_Mul(_b, role:GetRoleData(BattlePropList[_a])))
  5460. BattleUtil.CalTreat(role, list[i], val)
  5461. end
  5462. cnt = cnt + 1
  5463. if cnt >= _c then
  5464. role.Event:RemoveEvent(BattleEventName.RoleDead, OnDead)
  5465. end
  5466. end
  5467. role.Event:AddEvent(BattleEventName.RoleDead, OnDead)
  5468. end,
  5469. --> 自己死亡时, 立即复活,并恢复[a]属性[b]的生命,[c]属性[d]改变[e],持续[f]回合
  5470. [314] = function(role, args, delay)
  5471. local _a = args[1]
  5472. local _b = args[2]
  5473. local _c = args[3]
  5474. local _d = args[4]
  5475. local _e = args[5]
  5476. local _f = args[6]
  5477. local counter = 0
  5478. local onRoleRealDead = function(deadRole)
  5479. counter = counter + 1
  5480. if counter == 1 then
  5481. deadRole:SetRelive(BattleUtil.FP_Mul(role:GetRoleData(BattlePropList[_a]), _b) / role:GetRoleData(RoleDataName.MaxHp))
  5482. end
  5483. end
  5484. local counter2 = 0
  5485. local OnRoleRelive = function(deadRole)
  5486. counter2 = counter2 + 1
  5487. if counter2 == 1 then
  5488. deadRole:AddBuff(Buff.Create(role, BuffName.PropertyChange, _f, BattlePropList[_c], _e, _d))
  5489. end
  5490. end
  5491. role.Event:AddEvent(BattleEventName.RoleRelive, OnRoleRelive)
  5492. role.Event:AddEvent(BattleEventName.RoleRealDead, onRoleRealDead)
  5493. end,
  5494. --> 己方单位暴击时, 为己方全体单位恢复伤害量[a]的生命
  5495. [313] = function(role, args, delay)
  5496. local _a = args[1]
  5497. local isAdd = false
  5498. local onRoundChange = function(curRound)
  5499. if curRound == 1 and not isAdd then
  5500. local list = RoleManager.Query(function(v) return role.camp == v.camp and role.roleId ~= v.roleId end)
  5501. local tubuList = RoleManager.QueryTibu(function(v) return role.camp == v.camp and role.roleId ~= v.roleId end)
  5502. local onRoleCrit = function(defRole, damage, bCrit, finalDmg, damageType, skill)
  5503. if role:IsDead() then
  5504. return
  5505. end
  5506. local list2 = RoleManager.Query(function(v) return role.camp == v.camp end)
  5507. local val = floor(BattleUtil.FP_Mul(damage, _a))
  5508. for i=1, #list2 do
  5509. BattleUtil.CalTreat(role, list2[i], val)
  5510. end
  5511. end
  5512. for i=1, #list do
  5513. list[i].Event:AddEvent(BattleEventName.RoleCrit, onRoleCrit)
  5514. end
  5515. for i=1, #tubuList do
  5516. tubuList[i].Event:AddEvent(BattleEventName.RoleCrit, onRoleCrit)
  5517. end
  5518. role.Event:AddEvent(BattleEventName.RoleCrit, onRoleCrit)
  5519. isAdd = true
  5520. end
  5521. end
  5522. BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, onRoundChange)
  5523. end,
  5524. --> 己方单位暴击时, 为己方全体单位附加吸收盾, 吸收量为伤害量的[a], 持续[b]回合
  5525. [348] = function(role, args, delay)
  5526. local _a = args[1]
  5527. local _b = args[2]
  5528. local onRoundChange = function(curRound)
  5529. if curRound == 1 then
  5530. local list = RoleManager.Query(function(v) return role.camp == v.camp end)
  5531. local tubuList = RoleManager.QueryTibu(function(v) return role.camp == v.camp end)
  5532. local onRoleCrit = function(defRole, damage, bCrit, finalDmg, damageType, skill)
  5533. if role:IsDead() then
  5534. return
  5535. end
  5536. local list2 = RoleManager.Query(function(v) return role.camp == v.camp end)
  5537. local val = floor(BattleUtil.FP_Mul(damage, _a))
  5538. for i=1, #list2 do
  5539. local buff = Buff.Create(role, BuffName.Shield, _b, ShieldTypeName.NormalReduce, val, 0)
  5540. buff.cover = true
  5541. buff.isValueCover = true
  5542. list2[i]:AddBuff(buff)
  5543. end
  5544. end
  5545. for i=1, #list do
  5546. list[i].Event:AddEvent(BattleEventName.RoleCrit, onRoleCrit)
  5547. end
  5548. for i=1, #tubuList do
  5549. tubuList[i].Event:AddEvent(BattleEventName.RoleCrit, onRoleCrit)
  5550. end
  5551. end
  5552. end
  5553. BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, onRoundChange)
  5554. end,
  5555. --> 击杀目标时, 若目标是[a]阵营, 则自身恢复伤害量[b]的生命
  5556. [316] = function(role, args, delay)
  5557. local _a = args[1]
  5558. local _b = args[2]
  5559. local OnKill = function(defRole, damage)
  5560. if defRole.roleData.element == _a then
  5561. BattleUtil.CalTreat(role, role, floor(BattleUtil.FP_Mul(damage, _b)))
  5562. end
  5563. end
  5564. role.Event:AddEvent(BattleEventName.RoleKill, OnKill)
  5565. end,
  5566. --> 改变【普通攻击】, 使其优先选择处于[a]或[b]持续伤害状态的目标
  5567. [312] = function(role, args, delay)
  5568. local _a = args[1]
  5569. local _b = args[2]
  5570. local function onSkillTargetCheck(func, skill)
  5571. if role.ctrl_chaos or role.lockTarget~=nil then return end --混乱,嘲讽状态不强制改变目标
  5572. if skill.ext_slot == 0 then
  5573. local list = RoleManager.Query(function(r)
  5574. return r.camp ~= role.camp
  5575. end)
  5576. --local chooseId = skill.effectList.buffer[1].chooseId
  5577. local num = skill:GetMaxTargetNum()
  5578. -- local num = #skill.effectTargets[1]
  5579. BattleUtil.Sort(list, function(a, b)
  5580. local aHave = BattleLogic.BuffMgr:HasBuff(a, BuffName.DOT, function (buff) return buff.damageType == _a or buff.damageType == _b end)
  5581. local bHave = BattleLogic.BuffMgr:HasBuff(b, BuffName.DOT, function (buff) return buff.damageType == _a or buff.damageType == _b end)
  5582. if aHave and bHave then
  5583. return false
  5584. elseif not aHave and bHave then
  5585. return true
  5586. elseif aHave and not bHave then
  5587. return false
  5588. end
  5589. return false
  5590. end)
  5591. local trans = {}
  5592. for i = 1, num do
  5593. if list[i] then
  5594. table.insert(trans, list[i])
  5595. end
  5596. end
  5597. if trans and #trans > 0 then
  5598. if func then func(trans) end
  5599. end
  5600. end
  5601. end
  5602. role.Event:AddEvent(BattleEventName.SkillTargetCheck, onSkillTargetCheck)
  5603. end,
  5604. --> 改变【普通攻击】, 使其伤害[a]类型改变[b]
  5605. [325] = function(role, args, delay)
  5606. local _a = args[1]
  5607. local _b = args[2]
  5608. --RoleManager.LogArgs("325",args)
  5609. local function onFinalDamage(damagingFunc, defRole, damage, skill, dotType, bCrit, damageType)
  5610. if skill and skill.ext_slot == 0 and skill.skillSubType~=2 then
  5611. local changeValue = function(ct, a, b)
  5612. if ct == 1 then
  5613. return a + b
  5614. elseif ct == 2 then
  5615. return a + floor(BattleUtil.FP_Mul(a, b))
  5616. elseif ct == 3 then
  5617. return a - b
  5618. elseif ct == 4 then
  5619. return a - floor(BattleUtil.FP_Mul(a, b))
  5620. end
  5621. end
  5622. --LogError("325 triggerd before"..damage)
  5623. local d = floor(changeValue(_a, damage, _b) + 0.5)
  5624. local cDamage = d - damage
  5625. --LogError("325 triggerd after"..cDamage.." D:"..d)
  5626. damagingFunc(-cDamage)
  5627. end
  5628. end
  5629. role.Event:AddEvent(BattleEventName.FinalDamage, onFinalDamage)
  5630. end,
  5631. --> 改变[a]号技能, 使其附加的【诅咒】的伤害增加[b]
  5632. [343] = function(role, args, delay)
  5633. local _a = args[1]
  5634. local _b = args[2]
  5635. local damageFun = function(onDamage, skill)
  5636. if onDamage and skill then
  5637. if skill.ext_slot == _a then
  5638. onDamage(-_b)
  5639. end
  5640. end
  5641. end
  5642. role.Event:AddEvent(BattleEventName.BuffAuraTrigger, damageFun)
  5643. end,
  5644. --> 光环, 使所有己方[a]阵营单位的[b]属性[c]改变[d]
  5645. [338] = function(role, args, delay)
  5646. local _a = args[1]
  5647. local _b = args[2]
  5648. local _c = args[3]
  5649. local _d = args[4]
  5650. local onRoundChange = function(curRound)
  5651. if curRound == 1 then
  5652. local arr = RoleManager.Query(function (r) return r.camp == role.camp end)
  5653. for k, v in ipairs(arr) do
  5654. if v.roleData.element == _a then
  5655. BattleUtil.AddProp(v, _b, _d, _c)
  5656. end
  5657. end
  5658. end
  5659. end
  5660. BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, onRoundChange)
  5661. end,
  5662. --> 光环, 提高己方所有单位的【反击】伤害, 增加相当于自己[a]属性的[b]
  5663. [339] = function(role, args, delay)
  5664. local _a = args[1]
  5665. local _b = args[2]
  5666. local onRoundChange = function(curRound)
  5667. if curRound == 1 then
  5668. local arr = RoleManager.Query(function (r) return r.camp == role.camp end)
  5669. for k, v in ipairs(arr) do
  5670. local OnPassiveDamaging = function( damagingFunc, atkRole, damage, skill, dotType, bCrit)
  5671. --if skill and skill.skillSubType~=nil then LogError("339 SkillSubType "..skill.skillSubType.." type:"..type(skill.skillSubType)) end
  5672. if skill and skill.skillSubType~=nil and skill.skillSubType == 2 then --SkillSubType 对比问题
  5673. local val = floor(BattleUtil.FP_Mul(_b, role:GetRoleData(BattlePropList[_a])))
  5674. damagingFunc(-val)
  5675. end
  5676. end
  5677. v.Event:AddEvent(BattleEventName.PassiveDamaging, OnPassiveDamaging)
  5678. end
  5679. end
  5680. end
  5681. BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, onRoundChange)
  5682. end,
  5683. --> 光环, 若敌方单位死亡时有[a]属性状态, 则恢复己方所有单位相当于自己[b]属性[c]的生命
  5684. [341] = function(role, args, delay)
  5685. local _a = args[1]
  5686. local _b = args[2]
  5687. local _c = args[3]
  5688. local onRoundChange = function(curRound)
  5689. if curRound == 1 then
  5690. local arr = RoleManager.Query(function (r) return r.camp ~= role.camp end)
  5691. for k, v in ipairs(arr) do
  5692. local OnDead = function(atkRole)
  5693. if BattleLogic.BuffMgr:HasBuff(v, BuffName.PropertyChange, function (buff) return buff.propertyChangeType == _a end) then
  5694. local arr2 = RoleManager.Query(function (r2) return r2.camp == role.camp end)
  5695. for index, value in ipairs(arr2) do
  5696. local val = floor(BattleUtil.FP_Mul(_c, role:GetRoleData(BattlePropList[_b])))
  5697. BattleUtil.CalTreat(role, value, val)
  5698. end
  5699. end
  5700. end
  5701. v.Event:AddEvent(BattleEventName.RoleDead, OnDead)
  5702. end
  5703. end
  5704. end
  5705. BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, onRoundChange)
  5706. end,
  5707. --> 光环, 有单位死亡, 自己获得1层【魔界之力】, 每层使自己[a]属性[b]改变[c], 无法驱散, 持续到本场战斗结束( 同1武将1回合内多次死亡只算1次; 自己死亡后不清除魔界之力)
  5708. [347] = function(role, args, delay)
  5709. local _a = args[1]
  5710. local _b = args[2]
  5711. local _c = args[3]
  5712. local DeadNums = 0
  5713. local SignList={}
  5714. local DeadAddProp = function ()
  5715. BattleUtil.AddProp(role, _a, _c, _b)
  5716. local brand = Buff.Create(role, BuffName.Brand, 0, "mojiezhili")--BrandType.Angry
  5717. brand.clear = false
  5718. role:AddBuff(brand)
  5719. brand.cover=true
  5720. --不可驱散永久增加
  5721. -- LogError( "add one is dead!! "..#SignList)
  5722. end
  5723. local IsInsertDeadList = function (deadRole)
  5724. if #SignList == 0 then
  5725. table.insert(SignList,deadRole.roleId)
  5726. DeadAddProp()
  5727. else
  5728. for k,v in pairs(SignList) do
  5729. if v==deadRole.roleId then
  5730. return false
  5731. end
  5732. end
  5733. table.insert(SignList,deadRole.roleId)
  5734. DeadAddProp()
  5735. end
  5736. end
  5737. local onRoundChange = function(curRound)
  5738. if curRound == 1 then
  5739. local OnDead = function(defRole, atkRole)
  5740. IsInsertDeadList(defRole)
  5741. end
  5742. BattleLogic.Event:AddEvent(BattleEventName.BattleRoleDead, OnDead)
  5743. else
  5744. SignList={} --回合变更后清除列表
  5745. end
  5746. end
  5747. BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, onRoundChange)
  5748. end,
  5749. --> 光环, 使所有敌方单位附加[a]或[b]持续伤害状态的概率提升[c], 且提升持续伤害效果, 相当于自己[d]属性的[e]
  5750. [317] = function(role, args, delay)
  5751. local _a = args[1]
  5752. local _b = args[2]
  5753. local _c = args[3]
  5754. local _d = args[4]
  5755. local _e = args[5]
  5756. local onRoundChange = function(curRound)
  5757. if curRound == 1 then
  5758. local arr = RoleManager.Query(function (r) return r.camp == role.camp end)
  5759. for k, v in ipairs(arr) do
  5760. local onPassiveRandomDot = function(func, dot)
  5761. if dot == _a or dot == _b then
  5762. local val = floor(BattleUtil.FP_Mul(_e, role:GetRoleData(BattlePropList[_d])))
  5763. if func then func(_c, 2, val, 1) end --< 概率加乘 2类型
  5764. end
  5765. end
  5766. v.Event:AddEvent(BattleEventName.PassiveRandomDot, onPassiveRandomDot)
  5767. end
  5768. end
  5769. end
  5770. BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, onRoundChange)
  5771. end,
  5772. --> 为己方最先出手的单位时,[a]属性临时[b]改变[c];[d]属性临时[e]改变[f]; 反之有[g]概率额外增加1个攻击目标,造成原技能[h]的伤害
  5773. [319] = function(role, args, delay)
  5774. local _a = args[1]
  5775. local _b = args[2]
  5776. local _c = args[3]
  5777. local _d = args[4]
  5778. local _e = args[5]
  5779. local _f = args[6]
  5780. local _g = args[7]
  5781. local _h = args[8]
  5782. local OnSkillSelectBefore = function(skill)
  5783. --RoleManager.LogArgs("319",args)
  5784. -- BattleLogic.WaitForTrigger(delay, function ()
  5785. -- if skill.ext_slot == 1 or skill.ext_slot == 3 then
  5786. local maxSpeed = 0
  5787. local arr = RoleManager.Query(function (r) return r.camp == role.camp end)
  5788. local maxTarget = nil
  5789. for k, v in ipairs(arr) do
  5790. if v and v:GetRoleData(RoleDataName.Speed) > maxSpeed then
  5791. maxSpeed = v:GetRoleData(RoleDataName.Speed)
  5792. maxTarget = v
  5793. end
  5794. end
  5795. if maxTarget == role then
  5796. local OnRoleDamageBefore = nil
  5797. OnRoleDamageBefore = function(defRole, factorFunc, damageType, skill,baseFactor,atkRole)
  5798. BattleUtil.AddProp(role, _a, _c, _b)
  5799. BattleUtil.AddProp(role, _d, _f, _e)
  5800. role.Event:RemoveEvent(BattleEventName.RoleDamageBefore, OnRoleDamageBefore)
  5801. end
  5802. role.Event:AddEvent(BattleEventName.RoleDamageBefore, OnRoleDamageBefore)
  5803. local OnRoleDamageAfter = nil
  5804. OnRoleDamageAfter = function(defRole, func, damageType)
  5805. BattleUtil.RevertProp(role, _a, _c, _b)
  5806. BattleUtil.RevertProp(role, _d, _f, _e)
  5807. role.Event:RemoveEvent(BattleEventName.RoleDamageAfter, OnRoleDamageAfter)
  5808. end
  5809. role.Event:AddEvent(BattleEventName.RoleDamageAfter, OnRoleDamageAfter)
  5810. else
  5811. BattleUtil.RandomAction2(_g, function()
  5812. local OnSkillTargetCheck = nil
  5813. OnSkillTargetCheck = function(func, skill)
  5814. local list = RoleManager.Query(function(r)
  5815. if r.camp == role.camp then
  5816. return false
  5817. end
  5818. for i = 1, #skill.effectTargets[1] do
  5819. if r == skill.effectTargets[1][i] then
  5820. return false
  5821. end
  5822. end
  5823. return true
  5824. end)
  5825. if func then
  5826. if #list > 0 then
  5827. local retlist = {}
  5828. for i = 1, #skill.effectTargets[1] do
  5829. table.insert(retlist, skill.effectTargets[1][i])
  5830. end
  5831. table.insert(retlist, list[1])
  5832. --> h伤害
  5833. local function onFinalBeDamage(damagingFunc, atkRole, damage, skill, dotType, bCrit, damageType)
  5834. list[1].Event:RemoveEvent(BattleEventName.FinalBeDamage, onFinalBeDamage)
  5835. if damagingFunc then damagingFunc(damage - BattleUtil.FP_Mul(damage, _h)) end
  5836. end
  5837. list[1].Event:AddEvent(BattleEventName.FinalBeDamage, onFinalBeDamage)
  5838. func(retlist)
  5839. else
  5840. func(skill.effectTargets[1])
  5841. end
  5842. end
  5843. role.Event:RemoveEvent(BattleEventName.SkillTargetCheck, OnSkillTargetCheck)
  5844. end
  5845. role.Event:AddEvent(BattleEventName.SkillTargetCheck, OnSkillTargetCheck)
  5846. end)
  5847. end
  5848. -- end
  5849. -- end)
  5850. end
  5851. role.Event:AddEvent(BattleEventName.SkillSelectBefore, OnSkillSelectBefore)
  5852. end,
  5853. --> 造成[a][伤害类型]时,[b]概率再次释放技能,造成原技能[c]的伤害,[d]属性临时[e]改变[f]
  5854. [350] = function(role, args, delay)
  5855. local _a = args[1]
  5856. local _b = args[2]
  5857. local _c = args[3]
  5858. local _d = args[4]
  5859. local _e = args[5]
  5860. local _f = args[6]
  5861. local triggerOnce = true
  5862. local OnHit = nil
  5863. --> OnHit打击正常是会触发一次(按之前的逻辑) 加个skillcast reset 确保一下
  5864. OnHit = function(defRole, damage, bCrit, finalDmg, damageType, skill, transType)
  5865. BattleLogic.WaitForTrigger(delay, function ()
  5866. if defRole==nil then
  5867. return
  5868. end
  5869. if damageType ~= _a then
  5870. return
  5871. end
  5872. if not skill.isAdd or not skill then
  5873. return
  5874. end
  5875. if triggerOnce then
  5876. BattleUtil.RandomAction2(_b, function ()
  5877. role:InsertSkill(_a, false, nil, role.skillArray[Slot2Idx(skill.ext_slot)])
  5878. --开始连击
  5879. local isC = false
  5880. local OnSkillCastOnce = nil
  5881. OnSkillCastOnce = function(skill)
  5882. role.Event:RemoveEvent(BattleEventName.SkillCast, OnSkillCastOnce)
  5883. --连击技能开始
  5884. isC = true
  5885. local OnFinalDamage = nil
  5886. OnFinalDamage = function(damagingFunc, defRole, damage, skill, dotType, bCrit, damageType)
  5887. if isC then
  5888. --连击的伤害都要减半
  5889. local fDamage = floor(BattleUtil.FP_Mul(damage, _c))
  5890. local rDamage = damage - fDamage
  5891. damagingFunc(rDamage)
  5892. end
  5893. end
  5894. role.Event:AddEvent(BattleEventName.FinalDamage, OnFinalDamage)
  5895. local OnSkillCastEndOnce = nil
  5896. OnSkillCastEndOnce = function(skill)
  5897. --连击技能完成
  5898. isC = false
  5899. role.Event:RemoveEvent(BattleEventName.FinalDamage, OnFinalDamage)
  5900. role.Event:RemoveEvent(BattleEventName.SkillCastEnd, OnSkillCastEndOnce)
  5901. --还原属性
  5902. BattleUtil.RevertProp(role, _d, _f, _e)
  5903. end
  5904. role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEndOnce)
  5905. --修改属性
  5906. BattleUtil.AddProp(role, _d, _f, _e)
  5907. end
  5908. role.Event:AddEvent(BattleEventName.SkillCast, OnSkillCastOnce)
  5909. end)
  5910. triggerOnce = false
  5911. end
  5912. end)
  5913. end
  5914. role.Event:AddEvent(BattleEventName.RoleHit, OnHit)
  5915. local OnRoleTurnEnd = function(SkillRole)
  5916. triggerOnce = true
  5917. end
  5918. role.Event:AddEvent(BattleEventName.RoleTurnEnd, OnRoleTurnEnd)
  5919. end,
  5920. --> 使用[a][伤害类型]击杀目标时[b]概率触发[c]次普攻,普攻伤害为原伤害的[d]
  5921. [351] = function(role, args, delay)
  5922. BattleLogManager.Log(
  5923. "351-----"
  5924. )
  5925. local _a = args[1]
  5926. local _b = args[2]
  5927. local _c = args[3]
  5928. local _d = args[4]
  5929. local triggerOnce = true
  5930. local OnRoleKill = nil
  5931. OnRoleKill = function(defRole, damage, bCrit, damageType, dotType, skill)
  5932. BattleLogic.WaitForTrigger(delay, function ()
  5933. if damageType ~= _a then
  5934. return
  5935. end
  5936. if not skill then
  5937. return
  5938. end
  5939. if skill and not skill.isAdd then
  5940. return
  5941. end
  5942. if triggerOnce then
  5943. BattleUtil.RandomAction2(_b, function ()
  5944. for i = 1, _c do
  5945. role:InsertSkill(SkillBaseType.Physical, false, nil, role.skillArray[1])
  5946. end
  5947. local isC = false
  5948. local OnSkillCastOnce = function(skill)
  5949. isC = true
  5950. end
  5951. role.Event:AddEvent(BattleEventName.SkillCast, OnSkillCastOnce)
  5952. local OnRoleTurnEnd = nil
  5953. OnRoleTurnEnd = function(SkillRole)
  5954. isC = false
  5955. role.Event:RemoveEvent(BattleEventName.SkillCast, OnSkillCastOnce)
  5956. role.Event:RemoveEvent(BattleEventName.RoleTurnEnd, OnRoleTurnEnd)
  5957. end
  5958. role.Event:AddEvent(BattleEventName.RoleTurnEnd, OnRoleTurnEnd)
  5959. local OnFinalDamage = function(damagingFunc, defRole, damage, skill, dotType, bCrit, damageType)
  5960. if isC then
  5961. if damage == nil then
  5962. damage = 0
  5963. end
  5964. local fDamage = floor(BattleUtil.FP_Mul(damage, _d))
  5965. local rDamage = damage - fDamage
  5966. if type(damagingFunc) == "table" then return end
  5967. damagingFunc(rDamage)
  5968. end
  5969. end
  5970. role.Event:AddEvent(BattleEventName.FinalDamage, OnFinalDamage)
  5971. end)
  5972. triggerOnce = false
  5973. end
  5974. end)
  5975. end
  5976. role.Event:AddEvent(BattleEventName.RoleKill, OnRoleKill)
  5977. local OnRoleTurnEnd = function(SkillRole)
  5978. triggerOnce = true
  5979. end
  5980. role.Event:AddEvent(BattleEventName.RoleTurnEnd, OnRoleTurnEnd)
  5981. end,
  5982. --> 若为反击类技能使用[a][伤害类型]造成暴击时[b]概率触发[c]次普攻,若非反击类技能使用[d][伤害类型]造成暴击时[e]概率触发[f]次普攻
  5983. [352] = function(role, args, delay)
  5984. local _a = args[1]
  5985. local _b = args[2]
  5986. local _c = args[3]
  5987. local _d = args[4]
  5988. local _e = args[5]
  5989. local _f = args[6]
  5990. local triggerOnce = true
  5991. local OnRoleCrit = nil
  5992. OnRoleCrit = function(defRole, damage, bCrit, finalDmg, damageType, skill)
  5993. BattleLogic.WaitForTrigger(delay, function ()
  5994. if not skill then
  5995. return
  5996. end
  5997. if skill.skillSubType == SkillSubType.BeatBack then
  5998. if damageType ~= _a then
  5999. return
  6000. end
  6001. if triggerOnce then
  6002. BattleUtil.RandomAction2(_b, function ()
  6003. for i = 1, _c do
  6004. role:InsertSkill(SkillBaseType.Physical, false, nil, role.skillArray[1])
  6005. end
  6006. end)
  6007. triggerOnce = false
  6008. end
  6009. else
  6010. if damageType ~= _d then
  6011. return
  6012. end
  6013. if triggerOnce then
  6014. BattleUtil.RandomAction2(_e, function ()
  6015. for i = 1, _f do
  6016. role:InsertSkill(SkillBaseType.Physical, false, nil, role.skillArray[1])
  6017. end
  6018. end)
  6019. triggerOnce = false
  6020. end
  6021. end
  6022. end)
  6023. end
  6024. role.Event:AddEvent(BattleEventName.RoleCrit, OnRoleCrit)
  6025. local OnRoleTurnEnd = function(SkillRole)
  6026. triggerOnce = true
  6027. end
  6028. role.Event:AddEvent(BattleEventName.RoleTurnEnd, OnRoleTurnEnd)
  6029. end,
  6030. --> 生命每下降[a], 则[b]属性[c]改变[d]
  6031. [353] = function(role, args, delay)
  6032. local _a = args[1]
  6033. local _b = args[2]
  6034. local _c = args[3]
  6035. local _d = args[4]
  6036. local reduceHp = 0
  6037. local OnRoleBeDamaged = function(atkRole, damage, bCrit, finalDmg, damageType, dotType, skill)
  6038. reduceHp = reduceHp + finalDmg
  6039. local maxHp = role:GetRoleData(RoleDataName.MaxHp)
  6040. local rH = BattleUtil.FP_Mul(maxHp, _a)
  6041. if reduceHp >= rH then
  6042. local multi = floor(reduceHp / rH)
  6043. reduceHp = reduceHp - BattleUtil.FP_Mul(rH, multi)
  6044. for i = 1, multi do
  6045. BattleUtil.AddProp(role, _b, _d, _c)
  6046. end
  6047. end
  6048. end
  6049. role.Event:AddEvent(BattleEventName.RoleBeDamaged, OnRoleBeDamaged)
  6050. end,
  6051. --> 复活后[a]属性[b]改变[c],持续[d]回合
  6052. [354] = function(role, args, delay)
  6053. local _a = args[1]
  6054. local _b = args[2]
  6055. local _c = args[3]
  6056. local _d = args[4]
  6057. local OnRoleRelive = nil
  6058. OnRoleRelive = function(reliveRole)
  6059. reliveRole:AddBuff(Buff.Create(role, BuffName.PropertyChange, _d, BattlePropList[_a], _c, _b))
  6060. role.Event:RemoveEvent(BattleEventName.RoleRealRelive, OnRoleRelive)
  6061. end
  6062. role.Event:AddEvent(BattleEventName.RoleRealRelive, OnRoleRelive)
  6063. end,
  6064. --> 对敌方造成伤害时(dot伤害除外),有[a]概率使其[b]属性[c]改变[d],持续[e]回合
  6065. [355] = function(role, args, delay)
  6066. local _a = args[1]
  6067. local _b = args[2]
  6068. local _c = args[3]
  6069. local _d = args[4]
  6070. local _e = args[5]
  6071. local OnDamage = function(defRole, damage, bCrit, finalDmg, damageType, dotType, skill,atkRole)
  6072. BattleLogic.WaitForTrigger(delay, function ()
  6073. if dotType~=nil then return end --排除dot伤害
  6074. BattleUtil.RandomAction2(_a, function ()
  6075. defRole:AddBuff(Buff.Create(role, BuffName.PropertyChange, _e, BattlePropList[_b], _d, _c))
  6076. end)
  6077. end)
  6078. end
  6079. role.Event:AddEvent(BattleEventName.RoleDamage, OnDamage)
  6080. end,
  6081. --> 攻击时有[a]概率使目标[b]回合无法复活,对携带复活或还魂技能的目标[c]属性[d]改变[e]
  6082. [356] = function(role, args, delay)
  6083. local _a = args[1]
  6084. local _b = args[2]
  6085. local _c = args[3]
  6086. local _d = args[4]
  6087. local _e = args[5]
  6088. local onRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill)
  6089. BattleLogic.WaitForTrigger(delay, function ()
  6090. BattleUtil.RandomAction2(_a, function()
  6091. defRole:SetReliveFilter(false)
  6092. local roundTimes = _b
  6093. local onRoundChange = nil
  6094. onRoundChange = function(curRound)
  6095. roundTimes = roundTimes - 1
  6096. if roundTimes <= 0 then
  6097. BattleLogic.Event:RemoveEvent(BattleEventName.BattleRoundChange, onRoundChange)
  6098. defRole:SetReliveFilter(true)
  6099. end
  6100. end
  6101. BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, onRoundChange)
  6102. if defRole.warWayType[WarWayType.W_6026] or defRole.warWayType[WarWayType.W_6027] then
  6103. BattleUtil.AddProp(defRole, _c, _e, _d)
  6104. end
  6105. end)
  6106. end)
  6107. end
  6108. role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit)
  6109. end,
  6110. --> 攻击时[a]概率驱散目标身上所有的[b][清除状态]
  6111. [357] = function(role, args, delay)
  6112. local _a = args[1]
  6113. local _b = args[2]
  6114. local onRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill)
  6115. BattleLogic.WaitForTrigger(delay, function ()
  6116. BattleUtil.RandomAction2(_a, function()
  6117. BattleLogic.BuffMgr:ClearBuff(defRole, function (buff)
  6118. return clearBuffPredicate(buff, _b)
  6119. end)
  6120. end)
  6121. end)
  6122. end
  6123. role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit)
  6124. end,
  6125. --> 攻击时, 技能伤害大于目标[a]属性的[b]时,[c]概率对目标添加[d][控制状态],持续[e]回合
  6126. [358] = function(role, args, delay)
  6127. local _a = args[1]
  6128. local _b = args[2]
  6129. local _c = args[3]
  6130. local _d = args[4]
  6131. local _e = args[5]
  6132. local onRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill)
  6133. local val = floor(BattleUtil.FP_Mul(_b, defRole:GetRoleData(BattlePropList[_a])))
  6134. if damage > val then
  6135. BattleUtil.RandomControl(_c, _d, role, defRole, _e)
  6136. end
  6137. end
  6138. role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit)
  6139. end,
  6140. --> 攻击时有[a]概率对目标添加[b][控制状态],持续[c]回合
  6141. [359] = function(role, args, delay)
  6142. local _a = args[1]
  6143. local _b = args[2]
  6144. local _c = args[3]
  6145. local onRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill)
  6146. BattleUtil.RandomControl(_a, _b, role, defRole, _c)
  6147. end
  6148. role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit)
  6149. end,
  6150. --> 攻击时有[a]概率[b]改变目标[c]属性[d],持续[e]回合
  6151. [360] = function(role, args, delay)
  6152. local _a = args[1]
  6153. local _b = args[2]
  6154. local _c = args[3]
  6155. local _d = args[4]
  6156. local _e = args[5]
  6157. local onRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill)
  6158. BattleLogic.WaitForTrigger(delay, function ()
  6159. BattleUtil.RandomAction2(_a, function()
  6160. local propertyChange = function(_target, round, pro, v, ct)
  6161. _target:AddBuff(Buff.Create(role, BuffName.PropertyChange, round, BattlePropList[pro], v, ct))
  6162. end
  6163. propertyChange(defRole, _e, _c, _d, _b)
  6164. end)
  6165. end)
  6166. end
  6167. role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit)
  6168. end,
  6169. --> 死亡时有[a]概率[b]改变全体友方[c]属性[d],持续[e]回合
  6170. [361] = function(role, args, delay)
  6171. local _a = args[1]
  6172. local _b = args[2]
  6173. local _c = args[3]
  6174. local _d = args[4]
  6175. local _e = args[5]
  6176. local onRoleDead = function(atkRole)
  6177. BattleLogic.WaitForTrigger(delay, function ()
  6178. BattleUtil.RandomAction2(_a, function()
  6179. local propertyChange = function(_target, round, pro, v, ct)
  6180. _target:AddBuff(Buff.Create(role, BuffName.PropertyChange, round, BattlePropList[pro], v, ct))
  6181. end
  6182. local arr2 = RoleManager.Query(function (r2) return r2.camp == role.camp end)
  6183. for k, v in ipairs(arr2) do
  6184. if v then
  6185. propertyChange(v, _e, _c, _d, _b)
  6186. end
  6187. end
  6188. end)
  6189. end)
  6190. end
  6191. role.Event:AddEvent(BattleEventName.RoleDead, onRoleDead)
  6192. end,
  6193. --> 被携带武力或法力技能的武将攻击时,自身[a]属性临时[b]改变[c]
  6194. [362] = function(role, args, delay)
  6195. local _a = args[1]
  6196. local _b = args[2]
  6197. local _c = args[3]
  6198. local OnRoleBeDamagedBefore = function(atkRole, func, damageType)
  6199. if atkRole.warWayType[WarWayType.W_6004] or atkRole.warWayType[WarWayType.W_6005] then
  6200. BattleUtil.AddProp(role, _a, _c, _b)
  6201. end
  6202. end
  6203. role.Event:AddEvent(BattleEventName.RoleBeDamagedBefore, OnRoleBeDamagedBefore)
  6204. local OnRoleBeDamagedAfter = function(atkRole, func, damageType)
  6205. if atkRole.warWayType[WarWayType.W_6004] or atkRole.warWayType[WarWayType.W_6005] then
  6206. BattleUtil.RevertProp(role, _a, _c, _b)
  6207. end
  6208. end
  6209. role.Event:AddEvent(BattleEventName.RoleBeDamagedAfter, OnRoleBeDamagedAfter)
  6210. end,
  6211. --> 攻击携带医术或回春技能的目标时,自身[a]属性临时[b]改变[c]
  6212. [363] = function(role, args, delay)
  6213. local _a = args[1]
  6214. local _b = args[2]
  6215. local _c = args[3]
  6216. local OnRoleDamageBefore = function(defRole, func, damageType)
  6217. if defRole.warWayType[WarWayType.W_6025] or defRole.warWayType[WarWayType.W_6031] then
  6218. BattleUtil.AddProp(role, _a, _c, _b)
  6219. end
  6220. end
  6221. role.Event:AddEvent(BattleEventName.RoleDamageBefore, OnRoleDamageBefore)
  6222. local OnRoleDamageAfter = function(defRole, func, damageType)
  6223. if defRole.warWayType[WarWayType.W_6025] or defRole.warWayType[WarWayType.W_6031] then
  6224. BattleUtil.RevertProp(role, _a, _c, _b)
  6225. end
  6226. end
  6227. role.Event:AddEvent(BattleEventName.RoleDamageAfter, OnRoleDamageAfter)
  6228. end,
  6229. --> 攻击携带躲闪或敏捷技能的目标时,自身[a]属性临时[b]改变[c]
  6230. [364] = function(role, args, delay)
  6231. local _a = args[1]
  6232. local _b = args[2]
  6233. local _c = args[3]
  6234. local OnRoleDamageBefore = function(defRole, func, damageType)
  6235. if defRole.warWayType[WarWayType.W_6001] or defRole.warWayType[WarWayType.W_6020] then
  6236. BattleUtil.AddProp(role, _a, _c, _b)
  6237. end
  6238. end
  6239. role.Event:AddEvent(BattleEventName.RoleDamageBefore, OnRoleDamageBefore)
  6240. local OnRoleDamageAfter = function(defRole, func, damageType)
  6241. if defRole.warWayType[WarWayType.W_6001] or defRole.warWayType[WarWayType.W_6020] then
  6242. BattleUtil.RevertProp(role, _a, _c, _b)
  6243. end
  6244. end
  6245. role.Event:AddEvent(BattleEventName.RoleDamageAfter, OnRoleDamageAfter)
  6246. end,
  6247. --> 回合开始时,[a]概率清除自身所有[b][清除状态]
  6248. [365] = function(role, args, delay)
  6249. local _a = args[1]
  6250. local _b = args[2]
  6251. BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, function(curRound)
  6252. BattleLogic.WaitForTrigger(delay, function ()
  6253. BattleUtil.RandomAction2(_a, function()
  6254. BattleLogic.BuffMgr:ClearBuff(role, function (buff)
  6255. return clearBuffPredicate(buff, _b)
  6256. end)
  6257. end)
  6258. end)
  6259. end)
  6260. end,
  6261. --> 回合开始时,恢复自身[a]属性的[b]值
  6262. [366] = function(role, args, delay)
  6263. local _a = args[1]
  6264. local _b = args[2]
  6265. BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, function(curRound)
  6266. local val = floor(BattleUtil.FP_Mul(_b, role:GetRoleData(BattlePropList[_a])))
  6267. BattleUtil.CalTreat(role, role, val)
  6268. end)
  6269. end,
  6270. --> 死亡时,有[a]概率复活,复活时恢复自身[b]属性的[c]值,每场最多触发[d]次
  6271. [367] = function(role, args, delay)
  6272. local _a = args[1]
  6273. local _b = args[2]
  6274. local _c = args[3]
  6275. local _d = args[4]
  6276. local counter = 0
  6277. local onRoleRealDead = function(deadRole)
  6278. -- BattleLogic.WaitForTrigger(delay, function ()
  6279. BattleUtil.RandomAction2(_a, function()
  6280. counter = counter + 1
  6281. if counter <= _d then
  6282. deadRole:SetRelive(BattleUtil.FP_Mul(role:GetRoleData(BattlePropList[_b]), _c) / role:GetRoleData(RoleDataName.MaxHp))
  6283. end
  6284. end)
  6285. -- end)
  6286. end
  6287. role.Event:AddEvent(BattleEventName.RoleRealDead, onRoleRealDead)
  6288. end,
  6289. --> 使目标[a]属性[b]改变[c]
  6290. [368] = function(role, args, delay)
  6291. local _a = args[1]
  6292. local _b = args[2]
  6293. local _c = args[3]
  6294. BattleUtil.AddProp(role, _a, _c, _b)
  6295. end,
  6296. --> 战斗开始时,自身[a]属性[b]改变[c],持续[d]回合 -- 不能被驱散
  6297. [369] = function(role, args, delay)
  6298. local _a = args[1]
  6299. local _b = args[2]
  6300. local _c = args[3]
  6301. local _d = args[4]
  6302. --RoleManager.LogArgs("369",args)
  6303. local isAdd = false
  6304. local function _OnRoundChange(curRound)
  6305. if not isAdd then
  6306. local buff=Buff.Create(role, BuffName.PropertyChange, _d, BattlePropList[_a], _c, _b)
  6307. buff.clear = false -- 不能被驱散
  6308. role:AddBuff(buff)
  6309. isAdd=true
  6310. end
  6311. end
  6312. BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, _OnRoundChange)
  6313. -- BattleUtil.AddProp(role, _a, _c, _b)
  6314. -- BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, function(curRound)
  6315. -- if curRound >= _d then
  6316. -- BattleUtil.RevertProp(role, _a, _c, _b)
  6317. -- end
  6318. -- end)
  6319. end,
  6320. --> 造成[a][伤害类型]时,恢复自己血量,恢复量为伤害量的[b]
  6321. [370] = function(role, args, delay)
  6322. local _a = args[1]
  6323. local _b = args[2]
  6324. local onRoleDamage = function(defRole, damage, bCrit, finalDmg, damageType, dotType, skill)
  6325. if role and damageType == _a then
  6326. BattleUtil.CalTreat(role, role, floor(BattleUtil.FP_Mul(_b, damage)))
  6327. end
  6328. end
  6329. role.Event:AddEvent(BattleEventName.RoleDamage, onRoleDamage)
  6330. end,
  6331. --> 当敌方单位携带必杀、物连、法连技能造成伤害时,自身受到的[a]属性[b]改变[c]
  6332. [371] = function(role, args, delay)
  6333. local _a = args[1]
  6334. local _b = args[2]
  6335. local _c = args[3]
  6336. local OnRoleBeDamagedBefore = function(caster, func, damageType)
  6337. if role then
  6338. if caster.warWayType then
  6339. if caster.warWayType[WarWayType.W_6002] or caster.warWayType[WarWayType.W_6003] or caster.warWayType[WarWayType.W_6009] then
  6340. BattleUtil.AddProp(role, _a, _c, _b)
  6341. end
  6342. end
  6343. end
  6344. end
  6345. role.Event:AddEvent(BattleEventName.RoleBeDamagedBefore, OnRoleBeDamagedBefore)
  6346. local OnRoleBeDamagedAfter = function(caster, func, damageType)
  6347. if role then
  6348. if caster.warWayType then
  6349. if caster.warWayType[WarWayType.W_6002] or caster.warWayType[WarWayType.W_6003] or caster.warWayType[WarWayType.W_6009] then
  6350. BattleUtil.RevertProp(role, _a, _c, _b)
  6351. end
  6352. end
  6353. end
  6354. end
  6355. role.Event:AddEvent(BattleEventName.RoleBeDamagedAfter, OnRoleBeDamagedAfter)
  6356. end,
  6357. --> 战斗开始时,给己方全体增加伤害吸收盾,吸收量为自身[a]属性的[b],持续[c]回合
  6358. [372] = function(role, args, delay)
  6359. local _a = args[1]
  6360. local _b = args[2]
  6361. local _c = args[3]
  6362. local onRoundChange = function(curRound)
  6363. if curRound == 1 then
  6364. local list = RoleManager.Query(function(v) return v.camp == role.camp end)
  6365. for i = 1, #list do
  6366. if not list[i]:IsRealDead() then
  6367. local val = floor(BattleUtil.FP_Mul(_b, role:GetRoleData(BattlePropList[_a])))
  6368. list[i]:AddBuff(Buff.Create(role, BuffName.Shield, _c, ShieldTypeName.NormalReduce, val, 0))
  6369. end
  6370. end
  6371. end
  6372. end
  6373. BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, onRoundChange)
  6374. end,
  6375. --> 战斗中使用[治疗]或[复活]技能时,有[a]概率清除随机一名队友[b][清除状态]
  6376. [373] = function(role, args, delay)
  6377. local _a = args[1]
  6378. local _b = args[2]
  6379. local clearFun = function()
  6380. BattleLogic.WaitForTrigger(delay, function ()
  6381. BattleUtil.RandomAction2(_a, function()
  6382. local list = RoleManager.Query(function(v) return role.camp == v.camp end)
  6383. for k, v in ipairs(list) do --< 任意为第一个拥有者第一个相关buff
  6384. if v ~= role then
  6385. local bList = BattleLogic.BuffMgr:GetBuff(v, function (buff)
  6386. return clearBuffPredicate(buff, _b)
  6387. end)
  6388. if #bList > 0 then
  6389. BattleLogic.BuffMgr:ClearBuff(v, function (buff)
  6390. return clearBuffPredicate(buff, _b)
  6391. end)
  6392. break
  6393. end
  6394. end
  6395. end
  6396. end)
  6397. end)
  6398. end
  6399. local onRoleTreat = function(targetRole, treat, baseTreat)
  6400. clearFun()
  6401. end
  6402. role.Event:AddEvent(BattleEventName.RoleTreat, onRoleTreat)
  6403. local OnRoleRelive = function(reliveRole)
  6404. clearFun()
  6405. end
  6406. role.Event:AddEvent(BattleEventName.RoleRelive, OnRoleRelive)
  6407. end,
  6408. --> 受到伤害时,有[a]概率对伤害输出者造成受到伤害的[b]
  6409. [374] = function(role, args, delay)
  6410. local _a = args[1]
  6411. local _b = args[2]
  6412. local round = -1
  6413. local onRoleBeDamaged = function(caster, damage, bCrit, finalDmg, damageType, dotType, skill)
  6414. BattleLogic.WaitForTrigger(delay, function ()
  6415. if role and caster.uid ~= role.uid and not dotType and round ~= BattleLogic.GetMoveTimes() then
  6416. BattleUtil.RandomAction2(_a, function()
  6417. local val = floor(BattleUtil.FP_Mul(_b, damage))
  6418. round = BattleLogic.GetMoveTimes()
  6419. BattleUtil.ApplyDamage(nil, role, caster, val, nil, nil, nil, false) -- atkRole, defRole
  6420. end)
  6421. end
  6422. end)
  6423. end
  6424. role.Event:AddEvent(BattleEventName.RoleBeDamaged, onRoleBeDamaged)
  6425. end,
  6426. --> 使用[a][伤害类型]时,恢复自身血量,恢复量为伤害量的[b],恢复量不大于自身生命的[c]
  6427. [375] = function(role, args, delay)
  6428. local _a = args[1] --< 物理 魔法 已无用
  6429. local _b = args[2]
  6430. local _c = args[3]
  6431. local OnRoleDamage = function(defRole, damage, bCrit, finalDmg)
  6432. local dmg = floor(BattleUtil.FP_Mul(_b, damage))
  6433. local treatVal = dmg
  6434. local limitVal = floor(BattleUtil.FP_Mul(_c, role:GetRoleData(RoleDataName.Hp)))
  6435. if treatVal > limitVal then
  6436. treatVal = limitVal
  6437. end
  6438. BattleUtil.CalTreat(role, role, treatVal)
  6439. end
  6440. role.Event:AddEvent(BattleEventName.RoleDamage, OnRoleDamage)
  6441. end,
  6442. --> 自身受到攻击时,对攻击者造成自身生命值上限[a]的伤害,无视防御 不超过施法者攻击的[b] 伤害
  6443. [376] = function(role, args, delay)
  6444. local _a = args[1]
  6445. local _b = args[2]
  6446. local lastMove = 0
  6447. local val = floor(BattleUtil.FP_Mul(_a, role:GetRoleData(RoleDataName.MaxHp)))
  6448. local onRoleBeDamaged = function (caster, damage, bCrit, finalDmg, damageType, dotType, skill)
  6449. local limit =floor(role:GetRoleData(RoleDataName.Attack)*_b)
  6450. if val > limit then
  6451. val = limit
  6452. end
  6453. local curmove=BattleLogic.GetMoveTimes()
  6454. if not role:IsDead() and lastMove~=curmove and role.camp~=caster.camp and not dotType then
  6455. lastMove=curmove
  6456. BattleUtil.ApplyDamage(nil, role, caster, val, nil, nil, nil, false)
  6457. end
  6458. end
  6459. role.Event:AddEvent(BattleEventName.RoleBeDamaged, onRoleBeDamaged)
  6460. end,
  6461. --> 进入战斗后,每回合提高[a]伤害,最多叠加[b]层
  6462. [377] = function(role, args, delay)
  6463. local _a = args[1]
  6464. local _b = args[2]
  6465. local totalDamage = 0 --< 改为层数 a为伤害的百分比
  6466. BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, function(curRound)
  6467. if curRound <= _b then
  6468. totalDamage = totalDamage + 1
  6469. end
  6470. end)
  6471. local OnPassiveDamaging = function(damagingFunc, defRole, damage)
  6472. local damageReduce = floor(BattleUtil.FP_Mul(damage, _a, totalDamage))
  6473. damagingFunc(-damageReduce)
  6474. end
  6475. role.Event:AddEvent(BattleEventName.PassiveDamaging, OnPassiveDamaging)
  6476. end,
  6477. --> 攻击造成暴击时有[a]概率额外造成目标生命上限[b]的无视防御伤害(该伤害不超过攻击的[c]倍)
  6478. [378] = function(role, args, delay)
  6479. local _a = args[1]
  6480. local _b = args[2]
  6481. local _c = args[3]
  6482. local OnRoleDamage = function(defRole, damage, bCrit, finalDmg)
  6483. BattleLogic.WaitForTrigger(delay, function ()
  6484. if bCrit then
  6485. BattleUtil.RandomAction2(_a, function()
  6486. local val = floor(BattleUtil.FP_Mul(_b, defRole:GetRoleData(RoleDataName.MaxHp)))
  6487. local limit = floor(BattleUtil.FP_Mul(role:GetRoleData(RoleDataName.Attack), _c))
  6488. val = math.min(val, limit)
  6489. BattleUtil.ApplyDamage(nil, role, defRole, val)
  6490. end)
  6491. end
  6492. end)
  6493. end
  6494. role.Event:AddEvent(BattleEventName.RoleDamage, OnRoleDamage)
  6495. end,
  6496. --> 治疗时目标获得等同治疗量[a]的【伤害吸收盾】该效果不可驱散,持续[b]回合
  6497. [379] = function(role, args, delay)
  6498. local _a = args[1]
  6499. local _b = args[2]
  6500. local OnRoleBeTreated = function(targetRole, treat, baseTreat)
  6501. local val = floor(BattleUtil.FP_Mul(_a, baseTreat))
  6502. local shieldBuff = Buff.Create(role, BuffName.Shield, _b, ShieldTypeName.NormalReduce, val, 0)
  6503. shieldBuff.clear = false
  6504. shieldBuff.cover = true
  6505. shieldBuff.isValueCover = true
  6506. targetRole:AddBuff(shieldBuff)
  6507. end
  6508. role.Event:AddEvent(BattleEventName.RoleTreat, OnRoleBeTreated)
  6509. end,
  6510. --> 己方全员[a]属性[b]改变[c]
  6511. [380] = function(role, args, delay)
  6512. local _a = args[1]
  6513. local _b = args[2]
  6514. local _c = args[3]
  6515. local onRoundChange = function(curRound)
  6516. if curRound == 1 then
  6517. local list = RoleManager.Query(function(v) return role.camp == v.camp end)
  6518. for k, v in ipairs(list) do
  6519. BattleUtil.AddProp(v, _a, _c, _b)
  6520. end
  6521. end
  6522. end
  6523. BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, onRoundChange)
  6524. end,
  6525. --> 每回合开始时,取己方最大生命值单位的[a]生命值,添加此生命值给己方全体单位
  6526. [381] = function(role, args, delay)
  6527. local _a = args[1]
  6528. BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, function(curRound)
  6529. local list = RoleManager.Query(function(v) return role.camp == v.camp end)
  6530. local maxHp = 0
  6531. local addHp = 0
  6532. for k, v in ipairs(list) do
  6533. local hp = v:GetRoleData(RoleDataName.Hp)
  6534. if hp > maxHp then
  6535. maxHp = hp
  6536. addHp = floor(BattleUtil.FP_Mul(_a, maxHp))
  6537. end
  6538. end
  6539. for k, v in ipairs(list) do
  6540. BattleUtil.CalTreat(role, v, addHp)
  6541. end
  6542. end)
  6543. end,
  6544. --> 战斗开始时,给自身增加无懈可击状态(抵挡[a]次控制效果),持续[b]回合
  6545. [382] = function(role, args, delay)
  6546. local _a = args[1]
  6547. local _b = args[2]
  6548. local brand
  6549. local triggerCount = 0
  6550. local func = function(buff)
  6551. local isTarget = buff.type == BuffName.Control
  6552. if isTarget then
  6553. triggerCount = triggerCount + 1
  6554. if triggerCount >= _a then --< 抵挡次数到了 清除
  6555. BattleLogic.BuffMgr:ClearBuff(role, function(buff)
  6556. return buff == brand
  6557. end)
  6558. end
  6559. return _a == 0 or (_a > 0 and triggerCount <= _a)
  6560. else
  6561. return false
  6562. end
  6563. end
  6564. role.buffFilter:Add(func)
  6565. brand = Buff.Create(role, BuffName.Brand, _b, BrandType.WithStand)
  6566. brand.maxLayer = _b
  6567. brand.clear = false
  6568. brand.endFunc = function ()
  6569. for i = 1, role.buffFilter.size do
  6570. if role.buffFilter.buffer[i] == func then
  6571. role.buffFilter:Remove(i)
  6572. break
  6573. end
  6574. end
  6575. end
  6576. role:AddBuff(brand)
  6577. end,
  6578. --> 暴击时,[a]概率使目标无法复活,持续[b]回合
  6579. [383] = function(role, args, delay)
  6580. local _a = args[1]
  6581. local _b = args[2]
  6582. local OnRoleCrit = function(defRole)
  6583. BattleLogic.WaitForTrigger(delay, function ()
  6584. BattleUtil.RandomAction2(_a, function ()
  6585. defRole:SetReliveFilter(false)
  6586. local brand = Buff.Create(role, BuffName.Brand, _b, BrandType.CantRelive)
  6587. brand.clear = false
  6588. brand.startFunc = function()
  6589. defRole:SetReliveFilter(false)
  6590. end
  6591. brand.endFunc = function ()
  6592. defRole:SetReliveFilter(true)
  6593. end
  6594. role:AddBuff(brand)
  6595. end)
  6596. end)
  6597. end
  6598. role.Event:AddEvent(BattleEventName.RoleCrit, OnRoleCrit)
  6599. end,
  6600. --> 主动治疗时,[a]概率清除治疗目标[b]个负面效果
  6601. [384] = function(role, args, delay)
  6602. local _a = args[1]
  6603. local _b = args[2]
  6604. local showCurFrame = false
  6605. local OnRoleTreat = function(targetRole, treat, baseTreat)
  6606. BattleLogic.WaitForTrigger(delay, function ()
  6607. BattleUtil.RandomAction2(_a, function ()
  6608. local targetList = BattleLogic.BuffMgr:GetBuff(targetRole, function(buff)
  6609. return clearBuffPredicate(buff, 6)
  6610. end)
  6611. local clearT = function(t, list)
  6612. if list and #list > 0 then
  6613. local num = 0
  6614. if _b == 0 then --< 0所有
  6615. num = #list
  6616. else
  6617. num = math.min(_b, #list)
  6618. end
  6619. for i = 1, num do
  6620. BattleLogic.BuffMgr:ClearBuff(t, function(buff)
  6621. return buff == list[i]
  6622. end)
  6623. end
  6624. end
  6625. end
  6626. clearT(targetRole, targetList)
  6627. --> 显示用
  6628. if not BattleLogic.BuffMgr:HasBuff(role, BuffName.Brand, function (buff) return buff.flag == BrandType.TreatCutDebuff end) and not showCurFrame then --< 避免治疗多个触发多次
  6629. local brand = Buff.Create(role, BuffName.Brand, 0, BrandType.TreatCutDebuff)
  6630. role:AddBuff(brand)
  6631. showCurFrame = true
  6632. BattleLogic.WaitForTrigger(BattleLogic.GameDeltaTime, function ()
  6633. showCurFrame = false
  6634. BattleLogic.BuffMgr:ClearBuff(role, function(buff)
  6635. return buff == brand
  6636. end)
  6637. end)
  6638. end
  6639. end)
  6640. end)
  6641. end
  6642. role.Event:AddEvent(BattleEventName.RoleTreat, OnRoleTreat)
  6643. end,
  6644. --> 385~392 回合开始改为技能开始 有目标问题 回合开始确定不了
  6645. --> 每回合开始时,[a]目标[b]属性[c]改变[d],最多叠加[e]层(不可被驱散)
  6646. [385] = function(role, args, delay)
  6647. local _a = args[1]
  6648. local _b = args[2]
  6649. local _c = args[3]
  6650. local _d = args[4]
  6651. local _e = args[5]
  6652. local function onSkillCast(skill)
  6653. if _a == 1 then
  6654. local targets = skill:GetDirectTargets()
  6655. for _, target in ipairs(targets) do
  6656. local buff = Buff.Create(role, BuffName.PropertyChange, 0, BattlePropList[_b], _d, _c)
  6657. buff.cover = true
  6658. buff.maxLayer = _e
  6659. buff.clear = false
  6660. target:AddBuff(buff)
  6661. end
  6662. elseif _a == 2 then
  6663. local buff = Buff.Create(role, BuffName.PropertyChange, 0, BattlePropList[_b], _d, _c)
  6664. buff.cover = true
  6665. buff.maxLayer = _e
  6666. buff.clear = false
  6667. role:AddBuff(buff)
  6668. end
  6669. end
  6670. role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
  6671. end,
  6672. --> 385~392 回合开始改为技能开始 有目标问题 回合开始确定不了
  6673. --> 每回合开始时,恢复生命上限[a]
  6674. [386] = function(role, args, delay)
  6675. local _a = args[1]
  6676. local function onRoundChange(curRound)
  6677. local value = floor(BattleUtil.FP_Mul(role:GetRoleData(RoleDataName.MaxHp), _a))
  6678. BattleUtil.ApplyTreat(role, role, value)
  6679. end
  6680. BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, onRoundChange)
  6681. end,
  6682. --> 385~392 回合开始改为技能开始 有目标问题 回合开始确定不了
  6683. --> 每回合开始时,[a]目标[b]属性[c]改变[d],最多叠加[e]层(不可被驱散),并额外使[f]目标,[g]属性[h]改变[i],伤害不超过自身攻击力的[j]
  6684. [387] = function(role, args, delay)
  6685. local _a = args[1]
  6686. local _b = args[2]
  6687. local _c = args[3]
  6688. local _d = args[4]
  6689. local _e = args[5]
  6690. local _f = args[6]
  6691. local _g = args[7]
  6692. local _h = args[8]
  6693. local _i = args[9]
  6694. local _j = args[10]
  6695. passivityList[385](role, {_a, _b, _c, _d, _e})
  6696. local function onSkillCast(skill)
  6697. if _f == 1 then
  6698. local targets = skill:GetDirectTargets()
  6699. for _, target in ipairs(targets) do
  6700. local buff = Buff.Create(role, BuffName.PropertyChange, 0, BattlePropList[_g], _i, _h)
  6701. target:AddBuff(buff)
  6702. end
  6703. elseif _f == 2 then
  6704. local buff = Buff.Create(role, BuffName.PropertyChange, 0, BattlePropList[_g], _i, _h)
  6705. role:AddBuff(buff)
  6706. end
  6707. end
  6708. role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
  6709. local OnPassiveDamaging = function(damagingFunc, defRole, damage)
  6710. local maxDmg = floor(BattleUtil.FP_Mul(role:GetRoleData(RoleDataName.Attack), _j))
  6711. if maxDmg < damage then
  6712. damagingFunc(damage - maxDmg)
  6713. end
  6714. end
  6715. role.Event:AddEvent(BattleEventName.PassiveDamaging, OnPassiveDamaging)
  6716. end,
  6717. --> 385~392 回合开始改为技能开始 有目标问题 回合开始确定不了
  6718. --> 每回合开始时,[a]目标[b]属性[c]改变[d],最多叠加[e]层(不可被驱散),并额外使[f]目标,负面效果随机清除[g]个
  6719. [388] = function(role, args, delay)
  6720. local _a = args[1]
  6721. local _b = args[2]
  6722. local _c = args[3]
  6723. local _d = args[4]
  6724. local _e = args[5]
  6725. local _f = args[6]
  6726. local _g = args[7]
  6727. passivityList[385](role, {_a, _b, _c, _d, _e})
  6728. local function clearRoleBuff(par_role)
  6729. local targetList = BattleLogic.BuffMgr:GetBuff(par_role, function(buff)
  6730. return clearBuffPredicate(buff, 6)
  6731. end)
  6732. local clearT = function(t, list)
  6733. if list and #list > 0 then
  6734. local num = 0
  6735. if _g == 0 then --< 0所有
  6736. num = #list
  6737. else
  6738. num = math.min(_g, #list)
  6739. end
  6740. for i = 1, num do
  6741. BattleLogic.BuffMgr:ClearBuff(t, function(buff)
  6742. return buff == list[i]
  6743. end)
  6744. end
  6745. end
  6746. end
  6747. clearT(par_role, targetList)
  6748. end
  6749. local function onSkillCast(skill)
  6750. if _a == 1 then
  6751. local targets = skill:GetDirectTargets()
  6752. for _, target in ipairs(targets) do
  6753. clearRoleBuff(target)
  6754. end
  6755. elseif _a == 2 then
  6756. clearRoleBuff(role)
  6757. end
  6758. end
  6759. role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
  6760. end,
  6761. --> 385~392 回合开始改为技能开始 有目标问题 回合开始确定不了
  6762. --> 每回合开始时,[a]目标[b]属性[c]改变[d],最多叠加[e]层(不可被驱散),并使全场友方[f]属性[g]改变[h]
  6763. [389] = function(role, args, delay)
  6764. local _a = args[1]
  6765. local _b = args[2]
  6766. local _c = args[3]
  6767. local _d = args[4]
  6768. local _e = args[5]
  6769. local _f = args[6]
  6770. local _g = args[7]
  6771. local _h = args[8]
  6772. local _i = args[9]
  6773. passivityList[385](role, {_a, _b, _c, _d, _e})
  6774. local function onSkillCast(skill)
  6775. local list = RoleManager.Query(function(v) return role.camp == v.camp end)
  6776. for k, v in ipairs(list) do
  6777. local buff = Buff.Create(role, BuffName.PropertyChange, 0, BattlePropList[_f], _h, _g)
  6778. v:AddBuff(buff)
  6779. end
  6780. end
  6781. role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
  6782. end,
  6783. --> 385~392 回合开始改为技能开始 有目标问题 回合开始确定不了
  6784. --> 每回合开始时,[a]目标[b]属性[c]改变[d],最多叠加[e]层(不可被驱散),并使自己每回合可抵抗[f]次暴击
  6785. [390] = function(role, args, delay)
  6786. local _a = args[1]
  6787. local _b = args[2]
  6788. local _c = args[3]
  6789. local _d = args[4]
  6790. local _e = args[5]
  6791. local _f = args[6]
  6792. passivityList[385](role, {_a, _b, _c, _d, _e})
  6793. local times = _f
  6794. local function onRoundChange(curRound)
  6795. times = _f
  6796. end
  6797. BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, onRoundChange)
  6798. local function onCritMiss(CritMissFunc, atkRole, defRole, bCrit)
  6799. if bCrit then
  6800. if times > 0 then
  6801. times = times - 1
  6802. if CritMissFunc then
  6803. CritMissFunc(false)
  6804. end
  6805. end
  6806. end
  6807. end
  6808. role.Event:AddEvent(BattleEventName.BeCritMiss, onCritMiss)
  6809. end,
  6810. --> 385~392 回合开始改为技能开始 有目标问题 回合开始确定不了
  6811. --> 每回合开始时,恢复生命上限[a],恢复溢出血量会形成伤害吸收盾保护自己,持续[b]回合。
  6812. [391] = function(role, args, delay)
  6813. local _a = args[1]
  6814. local _b = args[2]
  6815. local function onRoundChange(curRound)
  6816. local value = floor(BattleUtil.FP_Mul(role:GetRoleData(RoleDataName.MaxHp), _a))
  6817. local canAddBlood = (role:GetRoleData(RoleDataName.MaxHp) - role:GetRoleData(RoleDataName.Hp))
  6818. local outBlood = 0
  6819. if value > canAddBlood then
  6820. outBlood = floor(value - canAddBlood)
  6821. end
  6822. BattleUtil.ApplyTreat(role, role, value)
  6823. if outBlood > 0 then
  6824. role:AddBuff(Buff.Create(role, BuffName.Shield, _b, ShieldTypeName.NormalReduce, outBlood, 0))
  6825. end
  6826. end
  6827. BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, onRoundChange)
  6828. end,
  6829. --> 385~392 回合开始改为技能开始 有目标问题 回合开始确定不了
  6830. --> 每回合开始时,[a]目标[b]属性[c]改变[d],最多叠加[e]层(不可被驱散),并额外使[f]目标,[g]属性[h]改变[i]
  6831. [392] = function(role, args, delay)
  6832. local _a = args[1]
  6833. local _b = args[2]
  6834. local _c = args[3]
  6835. local _d = args[4]
  6836. local _e = args[5]
  6837. local _f = args[6]
  6838. local _g = args[7]
  6839. local _h = args[8]
  6840. local _i = args[9]
  6841. passivityList[385](role, {_a, _b, _c, _d, _e})
  6842. local function onSkillCast(skill)
  6843. if _f == 1 then
  6844. local targets = skill:GetDirectTargets()
  6845. for _, target in ipairs(targets) do
  6846. local buff = Buff.Create(role, BuffName.PropertyChange, 0, BattlePropList[_g], _i, _h)
  6847. target:AddBuff(buff)
  6848. end
  6849. elseif _f == 2 then
  6850. local buff = Buff.Create(role, BuffName.PropertyChange, 0, BattlePropList[_g], _i, _h)
  6851. role:AddBuff(buff)
  6852. end
  6853. end
  6854. role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
  6855. end,
  6856. --> 替补未上场,给我方职业[c]的单位[a]属性[b]改变( 自身[e]属性[f]倍值),从第1回合开始,持续生效[d]回合,失效[g]回合,一直循环到替补上场就清除该buff
  6857. [393] = function(role, args, delay)
  6858. local _a = args[1]
  6859. local _b = args[2]
  6860. local _c = args[3]
  6861. local _d = args[4]
  6862. local _e = args[5]
  6863. local _f = args[6]
  6864. local _g = args[7]
  6865. --当前是替补并且未上场
  6866. if role:IsSubstitute() then
  6867. if RoleManager.getTibuStateByCamp(role.camp) == 1 or RoleManager.getTibuStateByCamp(role.camp) == 3 then
  6868. local list = RoleManager.Query(function (r) return r.camp == role.camp and r.professionId == _c end)
  6869. for i = 1, #list do
  6870. local buff=Buff.Create(list[i], BuffName.PropertyChange, 0, BattlePropList[_a], role:GetRoleData(BattlePropList[_e])*_f, _b)
  6871. buff.isEveryRound = true
  6872. buff.cdRound = _g
  6873. buff.effectRound = _d
  6874. buff.isEffect = true
  6875. list[i]:AddBuff(buff)
  6876. end
  6877. BattleLogic.Event:AddEvent(BattleEventName.OnAddTibuRole, function(roleData)
  6878. if roleData.roleId == role.roleId then
  6879. for i = 1, #list do
  6880. list[i]:RemoveBuff(function(b)
  6881. return b.type == BuffName.PropertyChange and b.propertyName == BattlePropList[_a]
  6882. end)
  6883. end
  6884. end
  6885. end)
  6886. end
  6887. end
  6888. end,
  6889. --> 替补未上场,回合结束我方有目标死亡时,复活一名友军,并给目标恢复释放者[a]百分比[b]的生命值。
  6890. [394] = function(role, args, delay)
  6891. local _a = args[1]
  6892. local _b = args[2]
  6893. local counter = 0
  6894. local function clamp(v, minValue, maxValue)
  6895. if v < minValue then
  6896. return minValue
  6897. end
  6898. if v > maxValue then
  6899. return maxValue
  6900. end
  6901. return v
  6902. end
  6903. --回合结束时
  6904. BattleLogic.Event:AddEvent(BattleEventName.RoundEnd, function(isHave,nullNum,ReCheckRound)
  6905. --当前是替补并且未上场
  6906. if role:IsSubstitute() then
  6907. if RoleManager.getTibuStateByCamp(role.camp) == 1 or RoleManager.getTibuStateByCamp(role.camp) == 3 then
  6908. if counter == 0 then
  6909. local list = RoleManager.Query(function (r) return r.camp == role.camp and r:IsRealDead() and r:IsCanRelive() end,true)
  6910. if #list > 0 then
  6911. local random = Random.Range(1,#list) + 0.49
  6912. local pos = clamp(floor(random),1,#list)
  6913. local maxHp = list[pos]:GetRoleData(RoleDataName.MaxHp)
  6914. local pro = floor(role:GetRoleData(BattlePropList[_a]) * _b)
  6915. --快速复活
  6916. if list[pos]:IsCanRelive() then
  6917. list[pos].reliveHPF = math.min(pro / maxHp, 1)
  6918. RoleManager.AddReliveRole(list[pos])
  6919. counter = 1
  6920. end
  6921. end
  6922. end
  6923. end
  6924. end
  6925. end)
  6926. end,
  6927. --> 替补上场时,[a]属性[b]改变[c],持续[d]回合
  6928. [395] = function(role, args, delay)
  6929. local _a = args[1]
  6930. local _b = args[2]
  6931. local _c = args[3]
  6932. local _d = args[4]
  6933. local counter = 0
  6934. --回合结束时
  6935. BattleLogic.Event:AddEvent(BattleEventName.BattleTibuRoundEnd, function(curRound)
  6936. --当前是替补并且上场时
  6937. if role:IsSubstitute() then
  6938. if counter == 0 then
  6939. if RoleManager.getTibuStateByCamp(role.camp) == 4 then
  6940. counter = 1
  6941. local list = RoleManager.Query(function (r) return r.camp == role.camp end)
  6942. for _, r in ipairs(list) do
  6943. r:AddBuff(Buff.Create(role, BuffName.PropertyChange, _d, BattlePropList[_a], _c, _b))
  6944. end
  6945. end
  6946. end
  6947. end
  6948. end)
  6949. end,
  6950. --> 受到攻击时,增加[a]点怒气,最多[b]点怒气,每1层怒气使自身[c]属性[d]类型改变[e]
  6951. -->(a[int],b[int],c[属性],d[改变类型],e[float])
  6952. [396] = function(role, args, delay)
  6953. local _a = args[1]
  6954. local _b = args[2]
  6955. local _c = args[3]
  6956. local _d = args[4]
  6957. local _e = args[5]
  6958. -- 记录怒气层数
  6959. local counter = 0
  6960. local OnBeHit = function(atkRole, damage, bCrit, finalDmg, damageType)
  6961. if counter + _a > _b then
  6962. return
  6963. end
  6964. local brand = Buff.Create(role, BuffName.Brand, 0, BrandType.Angry)
  6965. brand.layer = _a
  6966. brand.maxLayer = _b
  6967. brand.clear = false
  6968. brand.startFunc = function()
  6969. counter = counter + _a
  6970. BattleUtil.AddProp(role, _c, _e*_a, _d)
  6971. -- 增加属性
  6972. --LogError("count add:"..counter)
  6973. end
  6974. brand.endFunc = function ()
  6975. -- 还原属性
  6976. if brand.disperse or brand.caster.isRealDamage then
  6977. BattleUtil.RevertProp(role, _c, _e*counter, _d)
  6978. counter = 0
  6979. --LogError("count del:"..counter)
  6980. end
  6981. end
  6982. role:AddBuff(brand)
  6983. end
  6984. role.Event:AddEvent(BattleEventName.RoleBeHit, OnBeHit)
  6985. end,
  6986. --> 释放[a]号技能时, 若目标是[b]职业, 则[c]目标的[d]属性临时[e]改变[f]
  6987. [397] = function(role, args, delay)
  6988. local _a = args[1]
  6989. local _b = args[2]
  6990. local _c = args[3]
  6991. local _d = args[4]
  6992. local _e = args[5]
  6993. local _f = args[6]
  6994. local isAdded=false
  6995. local targets = nil
  6996. local tempSkill = nil
  6997. local AddEnemyProp =function(skill)
  6998. targets = skill:GetDirectTargets()
  6999. if not targets or #targets == 0 then return end
  7000. for _, target in ipairs(targets) do
  7001. if target.professionId == _b then
  7002. BattleUtil.AddProp(target, _d, _f, _e)
  7003. end
  7004. end
  7005. end
  7006. local RevertEnemyProp=function()
  7007. if not targets or #targets == 0 then return end
  7008. for _, target in ipairs(targets) do
  7009. if target.professionId == _b and not target:IsRealDead() then
  7010. BattleUtil.RevertProp(target, _d, _f, _e)
  7011. end
  7012. end
  7013. end
  7014. local CheckAdd = function(defRole)
  7015. local isAdd = defRole.professionId == _b
  7016. return isAdd
  7017. end
  7018. local OnSkillCast = function(defRole, damageType, f, skill)
  7019. tempSkill = skill
  7020. if skill.ext_slot == _a then
  7021. if _c == 1 then
  7022. AddEnemyProp(skill)
  7023. isAdded=true
  7024. elseif _c == 2 then
  7025. if CheckAdd(defRole) then
  7026. BattleUtil.AddProp(role, _d, _f, _e)
  7027. end
  7028. isAdded=true
  7029. elseif _c == 3 then
  7030. AddEnemyProp(skill)
  7031. if CheckAdd(defRole) then
  7032. BattleUtil.AddProp(role, _d, _f, _e)
  7033. end
  7034. isAdded=true
  7035. end
  7036. end
  7037. end
  7038. role.Event:AddEvent(BattleEventName.RoleDamageBefore, OnSkillCast)
  7039. -- 还原属性
  7040. local OnSkillCastEnd = function(defRole, damageFunc, fixDamage)
  7041. if isAdded then
  7042. if _c == 1 then
  7043. RevertEnemyProp()
  7044. isAdded=false
  7045. elseif _c == 2 then
  7046. if CheckAdd(defRole) then
  7047. BattleUtil.RevertProp(role, _d, _f, _e)
  7048. end
  7049. isAdded=false
  7050. elseif _c == 3 then
  7051. RevertEnemyProp()
  7052. if CheckAdd(defRole) then
  7053. BattleUtil.RevertProp(role, _d, _f, _e)
  7054. end
  7055. isAdded=false
  7056. end
  7057. end
  7058. end
  7059. role.Event:AddEvent(BattleEventName.RoleDamageAfter, OnSkillCastEnd)
  7060. end,
  7061. --> 释放[a]号技能时, 若目标是[b]职业, 则有[c]概率为目标附加[d]控制状态,持续[e]回合
  7062. [398] = function(role, args, delay)
  7063. local _a = args[1]
  7064. local _b = args[2]
  7065. local _c = args[3]
  7066. local _d = args[4]
  7067. local _e = args[5]
  7068. local _f = args[6]
  7069. local OnSkillCast = function(skill)
  7070. if skill.ext_slot == _a then
  7071. local targets = skill:GetDirectTargets()
  7072. if not targets or #targets == 0 then return end
  7073. for _, target in ipairs(targets) do
  7074. if target.professionId == _b then
  7075. BattleUtil.RandomControl(_c, _d, role, target, _e)
  7076. end
  7077. end
  7078. end
  7079. end
  7080. role.Event:AddEvent(BattleEventName.SkillCast, OnSkillCast)
  7081. end,
  7082. --> 造成[a]伤害类型时,[b]概率再次释放技能,造成原技能[c]的伤害,若该技能是控制技能,则使技能最终的控制几率[d]类型改变[e](a[伤害类型],b[float],c[float],d[改变类型],e[float])
  7083. [399] = function(role, args, delay)
  7084. BattleLogManager.Log(
  7085. "399-----"
  7086. )
  7087. local _a = args[1]
  7088. local _b = args[2]
  7089. local _c = args[3]
  7090. local _d = args[4]
  7091. local _e = args[5]
  7092. local index = 0
  7093. -- RoleManager.LogArgs("399",args)
  7094. local triggerOnce = true
  7095. local OnHit = nil
  7096. local isConTrol=false
  7097. --> OnHit打击正常是会触发一次(按之前的逻辑) 加个skillcast reset 确保一下
  7098. OnHit = function(defRole, damage, bCrit, finalDmg, damageType, skill, transType)
  7099. BattleLogic.WaitForTrigger(delay, function ()
  7100. if damageType ~= _a then
  7101. return
  7102. end
  7103. if not skill.isAdd or not skill then
  7104. return
  7105. end
  7106. if triggerOnce then
  7107. BattleUtil.RandomAction(_b, function ()
  7108. role:InsertSkill(_a, false, nil, role.skillArray[Slot2Idx(skill.ext_slot)])
  7109. --开始连击
  7110. local isInContorl = false
  7111. local isC = false
  7112. local OnSkillCastOnce = nil
  7113. local onSkillPassivetyPropChange = nil
  7114. OnSkillCastOnce = function(skill)
  7115. role.Event:RemoveEvent(BattleEventName.SkillCast, OnSkillCastOnce)
  7116. --连击技能开始
  7117. isC = true
  7118. local OnFinalDamage = nil
  7119. OnFinalDamage = function(damagingFunc, defRole, damage, skill, dotType, bCrit, damageType)
  7120. if isC then
  7121. if damage == nil then
  7122. damage = 0
  7123. end
  7124. --连击的伤害都要减半
  7125. local fDamage = floor(BattleUtil.FP_Mul(damage, _c))
  7126. local rDamage = damage - fDamage
  7127. if type(damagingFunc) == "table" then return end
  7128. damagingFunc(rDamage)
  7129. onSkillPassivetyPropChange = function(fixControl, rand, ctrl, target)
  7130. --修改本次最终控制几率
  7131. if isC then
  7132. isConTrol = true
  7133. rand = BattleUtil.CountValue(rand, _e, _d)
  7134. fixControl(rand)
  7135. index = index - 1
  7136. role.Event:RemoveEvent(BattleEventName.PassiveRandomFinalControl, onSkillPassivetyPropChange)
  7137. end
  7138. end
  7139. --若该技能是控制技能,则使技能最终的控制几率[d]类型改变[e](a[伤害类型],b[float],c[float],d[改变类型],e[float]) PassiveRandomControl
  7140. if not isInContorl or isConTrol then
  7141. index = index + 1
  7142. role.Event:AddEvent(BattleEventName.PassiveRandomFinalControl, onSkillPassivetyPropChange)
  7143. isInContorl = true
  7144. end
  7145. end
  7146. end
  7147. role.Event:AddEvent(BattleEventName.FinalDamage, OnFinalDamage)
  7148. local OnSkillCastEndOnce = nil
  7149. OnSkillCastEndOnce = function(skill)
  7150. --连击技能完成
  7151. isC = false
  7152. isInContorl=false
  7153. index = index - 1
  7154. role.Event:RemoveEvent(BattleEventName.PassiveRandomFinalControl, onSkillPassivetyPropChange)
  7155. role.Event:RemoveEvent(BattleEventName.FinalDamage, OnFinalDamage)
  7156. role.Event:RemoveEvent(BattleEventName.SkillCastEnd, OnSkillCastEndOnce)
  7157. if isConTrol then
  7158. isConTrol=false
  7159. end
  7160. end
  7161. role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEndOnce)
  7162. end
  7163. role.Event:AddEvent(BattleEventName.SkillCast, OnSkillCastOnce)
  7164. end)
  7165. triggerOnce = false
  7166. end
  7167. end)
  7168. end
  7169. role.Event:AddEvent(BattleEventName.RoleHit, OnHit)
  7170. local OnRoleTurnEnd = function(SkillRole)
  7171. triggerOnce = true
  7172. end
  7173. role.Event:AddEvent(BattleEventName.RoleTurnEnd, OnRoleTurnEnd)
  7174. end,
  7175. --被动检测主动技能释放连击
  7176. -->当使用[a]号技能时,若击杀目标,则[b]概率触发追击,以[c]%的攻击再次释放该技能,-- 最多追击触发一次
  7177. [400] = function(role, args, delay)
  7178. local _a = args[1]
  7179. local _b = args[2]
  7180. local _c = args[3]
  7181. --local _d = 10
  7182. --RoleManager.LogArgs("400",args)
  7183. local triggerOnce = true
  7184. local OnRoleKill = nil
  7185. local isStoped = false
  7186. --> OnHit打击正常是会触发一次(按之前的逻辑) 加个skillcast reset 确保一下
  7187. OnRoleKill = function(defRole, damage, bCrit, damageType, dotType, skill)
  7188. BattleLogic.WaitForTrigger(delay, function ()
  7189. if skill == nil or defRole==nil then
  7190. return
  7191. end
  7192. if skill.ext_slot ~= _a then
  7193. return
  7194. end
  7195. if not skill.isAdd or not skill then
  7196. return
  7197. end
  7198. if triggerOnce then
  7199. BattleUtil.RandomAction2(_b, function ()
  7200. role:InsertSkill(_a, false, nil, role.skillArray[Slot2Idx(skill.ext_slot)])
  7201. --LogError("InsertSkill ")
  7202. --开始连击
  7203. local isC = false
  7204. local OnSkillCastOnce = nil
  7205. OnSkillCastOnce = function(skill)
  7206. --LogError("OnSkillCastOnce OnFinalDamage")
  7207. role.Event:RemoveEvent(BattleEventName.SkillCast, OnSkillCastOnce)
  7208. --连击技能开始
  7209. isC = true
  7210. local OnFinalDamage = nil
  7211. OnFinalDamage = function(damagingFunc, defRole, damage, skill, dotType, bCrit, damageType)
  7212. --LogError("xxdamage "..damage)
  7213. if isC then
  7214. if damage == nil then
  7215. damage = 0
  7216. end
  7217. --连击的伤害都要减半
  7218. local fDamage = floor(BattleUtil.FP_Mul(damage, _c))
  7219. local rDamage = damage - fDamage
  7220. --LogError("rDamage "..rDamage)
  7221. if type(damagingFunc) == "table" then return end
  7222. damagingFunc(rDamage)
  7223. end
  7224. end
  7225. role.Event:AddEvent(BattleEventName.FinalDamage, OnFinalDamage)
  7226. local OnSkillCastEndOnce = nil
  7227. OnSkillCastEndOnce = function(skill)
  7228. --连击技能完成
  7229. isC = false
  7230. if not isC then
  7231. if isStoped then
  7232. role.stop_move = true
  7233. isStoped = false
  7234. end
  7235. --LogError("OnSkillCastEndOnce ")
  7236. role.Event:RemoveEvent(BattleEventName.FinalDamage, OnFinalDamage)
  7237. role.Event:RemoveEvent(BattleEventName.SkillCastEnd, OnSkillCastEndOnce)
  7238. end
  7239. end
  7240. role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEndOnce)
  7241. end
  7242. role.Event:AddEvent(BattleEventName.SkillCast, OnSkillCastOnce)
  7243. end)
  7244. triggerOnce = false
  7245. end
  7246. end)
  7247. end
  7248. role.Event:AddEvent(BattleEventName.RoleKill, OnRoleKill)
  7249. local OnRoleTurnEnd = function(SkillRole)
  7250. triggerOnce = true
  7251. end
  7252. role.Event:AddEvent(BattleEventName.RoleTurnEnd, OnRoleTurnEnd)
  7253. -- 检测当前是否禁步状态 连击后复原
  7254. local function resetStop()
  7255. if role.stop_move and not triggerOnce then
  7256. role.stop_move = false
  7257. isStoped = true
  7258. end
  7259. end
  7260. role.Event:AddEvent(BattleEventName.SkillCastEnd, resetStop)
  7261. end,
  7262. --> 造成[a][伤害类型]时,[b]概率再次释放技能,造成原技能[c]的伤害,[d]属性临时[e]改变[f]
  7263. [332] = function(role, args, delay)
  7264. local _a = args[1]
  7265. local _b = args[2]
  7266. local _c = args[3]
  7267. local triggerOnce = true
  7268. local OnHit = nil
  7269. --> OnHit打击正常是会触发一次(按之前的逻辑) 加个skillcast reset 确保一下
  7270. OnHit = function(defRole, damage, bCrit, finalDmg, damageType, skill, transType)
  7271. BattleLogic.WaitForTrigger(delay, function ()
  7272. if defRole==nil then
  7273. return
  7274. end
  7275. if not skill.isAdd or not skill then
  7276. return
  7277. end
  7278. if triggerOnce then
  7279. BattleUtil.RandomAction2(_a, function ()
  7280. --role:InsertSkill(_a, false, nil, role.skillArray[Slot2Idx(skill.ext_slot)])
  7281. role:InsertSkill(SkillBaseType.Physical, false, nil, role.skillArray[Slot2Idx(0)])
  7282. --开始连击
  7283. local isC = false
  7284. local OnSkillCastOnce = nil
  7285. OnSkillCastOnce = function(skill)
  7286. role.Event:RemoveEvent(BattleEventName.SkillCast, OnSkillCastOnce)
  7287. --连击技能开始
  7288. isC = true
  7289. local OnFinalDamage = nil
  7290. OnFinalDamage = function(damagingFunc, defRole, damage, skill, dotType, bCrit, damageType)
  7291. if isC then
  7292. --连击的伤害都要减半
  7293. local fDamage = floor(BattleUtil.FP_Mul(damage, _b))
  7294. local rDamage = damage - fDamage
  7295. damagingFunc(rDamage)
  7296. damageType=_c
  7297. end
  7298. end
  7299. role.Event:AddEvent(BattleEventName.FinalDamage, OnFinalDamage)
  7300. local OnSkillCastEndOnce = nil
  7301. OnSkillCastEndOnce = function(skill)
  7302. --连击技能完成
  7303. isC = false
  7304. role.Event:RemoveEvent(BattleEventName.FinalDamage, OnFinalDamage)
  7305. role.Event:RemoveEvent(BattleEventName.SkillCastEnd, OnSkillCastEndOnce)
  7306. end
  7307. role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEndOnce)
  7308. end
  7309. role.Event:AddEvent(BattleEventName.SkillCast, OnSkillCastOnce)
  7310. end)
  7311. triggerOnce = false
  7312. end
  7313. end)
  7314. end
  7315. role.Event:AddEvent(BattleEventName.RoleHit, OnHit)
  7316. local OnRoleTurnEnd = function(SkillRole)
  7317. triggerOnce = true
  7318. end
  7319. role.Event:AddEvent(BattleEventName.RoleTurnEnd, OnRoleTurnEnd)
  7320. end,
  7321. --> 免疫控制
  7322. --> 当自己血量低于[a]或首次被控制时,自动解除并免疫控制,同时使自己的[b]属性[c]改变[d],持续[e]回合(每场只能触发一次)
  7323. --> a[float] b[float] c[int]
  7324. [403] = function(role, args)
  7325. local _a = args[1]
  7326. local _b = args[2]
  7327. local _c = args[3]
  7328. local _d = args[4]
  7329. local _e = args[5]
  7330. -- RoleManager.LogArgs("403",args)
  7331. local onRoleContoleOrHit
  7332. onRoleContoleOrHit= function()
  7333. local list = BattleLogic.BuffMgr:GetBuff(role, function(buff)
  7334. return buff.type == BuffName.Control
  7335. end)
  7336. -- LogError("triggerd list"..#list.." per "..BattleUtil.GetHPPencent(role).." 218:"..role.effect218times.." ctrl:"..role.ctrltimes)
  7337. if role.effect218times <= 0 and (BattleUtil.GetHPPencent(role) < _a or (list and #list > 0 and role.ctrltimes == 1)) then
  7338. role.effect218times = role.effect218times + 1
  7339. --LogError("triggerd")
  7340. local ime=Buff.Create(role, BuffName.Immune, _e, 1)
  7341. role:AddBuff(ime)
  7342. ime.IsOnlyImmune = true
  7343. ime:OnStart()
  7344. ime.clear=false
  7345. if list and #list > 0 then
  7346. for i=0,#list do
  7347. BattleLogic.BuffMgr:ClearBuff(role, function (buff)
  7348. if buff == list[i] then
  7349. buff.clear = true
  7350. buff.disperse=true
  7351. end
  7352. return false --代理类存在问题
  7353. end)
  7354. end
  7355. end
  7356. local buff = Buff.Create(role, BuffName.PropertyChange, _e, BattlePropList[_b], _d, _c)
  7357. role:AddBuff(buff)
  7358. buff:OnTrigger()
  7359. end
  7360. end
  7361. role.Event:AddEvent(BattleEventName.PassiveBeRandomFinalControl, onRoleContoleOrHit)
  7362. role.Event:AddEvent(BattleEventName.RoleBeDamaged, onRoleContoleOrHit)
  7363. role.Event:AddEvent(BattleEventName.RoleDead, onRoleContoleOrHit)
  7364. role.Event:AddEvent(BattleEventName.BuffStart, onRoleContoleOrHit)
  7365. BattleLogic.Event:DispatchEvent(BattleEventName.BuffCaster, onRoleContoleOrHit)
  7366. BattleLogic.Event:DispatchEvent(BattleEventName.RoleTurnEnd, onRoleContoleOrHit)
  7367. end,
  7368. --> 攻击时, 若目标是[a]职业, 则[b]目标的[c]属性临时[d]改变[e]
  7369. [405] = function(role, args, delay)
  7370. local _a = args[1]
  7371. local _b = args[2]
  7372. local _c = args[3]
  7373. local _d = args[4]
  7374. local _e = args[5]
  7375. local triggered=false
  7376. local onRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill)
  7377. if defRole.professionId == _a then
  7378. if _b == 1 then
  7379. BattleUtil.AddProp(defRole, _c, _e, _d)
  7380. elseif _b == 2 then
  7381. BattleUtil.AddProp(role, _c, _e, _d)
  7382. elseif _b == 3 then
  7383. BattleUtil.AddProp(defRole, _c, _e, _d)
  7384. BattleUtil.AddProp(role, _c, _e, _d)
  7385. end
  7386. triggered=true
  7387. end
  7388. end
  7389. local onRoleHitRevert = function(damagingFunc, defRole, damage, skill, dotType, bCrit, damageType)
  7390. if defRole.professionId == _a and triggered then
  7391. if _b == 1 then
  7392. BattleUtil.RevertProp(defRole, _c, _e, _d)
  7393. elseif _b == 2 then
  7394. BattleUtil.RevertProp(role, _c, _e, _d)
  7395. elseif _b == 3 then
  7396. BattleUtil.RevertProp(defRole, _c, _e, _d)
  7397. BattleUtil.RevertProp(role, _c, _e, _d)
  7398. end
  7399. triggered=false
  7400. end
  7401. end
  7402. role.Event:AddEvent(BattleEventName.FinalDamage, onRoleHitRevert)
  7403. role.Event:AddEvent(BattleEventName.RoleDamageBefore, onRoleHit)
  7404. end,
  7405. --> 战斗开始时, 敌方所有人[a]属性[b]改变[c], 持续[d]回合,可驱散
  7406. [406] = function(role, args, delay)
  7407. local _a = args[1]
  7408. local _b = args[2]
  7409. local _c = args[3]
  7410. local _d = args[4]
  7411. local function _OnRoundChange(curRound)
  7412. if curRound == 1 then
  7413. local list = RoleManager.Query(function(r)
  7414. return r.camp ~= role.camp
  7415. end)
  7416. for _, r in ipairs(list) do
  7417. local buff = Buff.Create(role, BuffName.PropertyChange, _d, BattlePropList[_a], _c, _b)
  7418. r:AddBuff(buff)
  7419. buff.clear = true
  7420. end
  7421. end
  7422. end
  7423. BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, _OnRoundChange)
  7424. end,
  7425. --> 击杀目标时, 若目标是[a]职业, 则自身恢复伤害量[b]的生命/镜像逻辑316
  7426. [407] = function(role, args, delay)
  7427. local _a = args[1]
  7428. local _b = args[2]
  7429. local OnKill = function(defRole, damage)
  7430. if defRole.professionId == _a then
  7431. BattleUtil.CalTreat(role, role, floor(BattleUtil.FP_Mul(damage, _b)))
  7432. end
  7433. end
  7434. role.Event:AddEvent(BattleEventName.RoleKill, OnKill)
  7435. end,
  7436. --> copy
  7437. [99999999] = function(role, args, delay)
  7438. local _a = args[1]
  7439. local _b = args[2]
  7440. local _c = args[3]
  7441. local _d = args[4]
  7442. local _e = args[5]
  7443. local _f = args[6]
  7444. local _g = args[7]
  7445. local _h = args[8]
  7446. local _i = args[9]
  7447. end,
  7448. }
  7449. return passivityList