Passivity.lua 218 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746
  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 clearBuffPredicate(buff, type)
  41. local flag = false
  42. if type == 1 then --持续恢复
  43. flag = buff.type == BuffName.HOT
  44. elseif type == 2 then --护盾
  45. flag = buff.type == BuffName.Shield
  46. elseif type == 3 then --增益状态
  47. flag = buff.isBuff == true
  48. elseif type == 4 then --减益状态
  49. flag = buff.isDeBuff == true
  50. elseif type == 5 then --持续伤害
  51. flag = buff.type == BuffName.DOT
  52. elseif type == 6 then --负面状态(控制状态、减益状态和持续伤害状态)
  53. flag = buff.type == BuffName.Control or buff.isDeBuff or buff.type == BuffName.DOT
  54. end
  55. return flag
  56. end
  57. --被动技能表
  58. local passivityList = {
  59. --发动技能时,[a]的概率将[b]*[c]算作[d]计算
  60. --a[float],b[属性],c[float],d[属性]
  61. [1] = function(role, args)
  62. local f1 = args[1]
  63. local pro1 = args[2]
  64. local f2 = args[3]
  65. local pro2 = args[4]
  66. local OnSkillCast = function(skill)
  67. BattleUtil.RandomAction(f1, function ()
  68. local duration = 0
  69. for i=1, skill.effectList.size do
  70. duration = max(duration, skill.effectList.buffer[i].duration)
  71. end
  72. role:AddPropertyTransfer(BattlePropList[pro1], f2, BattlePropList[pro2], 2, duration + BattleLogic.GameDeltaTime * 2)
  73. end)
  74. end
  75. role.Event:AddEvent(BattleEventName.SkillCast, OnSkillCast)
  76. end,
  77. --发动技能后,[a]的概率对敌方随机1名施加攻击*[c]的[d]伤害。
  78. --a[float],c[float],d[伤害类型]
  79. [2] = function(role, args)
  80. local f1 = args[1]
  81. local f2 = args[2]
  82. local dt = args[3]
  83. local OnSkillCastEnd = function(skill)
  84. BattleUtil.RandomAction(f1, function ()
  85. local arr = BattleUtil.ChooseTarget(role, 20001)
  86. if arr[1] then
  87. BattleUtil.CalDamage(nil, role, arr[1], dt, f2)
  88. end
  89. end)
  90. end
  91. role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
  92. end,
  93. --发动技能后,[c]使仇恨目标受到治疗效果降低[a],持续[b]
  94. --a[float],b[int],c[float]
  95. [3] = function(role, args)
  96. local f1 = args[1]
  97. local f2 = args[2]
  98. local f3 = args[3]
  99. local OnSkillCastEnd = function(skill)
  100. BattleUtil.RandomAction(f3, function ()
  101. local arr = BattleUtil.ChooseTarget(role, 40000)
  102. if arr[1] then
  103. arr[1]:AddBuff(Buff.Create(role, BuffName.PropertyChange, f2, RoleDataName.CureFacter, f1, 3))
  104. end
  105. end)
  106. end
  107. role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
  108. end,
  109. --发动技能后,[d]改变自身[a]属性[b],持续[c]秒
  110. --a[属性],b[float],c[int],d[改变类型]
  111. [4] = function(role, args)
  112. local pro = args[1]
  113. local f1 = args[2]
  114. local f2 = args[3]
  115. local ct = args[4]
  116. local OnSkillCastEnd = function(skill)
  117. role:AddBuff(Buff.Create(role, BuffName.PropertyChange, f2, BattlePropList[pro], f1, ct))
  118. end
  119. role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
  120. end,
  121. --发动技能后,[a]的概率回复攻击最高的1人的[b]*[c]血量,持续[d]秒。
  122. --a[float],b[属性],c[float],d[int]
  123. [5] = function(role, args)
  124. local f1 = args[1]
  125. local pro = args[2]
  126. local f2 = args[3]
  127. local f3 = args[4]
  128. local OnSkillCastEnd = function(skill)
  129. BattleUtil.RandomAction(f1, function ()
  130. local arr = BattleUtil.ChooseTarget(role, 10321)
  131. if arr[1] then
  132. local val = floor(BattleUtil.FP_Mul(f2, role:GetRoleData(BattlePropList[pro])))
  133. arr[1]:AddBuff(Buff.Create(role, BuffName.HOT, f3, 1, val))
  134. end
  135. end)
  136. end
  137. role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
  138. end,
  139. --发动技能后,[a]的概率提升随机角色的[b]*[c]的[d],持续[e]秒。
  140. --a[float],b[属性],c[float],d[属性],e[int]
  141. [6] = function(role, args)
  142. local f1 = args[1]
  143. local pro1 = args[2]
  144. local f2 = args[3]
  145. local pro2 = args[4]
  146. local f3 = args[5]
  147. local OnSkillCastEnd = function(skill)
  148. BattleUtil.RandomAction(f1, function ()
  149. local arr = BattleUtil.ChooseTarget(role, 10001)
  150. if arr[1] then
  151. local val = floor(BattleUtil.FP_Mul(f2, role:GetRoleData(BattlePropList[pro1])))
  152. arr[1]:AddBuff(Buff.Create(role, BuffName.PropertyChange, f3, BattlePropList[pro2], val, 1))
  153. end
  154. end)
  155. end
  156. role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
  157. end,
  158. --使用回复技能时,[a]的概率提高恢复效果[b]。
  159. --a[float],b[float]
  160. [7] = function(role, args)
  161. local f1 = args[1]
  162. local f2 = args[2]
  163. local OnPassiveTreating = function(treatingFunc)
  164. BattleUtil.RandomAction(f1, function ()
  165. treatingFunc(f2, CountTypeName.AddPencent)
  166. end)
  167. end
  168. role.Event:AddEvent(BattleEventName.PassiveTreating, OnPassiveTreating)
  169. end,
  170. --受击后,[a]的概率,回复自身的[b]*[c]的血量
  171. --a[float],b[属性],c[float]
  172. [8] = function(role, args)
  173. local f1 = args[1]
  174. local pro = args[2]
  175. local f2 = args[3]
  176. local OnBeHit = function(treatingFunc)
  177. BattleUtil.RandomAction(f1, function ()
  178. local val = floor(BattleUtil.FP_Mul(f2, role:GetRoleData(BattlePropList[pro])))
  179. BattleUtil.CalTreat(role, role, val)
  180. end)
  181. end
  182. role.Event:AddEvent(BattleEventName.RoleBeHit, OnBeHit)
  183. end,
  184. --受击后,[a]对攻击者造成的攻击*[c]的持续伤害,持续[d]秒。
  185. --a[float],c[float],d[int]
  186. [9] = function(role, args)
  187. local f1 = args[1]
  188. local f2 = args[2]
  189. local f3 = args[3]
  190. local triggerUid = {}
  191. local OnBeHit = function(atkRole)
  192. if atkRole.isTeam then
  193. return
  194. end
  195. if triggerUid[atkRole.uid] then --加入限定避免循环触发
  196. return
  197. end
  198. BattleUtil.RandomAction(f1, function ()
  199. atkRole:AddBuff(Buff.Create(role, BuffName.DOT, f3, 1, 0, 1, f2))
  200. triggerUid[atkRole.uid] = atkRole.uid
  201. BattleLogic.WaitForTrigger(f3+1, function ()
  202. triggerUid[atkRole.uid] = nil
  203. end)
  204. end)
  205. end
  206. role.Event:AddEvent(BattleEventName.RoleBeHit, OnBeHit)
  207. end,
  208. --受击时[e],[a]的概率将[b]*[c]算作[d]计算
  209. --a[float],b[属性],c[float],d[属性],e[伤害类型]
  210. [10] = function(role, args)
  211. local f1 = args[1]
  212. local pro1 = args[2]
  213. local f2 = args[3]
  214. local pro2 = args[4]
  215. local dt = args[5]
  216. local OnRoleBeDamagedBefore = function(atkRole, func, damageType)
  217. if damageType == dt then
  218. BattleUtil.RandomAction(f1, function ()
  219. role:AddPropertyTransfer(BattlePropList[pro1], f2, BattlePropList[pro2], 2, BattleLogic.GameDeltaTime)
  220. end)
  221. end
  222. end
  223. role.Event:AddEvent(BattleEventName.RoleBeDamagedBefore, OnRoleBeDamagedBefore)
  224. end,
  225. --受击时,有[a]的概率抵消[b]*[c]的攻击。
  226. --a[float],b[属性],c[float]
  227. [11] = function(role, args)
  228. local f1 = args[1]
  229. local pro = args[2]
  230. local f2 = args[3]
  231. local OnPassiveDamaging = function(damagingFunc, atkRole, damage)
  232. BattleUtil.RandomAction(f1, function ()
  233. damagingFunc(floor(BattleUtil.FP_Mul(f2, role:GetRoleData(BattlePropList[pro]))))
  234. end)
  235. end
  236. role.Event:AddEvent(BattleEventName.PassiveBeDamaging, OnPassiveDamaging)
  237. end,
  238. --受击后,有[a]的概率对敌方全体造成攻击*[c]的[d]伤害
  239. --a[float],c[float],d[伤害类型]
  240. [12] = function(role, args)
  241. local f1 = args[1]
  242. local f2 = args[2]
  243. local dt = args[3]
  244. local lastTrigger = 0
  245. local OnBeHit = function(atkRole)
  246. if atkRole.isTeam then
  247. return
  248. end
  249. lastTrigger = lastTrigger + 1
  250. if lastTrigger > 1 then --加入限定避免循环触发
  251. return
  252. end
  253. BattleUtil.RandomAction(f1, function ()
  254. local arr = BattleUtil.ChooseTarget(role, 20000)
  255. for i=1, #arr do
  256. BattleUtil.CalDamage(nil, role, arr[i], dt, f2)
  257. end
  258. end)
  259. lastTrigger = 0
  260. end
  261. role.Event:AddEvent(BattleEventName.RoleBeHit, OnBeHit)
  262. end,
  263. --受击后,有[a]的概率对随机1人造成[b]*[c]的真实伤害。
  264. --a[float],b[属性],c[float]
  265. [13] = function(role, args)
  266. local f1 = args[1]
  267. local pro = args[2]
  268. local f2 = args[3]
  269. local lastTrigger = 0
  270. local OnBeHit = function(atkRole)
  271. if atkRole.isTeam then
  272. return
  273. end
  274. lastTrigger = lastTrigger + 1
  275. if lastTrigger > 1 then --加入限定避免循环触发
  276. return
  277. end
  278. BattleUtil.RandomAction(f1, function ()
  279. local arr = BattleUtil.ChooseTarget(role, 20001)
  280. if arr[1] then
  281. local val = floor(BattleUtil.FP_Mul(f2, role:GetRoleData(BattlePropList[pro])))
  282. BattleUtil.ApplyDamage(nil, role, arr[1], val)
  283. end
  284. end)
  285. lastTrigger = 0
  286. end
  287. role.Event:AddEvent(BattleEventName.RoleBeHit, OnBeHit)
  288. end,
  289. --受击后[f],[a]的概率将[b]*[c]算作[d]计算,持续[e]秒。
  290. --a[float],b[属性],c[float],d[属性],e[int],f[伤害类型]
  291. [14] = function(role, args)
  292. local f1 = args[1]
  293. local pro1 = args[2]
  294. local f2 = args[3]
  295. local pro2 = args[4]
  296. local f3 = args[5]
  297. local dt = args[6]
  298. local OnBeHit = function(atkRole, damage, bCrit, finalDmg, damageType)
  299. if damageType == dt then
  300. BattleUtil.RandomAction(f1, function ()
  301. role:AddPropertyTransfer(BattlePropList[pro1], f2, BattlePropList[pro2], 2, f3)
  302. end)
  303. end
  304. end
  305. role.Event:AddEvent(BattleEventName.RoleBeHit, OnBeHit)
  306. end,
  307. --免疫[a]属性伤害。
  308. --a[属性类型]
  309. [15] = function(role, args)
  310. local pt = args[1]
  311. local elementDamageReduceFactor
  312. if pt == 1 then
  313. elementDamageReduceFactor = RoleDataName.FireDamageReduceFactor
  314. elseif pt == 2 then
  315. elementDamageReduceFactor = RoleDataName.WindDamageReduceFactor
  316. elseif pt == 3 then
  317. elementDamageReduceFactor = RoleDataName.IceDamageReduceFactor
  318. elseif pt == 4 then
  319. elementDamageReduceFactor = RoleDataName.LandDamageReduceFactor
  320. elseif pt == 5 then
  321. elementDamageReduceFactor = RoleDataName.LightDamageReduceFactor
  322. elseif pt == 6 then
  323. elementDamageReduceFactor = RoleDataName.DarkDamageReduceFactor
  324. end
  325. role.data:AddValue(elementDamageReduceFactor, 10000)
  326. end,
  327. --发动技能后,[a]的概率将[b]*[c]算作[d]计算,持续[e]秒。
  328. --a[float],b[属性],c[float],d[属性],e[int]
  329. [16] = function(role, args)
  330. local f1 = args[1]
  331. local pro1 = args[2]
  332. local f2 = args[3]
  333. local pro2 = args[4]
  334. local f3 = args[5]
  335. local OnSkillCastEnd = function(skill)
  336. BattleUtil.RandomAction(f1, function ()
  337. role:AddPropertyTransfer(BattlePropList[pro1], f2, BattlePropList[pro2], 2, f3)
  338. end)
  339. end
  340. role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
  341. end,
  342. --发动技能后,[d]改变仇恨目标[a]属性[b],持续[c]秒
  343. --a[属性],b[int],c[int],d[改变类型]
  344. [17] = function(role, args)
  345. local pro1 = args[1]
  346. local f1 = args[2]
  347. local f2 = args[3]
  348. local ct = args[4]
  349. local OnSkillCastEnd = function(skill)
  350. local arr = BattleUtil.ChooseTarget(role, 40000)
  351. if arr[1] then
  352. arr[1]:AddBuff(Buff.Create(role, BuffName.PropertyChange, f2, BattlePropList[pro1], f1, ct))
  353. end
  354. end
  355. role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
  356. end,
  357. --发动技能后,[d]改变己方全体[a]属性[b],持续[c]秒
  358. --a[属性],b[int],c[int],d[改变类型]
  359. [18] = function(role, args)
  360. local pro1 = args[1]
  361. local f1 = args[2]
  362. local f2 = args[3]
  363. local ct = args[4]
  364. local OnSkillCastEnd = function(skill)
  365. local arr = BattleUtil.ChooseTarget(role, 10000)
  366. for i=1, #arr do
  367. arr[i]:AddBuff(Buff.Create(role, BuffName.PropertyChange, f2, BattlePropList[pro1], f1, ct))
  368. end
  369. end
  370. role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
  371. end,
  372. --受到治疗效果提高[a]。
  373. --a[float]
  374. [19] = function(role, args)
  375. local f1 = args[1]
  376. role.data:AddValue(RoleDataName.CureFacter, f1)
  377. end,
  378. --[b]造成的持续伤害时间延长[a]。
  379. --a[int],b[改变类型]
  380. [20] = function(role, args)
  381. local f1 = args[1]
  382. local ct = args[2]
  383. local OnBuffCaster = function(buff)
  384. if buff.type == BuffName.DOT then
  385. if ct == 1 then --加算
  386. buff.duration = buff.duration + f1
  387. elseif ct == 2 then --乘加算(百分比属性加算)
  388. buff.duration = buff.duration * (1 + f1)
  389. elseif ct == 3 then --减算
  390. buff.duration = buff.duration - f1
  391. elseif ct == 4 then --乘减算(百分比属性减算)
  392. buff.duration = buff.duration * (1 - f1)
  393. end
  394. end
  395. end
  396. role.Event:AddEvent(BattleEventName.BuffCaster, OnBuffCaster)
  397. end,
  398. --自身增益效果超过[a]时,技能伤害提升[b]。
  399. --a[int],b[float]
  400. [21] = function(role, args)
  401. local i1 = args[1]
  402. local f1 = args[2]
  403. local count = 0
  404. local targetBuff
  405. local active = count > i1
  406. local OnBuffStart = function(buff)
  407. if buff.isBuff then
  408. count = count + 1
  409. if count > i1 and not active then
  410. active = true
  411. targetBuff = Buff.Create(role, BuffName.PropertyChange, 0, RoleDataName.DamageBocusFactor, f1, 1)
  412. targetBuff.isBuff = false --自身不算增益
  413. role:AddBuff(targetBuff)
  414. end
  415. end
  416. end
  417. local OnBuffEnd = function(buff)
  418. if buff.isBuff then
  419. count = count - 1
  420. if count <= i1 and active then
  421. active = false
  422. if targetBuff then
  423. targetBuff.disperse = true
  424. end
  425. end
  426. end
  427. end
  428. role.Event:AddEvent(BattleEventName.BuffStart, OnBuffStart)
  429. role.Event:AddEvent(BattleEventName.BuffEnd, OnBuffEnd)
  430. end,
  431. --血量低于[a]时,[b]概率触发控制免疫,持续[c]秒。每场战斗只能触发1次。
  432. --a[float],b[float],c[int]
  433. [22] = function(role, args)
  434. local f1 = args[1]
  435. local f2 = args[2]
  436. local f3 = args[3]
  437. local triggerCount = 0
  438. local OnBeHit = function(atkRole)
  439. if BattleUtil.GetHPPencent(role) < f1 then
  440. if triggerCount < 1 then
  441. BattleUtil.RandomAction(f2, function ()
  442. role:AddBuff(Buff.Create(role, BuffName.Immune, f3, 1))
  443. triggerCount = triggerCount + 1
  444. end)
  445. end
  446. end
  447. end
  448. role.Event:AddEvent(BattleEventName.RoleBeHit, OnBeHit)
  449. end,
  450. --死亡时,立即回复己方全体[a]*[b]的血量。
  451. --a[属性],b[float]
  452. [23] = function(role, args)
  453. local pro = args[1]
  454. local f1 = args[2]
  455. local OnDead = function(atkRole)
  456. local arr = BattleUtil.ChooseTarget(role, 10000)
  457. for i=1, #arr do
  458. local val = floor(BattleUtil.FP_Mul(f1, role:GetRoleData(BattlePropList[pro])))
  459. BattleUtil.CalTreat(role, arr[i], val)
  460. end
  461. end
  462. role.Event:AddEvent(BattleEventName.RoleDead, OnDead)
  463. end,
  464. --控制效果命中后,[a]的概率施加[c]的[d]伤害
  465. --a[float],c[float],d[伤害类型]
  466. [24] = function(role, args)
  467. local f1 = args[1]
  468. local f2 = args[2]
  469. local dt = args[3]
  470. local OnBuffCaster = function(buff)
  471. if buff.type == BuffName.Control then
  472. BattleUtil.RandomAction(f1, function ()
  473. BattleUtil.CalDamage(nil, role, buff.target, dt, f2)
  474. end)
  475. end
  476. end
  477. role.Event:AddEvent(BattleEventName.BuffCaster, OnBuffCaster)
  478. end,
  479. --控制效果命中后,[a]对全体造成[c]的[d]伤害。
  480. --a[float],c[float],d[伤害类型]
  481. [25] = function(role, args)
  482. local f1 = args[1]
  483. local f2 = args[2]
  484. local dt = args[3]
  485. local OnBuffCaster = function(buff)
  486. if buff.type == BuffName.Control then
  487. BattleUtil.RandomAction(f1, function ()
  488. local arr = BattleUtil.ChooseTarget(buff.target, 10000)
  489. for i=1, #arr do
  490. BattleUtil.CalDamage(nil, role, arr[i], dt, f2)
  491. end
  492. end)
  493. end
  494. end
  495. role.Event:AddEvent(BattleEventName.BuffCaster, OnBuffCaster)
  496. end,
  497. --造成的伤害暴击后,[a]施加攻击*[c]的[d]持续伤害,持续[e]秒。
  498. --a[float],c[float],d[伤害类型],e[int]
  499. [26] = function(role, args)
  500. local f1 = args[1]
  501. local f2 = args[2]
  502. local dt = args[3]
  503. local f3 = args[4]
  504. local triggerUid = {}
  505. local OnRoleCrit = function(defRole)
  506. if triggerUid[defRole.uid] then --加入限定避免循环触发
  507. return
  508. end
  509. BattleUtil.RandomAction(f1, function ()
  510. defRole:AddBuff(Buff.Create(role, BuffName.DOT, f3, 1, 0, dt, f2))
  511. triggerUid[defRole.uid] = defRole.uid
  512. BattleLogic.WaitForTrigger(f3+1, function ()
  513. triggerUid[defRole.uid] = nil
  514. end)
  515. end)
  516. end
  517. role.Event:AddEvent(BattleEventName.RoleCrit, OnRoleCrit)
  518. end,
  519. --造成的伤害暴击后,[a]的概率回复自身[b]*[c]的血量
  520. --a[float],b[属性],c[float]
  521. [27] = function(role, args)
  522. local f1 = args[1]
  523. local pro = args[2]
  524. local f2 = args[3]
  525. local OnRoleCrit = function(defRole)
  526. BattleUtil.RandomAction(f1, function ()
  527. local val = floor(BattleUtil.FP_Mul(f2, role:GetRoleData(BattlePropList[pro])))
  528. BattleUtil.CalTreat(role, role, val)
  529. end)
  530. end
  531. role.Event:AddEvent(BattleEventName.RoleCrit, OnRoleCrit)
  532. end,
  533. --对血量高于[a]的敌人伤害提高[b]。
  534. --a[float],b[float]
  535. [28] = function(role, args)
  536. local f1 = args[1]
  537. local f2 = args[2]
  538. local OnPassiveDamaging = function(damagingFunc, defRole, damage)
  539. if BattleUtil.GetHPPencent(defRole) > f1 then
  540. damagingFunc(-floor(f2 * damage))
  541. end
  542. end
  543. role.Event:AddEvent(BattleEventName.PassiveDamaging, OnPassiveDamaging)
  544. end,
  545. --对血量低于[a]的敌人伤害提高[b]。
  546. --a[float],b[float]
  547. [29] = function(role, args)
  548. local f1 = args[1]
  549. local f2 = args[2]
  550. local OnPassiveDamaging = function(damagingFunc, defRole, damage)
  551. if BattleUtil.GetHPPencent(defRole) < f1 then
  552. damagingFunc(-floor(f2 * damage))
  553. end
  554. end
  555. role.Event:AddEvent(BattleEventName.PassiveDamaging, OnPassiveDamaging)
  556. end,
  557. --发动技能后,[d]改变敌方全体[a]属性[b],持续[c]秒
  558. --a[属性],b[float],c[int],d[改变类型]
  559. [30] = function(role, args)
  560. local pro = args[1]
  561. local f1 = args[2]
  562. local f2 = args[3]
  563. local ct = args[4]
  564. local OnSkillCastEnd = function(skill)
  565. local arr = BattleUtil.ChooseTarget(role, 20000)
  566. for i=1, #arr do
  567. arr[i]:AddBuff(Buff.Create(role, BuffName.PropertyChange, f2, BattlePropList[pro], f1, ct))
  568. end
  569. end
  570. role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
  571. end,
  572. --发动技能后,有[a]的概率眩晕敌方其中1人,持续[b]秒。
  573. --a[float],b[int]
  574. [31] = function(role, args)
  575. local f1 = args[1]
  576. local f2 = args[2]
  577. local OnSkillCastEnd = function(skill)
  578. local arr = BattleUtil.ChooseTarget(role, 20001)
  579. if arr[1] then
  580. BattleUtil.RandomControl(f1, 1, role, arr[1], f2)
  581. end
  582. end
  583. role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
  584. end,
  585. --持续伤害效果命中后,[d]改变自身[a]属性[b],持续[c]秒
  586. --a[属性],b[float],c[int],d[改变类型]
  587. [32] = function(role, args)
  588. local pro = args[1]
  589. local f1 = args[2]
  590. local f2 = args[3]
  591. local ct = args[4]
  592. local OnBuffCaster = function(buff)
  593. if buff.type == BuffName.DOT then
  594. role:AddBuff(Buff.Create(role, BuffName.PropertyChange, f2, BattlePropList[pro], f1, ct))
  595. end
  596. end
  597. role.Event:AddEvent(BattleEventName.BuffCaster, OnBuffCaster)
  598. end,
  599. --[d]改变自身[a]属性[b],持续[c]秒
  600. --a[属性],b[float],c[int],d[改变类型]
  601. [33] = function(role, args)
  602. local pro = args[1]
  603. local f1 = args[2]
  604. local f2 = args[3]
  605. local ct = args[4]
  606. role:AddBuff(Buff.Create(role, BuffName.PropertyChange, f2, BattlePropList[pro], f1, ct))
  607. end,
  608. --造成伤害时,额外增加[a]点伤害。
  609. --a[int]
  610. [34] = function(role, args)
  611. local f1 = args[1]
  612. local OnPassiveDamaging = function(damagingFunc)
  613. damagingFunc(-f1)
  614. end
  615. role.Event:AddEvent(BattleEventName.PassiveDamaging, OnPassiveDamaging)
  616. end,
  617. --进入战斗[a]秒后,造成的伤害提升[b],持续[c]秒
  618. --a[int],b[float],c[int]
  619. [35] = function(role, args)
  620. local f1 = args[1]
  621. local f2 = args[2]
  622. local f3 = args[3]
  623. BattleLogic.WaitForTrigger(f1, function ()
  624. role:AddBuff(Buff.Create(role, BuffName.PropertyChange, f3, RoleDataName.DamageBocusFactor, f2, 1))
  625. end)
  626. end,
  627. --进入战斗[a]秒后,[d]改变[b]属性[c],持续[e]秒
  628. --a[int],b[属性],c[int],d[改变类型],e[int]
  629. [36] = function(role, args)
  630. local f1 = args[1]
  631. local pro = args[2]
  632. local f2 = args[3]
  633. local ct = args[4]
  634. local f3 = args[5]
  635. BattleLogic.WaitForTrigger(f1, function ()
  636. role:AddBuff(Buff.Create(role, BuffName.PropertyChange, f3, BattlePropList[pro], f2, ct))
  637. end)
  638. end,
  639. --进入战斗[a]秒后,免疫控制效果,持续[b]秒
  640. --a[int],b[int]
  641. [37] = function(role, args)
  642. local f1 = args[1]
  643. local f2 = args[2]
  644. BattleLogic.WaitForTrigger(f1, function ()
  645. role:AddBuff(Buff.Create(role, BuffName.Immune, f2, 1))
  646. end)
  647. end,
  648. --每[a]秒,[d]改变[b]的[c],[g改变[e]的[f],最高叠加[h]层 (举例:每5秒,扣除10%的生命,提高5%的速度, 最高叠加5层)
  649. --a[int],b[float],c[属性],d[改变类型],e[float],f[属性],g[改变类型],h[int]
  650. [38] = function(role, args)
  651. local f1 = args[1]
  652. local f2 = args[2]
  653. local pro1 = args[3]
  654. local ct1 = args[4]
  655. local f3 = args[5]
  656. local pro2 = args[6]
  657. local ct2 = args[7]
  658. local i1 = args[8]
  659. local auraBuff = Buff.Create(role, BuffName.Aura, 0, function (r)
  660. local changeBuff1 = Buff.Create(r, BuffName.PropertyChange, 0, BattlePropList[pro1], f2, ct1)
  661. changeBuff1.cover = true
  662. changeBuff1.maxLayer = i1
  663. local changeBuff2 = Buff.Create(r, BuffName.PropertyChange, 0, BattlePropList[pro2], f3, ct2)
  664. changeBuff2.cover = true
  665. changeBuff2.maxLayer = i1
  666. r:AddBuff(changeBuff1)
  667. r:AddBuff(changeBuff2)
  668. end)
  669. auraBuff.interval = f1
  670. role:AddBuff(auraBuff)
  671. end,
  672. --进入战斗后,每[a]秒回复[b]生命
  673. --a[int],b[int]
  674. [39] = function(role, args)
  675. local f1 = args[1]
  676. local f2 = args[2]
  677. local auraBuff = Buff.Create(role, BuffName.Aura, 0, function (r)
  678. BattleUtil.CalTreat(r, r, f2)
  679. end)
  680. auraBuff.interval = f1
  681. role:AddBuff(auraBuff)
  682. end,
  683. --被指定[a]造成伤害时,回复[b]生命
  684. --a[职业],b[int]
  685. [40] = function(role, args)
  686. local i1 = args[1]
  687. local f1 = args[2]
  688. local OnBeHit = function(atkRole)
  689. if atkRole.isTeam then
  690. return
  691. end
  692. if atkRole.roleData.professionId == i1 then
  693. BattleUtil.CalTreat(role, role, f1)
  694. end
  695. end
  696. role.Event:AddEvent(BattleEventName.RoleBeHit, OnBeHit)
  697. end,
  698. --造成伤害时,将伤害的[a]%转化为自身生命
  699. --a[float]
  700. [41] = function(role, args)
  701. local f1 = args[1]
  702. local OnDamage = function(defRole, damage, bCrit, finalDmg)
  703. BattleUtil.CalTreat(role, role, floor(f1 * finalDmg))
  704. end
  705. role.Event:AddEvent(BattleEventName.RoleDamage, OnDamage)
  706. end,
  707. --造成暴击伤害时,有[a]的概率造成[b]的暴击伤害。
  708. --a[float],b[float]
  709. [42] = function(role, args)
  710. local f1 = args[1]
  711. local f2 = args[2]
  712. local OnPassiveCriting = function(crit)
  713. BattleUtil.RandomAction(f1, function ()
  714. crit(f2)
  715. end)
  716. end
  717. role.Event:AddEvent(BattleEventName.PassiveCriting, OnPassiveCriting)
  718. end,
  719. --发动技能后,[d]改变仇恨目标[a]属性[b],持续整场战斗,属性最多可改变[c]
  720. --a[属性],b[float],c[float],d[改变类型]
  721. [43] = function(role, args)
  722. local pro = args[1]
  723. local f1 = args[2]
  724. local i1 = args[3]
  725. local ct = args[4]
  726. local OnSkillCastEnd = function(skill)
  727. local arr = BattleUtil.ChooseTarget(role, 40000)
  728. if arr[1] then
  729. local buff = Buff.Create(role, BuffName.PropertyChange, 0, BattlePropList[pro], f1, ct)
  730. buff.cover = true
  731. buff.maxLayer = i1
  732. arr[1]:AddBuff(buff)
  733. end
  734. end
  735. role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
  736. end,
  737. --发动技能后,[a]的概率[e]改变自身[b]属性[c],持续[d]秒。
  738. --a[float],b[属性],c[float],d[int],e[改变类型]
  739. [44] = function(role, args)
  740. local f1 = args[1]
  741. local pro = args[2]
  742. local f2 = args[3]
  743. local f3 = args[4]
  744. local ct = args[5]
  745. local OnSkillCastEnd = function(skill)
  746. BattleUtil.RandomAction(f1, function ()
  747. role:AddBuff(Buff.Create(role, BuffName.PropertyChange, f3, BattlePropList[pro], f2, ct))
  748. end)
  749. end
  750. role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
  751. end,
  752. --免疫[a]次[b]控制状态。
  753. --a[int],b[控制类型]
  754. [45] = function(role, args)
  755. local i1 = args[1]
  756. local ct = args[2]
  757. local triggerCount = 0
  758. role.buffFilter:Add(function(buff)
  759. local isTarget = buff.type == BuffName.Control and (ct == 0 or buff.ctrlType == ct)
  760. if isTarget then
  761. triggerCount = triggerCount + 1
  762. return i1 == 0 or (i1 > 0 and triggerCount <= i1)
  763. else
  764. return isTarget
  765. end
  766. end)
  767. end,
  768. --免疫[a]持续伤害状态。
  769. --a[持续伤害类型]
  770. [46] = function(role, args)
  771. local dt = args[1]
  772. role.buffFilter:Add(function(buff)
  773. return buff.type == BuffName.DOT and (dt == 0 or buff.damageType == dt)
  774. end)
  775. end,
  776. --战斗中,[c]改变[a]属性[b]。
  777. --a[属性],b[float],c[改变类型]
  778. [47] = function(role, args)
  779. local pro = args[1]
  780. local f1 = args[2]
  781. local ct = args[3]
  782. if ct == 1 then --加算
  783. role.data:AddValue(BattlePropList[pro], f1)
  784. elseif ct == 2 then --乘加算(百分比属性加算)
  785. role.data:AddPencentValue(BattlePropList[pro], f1)
  786. elseif ct == 3 then --减算
  787. role.data:SubValue(BattlePropList[pro], f1)
  788. elseif ct == 4 then --乘减算(百分比属性减算)
  789. role.data:SubPencentValue(BattlePropList[pro], f1)
  790. end
  791. end,
  792. --战斗中,[c]改变[a]属性[b],[f]改变[d]属性[e]。
  793. --a[属性],b[float],c[改变类型],d[属性],e[float],f[改变类型]
  794. [48] = function(role, args)
  795. local pro = args[1]
  796. local f1 = args[2]
  797. local ct = args[3]
  798. local pro2 = args[4]
  799. local f2 = args[5]
  800. local ct2 = args[6]
  801. if ct == 1 then --加算
  802. role.data:AddValue(BattlePropList[pro], f1)
  803. elseif ct == 2 then --乘加算(百分比属性加算)
  804. role.data:AddPencentValue(BattlePropList[pro], f1)
  805. elseif ct == 3 then --减算
  806. role.data:SubValue(BattlePropList[pro], f1)
  807. elseif ct == 4 then --乘减算(百分比属性减算)
  808. role.data:SubPencentValue(BattlePropList[pro], f1)
  809. end
  810. if ct2 == 1 then --加算
  811. role.data:AddValue(BattlePropList[pro2], f2)
  812. elseif ct2 == 2 then --乘加算(百分比属性加算)
  813. role.data:AddPencentValue(BattlePropList[pro2], f2)
  814. elseif ct2 == 3 then --减算
  815. role.data:SubValue(BattlePropList[pro2], f2)
  816. elseif ct2 == 4 then --乘减算(百分比属性减算)
  817. role.data:SubPencentValue(BattlePropList[pro2], f2)
  818. end
  819. end,
  820. --发动技能后,[a]概率[e]改变敌方全体[b]属性[c],持续[d]秒
  821. --a[float],b[属性],c[float],d[int],e[改变类型]
  822. [49] = function(role, args)
  823. local f1 = args[1]
  824. local pro = args[2]
  825. local f2 = args[3]
  826. local f3 = args[4]
  827. local ct = args[5]
  828. local OnSkillCastEnd = function(skill)
  829. BattleUtil.RandomAction(f1, function ()
  830. local arr = BattleUtil.ChooseTarget(role, 20000)
  831. for i=1, #arr do
  832. arr[i]:AddBuff(Buff.Create(role, BuffName.PropertyChange, f3, BattlePropList[pro], f2, ct))
  833. end
  834. end)
  835. end
  836. role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
  837. end,
  838. --战斗中,每[a]秒增加[b]%的异妖能量
  839. --a[int],b[float]
  840. [50] = function(role, args)
  841. local f1 = args[1]
  842. local f2 = args[2]
  843. local auraBuff = Buff.Create(role, BuffName.Aura, 0, function (r)
  844. --BattleLogic.AddMP(role.camp, f2 * 100)
  845. end)
  846. auraBuff.interval = f1
  847. BattleLogic.BuffMgr:AddBuff(role, auraBuff)
  848. end,
  849. --战斗中,初始拥有[a]%的异妖能量
  850. --a[float]
  851. [51] = function(role, args)
  852. local f1 = args[1]
  853. --BattleLogic.AddMP(role.camp, f1 * 100)
  854. end,
  855. --战斗中,队伍每损失[a]%的生命值,增加[b]%的异妖能量
  856. --a[float],b[float]
  857. [52] = function(role, args)
  858. local f1 = args[1]
  859. local f2 = args[2]
  860. local maxHp = 0
  861. local curHp = 0
  862. if f1 == 0 then
  863. return
  864. end
  865. local curHpGears = 0
  866. local arr = BattleUtil.ChooseTarget(role, 10000)
  867. for i=1, #arr do
  868. curHp = curHp + arr[i]:GetRoleData(RoleDataName.Hp)
  869. maxHp = maxHp + arr[i]:GetRoleData(RoleDataName.MaxHp)
  870. end
  871. local auraBuff = Buff.Create(role, BuffName.Aura, 0, function (r)
  872. local hp = 0
  873. for i=1, #arr do
  874. hp = hp + arr[i]:GetRoleData(RoleDataName.Hp)
  875. end
  876. if hp < curHp then
  877. local gears = floor((maxHp - hp) / (f1 * maxHp))
  878. if gears > curHpGears then
  879. --BattleLogic.AddMP(role.camp, f2 * (gears - curHpGears) * 100)
  880. curHpGears = gears
  881. end
  882. curHp = hp
  883. end
  884. end)
  885. auraBuff.interval = 0
  886. BattleLogic.BuffMgr:AddBuff(role, auraBuff)
  887. end,
  888. --战斗中,治疗技能有概率额外造成[a]%的治疗,概率等于自身暴击率。
  889. --a[float]
  890. [53] = function(role, args)
  891. local f1 = args[1]
  892. local OnPassiveTreating = function(treatingFunc)
  893. BattleUtil.RandomAction(role:GetRoleData(RoleDataName.Crit), function ()
  894. treatingFunc(f1, CountTypeName.AddPencent)
  895. end)
  896. end
  897. role.Event:AddEvent(BattleEventName.PassiveTreating, OnPassiveTreating)
  898. end,
  899. --受击后,有[a]的概率对攻击者造成眩晕,持续[b]秒。
  900. --a[float],b[int]
  901. [54] = function(role, args)
  902. local f1 = args[1]
  903. local f2 = args[2]
  904. local OnBeHit = function(atkRole, damage, bCrit, finalDmg, damageType)
  905. if atkRole.isTeam then
  906. return
  907. end
  908. BattleUtil.RandomControl(f1, 1, role, atkRole, f2)
  909. end
  910. role.Event:AddEvent(BattleEventName.RoleBeHit, OnBeHit)
  911. end,
  912. --造成伤害时,有[a]的概率立即造成攻击[b]%的伤害。
  913. --a[float],b[float]
  914. [55] = function(role, args)
  915. local f1 = args[1]
  916. local f2 = args[2]
  917. local lastTrigger = 0
  918. local OnDamage = function(defRole, damage, bCrit, finalDmg)
  919. lastTrigger = lastTrigger + 1
  920. if lastTrigger > 1 then --加入限定避免循环触发
  921. return
  922. end
  923. BattleUtil.RandomAction(f1, function ()
  924. local val = floor(BattleUtil.FP_Mul(role:GetRoleData(RoleDataName.Attack), f2))
  925. BattleUtil.ApplyDamage(nil, role, defRole, val)
  926. end)
  927. lastTrigger = 0
  928. end
  929. role.Event:AddEvent(BattleEventName.RoleHit, OnDamage)
  930. end,
  931. --造成暴击时,额外造成目标最大生命值[a]%的伤害。(目标最大生命值伤害总上限为施法者2.5倍攻击)
  932. --a[float]
  933. [56] = function(role, args)
  934. local f1 = args[1]
  935. local lastTrigger = 0
  936. local OnRoleCrit = function(defRole)
  937. lastTrigger = lastTrigger + 1
  938. if lastTrigger > 1 then --加入限定避免循环触发
  939. return
  940. end
  941. local ar1 = BattleUtil.FP_Mul(defRole:GetRoleData(RoleDataName.MaxHp), f1)
  942. local ar2 = BattleUtil.FP_Mul(role:GetRoleData(RoleDataName.Attack), 2.5)
  943. BattleUtil.ApplyDamage(nil, role, defRole, floor(min(ar1, ar2)))
  944. lastTrigger = 0
  945. end
  946. role.Event:AddEvent(BattleEventName.RoleCrit, OnRoleCrit)
  947. end,
  948. --发动技能时,若技能目标与自身发动的上一个技能目标相同,则增加[a]%的伤害,最多叠加[b]层。
  949. --a[float],b[int]
  950. [57] = function(role, args)
  951. local f1 = args[1]
  952. local i2 = args[2]
  953. local damageDic = {}
  954. local lastDamageDic = {}
  955. local OnSkillCastEnd = function(skill)
  956. for k in pairs(damageDic) do
  957. if lastDamageDic[k] then
  958. damageDic[k] = damageDic[k] + 1
  959. end
  960. end
  961. lastDamageDic = damageDic
  962. damageDic = {}
  963. end
  964. local OnPassiveDamaging = function(damagingFunc, defRole, damage)
  965. if lastDamageDic[defRole] then
  966. local layer = i2 == 0 and lastDamageDic[defRole] or min(i2, lastDamageDic[defRole])
  967. damagingFunc(-floor(f1 * layer * damage))
  968. damageDic[defRole] = lastDamageDic[defRole]
  969. else
  970. damageDic[defRole] = 1
  971. end
  972. end
  973. role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
  974. role.Event:AddEvent(BattleEventName.PassiveDamaging, OnPassiveDamaging)
  975. end,
  976. --发动技能后,每个敌方角色有[a]概率获得[b],每秒造成[c]%的[d]伤害,持续[e]秒。
  977. --a[float],b[持续伤害类型],c[float],d[伤害类型],e[int]
  978. [58] = function(role, args)
  979. local f1 = args[1]
  980. local d1 = args[2]
  981. local f2 = args[3]
  982. local dt = args[4]
  983. local f3 = args[5]
  984. local OnSkillCastEnd = function(skill)
  985. local arr = BattleUtil.ChooseTarget(role, 20000)
  986. for i=1, #arr do
  987. BattleUtil.RandomAction(f1, function ()--
  988. arr[i]:AddBuff(Buff.Create(role, BuffName.DOT, f3, 1, d1, dt, f2))
  989. end)
  990. end
  991. end
  992. role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
  993. end,
  994. --每隔[a]秒,抵挡一个负面状态。(控制 dot 减益)
  995. --a[int]
  996. [59] = function(role, args)
  997. local f1 = args[1]
  998. local count = 0
  999. role.buffFilter:Add(function(buff)
  1000. local b = buff.isDeBuff or buff.type == BuffName.DOT or buff.type == BuffName.Control
  1001. if b then
  1002. count = count + 1
  1003. end
  1004. return b and count <= 1
  1005. end)
  1006. local auraBuff = Buff.Create(role, BuffName.Aura, 0, function (r)
  1007. count = 0
  1008. end)
  1009. auraBuff.interval = f1
  1010. BattleLogic.BuffMgr:AddBuff(role, auraBuff)
  1011. end,
  1012. --我方生命最低的其他角色受到技能攻击后,自身[a]的概率对攻击者造成攻击[b]%的[c]伤害,并造成[d],持续[e]秒。若自身处于沉默或眩晕状态,则不会触发。播放攻击特效,特效时间[f]秒。
  1013. --a[float],b[float],c[伤害类型],d[控制状态],e[int],f[float]
  1014. [60] = function(role, args)
  1015. local f1 = args[1]
  1016. local f2 = args[2]
  1017. local dt = args[3]
  1018. local ct = args[4]
  1019. local f3 = args[5]
  1020. local f4 = args[6]
  1021. local triggerUid = {}
  1022. BattleLogic.Event:AddEvent(BattleEventName.RoleBeDamaged, function (defRole, atkRole, damage, bCrit, finalDmg, damageType, dotType)
  1023. if atkRole.isTeam or role:IsDead() or dotType then
  1024. return
  1025. end
  1026. if triggerUid[atkRole.uid] then --加入限定避免循环触发
  1027. return
  1028. end
  1029. if not BattleLogic.BuffMgr:HasBuff(role, BuffName.Control, function (buff) return buff.ctrlType == 1 or buff.ctrlType == 2 end) then
  1030. local arr = BattleUtil.ChooseTarget(role, 10110)
  1031. local target
  1032. if arr[1] then
  1033. if arr[1] == role and arr[2] then
  1034. target = arr[2]
  1035. else
  1036. target = arr[1]
  1037. end
  1038. end
  1039. if defRole == target then
  1040. BattleUtil.RandomAction(f1, function ()--
  1041. role.Event:DispatchEvent(BattleEventName.RoleViewBullet, f4, atkRole)
  1042. BattleLogic.WaitForTrigger(f4, function ()
  1043. triggerUid[atkRole.uid] = atkRole.uid
  1044. BattleUtil.CalDamage(nil, role, atkRole, dt, f2)
  1045. BattleUtil.RandomControl(1, ct, role, atkRole, f3)
  1046. triggerUid[atkRole.uid] = nil
  1047. end)
  1048. end)
  1049. end
  1050. end
  1051. end)
  1052. end,
  1053. --自身受到的非暴击伤害,可以转化[a]%的伤害为自身攻击,持续[b]秒。上限自身攻击的[c]%。
  1054. --a[float],b[int],c[float]
  1055. [61] = function(role, args)
  1056. local f1 = args[1]
  1057. local f2 = args[2]
  1058. local f3 = args[3]
  1059. local OnBeHit = function(atkRole, damage, bCrit, finalDmg, damageType)
  1060. if not bCrit then
  1061. local ar1 = BattleUtil.FP_Mul(role:GetRoleData(RoleDataName.Attack), f3)
  1062. local ar2 = BattleUtil.FP_Mul(damage, f1)
  1063. role:AddBuff(Buff.Create(role, BuffName.PropertyChange, f2, RoleDataName.Attack, floor(min(ar1, ar2)), 1))
  1064. end
  1065. end
  1066. role.Event:AddEvent(BattleEventName.RoleBeHit, OnBeHit)
  1067. end,
  1068. --发动技能后,有[a]的概率为自身及相邻加持[b][c]%的护盾,持续[d]秒。
  1069. --a[float],b[属性],c[float],d[int]
  1070. [62] = function(role, args)
  1071. local f1 = args[1]
  1072. local pro = args[2]
  1073. local f2 = args[3]
  1074. local f3 = args[4]
  1075. local OnSkillCastEnd = function(skill)
  1076. BattleUtil.RandomAction(f1, function ()
  1077. local list = RoleManager.GetNeighbor(role, 1)
  1078. for i=1, #list do
  1079. local val = floor(BattleUtil.FP_Mul(role:GetRoleData(BattlePropList[pro]), f2))
  1080. list[i]:AddBuff(Buff.Create(role, BuffName.Shield, f3, ShieldTypeName.NormalReduce, val, 0))
  1081. end
  1082. end)
  1083. end
  1084. role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
  1085. end,
  1086. --自身拥有护盾时,我方角色每次释放技能后,有[a]概率回复[b]%的[c]的治疗。
  1087. --a[float],b[float],c[属性]
  1088. [63] = function(role, args)
  1089. local f1 = args[1]
  1090. local f2 = args[2]
  1091. local pro1 = args[3]
  1092. BattleLogic.Event:AddEvent(BattleEventName.SkillCastEnd, function (skill)
  1093. if skill.owner.isTeam then
  1094. return
  1095. end
  1096. if skill.owner.camp == role.camp then
  1097. if BattleLogic.BuffMgr:HasBuff(role, BuffName.Shield, function (buff) return true end) then
  1098. BattleUtil.RandomAction(f1, function ()
  1099. local val = floor(BattleUtil.FP_Mul(role:GetRoleData(BattlePropList[pro1]), f2))
  1100. BattleUtil.CalTreat(role, skill.owner, val)
  1101. end)
  1102. end
  1103. end
  1104. end)
  1105. end,
  1106. --基于生命损失的百分比,受到的伤害降低[b]%。
  1107. --a[float]
  1108. [64] = function(role, args)
  1109. local f1 = args[1]
  1110. local OnPassiveDamaging = function(damagingFunc, atkRole, damage)
  1111. damagingFunc(floor(BattleUtil.FP_Mul(f1, damage,1-BattleUtil.GetHPPencent(role))))
  1112. end
  1113. role.Event:AddEvent(BattleEventName.PassiveBeDamaging, OnPassiveDamaging)
  1114. end,
  1115. --我方角色死亡时,对击杀者造成[a]%的[b]伤害,令其眩晕,持续[c]秒。
  1116. --a[float],b[伤害类型],c[int]
  1117. [65] = function(role, args)
  1118. local f1 = args[1]
  1119. local dt = args[2]
  1120. local f2 = args[3]
  1121. BattleLogic.Event:AddEvent(BattleEventName.BattleRoleDead, function (defRole, atkRole)
  1122. if role:IsDead() or atkRole.isTeam then
  1123. return
  1124. end
  1125. if defRole.camp == role.camp then
  1126. BattleUtil.CalDamage(nil, role, atkRole, dt, f1)
  1127. BattleUtil.RandomControl(1, ControlType.Dizzy, role, atkRole, f2)
  1128. end
  1129. end)
  1130. end,
  1131. --免疫减益状态。
  1132. --无
  1133. [66] = function(role, args)
  1134. role.buffFilter:Add(function(buff)
  1135. return buff.isDeBuff
  1136. end)
  1137. end,
  1138. --敌方累计发动[a]次技能,有[b]概率发动(发动特效),对敌方全体造成眩晕效果,持续[c]秒。然后清空累计次数。播放攻击特效,特效时间[d]秒。
  1139. --a[int],b[float],c[float]
  1140. [67] = function(role, args)
  1141. local i1 = args[1]
  1142. local f1 = args[2]
  1143. local f2 = args[3]
  1144. local f3 = args[4]
  1145. local count = 0
  1146. BattleLogic.Event:AddEvent(BattleEventName.SkillCast, function (skill)
  1147. if skill.owner.isTeam or role:IsDead() then
  1148. return
  1149. end
  1150. if skill.owner.camp ~= role.camp then
  1151. count = count + 1
  1152. if count == i1 then
  1153. BattleUtil.RandomAction(f1, function ()--
  1154. role.Event:DispatchEvent(BattleEventName.AOE, 1-role.camp)
  1155. BattleLogic.WaitForTrigger(f3, function ()
  1156. local arr = BattleUtil.ChooseTarget(role, 20000)
  1157. for i=1, #arr do
  1158. BattleUtil.RandomControl(1, ControlType.Dizzy, role, arr[i], f2)
  1159. end
  1160. end)
  1161. end)
  1162. count = 0
  1163. end
  1164. end
  1165. end)
  1166. end,
  1167. --受到伤害后,[a]概率为自身施加[b]的[c]%的护盾。持续[d]秒。
  1168. --a[float],b[属性],c[float],d[int]
  1169. [68] = function(role, args)
  1170. local f1 = args[1]
  1171. local pro1 = args[2]
  1172. local f2 = args[3]
  1173. local f3 = args[4]
  1174. local OnBeHit = function(atkRole, damage, bCrit, finalDmg, damageType)
  1175. BattleUtil.RandomAction(f1, function ()
  1176. local val = floor(BattleUtil.FP_Mul(role:GetRoleData(BattlePropList[pro1]), f2))
  1177. role:AddBuff(Buff.Create(role, BuffName.Shield, f3, ShieldTypeName.NormalReduce, val, 0))
  1178. end)
  1179. end
  1180. role.Event:AddEvent(BattleEventName.RoleBeHit, OnBeHit)
  1181. end,
  1182. --造成暴击时,额外造成目标最大生命值[a]%的伤害。造成伤害时,有[a]的概率立即造成攻击[b]%的伤害,该伤害造成的暴击伤害不会触发额外最大生命值伤害。(效果55+效果56)(目标最大生命值伤害总上限为施法者5倍攻击)
  1183. --a[float],b[float],c[float]
  1184. [69] = function(role, args)
  1185. local f1 = args[1]
  1186. local f2 = args[2]
  1187. local f3 = args[3]
  1188. local lastTrigger = 0
  1189. local OnDamage = function(defRole, damage, bCrit, finalDmg)
  1190. lastTrigger = lastTrigger + 1
  1191. if lastTrigger > 1 then --加入限定避免循环触发
  1192. return
  1193. end
  1194. if bCrit then
  1195. local ar1 = BattleUtil.FP_Mul(defRole:GetRoleData(RoleDataName.MaxHp), f1)
  1196. local ar2 = BattleUtil.FP_Mul(role:GetRoleData(RoleDataName.Attack), 5)
  1197. BattleUtil.ApplyDamage(nil, role, defRole, floor(min(ar1, ar2)))
  1198. else
  1199. BattleUtil.RandomAction(f2, function ()
  1200. local val = floor(BattleUtil.FP_Mul(role:GetRoleData(RoleDataName.Attack), f3))
  1201. BattleUtil.ApplyDamage(nil, role, defRole, val)
  1202. end)
  1203. end
  1204. lastTrigger = 0
  1205. end
  1206. role.Event:AddEvent(BattleEventName.RoleDamage, OnDamage)
  1207. end,
  1208. --击杀每个敌人会永久增加[a]%的[b],持续[c]秒。(0表示永久)(不可驱散)
  1209. --a[float],b[属性],c[int]
  1210. [70] = function(role, args)
  1211. local f1 = args[1]
  1212. local pro = args[2]
  1213. local f2 = args[3]
  1214. local OnKill = function(defRole)
  1215. local buff = Buff.Create(role, BuffName.PropertyChange, f2, BattlePropList[pro], f1, 2)
  1216. buff.cover = true
  1217. buff.clear = false
  1218. role:AddBuff(buff)
  1219. end
  1220. role.Event:AddEvent(BattleEventName.RoleKill, OnKill)
  1221. end,
  1222. --受击后,[a]对攻击者造成自身[c]%的[d]伤害。
  1223. --a[float],c[float],d[伤害类型]
  1224. [71] = function(role, args)
  1225. local f1 = args[1]
  1226. local f2 = args[2]
  1227. local dt = args[3]
  1228. local lastTrigger = 0
  1229. local OnBeHit = function(atkRole, damage, bCrit, finalDmg, damageType)
  1230. if atkRole.isTeam then
  1231. return
  1232. end
  1233. lastTrigger = lastTrigger + 1
  1234. if lastTrigger > 1 then --加入限定避免循环触发
  1235. return
  1236. end
  1237. BattleUtil.RandomAction(f1, function ()
  1238. BattleUtil.CalDamage(nil, role, atkRole, dt, f2)
  1239. end)
  1240. lastTrigger = 0
  1241. end
  1242. role.Event:AddEvent(BattleEventName.RoleBeHit, OnBeHit)
  1243. end,
  1244. --造成的伤害暴击时,有[a]概率在计算伤害时额外计算[b]的暴击伤害。
  1245. --a[float],b[float]
  1246. [72] = function(role, args)
  1247. local f1 = args[1]
  1248. local f2 = args[2]
  1249. local OnPassiveCriting = function(crit)
  1250. BattleUtil.RandomAction(f1, function ()
  1251. crit(role:GetRoleData(RoleDataName.CritDamageFactor)+f2)
  1252. end)
  1253. end
  1254. role.Event:AddEvent(BattleEventName.PassiveCriting, OnPassiveCriting)
  1255. end,
  1256. --释放技能时,自己损失[a]%当前生命值,为此次技能增加等量伤害。
  1257. --a[float]
  1258. [73] = function(role, args)
  1259. local f1 = args[1]
  1260. local hp=0
  1261. local OnPassiveDamaging = function(damagingFunc, defRole, damage)
  1262. damagingFunc(-hp)
  1263. end
  1264. local OnSkillCast, OnSkillCastEnd
  1265. OnSkillCast = function(skill)
  1266. hp = floor(BattleUtil.FP_Mul(role:GetRoleData(RoleDataName.Hp), f1))
  1267. role.data:SubValue(RoleDataName.Hp, hp)
  1268. role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
  1269. role.Event:AddEvent(BattleEventName.PassiveDamaging, OnPassiveDamaging)
  1270. end
  1271. OnSkillCastEnd = function(skill)
  1272. BattleLogic.WaitForTrigger(BattleLogic.GameDeltaTime, function () --延迟一帧移除事件,防止触发帧和结束帧为同一帧时,被动未移除
  1273. role.Event:RemoveEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
  1274. role.Event:RemoveEvent(BattleEventName.PassiveDamaging, OnPassiveDamaging)
  1275. end)
  1276. end
  1277. role.Event:AddEvent(BattleEventName.SkillCast, OnSkillCast)
  1278. end,
  1279. --死亡时,为所有我方角色增加[a]%的[b]属性,持续[c]秒。
  1280. --a[float],b[属性],c[int]
  1281. [74] = function(role, args)
  1282. local f1 = args[1]
  1283. local pro = args[2]
  1284. local f2 = args[3]
  1285. local OnDead = function(atkRole)
  1286. local arr = BattleUtil.ChooseTarget(role, 10000)
  1287. for i=1, #arr do
  1288. arr[i]:AddBuff(Buff.Create(role, BuffName.PropertyChange, f2, BattlePropList[pro], f1, 2))
  1289. end
  1290. end
  1291. role.Event:AddEvent(BattleEventName.RoleDead, OnDead)
  1292. end,
  1293. --boss每受到([a]*印记层数)点伤害,为自身永久增加一层印记,每层印记为自身增加[b]点攻击,[c]点护甲和[d]点魔抗。【不可驱散】
  1294. --a[int],b[int],c[int],d[int]
  1295. [75] = function(role, args)
  1296. local i1 = args[1]
  1297. local i2 = args[2]
  1298. local i3 = args[3]
  1299. local i4 = args[4]
  1300. if i1 <= 0 then return end --防止死循环
  1301. local total = 0
  1302. local layer = 0
  1303. local OnBeDamaged = function(atkRole, damage, bCrit, finalDmg, damageType)
  1304. total = total + damage
  1305. local count = 0
  1306. while total >= i1 * layer do
  1307. total = total - i1 * layer
  1308. layer = layer + 1
  1309. count = count + 1
  1310. end
  1311. if count > 0 then
  1312. local buff1 = Buff.Create(role, BuffName.PropertyChange, 0, BattlePropList[1], i2 * count, 1)
  1313. buff1.cover = true
  1314. buff1.layer = count
  1315. buff1.clear = false
  1316. local buff2 = Buff.Create(role, BuffName.PropertyChange, 0, BattlePropList[2], i3 * count, 1)
  1317. buff2.cover = true
  1318. buff2.layer = count
  1319. buff2.clear = false
  1320. local buff3 = Buff.Create(role, BuffName.PropertyChange, 0, BattlePropList[3], i4 * count, 1)
  1321. buff3.cover = true
  1322. buff3.layer = count
  1323. buff3.clear = false
  1324. role:AddBuff(buff1)
  1325. role:AddBuff(buff2)
  1326. role:AddBuff(buff3)
  1327. end
  1328. end
  1329. role.Event:AddEvent(BattleEventName.RoleBeDamaged, OnBeDamaged)
  1330. end,
  1331. --战斗中,若自己是[a],[d]改变[b]属性[c]。
  1332. --a[职业],b[属性],c[float],d[改变类型]
  1333. [76] = function(role, args)
  1334. local i1 = args[1]
  1335. local pro = args[2]
  1336. local f1 = args[3]
  1337. local ct = args[4]
  1338. if role.roleData.professionId == i1 then
  1339. if ct == 1 then --加算
  1340. role.data:AddValue(BattlePropList[pro], f1)
  1341. elseif ct == 2 then --乘加算(百分比属性加算)
  1342. role.data:AddPencentValue(BattlePropList[pro], f1)
  1343. elseif ct == 3 then --减算
  1344. role.data:SubValue(BattlePropList[pro], f1)
  1345. elseif ct == 4 then --乘减算(百分比属性减算)
  1346. role.data:SubPencentValue(BattlePropList[pro], f1)
  1347. end
  1348. end
  1349. end,
  1350. --战斗开始时,为自身施加[a]*[b]的护盾,持续[c]秒(0为无限)。
  1351. --a[属性],b[float],c[int]
  1352. [77] = function(role, args)
  1353. local pro1 = args[1]
  1354. local f1 = args[2]
  1355. local f2 = args[3]
  1356. local val = floor(BattleUtil.FP_Mul(f1, role:GetRoleData(BattlePropList[pro1])))
  1357. role:AddBuff(Buff.Create(role, BuffName.Shield, f2, ShieldTypeName.NormalReduce, val, 0))
  1358. end,
  1359. --战斗开始时,为自身回复[a]*[b]的血量。
  1360. --a[属性],b[float]
  1361. [78] = function(role, args)
  1362. local pro = args[1]
  1363. local f1 = args[2]
  1364. local val = floor(BattleUtil.FP_Mul(f1, role:GetRoleData(BattlePropList[pro])))
  1365. BattleUtil.CalTreat(role, role, val)
  1366. end,
  1367. --战斗结束时,为自身回复[a]*[b]的血量。
  1368. --a[属性],b[float]
  1369. [79] = function(role, args)
  1370. local pro = args[1]
  1371. local f1 = args[2]
  1372. local OnEnd = function(order)
  1373. if order == BattleLogic.TotalOrder then
  1374. local val = floor(BattleUtil.FP_Mul(f1, role:GetRoleData(BattlePropList[pro])))
  1375. BattleUtil.CalTreat(role, role, val)
  1376. end
  1377. end
  1378. BattleLogic.Event:AddEvent(BattleEventName.BattleOrderEnd, OnEnd)
  1379. end,
  1380. --战斗中,若自己是[a],[d]改变[b]属性[c]。-- 2020/3/6 高鑫
  1381. --a[元素],b[属性],c[float],d[改变类型]
  1382. [80] = function(role, args)
  1383. local i1 = args[1]
  1384. local pro = args[2]
  1385. local f1 = args[3]
  1386. local ct = args[4]
  1387. if role.roleData.element == i1 then
  1388. if ct == 1 then --加算
  1389. role.data:AddValue(BattlePropList[pro], f1)
  1390. elseif ct == 2 then --乘加算(百分比属性加算)
  1391. role.data:AddPencentValue(BattlePropList[pro], f1)
  1392. elseif ct == 3 then --减算
  1393. role.data:SubValue(BattlePropList[pro], f1)
  1394. elseif ct == 4 then --乘减算(百分比属性减算)
  1395. role.data:SubPencentValue(BattlePropList[pro], f1)
  1396. end
  1397. end
  1398. end,
  1399. -- [a]增加[b], [c]改变
  1400. -- a[属性]b[float]
  1401. [90] = function(role, args)
  1402. local pro = args[1]
  1403. local f1 = args[2]
  1404. local ct = args[3]
  1405. role.data:CountValue(BattlePropList[pro], f1, ct)
  1406. end,
  1407. -- 技能伤害增加[a]%,[b]改变
  1408. -- a[float]b[改变类型]
  1409. [91] = function(role, args)
  1410. local f1 = args[1]
  1411. local ct = args[2]
  1412. local passivityDamaging = function(func, caster, damage)
  1413. if func then
  1414. local dd = BattleUtil.CountValue(damage, f1, ct) - damage
  1415. func(-floor(BattleUtil.ErrorCorrection(dd)))
  1416. end
  1417. end
  1418. local OnSkillCast = function(skill)
  1419. if skill.type == BattleSkillType.Special then
  1420. role.Event:AddEvent(BattleEventName.PassiveDamaging, passivityDamaging)
  1421. end
  1422. end
  1423. local OnSkillCastEnd = function(skill)
  1424. if skill.type == BattleSkillType.Special then
  1425. role.Event:RemoveEvent(BattleEventName.PassiveDamaging, passivityDamaging)
  1426. end
  1427. end
  1428. role.Event:AddEvent(BattleEventName.SkillCast, OnSkillCast)
  1429. role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
  1430. end,
  1431. -- (直接伤害(目前没有明确定义直接伤害))直接伤害击杀目标自身增加[a]点怒气
  1432. -- a[int]
  1433. [92] = function(role, args)
  1434. local i1 = args[1]
  1435. local OnRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill)
  1436. -- local buff = Buff.Create(role, BuffName.PropertyChange, 0, BattlePropList[pro], i1, 1)
  1437. -- buff.cover = true -- 可以叠加
  1438. -- buff.clear = false -- 不可驱散
  1439. -- role:AddBuff(buff)
  1440. if skill and not skill.isAdd and defRole:IsDead() and BattleUtil.CheckIsNoDead(defRole) then
  1441. role:AddRage(i1, CountTypeName.Add)
  1442. end
  1443. end
  1444. role.Event:AddEvent(BattleEventName.RoleHit, OnRoleHit)
  1445. end,
  1446. -- 技能治疗量增加[a]
  1447. -- a[float]
  1448. [93] = function(role, args)
  1449. local f1 = args[1]
  1450. local passiveTreating = function(func, caster)
  1451. if func then func(f1, CountTypeName.AddPencent) end
  1452. end
  1453. local OnSkillCast = function(skill)
  1454. if skill.type == BattleSkillType.Special then
  1455. role.Event:AddEvent(BattleEventName.PassiveTreating, passiveTreating)
  1456. end
  1457. end
  1458. local OnSkillCastEnd = function(skill)
  1459. if skill.type == BattleSkillType.Special then
  1460. role.Event:RemoveEvent(BattleEventName.PassiveTreating, passiveTreating)
  1461. end
  1462. end
  1463. role.Event:AddEvent(BattleEventName.SkillCast, OnSkillCast)
  1464. role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
  1465. end,
  1466. -- 全体上阵武将增加[a][b] [c]改变
  1467. -- a[float]b[属性]c[改变类型]
  1468. [94] = function(role, args)
  1469. local f1 = args[1]
  1470. local pro = args[2]
  1471. local ct = args[3]
  1472. local list = RoleManager.Query(function(v) return role.camp == v.camp end)
  1473. for _, r in pairs(list) do
  1474. r.data:CountValue(BattlePropList[pro], f1, ct)
  1475. end
  1476. end,
  1477. -- 行动后增加[a]点怒气
  1478. -- a[int]
  1479. [95] = function(role, args)
  1480. local i1 = args[1]
  1481. -- 行动结束后
  1482. local onTurnEnd = function()
  1483. role:AddRage(i1, CountTypeName.Add)
  1484. end
  1485. role.Event:AddEvent(BattleEventName.RoleTurnEnd, onTurnEnd)
  1486. end,
  1487. -- 普攻伤害增加[a]%[b]改变
  1488. -- a[float]b[改变类型]
  1489. [96] = function(role, args)
  1490. local f1 = args[1]
  1491. local ct = args[2]
  1492. local passivityDamaging = function(func, caster, damage)
  1493. if func then
  1494. local dd = BattleUtil.CountValue(damage, f1, ct) - damage
  1495. func(-floor(BattleUtil.ErrorCorrection(dd)))
  1496. end
  1497. end
  1498. local OnSkillCast = function(skill)
  1499. if skill.type == BattleSkillType.Normal then
  1500. role.Event:AddEvent(BattleEventName.PassiveDamaging, passivityDamaging)
  1501. end
  1502. end
  1503. local OnSkillCastEnd = function(skill)
  1504. if skill.type == BattleSkillType.Normal then
  1505. role.Event:RemoveEvent(BattleEventName.PassiveDamaging, passivityDamaging)
  1506. end
  1507. end
  1508. role.Event:AddEvent(BattleEventName.SkillCast, OnSkillCast)
  1509. role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
  1510. end,
  1511. -- 释放技能有[a]%对全体造成[c]%[d]伤害
  1512. -- a[float]b[int]c[float]d[伤害类型]
  1513. [97] = function(role, args)
  1514. local f1 = args[1]
  1515. local f2 = args[2]
  1516. local dt = args[3]
  1517. -- 释放技能后
  1518. local onSkillEnd = function(skill)
  1519. if skill and skill.type == BattleSkillType.Special then
  1520. BattleUtil.RandomAction(f1, function()
  1521. BattleLogic.WaitForTrigger(0.1, function()
  1522. local list = RoleManager.Query(function(v)
  1523. return v.camp == (role.camp + 1) % 2
  1524. end)
  1525. for _, r in ipairs(list) do
  1526. BattleUtil.CalDamage(nil, role, r, dt, f2)
  1527. end
  1528. end)
  1529. end)
  1530. end
  1531. end
  1532. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd)
  1533. end,
  1534. -- 释放技能[a]概率不消耗怒气
  1535. -- a[float]
  1536. [98] = function(role, args)
  1537. local f1 = args[1]
  1538. local onRageCost = function(noCostRate, costRage, func)
  1539. local dRate = f1
  1540. local dCost = 0
  1541. if func then func(dRate, dCost) end
  1542. end
  1543. role.Event:AddEvent(BattleEventName.RoleRageCost, onRageCost)
  1544. end,
  1545. -- 技能直接伤害的[a]%治疗友方生命最少队友。
  1546. -- a[float]
  1547. [99] = function(role, args)
  1548. local f1 = args[1]
  1549. local allDamage = 0
  1550. local OnHit = function(atkRole, damage, bCrit, finalDmg, damageType, skill)
  1551. if skill and skill.type == BattleSkillType.Special then
  1552. allDamage = allDamage + finalDmg
  1553. end
  1554. end
  1555. local function onSkillCast(skill)
  1556. if skill.type == BattleSkillType.Special then
  1557. allDamage = 0
  1558. role.Event:AddEvent(BattleEventName.RoleHit, OnHit)
  1559. end
  1560. end
  1561. local function onSkillCastEnd(skill)
  1562. if skill.type == BattleSkillType.Special then
  1563. role.Event:RemoveEvent(BattleEventName.RoleHit, OnHit)
  1564. local arr = RoleManager.Query(function (r) return r.camp == role.camp end)
  1565. BattleUtil.SortByHpFactor(arr, 1)
  1566. -- 检测技能伤害治疗加成
  1567. local f = BattleUtil.CheckSkillDamageHeal(f1, role, arr[1])
  1568. -- 治疗血量最低队友实际伤害的f1%
  1569. BattleUtil.ApplyTreat(role, arr[1], floor(BattleUtil.ErrorCorrection(allDamage*f)))
  1570. -- 清空伤害记录
  1571. allDamage = 0
  1572. end
  1573. end
  1574. role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
  1575. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillCastEnd)
  1576. end,
  1577. -- 释放技能不消耗怒气几率[a]改变[b]%
  1578. -- a[改变类型]b[float]
  1579. [100] = function(role, args)
  1580. local ct = args[1]
  1581. local f1 = args[2]
  1582. local onRageCost = function(noCostRate, costRage, func)
  1583. local dRate = BattleUtil.CountValue(noCostRate, f1, ct) - noCostRate
  1584. dRate = BattleUtil.ErrorCorrection(dRate)
  1585. local dCost = 0
  1586. if func then func(dRate, dCost) end
  1587. end
  1588. role.Event:AddEvent(BattleEventName.RoleRageCost, onRageCost)
  1589. end,
  1590. -- 释放技能技能[a]概率[b]改变[c]%
  1591. -- a[控制状态]b[改变类型]c[float]
  1592. [101] = function(role, args)
  1593. local ctl = args[1]
  1594. local ct = args[2]
  1595. local f1 = args[3]
  1596. local onSkillControl = function(func, ctrl)
  1597. if ctrl == ctl then
  1598. if func then func(f1, ct) end
  1599. end
  1600. end
  1601. local onSkillCast = function(skill)
  1602. if skill.type == BattleSkillType.Special then
  1603. role.Event:AddEvent(BattleEventName.PassiveRandomControl, onSkillControl)
  1604. end
  1605. end
  1606. local onSkillCastEnd = function(skill)
  1607. if skill.type == BattleSkillType.Special then
  1608. role.Event:RemoveEvent(BattleEventName.PassiveRandomControl, onSkillControl)
  1609. end
  1610. end
  1611. role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
  1612. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillCastEnd)
  1613. end,
  1614. -- 释放技能后追加[a]次普攻
  1615. -- a[int]
  1616. [102] = function(role, args)
  1617. local i1 = args[1]
  1618. -- 释放技能后
  1619. local onSkillEnd = function(skill)
  1620. if skill.type == BattleSkillType.Special then
  1621. for i = 1, i1 do
  1622. role:AddSkill(BattleSkillType.Normal, false, true, nil)
  1623. end
  1624. end
  1625. end
  1626. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd)
  1627. end,
  1628. -- 直接伤害每次击杀目标增加[a]%的[b]可叠加持续至战斗结束[c]改变
  1629. -- a[float]b[属性]c[改变类型]
  1630. [103] = function(role, args)
  1631. local f1 = args[1]
  1632. local pro = args[2]
  1633. local ct = args[3]
  1634. -- 释放技能后
  1635. local onRoleHit = function(defRole)
  1636. if defRole:IsDead() and BattleUtil.CheckIsNoDead(defRole) then
  1637. local buff = Buff.Create(role, BuffName.PropertyChange, 0, BattlePropList[pro], f1, ct)
  1638. -- buff.cover = true
  1639. role:AddBuff(buff)
  1640. end
  1641. end
  1642. role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit)
  1643. end,
  1644. -- 释放技能后给除自己外己方生命最少的武将附加无敌盾持续[b]回合(只剩自己则不加)
  1645. --b[属性]
  1646. [104] = function(role, args)
  1647. local i1 = args[1]
  1648. -- 释放技能后
  1649. local onSkillEnd = function(skill)
  1650. if skill.type == BattleSkillType.Special then
  1651. local list = RoleManager.Query(function(v) return v.camp == role.camp end)
  1652. BattleUtil.SortByHpFactor(list, 1)
  1653. local target = nil
  1654. for i = 1, #list do
  1655. if not list[i]:IsRealDead() and list[i] ~= role then
  1656. target = list[i]
  1657. break
  1658. end
  1659. end
  1660. if target then
  1661. target:AddBuff(Buff.Create(role, BuffName.Shield, i1, ShieldTypeName.AllReduce, 0, 0))
  1662. end
  1663. end
  1664. end
  1665. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd)
  1666. end,
  1667. -- 释放技能后增加友方全体[a]点怒气
  1668. -- a[int]
  1669. [105] = function(role, args)
  1670. local i1 = args[1]
  1671. -- 释放技能后
  1672. local onSkillEnd = function(skill)
  1673. if skill.type == BattleSkillType.Special then
  1674. local list = RoleManager.Query(function(v) return v.camp == role.camp end)
  1675. for i = 1, #list do
  1676. local r = list[i]
  1677. r:AddRage(i1, CountTypeName.Add)
  1678. end
  1679. end
  1680. end
  1681. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd)
  1682. end,
  1683. -- 受到直接伤害[a]%治疗友方[b]最少[c]个单位
  1684. -- a[float]b[属性]c[int]
  1685. [106] = function(role, args)
  1686. local f1 = args[1]
  1687. local pro = args[2]
  1688. local i1 = args[3]
  1689. local onBeHit = function(caster, damage)
  1690. local list = RoleManager.Query(function(v) return v.camp == role.camp end)
  1691. list = BattleUtil.SortByProp(list, BattlePropList[pro], 1)
  1692. for i = 1, i1 do
  1693. local r = list[i]
  1694. if r and not r:IsRealDead() then
  1695. local treatValue = floor(BattleUtil.ErrorCorrection(f1 * damage))
  1696. BattleUtil.ApplyTreat(role, r, treatValue)
  1697. end
  1698. end
  1699. end
  1700. role.Event:AddEvent(BattleEventName.RoleBeHit, onBeHit)
  1701. end,
  1702. -- 释放技能后自身回[a]点怒气
  1703. -- a[int]
  1704. [107] = function(role, args)
  1705. local i1 = args[1]
  1706. -- 释放技能后
  1707. local onSkillEnd = function(skill)
  1708. if skill.type == BattleSkillType.Special then
  1709. role:AddRage(i1, CountTypeName.Add)
  1710. end
  1711. end
  1712. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd)
  1713. end,
  1714. -- 受到技能或普攻直接伤害的[a]%反弹给攻击者
  1715. -- a[float]
  1716. [108] = function(role, args)
  1717. local f1 = args[1]
  1718. local onBeHit = function(caster, damage, bCrit, finalDmg, damageType, skill)
  1719. if skill then --技能造成的直接伤害
  1720. local rDamage = f1 * damage
  1721. -- 计算被动技能额外加乘
  1722. local cl = {}
  1723. local function _CallBack(v, ct)
  1724. if v then
  1725. table.insert(cl, {v, ct})
  1726. end
  1727. end
  1728. role.Event:DispatchEvent(BattleEventName.PassiveRebackDamage, _CallBack)
  1729. caster.Event:DispatchEvent(BattleEventName.PassiveBeRebackDamage, _CallBack)
  1730. rDamage = floor(BattleUtil.ErrorCorrection(BattleUtil.CountChangeList(rDamage, cl)))
  1731. if rDamage ~= 0 then
  1732. BattleUtil.ApplyDamage(nil, role, caster, rDamage)
  1733. end
  1734. end
  1735. end
  1736. role.Event:AddEvent(BattleEventName.RoleBeHit, onBeHit)
  1737. end,
  1738. -- 受到普通攻击或直接伤害时回复自身[a]点怒气
  1739. -- a[int]
  1740. [109] = function(role, args)
  1741. local i1 = args[1]
  1742. local onBeSkillCastEnd = function(skill)
  1743. if skill.type == BattleSkillType.Normal then
  1744. role:AddRage(i1, CountTypeName.Add)
  1745. end
  1746. end
  1747. role.Event:AddEvent(BattleEventName.BeSkillCastEnd, onBeSkillCastEnd)
  1748. end,
  1749. -- 释放技能后降低目标[a]点怒气
  1750. -- a[int]
  1751. [110] = function(role, args)
  1752. local i1 = args[1]
  1753. -- 释放技能后
  1754. local onSkillEnd = function(skill)
  1755. if skill.type == BattleSkillType.Special then
  1756. local list = skill:GetDirectTargetsNoMiss()
  1757. if list then
  1758. for i = 1, #list do
  1759. list[i]:AddRage(i1, CountTypeName.Sub)
  1760. end
  1761. end
  1762. end
  1763. end
  1764. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd)
  1765. end,
  1766. -- 被击杀时[a]%概率[b]敌方武将[c]回合
  1767. -- a[float]b[控制状态]c[int]
  1768. [111] = function(role, args)
  1769. local f1 = args[1]
  1770. local ctl = args[2]
  1771. local i1 = args[3]
  1772. local onRoleBeDamaged = function(caster, damage, bCrit, finalDmg, damageType, dotType, skill)
  1773. if role:IsDead() and skill then
  1774. BattleUtil.RandomControl(f1, ctl, role, caster, i1)
  1775. end
  1776. end
  1777. role.Event:AddEvent(BattleEventName.RoleBeDamaged, onRoleBeDamaged)
  1778. end,
  1779. -- 战斗第[a]回合造成伤害必定暴击
  1780. -- a[int]
  1781. [112] = function(role, args)
  1782. local i1 = args[1]
  1783. local function onRoleDamageAfter(target)
  1784. target.isFlagCrit = false
  1785. role.Event:RemoveEvent(BattleEventName.RoleDamageAfter, onRoleDamageAfter)
  1786. end
  1787. local function onRoleDamageBefore(target)
  1788. if BattleLogic.GetCurRound() == i1 then
  1789. target.isFlagCrit = true
  1790. role.Event:AddEvent(BattleEventName.RoleDamageAfter, onRoleDamageAfter)
  1791. end
  1792. end
  1793. role.Event:AddEvent(BattleEventName.RoleDamageBefore, onRoleDamageBefore)
  1794. end,
  1795. -- 追加的普攻[a]%概率暴击
  1796. -- a[float]
  1797. [113] = function(role, args)
  1798. local f1 = args[1]
  1799. local function onSkillCast(skill)
  1800. if skill.type == BattleSkillType.Normal and skill.isAdd then
  1801. role.data:AddValue(RoleDataName.Crit, f1)
  1802. end
  1803. end
  1804. role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
  1805. local function onSkillCastEnd(skill)
  1806. if skill.type == BattleSkillType.Normal and skill.isAdd then
  1807. role.data:SubValue(RoleDataName.Crit, f1)
  1808. end
  1809. end
  1810. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillCastEnd)
  1811. end,
  1812. -- 直接伤害击杀目标后追加[a]次普攻
  1813. -- a[int]
  1814. [114] = function(role, args)
  1815. local i1 = args[1]
  1816. -- 释放技能后
  1817. local onRoleHit = function(target)
  1818. -- LogError("target "..target.roleId .. " ".. target.star)
  1819. if target:IsDead() and BattleUtil.CheckIsNoDead(target) then
  1820. for i = 1, i1 do
  1821. role:AddSkill(BattleSkillType.Normal, false, true, nil)
  1822. end
  1823. end
  1824. end
  1825. role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit)
  1826. end,
  1827. -- 战斗第[a]回合增加[c]%的自身伤害持续[e]回合,[f]改变
  1828. -- a[int]c[float]e[int]f[改变]
  1829. [115] = function(role, args)
  1830. local i1 = args[1]
  1831. local f1 = args[2]
  1832. local i2 = args[3] or 1
  1833. local ct = args[4]
  1834. -- 如果是技能的伤害则判断加成
  1835. local onPassiveDamaging = function(func, target, damage, skill)
  1836. if skill then
  1837. local dd = BattleUtil.CountValue(damage, f1, ct) - damage
  1838. if func then func(-floor(BattleUtil.ErrorCorrection(dd))) end
  1839. end
  1840. end
  1841. BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, function(curRound)
  1842. -- 第i1回合开始
  1843. if curRound == i1 then
  1844. role.Event:AddEvent(BattleEventName.PassiveDamaging, onPassiveDamaging)
  1845. end
  1846. -- 第i1+i2回合结束
  1847. if curRound == i1 + i2 then
  1848. role.Event:RemoveEvent(BattleEventName.PassiveDamaging, onPassiveDamaging)
  1849. end
  1850. end)
  1851. end,
  1852. -- 直接伤害击杀目标回复自身[a]%的[b]
  1853. -- a[float]
  1854. [116] = function(role, args)
  1855. local f1 = args[1]
  1856. -- 释放技能后
  1857. local onRoleHit = function(target)
  1858. if target:IsDead() and BattleUtil.CheckIsNoDead(target) then
  1859. local treat = floor(BattleUtil.FP_Mul(role:GetRoleData(RoleDataName.MaxHp), f1))
  1860. BattleUtil.CalTreat(role, role, treat)
  1861. end
  1862. end
  1863. role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit)
  1864. end,
  1865. -- 技能目标每[a]改变[b]个,技能伤害增加[c]%,[d]改变
  1866. -- a[改变类型]b[int]c[float]d[改变类型]
  1867. [117] = function(role, args)
  1868. local ct = args[1] -- 对方阵营中死亡数量(目前没有用到)
  1869. local i1 = args[2]
  1870. local f1 = args[3]
  1871. local ct2 = args[4]
  1872. -- 每次释放技能时提前计算额外加成的伤害
  1873. local extra = 0
  1874. local onSkillCast = function(skill)
  1875. extra = 0
  1876. if skill and skill.type == BattleSkillType.Special then
  1877. -- local roleList =RoleManager.Query(function (r) return r.camp ~= role.camp end)
  1878. -- local deadNum = 6 - #roleList
  1879. -- local level = math.floor(deadNum/i1)
  1880. -- extra = BattleUtil.ErrorCorrection(level * f1)
  1881. -- 改变值 = 技能最大目标数 - 当前目标数
  1882. local maxNum = skill:GetMaxTargetNum()
  1883. local curNum = #skill:GetDirectTargets()
  1884. local lessNum = max(maxNum - curNum, 0)
  1885. local level = math.floor(lessNum/i1)
  1886. extra = BattleUtil.ErrorCorrection(level * f1)
  1887. end
  1888. end
  1889. role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
  1890. -- 如果是技能的伤害则判断加成
  1891. local onPassiveDamaging = function(func, target, damage, skill)
  1892. if skill and skill.type == BattleSkillType.Special then
  1893. local dd = BattleUtil.CountValue(damage, extra, ct2) - damage
  1894. if func then func(-floor(BattleUtil.ErrorCorrection(dd))) end
  1895. end
  1896. end
  1897. role.Event:AddEvent(BattleEventName.PassiveDamaging, onPassiveDamaging)
  1898. end,
  1899. -- 每次释放技能,技能伤害增加[a]%,无限叠加释放普攻时清除加成,[b]改变
  1900. -- a[float]b[改变类型]
  1901. [118] = function(role, args)
  1902. local f1 = args[1]
  1903. local ct = args[2]
  1904. local af = 0
  1905. local onSkillCast = function(skill)
  1906. if skill.type == BattleSkillType.Normal and not skill.isAdd then
  1907. af = 0
  1908. elseif skill.type == BattleSkillType.Special then
  1909. af = af + f1
  1910. end
  1911. end
  1912. role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
  1913. -- 如果是技能的伤害则判断加成
  1914. local onPassiveDamaging = function(func, target, damage, skill)
  1915. if skill and skill.type == BattleSkillType.Special then
  1916. local dd = BattleUtil.CountValue(damage, af, ct) - damage
  1917. if func then func(-floor(BattleUtil.ErrorCorrection(dd))) end
  1918. end
  1919. end
  1920. role.Event:AddEvent(BattleEventName.PassiveDamaging, onPassiveDamaging)
  1921. end,
  1922. -- 普攻后[a]改变自身[b]%的[c]持续[d]回合可叠加
  1923. -- a[改变类型]b[float]c[属性]d[int]
  1924. [119] = function(role, args)
  1925. local ct = args[1]
  1926. local f1 = args[2]
  1927. local pro = args[3]
  1928. local i1 = args[4]
  1929. -- 释放技能后
  1930. local onSkillEnd = function(skill)
  1931. if skill.type == BattleSkillType.Normal then
  1932. local buff = Buff.Create(role, BuffName.PropertyChange, i1, BattlePropList[pro], f1, ct)
  1933. buff.cover = true
  1934. role:AddBuff(buff)
  1935. end
  1936. end
  1937. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd)
  1938. end,
  1939. -- 受到直接伤害[a]%治疗友方全体
  1940. -- a[float]
  1941. [120] = function(role, args)
  1942. local f1 = args[1]
  1943. local onBeHit = function(caster, damage)
  1944. local list = RoleManager.Query(function(v) return v.camp == role.camp end)
  1945. for i = 1, #list do
  1946. local r = list[i]
  1947. if r and not r:IsDead() then
  1948. local treatValue = floor(BattleUtil.ErrorCorrection(f1 * damage))
  1949. BattleUtil.ApplyTreat(role, r, treatValue)
  1950. end
  1951. end
  1952. end
  1953. role.Event:AddEvent(BattleEventName.RoleBeHit, onBeHit)
  1954. end,
  1955. -- 普攻后回复[a]点怒气
  1956. -- a[int]
  1957. [121] = function(role, args)
  1958. local i1 = args[1]
  1959. -- 释放技能后
  1960. local onSkillEnd = function(skill)
  1961. if skill.type == BattleSkillType.Normal then
  1962. role:AddRage(i1, CountTypeName.Add)
  1963. end
  1964. end
  1965. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd)
  1966. end,
  1967. -- 释放技能后给己方前排武将附加减伤盾持续时间[a]改变[b]回合
  1968. -- a[改变类型]b[int]
  1969. [122] = function(role, args)
  1970. local ct = args[1]
  1971. local i1 = args[2]
  1972. -- 释放技能后
  1973. local onSkillEnd = function(skill)
  1974. if skill.type == BattleSkillType.Special then
  1975. local list = RoleManager.Query(function(v) return v.camp == role.camp and v.position <= 3 end)
  1976. for _, role in ipairs(list) do
  1977. BattleLogic.BuffMgr:QueryBuff(role, function(buff)
  1978. if buff.type == BuffName.Shield and buff.shieldType == ShieldTypeName.RateReduce then
  1979. buff:ChangeBuffDuration(ct, i1)
  1980. end
  1981. end)
  1982. end
  1983. end
  1984. end
  1985. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd)
  1986. end,
  1987. -- 释放技能后给己方前排附加减伤盾效果[a]改变[b]%
  1988. -- a[改变类型]b[float]
  1989. [123] = function(role, args)
  1990. local ct = args[1]
  1991. local f1 = args[2]
  1992. -- 释放技能后
  1993. local onSkillEnd = function(skill)
  1994. if skill.type == BattleSkillType.Special then
  1995. local list = RoleManager.Query(function(v) return v.camp == role.camp and v.position <= 3 end)
  1996. for _, role in ipairs(list) do
  1997. BattleLogic.BuffMgr:QueryBuff(role, function(buff)
  1998. if buff.type == BuffName.Shield and buff.shieldType == ShieldTypeName.RateReduce then
  1999. buff:ChangeShieldValue(ct, f1)
  2000. end
  2001. end)
  2002. end
  2003. end
  2004. end
  2005. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd)
  2006. end,
  2007. -- 释放技能后回复己方后排[a]点怒气
  2008. -- a[int]
  2009. [124] = function(role, args)
  2010. local i1 = args[1]
  2011. -- 释放技能后
  2012. local onSkillEnd = function(skill)
  2013. if skill.type == BattleSkillType.Special then
  2014. local list = RoleManager.Query(function(v) return v.position > 3 end)
  2015. for _, r in ipairs(list) do
  2016. r:AddRage(i1, CountTypeName.Add)
  2017. end
  2018. end
  2019. end
  2020. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd)
  2021. end,
  2022. -- 直接伤害击杀目标下回合攻击[a]%暴击(TODO:目前为增加[a]%)
  2023. -- a[float]
  2024. [125] = function(role, args)
  2025. local f1 = args[1]
  2026. -- 释放技能后
  2027. local onRoleHit = function(target)
  2028. if target:IsDead() and BattleUtil.CheckIsNoDead(target) then
  2029. local buff = Buff.Create(role, BuffName.PropertyChange, 1, RoleDataName.Crit, f1, CountTypeName.Add)
  2030. role:AddBuff(buff)
  2031. end
  2032. end
  2033. role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit)
  2034. end,
  2035. -- 战斗中生命每减少[c]%,[d]就[e]改变[f]%
  2036. -- c[float]d[属性]e[改变类型]f[float]
  2037. [126] = function(role, args)
  2038. local f1 = args[1]
  2039. local pro = args[2]
  2040. local dt = args[3]
  2041. local f2 = args[4]
  2042. local curLevel = 0
  2043. -- 释放技能后
  2044. local onRoleBeDamaged = function(caster, damage)
  2045. local levelDamage = floor(role:GetRoleData(RoleDataName.MaxHp)*f1)
  2046. local lostDamage = role:GetRoleData(RoleDataName.MaxHp) - role:GetRoleData(RoleDataName.Hp)
  2047. local level = floor(lostDamage/levelDamage)
  2048. if level > curLevel then
  2049. local dl = level - curLevel
  2050. for i = 1, dl do
  2051. local buff = Buff.Create(role, BuffName.PropertyChange, 0, BattlePropList[pro], f2, dt)
  2052. buff.cover = true
  2053. role:AddBuff(buff)
  2054. end
  2055. curLevel = level
  2056. end
  2057. end
  2058. role.Event:AddEvent(BattleEventName.RoleBeDamaged, onRoleBeDamaged)
  2059. end,
  2060. -- 与48相同
  2061. -- [127] = {},
  2062. -- 普攻后降低目标[b]点怒气
  2063. -- a[int]
  2064. [128] = function(role, args)
  2065. local i1 = args[1]
  2066. -- 普攻后
  2067. local onSkillEnd = function(skill)
  2068. if skill.type == BattleSkillType.Normal then
  2069. local list = skill:GetDirectTargetsNoMiss()
  2070. if list then
  2071. for _, r in ipairs(list) do
  2072. r:AddRage(i1, CountTypeName.Sub)
  2073. end
  2074. end
  2075. end
  2076. end
  2077. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd)
  2078. end,
  2079. -- TODO
  2080. -- 全体蜀国武将增加[a]%[b]
  2081. -- a[float]b[属性]
  2082. -- [129] = {},
  2083. -- 死亡后持续战斗两回合期间受伤不致死,[a]回合后自动死亡。期间技能伤害降低[b]%无法触发追击效果且死后无法被复活。受到伤害[c]改变
  2084. -- a[int]b[float]c[改变类型]
  2085. [130] = function(role, args)
  2086. local i1 = args[1]
  2087. local f1 = args[2]
  2088. local ct = args[3]
  2089. -- 角色死亡时
  2090. local onRoleDead = function()
  2091. -- -- 暂时不能死
  2092. -- role:SetDeadFilter(false)
  2093. -- -- 伤害降低
  2094. -- local function onPassiveDamaging(func, target, damage, skill)
  2095. -- if skill and skill.type == BattleSkillType.Special then
  2096. -- local dd = BattleUtil.CountValue(damage, f1, 4) - damage
  2097. -- if func then func(-floor(BattleUtil.ErrorCorrection(dd))) end
  2098. -- end
  2099. -- end
  2100. -- role.Event:AddEvent(BattleEventName.PassiveDamaging, onPassiveDamaging)
  2101. -- -- 自动死亡
  2102. -- local counter = 0
  2103. -- local function onRoleTurnEnd()
  2104. -- counter = counter + 1
  2105. -- if counter == i1 then
  2106. -- -- 可以去死了
  2107. -- role:SetDeadFilter(true)
  2108. -- -- 但是不能复活了
  2109. -- role:SetReliveFilter(false)
  2110. -- -- 移除事件
  2111. -- role.Event:RemoveEvent(BattleEventName.RoleTurnEnd, onRoleTurnEnd)
  2112. -- role.Event:RemoveEvent(BattleEventName.PassiveDamaging, onPassiveDamaging)
  2113. -- end
  2114. -- end
  2115. -- role.Event:AddEvent(BattleEventName.RoleTurnEnd, onRoleTurnEnd)
  2116. local buff = Buff.Create(role, BuffName.NoDead, i1, f1, ct, false)
  2117. BattleLogic.BuffMgr:AddBuff(role, buff)
  2118. end
  2119. role.Event:AddEvent(BattleEventName.RoleDead, onRoleDead)
  2120. end,
  2121. -- 敌方每[a]改变[b]人自身伤害就[d]改变[e]% (敌方每死亡i1个则自身属性改变)
  2122. -- a[改变类型]b[int]d[改变类型]e[float]
  2123. [131] = function(role, args)
  2124. local ct1 = args[1]
  2125. local i1 = args[2]
  2126. local ct2 = args[3]
  2127. local f1 = args[4]
  2128. local deadNum = 0
  2129. local extra = 0
  2130. -- 释放技能后
  2131. local OnDead = function(deadRole)
  2132. if deadRole.camp == (role.camp + 1)%2 then
  2133. deadNum = deadNum + 1
  2134. if deadNum >= i1 then
  2135. deadNum = 0
  2136. extra = extra + f1
  2137. -- local buff = Buff.Create(role, BuffName.PropertyChange, 0, BattlePropList[pro], f1, ct2)
  2138. -- role:AddBuff(buff)
  2139. end
  2140. end
  2141. end
  2142. BattleLogic.Event:AddEvent(BattleEventName.BattleRoleDead, OnDead)
  2143. local passivityDamaging = function(func, caster, damage, skill)
  2144. if skill then
  2145. if func then
  2146. local dd = BattleUtil.CountValue(damage, extra, ct2) - damage
  2147. func(-floor(BattleUtil.ErrorCorrection(dd)))
  2148. end
  2149. end
  2150. end
  2151. role.Event:AddEvent(BattleEventName.PassiveDamaging, passivityDamaging)
  2152. end,
  2153. -- 直接伤害每次击杀目标增加自身伤害[a]%,[b]改变,可叠加持续至战斗结束
  2154. -- a[float]b[改变类型]
  2155. [132] = function(role, args)
  2156. local f1 = args[1]
  2157. local ct = args[2]
  2158. local killNum = 0
  2159. local extra = 0
  2160. -- 击杀数量累加
  2161. local OnRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill)
  2162. if skill and defRole:IsDead() and BattleUtil.CheckIsNoDead(defRole) then
  2163. killNum = killNum + 1
  2164. end
  2165. end
  2166. role.Event:AddEvent(BattleEventName.RoleHit, OnRoleHit)
  2167. -- 释放技能时计算额外伤害
  2168. local OnSkillCast = function(skill)
  2169. if skill then
  2170. extra = f1 * killNum
  2171. end
  2172. end
  2173. role.Event:AddEvent(BattleEventName.SkillCast, OnSkillCast)
  2174. -- 造成伤害时判断额外伤害
  2175. local passivityDamaging = function(func, caster, damage, skill)
  2176. if skill then
  2177. if func then
  2178. local dd = BattleUtil.CountValue(damage, extra, ct) - damage
  2179. func(-floor(BattleUtil.ErrorCorrection(dd)))
  2180. end
  2181. end
  2182. end
  2183. role.Event:AddEvent(BattleEventName.PassiveDamaging, passivityDamaging)
  2184. end,
  2185. -- 攻击时若目标[a]则当次攻击自身[b],[c]改变[d]%
  2186. -- a[持续伤害状态]b[属性]c[改变类型]d[float}
  2187. [133] = function(role, args)
  2188. local dot = args[1]
  2189. local pro = args[2]
  2190. local ct = args[3]
  2191. local f1 = args[4]
  2192. local index, tran
  2193. local OnRoleDamageBefore = function(target)
  2194. if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function(buff) return buff.damageType == dot end) then
  2195. index, tran = role:AddPropertyTransfer(BattlePropList[pro], f1, BattlePropList[pro], ct)
  2196. end
  2197. end
  2198. local OnRoleDamageAfter = function()
  2199. if index and tran then
  2200. role:RemovePropertyTransfer(index, tran)
  2201. end
  2202. end
  2203. role.Event:AddEvent(BattleEventName.RoleDamageBefore, OnRoleDamageBefore)
  2204. role.Event:AddEvent(BattleEventName.RoleDamageAfter, OnRoleDamageAfter)
  2205. end,
  2206. -- 释放技能技能[a]概率[b]改变[c]%
  2207. -- a[持续伤害状态]b[改变类型]c[float]
  2208. [134] = function(role, args)
  2209. local dot = args[1]
  2210. local ct = args[2]
  2211. local f1 = args[3]
  2212. local onSkillControl = function(func, dotType)
  2213. if dotType == dot then
  2214. if func then func(f1, ct) end
  2215. end
  2216. end
  2217. local onSkillCast = function(skill)
  2218. if skill.type == BattleSkillType.Special then
  2219. role.Event:AddEvent(BattleEventName.PassiveRandomDot, onSkillControl)
  2220. end
  2221. end
  2222. -- 技能后后
  2223. local onSkillCastEnd = function(skill)
  2224. if skill.type == BattleSkillType.Special then
  2225. role.Event:RemoveEvent(BattleEventName.PassiveRandomDot, onSkillControl)
  2226. end
  2227. end
  2228. role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
  2229. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillCastEnd)
  2230. end,
  2231. -- 普攻有[a]%概率使目标[b]持续[c]回合(每回合造成攻击者20%攻击力的伤害)
  2232. -- a[float]b[持续伤害状态]c[int]
  2233. [135] = function(role, args)
  2234. local f1 = args[1]
  2235. local dot = args[2]
  2236. local i1 = args[3]
  2237. -- 普攻后
  2238. local onSkillEnd = function(skill)
  2239. if skill.type == BattleSkillType.Normal then
  2240. local list = skill:GetDirectTargetsNoMiss()
  2241. if list then
  2242. local attack = role:GetRoleData(RoleDataName.Attack)
  2243. local damage = floor(BattleUtil.ErrorCorrection(attack * 0.2))
  2244. for _, r in ipairs(list) do
  2245. BattleUtil.RandomDot(f1, dot, role, r, i1, 1, damage)
  2246. end
  2247. end
  2248. end
  2249. end
  2250. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd)
  2251. end,
  2252. -- 受到普攻有[a]%概率使攻击者[b]持续[c]回合(每回合造成攻击者20%攻击力的伤害)
  2253. -- a[float]b[持续伤害状态]c[int]
  2254. [136] = function(role, args)
  2255. local f1 = args[1]
  2256. local dot = args[2]
  2257. local i1 = args[3]
  2258. -- 普攻后
  2259. local onSkillEnd = function(skill)
  2260. if skill.type == BattleSkillType.Normal then
  2261. local caster = skill.owner
  2262. local attack = role:GetRoleData(RoleDataName.Attack)
  2263. local damage = floor(BattleUtil.ErrorCorrection(attack * 0.2))
  2264. BattleUtil.RandomDot(f1, dot, role, caster, i1, 1, damage)
  2265. end
  2266. end
  2267. role.Event:AddEvent(BattleEventName.BeSkillCastEnd, onSkillEnd)
  2268. end,
  2269. -- 释放技能后给目标附加治疗效果每回合回复[a]的[b]%点生命持续[c]回合
  2270. -- a[属性]b[float]c[int]
  2271. [137] = function(role, args)
  2272. local pro = args[1]
  2273. local f1 = args[2]
  2274. local i1 = args[3]
  2275. -- 技能后后
  2276. local onSkillEnd = function(skill)
  2277. if skill.type == BattleSkillType.Special then
  2278. local list = skill:GetDirectTargetsNoMiss()
  2279. if list then
  2280. local tv = floor(BattleUtil.ErrorCorrection(role:GetRoleData(pro) * f1))
  2281. for _, r in ipairs(list) do
  2282. local auraBuff = Buff.Create(role, BuffName.HOT, i1, 1, tv)
  2283. auraBuff.interval = 1
  2284. r:AddBuff(auraBuff)
  2285. end
  2286. end
  2287. end
  2288. end
  2289. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd)
  2290. end,
  2291. -- 释放普攻后给目标附加治疗效果每回合回复[a]的[b]%点生命持续[c]回合
  2292. -- a[属性]b[float]c[int]
  2293. [138] = function(role, args)
  2294. local pro = args[1]
  2295. local f1 = args[2]
  2296. local i1 = args[3]
  2297. -- 技能后后
  2298. local onSkillEnd = function(skill)
  2299. if skill.type == BattleSkillType.Normal then
  2300. local list = skill:GetDirectTargetsNoMiss()
  2301. if list then
  2302. local tv = floor(BattleUtil.ErrorCorrection(role:GetRoleData(pro) * f1))
  2303. for _, r in ipairs(list) do
  2304. local auraBuff = Buff.Create(role, BuffName.HOT, i1, 1, tv)
  2305. auraBuff.interval = 1
  2306. r:AddBuff(auraBuff)
  2307. end
  2308. end
  2309. end
  2310. end
  2311. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd)
  2312. end,
  2313. -- TODO
  2314. -- 释放技能后给目标附加治疗效果[a]改变[b]%
  2315. -- a[改变类型]b[float]
  2316. [139] = function(role, args)
  2317. local dt = args[1]
  2318. local f1 = args[2]
  2319. local tFactor = function(factorFunc)
  2320. factorFunc(f1, dt)
  2321. end
  2322. role.Event:AddEvent(BattleEventName.SkillCast, function(skill)
  2323. if skill.type == BattleSkillType.Special then
  2324. role.Event:AddEvent(BattleEventName.PassiveTreatingFactor, tFactor)
  2325. end
  2326. end)
  2327. role.Event:AddEvent(BattleEventName.SkillCastEnd, function(skill)
  2328. if skill.type == BattleSkillType.Special then
  2329. role.Event:RemoveEvent(BattleEventName.PassiveTreatingFactor, tFactor)
  2330. end
  2331. end)
  2332. end,
  2333. -- 受到[a]状态敌人攻击时受到伤害[b]改变[c]%
  2334. -- a[持续伤害状态]b[改变类型]c[float]
  2335. [140] = function(role, args)
  2336. local dot = args[1]
  2337. local ct = args[2]
  2338. local f1 = args[3]
  2339. local onPassiveBeDamaging = function(func, caster, damage)
  2340. if BattleLogic.BuffMgr:HasBuff(caster, BuffName.DOT, function(buff) return buff.damageType == dot end) then
  2341. local dmgDeduction = damage - floor(BattleUtil.ErrorCorrection(BattleUtil.CountValue(damage, f1, ct)))
  2342. if func then func(dmgDeduction) end
  2343. end
  2344. end
  2345. role.Event:AddEvent(BattleEventName.PassiveBeDamaging, onPassiveBeDamaging)
  2346. end,
  2347. -- 战斗第[a]回合无敌
  2348. -- a[int]
  2349. [141] = function(role, args)
  2350. local i1 = args[1]
  2351. local buff
  2352. BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, function(curRound)
  2353. -- 第i1回合开始
  2354. if curRound == i1 then
  2355. buff = Buff.Create(role, BuffName.Shield, 0, ShieldTypeName.AllReduce, 0, 0)
  2356. buff.clear = false
  2357. role:AddBuff(buff)
  2358. end
  2359. if curRound == i1 + 1 then
  2360. if buff then
  2361. buff.disperse = true
  2362. end
  2363. end
  2364. end)
  2365. end,
  2366. -- 释放技能时如目标处于[a]状态则伤害的[b]%转化为生命治疗自己
  2367. -- a[持续伤害状态]b[float]
  2368. [142] = function(role, args)
  2369. local dot = args[1]
  2370. local f1 = args[2]
  2371. local onHit = function(target, damage, bCrit, finalDmg)
  2372. if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function(buff) return buff.damageType == dot end) then
  2373. BattleUtil.ApplyTreat(role, role, floor(BattleUtil.ErrorCorrection(finalDmg * f1)))
  2374. end
  2375. end
  2376. local onSkillCast = function(skill)
  2377. if skill.type == BattleSkillType.Special then
  2378. role.Event:AddEvent(BattleEventName.RoleHit, onHit)
  2379. end
  2380. end
  2381. -- 技能后后
  2382. local onSkillCastEnd = function(skill)
  2383. if skill.type == BattleSkillType.Special then
  2384. role.Event:RemoveEvent(BattleEventName.RoleHit, onHit)
  2385. end
  2386. end
  2387. role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
  2388. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillCastEnd)
  2389. end,
  2390. -- 释放技能时如目标处于[a]状态则[b]的概率[c]改变[d]%
  2391. -- a[持续伤害状态]b[控制状态]c[改变类型]d[float]
  2392. [143] = function(role, args)
  2393. local dot = args[1]
  2394. local ctrl = args[2]
  2395. local ct = args[3]
  2396. local f1 = args[4]
  2397. local onSkillControl = function(func, ctrl2, target)
  2398. if ctrl2 == ctrl then
  2399. if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function(b) return b.damageType == dot end) then
  2400. if func then func(f1, ct) end
  2401. end
  2402. end
  2403. end
  2404. local onSkillCast = function(skill)
  2405. if skill.type == BattleSkillType.Special then
  2406. role.Event:AddEvent(BattleEventName.PassiveRandomControl, onSkillControl)
  2407. end
  2408. end
  2409. -- 技能后后
  2410. local onSkillCastEnd = function(skill)
  2411. if skill.type == BattleSkillType.Special then
  2412. role.Event:RemoveEvent(BattleEventName.PassiveRandomControl, onSkillControl)
  2413. end
  2414. end
  2415. role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
  2416. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillCastEnd)
  2417. end,
  2418. -- 死亡时释放[a]次技能
  2419. -- a[int]
  2420. [144] = function(role, args)
  2421. local i1 = args[1]
  2422. local function onRoleDead()
  2423. for i = 1, i1 do
  2424. -- 插入一个技能,该技能优先级较高
  2425. role:InsertSkill(BattleSkillType.Special, false, true, nil)
  2426. end
  2427. end
  2428. role.Event:AddEvent(BattleEventName.RoleDead, onRoleDead)
  2429. end,
  2430. -- 技能对[a]目标[b]额外提升[c]%(当次),[d]改变
  2431. -- a[持续伤害状态]b[属性]c[float]d[改变类型]
  2432. [145] = function(role, args)
  2433. local dot = args[1]
  2434. local pro = args[2]
  2435. local f1 = args[3]
  2436. local ct = args[4]
  2437. local index, tran
  2438. local OnRoleDamageBefore = function(target, factorFunc, damageType, skill)
  2439. if skill and skill.type == BattleSkillType.Special and
  2440. BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function(buff) return buff.damageType == dot end) then
  2441. index, tran = role:AddPropertyTransfer(BattlePropList[pro], f1, BattlePropList[pro], ct)
  2442. end
  2443. end
  2444. local OnRoleDamageAfter = function()
  2445. if index and tran then
  2446. role:RemovePropertyTransfer(index, tran)
  2447. end
  2448. end
  2449. role.Event:AddEvent(BattleEventName.RoleDamageBefore, OnRoleDamageBefore)
  2450. role.Event:AddEvent(BattleEventName.RoleDamageAfter, OnRoleDamageAfter)
  2451. end,
  2452. -- 普攻对[a]目标伤害额外增加[b]%(当次),[c]改变
  2453. -- a[持续伤害状态]b[float]c[改变类型]
  2454. [146] = function(role, args)
  2455. local dot = args[1]
  2456. local f1 = args[2]
  2457. local ct = args[3]
  2458. local onPassiveDamaging = function(damagingFunc, defRole, damage)
  2459. if BattleLogic.BuffMgr:HasBuff(defRole, BuffName.DOT, function(buff) return buff.damageType == dot end) then
  2460. if damagingFunc then
  2461. local dd = BattleUtil.CountValue(damage, f1, ct) - damage
  2462. damagingFunc(-floor(BattleUtil.ErrorCorrection(dd)))
  2463. end
  2464. end
  2465. end
  2466. local onSkillCast = function(skill)
  2467. if skill.type == BattleSkillType.Normal then
  2468. role.Event:AddEvent(BattleEventName.PassiveDamaging, onPassiveDamaging)
  2469. end
  2470. end
  2471. local onSkillCastEnd = function(skill)
  2472. if skill.type == BattleSkillType.Normal then
  2473. role.Event:RemoveEvent(BattleEventName.PassiveDamaging, onPassiveDamaging)
  2474. end
  2475. end
  2476. role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
  2477. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillCastEnd)
  2478. end,
  2479. -- 受到攻击有[a]%概率使攻击者[b](每回合造成被击者自身20%攻击力的伤害)持续[c]回合
  2480. -- a[float]b[持续伤害状态]c[int]
  2481. [147] = function(role, args)
  2482. local f1 = args[1]
  2483. local dot = args[2]
  2484. local i1 = args[3]
  2485. -- 技能后后
  2486. local onRoleBeHit = function(caster)
  2487. local attack = role:GetRoleData(RoleDataName.Attack)
  2488. local damage = floor(BattleUtil.ErrorCorrection(attack * 0.2))
  2489. BattleUtil.RandomDot(f1, dot, role, caster, i1, 1, damage)
  2490. end
  2491. role.Event:AddEvent(BattleEventName.RoleBeHit, onRoleBeHit)
  2492. end,
  2493. -- 直接伤害击杀[a]目标回复[b]%的最大生命
  2494. -- a[持续伤害状态]b[float]
  2495. [148] = function(role, args)
  2496. local dot = args[1]
  2497. local f1 = args[2]
  2498. local function onHit(target)
  2499. if target:IsDead() and BattleUtil.CheckIsNoDead(target) then
  2500. local maxHp = role:GetRoleData(RoleDataName.MaxHp)
  2501. local value = floor(BattleUtil.ErrorCorrection(maxHp* f1))
  2502. BattleUtil.ApplyTreat(role, role, value)
  2503. end
  2504. role.Event:RemoveEvent(BattleEventName.RoleHit, onHit)
  2505. end
  2506. local onDamaging = function(func, target)
  2507. if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function(buff) return buff.damageType == dot end) then
  2508. role.Event:AddEvent(BattleEventName.RoleHit, onHit)
  2509. end
  2510. end
  2511. role.Event:AddEvent(BattleEventName.PassiveDamaging, onDamaging)
  2512. end,
  2513. -- 技能攻击的目标如本回合直接攻击过自己则对其造成伤害增加[a]%(如目标[b]则伤害增加[c]%)[d]改变
  2514. -- a[float]b[持续伤害状态]c[float]d[改变类型]
  2515. [149] = function(role, args)
  2516. local f1 = args[1]
  2517. local dot = args[2]
  2518. local f2 = args[3]
  2519. local ct = args[4]
  2520. local attor = {}
  2521. local onRoleBeHit = function(caster)
  2522. if not attor[caster.position] then
  2523. attor[caster.position] = 1
  2524. end
  2525. end
  2526. role.Event:AddEvent(BattleEventName.RoleBeHit, onRoleBeHit)
  2527. local onBattleRoundChange = function(func, caster)
  2528. attor = {}
  2529. end
  2530. BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, onBattleRoundChange)
  2531. -- 被动技能加伤害
  2532. local onDamaging = function(func, target, damage, skill)
  2533. if attor[target.position] and skill and skill.type == BattleSkillType.Special and func then
  2534. local df = f1
  2535. if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function(buff) return buff.damageType == dot end) then
  2536. df = f2
  2537. end
  2538. local dd = BattleUtil.CountValue(damage, df, ct) - damage
  2539. func(-floor(BattleUtil.ErrorCorrection(dd)))
  2540. end
  2541. end
  2542. role.Event:AddEvent(BattleEventName.PassiveDamaging, onDamaging)
  2543. end,
  2544. -- 技能对[a]目标当次伤害提升[b]%,[c]改变
  2545. -- a[持续伤害状态]b[flaot]c[改变类型]
  2546. [150] = function(role, args)
  2547. local dot = args[1]
  2548. local f1 = args[2]
  2549. local ct = args[3]
  2550. local onPassiveDamaging = function(damagingFunc, defRole, damage)
  2551. if BattleLogic.BuffMgr:HasBuff(defRole, BuffName.DOT, function(buff) return buff.damageType == dot end) then
  2552. if damagingFunc then
  2553. local dd = BattleUtil.CountValue(damage, f1, ct) - damage
  2554. damagingFunc(-floor(BattleUtil.ErrorCorrection(dd)))
  2555. end
  2556. end
  2557. end
  2558. local onSkillCast = function(skill)
  2559. if skill.type == BattleSkillType.Special then
  2560. role.Event:AddEvent(BattleEventName.PassiveDamaging, onPassiveDamaging)
  2561. end
  2562. end
  2563. local onSkillCastEnd = function(skill)
  2564. if skill.type == BattleSkillType.Special then
  2565. role.Event:RemoveEvent(BattleEventName.PassiveDamaging, onPassiveDamaging)
  2566. end
  2567. end
  2568. role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
  2569. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillCastEnd)
  2570. end,
  2571. -- 释放普通攻击如目标[a],且血量低于[b]%则有[c]%概率秒杀
  2572. -- a[持续伤害状态]b[float]c[float]
  2573. [151] = function(role, args)
  2574. local dot = args[1]
  2575. local f1 = args[2]
  2576. local f2 = args[3]
  2577. --
  2578. local onRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill)
  2579. if skill and skill.type == BattleSkillType.Normal and not defRole:IsDead() then
  2580. if BattleLogic.BuffMgr:HasBuff(defRole, BuffName.DOT, function (buff) return dot == 0 or buff.damageType == dot end) then
  2581. -- 检测被动技能对秒杀参数得影响
  2582. local bf, kf = BattleUtil.CheckSeckill(f1, f2, role, defRole)
  2583. --
  2584. local ft = defRole:GetRoleData(RoleDataName.Hp)/defRole:GetRoleData(RoleDataName.MaxHp)
  2585. if ft < bf then
  2586. BattleUtil.RandomAction(kf, function()
  2587. -- 秒杀
  2588. BattleUtil.Seckill(skill, role, defRole)
  2589. end)
  2590. end
  2591. end
  2592. end
  2593. end
  2594. role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit)
  2595. end,
  2596. -- 释放技能有[a]%概率附加[b]效果持续[c]回合
  2597. -- a[float]b[控制状态]c[int]
  2598. [152] = function(role, args)
  2599. local f1 = args[1]
  2600. local ctrl = args[2]
  2601. local i1 = args[3]
  2602. -- 技能后后
  2603. local onSkillCastEnd = function(skill)
  2604. if skill.type == BattleSkillType.Special then
  2605. local targets = skill:GetDirectTargetsNoMiss()
  2606. if targets then
  2607. for _, r in ipairs(targets) do
  2608. BattleUtil.RandomControl(f1, ctrl, role, r, i1)
  2609. end
  2610. end
  2611. end
  2612. end
  2613. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillCastEnd)
  2614. end,
  2615. -- 直接伤害击杀目标回复自身[a]点怒气
  2616. -- a[int]
  2617. [153] = function(role, args)
  2618. local i1 = args[1]
  2619. local onHit = function(target, damage, bCrit, finalDmg)
  2620. if target:IsDead() and BattleUtil.CheckIsNoDead(target) then
  2621. role:AddRage(i1, CountTypeName.Add)
  2622. end
  2623. end
  2624. role.Event:AddEvent(BattleEventName.RoleHit, onHit)
  2625. end,
  2626. -- 复活友方第[a]位阵亡的英雄并回复其[b]%的生命每场战斗触发[c]次
  2627. -- a[int]b[float]c[int]
  2628. [154] = function(role, args)
  2629. local i1 = args[1]
  2630. local f1 = args[2]
  2631. local i2 = args[3]-- 无意义(第几个死亡的人只能有一个)
  2632. local counter = 0
  2633. local onRoleRealDead = function(deadRole)
  2634. if deadRole.camp == role.camp then
  2635. counter = counter + 1
  2636. if counter == i1 then
  2637. deadRole:SetRelive(f1)
  2638. end
  2639. end
  2640. end
  2641. BattleLogic.Event:AddEvent(BattleEventName.RoleRealDead, onRoleRealDead)
  2642. end,
  2643. -- 目标血量每降低[c]%(只看当前血量),对其治疗量就[e]改变[f]%
  2644. -- c[float]e[改变类型]f[float]
  2645. [155] = function(role, args)
  2646. local f1 = args[1]
  2647. local ct = args[2]
  2648. local f2 = args[3]
  2649. local function onPassiveTreatingFactor(treatFactorFunc, targetRole)
  2650. local lf = targetRole:GetRoleData(RoleDataName.Hp)/targetRole:GetRoleData(RoleDataName.MaxHp)
  2651. local df = 1 - lf -- 血量降低百分比 = 1 - 当前血量百分比
  2652. local level = floor(df/f1)
  2653. if treatFactorFunc then
  2654. treatFactorFunc(BattleUtil.ErrorCorrection(level*f2), ct)
  2655. end
  2656. end
  2657. role.Event:AddEvent(BattleEventName.PassiveTreatingFactor, onPassiveTreatingFactor)
  2658. end,
  2659. -- 受到普攻后降低攻击自己武将的[c]点怒气
  2660. -- c[int]
  2661. [156] = function(role, args)
  2662. local i1 = args[1]
  2663. local onBeSkillCastEnd = function(skill)
  2664. if skill.type == BattleSkillType.Normal then
  2665. skill.owner:AddRage(i1, CountTypeName.Sub)
  2666. end
  2667. end
  2668. role.Event:AddEvent(BattleEventName.BeSkillCastEnd, onBeSkillCastEnd)
  2669. end,
  2670. -- 减伤盾减伤比例[a]改变[b]%
  2671. -- a[改变类型]b[float]
  2672. [157] = function(role, args)
  2673. local ct = args[1]
  2674. local f1 = args[2]
  2675. local OnBuffCaster = function(buff)
  2676. if buff.type == BuffName.Shield and buff.shieldType == ShieldTypeName.RateReduce then
  2677. buff:ChangeShieldValue(ct, f1)
  2678. end
  2679. end
  2680. role.Event:AddEvent(BattleEventName.BuffCaster, OnBuffCaster)
  2681. end,
  2682. -- 释放技能后回复当前本方阵容最靠前武将[a]点怒气
  2683. -- a[int]
  2684. [158] = function(role, args)
  2685. local i1 = args[1]
  2686. local onSkillCastEnd = function(skill)
  2687. if skill.type == BattleSkillType.Special then
  2688. local list = RoleManager.Query(function(v) return v.camp == role.camp end)
  2689. table.sort(list, function(a, b)
  2690. return a.position < b.position
  2691. end)
  2692. for i= 1, #list do
  2693. if list[i] and not list[i]:IsRealDead() then
  2694. list[i]:AddRage(i1, CountTypeName.Add)
  2695. break
  2696. end
  2697. end
  2698. end
  2699. end
  2700. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillCastEnd)
  2701. end,
  2702. -- [a]伤害[b]改变[c]%(技能效果111专属被动)
  2703. -- a[持续伤害状态]b[改变类型]c[float]
  2704. [159] = function(role, args)
  2705. local dot = args[1]
  2706. local ct = args[2]
  2707. local f1 = args[3]
  2708. local onSkillEffectBefore = function(skill, e, func)
  2709. if skill.type == BattleSkillType.Special then
  2710. if e.type == 111 then -- 当前只对技能效果103生效
  2711. if e.args[2] == dot then
  2712. local factor = BattleUtil.ErrorCorrection(BattleUtil.CountValue(e.args[3], f1, ct))
  2713. e.args[3] = factor
  2714. if func then func(e) end
  2715. end
  2716. end
  2717. end
  2718. end
  2719. role.Event:AddEvent(BattleEventName.SkillEffectBefore, onSkillEffectBefore)
  2720. end,
  2721. -- 受到普攻是有[a]%概率给攻击者附加[b],每回合对目标造成自身攻击的[c]%伤害,持续[d]回合
  2722. -- a[float]b[持续伤害状态]c[float]d[int]
  2723. [160] = function(role, args)
  2724. local f1 = args[1]
  2725. local dot = args[2]
  2726. local f2 = args[3]
  2727. local i1 = args[3]
  2728. -- 技能后后
  2729. local onBeSkillCastEnd = function(skill)
  2730. if skill.type == BattleSkillType.Normal then
  2731. local attack = role:GetRoleData(RoleDataName.Attack)
  2732. local damage = floor(BattleUtil.ErrorCorrection(attack * f2))
  2733. BattleUtil.RandomDot(f1, dot, role, skill.owner, i1, 1, damage)
  2734. end
  2735. end
  2736. role.Event:AddEvent(BattleEventName.BeSkillCastEnd, onBeSkillCastEnd)
  2737. end,
  2738. -- 攻击目标时目标身上每有1种异常状态(包括麻痹、眩晕、沉默、灼烧、中毒)都会使对其造成的直接伤害提高,异常状态数量乘以[a]%。
  2739. -- a[float]
  2740. [161] = function(role, args)
  2741. local f1 = args[1]
  2742. local function onPassiveDamaging(damagingFunc, target, damage)
  2743. local list = BattleLogic.BuffMgr:GetBuff(target, function(buff)
  2744. return buff.type == BuffName.DOT or buff.type == BuffName.Control
  2745. end)
  2746. if list and damagingFunc then
  2747. local num = #list
  2748. local dd = BattleUtil.CountValue(damage, f1 * num, CountTypeName.AddPencent) - damage
  2749. damagingFunc(-floor(BattleUtil.ErrorCorrection(dd)))
  2750. end
  2751. end
  2752. role.Event:AddEvent(BattleEventName.PassiveDamaging, onPassiveDamaging)
  2753. end,
  2754. -- 当敌方目标处于链接符状态(主动技能110效果)时受到链接符传导效果提高[a]%
  2755. -- a[float]
  2756. [162] = function(role, args)
  2757. local f1 = args[1]
  2758. local onCurse_ShareDamage = function(func)
  2759. if func then func(f1, CountTypeName.Add) end
  2760. end
  2761. role.Event:AddEvent(BattleEventName.Curse_ShareDamage, onCurse_ShareDamage)
  2762. end,
  2763. -- 每当对方拥有链接符的目标死亡时,都会使己方输出型武将技能伤害提高[a]%([b]元素输出武将提高[c]%)
  2764. -- a[float]b[元素]c[float]
  2765. [163] = function(role, args)
  2766. local f1 = args[1]
  2767. local ele = args[2]
  2768. local f2 = args[3]
  2769. -- 死亡数量
  2770. local num = 0
  2771. local onBattleRoleDead = function(defRole)
  2772. --
  2773. if BattleLogic.BuffMgr:HasBuff(defRole, BuffName.Curse, function(buff) return buff.curseType == CurseTypeName.ShareDamage end) then
  2774. num = num + 1
  2775. end
  2776. end
  2777. BattleLogic.Event:AddEvent(BattleEventName.BattleRoleDead, onBattleRoleDead)
  2778. --
  2779. local cNum = 0 -- 释放技能前记录此次技能提高伤害的目标数量,防止单次技能伤害不一致的问题
  2780. local function onSkillCast()
  2781. cNum = num
  2782. end
  2783. BattleLogic.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
  2784. -- 技能伤害提高
  2785. local function onPassiveDamaging(damagingFunc, atkRole, defRole, damage, skill)
  2786. if atkRole.professionId == 2 and atkRole.camp == role.camp and skill and skill.type == BattleSkillType.Special then
  2787. -- 地元素特殊
  2788. local f = atkRole.element == ele and f2 or f1
  2789. local dd = BattleUtil.CountValue(damage, f * cNum, CountTypeName.AddPencent) - damage
  2790. damagingFunc(-floor(BattleUtil.ErrorCorrection(dd)))
  2791. end
  2792. end
  2793. BattleLogic.Event:AddEvent(BattleEventName.PassiveDamaging, onPassiveDamaging)
  2794. end,
  2795. -- 爆伤减免增加[a]%,[b]改变
  2796. -- a[float]b[改变类型]
  2797. [164] = function(role, args)
  2798. local f1 = args[1]
  2799. local ct = args[2]
  2800. local function onCritDamageReduceFactor(damagingFunc, atkRole, defRole)
  2801. if defRole == role then
  2802. if damagingFunc then
  2803. damagingFunc(f1, ct)
  2804. end
  2805. end
  2806. end
  2807. role.Event:AddEvent(BattleEventName.CritDamageReduceFactor, onCritDamageReduceFactor)
  2808. end,
  2809. -- 战斗中生命每减少[a]%,自身伤害就[b]改变[c]%,减少为[d]改变
  2810. -- a[float]b[改变类型]c[float]d[改变类型]
  2811. [165] = function(role, args)
  2812. local f1 = args[1]
  2813. local ct = args[2]
  2814. local f2 = args[3]
  2815. local ct2 = args[4] -- 废物参数
  2816. -- 释放技能后
  2817. local onPassiveDamaging = function(damagingFunc, defRole, damage, skill)
  2818. local levelDamage = floor(role:GetRoleData(RoleDataName.MaxHp)*f1)
  2819. local lostDamage = role:GetRoleData(RoleDataName.MaxHp) - role:GetRoleData(RoleDataName.Hp)
  2820. local level = floor(lostDamage/levelDamage)
  2821. local dd = BattleUtil.CountValue(damage, f2*level, ct) - damage
  2822. damagingFunc(-floor(BattleUtil.ErrorCorrection(dd)))
  2823. end
  2824. role.Event:AddEvent(BattleEventName.PassiveDamaging, onPassiveDamaging)
  2825. end,
  2826. -- 普通攻击时如目标处于[a]状态则伤害的[b]%转化为生命治疗自己
  2827. -- a[持续伤害状态]b[float]
  2828. [166] = function(role, args)
  2829. local dot = args[1]
  2830. local f1 = args[2]
  2831. local onHit = function(target, damage, bCrit, finalDmg)
  2832. if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function(buff) return buff.damageType == dot end) then
  2833. BattleUtil.ApplyTreat(role, role, floor(BattleUtil.ErrorCorrection(finalDmg * f1)))
  2834. end
  2835. end
  2836. local onSkillCast = function(skill)
  2837. if skill.type == BattleSkillType.Normal then
  2838. role.Event:AddEvent(BattleEventName.RoleHit, onHit)
  2839. end
  2840. end
  2841. -- 技能后后
  2842. local onSkillCastEnd = function(skill)
  2843. if skill.type == BattleSkillType.Normal then
  2844. role.Event:RemoveEvent(BattleEventName.RoleHit, onHit)
  2845. end
  2846. end
  2847. role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
  2848. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillCastEnd)
  2849. end,
  2850. -- 如果目标数量大于[a]个,增加自身[b]点怒气
  2851. -- a[int]b[int]
  2852. [167] = function(role, args)
  2853. local i1 = args[1]
  2854. local i2 = args[2]
  2855. -- 释放技能后
  2856. local onSkillEnd = function(skill)
  2857. local targets = skill:GetDirectTargets()
  2858. if targets and #targets > i1 then
  2859. role:AddRage(i2, 1)
  2860. end
  2861. end
  2862. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd)
  2863. end,
  2864. -- 释放技能后给当前血量最少的2名队友附加无敌吸血盾持续[a]回合
  2865. -- a[int]
  2866. [168] = function(role, args)
  2867. local i1 = args[1]
  2868. -- 释放技能后
  2869. local onSkillEnd = function(skill)
  2870. if skill.type == BattleSkillType.Special then
  2871. local list = RoleManager.Query(function(v) return v.camp == role.camp end)
  2872. BattleUtil.SortByProp(list, RoleDataName.Hp, 1)
  2873. local index = 0
  2874. for i = 1, #list do
  2875. if not list[i]:IsRealDead() and index < 2 then
  2876. index = index + 1
  2877. -- 吸血率%25 策划说写死
  2878. list[i]:AddBuff(Buff.Create(role, BuffName.Shield, i1, ShieldTypeName.AllReduce, 0.25, 0))
  2879. end
  2880. end
  2881. end
  2882. end
  2883. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd)
  2884. end,
  2885. -- 行动后增加自身[a]%的[b](可叠加持续至结束)
  2886. -- a[float]b[属性]
  2887. [169] = function(role, args)
  2888. local f1 = args[1]
  2889. local pro = args[2]
  2890. -- 行动结束后
  2891. local onTurnEnd = function()
  2892. local buff = Buff.Create(role, BuffName.PropertyChange, 0, BattlePropList[pro], f1, CountTypeName.AddPencent)
  2893. role:AddBuff(buff)
  2894. end
  2895. role.Event:AddEvent(BattleEventName.RoleTurnEnd, onTurnEnd)
  2896. end,
  2897. -- 击杀目标后对敌方血量百分比最低两名角色造成[a]%[b]伤害
  2898. -- a[float]b[伤害类型]
  2899. [170] = function(role, args)
  2900. local f1 = args[1]
  2901. local dt = args[2]
  2902. -- 直接伤害后
  2903. local onRoleHit = function(target, damage, bCrit, finalDmg, damageType, skill)
  2904. if skill and not skill.isAdd and target:IsDead() and BattleUtil.CheckIsNoDead(target) then
  2905. local list = RoleManager.Query(function(v) return v.camp ~= role.camp end)
  2906. BattleUtil.SortByHpFactor(list, 1)
  2907. local index = 0
  2908. for i = 1, #list do
  2909. if not list[i]:IsDead() and index < 2 then
  2910. index = index + 1
  2911. BattleUtil.CalDamage(nil, role, list[i], dt, f1)
  2912. end
  2913. end
  2914. end
  2915. end
  2916. role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit)
  2917. end,
  2918. -- 攻击目标越少[a]对每个目标提升概率越高,提升概率为[b]%除以被击者的总数,提升为[c]改变
  2919. -- a[控制状态]b[float]c[改变类型]
  2920. [172] = function(role, args)
  2921. local ctrl = args[1]
  2922. local f1 = args[2]
  2923. local ct = args[3]
  2924. local af = 0
  2925. local onSkillCast = function(skill)
  2926. local targets = skill:GetDirectTargets()
  2927. if targets and #targets > 0 then
  2928. af = BattleUtil.ErrorCorrection(f1/#targets)
  2929. end
  2930. end
  2931. role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
  2932. local onPassiveRandomControl = function(func, ctrl2)
  2933. if ctrl == 0 or ctrl == ctrl2 then
  2934. if func then func(af, ct) end
  2935. end
  2936. end
  2937. role.Event:AddEvent(BattleEventName.PassiveRandomControl, onPassiveRandomControl)
  2938. end,
  2939. -- 反弹伤害增加[a]%,[b]改变
  2940. -- a[float]b[改变类型]
  2941. [173] = function(role, args)
  2942. local f1 = args[1]
  2943. local ct = args[2]
  2944. local onPassiveRebackDamage = function(func)
  2945. if func then func(f1, ct) end
  2946. end
  2947. role.Event:AddEvent(BattleEventName.PassiveRebackDamage, onPassiveRebackDamage)
  2948. end,
  2949. -- 技能直接伤害治疗生命最少队友治疗量提升[a]%,[b]改变
  2950. -- a[float]b[改变类型]
  2951. [174] = function(role, args)
  2952. local f1 = args[1]
  2953. local ct = args[2]
  2954. local onPassiveSkillDamageHeal = function(func)
  2955. if func then func(f1, ct) end
  2956. end
  2957. role.Event:AddEvent(BattleEventName.PassiveSkillDamageHeal, onPassiveSkillDamageHeal)
  2958. end,
  2959. -- 释放技能时,对己方生命最少武将治疗效果额外提升[a],[b]改变
  2960. -- a[float]b[改变类型]
  2961. [175] = function(role, args)
  2962. local f1 = args[1]
  2963. local ct = args[2]
  2964. local onPassiveTreatingFactor = function(func, target)
  2965. local arr = RoleManager.Query(function (r) return r.camp == role.camp end)
  2966. BattleUtil.SortByHpFactor(arr, 1)
  2967. if arr and arr[1] and arr[1] == target then
  2968. if func then func(f1, ct) end
  2969. end
  2970. end
  2971. local function onSkillCast(skill)
  2972. if skill.type == BattleSkillType.Special then
  2973. role.Event:AddEvent(BattleEventName.PassiveTreatingFactor, onPassiveTreatingFactor)
  2974. end
  2975. end
  2976. local function onSkillCastEnd(skill)
  2977. if skill.type == BattleSkillType.Special then
  2978. role.Event:RemoveEvent(BattleEventName.PassiveTreatingFactor, onPassiveTreatingFactor)
  2979. end
  2980. end
  2981. role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
  2982. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillCastEnd)
  2983. end,
  2984. -- 减伤盾抵抗效果提升[a]%,抵抗效果[b]增加,提升效果由所有受益目标平分。
  2985. -- a[float]b[改变类型]
  2986. [176] = function(role, args)
  2987. local f1 = args[1]
  2988. local ct = args[2]
  2989. local af = 0
  2990. local onSkillCast = function(skill)
  2991. local targets = skill.effectTargets[2]
  2992. if targets and #targets > 0 then
  2993. af = BattleUtil.ErrorCorrection(f1/#targets)
  2994. end
  2995. end
  2996. role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
  2997. local onPassiveShield = function(func, shieldType)
  2998. if shieldType == ShieldTypeName.RateReduce then
  2999. if func then func(af, ct) end
  3000. end
  3001. end
  3002. role.Event:AddEvent(BattleEventName.PassiveShield, onPassiveShield)
  3003. end,
  3004. -- 技能治疗效果提升[a]%, 同时为每个技能目标附加减伤盾,减伤效果[b]%,持续[c]回合
  3005. -- a[float]b[float]c[int]
  3006. [177] = function(role, args)
  3007. local f1 = args[1]
  3008. local f2 = args[2]
  3009. local i1 = args[3]
  3010. local onPassiveTreatingFactor = function(func, target)
  3011. if func then func(f1, 1) end
  3012. end
  3013. local function onSkillCast(skill)
  3014. if skill.type == BattleSkillType.Special then
  3015. role.Event:AddEvent(BattleEventName.PassiveTreatingFactor, onPassiveTreatingFactor)
  3016. end
  3017. end
  3018. local function onSkillCastEnd(skill)
  3019. if skill.type == BattleSkillType.Special then
  3020. role.Event:RemoveEvent(BattleEventName.PassiveTreatingFactor, onPassiveTreatingFactor)
  3021. -- 对每个目标附加减伤盾
  3022. local targets = skill:GetDirectTargets()
  3023. for _, target in ipairs(targets) do
  3024. target:AddBuff(Buff.Create(role, BuffName.Shield, i1, ShieldTypeName.RateReduce, f2, 0))
  3025. end
  3026. end
  3027. end
  3028. role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
  3029. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillCastEnd)
  3030. end,
  3031. -- 攻击目标越少[a]对每个目标提升概率越高,提升率等于[b]%除以被攻击者的总数,[c]改变
  3032. -- a[持续伤害状态]b[float]c[改变类型]
  3033. [178] = function(role, args)
  3034. local dot = args[1]
  3035. local f1 = args[2]
  3036. local ct = args[3]
  3037. local af = 0
  3038. local onSkillCast = function(skill)
  3039. local targets = skill:GetDirectTargets()
  3040. if targets and #targets > 0 then
  3041. af = BattleUtil.ErrorCorrection(f1/#targets)
  3042. end
  3043. end
  3044. role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
  3045. local onPassiveRandomDot = function(func, dot2)
  3046. if dot == dot2 then
  3047. if func then func(af, ct) end
  3048. end
  3049. end
  3050. role.Event:AddEvent(BattleEventName.PassiveRandomDot, onPassiveRandomDot)
  3051. end,
  3052. -- 对别人造成的中毒伤害的[a]%用于治疗自己
  3053. -- a[float]
  3054. [179] = function(role, args)
  3055. local f1 = args[1]
  3056. local dot = DotType.Poison
  3057. local onRoleDamage = function(defRole, damage, bCrit, finalDmg, damageType, dotType, skill)
  3058. if dotType == dot then
  3059. BattleUtil.ApplyTreat(role, role, floor(BattleUtil.ErrorCorrection(finalDmg * f1)))
  3060. end
  3061. end
  3062. role.Event:AddEvent(BattleEventName.RoleDamage, onRoleDamage)
  3063. end,
  3064. -- 受到[a]效果概率降低[b]%,[c]改变
  3065. -- a[控制状态]b[float]c[改变类型]
  3066. [180] = function(role, args)
  3067. local ctrl = args[1]
  3068. local f1 = args[2]
  3069. local ct = args[3]
  3070. local onPassiveBeRandomControl = function(func, ctrl2, target)
  3071. if ctrl == 0 or ctrl == ctrl2 then
  3072. if func then func(f1, ct) end
  3073. end
  3074. end
  3075. role.Event:AddEvent(BattleEventName.PassiveBeRandomControl, onPassiveBeRandomControl)
  3076. end,
  3077. -- 攻击单体目标时额外降低目标[a]点怒气
  3078. -- a[int]
  3079. [181] = function(role, args)
  3080. local i1 = args[1]
  3081. local function onSkillCastEnd(skill)
  3082. -- 对每个目标附加减伤盾
  3083. local targets = skill:GetDirectTargetsNoMiss()
  3084. if targets and #targets == 1 then
  3085. targets[1]:AddRage(i1, CountTypeName.Sub)
  3086. end
  3087. end
  3088. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillCastEnd)
  3089. end,
  3090. -- 攻击目标越少[a]对每个目标的伤害越高,伤害提升量等于[b]%除以由于自身攻击受到该效果的敌人的总数,[c]改变
  3091. -- a[持续伤害状态]b[float]c[改变类型]
  3092. [182] = function(role, args)
  3093. local dot = args[1]
  3094. local f1 = args[2]
  3095. local ct = args[3]
  3096. local af = 0
  3097. local onSkillCast = function(skill)
  3098. local targets = skill:GetDirectTargets()
  3099. if targets and #targets > 0 then
  3100. af = BattleUtil.ErrorCorrection(f1/#targets)
  3101. end
  3102. end
  3103. role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
  3104. local onPassiveRandomDot = function(func, dot2, damage)
  3105. if dot == dot2 then
  3106. if func then func(nil, nil, af, ct) end
  3107. end
  3108. end
  3109. role.Event:AddEvent(BattleEventName.PassiveRandomDot, onPassiveRandomDot)
  3110. end,
  3111. -- 有该技能角色,释放技能造成的[a]效果附加封治疗效果,该状态武将无法回复生命
  3112. -- a[持续伤害状态]
  3113. [183] = function(role, args)
  3114. local dot = args[1]
  3115. local onBuffCaster = function(buff)
  3116. if buff.type == BuffName.DOT and buff.damageType == dot then
  3117. BattleUtil.RandomControl(1, ControlType.NoHeal, role, buff.target, buff.duration)
  3118. end
  3119. end
  3120. role.Event:AddEvent(BattleEventName.BuffCaster, onBuffCaster)
  3121. end,
  3122. -- [a]状态延长[b]回合
  3123. -- a[持续伤害状态]b[int]
  3124. [184] = function(role, args)
  3125. local dot = args[1]
  3126. local i1 = args[2]
  3127. local onBuffCaster = function(buff)
  3128. if buff.type == BuffName.DOT and buff.damageType == dot then
  3129. buff:ChangeBuffDuration(CountTypeName.Add, i1)
  3130. end
  3131. end
  3132. role.Event:AddEvent(BattleEventName.BuffCaster, onBuffCaster)
  3133. end,
  3134. -- 直接伤害击杀目标对仇恨目标造成[a]%物理伤害
  3135. -- a[float]
  3136. [185] = function(role, args)
  3137. local f1 = args[1]
  3138. local onRoleHit = function(target)
  3139. if target:IsDead() and BattleUtil.CheckIsNoDead(target) then
  3140. local target = RoleManager.GetAliveAggro(role)
  3141. BattleUtil.CalDamage(nil, role, target, 1, f1)
  3142. end
  3143. end
  3144. role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit)
  3145. end,
  3146. -- 直接伤害击杀目标对仇恨目标追加一次造成[a]%物理伤害的技能
  3147. -- a[float]
  3148. -- [185] = function(role, args)
  3149. -- local f1 = args[1]
  3150. -- local onRoleHit = function(target)
  3151. -- if target:IsDead() then
  3152. -- local skill = {
  3153. -- role.skill[1], -- 技能id
  3154. -- {
  3155. -- 400000, -- chooseId
  3156. -- role.skill[2][2], -- 效果时间
  3157. -- {1, f1, 1} -- 效果id及参数
  3158. -- }
  3159. -- }
  3160. -- SkillManager.AddSkill(role, skill, BattleSkillType.Normal, nil, true, false)
  3161. -- end
  3162. -- end
  3163. -- role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit)
  3164. -- end,
  3165. -- 攻击纵排目标时额外降低目标[a]点怒气
  3166. -- a[int]
  3167. [186] = function(role, args)
  3168. local i1 = args[1]
  3169. local onSkillCastEnd = function(skill)
  3170. local effectGroup = skill.effectList.buffer[1]
  3171. local chooseId = effectGroup.chooseId
  3172. local chooseLimit = floor(chooseId / 10000) % 10
  3173. if chooseLimit == 3 then -- 打纵列
  3174. local targets = skill:GetDirectTargetsNoMiss()
  3175. if targets then
  3176. for _, r in ipairs(targets) do
  3177. r:AddRage(i1, CountTypeName.Sub)
  3178. end
  3179. end
  3180. end
  3181. end
  3182. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillCastEnd)
  3183. end,
  3184. -- 普攻[a]%概率暴击
  3185. -- a[float]
  3186. [187] = function(role, args)
  3187. local f1 = args[1]
  3188. local function onSkillCast(skill)
  3189. if skill.type == BattleSkillType.Normal then
  3190. role.data:AddValue(RoleDataName.Crit, f1)
  3191. end
  3192. end
  3193. role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
  3194. local function onSkillCastEnd(skill)
  3195. if skill.type == BattleSkillType.Normal then
  3196. role.data:SubValue(RoleDataName.Crit, f1)
  3197. end
  3198. end
  3199. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillCastEnd)
  3200. end,
  3201. -- 受到伤害降低[a]%(与减伤盾同效果)并且将自身受到非致命伤害平分给自身及己方当前生命最高的两名武将(被平摊武将有无敌也会受到伤害)降低伤害[b]改变
  3202. -- a[float]b[改变类型]
  3203. [188] = function(role, args)
  3204. local f1 = args[1]
  3205. local ct = args[2]
  3206. local onFinalBeDamage = function(damagingFunc, atkRole, damage, skill, dotType, bCrit, damageType)
  3207. -- 伤害降低
  3208. local finalDamage = BattleUtil.CountValue(damage, f1, ct)
  3209. local curHp = role:GetRoleData(RoleDataName.Hp)
  3210. -- 不是致死伤害
  3211. if finalDamage < curHp then
  3212. -- 找到除自身外的血量最高的两人
  3213. local list = RoleManager.Query(function(v)
  3214. return v.camp == role.camp and v.position ~= role.position
  3215. end)
  3216. local ff = 1 -- 分摊比
  3217. -- 检测被动对分摊比的影响
  3218. local cl = {}
  3219. local function _CallBack(v, ct)
  3220. if v then
  3221. table.insert(cl, {v, ct})
  3222. end
  3223. end
  3224. role.Event:DispatchEvent(BattleEventName.PassiveDamageShare, _CallBack)
  3225. atkRole.Event:DispatchEvent(BattleEventName.PassiveDamageBeShare, _CallBack)
  3226. ff = BattleUtil.CountChangeList(ff, cl)
  3227. -- 计算分摊伤害
  3228. local fenDamage = finalDamage * ff -- 需要分摊的总伤害
  3229. list = BattleUtil.SortByProp(list, RoleDataName.Hp, 0)
  3230. local targets = {role, list[1], list[2]}
  3231. local fd = floor(BattleUtil.ErrorCorrection(fenDamage/#targets)) -- 每个人需要分摊的伤害
  3232. -- 自身伤害
  3233. if damagingFunc then
  3234. local unFenDamage = floor(BattleUtil.ErrorCorrection(finalDamage * (1 - ff))) -- 不被分摊的伤害
  3235. damagingFunc(floor(BattleUtil.ErrorCorrection(damage - (unFenDamage + fd))))
  3236. end
  3237. -- 平分给别人
  3238. if fd > 0 then
  3239. for i = 2, #targets do
  3240. BattleUtil.FinalDamage(skill, atkRole, targets[i], fd, nil, 0, dotType)
  3241. end
  3242. end
  3243. end
  3244. end
  3245. role.Event:AddEvent(BattleEventName.FinalBeDamage, onFinalBeDamage)
  3246. end,
  3247. -- 有该技能角色,造成的[a]效果会使目标无法获得无敌盾和无敌吸血盾效果
  3248. -- a[持续伤害状态]
  3249. [189] = function(role, args)
  3250. local dot = args[1]
  3251. local onBuffCaster = function(buff)
  3252. if buff.type == BuffName.DOT and buff.damageType == dot then
  3253. buff.target:AddBuff(Buff.Create(role, BuffName.Immune, buff.duration, 3))
  3254. end
  3255. end
  3256. role.Event:AddEvent(BattleEventName.BuffCaster, onBuffCaster)
  3257. end,
  3258. -- 所有攻击优先攻击敌方[a]最少的单位
  3259. -- a[属性]
  3260. [190] = function(role, args)
  3261. local pro = args[1]
  3262. local function onSkillTargetCheck(func)
  3263. local list = RoleManager.Query(function(r)
  3264. return r.camp == (role.camp + 1) % 2
  3265. end)
  3266. list = BattleUtil.SortByProp(list, BattlePropList[pro], 1)
  3267. if list and #list > 0 then
  3268. if func then func({list[1]}) end
  3269. end
  3270. end
  3271. role.Event:AddEvent(BattleEventName.SkillTargetCheck, onSkillTargetCheck)
  3272. end,
  3273. -- 技能直接伤害[a]%转化为生命治疗自己
  3274. -- a[float]
  3275. [191] = function(role, args)
  3276. local f1 = args[1]
  3277. local onHit = function(target, damage, bCrit, finalDmg, dtype, skill)
  3278. if skill and skill.type == BattleSkillType.Special then
  3279. -- 检测技能伤害治疗加成
  3280. local f = BattleUtil.CheckSkillDamageHeal(f1, role, target)
  3281. -- 治疗自己
  3282. BattleUtil.ApplyTreat(role, role, floor(BattleUtil.ErrorCorrection(finalDmg * f)))
  3283. end
  3284. end
  3285. role.Event:AddEvent(BattleEventName.RoleHit, onHit)
  3286. end,
  3287. -- 武将怒气小于[a]点时不会释放技能,释放技能消耗当前所有怒气超过4怒气部分每额外消耗1点怒气技能伤害增加[b]%
  3288. -- a[int]b[float]
  3289. [192] = function(role, args)
  3290. local i1 = args[1]
  3291. local f1 = args[2]
  3292. -- 提高技能释放怒气值
  3293. role.SuperSkillRage = i1
  3294. --
  3295. local allRage = 0
  3296. local function onRoleRageCost(rage, rate, func)
  3297. allRage = role.Rage
  3298. local deltaRage = allRage - role.SuperSkillRage
  3299. if func then
  3300. func(0, deltaRage)
  3301. end
  3302. end
  3303. role.Event:AddEvent(BattleEventName.RoleRageCost, onRoleRageCost)
  3304. -- 释放技能后
  3305. local onPassiveDamaging = function(damagingFunc, defRole, damage, skill, dotType)
  3306. if skill and skill.type == BattleSkillType.Special then
  3307. local deltaRage = allRage - 4
  3308. if deltaRage > 0 then
  3309. local dd = BattleUtil.CountValue(damage, f1 * deltaRage, 2) - damage
  3310. damagingFunc(-floor(BattleUtil.ErrorCorrection(dd)))
  3311. end
  3312. end
  3313. end
  3314. role.Event:AddEvent(BattleEventName.PassiveDamaging, onPassiveDamaging)
  3315. end,
  3316. -- 对己方生命最少的三个武将治疗效果额外提升治疗武将攻击的[a]%,提升为[b]改变
  3317. -- a[float]b[改变类型]
  3318. [193] = function(role, args)
  3319. local f1 = args[1]
  3320. local ct = args[2]
  3321. local OnPassiveTreating = function(treatingFunc, target)
  3322. local arr = RoleManager.Query(function (r) return r.camp == role.camp end)
  3323. BattleUtil.SortByHpFactor(arr, 1)
  3324. if not arr then return end
  3325. for i = 1, 3 do
  3326. if arr[i] and arr[i] == target then
  3327. local atk = role:GetRoleData(RoleDataName.Attack)
  3328. treatingFunc(atk * f1, ct)
  3329. end
  3330. end
  3331. end
  3332. role.Event:AddEvent(BattleEventName.PassiveTreating, OnPassiveTreating)
  3333. end,
  3334. -- 攻击有概率清除敌方武将无敌盾和无敌吸血盾,攻击目标越少,清除概率越高,对每个受击者清除概率等于[a]%除以受击者的总数
  3335. -- a[float]
  3336. [194] = function(role, args)
  3337. local f1 = args[1]
  3338. local OnRoleDamageBefore = function(defRole, factorFunc, damageType, skill)
  3339. local targets = skill:GetDirectTargets()
  3340. if not targets or #targets == 0 then return end
  3341. local cf = f1/#targets
  3342. for _, target in ipairs(targets) do
  3343. BattleUtil.RandomAction(cf, function()
  3344. BattleLogic.BuffMgr:ClearBuff(target, function(buff)
  3345. return buff.type == BuffName.Shield and buff.shieldType == ShieldTypeName.AllReduce
  3346. end)
  3347. end)
  3348. end
  3349. end
  3350. role.Event:AddEvent(BattleEventName.RoleDamageBefore, OnRoleDamageBefore)
  3351. end,
  3352. -- 首回合免疫[a]效果
  3353. -- a[控制状态]
  3354. [195] = function(role, args)
  3355. local ctrl = args[1]
  3356. local immune = function(buff)
  3357. return buff.type == BuffName.Control and (ctrl == 0 or buff.ctrlType == ctrl)
  3358. end
  3359. BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, function(curRound)
  3360. -- 第i1回合开始
  3361. if curRound == 1 then
  3362. role.buffFilter:Add(immune)
  3363. end
  3364. -- 第i1+i2回合结束
  3365. if curRound == 2 then
  3366. for i = 1, role.buffFilter.size do
  3367. if role.buffFilter.buffer[i] == immune then
  3368. role.buffFilter:Remove(i)
  3369. break
  3370. end
  3371. end
  3372. end
  3373. end)
  3374. end,
  3375. -- 对敌方造成伤害如被分摊其分摊比降低[a]%
  3376. -- a[float]
  3377. [196] = function(role, args)
  3378. local f1 = args[1]
  3379. local onDamageBeShare = function(func)
  3380. if func then func(f1, CountTypeName.Sub) end
  3381. end
  3382. role.Event:AddEvent(BattleEventName.PassiveDamageBeShare, onDamageBeShare)
  3383. end,
  3384. -- 技能直接击杀敌方目标时有[a]%概率获得目标剩余所有怒气(输出武将佩戴)
  3385. -- a[float]
  3386. [197] = function(role, args)
  3387. local f1 = args[1]
  3388. local onRoleHit = function(target, damage, bCrit, finalDmg, damageType, skill)
  3389. if skill and skill.type == BattleSkillType.Special and target:IsDead() and BattleUtil.CheckIsNoDead(target) then
  3390. BattleUtil.RandomAction(f1, function()
  3391. role:AddRage(target.Rage, CountTypeName.Add)
  3392. end)
  3393. end
  3394. end
  3395. role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit)
  3396. end,
  3397. -- 受到的[a]效果伤害降低[b]%(与减伤盾原理相同)[c]改变
  3398. -- a[持续伤害状态]b[float]c[改变类型]
  3399. [198] = function(role, args)
  3400. local dot = args[1]
  3401. local f1 = args[2]
  3402. local ct = args[3]
  3403. -- 释放技能后
  3404. local onPassiveBeDamaging = function(damagingFunc, defRole, damage, skill, dotType)
  3405. if dotType and (dotType == dot or dot == 0) then
  3406. local dd = damage - BattleUtil.CountValue(damage, f1, ct)
  3407. damagingFunc(floor(BattleUtil.ErrorCorrection(dd)))
  3408. end
  3409. end
  3410. role.Event:AddEvent(BattleEventName.PassiveBeDamaging, onPassiveBeDamaging)
  3411. end,
  3412. --每回合最多受到自身生命上限[a]%的伤害(该伤害为来自武将的直接伤害)
  3413. --a[float]
  3414. [199] = function(role, args)
  3415. local f1 = args[1]
  3416. local curDamage = 0
  3417. local function onRoundChange()
  3418. curDamage = 0
  3419. end
  3420. BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, onRoundChange)
  3421. local function onFinalBeDamage(damagingFunc, atkRole, damage, skill, dotType, bCrit, damageType)
  3422. local maxDamage = role:GetRoleData(RoleDataName.MaxHp) * f1
  3423. curDamage = curDamage + damage
  3424. if curDamage > maxDamage then
  3425. -- 计算免除的伤害值
  3426. local md = curDamage - maxDamage
  3427. if md > damage then
  3428. md = damage
  3429. end
  3430. if damagingFunc then damagingFunc(md) end
  3431. end
  3432. end
  3433. role.Event:AddEvent(BattleEventName.FinalBeDamage, onFinalBeDamage)
  3434. end,
  3435. -- 同阵营武将受到直接伤害时该伤害[a]%转移给有此锦囊的武将转移伤害属于直接伤害(无法触发任何特性)
  3436. -- a[float]
  3437. [200] = function(role, args)
  3438. local f1 = args[1]
  3439. local onFinalDamage = function(damagingFunc, atkRole, defRole, damage, skill, dotType, bCrit, damageType)
  3440. if skill and role.position ~= defRole.position and defRole.camp == role.camp and defRole.element == role.element then
  3441. local shareDamage = floor(BattleUtil.ErrorCorrection(damage * f1))
  3442. -- 被攻击武将自身伤害
  3443. if damagingFunc then
  3444. damagingFunc(shareDamage)
  3445. end
  3446. -- 分担伤害
  3447. BattleUtil.ApplyDamage(nil, atkRole, role, shareDamage)
  3448. end
  3449. end
  3450. BattleLogic.Event:AddEvent(BattleEventName.FinalDamage, onFinalDamage)
  3451. end,
  3452. -- 初始怒气增加[a]点并且目标血量低于[b]%时即有概率秒杀(对应秒杀技能)
  3453. -- a[int]b[float]
  3454. [201] = function(role, args)
  3455. local i1 = args[1]
  3456. local f1 = args[2]
  3457. role:AddRage(i1, CountTypeName.Add)
  3458. local function onPassiveSeckill(func)
  3459. if func then func(f1, CountTypeName.Cover) end
  3460. end
  3461. role.Event:AddEvent(BattleEventName.PassiveSeckill, onPassiveSeckill)
  3462. end,
  3463. -- 秒杀概率增加[a]%直接伤害击杀的[b]目标有[c]%概率无法复活触发秒杀的目标[d]%无法复活,秒杀概率[e]改变
  3464. -- a[float]b[持续伤害状态]c[float]d[float]e[改变类型]
  3465. [202] = function(role, args)
  3466. local f1 = args[1]
  3467. local dot = args[2]
  3468. local f2 = args[3]
  3469. local f3 = args[4]
  3470. local ct = args[5]
  3471. -- 秒杀概率增加
  3472. local function onPassiveSeckill(func)
  3473. if func then func(nil, nil, f1, ct) end
  3474. end
  3475. role.Event:AddEvent(BattleEventName.PassiveSeckill, onPassiveSeckill)
  3476. -- 直接伤害概率无法复活
  3477. local function onRoleHit(target)
  3478. if target:IsDead() then
  3479. if not BattleLogic.BuffMgr:HasBuff(role, BuffName.DOT, function (buff) return buff.damageType == dot or dot == 0 end) then
  3480. BattleUtil.RandomAction(f2, function()
  3481. target:SetReliveFilter(false)
  3482. end)
  3483. end
  3484. end
  3485. end
  3486. role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit)
  3487. -- 秒杀概率无法复活
  3488. local function onSecKill(target)
  3489. BattleUtil.RandomAction(f3, function()
  3490. target:SetReliveFilter(false)
  3491. end)
  3492. end
  3493. role.Event:AddEvent(BattleEventName.Seckill, onSecKill)
  3494. end,
  3495. -- 初始怒气增加[a]点敌方处于连接符状态的目标在回合结束时有[b]概率减少[c]点怒气
  3496. -- a[int]b[int]
  3497. [203] = function(role, args)
  3498. local i1 = args[1]
  3499. local f1 = args[2]
  3500. local i2 = args[3]
  3501. -- 初始怒气增加
  3502. role:AddRage(i1, CountTypeName.Add)
  3503. -- 死亡数量
  3504. local onRoleTurnEnd = function(target)
  3505. if not target:IsDead() and BattleLogic.BuffMgr:HasBuff(target, BuffName.Curse, function(buff) return buff.curseType == CurseTypeName.ShareDamage end) then
  3506. BattleUtil.RandomAction(f1, function()
  3507. target:AddRage(i2, CountTypeName.Sub)
  3508. end)
  3509. end
  3510. end
  3511. BattleLogic.Event:AddEvent(BattleEventName.RoleTurnEnd, onRoleTurnEnd)
  3512. end,
  3513. -- 敌方处于连接符状态的目标在获得无敌盾时有[a]%概率获取失败
  3514. -- a[float]
  3515. [204] = function(role, args)
  3516. local f1 = args[1]
  3517. -- 死亡数量
  3518. local onRoleAddBuffMiss = function(func, target, buff)
  3519. -- 无敌盾
  3520. if buff.type == BuffName.Shield and buff.shieldType == ShieldTypeName.AllReduce then
  3521. -- 有连接符
  3522. if BattleLogic.BuffMgr:HasBuff(target, BuffName.Curse, function(buff) return buff.curseType == CurseTypeName.ShareDamage end) then
  3523. -- 提高miss概率
  3524. if func then func(f1, CountTypeName.Add) end
  3525. end
  3526. end
  3527. end
  3528. BattleLogic.Event:AddEvent(BattleEventName.RoleAddBuffMiss, onRoleAddBuffMiss)
  3529. end,
  3530. -- 伤害增加[a]%,[b]改变
  3531. -- a[float]b[改变类型]
  3532. [205] = function(role, args)
  3533. local f1 = args[1]
  3534. local ct = args[2]
  3535. local passivityDamaging = function(func, caster, damage, skill)
  3536. if skill and func then
  3537. local dd = BattleUtil.CountValue(damage, f1, ct) - damage
  3538. func(-floor(BattleUtil.ErrorCorrection(dd)))
  3539. end
  3540. end
  3541. role.Event:AddEvent(BattleEventName.PassiveDamaging, passivityDamaging)
  3542. end,
  3543. --技能治疗系数[a]改变[b]%(作用于主动技能效果103)
  3544. --a[改变类型]b[float]
  3545. [206] = function(role, args)
  3546. local ct = args[1]
  3547. local f1 = args[2]
  3548. local onSkillEffectBefore = function(skill, e, func)
  3549. if skill.type == BattleSkillType.Special then
  3550. if e.type == 103 then -- 当前只对技能效果103生效
  3551. local factor = BattleUtil.ErrorCorrection(BattleUtil.CountValue(e.args[3], f1, ct))
  3552. e.args[3] = factor
  3553. if func then func(e) end
  3554. end
  3555. end
  3556. end
  3557. role.Event:AddEvent(BattleEventName.SkillEffectBefore, onSkillEffectBefore)
  3558. end,
  3559. -- 释放技能有[a]%几率对敌方后排造成[b]%[c]伤害
  3560. -- a[float]b[float]c[伤害类型]
  3561. [207] = function(role, args)
  3562. local f1 = args[1]
  3563. local f2 = args[2]
  3564. local dt = args[3]
  3565. -- 释放技能后
  3566. local onSkillEnd = function(skill)
  3567. if skill.type == BattleSkillType.Special then
  3568. BattleUtil.RandomAction(f1, function()
  3569. BattleLogic.WaitForTrigger(0.1, function()
  3570. local list = RoleManager.Query(function(v)
  3571. return v.camp == (role.camp + 1) % 2 and v.position > 3
  3572. end)
  3573. for _, r in ipairs(list) do
  3574. BattleUtil.CalDamage(nil, role, r, dt, f2)
  3575. end
  3576. end)
  3577. end)
  3578. end
  3579. end
  3580. role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd)
  3581. end,
  3582. -- 如果自身是[a],则[d]改变[b]的[c],[g改变[e]的[f]
  3583. -- a[位置],b[float],c[属性],d[改变类型],e[float],f[属性],g[改变类型]
  3584. [208] = function(role, args)
  3585. local i1 = args[1]
  3586. local f1 = args[2]
  3587. local pro1 = args[3]
  3588. local ct1 = args[4]
  3589. local f2 = args[5]
  3590. local pro2 = args[6]
  3591. local ct2 = args[7]
  3592. if BattleUtil.GetRolePosType(role.position) == i1 then
  3593. BattleUtil.AddProp(role, pro1, f1, ct1)
  3594. BattleUtil.AddProp(role, pro2, f2, ct2)
  3595. end
  3596. end,
  3597. -- 我方[a]武将全部阵亡后,如果自身是[a],则[d]改变[b]的[c]
  3598. -- a[位置],b[位置],c[float],d[属性],e[改变类型]
  3599. [209] = function(role, args)
  3600. local i1 = args[1]
  3601. local i2 = args[2]
  3602. local f1 = args[3]
  3603. local pro = args[4]
  3604. local ct = args[5]
  3605. local function _OnRoleRealDead(deadRole)
  3606. if role.camp == deadRole.camp then
  3607. local list = BattleUtil.GetRoleListByPosType(role.camp, i1)
  3608. if not list or #list == 0 then
  3609. if BattleUtil.GetRolePosType(role.position) == i2 then
  3610. BattleUtil.AddProp(role, pro, f1, ct)
  3611. -- 移除事件监听
  3612. BattleLogic.Event:RemoveEvent(BattleEventName.RoleRealDead, _OnRoleRealDead)
  3613. end
  3614. end
  3615. end
  3616. end
  3617. BattleLogic.Event:AddEvent(BattleEventName.RoleRealDead, _OnRoleRealDead)
  3618. end,
  3619. -- 如果自身是[a]和[b]武将则[e]改变[c]的[d]
  3620. -- a[类型],b[类型],c[float],d[属性],e[改变类型]
  3621. [210] = function(role, args)
  3622. local pf1 = args[1]
  3623. local pf2 = args[2]
  3624. local f1 = args[3]
  3625. local pro = args[4]
  3626. local ct = args[5]
  3627. if role.professionId == pf1 or role.professionId == pf2 then
  3628. BattleUtil.AddProp(role, pro, f1, ct)
  3629. end
  3630. end,
  3631. -- 第[a]回合开始时,如果自身血量最低,则恢复[b]*[c]的血量
  3632. -- a[int],b[属性],c[float]
  3633. [211] = function(role, args)
  3634. if PassiveManager.passiveCountList[role.camp][211] and PassiveManager.passiveCountList[role.camp][211] > 0 then
  3635. return
  3636. end
  3637. PassiveManager.passiveCountList[role.camp][211] = 1
  3638. local round = args[1]
  3639. local pro = args[2]
  3640. local f1 = args[3]
  3641. local function onRoundChange(curRound)
  3642. if curRound == round then
  3643. local list = RoleManager.Query(function(r) return r.camp == role.camp end)
  3644. list = BattleUtil.SortByProp(list, RoleDataName.Hp, 1)
  3645. local base = list[1]:GetRoleData(BattlePropList[pro])
  3646. local value = floor(BattleUtil.ErrorCorrection(base* f1))
  3647. BattleUtil.ApplyTreat(list[1], list[1], value)
  3648. end
  3649. end
  3650. BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, onRoundChange)
  3651. end,
  3652. -- 战斗开始时, 自身血量高于[a]%, 则[d]改变[b]的[c]
  3653. -- a[float],b[float],c[属性],d[改变类型]
  3654. [212] = function(role, args)
  3655. local f1 = args[1]
  3656. local f2 = args[2]
  3657. local pro = args[3]
  3658. local ct = args[4]
  3659. local hp = role:GetRoleData(RoleDataName.Hp)
  3660. local maxHp = role:GetRoleData(RoleDataName.MaxHp)
  3661. if hp/maxHp >= f1 then
  3662. BattleUtil.AddProp(role, pro, f2, ct)
  3663. end
  3664. end,
  3665. -- 战斗开始时,回复自身[a]点怒气 --
  3666. -- a[int]
  3667. [213] = function(role, args)
  3668. local i1 = args[1]
  3669. local function onRoundChange(curRound)
  3670. if curRound == 1 then
  3671. role:AddRage(i1, CountTypeName.Add)
  3672. -- BattleLogic.Event:RemoveEvent(BattleEventName.BattleRoundChange, onRoundChange)
  3673. end
  3674. end
  3675. BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, onRoundChange)
  3676. end,
  3677. -- 同阵营只会有一个生效
  3678. -- 第[a]回合中,敌人受到的任何伤害会对其他敌人造成该伤害[b]%的伤害
  3679. -- a[float],b[float]
  3680. [214] = function(role, args)
  3681. if PassiveManager.passiveCountList[role.camp][214] and PassiveManager.passiveCountList[role.camp][214] > 0 then
  3682. return
  3683. end
  3684. PassiveManager.passiveCountList[role.camp][214] = 1
  3685. local i1 = args[1]
  3686. local f1 = args[2]
  3687. local function OnDamage(func, atkRole, defRole, damage, skill, dotType, bCrit, damageType)
  3688. if defRole.camp ~= role.camp then
  3689. if skill or dotType then
  3690. local list = RoleManager.Query(function(r) return r.camp == defRole.camp and r ~= defRole end)
  3691. for _, r in ipairs(list) do
  3692. local dd = floor(BattleUtil.ErrorCorrection(damage* f1))
  3693. BattleUtil.ApplyDamage(nil, role, r, dd)
  3694. end
  3695. end
  3696. end
  3697. end
  3698. local function onRoundChange(curRound)
  3699. if curRound == i1 then
  3700. BattleLogic.Event:AddEvent(BattleEventName.FinalDamage, OnDamage)
  3701. elseif curRound == i1 + 1 then
  3702. BattleLogic.Event:RemoveEvent(BattleEventName.FinalDamage, OnDamage)
  3703. -- BattleLogic.Event:RemoveEvent(BattleEventName.BattleRoundChange, onRoundChange)
  3704. end
  3705. end
  3706. BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, onRoundChange)
  3707. end,
  3708. -- 战斗开始时,使随机一名敌人受到的伤害增加[a]%,持续[b]回合。持续期间目标敌人死亡时,转移给另一名随机敌人
  3709. -- a[float],b[int]
  3710. [215] = function(role, args)
  3711. if PassiveManager.passiveCountList[role.camp][215] and PassiveManager.passiveCountList[role.camp][215] > 0 then
  3712. return
  3713. end
  3714. PassiveManager.passiveCountList[role.camp][215] = 1
  3715. local f1 = args[1]
  3716. local i1 = args[2]
  3717. local target
  3718. local function RandomTarget()
  3719. local list = RoleManager.Query(function(r)
  3720. return r.camp ~= role.camp
  3721. end)
  3722. if #list < 1 then return end
  3723. local index = Random.RangeInt(1, #list)
  3724. target = list[index]
  3725. end
  3726. -- 伤害增加
  3727. local function _OnPassiveDamaging(damagingFunc, atkRole, defRole, damage)
  3728. if defRole == target then
  3729. local dd = floor(BattleUtil.ErrorCorrection(damage* f1))
  3730. if damagingFunc then damagingFunc(-dd) end
  3731. end
  3732. end
  3733. -- 死亡重新随机
  3734. local function _OnRoleRealDead(deadRole)
  3735. if deadRole == target then
  3736. RandomTarget()
  3737. end
  3738. end
  3739. --
  3740. local function onRoundChange(curRound)
  3741. if curRound == 1 then
  3742. RandomTarget()
  3743. BattleLogic.Event:AddEvent(BattleEventName.PassiveDamaging, _OnPassiveDamaging)
  3744. BattleLogic.Event:AddEvent(BattleEventName.RoleRealDead, _OnRoleRealDead)
  3745. elseif curRound == i1 + 1 then
  3746. target = nil
  3747. BattleLogic.Event:RemoveEvent(BattleEventName.PassiveDamaging, _OnPassiveDamaging)
  3748. BattleLogic.Event:RemoveEvent(BattleEventName.RoleRealDead, _OnRoleRealDead)
  3749. -- BattleLogic.Event:RemoveEvent(BattleEventName.BattleRoundChange, onRoundChange)
  3750. end
  3751. end
  3752. BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, onRoundChange)
  3753. end,
  3754. -- 第[a]回合开始时,对敌方全体造成目标最大生命值[b]%的伤害,并有[c]%概率造成[d]效果,持续[e]回合。
  3755. -- a[int],b[float],c[float],d[控制类型],e[int]
  3756. [216] = function(role, args)
  3757. if PassiveManager.passiveCountList[role.camp][216] and PassiveManager.passiveCountList[role.camp][216] > 0 then
  3758. return
  3759. end
  3760. PassiveManager.passiveCountList[role.camp][216] = 1
  3761. local i1 = args[1]
  3762. local f1 = args[2]
  3763. local f2 = args[3]
  3764. local ctrl = args[4]
  3765. local i2 = args[5]
  3766. local function onRoundChange(curRound)
  3767. if curRound == i1 then
  3768. local list = RoleManager.Query(function(r) return r.camp ~= role.camp end)
  3769. for _, r in ipairs(list) do
  3770. --
  3771. local dd = floor(BattleUtil.ErrorCorrection(r:GetRoleData(RoleDataName.MaxHp)* f1))
  3772. local das = BattleUtil.PreCountShield(r, dd) -- 计算护盾吸收后的伤害值
  3773. local hp = r:GetRoleData(RoleDataName.Hp)
  3774. -- 有瑕疵,百分比减伤盾可能出现剩余血量不为1的问题
  3775. if das > hp then -- 护盾后伤害值依然致死
  3776. dd = dd - das + hp - 1
  3777. end
  3778. BattleUtil.ApplyDamage(nil, role, r, dd)
  3779. --概率控制
  3780. BattleUtil.RandomControl(f2, ctrl, role, r, i2)
  3781. end
  3782. end
  3783. end
  3784. BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, onRoundChange)
  3785. end,
  3786. -- 战斗结束时,恢复自身[a]的损失血量
  3787. -- a[float]
  3788. [217] = function(role, args)
  3789. local f1 = args[1]
  3790. local function onBeforeBattleEnd()
  3791. if not role:IsDead() then
  3792. local maxHp = BattleUtil.ErrorCorrection(role:GetRoleData(RoleDataName.MaxHp))
  3793. local hp = BattleUtil.ErrorCorrection(role:GetRoleData(RoleDataName.Hp))
  3794. local dd = floor((maxHp - hp) * f1)
  3795. BattleUtil.ApplyTreat(role, role, dd)
  3796. end
  3797. end
  3798. BattleLogic.Event:AddEvent(BattleEventName.BeforeBattleEnd, onBeforeBattleEnd)
  3799. end,
  3800. --[218] 用 79实现
  3801. -- 敌方首次释放技能时,自身获得[a]*[b]的护盾,持续[c]回合
  3802. -- a[属性],b[float],c[int]
  3803. [219] = function(role, args)
  3804. local pro = args[1]
  3805. local f1 = args[2]
  3806. local i1 = args[3]
  3807. local counter = 0
  3808. local function _OnSkillCast(skill)
  3809. if counter == 0 and skill.owner.camp ~= role.camp and skill.type == BattleSkillType.Special then
  3810. local dd = floor(BattleUtil.ErrorCorrection(role:GetRoleData(BattlePropList[pro])*f1))
  3811. local buff = Buff.Create(skill.owner, BuffName.Shield, i1, ShieldTypeName.NormalReduce, dd, 0)
  3812. role:AddBuff(buff)
  3813. counter = counter + 1
  3814. -- BattleLogic.Event:RemoveEvent(BattleEventName.SkillCast, _OnSkillCast)
  3815. end
  3816. end
  3817. BattleLogic.Event:AddEvent(BattleEventName.SkillCast, _OnSkillCast)
  3818. end,
  3819. -- 每当敌方英雄死亡时,自身[d]改变[b]的[c],[g改变[e]的[f]
  3820. -- b[float],c[属性],d[改变类型],e[float],f[属性],g[改变类型]
  3821. [220] = function(role, args)
  3822. local f1 = args[1]
  3823. local pro1 = args[2]
  3824. local ct1 = args[3]
  3825. local f2 = args[4]
  3826. local pro2 = args[5]
  3827. local ct2 = args[6]
  3828. local function _OnRoleRealDead(deadRole)
  3829. if role.camp ~= deadRole.camp then
  3830. BattleUtil.AddProp(role, pro1, f1, ct1)
  3831. BattleUtil.AddProp(role, pro2, f2, ct2)
  3832. end
  3833. end
  3834. BattleLogic.Event:AddEvent(BattleEventName.RoleRealDead, _OnRoleRealDead)
  3835. end,
  3836. -- 我方武将造成伤害时,[a]概率降低目标[b]%的[c]。若同时拥有效果222,则降低的属性加给伤害者。
  3837. -- a[float],b[float],c[属性]
  3838. [221] = function(role, args)
  3839. local rand = args[1]
  3840. local f1 = args[2]
  3841. local pro = args[3]
  3842. role:AddBuff(Buff.Create(role, BuffName.Brand, 0, "YUAN")) -- 鸳
  3843. --
  3844. local function _OnRoleHit(target)
  3845. BattleUtil.RandomAction(rand, function()
  3846. local buff = Buff.Create(role, BuffName.PropertyChange, 0, BattlePropList[pro], f1, CountTypeName.Sub)
  3847. buff.cover = true
  3848. buff.maxLayer = 1
  3849. target:AddBuff(buff)
  3850. -- BattleUtil.AddProp(target, pro, f1, CountTypeName.Sub)
  3851. if BattleLogic.BuffMgr:HasBuff(role, BuffName.Brand, function(buff) return buff.flag == "YANG" end) then
  3852. local buff = Buff.Create(role, BuffName.PropertyChange, 0, BattlePropList[pro], f1, CountTypeName.Add)
  3853. buff.cover = true
  3854. buff.maxLayer = 1
  3855. role:AddBuff(buff)
  3856. -- BattleUtil.AddProp(role, pro, f1, CountTypeName.Add)
  3857. end
  3858. end)
  3859. end
  3860. role.Event:AddEvent(BattleEventName.RoleHit, _OnRoleHit)
  3861. end,
  3862. -- 我方武将造成伤害时,[a]概率降低目标[b]%的[c]。若同时拥有效果221,则降低的属性加给伤害者。
  3863. -- a[float],b[float],c[属性]
  3864. [222] = function(role, args)
  3865. local rand = args[1]
  3866. local f1 = args[2]
  3867. local pro = args[3]
  3868. role:AddBuff(Buff.Create(role, BuffName.Brand, 0, "YANG")) -- 鸯
  3869. --
  3870. local function _OnRoleHit(target)
  3871. BattleUtil.RandomAction(rand, function()
  3872. local buff = Buff.Create(role, BuffName.PropertyChange, 0, BattlePropList[pro], f1, CountTypeName.Sub)
  3873. buff.cover = true
  3874. buff.maxLayer = 1
  3875. target:AddBuff(buff)
  3876. -- BattleUtil.AddProp(target, pro, f1, CountTypeName.Sub)
  3877. if BattleLogic.BuffMgr:HasBuff(role, BuffName.Brand, function(buff) return buff.flag == "YUAN" end) then
  3878. local buff = Buff.Create(role, BuffName.PropertyChange, 0, BattlePropList[pro], f1, CountTypeName.Add)
  3879. buff.cover = true
  3880. buff.maxLayer = 1
  3881. role:AddBuff(buff)
  3882. -- BattleUtil.AddProp(role, pro, f1, CountTypeName.Add)
  3883. end
  3884. end)
  3885. end
  3886. role.Event:AddEvent(BattleEventName.RoleHit, _OnRoleHit)
  3887. end,
  3888. -- 普攻时,[a]概率附加[b]效果,每回合造成攻击[c]%的伤害,持续[d]秒。
  3889. -- a[float],b[持续伤害效果],c[float],d[int]
  3890. [223] = function(role, args)
  3891. local rand = args[1]
  3892. local dot = args[2]
  3893. local f1 = args[3]
  3894. local i1 = args[3]
  3895. local function _OnRoleHit(target, damage, _, finalDmg, _, skill)
  3896. -- BattleUtil.RandomDot(rand, dot, role, target, i1, 1, )
  3897. if skill and skill.type == BattleSkillType.Normal then
  3898. BattleUtil.RandomAction(rand, function()
  3899. target:AddBuff(Buff.Create(role, BuffName.DOT, i1, 1, dot, 2, f1))
  3900. end)
  3901. end
  3902. end
  3903. role.Event:AddEvent(BattleEventName.RoleHit, _OnRoleHit)
  3904. end,
  3905. -- 我方武将造成伤害时,[a]概率附加攻击[b]%的真伤。
  3906. -- a[float],b[float]
  3907. [224] = function(role, args)
  3908. local rand = args[1]
  3909. local f1 = args[2]
  3910. local function _OnRoleHit(target)
  3911. BattleUtil.RandomAction(rand, function()
  3912. -- local dd = floor(BattleUtil.ErrorCorrection(role:GetRoleData(RoleDataName.Attack)*f1))
  3913. BattleUtil.CalDamage(nil, role, target, 1, f1, 1)
  3914. end)
  3915. end
  3916. role.Event:AddEvent(BattleEventName.RoleHit, _OnRoleHit)
  3917. end,
  3918. --
  3919. [225] = function(role, args)
  3920. --王振兴添加
  3921. local f1 = args[1]
  3922. local pro1 = args[2]
  3923. local ct1 = args[3]
  3924. local maxNum = args[4]
  3925. -- 紫+橙
  3926. local num = OutDataManager.GetOutData(role.camp, OutDataName.MisteryLiquidUsedTimes)
  3927. num = min(maxNum, num)
  3928. BattleUtil.AddProp(role, pro1, f1 * num, ct1)
  3929. end,
  3930. -- 斩杀生命低于[a]的敌人
  3931. -- a[float]
  3932. [226] = function(role, args)
  3933. local f1 = args[1]
  3934. --
  3935. local onRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill)
  3936. if skill and not defRole:IsDead() then
  3937. -- 检测被动技能对秒杀参数得影响
  3938. local bf, kf = BattleUtil.CheckSeckill(f1, 0, role, defRole)
  3939. --
  3940. local ft = defRole:GetRoleData(RoleDataName.Hp)/defRole:GetRoleData(RoleDataName.MaxHp)
  3941. if ft < bf then
  3942. -- 秒杀
  3943. BattleUtil.Seckill(skill, role, defRole)
  3944. end
  3945. end
  3946. end
  3947. role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit)
  3948. end,
  3949. -- 杀敌回复自身[a]*[b]的血量
  3950. -- a[属性],b[float]
  3951. [227] = function(role, args)
  3952. local pro = args[1]
  3953. local f1 = args[2]
  3954. -- 杀敌回血
  3955. local onRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill)
  3956. if skill and defRole:IsDead() then
  3957. -- 回血
  3958. local dd = floor(BattleUtil.ErrorCorrection(role:GetRoleData(BattlePropList[pro])*f1))
  3959. BattleUtil.ApplyTreat(role, role, dd)
  3960. end
  3961. end
  3962. role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit)
  3963. end,
  3964. -- 敌人生命越高,造成的伤害越高,最高[a]%
  3965. -- a[float]
  3966. [228] = function(role, args)
  3967. local f1 = args[1]
  3968. local OnPassiveDamaging = function(damagingFunc, target, damage)
  3969. damagingFunc(-floor(BattleUtil.FP_Mul(f1, damage, BattleUtil.GetHPPencent(target))))
  3970. end
  3971. role.Event:AddEvent(BattleEventName.PassiveDamaging, OnPassiveDamaging)
  3972. end,
  3973. -- 自己血量越低,造成伤害越高,最多[a]%
  3974. -- a[float]
  3975. [229] = function(role, args)
  3976. local f1 = args[1]
  3977. local OnPassiveDamaging = function(damagingFunc, target, damage)
  3978. damagingFunc(-floor(BattleUtil.FP_Mul(f1, damage, 1 - BattleUtil.GetHPPencent(role))))
  3979. end
  3980. role.Event:AddEvent(BattleEventName.PassiveDamaging, OnPassiveDamaging)
  3981. end,
  3982. -- 同阵营只生效一次
  3983. -- 敌方武将[c]改变[a]的[b]
  3984. -- a[float],b[属性],c[改变类型]
  3985. [230] = function(role, args)
  3986. if PassiveManager.passiveCountList[role.camp][230] and PassiveManager.passiveCountList[role.camp][230] > 0 then
  3987. return
  3988. end
  3989. PassiveManager.passiveCountList[role.camp][230] = 1
  3990. local f1 = args[1]
  3991. local pro = args[2]
  3992. local ct = args[3]
  3993. local function _OnRoundChange(curRound)
  3994. if curRound == 1 then
  3995. local list = RoleManager.Query(function(r)
  3996. return r.camp ~= role.camp
  3997. end)
  3998. for _, r in ipairs(list) do
  3999. BattleUtil.AddProp(r, pro, f1, ct)
  4000. end
  4001. -- BattleLogic.Event:RemoveEvent(BattleEventName.BattleRoundChange, _OnRoundChange)
  4002. end
  4003. end
  4004. BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, _OnRoundChange)
  4005. end,
  4006. -- 我方[a]武将每回合[d]改变[b]的[c],可叠加
  4007. -- a[元素],b[float],c[属性],d[改变类型]
  4008. [231] = function(role, args)
  4009. local ele = args[1]
  4010. local f1 = args[2]
  4011. local pro = args[3]
  4012. local ct = args[4]
  4013. local function _OnRoundChange(curRound)
  4014. if role.element == ele then
  4015. BattleUtil.AddProp(role, pro, f1, ct)
  4016. end
  4017. end
  4018. BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, _OnRoundChange)
  4019. end,
  4020. -- 我方[a]武将每回合恢复[b]的损失血量
  4021. -- a[元素],b[float]
  4022. [232] = function(role, args)
  4023. local ele = args[1]
  4024. local f1 = args[2]
  4025. local function _OnRoundChange(curRound)
  4026. if role.element == ele then
  4027. local maxHp = BattleUtil.ErrorCorrection(role:GetRoleData(RoleDataName.MaxHp))
  4028. local hp = BattleUtil.ErrorCorrection(role:GetRoleData(RoleDataName.Hp))
  4029. local dd = floor((maxHp - hp) * f1)
  4030. BattleUtil.ApplyTreat(role, role, dd)
  4031. end
  4032. end
  4033. BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, _OnRoundChange)
  4034. end,
  4035. -- 我方[a]武将每回合获得[b]*[c]的护盾,持续[d]回合
  4036. -- a[元素],b[属性],c[float],d[int]
  4037. [233] = function(role, args)
  4038. local ele = args[1]
  4039. local pro = args[2]
  4040. local f1 = args[3]
  4041. local i1 = args[4]
  4042. local function _OnRoundChange(curRound)
  4043. if role.element == ele then
  4044. local dd = floor(BattleUtil.ErrorCorrection(role:GetRoleData(BattlePropList[pro])*f1))
  4045. local buff = Buff.Create(role, BuffName.Shield, i1, ShieldTypeName.NormalReduce, dd, 0)
  4046. role:AddBuff(buff)
  4047. end
  4048. end
  4049. BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, _OnRoundChange)
  4050. end,
  4051. -- 我方[a]武将每回合[b]概率回复[c]点怒气
  4052. -- a[元素],b[float],c[int]
  4053. [234] = function(role, args)
  4054. local ele = args[1]
  4055. local f1 = args[2]
  4056. local i1 = args[3]
  4057. local function _OnRoundChange(curRound)
  4058. if role.element == ele then
  4059. BattleUtil.RandomAction(f1, function()
  4060. role:AddRage(i1, CountTypeName.Add)
  4061. end)
  4062. end
  4063. end
  4064. BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, _OnRoundChange)
  4065. end,
  4066. -- 我方每有一个[a]武将,自身[d]改变[b]的[c],可叠加(第一回合开始时生效)
  4067. -- a[元素],b[float],c[属性],d[改变类型]
  4068. [235] = function(role, args)
  4069. local ele = args[1]
  4070. local f1 = args[2]
  4071. local pro = args[3]
  4072. local ct = args[4]
  4073. local function _OnRoundChange(curRound)
  4074. if curRound == 1 then
  4075. local list = RoleManager.Query(function(r)
  4076. return r.camp == role.camp and r.element == ele
  4077. end)
  4078. --
  4079. local num = #list
  4080. BattleUtil.AddProp(role, pro, f1*num, ct)
  4081. end
  4082. end
  4083. BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, _OnRoundChange)
  4084. end,
  4085. -- 猎妖之路专属
  4086. -- 根据同时拥有夜明珠的数量获得效果:2个:[c]改变[a]的[b];3个:[f]改变[d]的[e];4个:[i]改变[g]的[h]
  4087. -- a[float],b[属性],c[改变类型],d[float],e[属性],f[改变类型],g[float],h[属性],i[改变类型]
  4088. [237] = function(role, args)
  4089. local f1 = args[1]
  4090. local pro1 = args[2]
  4091. local ct1 = args[3]
  4092. local f2 = args[4]
  4093. local pro2 = args[5]
  4094. local ct2 = args[6]
  4095. local f3 = args[7]
  4096. local pro3 = args[8]
  4097. local ct3 = args[9]
  4098. local num = OutDataManager.GetOutData(role.camp, OutDataName.DarkGlowBallNum)
  4099. if num >= 2 then
  4100. BattleUtil.AddProp(role, pro1, f1, ct1)
  4101. end
  4102. if num >= 3 then
  4103. BattleUtil.AddProp(role, pro2, f2, ct2)
  4104. end
  4105. if num >= 4 then
  4106. BattleUtil.AddProp(role, pro3, f3, ct3)
  4107. end
  4108. end,
  4109. -- 猎妖之路专属
  4110. -- 在大闹天空的第[a]层中,我方武将[d]改变[b]的[c],[g改变[e]的[f]
  4111. -- a[位置],b[float],c[属性],d[改变类型],e[float],f[属性],g[改变类型]
  4112. [238] = function(role, args)
  4113. local flr = args[1]
  4114. local f1 = args[2]
  4115. local pro1 = args[3]
  4116. local ct1 = args[4]
  4117. local f2 = args[5]
  4118. local pro2 = args[6]
  4119. local ct2 = args[7]
  4120. if OutDataManager.GetOutData(role.camp, OutDataName.DaNaoTianGongFloor) == flr then
  4121. BattleUtil.AddProp(role, pro1, f1, ct1)
  4122. BattleUtil.AddProp(role, pro2, f2, ct2)
  4123. end
  4124. end,
  4125. -- 猎妖之路专属
  4126. -- 每有一件紫色品质以上的战利品,我方武将[d]改变[b]的[c],[g改变[e]的[f],最多[h]层
  4127. -- b[float],c[属性],d[改变类型],e[float],f[属性],g[改变类型],h[int]
  4128. [239] = function(role, args)
  4129. local f1 = args[1]
  4130. local pro1 = args[2]
  4131. local ct1 = args[3]
  4132. local f2 = args[4]
  4133. local pro2 = args[5]
  4134. local ct2 = args[6]
  4135. local maxNum = args[7]
  4136. -- 紫+橙
  4137. local num = OutDataManager.GetOutData(role.camp, OutDataName.PerpleGloryItemNum) + OutDataManager.GetOutData(role.camp, OutDataName.OrangeGloryItemNum)
  4138. num = min(maxNum, num)
  4139. BattleUtil.AddProp(role, pro1, f1 * num, ct1)
  4140. BattleUtil.AddProp(role, pro2, f2 * num, ct2)
  4141. end,
  4142. -- 猎妖之路专属
  4143. -- 每使用一次神秘药水,我方武将[c]改变[a]的[b],最多[d]层
  4144. -- a[float],b[属性],c[改变类型],d[int]
  4145. [240] = function(role, args)
  4146. local f1 = args[1]
  4147. local pro1 = args[2]
  4148. local ct1 = args[3]
  4149. local maxNum = args[4]
  4150. -- 紫+橙
  4151. local num = OutDataManager.GetOutData(role.camp, OutDataName.MisteryLiquidUsedTimes)
  4152. num = min(maxNum, num)
  4153. BattleUtil.AddProp(role, pro1, f1 * num, ct1)
  4154. end,
  4155. -- 每当友方英雄死亡时,自身[d]改变[b]的[c],[g]改变[e]的[f]
  4156. -- b[float],c[属性],d[改变类型],e[float],f[属性],g[改变类型]
  4157. [241] = function(role, args)
  4158. local f1 = args[1]
  4159. local pro1 = args[2]
  4160. local ct1 = args[3]
  4161. local f2 = args[4]
  4162. local pro2 = args[5]
  4163. local ct2 = args[6]
  4164. local function _OnRoleRealDead(deadRole)
  4165. if role.camp == deadRole.camp then
  4166. BattleUtil.AddProp(role, pro1, f1, ct1)
  4167. BattleUtil.AddProp(role, pro2, f2, ct2)
  4168. end
  4169. end
  4170. BattleLogic.Event:AddEvent(BattleEventName.RoleRealDead, _OnRoleRealDead)
  4171. end,
  4172. --> 战斗开始时, 敌方所有人[a]属性[b]改变[c], 持续[d]回合
  4173. [304] = function(role, args)
  4174. local _a = args[1]
  4175. local _b = args[2]
  4176. local _c = args[3]
  4177. local _d = args[4]
  4178. local function _OnRoundChange(curRound)
  4179. if curRound == 1 then
  4180. local list = RoleManager.Query(function(r)
  4181. return r.camp ~= role.camp
  4182. end)
  4183. for _, r in ipairs(list) do
  4184. r:AddBuff(Buff.Create(role, BuffName.PropertyChange, _d, BattlePropList[_a], _c, _b))
  4185. end
  4186. end
  4187. end
  4188. BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, _OnRoundChange)
  4189. end,
  4190. --> 战斗开始时, 己方所有人[a]属性[b]改变[c], 持续[d]回合
  4191. [327] = function(role, args)
  4192. local _a = args[1]
  4193. local _b = args[2]
  4194. local _c = args[3]
  4195. local _d = args[4]
  4196. local function _OnRoundChange(curRound)
  4197. if curRound == 1 then
  4198. local list = RoleManager.Query(function(r)
  4199. return r.camp == role.camp
  4200. end)
  4201. for _, r in ipairs(list) do
  4202. r:AddBuff(Buff.Create(role, BuffName.PropertyChange, _d, BattlePropList[_a], _c, _b))
  4203. end
  4204. end
  4205. end
  4206. BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, _OnRoundChange)
  4207. end,
  4208. --> 每回合开始时, 若自己血量大于50%, 则自己[a]属性[b]改变[c], 反之则[d]属性[e]改变[f]
  4209. [300] = function(role, args)
  4210. local _a = args[1]
  4211. local _b = args[2]
  4212. local _c = args[3]
  4213. local _d = args[4]
  4214. local _e = args[5]
  4215. local _f = args[6]
  4216. local function _OnRoundChange(curRound)
  4217. if role:GetRoleData(RoleDataName.Hp) > BattleUtil.ErrorCorrection(role:GetRoleData(RoleDataName.MaxHp) / 2) then
  4218. BattleUtil.AddProp(role, _a, _c, _b)
  4219. else
  4220. BattleUtil.AddProp(role, _d, _f, _e)
  4221. end
  4222. end
  4223. BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, _OnRoundChange)
  4224. end,
  4225. --> 攻击时, 有[a]概率使[b]目标的[c]属性[d]改变[e], 持续[f]回合
  4226. [324] = function(role, args)
  4227. local _a = args[1]
  4228. local _b = args[2]
  4229. local _c = args[3]
  4230. local _d = args[4]
  4231. local _e = args[5]
  4232. local _f = args[6]
  4233. local onRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill)
  4234. BattleUtil.RandomAction(_a, function()
  4235. if skill and defRole:IsDead() then
  4236. if _b == 1 then
  4237. defRole:AddBuff(Buff.Create(role, BuffName.PropertyChange, _f, BattlePropList[_c], _e, _d))
  4238. elseif _b == 2 then
  4239. role:AddBuff(Buff.Create(role, BuffName.PropertyChange, _f, BattlePropList[_c], _e, _d))
  4240. elseif _b == 3 then
  4241. defRole:AddBuff(Buff.Create(role, BuffName.PropertyChange, _f, BattlePropList[_c], _e, _d))
  4242. role:AddBuff(Buff.Create(role, BuffName.PropertyChange, _f, BattlePropList[_c], _e, _d))
  4243. end
  4244. end
  4245. end)
  4246. end
  4247. role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit)
  4248. end,
  4249. --> 攻击时, 目标若有[a]控制状态, 则[b]目标[c]属性临时[d]改变[e]
  4250. [305] = function(role, args)
  4251. local _a = args[1]
  4252. local _b = args[2]
  4253. local _c = args[3]
  4254. local _d = args[4]
  4255. local _e = args[5]
  4256. local onRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill)
  4257. if BattleLogic.BuffMgr:HasBuff(defRole, BuffName.Control, function(buff) return (buff.ctrlType == _a or _a == 0) end) then
  4258. if _b == 1 then
  4259. BattleUtil.AddProp(defRole, _c, _e, _d)
  4260. elseif _b == 2 then
  4261. BattleUtil.AddProp(role, _c, _e, _d)
  4262. elseif _b == 3 then
  4263. BattleUtil.AddProp(defRole, _c, _e, _d)
  4264. BattleUtil.AddProp(role, _c, _e, _d)
  4265. end
  4266. end
  4267. end
  4268. role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit)
  4269. end,
  4270. --> 攻击时, 目标若有[a]属性状态, 则[b]目标[c]属性临时[d]改变[e]
  4271. [307] = function(role, args)
  4272. local _a = args[1]
  4273. local _b = args[2]
  4274. local _c = args[3]
  4275. local _d = args[4]
  4276. local _e = args[5]
  4277. local onRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill)
  4278. if BattleLogic.BuffMgr:HasBuff(defRole, BuffName.PropertyChange, function(buff) return (buff.propertyChangeType == _a or _a == 0) end) then
  4279. if _b == 1 then
  4280. BattleUtil.AddProp(defRole, _c, _e, _d)
  4281. elseif _b == 2 then
  4282. BattleUtil.AddProp(role, _c, _e, _d)
  4283. elseif _b == 3 then
  4284. BattleUtil.AddProp(defRole, _c, _e, _d)
  4285. BattleUtil.AddProp(role, _c, _e, _d)
  4286. end
  4287. end
  4288. end
  4289. role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit)
  4290. end,
  4291. --> 攻击时, 技能目标被"冰封结界"冰冻概率变为[a],每当目标被附加[c]控制状态或[d]属性状态时, 增加自己[e]和[f]属性[g],持续[h]回合(可叠加10层),如果目标的[i]控制状态被解除, 会对全体敌方单位造成自己攻击力[j]的[k]伤害
  4292. [308] = function(role, args)
  4293. local _a = args[1]
  4294. local _b = args[2]
  4295. local _c = args[3]
  4296. local _d = args[4]
  4297. local _e = args[5]
  4298. end,
  4299. --> 攻击时, 若目标存在[a]或[b]持续伤害状态, 则[c]目标的[d]属性临时[e]改变[f]
  4300. [309] = function(role, args)
  4301. local _a = args[1]
  4302. local _b = args[2]
  4303. local _c = args[3]
  4304. local _d = args[4]
  4305. local _e = args[5]
  4306. local _f = args[6]
  4307. local onRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill)
  4308. if BattleLogic.BuffMgr:HasBuff(defRole, BuffName.DOT, function(buff) return (buff.damageType == _a or buff.damageType == _b) end) then
  4309. if _c == 1 then
  4310. BattleUtil.AddProp(defRole, _d, _f, _e)
  4311. elseif _c == 2 then
  4312. BattleUtil.AddProp(role, _d, _f, _e)
  4313. elseif _c == 3 then
  4314. BattleUtil.AddProp(defRole, _d, _f, _e)
  4315. BattleUtil.AddProp(role, _d, _f, _e)
  4316. end
  4317. end
  4318. end
  4319. role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit)
  4320. end,
  4321. --> 攻击时, 有[a]概率为目标附加1个【标识】,最多[b]层,每个【标识】使自己的[c]属性[d]改变[e], [f]个及以上【标识】使携带者的[g]属性[h]改变[i]
  4322. [320] = function(role, args)
  4323. local _a = args[1]
  4324. local _b = args[2]
  4325. local _c = args[3]
  4326. local _d = args[4]
  4327. local _e = args[5]
  4328. local _f = args[6]
  4329. local _g = args[7]
  4330. local _h = args[8]
  4331. local _i = args[9]
  4332. local onRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill)
  4333. BattleUtil.RandomAction(_a, function()
  4334. local buf = nil
  4335. if BattleLogic.BuffMgr:HasBuff(defRole, BuffName.Brand, function(buff)
  4336. local b = buff.flag == "biaoshi320"
  4337. if b then
  4338. buf = buff
  4339. end
  4340. return b
  4341. end)
  4342. then
  4343. if buf.layer < _b then
  4344. buf.layer = buf.layer + 1
  4345. if buf.pro1Arr[buf.layer] == nil then
  4346. BattleUtil.AddProp(defRole, _c, _e, _d)
  4347. buf.pro1Arr[buf.layer] = 1
  4348. end
  4349. if buf.layer >= _f then
  4350. for i = 1, buf.layer do
  4351. if buf.pro2Arr[i] == nil then
  4352. BattleUtil.AddProp(defRole, _g, _i, _h)
  4353. buf.pro2Arr[i] = 1
  4354. end
  4355. end
  4356. end
  4357. end
  4358. else
  4359. local brand = Buff.Create(defRole, BuffName.Brand, 0, "biaoshi320")
  4360. brand.maxLayer = _b
  4361. brand.clear = false
  4362. brand.pro1Arr = {}
  4363. brand.pro2Arr = {}
  4364. BattleUtil.AddProp(defRole, _c, _e, _d)
  4365. brand.pro1Arr[brand.layer] = 1
  4366. brand.endFunc = function ()
  4367. buf = nil
  4368. end
  4369. defRole:AddBuff(brand)
  4370. end
  4371. end)
  4372. end
  4373. role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit)
  4374. end,
  4375. --> 攻击时, 若目标的生命大于等于[a], 则[b]目标的[c]属性临时[d]改变[e]
  4376. [321] = function(role, args)
  4377. local _a = args[1]
  4378. local _b = args[2]
  4379. local _c = args[3]
  4380. local _d = args[4]
  4381. local _e = args[5]
  4382. local onRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill)
  4383. local hpPercent = BattleUtil.ErrorCorrection(defRole:GetRoleData(RoleDataName.Hp) / defRole:GetRoleData(RoleDataName.MaxHp))
  4384. if hpPercent >= _a then
  4385. if _b == 1 then
  4386. BattleUtil.AddProp(defRole, _c, _e, _d)
  4387. elseif _b == 2 then
  4388. BattleUtil.AddProp(role, _c, _e, _d)
  4389. elseif _b == 3 then
  4390. BattleUtil.AddProp(defRole, _c, _e, _d)
  4391. BattleUtil.AddProp(role, _c, _e, _d)
  4392. end
  4393. end
  4394. end
  4395. role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit)
  4396. end,
  4397. --> 攻击时, 若目标的生命小于[a], 则[b]目标的[c]属性临时[d]改变[e]
  4398. [345] = function(role, args)
  4399. local _a = args[1]
  4400. local _b = args[2]
  4401. local _c = args[3]
  4402. local _d = args[4]
  4403. local _e = args[5]
  4404. local onRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill)
  4405. local hpPercent = BattleUtil.ErrorCorrection(defRole:GetRoleData(RoleDataName.Hp) / defRole:GetRoleData(RoleDataName.MaxHp))
  4406. if hpPercent < _a then
  4407. if _b == 1 then
  4408. BattleUtil.AddProp(defRole, _c, _e, _d)
  4409. elseif _b == 2 then
  4410. BattleUtil.AddProp(role, _c, _e, _d)
  4411. elseif _b == 3 then
  4412. BattleUtil.AddProp(defRole, _c, _e, _d)
  4413. BattleUtil.AddProp(role, _c, _e, _d)
  4414. end
  4415. end
  4416. end
  4417. role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit)
  4418. end,
  4419. --> 攻击时, 若目标的生命小于[a], 则[b]概率为[c]目标附加[d]属性状态, [e]改变[f], 持续[g]回合
  4420. [322] = function(role, args)
  4421. local _a = args[1]
  4422. local _b = args[2]
  4423. local _c = args[3]
  4424. local _d = args[4]
  4425. local _e = args[5]
  4426. local _f = args[6]
  4427. local _g = args[7]
  4428. local onRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill)
  4429. local hpPercent = BattleUtil.ErrorCorrection(defRole:GetRoleData(RoleDataName.Hp) / defRole:GetRoleData(RoleDataName.MaxHp))
  4430. if hpPercent < _a then
  4431. BattleUtil.RandomAction(_b, function()
  4432. if skill and defRole:IsDead() then
  4433. if _c == 1 then
  4434. defRole:AddBuff(Buff.Create(role, BuffName.PropertyChange, _g, PropertyChangeTypeMap[_d], _f, _e, _d))
  4435. elseif _c == 2 then
  4436. role:AddBuff(Buff.Create(role, BuffName.PropertyChange, _g, PropertyChangeTypeMap[_d], _f, _e, _d))
  4437. elseif _c == 3 then
  4438. defRole:AddBuff(Buff.Create(role, BuffName.PropertyChange, _g, PropertyChangeTypeMap[_d], _f, _e, _d))
  4439. role:AddBuff(Buff.Create(role, BuffName.PropertyChange, _g, PropertyChangeTypeMap[_d], _f, _e, _d))
  4440. end
  4441. end
  4442. end)
  4443. end
  4444. end
  4445. role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit)
  4446. end,
  4447. --> 攻击时, 若目标的速度小于自己, 则[a]目标的[b]属性临时[c]改变[d]
  4448. [326] = function(role, args)
  4449. local _a = args[1]
  4450. local _b = args[2]
  4451. local _c = args[3]
  4452. local _d = args[4]
  4453. local onRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill)
  4454. if defRole:GetRoleData(RoleDataName.Speed) < role:GetRoleData(RoleDataName.Speed) then
  4455. if _a == 1 then
  4456. BattleUtil.AddProp(defRole, _b, _d, _c)
  4457. elseif _a == 2 then
  4458. BattleUtil.AddProp(role, _b, _d, _c)
  4459. elseif _a == 3 then
  4460. BattleUtil.AddProp(defRole, _b, _d, _c)
  4461. BattleUtil.AddProp(role, _b, _d, _c)
  4462. end
  4463. end
  4464. end
  4465. role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit)
  4466. end,
  4467. --> 攻击时, 若目标是[a]阵营, 则[b]目标的[c]属性临时[d]改变[e]
  4468. [342] = function(role, args)
  4469. local _a = args[1]
  4470. local _b = args[2]
  4471. local _c = args[3]
  4472. local _d = args[4]
  4473. local _e = args[5]
  4474. local onRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill)
  4475. if defRole.roleData.element == _a then
  4476. if _b == 1 then
  4477. BattleUtil.AddProp(defRole, _c, _e, _d)
  4478. elseif _b == 2 then
  4479. BattleUtil.AddProp(role, _c, _e, _d)
  4480. elseif _b == 3 then
  4481. BattleUtil.AddProp(defRole, _c, _e, _d)
  4482. BattleUtil.AddProp(role, _c, _e, _d)
  4483. end
  4484. end
  4485. end
  4486. role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit)
  4487. end,
  4488. --> 攻击时, 有[a]概率清除任意己方单位的一个[b]清除状态, 并为其附加一层【魔种】, 最多[c]层, 每层魔种使携带者[d]属性[e]改变[f], 无法驱散一直存在
  4489. [349] = function(role, args)
  4490. local _a = args[1]
  4491. local _b = args[2]
  4492. local _c = args[3]
  4493. local _d = args[4]
  4494. local _e = args[5]
  4495. local _f = args[6]
  4496. local onRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill)
  4497. BattleUtil.RandomAction(_a, function()
  4498. BattleLogic.BuffMgr:ClearBuff(target, function (buff)
  4499. return clearBuffPredicate(buff, _b)
  4500. end)
  4501. local buf = nil
  4502. if BattleLogic.BuffMgr:HasBuff(defRole, BuffName.Brand, function(buff)
  4503. local b = buff.flag == "mozhong349"
  4504. if b then
  4505. buf = buff
  4506. end
  4507. return b
  4508. end)
  4509. then
  4510. if buf.layer < _c then
  4511. buf.layer = buf.layer + 1
  4512. if buf.pro1Arr[buf.layer] == nil then
  4513. BattleUtil.AddProp(defRole, _d, _f, _e)
  4514. buf.pro1Arr[buf.layer] = 1
  4515. end
  4516. end
  4517. else
  4518. local brand = Buff.Create(defRole, BuffName.Brand, 0, "mozhong349")
  4519. brand.maxLayer = _c
  4520. brand.clear = false
  4521. brand.pro1Arr = {}
  4522. BattleUtil.AddProp(defRole, _d, _f, _e)
  4523. brand.pro1Arr[brand.layer] = 1
  4524. brand.endFunc = function ()
  4525. buf = nil
  4526. end
  4527. defRole:AddBuff(brand)
  4528. end
  4529. end)
  4530. end
  4531. role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit)
  4532. end,
  4533. --> 攻击后, 自己的[a]属性[b]改变[c],可叠加,持续[d]回合
  4534. [301] = function(role, args)
  4535. local _a = args[1]
  4536. local _b = args[2]
  4537. local _c = args[3]
  4538. local _d = args[4]
  4539. local onRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill)
  4540. local buff = Buff.Create(role, BuffName.PropertyChange, _d, BattlePropList[_a], _c, _b)
  4541. buff.cover = true
  4542. buff.maxLayer = NormalMaxLayer
  4543. defRole:AddBuff(buff)
  4544. end
  4545. role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit)
  4546. end,
  4547. --> 释放[a]号技能时, 有[b]概率使技能目标的[c]属性[d]改变[e], 可叠加, 持续[f]回合
  4548. [306] = function(role, args)
  4549. local _a = args[1]
  4550. local _b = args[2]
  4551. local _c = args[3]
  4552. local _d = args[4]
  4553. local _e = args[5]
  4554. local _f = args[6]
  4555. local OnSkillCast = function(skill)
  4556. if skill.ext_slot == _a then
  4557. BattleUtil.RandomAction(_b, function ()
  4558. local targets = skill:GetDirectTargets()
  4559. if not targets or #targets == 0 then return end
  4560. for _, target in ipairs(targets) do
  4561. local buff = Buff.Create(role, BuffName.PropertyChange, _f, BattlePropList[_c], _e, _d)
  4562. buff.cover = true
  4563. buff.maxLayer = NormalMaxLayer
  4564. target:AddBuff(buff)
  4565. end
  4566. end)
  4567. end
  4568. end
  4569. role.Event:AddEvent(BattleEventName.SkillCast, OnSkillCast)
  4570. end,
  4571. --> 释放[a]号技能时, 若目标是[b]阵营, 则[c]目标的[d]属性临时[e]改变[f]
  4572. [310] = function(role, args)
  4573. local _a = args[1]
  4574. local _b = args[2]
  4575. local _c = args[3]
  4576. local _d = args[4]
  4577. local _e = args[5]
  4578. local _f = args[6]
  4579. local OnSkillCast = function(skill)
  4580. if skill.ext_slot == _a then
  4581. local targets = skill:GetDirectTargets()
  4582. if not targets or #targets == 0 then return end
  4583. for _, target in ipairs(targets) do
  4584. if target.roleData.element == _b then
  4585. BattleUtil.AddProp(target, _d, _f, _e)
  4586. end
  4587. end
  4588. end
  4589. end
  4590. role.Event:AddEvent(BattleEventName.SkillCast, OnSkillCast)
  4591. end,
  4592. --> 释放[a]号技能时, 若目标是[b]阵营, 则有[c]概率为目标附加[d]控制状态,持续[e]回合
  4593. [311] = function(role, args)
  4594. local _a = args[1]
  4595. local _b = args[2]
  4596. local _c = args[3]
  4597. local _d = args[4]
  4598. local _e = args[5]
  4599. local _f = args[6]
  4600. local OnSkillCast = function(skill)
  4601. if skill.ext_slot == _a then
  4602. local targets = skill:GetDirectTargets()
  4603. if not targets or #targets == 0 then return end
  4604. for _, target in ipairs(targets) do
  4605. if target.roleData.element == _b then
  4606. BattleUtil.RandomControl(_c, _d, role, target, _e)
  4607. end
  4608. end
  4609. end
  4610. end
  4611. role.Event:AddEvent(BattleEventName.SkillCast, OnSkillCast)
  4612. end,
  4613. --> 释放[a]号技能时, 若击杀目标, 则[b]几率使目标无法复活
  4614. [323] = function(role, args)
  4615. local _a = args[1]
  4616. local _b = args[2]
  4617. local OnRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill)
  4618. if defRole:IsDead() then
  4619. BattleUtil.RandomAction(_b, function()
  4620. defRole:SetReliveFilter(false)
  4621. end)
  4622. end
  4623. end
  4624. local OnSkillCast = function(skill)
  4625. if skill.ext_slot == _a then
  4626. role.Event:AddEvent(BattleEventName.RoleHit, OnRoleHit)
  4627. end
  4628. end
  4629. role.Event:AddEvent(BattleEventName.SkillCast, OnSkillCast)
  4630. local OnSkillCastEnd = function(skill)
  4631. if skill.ext_slot == _a then
  4632. role.Event:RemoveEvent(BattleEventName.RoleHit, OnRoleHit)
  4633. end
  4634. end
  4635. role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
  4636. end,
  4637. --> 释放[a]号技能时, 有[b]概率对处目标外的随机[c]个敌方单位造成攻击[d]的[e]伤害
  4638. [333] = function(role, args)
  4639. local _a = args[1]
  4640. local _b = args[2]
  4641. local _c = args[3]
  4642. local _d = args[4]
  4643. local _e = args[5]
  4644. local OnSkillCast = function(skill)
  4645. if skill.ext_slot == _a then
  4646. BattleUtil.RandomAction(_b, function()
  4647. local targets = skill:GetDirectTargets()
  4648. if not targets or #targets == 0 then return end
  4649. local list = RoleManager.Query(function(v) return role.camp ~= v.camp end)
  4650. local otherRole = {}
  4651. for index, value in ipairs(list) do
  4652. local isHave = false
  4653. for _, target in ipairs(targets) do
  4654. if value == target then
  4655. isHave = true
  4656. end
  4657. end
  4658. if not isHave then
  4659. table.insert(otherRole, value)
  4660. end
  4661. end
  4662. if #otherRole > 0 then
  4663. Random.RandomList(otherRole)
  4664. local num = math.min(_c, #otherRole)
  4665. for i = 1, num do
  4666. if otherRole[i] then
  4667. BattleUtil.ApplyDamage(nil, role, otherRole[i], floor(otherRole[i]:GetRoleData(RoleDataName.Attack) * _d))
  4668. end
  4669. end
  4670. end
  4671. end)
  4672. end
  4673. end
  4674. role.Event:AddEvent(BattleEventName.SkillCast, OnSkillCast)
  4675. end,
  4676. --> 释放[a]号技能时, 有[b]概率使[c]目标附加[d]控制状态, , 持续[e]回合
  4677. [334] = function(role, args)
  4678. local _a = args[1]
  4679. local _b = args[2]
  4680. local _c = args[3]
  4681. local _d = args[4]
  4682. local _e = args[5]
  4683. local OnSkillCast = function(skill)
  4684. if skill.ext_slot == _a then
  4685. local target1 = function()
  4686. BattleUtil.RandomAction(_b, function()
  4687. local targets = skill:GetDirectTargets()
  4688. if not targets or #targets == 0 then return end
  4689. for _, target in ipairs(targets) do
  4690. if target.roleData.element == _b then
  4691. BattleUtil.RandomControl(1, _d, role, target, _e)
  4692. end
  4693. end
  4694. end)
  4695. end
  4696. local target2 = function()
  4697. BattleUtil.RandomAction(_b, function()
  4698. BattleUtil.RandomControl(1, _d, role, role, _e)
  4699. end)
  4700. end
  4701. if _c == 1 then
  4702. target1()
  4703. elseif _c == 2 then
  4704. target2()
  4705. elseif _c == 3 then
  4706. target1()
  4707. target2()
  4708. end
  4709. end
  4710. end
  4711. role.Event:AddEvent(BattleEventName.SkillCast, OnSkillCast)
  4712. end,
  4713. --> 受到攻击时, [a]概率触发【反击】,对攻击者造成攻击[b]的[c]型伤害
  4714. [302] = function(role, args)
  4715. local _a = args[1]
  4716. local _b = args[2]
  4717. local _c = args[3]
  4718. local _d = args[4]
  4719. local _e = args[5]
  4720. end,
  4721. --> 受到攻击时, [a]概率为攻击者附加[b]持续伤害状态, 每回合减少相当于施法者[c]属性[d]的生命, 持续[e]回合
  4722. [315] = function(role, args)
  4723. local _a = args[1]
  4724. local _b = args[2]
  4725. local _c = args[3]
  4726. local _d = args[4]
  4727. local _e = args[5]
  4728. local OnBeHit = function(atkRole, damage, bCrit, finalDmg, damageType)
  4729. BattleUtil.RandomAction(_a, function ()
  4730. local hitblood = floor(role:GetRoleData(BattlePropList[_c]) * _d)
  4731. local dot = Buff.Create(role, BuffName.DOT, _e, 1, _b, hitblood, 1)
  4732. dot.isRealDamage = true
  4733. atkRole:AddBuff(dot)
  4734. end)
  4735. end
  4736. role.Event:AddEvent(BattleEventName.RoleBeHit, OnBeHit)
  4737. end,
  4738. --> 受到攻击时, 如果目标是[a]职业, 则[b]属性临时[c]改变[d]
  4739. [303] = function(role, args)
  4740. local _a = args[1]
  4741. local _b = args[2]
  4742. local _c = args[3]
  4743. local _d = args[4]
  4744. local OnBeHit = function(atkRole, damage, bCrit, finalDmg, damageType)
  4745. if atkRole.roleData.professionId == _a then
  4746. BattleUtil.AddProp(role, _b, _d, _c)
  4747. end
  4748. end
  4749. role.Event:AddEvent(BattleEventName.RoleBeHit, OnBeHit)
  4750. end,
  4751. --> 受到攻击时, 增加[a]点怒气, 最多[b]点怒气
  4752. [318] = function(role, args)
  4753. local _a = args[1]
  4754. local _b = args[2]
  4755. local OnBeHit = function(atkRole, damage, bCrit, finalDmg, damageType)
  4756. local buf = nil
  4757. if BattleLogic.BuffMgr:HasBuff(role, BuffName.Brand, function(buff)
  4758. local b = buff.flag == "nuqi318"
  4759. if b then
  4760. buf = buff
  4761. end
  4762. return b
  4763. end)
  4764. then
  4765. if buf.layer < _b then
  4766. buf.layer = buf.layer + _a
  4767. end
  4768. else
  4769. local brand = Buff.Create(role, BuffName.Brand, 0, "nuqi318")
  4770. brand.layer = _a
  4771. brand.maxLayer = _b
  4772. brand.endFunc = function ()
  4773. buf = nil
  4774. end
  4775. role:AddBuff(brand)
  4776. end
  4777. end
  4778. role.Event:AddEvent(BattleEventName.RoleBeHit, OnBeHit)
  4779. end,
  4780. --> 受到攻击时, 伤害不会超过自己[a]属性的[b]
  4781. [331] = function(role, args)
  4782. local _a = args[1]
  4783. local _b = args[2]
  4784. local function onFinalBeDamage(damagingFunc, atkRole, damage, skill, dotType, bCrit, damageType)
  4785. local maxDamage = floor(role:GetRoleData(BattlePropList[_a]) * _b)
  4786. if damage > maxDamage then
  4787. -- 计算免除的伤害值
  4788. local md = damage - maxDamage
  4789. if damagingFunc then damagingFunc(md) end
  4790. end
  4791. end
  4792. role.Event:AddEvent(BattleEventName.FinalBeDamage, onFinalBeDamage)
  4793. end,
  4794. --> 受到攻击时, 有[a]概率给攻击者附加【诅咒】, 在[b]回合后给攻击者造成受击者[c]属性[d]的伤害, 诅咒可同时存在多个
  4795. [346] = function(role, args)
  4796. local _a = args[1]
  4797. local _b = args[2]
  4798. local _c = args[3]
  4799. local _d = args[4]
  4800. local OnBeHit = function(atkRole, damage, bCrit, finalDmg, damageType)
  4801. BattleUtil.RandomAction(_a, function()
  4802. local auraBuff = Buff.Create(role, BuffName.Aura, _b, function (target)
  4803. BattleUtil.ApplyDamage(nil, role, atkRole, floor(role:GetRoleData(BattlePropList[_c]) * _d))
  4804. end)
  4805. auraBuff.interval = _b
  4806. atkRole:AddBuff(auraBuff)
  4807. end)
  4808. end
  4809. role.Event:AddEvent(BattleEventName.RoleBeHit, OnBeHit)
  4810. end,
  4811. --> 普通攻击时, 有[a]概率为[b]目标附加[c]属性状态, [d]改变[e], 持续[f]回合
  4812. [330] = function(role, args)
  4813. local _a = args[1]
  4814. local _b = args[2]
  4815. local _c = args[3]
  4816. local _d = args[4]
  4817. local _e = args[5]
  4818. local _f = args[6]
  4819. local OnRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill)
  4820. if skill.ext_slot == 0 then
  4821. if not defRole:IsDead() then
  4822. BattleUtil.RandomAction(_a, function()
  4823. defRole:AddBuff(Buff.Create(role, BuffName.PropertyChange, _f, PropertyChangeTypeMap[_c], _e, _d, _c))
  4824. end)
  4825. end
  4826. end
  4827. end
  4828. role.Event:AddEvent(BattleEventName.RoleHit, OnRoleHit)
  4829. end,
  4830. --> 普通攻击时, 为己方生命最低的单位恢复相当于自身[a]属性[b]的生命
  4831. [329] = function(role, args)
  4832. local _a = args[1]
  4833. local _b = args[2]
  4834. local OnRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill)
  4835. if skill.ext_slot == 0 then
  4836. local list = RoleManager.Query(function(v) return role.camp == v.camp end)
  4837. if list and #list > 0 then
  4838. local livemin = nil
  4839. local minhp = 100000000
  4840. for _, r in pairs(list) do
  4841. local hp = r:GetRoleData(RoleDataName.Hp)
  4842. if hp < minhp then
  4843. minhp = hp
  4844. livemin = r
  4845. end
  4846. end
  4847. local hp = floor(role:GetRoleData(BattlePropList[_a]) * _b)
  4848. if livemin then
  4849. BattleUtil.ApplyTreat(role, livemin, hp)
  4850. end
  4851. end
  4852. end
  4853. end
  4854. role.Event:AddEvent(BattleEventName.RoleHit, OnRoleHit)
  4855. end,
  4856. --> 普通攻击时, 有[a]概率给目标附加【诅咒】, 在[b]回合后给携带者造成施法者[c]属性[d]的伤害, 诅咒可同时存在多个
  4857. [344] = function(role, args)
  4858. local _a = args[1]
  4859. local _b = args[2]
  4860. local _c = args[3]
  4861. local _d = args[4]
  4862. local OnRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill)
  4863. if skill.ext_slot == 0 then
  4864. BattleUtil.RandomAction(_a, function()
  4865. local auraBuff = Buff.Create(role, BuffName.Aura, _b, function (target)
  4866. local hurthp = floor(role:GetRoleData(BattlePropList[_c]) * _d)
  4867. local onDamage = function(changefactor)
  4868. hurthp = hurthp - changefactor
  4869. end
  4870. role.Event:DispatchEvent(BattleEventName.BuffAuraTrigger, onDamage, skill)
  4871. BattleUtil.ApplyDamage(nil, role, defRole, hurthp)
  4872. end)
  4873. auraBuff.interval = _b
  4874. defRole:AddBuff(auraBuff)
  4875. end)
  4876. end
  4877. end
  4878. role.Event:AddEvent(BattleEventName.RoleHit, OnRoleHit)
  4879. end,
  4880. --> 自己死亡时, 为己方所有单位恢复相当于自身[a]属性[b]的生命, 只能触发[c]次
  4881. [328] = function(role, args)
  4882. local _a = args[1]
  4883. local _b = args[2]
  4884. local _c = args[3]
  4885. local OnDead = nil
  4886. local cnt = 0
  4887. OnDead = function(atkRole)
  4888. local list = RoleManager.Query(function(v) return role.camp == v.camp end)
  4889. for i=1, #list do
  4890. local val = floor(BattleUtil.FP_Mul(_b, role:GetRoleData(BattlePropList[_a])))
  4891. BattleUtil.CalTreat(role, list[i], val)
  4892. end
  4893. cnt = cnt + 1
  4894. if cnt >= _c then
  4895. role.Event:RemoveEvent(BattleEventName.RoleDead, OnDead)
  4896. end
  4897. end
  4898. role.Event:AddEvent(BattleEventName.RoleDead, OnDead)
  4899. end,
  4900. --> 自己死亡时, 立即复活,并恢复[a]属性[b]的生命,[c]属性[d]改变[e],持续[f]回合
  4901. [314] = function(role, args)
  4902. local _a = args[1]
  4903. local _b = args[2]
  4904. local _c = args[3]
  4905. local _d = args[4]
  4906. local _e = args[5]
  4907. local _f = args[6]
  4908. local counter = 0
  4909. local onRoleRealDead = function(deadRole)
  4910. counter = counter + 1
  4911. if counter == 1 then
  4912. deadRole:SetRelive(BattleUtil.FP_Mul(role:GetRoleData(BattlePropList[_a]), _b))
  4913. deadRole:AddBuff(Buff.Create(role, BuffName.PropertyChange, _f, BattlePropList[_c], _e, _d))
  4914. end
  4915. end
  4916. role.Event:AddEvent(BattleEventName.RoleRealDead, onRoleRealDead)
  4917. end,
  4918. --> 己方单位暴击时, 为己方全体单位恢复伤害量[a]的生命
  4919. [313] = function(role, args)
  4920. local _a = args[1]
  4921. local list = RoleManager.Query(function(v) return role.camp == v.camp end)
  4922. local onRoleBeCrit = function(atkRole, damage, bCrit, finalDmg, damageType, skill)
  4923. local list2 = RoleManager.Query(function(v) return role.camp == v.camp end)
  4924. local val = floor(BattleUtil.FP_Mul(damage, _a))
  4925. for i=1, #list2 do
  4926. BattleUtil.CalTreat(role, list2[i], val)
  4927. end
  4928. end
  4929. for i=1, #list do
  4930. list[i].Event:AddEvent(BattleEventName.RoleBeCrit, onRoleBeCrit)
  4931. end
  4932. end,
  4933. --> 己方单位暴击时, 为己方全体单位附加吸收盾, 吸收量为伤害量的[a], 持续[b]回合
  4934. [348] = function(role, args)
  4935. local _a = args[1]
  4936. local _b = args[2]
  4937. local list = RoleManager.Query(function(v) return role.camp == v.camp end)
  4938. local onRoleBeCrit = function(atkRole, damage, bCrit, finalDmg, damageType, skill)
  4939. local list2 = RoleManager.Query(function(v) return role.camp == v.camp end)
  4940. local val = floor(BattleUtil.FP_Mul(damage, _a))
  4941. for i=1, #list2 do
  4942. list2[i]:AddBuff(Buff.Create(role, BuffName.Shield, _b, ShieldTypeName.NormalReduce, val, 0))
  4943. end
  4944. end
  4945. for i=1, #list do
  4946. list[i].Event:AddEvent(BattleEventName.RoleBeCrit, onRoleBeCrit)
  4947. end
  4948. end,
  4949. --> 击杀目标时, 若目标是[a]阵营, 则自身恢复伤害量[b]的生命
  4950. [316] = function(role, args)
  4951. local _a = args[1]
  4952. local _b = args[2]
  4953. local OnKill = function(defRole, damage)
  4954. if defRole.roleData.element == _a then
  4955. BattleUtil.CalTreat(role, role, floor(BattleUtil.FP_Mul(damage, _b)))
  4956. end
  4957. end
  4958. role.Event:AddEvent(BattleEventName.RoleKill, OnKill)
  4959. end,
  4960. --> 改变【普通攻击】, 使其优先选择处于[a]或[b]持续伤害状态的目标
  4961. [312] = function(role, args)
  4962. local _a = args[1]
  4963. local _b = args[2]
  4964. local function onSkillTargetCheck(func, skill)
  4965. if skill.ext_slot == 0 then
  4966. if skill.effectTargets and skill.effectTargets[1] then
  4967. local list = RoleManager.Query(function(r)
  4968. return r.camp ~= role.camp
  4969. end)
  4970. local num = #skill.effectTargets[1]
  4971. BattleUtil.Sort(list, function(a, b)
  4972. local aHave = BattleLogic.BuffMgr:HasBuff(a, BuffName.DOT, function (buff) return buff.damageType == _a or buff.damageType == _b end)
  4973. local bHave = BattleLogic.BuffMgr:HasBuff(b, BuffName.DOT, function (buff) return buff.damageType == _a or buff.damageType == _b end)
  4974. if aHave and bHave then
  4975. return false
  4976. elseif not aHave and bHave then
  4977. return false
  4978. elseif aHave and not bHave then
  4979. return true
  4980. end
  4981. return false
  4982. end)
  4983. local trans = {}
  4984. for i = 1, num do
  4985. if list[i] then
  4986. table.insert(trans, list[i])
  4987. end
  4988. end
  4989. if trans and #trans > 0 then
  4990. if func then func(trans) end
  4991. end
  4992. end
  4993. end
  4994. end
  4995. role.Event:AddEvent(BattleEventName.SkillTargetCheck, onSkillTargetCheck)
  4996. end,
  4997. --> 改变[a]号技能, 使其附加的【诅咒】的伤害增加[b]
  4998. [343] = function(role, args)
  4999. local _a = args[1]
  5000. local _b = args[2]
  5001. local damageFun = function(onDamage, skill)
  5002. if onDamage and skill then
  5003. if skill.ext_slot == _a then
  5004. onDamage(-_b)
  5005. end
  5006. end
  5007. end
  5008. role.Event:AddEvent(BattleEventName.BuffAuraTrigger, damageFun)
  5009. end,
  5010. --> 光环, 使所有己方[a]阵营单位的[b]属性[c]改变[d]
  5011. [338] = function(role, args)
  5012. local _a = args[1]
  5013. local _b = args[2]
  5014. local _c = args[3]
  5015. local _d = args[4]
  5016. local arr = RoleManager.Query(function (r) return r.camp == role.camp end)
  5017. for k, v in ipairs(arr) do
  5018. if v.roleData.element == _a then
  5019. BattleUtil.AddProp(v, _b, _d, _c)
  5020. end
  5021. end
  5022. end,
  5023. --> 光环, 提高己方所有单位的【反击】伤害, 增加相当于自己[a]属性的[b]
  5024. [339] = function(role, args)
  5025. local _a = args[1]
  5026. local _b = args[2]
  5027. end,
  5028. --> 光环, 若敌方单位死亡时有[a]属性状态, 则恢复己方所有单位相当于自己[b]属性[c]的生命
  5029. [341] = function(role, args)
  5030. local _a = args[1]
  5031. local _b = args[2]
  5032. local _c = args[3]
  5033. local arr = RoleManager.Query(function (r) return r.camp ~= role.camp end)
  5034. for k, v in ipairs(arr) do
  5035. local OnDead = function(atkRole)
  5036. if BattleLogic.BuffMgr:HasBuff(v, BuffName.PropertyChange, function (buff) return buff.propertyChangeType == _a end) then
  5037. local arr2 = RoleManager.Query(function (r2) return r2.camp == role.camp end)
  5038. for index, value in ipairs(arr2) do
  5039. local val = floor(BattleUtil.FP_Mul(_c, role:GetRoleData(BattlePropList[_b])))
  5040. BattleUtil.CalTreat(role, value, val)
  5041. end
  5042. end
  5043. end
  5044. role.Event:AddEvent(BattleEventName.RoleDead, OnDead)
  5045. end
  5046. end,
  5047. --> 光环, 有单位死亡, 自己获得1层【魔界之力】, 每层使自己[a]属性[b]改变[c], 无法驱散, 持续到本回合结束( 同1武将1回合内多次死亡只算1次; 自己死亡后不清除魔界之力)
  5048. [347] = function(role, args)
  5049. local _a = args[1]
  5050. local _b = args[2]
  5051. local _c = args[3]
  5052. local _d = args[4]
  5053. end,
  5054. --> 光环, 使所有敌方单位附加[a]或[b]持续伤害状态的概率提升[c], 且提升持续伤害效果, 相当于自己[d]属性的[e]
  5055. [317] = function(role, args)
  5056. local _a = args[1]
  5057. local _b = args[2]
  5058. local _c = args[3]
  5059. local _d = args[4]
  5060. end,
  5061. }
  5062. return passivityList