Effect.lua 222 KB

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