赞 | 0 |
VIP | 77 |
好人卡 | 306 |
积分 | 1 |
经验 | 85662 |
最后登录 | 2023-11-23 |
在线时间 | 1782 小时 |
Lv1.梦旅人 虱子
- 梦石
- 0
- 星屑
- 121
- 在线时间
- 1782 小时
- 注册时间
- 2010-6-19
- 帖子
- 3597
|
本帖最后由 Wind2010 于 2012-7-1 09:04 编辑
新工程测试报错,估计是攻防为0的时候描绘公式有问题,无法描绘水平线和纵向线
解决脚本:- #---------------------------------------------------
- # 本脚本来自66RPG.com,作者Deathless
- #---------------------------------------------------
- #-----------------------------------------------------
- # 功能设定
- # 当=1和=2,会改变图形的大小
- # =1的时候,图形为每个人自身的能力分配,最大数就是顶点
- # =2的时候,图形为所有人的能力分配,顶点为999
- #
- # 如果不需要999这么大,本脚本中搜索
- # "c[i] = get_position(a[0][0], a[0][1], a[i+1][0], a[i+1][1], b[i] / 999.0)"
- # 把这个999修改了即可。
- #-----------------------------------------------------
- ST_DRAW_SIX_LINES_TYPE = 2
- class Bitmap
- #--------------------------------------------------------------------------
- # ● 描绘直线
- # x1,y1,x2,y2: 直线两端的坐标
- # width: 宽度
- # color: 颜色
- #--------------------------------------------------------------------------
- def drawline(x1, y1, x2, y2, width, color)
- x1 = x1.to_f
- y1 = y1.to_f
- x2 = x2.to_f
- y2 = y2.to_f
- width = width.to_f
- k = (y2 - y1) / (x2 - x1)
- if k.abs > 1
- drawline_x(x1, y1, x2, y2, width, color)
- else
- drawline_y(x1, y1, x2, y2, width, color)
- end
- end
- def drawline_x(x1, y1, x2, y2, width, color)
- l = ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5 * width / (y1 - y2)
- l = 1 if l.nan? #####
- length = l.abs * 2
- k = (x2 - x1) / (y2 - y1) #x=ky+b
- k = 1 if k.nan? #####
- b = x1 - k * y1
- if l > 0
- for ty in y2.to_i..y1.to_i
- tx = ty * k + b
- fill_rect(tx - l, ty, length, 1, color)
- end
- else
- for ty in y1.to_i..y2.to_i
- tx = ty * k + b
- fill_rect(tx + l, ty, length, 1, color)
- end
- end
- end
- def drawline_y(x1, y1, x2, y2, width, color)
- l = ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5 * width / (x1 - x2)
- l = 1 if l.nan? #####
- height = l.abs * 2
- k = (y2 - y1) / (x2 - x1) #y=kx+b
- k = 1 if k.nan? #####
- b = y1 - k * x1
- if l > 0
- for tx in x2.to_i..x1.to_i
- ty = tx * k + b
- fill_rect(tx, ty - l, 1, height, color)
- end
- else
- for tx in x1.to_i..x2.to_i
- ty = tx * k + b
- fill_rect(tx, ty + l, 1, height, color)
- end
- end
- end
- end
- class Window_Status < Window_Base
- def get_position(x_begin, y_begin, x_end, y_end, percent)
- a = []
- a[0] = x_begin + (x_end - x_begin) * percent
- a[1] = y_begin + (y_end - y_begin) * percent
- return a
- end
- def refresh
- self.contents.clear
- x0 = 60 #图表的坐标
- y0 = 220
- r = 100.0 #图表的大小,友情提示:浮点数后面的.0不要省略了
- h = 3 ** 0.5 * r / 2
- a = [] #六边形的顶点和圆心
- a[0] = [r, h] #圆心
- a[1] = [r / 2, 0.0]
- a[2] = [r * 3 / 2, 0.0]
- a[6] = [0.0, h]
- a[3] = [r * 2, h]
- a[5] = [r / 2, h * 2]
- a[4] = [r * 3 / 2, h * 2]
- for i in a
- i[0] += x0
- i[1] += y0
- end
- self.contents.font.color = system_color
- self.contents.draw_text(a[1][0] - 16 , a[1][1] - 32, 80, 32, "攻")
- self.contents.draw_text(a[2][0] - 4, a[2][1] - 32, 80, 32, "防")
- self.contents.draw_text(a[6][0] - 28, a[6][1] - 16, 80, 32, "力")
- self.contents.draw_text(a[5][0] - 16, a[5][1], 80, 32, "敏")
- self.contents.draw_text(a[4][0] - 4, a[4][1], 80, 32, "速")
- self.contents.draw_text(a[3][0] + 8, a[3][1] - 16, 80, 32, "魔")
- #描绘边框
- for i in 1...a.size
- self.contents.drawline(a[0][0], a[0][1], a[i][0], a[i][1], 1, disabled_color)
- end
- self.contents.drawline(a[1][0], a[1][1], a[2][0], a[2][1], 1, text_color(6))
- self.contents.drawline(a[2][0], a[2][1], a[3][0], a[3][1], 1, text_color(6))
- self.contents.drawline(a[3][0], a[3][1], a[4][0], a[4][1], 1, text_color(6))
- self.contents.drawline(a[4][0], a[4][1], a[5][0], a[5][1], 1, text_color(6))
- self.contents.drawline(a[5][0], a[5][1], a[6][0], a[6][1], 1, text_color(6))
- self.contents.drawline(a[6][0], a[6][1], a[1][0], a[1][1], 1, text_color(6))
- #描绘能力曲线
- b = [] #获取能力值
- b.push(@actor.atk)
- b.push(@actor.pdef)
- b.push(@actor.int)
- b.push(@actor.agi)
- b.push(@actor.dex)
- b.push(@actor.str)
- case ST_DRAW_SIX_LINES_TYPE
- when 2
- #跟999作比较
- c = []
- for i in 0...b.size
- c[i] = get_position(a[0][0], a[0][1], a[i+1][0], a[i+1][1], b[i] / 999.0)
- end
- for i in 0...c.size
- self.contents.drawline(c[i][0], c[i][1], c[i-1][0], c[i-1][1], 1, text_color(3))
- end
- when 1
- #跟最高能力值比较
- max_abi = 0
- b.each{|i| max_abi = [max_abi, i].max}
- max_abi = max_abi.to_f
- c = [] #获得能力值的坐标
- for i in 0...b.size
- c[i] = get_position(a[0][0], a[0][1], a[i+1][0], a[i+1][1], b[i] / max_abi)
- end
- for i in 0...c.size
- self.contents.drawline(c[i][0], c[i][1], c[i-1][0], c[i-1][1], 1, text_color(3))
- end
- end
- #描绘能力数值
- self.contents.font.color = knockout_color
- self.contents.font.size = 14
- for i in 0...b.size
- self.contents.draw_text(c[i][0], c[i][1], 32, 24, b[i].to_s)
- end
- self.contents.font.size = 22
- #以下未修改
- draw_actor_graphic(@actor, 40, 112)
- draw_actor_name(@actor, 4, 0)
- draw_actor_class(@actor, 4 + 144, 0)
- draw_actor_level(@actor, 96, 32)
- draw_actor_state(@actor, 96, 64)
- draw_actor_hp(@actor, 96, 112, 172)
- draw_actor_sp(@actor, 96, 144, 172)
- self.contents.font.color = system_color
- self.contents.draw_text(320, 48, 80, 32, "EXP")
- self.contents.draw_text(320, 80, 80, 32, "NEXT")
- self.contents.font.color = normal_color
- self.contents.draw_text(320 + 80, 48, 84, 32, @actor.exp_s, 2)
- self.contents.draw_text(320 + 80, 80, 84, 32, @actor.next_rest_exp_s, 2)
- self.contents.font.color = system_color
- self.contents.draw_text(320, 160, 96, 32, "装备")
- draw_item_name($data_weapons[@actor.weapon_id], 320 + 16, 208)
- draw_item_name($data_armors[@actor.armor1_id], 320 + 16, 256)
- draw_item_name($data_armors[@actor.armor2_id], 320 + 16, 304)
- draw_item_name($data_armors[@actor.armor3_id], 320 + 16, 352)
- draw_item_name($data_armors[@actor.armor4_id], 320 + 16, 400)
- end
- end
复制代码 |
评分
-
查看全部评分
|