赞 | 46 |
VIP | 271 |
好人卡 | 233 |
积分 | 94 |
经验 | 181865 |
最后登录 | 2024-12-18 |
在线时间 | 2749 小时 |
Lv4.逐梦者 「Pemercyia」 泱 银 Urhurrenna
- 梦石
- 0
- 星屑
- 9418
- 在线时间
- 2749 小时
- 注册时间
- 2008-9-5
- 帖子
- 3544
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 cinderelmini 于 2009-12-13 19:17 编辑
最近的第3个问帖。。。前两个都在孤单中自己解决了。。。但是这个问题明尼真的没办法再研究了。。希望能得到大大们的帮助。。。
实际问题就是当我把血玲珑里剩余的量使用完时,物品数量不减,但是在角色升级时把它满上。。。
这个问题可以解决吗?
PS:明尼决定制作的是单人游戏,所以可以无视队伍人数(就是一个人啦。。)这个有用吗?- #==============================================================================
- # 血玲珑和法玲珑 1.0 by 沉影不器
- #------------------------------------------------------------------------------
- # 功能: 在物品中添加名为"血玲珑"的药品,说白了就是一大药缸,使用时将全体角色HP加
- # 满(如果血玲珑的剩余血量不够,全体角色HP增加量为剩余血量),直到血玲珑的剩
- # 余血量为零,物品数量-1.
- # 当角色持有多于1个血玲珑时,当前正在使用的血玲珑剩余血量不够加满全体HP的,
- # 自动使用下一个血玲珑(如果有).
- #
- # 使用方法: 1、复制脚本所有内容到main之前
- # 2、在系统中新增一个属性,名为"血玲珑"
- # 3、设定一个物品如下:
- # 效果范围[己方全体];可能使用时[平时或战斗中];消耗[不消耗]
- # 该物品必须钩选"血玲珑"属性,其余设定随意
- # 4、血玲珑的最大存血量在脚本21行设置
- #
- # 5、法玲珑的设定方法跟血玲珑相,对应不再重复
- #==============================================================================
- module STORAGE
- HP_MAX = 999 # 血玲珑的最大存血量
- SP_MAX = 999 # 法玲珑的最大存法量
- HP_VAR = 50 # 存储血玲珑当前存血量的变量id,例如默认是第50号变量
- SP_VAR = 51 # 存储法玲珑当前存法量的变量id,例如默认是第51号变量
- end
- #==============================================================================
- class Game_Battler
- #--------------------------------------------------------------------------
- def hp_storage_id
- hp_storage = 0
- for i in 1...$data_system.elements.size
- if $data_system.elements[i] =~ /血玲珑/
- hp_storage = i
- break
- end
- end
- return hp_storage
- end
- #--------------------------------------------------------------------------
- def sp_storage_id
- hp_storage = 0
- for i in 1...$data_system.elements.size
- if $data_system.elements[i] =~ /法玲珑/
- sp_storage = i
- break
- end
- end
- return sp_storage
- end
- #--------------------------------------------------------------------------
- def item_effect(item)
- self.critical = false
- if ((item.scope == 3 or item.scope == 4) and self.hp == 0) or
- ((item.scope == 5 or item.scope == 6) and self.hp >= 1)
- # 过程结束(effective = false)
- return false
- end
- effective = false
- effective |= item.common_event_id > 0
- hit_result = (rand(100) < item.hit)
- effective |= item.hit < 100
- if hit_result == true
- recover_hp = maxhp * item.recover_hp_rate / 100 + item.recover_hp
- recover_sp = maxsp * item.recover_sp_rate / 100 + item.recover_sp
- if recover_hp < 0
- recover_hp += self.pdef * item.pdef_f / 20
- recover_hp += self.mdef * item.mdef_f / 20
- recover_hp = [recover_hp, 0].min
- end
- recover_hp *= elements_correct(item.element_set)
- recover_hp /= 100
- recover_sp *= elements_correct(item.element_set)
- recover_sp /= 100
- if item.variance > 0 and recover_hp.abs > 0
- amp = [recover_hp.abs * item.variance / 100, 1].max
- recover_hp += rand(amp+1) + rand(amp+1) - amp
- end
- if item.variance > 0 and recover_sp.abs > 0
- amp = [recover_sp.abs * item.variance / 100, 1].max
- recover_sp += rand(amp+1) + rand(amp+1) - amp
- end
- if recover_hp < 0
- if self.guarding?
- recover_hp /= 2
- end
- end
- self.damage = -recover_hp
- last_hp = self.hp
- last_sp = self.sp
- self.hp += recover_hp
- self.sp += recover_sp
- effective |= self.hp != last_hp
- effective |= self.sp != last_sp
- @state_changed = false
- effective |= states_plus(item.plus_state_set)
- effective |= states_minus(item.minus_state_set)
- if item.parameter_type > 0 and item.parameter_points != 0
- case item.parameter_type
- when 1
- @maxhp_plus += item.parameter_points
- when 2
- @maxsp_plus += item.parameter_points
- when 3
- @str_plus += item.parameter_points
- when 4
- @dex_plus += item.parameter_points
- when 5
- @agi_plus += item.parameter_points
- when 6
- @int_plus += item.parameter_points
- end
- effective = true
- end
- if item.recover_hp_rate == 0 and item.recover_hp == 0
- self.damage = ""
- if item.recover_sp_rate == 0 and item.recover_sp == 0 and
- (item.parameter_type == 0 or item.parameter_points == 0)
- unless @state_changed
- self.damage = "Miss"
- end
- end
- end
- else
- self.damage = "Miss"
- end
- unless $game_temp.in_battle
- self.damage = nil
- end
- # 血玲珑
- if item.element_set.include?(hp_storage_id)
- self.damage = nil
- differ_hp = self.maxhp - self.hp
- if $game_variables[STORAGE::HP_VAR] > differ_hp
- $game_variables[STORAGE::HP_VAR] -= differ_hp
- self.damage = -differ_hp if differ_hp !=0
- self.hp = self.maxhp
- else
- self.damage = -$game_variables[STORAGE::HP_VAR] if $game_variables[STORAGE::HP_VAR] != 0
- self.hp += $game_variables[STORAGE::HP_VAR]
- $game_variables[STORAGE::HP_VAR] = 0
- end
- num = $game_party.item_number(item.id)
- num_remain = [1 + $game_variables[STORAGE::HP_VAR] / STORAGE::HP_MAX, num].min
- num_costed = num - num_remain
- if $game_variables[STORAGE::HP_VAR] == 0
- num_costed = num
- end
- $game_party.gain_storage(item.id, -num_costed)
- effective |= differ_hp > 0
- end
- # 法玲珑
- if item.element_set.include?(sp_storage_id)
- self.damage = nil
- differ_sp = self.maxsp - self.sp
- if $game_variables[STORAGE::SP_VAR] > differ_sp
- $game_variables[STORAGE::SP_VAR] -= differ_sp
- self.damage = -differ_sp if differ_sp != 0
- self.sp = self.maxsp
- else
- self.damage = -$game_variables[STORAGE::SP_VAR] if $game_variables[STORAGE::SP_VAR] != 0
- self.sp += $game_variables[STORAGE::SP_VAR]
- $game_variables[STORAGE::SP_VAR] = 0
- end
- num = $game_party.item_number(item.id)
- num_remain = [1 + $game_variables[STORAGE::SP_VAR] / STORAGE::SP_MAX, num].min
- num_costed = num - num_remain
- if $game_variables[STORAGE::SP_VAR] == 0
- num_costed = num
- end
- $game_party.gain_storage(item.id, -num_costed)
- effective |= differ_sp > 0
- end
- # 过程结束
- return effective
- end
- end
- #==============================================================================
- class Game_Party
- #--------------------------------------------------------------------------
- def hp_storage_id
- hp_storage = 0
- for i in 1...$data_system.elements.size
- if $data_system.elements[i] =~ /血玲珑/
- hp_storage = i
- break
- end
- end
- return hp_storage
- end
- #--------------------------------------------------------------------------
- def sp_storage_id
- hp_storage = 0
- for i in 1...$data_system.elements.size
- if $data_system.elements[i] =~ /法玲珑/
- sp_storage = i
- break
- end
- end
- return sp_storage
- end
- #--------------------------------------------------------------------------
- def gain_storage(item_id, n)
- if item_id > 0
- @items[item_id] = [[item_number(item_id) + n, 0].max, 99].min
- end
- end
- #--------------------------------------------------------------------------
- def gain_item(item_id, n)
- # 血玲珑
- if $data_items[item_id].element_set.include?(hp_storage_id)
- $game_variables[STORAGE::HP_VAR] += n * STORAGE::HP_MAX
- if $game_variables[STORAGE::HP_VAR] < 0
- $game_variables[STORAGE::HP_VAR] = 0
- end
- end
- # 法玲珑
- if $data_items[item_id].element_set.include?(sp_storage_id)
- $game_variables[STORAGE::SP_VAR] += n * STORAGE::SP_MAX
- if $game_variables[STORAGE::SP_VAR] < 0
- $game_variables[STORAGE::SP_VAR] = 0
- end
- end
- if item_id > 0
- @items[item_id] = [[item_number(item_id) + n, 0].max, 99].min
- end
- end
- end
- #==============================================================================
- class Window_Item < Window_Selectable
- #--------------------------------------------------------------------------
- def hp_storage_id
- hp_storage = 0
- for i in 1...$data_system.elements.size
- if $data_system.elements[i] =~ /血玲珑/
- hp_storage = i
- break
- end
- end
- return hp_storage
- end
- #--------------------------------------------------------------------------
- def sp_storage_id
- hp_storage = 0
- for i in 1...$data_system.elements.size
- if $data_system.elements[i] =~ /法玲珑/
- sp_storage = i
- break
- end
- end
- return sp_storage
- end
- #--------------------------------------------------------------------------
- def update_help
- description = ""
- if self.item != nil
- description = self.item.description
- # 血玲珑
- if $data_items[self.item.id].element_set.include?(hp_storage_id)
- hp_remain = $game_variables[STORAGE::HP_VAR] % STORAGE::HP_MAX
- if hp_remain == 0
- hp_remain = STORAGE::HP_MAX
- end
- description = description + " 剩余HP: #{hp_remain}"
- end
- # 法玲珑
- if $data_items[self.item.id].element_set.include?(sp_storage_id)
- sp_remain = $game_variables[STORAGE::SP_VAR] % STORAGE::SP_MAX
- if sp_remain == 0
- sp_remain = STORAGE::SP_MAX
- end
- description = description + " 剩余SP: #{sp_remain}"
- end
- end
- @help_window.set_text(description)
- end
- end
- #==============================================================================
- class Scene_Item
- alias storage_update_target update_target
- #--------------------------------------------------------------------------
- def update_target
- # 按下 C 键的情况下
- if Input.trigger?(Input::C)
- if $game_party.item_number(@item.id) == 0
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- if @target_window.index == -1
- used = false
- for i in $game_party.actors
- used |= i.item_effect(@item)
- end
- end
- if @target_window.index >= 0
- target = $game_party.actors[@target_window.index]
- used = target.item_effect(@item)
- end
- # 使用物品的情况下
- if used
- $game_system.se_play(@item.menu_se)
- if $data_items[@item.id].element_set.include?($game_party.hp_storage_id) or
- $data_items[@item.id].element_set.include?($game_party.sp_storage_id)
- $game_party.gain_storage(@item.id, -1)
- @item_window.draw_item(@item_window.index)
- end
- if @item.consumable
- $game_party.lose_item(@item.id, 1)
- @item_window.draw_item(@item_window.index)
- end
- @target_window.refresh
- if $game_party.all_dead?
- $scene = Scene_Gameover.new
- return
- end
- if @item.common_event_id > 0
- $game_temp.common_event_id = @item.common_event_id
- $scene = Scene_Map.new
- return
- end
- end
- # 无法使用物品的情况下
- unless used
- $game_system.se_play($data_system.buzzer_se)
- end
- return
- end
- storage_update_target
- end
- end
复制代码 |
|