| 赞 | 164 |
| VIP | |
| 好人卡 | |
| 积分 | 299 |
| 经验 | |
| 最后登录 | 2026-10-2 |
| 在线时间 | 5734 小时 |
- 梦石
- 0
- 星屑
- 29901
- 在线时间
- 5734 小时
- 注册时间
- 2016-3-8
- 回帖
- 1653
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有账号?注册会员
×
本帖最后由 alexncf125 于 2022-7-20 16:17 编辑
欢迎加入~RM学习交流群:632269521
呜谢:
MOG - https://mogplugins.wordpress.com/terms-of-use/
gqxastg - https://rpg.blue/home.php?mod=space&uid=216371
可搭配 老鹰的敌人追加物品掉落 一併使用
https://rpg.blue/thread-400902-1-1.html
效果图:
点击展开/收起[pre lang="ruby"]$imported ||= {}
$imported[:MOG_TrPopUpBattle] = true
module MOG_TrPopUpBattle
Animation_Type = 0
Scale = 0.8
Fade_Duration = 20
Drop_Item_Real_Time = true
end
class Game_Temp
attr_accessor :trBatNeedPopUp
attr_accessor :trBatRealTimeDrop
attr_accessor :trBatDropLock
alias :mog_trPopBattle_initialize :initialize
def initialize
mog_trPopBattle_initialize
@trBatNeedPopUp = false
@trBatRealTimeDrop = MOG_TrPopUpBattle::Drop_Item_Real_Time == true ? true : false
@trBatDropLock = false
end
end
class Game_Enemy < Game_Battler
attr_accessor :treasure
alias :mog_trPopBattle_initialize :initialize
def initialize(index, enemy_id)
mog_trPopBattle_initialize(index, enemy_id)
@treasure = {}
@treasure[:needPopup] = false
@treasure[:checked] = false
@treasure[:item] = []
end
alias :mog_trPopBattle_make_drop_items :make_drop_items
def make_drop_items
return @treasure[:item] if @treasure[:checked]
mog_trPopBattle_make_drop_items
end
end
module BattleManager
class << self
alias mog_trPopBattle_gain_drop_items gain_drop_items unless $@
def gain_drop_items
return if $game_temp.trBatDropLock
mog_trPopBattle_gain_drop_items
end
end
end
class Scene_Map
alias :mog_trPopBattle_initialize :initialize
def initialize
$game_temp.trBatDropLock = false
mog_trPopBattle_initialize
end
end
class Sprite_Battler < Sprite_Base
alias :mog_trPopBattle_update_collapse :update_collapse
def update_collapse
mog_trPopBattle_update_collapse
return if @battler.is_a?(Game_Actor)
unless @battler.treasure[:checked]
checkTreasurePopup if @effect_duration == 0
end
end
alias :mog_trPopBattle_update_boss_collapse :update_boss_collapse
def update_boss_collapse
mog_trPopBattle_update_boss_collapse
return if @battler.is_a?(Game_Actor)
unless @battler.treasure[:checked]
checkTreasurePopup if @effect_duration == 0
end
end
alias :mog_trPopBattle_update_instant_collapse :update_instant_collapse
def update_instant_collapse
mog_trPopBattle_update_instant_collapse
return if @battler.is_a?(Game_Actor)
unless @battler.treasure[:checked]
checkTreasurePopup if @effect_duration == 0
end
end
def checkTreasurePopup
@battler.treasure[:item] = @battler.make_drop_items
@battler.treasure[:checked] = true
if @battler.treasure[:item]
@battler.treasure[:needPopup] = true
$game_temp.trBatNeedPopUp = true
end
end
end
class Spriteset_Battle
alias :mog_trPopupBat_update :update
def update
mog_trPopupBat_update
treasurePopupR if $game_temp.trBatNeedPopUp
@enemiesTreasure.each {|i| i.update if i} if @enemiesTreasure
end
def treasurePopupR
$game_temp.trBatNeedPopUp = false
@enemiesTreasure ||= []
@enemy_sprites.each_with_index do |sprite, i|
if sprite.battler && sprite.battler.treasure[:needPopup]
sprite.battler.treasure[:needPopup] = false
@enemiesTreasure = SpriteEnemyTrP.new(@viewport1, sprite)
@enemiesTreasure.z = sprite.z ? sprite.z + 1 : 2
end
end
end
end
class SpriteEnemyTrP < Sprite
def initialize(viewport, sprite)
super(viewport)
@sprite = sprite
@mode = MOG_TrPopUpBattle::Animation_Type
self.visible = false
@enemy = @sprite.battler
createIcon
if $game_temp.trBatRealTimeDrop
$game_temp.trBatDropLock = true
gainDropItems
end
end
def gainDropItems
items = @enemy.treasure[:item]
items.each {|item| $game_party.gain_item(item, 1)}
end
def createIcon
@iconImg = Cache.system("Iconset")
@icons = []
@enemy.treasure[:item].each_with_index do |item, i|
if item
rect = Rect.new(item.icon_index % 16 * 24, item.icon_index / 16 * 24, 24, 24)
@icons = Sprite_MOG_TrPopUpBattle.new(@viewport1)
@icons.bitmap = Bitmap.new(24, 24)
@icons.bitmap.blt(0, 0, @iconImg, rect)
@icons.item = item
@icons.index = i
sx_arr = []
refreshIcons(@icons, sx_arr)
end
end
@icons.sort! {|a, b| b.intY - a.intY}
@icons.each_with_index {|icon, i| refreshWait(icon, i, @icons.size)}
end
def refreshWait(sprite, index, maxv)
mv = maxv * 20
mvt = mv - (20 * index)
sprite.wait = MOG_TrPopUpBattle::Fade_Duration + mvt
end
def refreshIcons(sprite, sx_arr = [])
w = 24
h = 24
iconindex = sprite.item.icon_index
sx = iconindex % 16 * w
sy = (iconindex / 16).to_f * h
hr = rand(h)
sprite.intY = ((@sprite.bitmap.height / 3.0) + hr) - h
sprite.dr = 60
sprite.dy = 15
sprite.y = -40
sprite.ry = sprite.y + sprite.intY
begin
randx = rand(0.5) + (sprite.index / 8.0)
sprite.sx = sx_arr[-1] ? (sx_arr[-1] < 0 ? randx : -randx) : (rand(2) == 0 ? randx : -randx)
end while sx_arr.any? {|n| (sprite.sx - n).abs < 0.1 }
sx_arr << sprite.sx
sprite.zoom_x = MOG_TrPopUpBattle::Scale
sprite.zoom_y = sprite.zoom_x
sprite.x = @enemy.screen_x
sprite.y += @enemy.screen_y
sprite.calc_x = @enemy.screen_x
sprite.calc_y += @enemy.screen_y
end
def updateBounce(sprite)
sprite.dy += 0.6
sprite.ry += sprite.dy
if sprite.ry >= 0
sprite.ry = 0
sprite.dy *= -0.7
end
sprite.calc_y = -sprite.intY + sprite.ry.round
sprite.calc_x += sprite.sx if sprite.calc_y < -sprite.intY
sprite.x = sprite.calc_x
sprite.y = sprite.calc_y
updateFade(sprite) if sprite.calc_y == -sprite.intY
sprite.y += @enemy.screen_y - 40
end
def updateFloat(sprite)
sprite.wait -= 1
return if sprite.wait > 0
sprite.y -= 3
sprite.opacity -= 8
end
def updateAnimation(sprite)
if @mode == 1
updateFloat(sprite)
else
updateBounce(sprite)
end
end
def updateFade(sprite)
sprite.wait -= 1
return if sprite.wait > 0
sprite.opacity -= 15
sprite.zoom_x -= 0.05
sprite.zoom_y += 0.15
end
def updateSprites(sprite)
self.visible = true
updateAnimation(sprite)
sprite.visible = false if sprite.opacity <= 0
end
def update
super
self.x = @sprite.x
self.y = @sprite.y
unless @iconImg.disposed?
@icons.each {|icon| updateSprites(icon) if icon.visible}
end
end
end
class Sprite_MOG_TrPopUpBattle < Sprite
attr_accessor :dr
attr_accessor :dy
attr_accessor :ry
attr_accessor :sx
attr_accessor :wait
attr_accessor :intY
attr_accessor :item
attr_accessor :index
attr_accessor :calc_x
attr_accessor :calc_y
def initialize(*args)
super
@dr = 0
@dy = 0
@ry = 0
@sx = 0
@wait = 0
@intY = 0
@item = nil
@index = 0
@calc_x = 0
@calc_y = 0
end
end[/pre] |
评分
-
查看全部评分
|