function War_EndPersonData(isexp,warStatus) --战斗以后设置人物参数
--敌方人员参数恢复
for i=0,WAR.PersonNum-1 do
local pid=WAR.Person[i]["人物编号"]
if not instruct_16(pid) then
JY.Person[pid]["生命"]=JY.Person[pid]["生命最大值"];
JY.Person[pid]["内力"]=JY.Person[pid]["内力最大值"];
JY.Person[pid]["体力"]=CC.PersonAttribMax["体力"];
JY.Person[pid]["受伤程度"]=0;
JY.Person[pid]["中毒程度"]=0;
end
end
--我方人员参数恢复,输赢都有
for i=0,WAR.PersonNum-1 do
local pid=WAR.Person[i]["人物编号"]
if instruct_16(pid) then
if warStatus==1 then
JY.Person[pid]["生命"]=JY.Person[pid]["生命"]+math.modf((JY.Person[pid]["生命最大值"]-JY.Person[pid]["生命"])*0.3)
JY.Person[pid]["内力"]=JY.Person[pid]["内力"]+math.modf((JY.Person[pid]["内力最大值"]-JY.Person[pid]["内力"])*0.3)
JY.Person[pid]["体力"]=JY.Person[pid]["体力"]+math.modf((100-JY.Person[pid]["体力"])*0.3)
JY.Person[pid]["受伤程度"]=math.modf(JY.Person[pid]["受伤程度"]/2)
JY.Person[pid]["中毒程度"]=math.modf(JY.Person[pid]["中毒程度"]/2)
else
if JY.Person[pid]["生命"]<JY.Person[pid]["生命最大值"]/4 then
JY.Person[pid]["生命"]=math.modf(JY.Person[pid]["生命最大值"]/4);
end
if JY.Person[pid]["体力"]<10 then
JY.Person[pid]["体力"]=10 ;
end
end
end
end
JY.Person[50]["武功1"]=26
JY.Wugong[13]["名称"]="铁掌"
if WAR.ZDDH==82 then SetS(10,0,18,0,1) end
if WAR.ZDDH==217 and warStatus==1 then SetS(10,0,16,0,1) end
if WAR.ZDDH==44 then
instruct_3(55,6,1,0,0,0,0,-2,-2,-2,0,-2,-2)
instruct_3(55,7,1,0,0,0,0,-2,-2,-2,0,-2,-2)
end
if WAR.ZDDH==45 then instruct_3(55,9,1,0,0,0,0,-2,-2,-2,0,-2,-2) end
if WAR.ZDDH==46 then instruct_3(55,13,0,0,0,0,0,-2,-2,-2,0,-2,-2) end
--[[for i=0,190 do
if JY.Person[i]["代号"]~=i then
say(CC.EXITSAY)
JY.Status=GANE_END
end
end]]
if warStatus==2 and isexp==0 then --输,没有经验,退出
return ;
end
local liveNum=0; --计算我方活着的人数
for i=0,WAR.PersonNum-1 do
if WAR.Person[i]["我方"]==true and JY.Person[WAR.Person[i]["人物编号"]]["生命"]>0 then
liveNum=liveNum+1;
end
end
local canyu=false;
--分配战斗经验---基本经验,战斗数据中的
if warStatus==1 then --赢了才有
if WAR.Data["经验"]<1000 then WAR.Data["经验"]=1000 end
--if WAR.Data["代号"]==226 then WAR.Data["经验"]=10000 end
for i=0,WAR.PersonNum-1 do
local pid=WAR.Person[i]["人物编号"]
if WAR.Person[i]["我方"]==true and inteam(pid) then
if JY.Person[pid]["生命"]>0 then
if pid==0 then
canyu=true;
end
for ii=1,10 do
if JY.Person[pid]["武功"..ii]==98 then
WAR.Person[i]["经验"]=WAR.Person[i]["经验"] + math.modf(WAR.Data["经验"]*1.5/liveNum);
end
end
WAR.Person[i]["经验"]=WAR.Person[i]["经验"] + math.modf(WAR.Data["经验"]/liveNum)
end
end
end
end
--每个人经验增加,以及升级 XLDS
for i=0,WAR.PersonNum-1 do
local pid=WAR.Person[i]["人物编号"];
AddPersonAttrib(pid,"物品修炼点数",math.modf(WAR.Person[i]["经验"]*8/10));
AddPersonAttrib(pid,"修炼点数",math.modf(WAR.Person[i]["经验"]*8/10));
if JY.Person[pid]["修炼点数"]<0 then JY.Person[pid]["修炼点数"]=0 end
if WAR.Person[i]["我方"]==true and inteam(pid) then
DrawStrBoxWaitKey( string.format(CC.WARS124,JY.Person[pid]["姓名"],WAR.Person[i]["经验"]),C_WHITE,CC.DefaultFont);
AddPersonAttrib(pid,"经验",math.modf(WAR.Person[i]["经验"]/2));
local r=War_AddPersonLVUP(pid); --人物升级
if r==true then
DrawStrBoxWaitKey( string.format(CC.WARS125,JY.Person[pid]["姓名"]),C_WHITE,CC.DefaultFont);
end
else
AddPersonAttrib(pid,"经验",WAR.Person[i]["经验"]);
end
War_PersonTrainBook(pid); --修炼秘籍
War_PersonTrainDrug(pid); --修炼药品
end
--[[if warStatus==1 and canyu and JY.Person[0]["经验"]==60000 and JY.Person[0]["武功1"]<109 and JY.Person[0]["武功7"]>0 then
CreatKf(WAR.Data["经验"]/100);
end]]--
if WAR.ZDDH==48 then
SetS(57,52,29,1,0)
SetS(57,52,30,1,0)
elseif WAR.ZDDH==175 then
instruct_3(32,12,1,0,0,0,0,0,0,0,-2,-2,-2);
--elseif WAR.ZDDH==217 then
--SetS(10,0,16,0,1)
elseif WAR.ZDDH==82 then
SetS(10,0,18,0,1)
elseif WAR.ZDDH==214 then
SetS(10,0,19,0,1)
end
if WAR.ZDDH==217 and warStatus==1 then
SetS(65,1,1,5,517)
end
end
function War_AddPersonLVUP(pid) --人物是否升级 Level
--人物是否升级
--pid 人id
--返回 true 升级,false不升级
local tmplevel=JY.Person[pid]["等级"];
if tmplevel>=CC.Level then --级别到顶
return false;
end
if JY.Person[pid]["经验"]<CC.Exp[tmplevel] then --经验不够升级
return false
end
while true do --判断可以升几级
if tmplevel >= CC.Level then
break;
end
if JY.Person[pid]["经验"]>=CC.Exp[tmplevel] then
--JY.Person[pid]["经验"]=JY.Person[pid]["经验"]-CC.Exp[tmplevel]
tmplevel=tmplevel+1;
else
break;
end
end
local leveladd=tmplevel-JY.Person[pid]["等级"]; --升级次数
JY.Person[pid]["等级"]=JY.Person[pid]["等级"]+leveladd;
AddPersonAttrib(pid,"生命最大值", (JY.Person[pid]["生命增长"]+Rnd(3))*leveladd*3);
JY.Person[pid]["生命"]=JY.Person[pid]["生命最大值"];
JY.Person[pid]["体力"]=CC.PersonAttribMax["体力"];
JY.Person[pid]["受伤程度"]=0;
JY.Person[pid]["中毒程度"]=0;
local function cleveradd()
local ca
local rndnum;
if CC.Debug then
rndnum=math.random(1);
else
rndnum=math.random(1);
end
--if JY.Person[pid]["资质"]>100 then JY.Person[pid]["资质"]=100 end
--ca=JY.Person[pid]["资质"]+Rnd(120-JY.Person[pid]["资质"]);
ca=JY.Person[pid]["资质"]/(rndnum+4);
--ca=ca/7
return ca
end
local function mymodf(x)
local x1=math.modf(x)
if math.random()<x-x1 then return x1
else return x1 end
end
--[[
if JY.Person[pid]["资质"]<30 then
cleveradd=1+Rnd(15);
elseif JY.Person[pid]["资质"]<50 then
cleveradd=2+Rnd(6);
elseif JY.Person[pid]["资质"]<70 then
cleveradd=3+Rnd(5);
elseif JY.Person[pid]["资质"]<90 then
cleveradd=4+Rnd(4);
else
cleveradd=5+Rnd(3);
end
]]--
--cleveradd=Rnd(cleveradd)+1; --按照资质计算的增长点,越高则技能增加越多,而内力增加越少。
local theadd=cleveradd()
AddPersonAttrib(pid,"内力最大值", math.modf(leveladd*((10-JY.Person[pid]["生命增长"])*7+210/(theadd+1)))); --聪明人不练内力
if pid==0 and GetS(4,5,5,5)==5 then
AddPersonAttrib(pid,"内力最大值",50*leveladd)
end
JY.Person[pid]["内力"]=JY.Person[pid]["内力最大值"];
--local totaladd=3*leveladd;
for i=1,leveladd do
local ups=math.modf((JY.Person[pid]["资质"]-1)/15)+1;
if pid==35 and GetD(82,1,0)==1 then --TLV
ups=3
end
if pid==55 and JY.Person[pid]["等级"]>20 then
ups=6
end
if T1LEQ(pid) then ups=8 end
if JY.Thing[202][WZ7]==2 then ups=ups+1 end
if JY.Thing[202][WZ7]==3 then ups=ups+2 end
AddPersonAttrib(pid,"攻击力",ups);
AddPersonAttrib(pid,"防御力",ups);
AddPersonAttrib(pid,"轻功",ups);
local a1=JY.Person[pid]['攻击力'];
local a2=JY.Person[pid]['防御力'];
local a3=JY.Person[pid]['轻功'];
local a4='攻击力'
if a2>=a1 and a2>=a3 then a4='防御力' end
if a3>=a2 and a3>=a1 then a4='轻功' end
AddPersonAttrib(pid,a4,1);
if JY.Thing[202][WZ7]>1 then
local ran=math.random(3);
if ran==1 then
AddPersonAttrib(pid,"攻击力",1);
elseif ran==2 then
AddPersonAttrib(pid,"防御力",1);
else
AddPersonAttrib(pid,"轻功",1);
end
end
if JY.Thing[202][WZ7]>2 then
local ran=math.random(3);
if ran==1 then
AddPersonAttrib(pid,"攻击力",1);
elseif ran==2 then
AddPersonAttrib(pid,"防御力",1);
else
AddPersonAttrib(pid,"轻功",1);
end
end
end
--[[
if add_a>=CC.PersonAttribMax['攻击力'] then
add_a=0
end
if add_b>=CC.PersonAttribMax['防御力'] then
add_b=0
end
if add_c>=CC.PersonAttribMax['轻功'] then
add_c=0
end
]]--
--add_c=add_c*0.6;
--local total=add_a+add_b+add_c+1;
--add_a=mymodf(totaladd*add_a/total);
--add_b=mymodf(totaladd*add_b/total);
--add_c=mymodf(totaladd*add_c/total);
--[[local rnn=math.random(3);
if rnn==1 then
add_a=add_a+1;
elseif rnn==2 then
add_b=add_b+1;
else
add_c=add_c+1;
end
rnn=math.random(3);
if rnn==1 then
add_a=add_a+1;
elseif rnn==2 then
add_b=add_b+1;
else
add_c=add_c+1;
end
if T1LEQ(pid) then
totaladd=0
for i=1,leveladd do
totaladd=28;
add_a=math.random(totaladd)
if add_a>totaladd/2 then
add_a=totaladd/2
end
add_b=math.random(totaladd-add_a)
add_c=totaladd-add_a-add_b
AddPersonAttrib(pid,"攻击力",add_b)
AddPersonAttrib(pid,"防御力",add_c)
AddPersonAttrib(pid,"轻功",add_a)
end
else
AddPersonAttrib(pid,"攻击力",add_a);
AddPersonAttrib(pid,"防御力",add_b);
AddPersonAttrib(pid,"轻功",add_c);
end]]
--[[
AddPersonAttrib(pid,"攻击力", mymodf(cleveradd()*leveladd));
AddPersonAttrib(pid,"防御力", mymodf(cleveradd()*leveladd));
AddPersonAttrib(pid,"轻功", mymodf(cleveradd()*leveladd*0.6));
]]--
if JY.Person[pid]["医疗能力"]>=20 then
AddPersonAttrib(pid,"医疗能力", math.random(2));
end
if JY.Person[pid]["用毒能力"]>=20 then
AddPersonAttrib(pid,"用毒能力", math.random(2));
end
if JY.Person[pid]["解毒能力"]>=20 then
AddPersonAttrib(pid,"解毒能力", math.random(2));
end
if pid==75 then
if JY.Person[pid]["拳掌功夫"]>=0 then
AddPersonAttrib(pid,"拳掌功夫", math.random(3)*leveladd);
end
if JY.Person[pid]["御剑能力"]>=0 then
AddPersonAttrib(pid,"御剑能力", (5+math.random(3))*leveladd);
end
if JY.Person[pid]["耍刀技巧"]>=0 then
AddPersonAttrib(pid,"耍刀技巧", (5+math.random(3))*leveladd);
end
if JY.Person[pid]["特殊兵器"]>=0 then
AddPersonAttrib(pid,"特殊兵器", (5+math.random(3))*leveladd);
end
end
if JY.Person[pid]["暗器技巧"]>=20 then
AddPersonAttrib(pid,"暗器技巧", math.random(2));
end
return true;
end |