赞 | 12 |
VIP | 107 |
好人卡 | 6 |
积分 | 4 |
经验 | 31122 |
最后登录 | 2024-6-29 |
在线时间 | 1606 小时 |
Lv2.观梦者 傻♂逼
- 梦石
- 0
- 星屑
- 374
- 在线时间
- 1606 小时
- 注册时间
- 2007-3-13
- 帖子
- 6562
|
- #===============================================================================
- # ■ 技能消耗物品
- # Skill Need Item
- #-------------------------------------------------------------------------------
- # 设定一些值,当拥有制定物品的制定个数及以上时才可发动特技。发动特技会
- # 消耗掉这些物品。
- #
- # 在技能的“注释”中如下书写:
- # <need_item 物品id,对应数量 物品id,对应数量 …… >
- # <need_item 1,1 2,2 3,3>
- #-------------------------------------------------------------------------------
- # 项目主管: DeathKing
- # 更新作者: DeathKing
- # 许可协议: FSL
- # 项目分类: VX \ 系统加强
- # 衍生关系:
- # 项目版本: 1.1.0
- # 建立日期: 2010年05月29日
- # 最后更新: 2010年07月05日
- # 引用网址:
- #-------------------------------------------------------------------------------
- # - 1.1.0 (2010.06.07)
- # * 改变了设置方法;
- #
- # - 1.0.0 (2010.05.29)
- # * 初始版本完成;
- #===============================================================================
- $fscript = {} if $fscript == nil
- $fscript["SkillNeedItem"] = [1,1,0]
- #-------------------------------------------------------------------------------
- # ▼ 通用配置模块
- #-------------------------------------------------------------------------------
- module FSL
- module Conf
- module SNItem
- WINDOW_X = 272 # X 544 / 2
- WINDOW_Y = 112 # Y 56 * 2
- WINDOW_W = 274 # 宽
- WINDOW_H = 640 # 高
-
- TEXT_NEED = "需要:"
- TEXT_NEED_X = WINDOW_X - 104
-
- TEXT_ITEM_NUM_X = WINDOW_X - 52
-
- BACK_OPACITY = 200
-
- end
- end
- end
- #==============================================================================
- # ■ Window_SNItem
- #------------------------------------------------------------------------------
- # 需要的物品的窗口。
- #==============================================================================
- class Window_SNItem < Window_Base
-
- include FSL::Conf::SNItem
-
- #--------------------------------------------------------------------------
- # ● 初始化对像
- # x : 窗口 X 座标
- # y : 窗口 Y 座标
- # width : 窗口宽度
- # height : 窗口高度
- #--------------------------------------------------------------------------
- def initialize(skill,index = 0,y=WINDOW_Y)
- skill_can_use(skill)
- if @need_item==nil
- begin
- dispose
- rescue
-
- end
- return
- end
- super(index % 2 == 0 ? WINDOW_X : 0, y, WINDOW_W, @need_item.size * 24 + 32)
- #self.back_opacity = BACK_OPACITY
- self.visible = false
- refresh(skill,index)
- end
- def skill_can_use(skill)
- # 如果传递过来的skill为空
- return false if skill == nil
- # 读取need_item项的参数
- @need_item = skill.read_note["need_item"]
- # need_item参数为空的话返回true
- return true if @need_item == nil
- # 重新生成参数列表
- @need_item_clone = []
- @need_item.each do |e|
- @need_item_clone << [ e.split(",")[0].to_i , e.split(",")[1].to_i ]
- end
- @need_item = @need_item_clone
- # 遍历
- @need_item.each_index do |i|
- # 生成物品id
- item_id = @need_item[i][0]
- # 生成物品数量
- item_num = @need_item[i][1]
- # 是否拥有物品,是的话返回物品的索引,不是的话返回nil
- item_exist = $game_party.items.index($data_items[item_id])
- # 不存在就返回false
- return false if item_exist == nil
- # 返回物品
- test_item = $game_party.items[item_exist]
- # 返回是否可用
- return $game_party.item_number(test_item) <= item_num
- end
- end
- #--------------------------------------------------------------------------
- # ● 判定技能可否使用(需要的物品是否满足)
- # skill : 技能
- #--------------------------------------------------------------------------
- def self.skill_can_use?(skill)
- # 如果传递过来的skill为空
- return false if skill == nil
- # 读取need_item项的参数
- @need_item = skill.read_note["need_item"]
- # need_item参数为空的话返回true
- return true if @need_item == nil
- # 重新生成参数列表
- @need_item_clone = []
- @need_item.each do |e|
- @need_item_clone << [ e.split(",")[0].to_i , e.split(",")[1].to_i ]
- end
- @need_item = @need_item_clone
- # 遍历
- @need_item.each_index do |i|
- # 生成物品id
- item_id = @need_item[i][0]
- # 生成物品数量
- item_num = @need_item[i][1]
- # 是否拥有物品,是的话返回物品的索引,不是的话返回nil
- item_exist = $game_party.items.index($data_items[item_id])
- # 不存在就返回false
- return false if item_exist == nil
- # 返回物品
- test_item = $game_party.items[item_exist]
- # 返回是否可用
- return $game_party.item_number(test_item) <= item_num
- end
- end
- #--------------------------------------------------------------------------
- # ● 刷新窗口
- # skill : 技能
- # index : 技能在技能窗口的索引,用来判定本
- # 窗口应该显示在左边还是右边
- #--------------------------------------------------------------------------
- def refresh( skill, index = 0)
- # 清除之前产生的位图
- #
- self.contents.clear
- # 如果skill为空就返回false
- return false if skill == nil
-
- # 先让需要窗口不可见
- self.visible = false
- # 读取参数
- #need_item = skill.read_note["need_item"]
- # 如果参数不是个数组就将需要窗口隐藏并返回false
- return false unless @need_item.is_a? Array
- =begin
- # 重新生成参数列表
- need_item_clone = []
- need_item.each do |e|
- need_item_clone << [ e.split(",")[0].to_i , e.split(",")[1].to_i ]
- end
- #p need_item_clone
- need_item = need_item_clone
- # 如果参数列表为空就返回
- return false unless need_item.size >= 1
- #create_contents
- # 判定索引以决定窗口位置
- self.x = index % 2 == 0 ? WINDOW_X : 0
- # 改变窗口大小
- self.height = need_item.size * 24 + 32
- =end
- #create_contents
- # 将窗口置为可见
- self.visible = true
- self.z=999999
- # 遍历参数列表
- @need_item.each_index do |i|
- # 生成物品id
- item_id = @need_item[i][0]
- # 生成物品数量
- item_num = @need_item[i][1]
- # 生成物品
- item = $data_items[item_id]
- # 判定物品是否足够
- enabled = $game_party.item_number(item) >= item_num ? true : false
- #enabled=true
- # 绘制文字
- #p item
- draw_item_name(item, 0, 24 * i, enabled)
-
- self.contents.font.color.alpha = enabled ? 255 : 128
- self.contents.draw_text(TEXT_NEED_X, 24 * i, 96, 24, TEXT_NEED) #
- self.contents.draw_text(TEXT_ITEM_NUM_X, WLH * i, 32, 24, item_num) #
- #p item
- #p TEXT_NEED_X,TEXT_NEED
- #p item,item_num,item_id
-
- # 结束参数遍历
- end
-
- #self.visible = true
-
- # self.contents.clear
- # p "Son of"
- # self.contents.draw_text(0,0,128,32,"HELLO")
-
- # 结束方法定义
- end
- end
- #==============================================================================
- # ■ Game_Actor
- #------------------------------------------------------------------------------
- # 处理角色的类。本类在 Game_Actors 类 ($game_actors) 的内部使用、
- # Game_Party 类请参考 ($game_party) 。
- #==============================================================================
- class Game_Actor
- #--------------------------------------------------------------------------
- # ● 可用技能判断
- # skill : 技能
- #--------------------------------------------------------------------------
- def skill_can_use?(skill)
- return false unless Window_SNItem.skill_can_use?(skill)
- return false unless skill_learn?(skill)
- return super
- end
- end
- #==============================================================================
- # ■ Scene_Skill
- #------------------------------------------------------------------------------
- # 处理特技画面的类。
- #==============================================================================
- class Scene_Skill < Scene_Base
- alias snitem_initialize initialize
- alias snitem_terminate terminate
- alias snitem_update update
- #--------------------------------------------------------------------------
- # ● 初始化对像
- # actor_index : 角色位置
- #--------------------------------------------------------------------------
- def initialize( actor_index = 0, equip_index = 0 )
- snitem_initialize
- # @snitem_window = Window_SNItem.new
- #@os=@skill_window.skill
- #@ow=@skill_window.index
- # @snitem_window.refresh( @skill_window.skill, @skill_window.index )
- end
- #--------------------------------------------------------------------------
- # ● 结束处理
- #--------------------------------------------------------------------------
- def terminate
- snitem_terminate
- @snitem_window.dispose
- end
- #--------------------------------------------------------------------------
- # ● 更新画面
- #--------------------------------------------------------------------------
- def update
- snitem_update
- if (@os!=@skill_window.skill) or (@ow!=@skill_window.index)
- begin
- @snitem_window.dispose
- rescue
- #这个,偷懒
- end
- @snitem_window= Window_SNItem.new(@skill_window.skill, @skill_window.index)
-
- #@snitem_window.refresh( @skill_window.skill, @skill_window.index )
- @os=@skill_window.skill
- @ow=@skill_window.index
- end
- end
-
- end
- #==============================================================================
- # ■ Scene_Battle
- #------------------------------------------------------------------------------
- # 处理战斗画面的类。
- #=============================================================================
- class Scene_Battle < Scene_Base
-
- alias snitem_update_skill_selection update_skill_selection
- alias snitem_start_skill_selection start_skill_selection
- alias snitem_end_skill_selection end_skill_selection
-
- #--------------------------------------------------------------------------
- # ● 开始技能选择
- #--------------------------------------------------------------------------
- def start_skill_selection
- snitem_start_skill_selection
- # 创建需要道具窗口,并把y坐标上移
- # @snitem_window = Window_SNItem.new(270,56)
- end
- #--------------------------------------------------------------------------
- # ● 结束技能选择
- #--------------------------------------------------------------------------
- def end_skill_selection
- if @skill_window != nil
- @snitem_window.dispose
- @snitem_window = nil
- end
- snitem_end_skill_selection
- end
- #--------------------------------------------------------------------------
- # ● 更新技能选择
- #--------------------------------------------------------------------------
- def update_skill_selection
- # 调用原方法内容
- snitem_update_skill_selection
- # 刷新技能 这个在下面拜托…
- if (@os!=@skill_window.skill) or (@ow!=@skill_window.index)
- begin
- @snitem_window.dispose
- rescue
- #这个,偷懒
- end
- @snitem_window= Window_SNItem.new(@skill_window.skill, @skill_window.index,55)
-
- #@snitem_window.refresh( @skill_window.skill, @skill_window.index )
- @os=@skill_window.skill
- @ow=@skill_window.index
- end
-
- end
- #--------------------------------------------------------------------------
- # ● 确认技能
- #--------------------------------------------------------------------------
- def determine_skill
- @active_battler.action.set_skill(@skill.id)
- @skill_window.active = false
- if @skill.need_selection?
- if @skill.for_opponent?
- start_target_enemy_selection
- else
- start_target_actor_selection
- end
- else
- end_skill_selection
- next_actor
- end
- end
- end
复制代码 |
评分
-
查看全部评分
|