设为首页 收藏本站
登录 /立即注册 /找回密码

URPGs

快捷导航
  • 门户Portal
  • 论坛BBS
  • 群组Group
  • 导读Guide
  • 家园Space
  • 工具Tools
  • 广播Follow
  • 期刊Periodical
  • 排行榜Ranklist
  • 社区茶坊
  • pixlr图片编辑
  • 资源列表
  • photobucket
  • RMVA Lite [In English]
  • RM RTP
  • TryRUBY
  • RMXP+RMVX下载[VeryCD]
  • RMVA下载[66RPG]
搜索
  • 本版
  • 帖子
  • 用户
URPGs»论坛 › 技术讨论 › 技术讨论 › LBQ的渣技能演示系统_(:з」∠)_
返回列表 发新帖
查看: 4046|回复: 5

[RMVA 技术讨论] LBQ的渣技能演示系统_(:з」∠)_

[复制链接]
lbq
lbq 当前离线
积分
199
查看详细资料 窥视卡 雷达卡
发表于 2013-7-23 20:38:05 | 显示全部楼层 |阅读模式
本帖最后由 lbq 于 2013-7-24 21:04 编辑

Skill Demonstration System
纯无聊技能演示系统_(:з」∠)_



于是先上截图。。。



脚本。。。
[code=ruby]#encoding:utf-8
#==============================================================================
# ■ Skill Demo System by LBQ v0.8
#------------------------------------------------------------------------------
#  好吧。。真累。。。
#==============================================================================


$imported||={}
$imported[:LBQ_SDS]=true

