查看: 3745|回复: 8

[交流讨论] 【MV移植VA】MOG的战斗掉落物品弹散效果

[复制链接]
梦石
0
星屑
29901
在线时间
5734 小时
注册时间
2016-3-8
回帖
1653
发表于 2022-6-23 15:10:09 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
本帖最后由 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

效果图:
gif.gif

点击展开/收起[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]

评分

参与人数 5星屑 +666 赞 +4 收起 理由
KB.Driver + 1 精品文章
109531867 + 1 精品文章
百里_飞柳 + 1 精品文章
VIPArcher + 666 移植发布
ji40033791 + 1 我很赞同

查看全部评分

梦石
0
星屑
5405
在线时间
311 小时
注册时间
2022-2-14
回帖
40
发表于 2022-6-23 17:50:58 | 显示全部楼层
VA酱贴贴!

评分

参与人数 1赞 +1 收起 理由
alexncf125 + 1 贴贴!

查看全部评分

回复

使用道具 举报

梦石
0
星屑
9813
在线时间
1647 小时
注册时间
2012-6-6
回帖
306
发表于 2022-6-24 14:26:52 | 显示全部楼层
版主可以尝试多多移植MV或MZ上的优秀jio本到VA上,这个很不错

评分

参与人数 1赞 +1 收起 理由
alexncf125 + 1 比如?

查看全部评分

回复

使用道具 举报

梦石
0
星屑
9813
在线时间
1647 小时
注册时间
2012-6-6
回帖
306
发表于 2022-6-24 15:25:49 | 显示全部楼层
比如RMMV的yanfly上的那装备系统,VA上可没有哟,当然,移植起来估计也是个大工程。。。。。。。

点评

他说的好像是YEP_ITEMCORE  发表于 2022-7-22 20:17
yep的装备插件我看VA都有吧, 具体说说是哪个没有  发表于 2022-6-24 15:58
回复

使用道具 举报

老鹰

梦石
40
星屑
37812
在线时间
7091 小时
注册时间
2012-5-26
回帖
3297

极短24评委极短23参与极短22参与极短21评委老司机慢点开短篇十吟唱者组别冠军开拓者剧作品鉴家

发表于 2022-6-24 20:10:33 | 显示全部楼层
死去已久的数据库扩展类型插件突然开始攻击我(x)
回复

使用道具 举报

梦石
0
星屑
346
在线时间
63 小时
注册时间
2020-2-24
回帖
12
发表于 2022-7-20 15:38:41 | 显示全部楼层
大佬 角色死亡时报错弹出来这个如何解决呀? QRYU)(N%I{5{]B)GW%H5L`6.png

点评

谢谢BUG回报, 加几句return if @battler.is_a?(Game_Actor)就好了, 1L的脚本已修正  发表于 2022-7-20 16:18

评分

参与人数 1星屑 +50 赞 +1 收起 理由
alexncf125 + 50 + 1 塞糖

查看全部评分

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部