Project1
标题:
如何设定战斗结束后用评分来奖励物品
[打印本页]
作者:
jiushiainilip19
时间:
2015-7-22 12:12
标题:
如何设定战斗结束后用评分来奖励物品
本帖最后由 jiushiainilip19 于 2015-7-22 13:46 编辑
我使用的是天干宝典的战后评分脚本
那么在评分后如何设定根据评分来获得物品奖励 下面是评分脚本
#--------------------------------------------------------------------------
# ● 战斗结果等级显示 Window_Base
#--------------------------------------------------------------------------
def draw_ranking(x,y)
case $Ranking
when 1
bitmap = Bitmap.new("Graphics/Ranks/A")
when 2
bitmap = Bitmap.new("Graphics/Ranks/B")
when 3
bitmap = Bitmap.new("Graphics/Ranks/C")
when 4
bitmap = Bitmap.new("Graphics/Ranks/D")
when 5
bitmap = Bitmap.new("Graphics/Ranks/E")
when 6
bitmap = Bitmap.new("Graphics/Ranks/F")
end
cw = bitmap.width
ch = bitmap.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x , y , bitmap, src_rect)
end
复制代码
#==============================================================================
# ■ Window_BattleResult
#------------------------------------------------------------------------------
# 战斗结束时、显示获得的 EXP 及金钱的窗口。
#==============================================================================
class Window_BattleResult < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对像
# exp : EXP
# gold : 金钱
# treasures : 宝物
#--------------------------------------------------------------------------
def initialize(exp, gold, treasures)
@exp = exp
@gold = gold
@treasures = treasures
# super(160, 0, 320, @treasures.size * 32 + 64)
super(120, 0, 400, 320)#添加的
self.contents = Bitmap.new(width - 32, height - 32)
self.y = 160 - height / 2
self.back_opacity = 160
self.visible = false
refresh
end
##############################################################
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
###########################################################################
#==========================================================================
# ● 战绩报告窗口
#==========================================================================
#以下是等级计算公式,目前仅仅是根据角色HP/SP的多少来判定(毕竟是范例)
#这些可以自己定义。
@mhp = 0
@php = 0
@msp = 0
@psp = 0
for i in 0...$game_party.actors.size
@mhp += $game_party.actors[i].maxhp
@php += $game_party.actors[i].hp
if $game_party.actors[i].hp > 0
@msp += $game_party.actors[i].maxsp
@psp += $game_party.actors[i].sp
end
end
@orz = @php * 50 / @mhp + @psp * 50 / @msp
case @orz
when 79..100
$Ranking = 1
when 67..78
$Ranking = 2
when 55..66
$Ranking = 3
when 43..54
$Ranking = 4
when 31..42
$Ranking = 5
else
$Ranking = 6
end
#描绘角色脸图
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
actor_x = i * 92
# draw_battle_actor(actor,actor_x, 96)
draw_actor_name(actor, actor_x, 0)
# draw_actor_state(actor, actor_x, 96, 120)
end
#以下是经验值和钱的描绘
x = 4
self.contents.font.color = normal_color
cx = contents.text_size(@exp.to_s).width
self.contents.draw_text(x, 125, cx, 32, @exp.to_s)
x += cx + 4
self.contents.font.color = system_color
cx = contents.text_size("EXP").width
self.contents.draw_text(x, 125, 64, 32, "EXP")
x += cx + 16
self.contents.font.color = normal_color
cx = contents.text_size(@gold.to_s).width
self.contents.draw_text(x, 125, cx, 32, @gold.to_s)
x += cx + 4
self.contents.font.color = system_color
self.contents.draw_text(x, 125, 128, 32, $data_system.words.gold)
#描绘本次战斗得分
self.contents.font.color = normal_color
self.contents.draw_text(200, 125, 135, 32, "得分: "+ @orz.to_s)
#描绘获得的道具
y = 160
#描绘获得的评价
if @treasures.size == 0
draw_ranking(120,160)
else
draw_ranking(200,160)
end
for item in @treasures
draw_item_name(item, 4, y)
y += 32
###########################################################################
end
end
end
复制代码
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1