module LBQ
  module Skill_Demo_System
    #===========================================================================
    module CONFIG
      BACKGROUND=["Grassland", "Grassland"]
      DIC={"a."=>"A的","b."=>"B的","atk"=>"ATK","def"=>"DEF","*"=>"×","/"=>"÷",
        "mat"=>"MAT","mdf"=>"MDF"
      }
      CODES={22=>"解除"}
      SCOPE_CODE={
        0   => "无",
        1   => "敌单体",
        2   => "敌全体",
        3   => "随机1敌",
        4   => "随机2敌",
        5   => "随机3敌",
        6   => "随机4敌",
        7   => "我方单体",
        8   => "我方全体",
        9   => "我方阵亡者",
        10  => "我方全阵亡者",
        11  => "使用者",
      }
      
      TYPE_CODE={
        0   => "无",
        1   => "HP伤害",
        2   => "MP伤害",
        3   => "HP回复",
        4   => "MP回复",
        5   => "HP吸收",
        6   => "MP吸收",
      }
    end
    #===========================================================================
    class Selection < Window_SkillList
      #--------------------------------------------------------------------------
      # ● 初始化对象
      #--------------------------------------------------------------------------
      def initialize(x, y, width, height)
        super
      end
      #--------------------------------------------------------------------------
      # ● 获取列数
      #--------------------------------------------------------------------------
      def col_max
        return 1
      end
      #--------------------------------------------------------------------------
      # ● 查询此技能是否可用
      #--------------------------------------------------------------------------
      def enable?(item)
        @actor
      end
      
      #--------------------------------------------------------------------------
      # ● 查询列表中是否含有此技能
      #--------------------------------------------------------------------------
      def include?(item)
        item
      end
    end
    #===========================================================================
    class Name_Window < Window_Base
      def initialize(actor,line_number = 3)
        super(0, 0, Graphics.width/2, fitting_height(line_number)/3*2)
        @actor=actor
        refresh
      end
      def actor=(nm)
        self.contents.clear
        @actor=nm
        refresh
      end
      def refresh
        name=@actor.name
        make_font_bigger
        draw_text(0,0,self.contents.width,self.contents.height,name,1)
        make_font_smaller
      end
      
    end
    #===========================================================================
    class Info_Window < Window_Base
      #====================
      include CONFIG
      #====================
      def initialize(x,y,skill)
        w=Graphics.width/2
        h=Graphics.height-y
        super(x,y,w,h)
        @skill=skill
        refresh
      end
      #====================
      def refresh
        self.contents.clear
        draw_skill_name
        draw_skill_formula
        draw_skill_effects
        draw_skill_type
      end
      #====================
      def draw_skill_name
        name=@skill.name
        make_font_bigger
        draw_text(0,0,self.contents.width,30,name,1)
        make_font_smaller
      end
      #====================
      def draw_skill_formula
        f=@skill.damage.formula
        v=@skill.damage.variance
        
        DIC.each do |key,value|
          f.gsub!(key.to_s,value.to_s)
        end
        
        text="#{f} ± %#{v}"
        contents.font.size -= 6 if contents.font.size >= 16
        draw_text(0,30,self.contents.width,30,text,1)
        contents.font.size += 6 if contents.font.size <= 64
      end
      #====================
      def draw_skill_effects
        @effects=@skill.effects
        draw_icons
        draw_scopes
      end
      #====================
      def draw_icons
        icons=@effects.select do |e|
          e.code==21 or 31 or 32 or 22
        end
        
        
        #--------------------------------------------------------------------------
        # ● 常量(能力强化/弱化图标的起始编号)
        #--------------------------------------------------------------------------
        icon_buff     =    Game_BattlerBase:: ICON_BUFF_START         # 强化(16 个)
        icon_debuff   =    Game_BattlerBase:: ICON_DEBUFF_START
        h={}
        icons.each do |i|
          @id=nil
         
          case i.code
          when 21
            @id=$data_states&#91;i.data_id&#93;.icon_index unless $data_states&#91;i.data_id&#93;.nil?
            @v="%"+(i.value1*100).to_i.to_s
          when 22
            @id=$data_states&#91;i.data_id&#93;.icon_index unless $data_states&#91;i.data_id&#93;.nil?
            @v=CODES&#91;22&#93;
          when 31
            @id=icon_buff+i.data_id
            @v=i.value1.to_i.to_s
          when 32
            @id=icon_debuff+i.data_id
            @v=i.value1.to_i.to_s
          end
         
          h&#91;@id&#93;=@v unless @id.nil?
        end
        
        
        total_length=h.length
        ws=self.contents.width
        start_x=(ws-total_length*24)/2
        i=0
        h.each do |key,value|
          draw_icon_with_text(key,start_x+i*24,60,value)
          i+=1
        end
        
        @id=nil
      end
      #====================
      def draw_icon_with_text(id,x,y,str)
        draw_icon(id,x,y)
        make_font_smaller
        draw_text(x,y+12,24,16,str,2)
        make_font_bigger
      end
      #====================
      def draw_scopes
        scope=@skill.scope
        make_font_smaller
        scope_text=SCOPE_CODE&#91;scope&#93;
        self.contents.draw_text(0,80,self.contents.width/2,20,scope_text,1)
        make_font_bigger
      end
      #====================
      def draw_skill_type
        type=@skill.damage.type
        type_text=TYPE_CODE&#91;type&#93;
        make_font_smaller
        self.contents.draw_text(self.contents.width/2,80,self.contents.width/2,20,type_text,1)
        make_font_bigger
      end
      #====================
      def skill=(nm)
        @skill=nm
        refresh
      end
      #====================
    end
    #===========================================================================
    class Scene < Scene_Base
      #====================
      include CONFIG
      #====================
      def start
        super
        create_background
        create_slime
        
        create_name_window
        
        create_skill_window
        create_info_window
        
        @ani_id=0
        @timer=-5
        
        play_ani(current_ani)
      end
      #====================
      def create_name_window
        @name_window=Name_Window.new($game_party.menu_actor)
      end
      #====================
      def terminate
        
        super
        @bgs.each(&:dispose)
        @slime.dispose
        
      end
      #====================
      def create_background
        @bgs=&#91;&#93;
        bg1=Sprite.new
        bg1.z=0
        bg1.bitmap=Cache.battleback1(BACKGROUND&#91;0&#93;)
        
        bg2=Sprite.new
        bg2.z=1
        bg2.bitmap=Cache.battleback2(BACKGROUND&#91;1&#93;)
        @bgs.push(bg1)
        @bgs.push(bg2)
      end
      #====================
      def create_slime
        slime=$data_enemies&#91;1&#93;
        @slime=Sprite_Base.new
        @slime.z=200
        @slime.bitmap=Cache.battler(slime.battler_name,0)
        
        @slime.x=Graphics.width*3/4
        @slime.x-=@slime.bitmap.width/2
        
        @slime.y=Graphics.height*2/3 - 40
      end
      #====================
      def create_info_window
        x=Graphics.width/2
        y=@slime.y+@slime.bitmap.height+10
        
        @info_window=Info_Window.new(x,y,current_skill)
        
      end
      #====================
      def create_skill_window
        @actor=$game_party.menu_actor
        @selection=Selection.new(0,@name_window.y,Graphics.width/2,Graphics.height-@name_window.y)
        @selection.y=@name_window.y
        @selection.actor=@actor
        @selection.activate
        @selection.select_last
        @selection.height=Graphics.height-@name_window.height
        @selection.y=@name_window.height
      end
      #====================
      def update
        if Input.trigger?(:B)
          Sound.play_cancel
          SceneManager.return
        end

          super

          @timer+=1

          unless current_ani.nil?
            if @timer>=current_ani.frame_max + 120 && @timer>=0
              @timer=-5
              play_ani current_ani
            end
          end
         
          @slime.update

          unless @ori_skill==current_skill or @ori_skill.nil?
            redraw_window_contents
            @slime.dispose_animation
            @timer=0

            @timer2=0
            @timer3=0
            
          end
          unless @timer2.nil?
            @timer2+=1
            if @timer2>=20
              play_ani current_ani
              @timer2=nil
            end
            
          end
         
         
         
         
          unless @timer3.nil?
            @timer3+=1
            if @timer3>=5
              Audio.se_stop
              @timer3=nil
            end
            
          end
          @ori_skill=current_skill
      end
      #====================
      def update_switch_actor
      end
      #====================
      def refresh(actor)
      end
      
      #====================
      def redraw_window_contents
          @info_window.skill=current_skill
      end
      #====================
      def current_ani
        if @selection.item.animation_id>=0
          $data_animations&#91;@selection.item.animation_id&#93; unless @selection.item.nil?
        else
          $data_animations&#91;@actor.atk_animation_id1&#93;
        end
      end
      #====================
      def current_skill
        return @selection.item
      end
      #====================
      def play_ani(ani)
        @slime.start_animation(ani)
      end
      #====================
      def check_to_play
        unless ani_playing?
          @timer=-2
          play_ani(current_ani)
        end
      end
      #====================
      def ani_playing?
        puts @timer
        return @timer<=current_ani.frame_max+10 && @timer>=0
      end
      #====================
    end
    #===========================================================================
  end
end

#encoding:utf-8
#==============================================================================
# ■ Window_MenuCommand
#------------------------------------------------------------------------------
#  菜单画面中显示指令的窗口
#==============================================================================

class Window_MenuCommand < Window_Command
  #--------------------------------------------------------------------------
  # ● 向指令列表添加主要的指令
  #--------------------------------------------------------------------------
  alias lbq_demo_system_menu_ccw add_main_commands
  def add_main_commands
    lbq_demo_system_menu_ccw
    add_command("技能演示", :skill_demo, main_commands_enabled)
  end
end


#encoding:utf-8
#==============================================================================
# ■ Scene_Menu
#------------------------------------------------------------------------------
#  菜单画面
#==============================================================================

class Scene_Menu < Scene_MenuBase
  #--------------------------------------------------------------------------
  # ● 生成指令窗口
  #--------------------------------------------------------------------------
  alias lbq_demo_system_menu_ccw create_command_window
  def create_command_window
    lbq_demo_system_menu_ccw
    @command_window.set_handler(:skill_demo,     method(:command_personal))
  end
  
  #--------------------------------------------------------------------------
  # ● 个人指令“确定”
  #--------------------------------------------------------------------------
  def on_personal_ok
    case @command_window.current_symbol
    when :skill
      SceneManager.call(Scene_Skill)
    when :equip
      SceneManager.call(Scene_Equip)
    when :status
      SceneManager.call(Scene_Status)
    when :skill_demo
      SceneManager.call(LBQ::Skill_Demo_System::Scene)
    end
  end
end
[/code]
请不要拿没有技能的人物测试。。
技能

本帖子中包含更多资源

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

×

点评

lbq
卧槽这个[url]是什么情况  发表于 2013-7-23 20:39

相关帖子

  • • T君の神秘转轮【Ver Beta 1.20 更新】
回复

使用道具 举报

  • 提升卡
  • 置顶卡
  • 沉默卡
  • 喧嚣卡
  • 变色卡
  • 抢沙发
  • 千斤顶
  • 显身卡
-4x
-4x 当前离线
积分
1
查看详细资料 窥视卡 雷达卡
发表于 2013-7-23 21:01:22 | 显示全部楼层
有错误!
回复 Like Dislike

使用道具 举报

  • 显身卡
satgo1546
satgo1546 当前离线
积分
201
查看详细资料 窥视卡 雷达卡
发表于 2013-7-24 12:08:29 | 显示全部楼层
不想说了……汗……

本帖子中包含更多资源

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

×
回复 Like Dislike

使用道具 举报

  • 显身卡
翎·仲秋
翎·仲秋 当前离线
积分
219
查看详细资料 窥视卡 雷达卡
发表于 2013-7-24 13:26:57 | 显示全部楼层
这个想法很不错啊
回复 Like Dislike

使用道具 举报

  • 显身卡
小小刀886
小小刀886 当前离线
积分
23
查看详细资料 窥视卡 雷达卡
发表于 2013-7-28 07:47:50 | 显示全部楼层
话说没有技能杀伤力吗?=-=

点评

lbq
公式难道不就是了吗。。  发表于 2013-7-28 19:36
回复 Like Dislike

使用道具 举报

  • 显身卡
delv25
delv25 当前离线
积分
188
查看详细资料 窥视卡 雷达卡
发表于 2013-8-12 15:50:14 | 显示全部楼层
已撸
回复 Like Dislike

使用道具 举报

  • 显身卡
返回列表 发新帖
高级模式
B Color Image Link Quote Code Smilies
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

站点统计|Archiver|手机版|意见反馈[feedback]| URPGs RPG Maker 游戏制作讨论

GMT+8, 2025-5-9 22:18 , Processed in 0.039526 second(s), 13 queries .

Powered by Discuz! X3.5

© 2011-2019 URPGs (Discuz! X3.4 © 2001-2019 Comsenz Inc.)

积分 0, 距离下一级还需 积分
快速回复 返回顶部 返回列表