Project1
标题:
【求助】关于附加状态后。
[打印本页]
作者:
美丽晨露
时间:
2012-12-15 10:24
标题:
【求助】关于附加状态后。
本帖最后由 美丽晨露 于 2012-12-15 13:45 编辑
想这样实现效果。
如果附加状态后,被状态影响的能力值如果高于原来的数值的话
用红色字描绘;
如果附加状态后,被状态影响的能力值如果低于原来的数值的话
用蓝色字描绘;
请问要怎么做判断呢?
作者:
hys111111
时间:
2012-12-15 13:14
都改好了,在Main前面加上去就可以了。
#==============================================================================
# ■ Window_Base
#------------------------------------------------------------------------------
# 游戏中全部窗口的超级类。
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# ● 描绘 HP
# actor : 角色
# x : 描画目标 X 坐标
# y : 描画目标 Y 坐标
# width : 描画目标的宽
#--------------------------------------------------------------------------
def draw_actor_hp(actor, x, y, width = 144)
# 描绘字符串 "HP"
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, $data_system.words.hp)
# 计算描绘 MaxHP 所需的空间
if width - 32 >= 108
hp_x = x + width - 108
flag = true
elsif width - 32 >= 48
hp_x = x + width - 48
flag = false
end
# 描绘 HP(修改部分)
states_rate = 1.0
for i in actor.states
states_rate *= $data_states[i].maxhp_rate / 100.0
end
self.contents.font.color = actor.hp == 0 ? knockout_color :
actor.hp <= actor.maxhp / 4 ? crisis_color :
states_rate > 1.0 ? text_color(1) : states_rate < 1.0 ? text_color(2) : normal_color
self.contents.draw_text(hp_x, y, 48, 32, actor.hp.to_s, 2)
# 描绘 MaxHP
if flag
self.contents.font.color = normal_color
self.contents.draw_text(hp_x + 48, y, 12, 32, "/", 1)
self.contents.draw_text(hp_x + 60, y, 48, 32, actor.maxhp.to_s)
end
end
#--------------------------------------------------------------------------
# ● 描绘 SP
# actor : 角色
# x : 描画目标 X 坐标
# y : 描画目标 Y 坐标
# width : 描画目标的宽
#--------------------------------------------------------------------------
def draw_actor_sp(actor, x, y, width = 144)
# 描绘字符串 "SP"
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, $data_system.words.sp)
# 计算描绘 MaxSP 所需的空间
if width - 32 >= 108
sp_x = x + width - 108
flag = true
elsif width - 32 >= 48
sp_x = x + width - 48
flag = false
end
# 描绘 SP(修改部分)
states_rate = 1.0
for i in actor.states
states_rate *= $data_states[i].maxsp_rate / 100.0
end
self.contents.font.color = actor.sp == 0 ? knockout_color :
actor.hp <= actor.maxhp / 4 ? crisis_color :
states_rate > 1.0 ? text_color(1) : states_rate < 1.0 ? text_color(2) : normal_color
self.contents.draw_text(sp_x, y, 48, 32, actor.sp.to_s, 2)
# 描绘 MaxSP
if flag
self.contents.font.color = normal_color
self.contents.draw_text(sp_x + 48, y, 12, 32, "/", 1)
self.contents.draw_text(sp_x + 60, y, 48, 32, actor.maxsp.to_s)
end
end
#--------------------------------------------------------------------------
# ● 描绘能力值
# actor : 角色
# x : 描画目标 X 坐标
# y : 描画目标 Y 坐标
# type : 能力值种类 (0~6)
#--------------------------------------------------------------------------
def draw_actor_parameter(actor, x, y, type)
states_rate = 1.0
case type
when 0
parameter_name = $data_system.words.atk
parameter_value = actor.atk
for i in actor.states
states_rate *= $data_states[i].atk_rate / 100.0
end
when 1
parameter_name = $data_system.words.pdef
parameter_value = actor.pdef
for i in actor.states
states_rate *= $data_states[i].pdef_rate / 100.0
end
when 2
parameter_name = $data_system.words.mdef
parameter_value = actor.mdef
for i in actor.states
states_rate *= $data_states[i].mdef_rate / 100.0
end
when 3
parameter_name = $data_system.words.str
parameter_value = actor.str
for i in actor.states
states_rate *= $data_states[i].str_rate / 100.0
end
when 4
parameter_name = $data_system.words.dex
parameter_value = actor.dex
for i in actor.states
states_rate *= $data_states[i].dex_rate / 100.0
end
when 5
parameter_name = $data_system.words.agi
parameter_value = actor.agi
for i in actor.states
states_rate *= $data_states[i].agi_rate / 100.0
end
when 6
parameter_name = $data_system.words.int
parameter_value = actor.int
for i in actor.states
states_rate *= $data_states[i].int_rate / 100.0
end
end
self.contents.font.color = system_color
self.contents.draw_text(x, y, 120, 32, parameter_name)
self.contents.font.color = normal_color
self.contents.font.color = text_color(1) if states_rate > 1.0
self.contents.font.color = text_color(2) if states_rate < 1.0
self.contents.draw_text(x + 120, y, 36, 32, parameter_value.to_s, 2)
end
end
复制代码
作者:
美丽晨露
时间:
2012-12-15 13:43
hys111111 发表于 2012-12-15 13:14
都改好了,在Main前面加上去就可以了。
非常感谢
这种正是我想要的
谢谢你的帮忙
作者:
hys111111
时间:
2012-12-15 13:58
美丽晨露 发表于 2012-12-15 13:43
非常感谢
这种正是我想要的
谢谢你的帮忙
那就把70-72行与77行交换,33-35行与40行交换。
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1