赞 | 32 |
VIP | 44 |
好人卡 | 11 |
积分 | 17 |
经验 | 81722 |
最后登录 | 2020-3-23 |
在线时间 | 1357 小时 |
Lv3.寻梦者 唯一的信徒
- 梦石
- 0
- 星屑
- 1665
- 在线时间
- 1357 小时
- 注册时间
- 2013-1-29
- 帖子
- 1637
|
其实上一版本已经大概写好了,但是之所以不行的原因其实和这个战斗系统本身有很多关系。
这个战斗系统左下角提示没法很好地处理多个信息的情况
也就是说我一次获得一对道具他只会显示最后获得的
所以说即使有了升级信息但是由于升级在获得掉落道具之前发生所以一般看不到升级
所以说我只能改了一下顺序,先获得道具,再升级,这样玩家才能看到自己升级了=。=
这个战斗系统果然提示系统蛋疼,所以说我最后还是写好了,楼上的最好删掉=。=
class << PearlKernel def draw_lv(obj, x, y, actor) string = 'Lv. ' + (actor.level).to_i.to_s obj.draw_text(x, y, 80, 32, string,2) end end class Sprite_LifeBars < Sprite def refresh_contents self.bitmap.clear self.bitmap.font.size = 19 @erasetimer = 180 self.opacity = 255 if battler.is_a?(Game_Actor) @old_exp = battler.exp @old_tp = battler.tp self.x = ScreenPos_X self.y = ScreenPos_Y h = HP_BarDimentions ; m = MP_BarDimentions ; e = EX_BarDimentions if PearlBars::ActorsHp != "" @pimg = Cache.picture(PearlBars::ActorsHp) if @pimg.nil? @bimg = Cache.picture(PearlBars::ActorsBack) if @bimg.nil? @pimp = Cache.picture(PearlBars::ActorsMp) if @pimp.nil? PearlKernel.image_hp(self.bitmap, h[0] + 4, h[1],@bimg, @pimg, battler,true) PearlKernel.image_mp(self.bitmap, m[0] + 4, m[1], @bimg, @pimp, battler) if PearlBars::ActorsExp != "" @piexp = Cache.picture(PearlBars::ActorsExp) if @piexp.nil? PearlKernel.image_exp(self.bitmap,e[0] + 4,e[1],@bimg,@piexp, battler) end else hc = HP_Color ; mc = MP_Color ; ec = EX_Color PearlKernel.draw_hp(self.bitmap,battler, h[0], h[1], h[2], h[3], hc) PearlKernel.draw_mp(self.bitmap,battler, m[0], m[1], m[2], m[3], mc) PearlKernel.draw_exp(self.bitmap,battler, e[0], e[1], e[2], e[3], ec) #PearlKernel.draw_lv(self.bitmap,battler, e[0], e[1], e[2], e[3], ec) PearlKernel.draw_lv(self.bitmap, TP_Info[0]+40, TP_Info[1], battler) end PearlKernel.draw_tp(self.bitmap, TP_Info[0], TP_Info[1], battler) else battler.is_a?(Game_Enemy) if boss? self.x = BeScreenPos_X self.y = BeScreenPos_Y h = BHP_BarDimentions ; hc = BHP_Color if PearlBars::BossEne != "" @n_img = Cache.picture(PearlBars::BossEne) if @n_img.nil? @n_back = Cache.picture(PearlBars::BossBack) if @n_back.nil? PearlKernel.image_hp(self.bitmap, h[0] + 4, h[1],@n_back, @n_img, battler,true) else PearlKernel.draw_hp(self.bitmap,battler, h[0],h[1],h[2], h[3],hc,true) end else self.x = NeScreenPos_X self.y = NeScreenPos_Y h = EHP_BarDimentions ; hc = EHP_Color if PearlBars::NormalEne != "" @n_img = Cache.picture(PearlBars::NormalEne) if @n_img.nil? @n_back = Cache.picture(PearlBars::NormalBack) if @n_back.nil? PearlKernel.image_hp(self.bitmap, h[0] + 4, h[1],@n_back, @n_img, battler,true) else PearlKernel.draw_hp(self.bitmap,battler,h[0],h[1],h[2], h[3], hc,true) end end end end end class Sprite_DamagePop < Sprite attr_reader :target def initialize(viewport, target,text=nil) super(viewport) @target = target self.bitmap = Bitmap.new(200, 50) self.bitmap.font.size = 20 case rand(4) when 0 then @resto_plus = 0.5 when 1 then @resto_plus = 0.6 when 2 then @resto_plus = 0.7 when 3 then @resto_plus = 0.8 end create_text_for_display @text = text if text set_text update end end class Spriteset_Map def add_new_popup(target,text) text = Sprite_DamagePop.new(@viewport1, DamagePop_Obj.new(target),text) @damagepop_sprites.push(text) end end class Game_Actor < Game_Battler #-------------------------------------------------------------------------- # ● 顯示等級上升的信息 # new_skills : 學會的新技能的數組 #-------------------------------------------------------------------------- def display_level_up(new_skills) new_popup(self,'Level Up!') $game_system.item_object = [:string, "Level Up!"] return unless SceneManager.scene.is_a? Scene_Map end end class Scene_Map attr_accessor :spriteset end class Spriteset_Map attr_accessor :item_sprite end class Sprite_PopItem < Sprite def set_bitmap #puts "Item: #{@item}, Num: #{@num}" operand = '' @item.nil? ? operand = Vocab::currency_unit : operand = @item.name unless @item == :string string = operand + ' X' + @num.to_s if @item == :string string = @num.to_s end self.bitmap = Bitmap.new(26 + string.length * 9, 28) self.bitmap.fill_rect(0, 0, self.bitmap.width, 28, Color.new(0, 0, 0, 100)) self.bitmap.font.size = 20 bitmap = Cache.system("Iconset") unless @item == :string icon = @item.nil? ? PearlItemPop::GoldIcon : @item.icon_index rect = Rect.new(icon % 16 * 24, icon / 16 * 24, 24, 24) self.bitmap.blt(4, 0, bitmap, rect) end x = 28 x = 5 if @item == :string self.bitmap.draw_text(x, 0, 250, 32, string) end end module Kernel def new_popup(target,text) new_target = target if target == $game_party.leader new_target = $game_player elsif target.is_a? Game_Actor new_target = $game_player.followers[$game_party.members.index(target)] end SceneManager.scene.instance_eval{@spriteset.add_new_popup(new_target,text)} end end class Game_Event < Game_Character def kill_enemy @secollapse = nil [url=home.php?mod=space&uid=472765]@killed[/url] = true @priority_type = 0 if @deadposee gain_gold gain_exp etext = 'Exp ' + @enemy.exp.to_s if @enemy.exp > 0 gtext = 'Gold ' + @enemy.gold.to_s if @enemy.gold > 0 $game_player.pop_damage("#{etext} #{gtext}") if etext || gtext make_drop_items run_assigned_commands end end
class << PearlKernel
def draw_lv(obj, x, y, actor)
string = 'Lv. ' + (actor.level).to_i.to_s
obj.draw_text(x, y, 80, 32, string,2)
end
end
class Sprite_LifeBars < Sprite
def refresh_contents
self.bitmap.clear
self.bitmap.font.size = 19
@erasetimer = 180
self.opacity = 255
if battler.is_a?(Game_Actor)
@old_exp = battler.exp
@old_tp = battler.tp
self.x = ScreenPos_X
self.y = ScreenPos_Y
h = HP_BarDimentions ; m = MP_BarDimentions ; e = EX_BarDimentions
if PearlBars::ActorsHp != ""
@pimg = Cache.picture(PearlBars::ActorsHp) if @pimg.nil?
@bimg = Cache.picture(PearlBars::ActorsBack) if @bimg.nil?
@pimp = Cache.picture(PearlBars::ActorsMp) if @pimp.nil?
PearlKernel.image_hp(self.bitmap, h[0] + 4, h[1],@bimg,
@pimg, battler,true)
PearlKernel.image_mp(self.bitmap, m[0] + 4, m[1], @bimg, @pimp, battler)
if PearlBars::ActorsExp != ""
@piexp = Cache.picture(PearlBars::ActorsExp) if @piexp.nil?
PearlKernel.image_exp(self.bitmap,e[0] + 4,e[1],@bimg,@piexp, battler)
end
else
hc = HP_Color ; mc = MP_Color ; ec = EX_Color
PearlKernel.draw_hp(self.bitmap,battler, h[0], h[1], h[2], h[3], hc)
PearlKernel.draw_mp(self.bitmap,battler, m[0], m[1], m[2], m[3], mc)
PearlKernel.draw_exp(self.bitmap,battler, e[0], e[1], e[2], e[3], ec)
#PearlKernel.draw_lv(self.bitmap,battler, e[0], e[1], e[2], e[3], ec)
PearlKernel.draw_lv(self.bitmap, TP_Info[0]+40, TP_Info[1], battler)
end
PearlKernel.draw_tp(self.bitmap, TP_Info[0], TP_Info[1], battler)
else battler.is_a?(Game_Enemy)
if boss?
self.x = BeScreenPos_X
self.y = BeScreenPos_Y
h = BHP_BarDimentions ; hc = BHP_Color
if PearlBars::BossEne != ""
@n_img = Cache.picture(PearlBars::BossEne) if @n_img.nil?
@n_back = Cache.picture(PearlBars::BossBack) if @n_back.nil?
PearlKernel.image_hp(self.bitmap, h[0] + 4, h[1],@n_back,
@n_img, battler,true)
else
PearlKernel.draw_hp(self.bitmap,battler, h[0],h[1],h[2], h[3],hc,true)
end
else
self.x = NeScreenPos_X
self.y = NeScreenPos_Y
h = EHP_BarDimentions ; hc = EHP_Color
if PearlBars::NormalEne != ""
@n_img = Cache.picture(PearlBars::NormalEne) if @n_img.nil?
@n_back = Cache.picture(PearlBars::NormalBack) if @n_back.nil?
PearlKernel.image_hp(self.bitmap, h[0] + 4, h[1],@n_back,
@n_img, battler,true)
else
PearlKernel.draw_hp(self.bitmap,battler,h[0],h[1],h[2], h[3], hc,true)
end
end
end
end
end
class Sprite_DamagePop < Sprite
attr_reader :target
def initialize(viewport, target,text=nil)
super(viewport)
@target = target
self.bitmap = Bitmap.new(200, 50)
self.bitmap.font.size = 20
case rand(4)
when 0 then @resto_plus = 0.5
when 1 then @resto_plus = 0.6
when 2 then @resto_plus = 0.7
when 3 then @resto_plus = 0.8
end
create_text_for_display
@text = text if text
set_text
update
end
end
class Spriteset_Map
def add_new_popup(target,text)
text = Sprite_DamagePop.new(@viewport1, DamagePop_Obj.new(target),text)
@damagepop_sprites.push(text)
end
end
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ● 顯示等級上升的信息
# new_skills : 學會的新技能的數組
#--------------------------------------------------------------------------
def display_level_up(new_skills)
new_popup(self,'Level Up!')
$game_system.item_object = [:string, "Level Up!"]
return unless SceneManager.scene.is_a? Scene_Map
end
end
class Scene_Map
attr_accessor :spriteset
end
class Spriteset_Map
attr_accessor :item_sprite
end
class Sprite_PopItem < Sprite
def set_bitmap
#puts "Item: #{@item}, Num: #{@num}"
operand = ''
@item.nil? ? operand = Vocab::currency_unit : operand = @item.name unless @item == :string
string = operand + ' X' + @num.to_s
if @item == :string
string = @num.to_s
end
self.bitmap = Bitmap.new(26 + string.length * 9, 28)
self.bitmap.fill_rect(0, 0, self.bitmap.width, 28, Color.new(0, 0, 0, 100))
self.bitmap.font.size = 20
bitmap = Cache.system("Iconset")
unless @item == :string
icon = @item.nil? ? PearlItemPop::GoldIcon : @item.icon_index
rect = Rect.new(icon % 16 * 24, icon / 16 * 24, 24, 24)
self.bitmap.blt(4, 0, bitmap, rect)
end
x = 28
x = 5 if @item == :string
self.bitmap.draw_text(x, 0, 250, 32, string)
end
end
module Kernel
def new_popup(target,text)
new_target = target
if target == $game_party.leader
new_target = $game_player
elsif target.is_a? Game_Actor
new_target = $game_player.followers[$game_party.members.index(target)]
end
SceneManager.scene.instance_eval{@spriteset.add_new_popup(new_target,text)}
end
end
class Game_Event < Game_Character
def kill_enemy
@secollapse = nil
[url=home.php?mod=space&uid=472765]@killed[/url] = true
@priority_type = 0 if @deadposee
gain_gold
gain_exp
etext = 'Exp ' + @enemy.exp.to_s if @enemy.exp > 0
gtext = 'Gold ' + @enemy.gold.to_s if @enemy.gold > 0
$game_player.pop_damage("#{etext} #{gtext}") if etext || gtext
make_drop_items
run_assigned_commands
end
end
|
|