本帖最后由 二宫和也 于 2013-3-29 11:35 编辑
其实是因为玩游戏的时候老是忘记武功效果,所以不得已补了几句代码,懒得边玩游戏边翻电子书的童鞋适用
补丁效果
1)装备栏会显示有威力加成的武功
新手温馨提示:武器武功搭配可以自己在CC.ExtraOffense里面添加
2)秘籍栏会显示内力性质需求(主要是以前的阴性从来都不显示...)以及10级无加成状态下的威力
代码如下,放在LDCR里面替换原函数,好吧我承认只是加了几行代码而已....
- function SelectThing(thing,thingnum, bg)
- local xnum=CC.MenuThingXnum;
- local ynum=CC.MenuThingYnum;
- local w=CC.ThingPicWidth*xnum+(xnum-1)*CC.ThingGapIn+2*CC.ThingGapOut; --总体宽度
- local h=CC.ThingPicHeight*ynum+(ynum-1)*CC.ThingGapIn+2*CC.ThingGapOut; --物品栏高度
- local dx=(CC.ScreenW-w)/2;
- local dy=(CC.ScreenH-h-2*(CC.ThingFontSize+2*CC.MenuBorderPixel+5))/2-50;
- local y1_1,y1_2,y2_1,y2_2,y3_1,y3_2; --名称,说明和图片的Y坐标
- local cur_line=0;
- local cur_x=0;
- local cur_y=0;
- local cur_thing=-1;
- while true do
- Cls();
- if bg ~= nil then
- lib.LoadPicture(bg, -1, -1)
- end
- y1_1=dy;
- y1_2=y1_1+CC.ThingFontSize+2*CC.MenuBorderPixel;
- DrawBox(dx,y1_1,dx+w,y1_2,C_WHITE);
- y2_1=y1_2+5
- y2_2=y2_1+CC.ThingFontSize+2*CC.MenuBorderPixel
- DrawBox(dx,y2_1,dx+w,y2_2,C_WHITE);
- y3_1=y2_2+5;
- y3_2=y3_1+h;
- DrawBox(dx,y3_1,dx+w,y3_2,C_WHITE);
- for y=0,ynum-1 do
- for x=0,xnum-1 do
- local id=y*xnum+x+xnum*cur_line --当前待选择物品
- local boxcolor;
- if x==cur_x and y==cur_y then
- boxcolor=C_WHITE;
- if thing[id]>=0 then
- cur_thing=thing[id];
- local str=JY.Thing[thing[id]]["名称"];
- if JY.Thing[thing[id]]["类型"]==1 or JY.Thing[thing[id]]["类型"]==2 then
- if JY.Thing[thing[id]]["使用人"] >=0 then
- str=str .. "(" .. JY.Person[JY.Thing[thing[id]]["使用人"]]["姓名"] .. ")";
- end
- end
- str=string.format("%s X %d",str,thingnum[id]);
- local str2=JY.Thing[thing[id]]["物品说明"];
- if thing[id]==182 then
- str2=str2..string.format('(人%3d,%3d)',JY.Base['人X'],JY.Base['人Y'])
- end
- DrawString(dx+CC.ThingGapOut,y1_1+CC.MenuBorderPixel,str,C_GOLD,CC.ThingFontSize);
- DrawString(dx+CC.ThingGapOut,y2_1+CC.MenuBorderPixel,str2,C_ORANGE,CC.ThingFontSize);
- local myfont=math.modf(CC.ThingFontSize*0.7)--20
- local mx, my = dx + 4 * myfont, y3_2 + 2
- local myflag=0
- local myThing=JY.Thing[thing[id]]
- --
- local function drawitem(ss,str,news)
- local mys
- if str==nil then
- mys=ss
- elseif myThing[ss]~=0 then
- if news==nil then
- if myflag==0 then
- mys=string.format(str..':%+d',myThing[ss])
- elseif myflag==1 then
- mys=string.format(str..':%d',myThing[ss])
- end
- else
- if myThing[ss]<0 then
- return
- end
- mys=string.format(str..':%s',news[myThing[ss]])
- end
- elseif myThing[ss]==0 and ss=="需内力性质" then
- mys=string.format(str..':%s',news[myThing[ss]])
- else
- return
- end
- local ccc=C_GOLD
- if ss=="需内力性质" then
- if myThing[ss]==0 then
- ccc=M_DeepSkyBlue
- elseif myThing[ss]==1 then
- ccc=C_ORANGE
- elseif myThing[ss]==2 then
- ccc=C_WHITE
- end
- end
- local mylen = myfont * string.len(mys) / 2 + 12
- if CC.ScreenW - dx < mx + mylen then
- my = my + myfont + 10
- mx = dx + 4 * myfont
- end
- DrawStrBox(mx,my,mys,ccc,myfont)
- mx=mx+mylen
- end
- if myThing["练出武功"] > 0 then
- local kfname = "习得:" .. JY.Wugong[myThing["练出武功"]]["名称"]
- DrawStrBox(mx, my, kfname, C_GOLD, myfont)
- mx = mx + myfont * string.len(kfname) / 2 + 12
- if JY.Wugong[myThing["练出武功"]]["攻击力10"] > 0 then
- local kfwl = "威力:" .. JY.Wugong[myThing["练出武功"]]["攻击力10"]
- DrawStrBox(mx, my, kfwl, C_GOLD, myfont)
- mx = mx + myfont * string.len(kfwl) / 2 + 12
- end
- end
- if myThing['类型']>0 then
- drawitem('加生命','生命')
- drawitem('加生命最大值','生命最大值')
- drawitem('加中毒解毒','中毒')
- drawitem('加体力','体力')
- if myThing['改变内力性质']==2 then
- drawitem('内力门路阴阳合一')
- elseif myThing['改变内力性质']==3 then
- drawitem('内力门路转为阴性')
- elseif myThing['改变内力性质']==4 then
- drawitem('内力门路转为阳性')
- end
- drawitem('加内力','内力')
- drawitem('加内力最大值','内力最大值')
- drawitem('加攻击力','攻击')
- drawitem('加轻功','轻功')
- drawitem('加防御力','防御')
- drawitem('加医疗能力','医疗')
- drawitem('加用毒能力','用毒')
- drawitem('加解毒能力','解毒')
- drawitem('加抗毒能力','抗毒')
- drawitem('加拳掌功夫','拳掌')
- drawitem('加御剑能力','御剑')
- drawitem('加耍刀技巧','耍刀')
- drawitem('加特殊兵器','特殊')
- drawitem('加暗器技巧','暗器')
- drawitem('加武学常识','武常')
- drawitem('加品德','品德')
- drawitem('加攻击次数','左右',{[0]='否','是'})
- drawitem('加攻击带毒','带毒')
- if myThing['类型'] == 1 and myThing['装备类型'] == 0 then
- local tmpvv = {}
- for v = 1, #CC.ExtraOffense do
- if CC.ExtraOffense[v][1] == thing[id] then
- tmpvv[#tmpvv + 1] = CC.ExtraOffense[v][2]
- end
- end
- if #tmpvv > 0 then
- local tmpss = "加成武功:"
- for v = 1, #tmpvv do
- tmpss = tmpss..JY.Wugong[tmpvv[v]]["名称"].." "
- end
- drawitem(tmpss)
- end
- end
- if mx~=dx or my~=y3_2+2 then
- DrawStrBox(dx, y3_2 + 2, " 效果:", C_RED, myfont)
- end
- end
- if myThing['类型']==1 or myThing['类型']==2 then
- if mx~=dx then
- mx=dx+4*myfont+12
- my=my+myfont+20
- end
- myflag=1
- local my2=my
- if myThing['仅修炼人物']>-1 then
- drawitem('仅限:'..JY.Person[myThing['仅修炼人物']]['姓名'])
- end
- drawitem('需内力性质','阴阳',{[0]='阴','阳','不限'})
- drawitem('需内力','内力')
- drawitem('需攻击力','攻击')
- drawitem('需轻功','轻功')
- drawitem('需用毒能力','用毒')
- drawitem('需医疗能力','医疗')
- drawitem('需解毒能力','解毒')
- drawitem('需拳掌功夫','拳掌')
- drawitem('需御剑能力','御剑')
- drawitem('需耍刀技巧','耍刀')
- drawitem('需特殊兵器','特殊')
- drawitem('需暗器技巧','暗器')
- drawitem('需资质','资质')
- drawitem('需经验','修炼经验')
- if mx~=dx or my~=my2 then
- DrawStrBox(dx,my2,' 需求:',C_RED,myfont)
- end
- end
- else
- cur_thing=-1;
- end
- else
- boxcolor=C_BLACK;
- end
- local boxx = dx + CC.ThingGapOut + x * (CC.ThingPicWidth + CC.ThingGapIn)
- local boxy = y3_1 + CC.ThingGapOut + y * (CC.ThingPicHeight + CC.ThingGapIn)
- lib.DrawRect(boxx, boxy, boxx + CC.ThingPicWidth + 1, boxy + CC.ThingPicHeight + 1, boxcolor)
- if thing[id] >= 0 then
- if CC.LoadThingPic == 1 then
- lib.PicLoadCache(2, thing[id] * 2, boxx + 1, boxy + 1, 1)
- else
- lib.PicLoadCache(0, (thing[id] + CC.StartThingPic) * 2, boxx + 1, boxy + 1, 1)
- end
- end
- end
- end
- ShowScreen();
- local keypress=WaitKey(1);
- lib.Delay(100);
- if keypress==VK_ESCAPE then
- cur_thing=-1;
- break;
- elseif keypress==VK_RETURN or keypress==VK_SPACE then
- break;
- elseif keypress==VK_UP then
- if cur_y == 0 then
- if cur_line > 0 then
- cur_line = cur_line - 1;
- end
- else
- cur_y = cur_y - 1;
- end
- elseif keypress==VK_DOWN then
- if cur_y ==ynum-1 then
- if cur_line < (math.modf(CC.MyThingNum/xnum)-ynum) then
- cur_line = cur_line + 1;
- end
- else
- cur_y = cur_y + 1;
- end
- elseif keypress==VK_LEFT then
- if cur_x > 0 then
- cur_x=cur_x-1;
- else
- cur_x=xnum-1;
- end
- elseif keypress==VK_RIGHT then
- if cur_x ==xnum-1 then
- cur_x=0;
- else
- cur_x=cur_x+1;
- end
- elseif keypress==888 and cur_line>0 then
- cur_line=cur_line-1
- elseif keypress==999 and cur_line<(math.modf(CC.MyThingNum/xnum)-ynum) then
- cur_line=cur_line+1
- elseif keypress>999999 then
- local k,mx,my
- k=math.modf(keypress/1000000)
- keypress=math.fmod(keypress,1000000)
- mx=math.modf(keypress/1000)
- my=math.fmod(keypress,1000)
- if mx>dx and my>dy and mx<CC.ScreenW-dx and my<CC.ScreenH-dy then
- cur_x=math.modf((mx-dx-CC.ThingGapOut/2)/(CC.ThingPicWidth+CC.ThingGapIn))
- cur_y=math.modf((my-y3_1-CC.ThingGapOut/2)/(CC.ThingPicHeight+CC.ThingGapIn))
- if k==2 then
- break
- end
- end
- end
- end
- Cls();
- return cur_thing;
- end
复制代码
|