本帖最后由 richvert 于 2025-5-2 14:18 编辑
稍微补充了点功能
- NL.RegBattleStartEvent(nil,"Bts_Event");
- NL.RegBattleActionEvent(nil,"Bta_Event");
- NL.RegTechOptionEvent(nil,"Bto_Event");
- NL.RegDamageCalculateEvent(nil,"Bdc_Event");
-
- --1:双倍伤害 2:受伤害减半 3:元素魔法伤害三倍 4:连击次数+2,伤害+50% 5:状态魔法成功率100% 6:补血魔法效果三倍 7:恢复魔法效果两倍,持续60回合 8:战斗开始状态回复满 9:恢复效果常驻
- local CONTANS_SKILL_1=1073741824;
- local CONTANS_SKILL_2=536870912;
- local CONTANS_SKILL_3=268435456;
- local CONTANS_SKILL_4=134217728;
- local CONTANS_SKILL_5=67108864;
- local CONTANS_SKILL_6=33554432;
- local CONTANS_SKILL_7=16777216;
- local CONTANS_SKILL_8=8388608;
- local CONTANS_SKILL_9=4194304;
-
- function Bdc_Event(CharIndex, DefCharIndex, OriDamage, Damage, BattleIndex, Com1, Com2, Com3, DefCom1, DefCom2, DefCom3, Flg)
- local zdamage = 0;
- local Pf1 = Char.GetData(CharIndex,%对象_OtherFlg%);
- local Pf2 = Char.GetData(DefCharIndex,%对象_OtherFlg%);
- zdamage = Damage;
- if (bit_and(Pf1,CONTANS_SKILL_1) >= 1) then
- zdamage = Damage * 2;
- end
- if (bit_and(Pf2,CONTANS_SKILL_2) >= 1) then
- zdamage = Damage * 0.5;
- end
- return zdamage;
- end
-
- function Bto_Event(CharIndex, Option, TechID, Val)
- local Pf1 = Char.GetData(CharIndex,%对象_OtherFlg%);
- if (TechID <= 3009 and TechID >= 1900 and bit_and(Pf1,CONTANS_SKILL_3) >= 1) then
- if Option == "AR:" then
- return Val*3
- end
- end
- if (TechID <= 9 and TechID >= 0 and bit_and(Pf1,CONTANS_SKILL_4) >= 1) then
- if Option == "AN:" then
- return Val+2
- end
- if Option == "AM:" then
- return Val+2
- end
- if Option == "DD:" then
- return Val+50
- end
- end
- if (TechID <= 4909 and TechID >= 3200 and bit_and(Pf1,CONTANS_SKILL_5) >= 1) then
- if Option == "SR:" then
- return 100
- end
- end
- if (TechID <= 6309 and TechID >= 6100 and bit_and(Pf1,CONTANS_SKILL_6) >= 1) then
- if Option == "AR:" then
- return Val*3
- end
- end
- if (TechID <= 6609 and TechID >= 6400 and bit_and(Pf1,CONTANS_SKILL_7) >= 1) then
- if Option == "CH:" then
- return Val*10
- end
- if Option == "RR:" then
- return Val*2
- end
- end
- return Val
- end
-
- function Bta_Event(CharIndex,con1,con2,con3,order)
- if(VaildChar(CharIndex)==true) then
- local Pf1 = Char.GetData(CharIndex,%对象_OtherFlg%);
- if(bit_and(Pf1,CONTANS_SKILL_9) >= 1 and order == 1) then
- local Phf1 = Char.GetData(CharIndex,%对象_回复%);
- Battle.SetBattleCharacterStatus(CharIndex, %战属_恢复魔法%,Phf1 * 100);
- Battle.SetBattleCharacterStatus(CharIndex, %战属_恢复回合%,1000);
- end
- end
- return ;
- end
-
- function Bts_Event(BattleIndex)
- for BWhile=0,19 do
- local CharIndex = Battle.GetPlayer(BattleIndex,BWhile);
- if(VaildChar(CharIndex)==true) then
- local Pf1 = Char.GetData(CharIndex,%对象_OtherFlg%);
- if(bit_and(Pf1,CONTANS_SKILL_8) >= 1) then
- local mhp = Char.GetData(CharIndex,%对象_最大血%);
- local mmp = Char.GetData(CharIndex,%对象_最大魔%);
- Char.SetData(CharIndex,%对象_血%,mhp);
- Char.SetData(CharIndex,%对象_魔%,mmp);
- end
- end
- end
- return 0;
- end
-
- function bit_and(a, b)
- local p, c = 1, 0;
- while a + b > 0 do
- local am, bm = a % 2, b % 2;
- if am + bm >= 2 then
- c = c + p;
- end
- a, b, p = math.floor(a / 2), math.floor(b / 2), p * 2;
- end
- return c
- end
复制代码
|