| 赞 | 275 |
| VIP | |
| 好人卡 | |
| 积分 | 154 |
| 经验 | |
| 最后登录 | 2026-9-15 |
| 在线时间 | 2109 小时 |
- 梦石
- 1
- 星屑
- 14373
- 在线时间
- 2109 小时
- 注册时间
- 2017-9-28
- 回帖
- 607
|
发表于 2021-8-19 20:33:30
|
显示全部楼层
脚本1- #==============================================================================
- # Bravo 饥饿/口渴/睡眠(疲劳) 系统
- #------------------------------------------------------------------------------
- # Author: Bravo2Kilo
- # Version: 1.1
- #
- # Version History:
- # v1.0 = Initial Release
- # v1.1 = New Features and Bug Fixes
- #==============================================================================
- # 注意
- # All of the stat decreases stack.
- # 在下面的脚本中,如果“角色”为0,则代表全部队员.
- #==============================================================================
- # 增减角色饥饿值的脚本:
- # change_hunger(角色, 数值)
- #
- # 增减角色口渴值的脚本:
- # change_thirst(角色, 数值)
- #
- # 增减角色疲劳值的脚本:
- # change_sleep(角色, 数值)
- #
- # 设定最大饥饿值的角色备注:
- # <hungermax: x>
- #
- # 设定最大口渴值的角色备注:
- # <thirstmax: x>
- #
- # 设定最大疲劳值的角色备注:
- # <sleepmax: x>
- #
- # 使用以后,目标可以增减饥饿值的技能/物品备注 :
- # <hunger: x>
- #
- # 使用以后,目标可以增减口渴值的技能/物品备注 :
- # <thirst: x>
- #
- # 使用以后,目标可以增减疲劳值的技能/物品备注 :
- # <sleep: x>
- #
- # 使用以后,自身可以增减饥饿值的技能/物品备注 :
- # <user-hunger: x>
- #
- # 使用以后,自身可以增减口渴值的技能/物品备注 :
- # <user-thirst: x>
- #
- # 使用以后,自身可以增减疲劳值的技能/物品备注 :
- # <user-sleep: x>
- #
- #==============================================================================
- module BRAVO_HTS
- # 饥饿、口渴、疲劳的名称
- HTS_NAMES = ["饥饿", "口渴", "疲劳"]
- # 是否启用任意一个系统
- # 顺序为饥饿、口渴、疲劳
- HTS_USE = [true, true, true]
- # 各值到达最大时,角色是否会死亡
- # 顺序为饥饿、口渴、疲劳
- HTS_DIE_MAX = [true, true, true]
- # 各值的最大值
- # 顺序为饥饿、口渴、疲劳
- HTS_MAX = [100, 100, 100]
- # 玩家每走一步,各值减少的数量.
- # 顺序为饥饿、口渴、疲劳
- HTS_INCREASE = [1, 1, 1]
- # 各值到达该数值时,玩家无法冲刺.
- # 顺序为饥饿、口渴、疲劳
- DISABLE_DASH = [50, 50, 50]
- # 队长各值到达该数值时,玩家无法冲刺.
- # 还是队伍中任意一位队员各值到达该数值时,玩家无法冲刺.
- # 前者设定为 ":leader" ,后者为 ":party"
- DIASBLE_DASH_METHOD = :leader
- # 饥饿值到达一定数值时,能力值下降.
- HUNGER_STAT_DECREASE = {
- # :能力值 => [下降比率, 要求饥饿值下降到该值时生效]
- :attack => [20, 50],
- :defense => [20, 50],
- :mattack => [20, 50],
- :mdefense => [20, 50],
- :agility => [20, 50],
- }# Don't Touch This
- # 口渴值到达一定数值时,能力值下降.
- THIRST_STAT_DECREASE = {
- # :能力值 => [下降比率, 要求口渴值下降到该值时生效]
- :attack => [20, 50],
- :defense => [20, 50],
- :mattack => [20, 50],
- :mdefense => [20, 50],
- :agility => [20, 50],
- }# Don't Touch This
- # 疲劳值到达一定数值时,能力值下降.
- SLEEP_STAT_DECREASE = {
- # :能力值 => [下降比率, 要求疲劳值下降到该值时生效]
- :attack => [20, 50],
- :defense => [20, 50],
- :mattack => [20, 50],
- :mdefense => [20, 50],
- :agility => [20, 50],
- }# Don't Touch This
- # 此开关开启时,显示HUD.
- HTS_HUD_SWITCH = 1
- # HUD的x坐标偏移.
- HTS_HUD_X = 0
- # HUD的y坐标偏移.
- HTS_HUD_Y = 0
- # HUD图片文件名,不显示HUD图片时留空就好.
- HTS_HUD_BACK = ""
- # HUD窗口不透明度.
- HTS_HUD_OPACITY = 255
- #==============================================================================
- # End of Configuration
- #==============================================================================
- end
- $imported ||= {}
- $imported[:Bravo_HTS] = true
- #==============================================================================
- # ** RPG Actor
- #==============================================================================
- class RPG::Actor < RPG::BaseItem
- #--------------------------------------------------------------------------
- # * Hunger Max
- #--------------------------------------------------------------------------
- def hunger_max
- if @note =~ /<hungermax: (.*)>/i
- return $1.to_i
- else
- return BRAVO_HTS::HTS_MAX[0]
- end
- end
- #--------------------------------------------------------------------------
- # * Thirst Max
- #--------------------------------------------------------------------------
- def thirst_max
- if @note =~ /<thirstmax: (.*)>/i
- return $1.to_i
- else
- return BRAVO_HTS::HTS_MAX[1]
- end
- end
- #--------------------------------------------------------------------------
- # * Sleep Max
- #--------------------------------------------------------------------------
- def sleep_max
- if @note =~ /<sleepmax: (.*)>/i
- return $1.to_i
- else
- return BRAVO_HTS::HTS_MAX[2]
- end
- end
- end
- #==============================================================================
- # ** RPG UsableItem
- #==============================================================================
- class RPG::UsableItem < RPG::BaseItem
- #--------------------------------------------------------------------------
- # * User Hunger
- #--------------------------------------------------------------------------
- def user_hunger
- if @note =~ /<user-hunger: (.*)>/i
- return $1.to_i
- else
- return 0
- end
- end
- #--------------------------------------------------------------------------
- # * User Thirst
- #--------------------------------------------------------------------------
- def user_thirst
- if @note =~ /<user-thirst: (.*)>/i
- return $1.to_i
- else
- return 0
- end
- end
- #--------------------------------------------------------------------------
- # * User Sleep
- #--------------------------------------------------------------------------
- def user_sleep
- if @note =~ /<user-sleep: (.*)>/i
- return $1.to_i
- else
- return 0
- end
- end
- #--------------------------------------------------------------------------
- # * Hunger
- #--------------------------------------------------------------------------
- def hunger
- if @note =~ /<hunger: (.*)>/i
- return $1.to_i
- else
- return 0
- end
- end
- #--------------------------------------------------------------------------
- # * Thirst
- #--------------------------------------------------------------------------
- def thirst
- if @note =~ /<thirst: (.*)>/i
- return $1.to_i
- else
- return 0
- end
- end
- #--------------------------------------------------------------------------
- # * Sleep
- #--------------------------------------------------------------------------
- def sleep
- if @note =~ /<sleep: (.*)>/i
- return $1.to_i
- else
- return 0
- end
- end
- end
- #==============================================================================
- # ** Game_Actor
- #==============================================================================
- class Game_Actor < Game_Battler
- #--------------------------------------------------------------------------
- # * Public Instance Variables
- #--------------------------------------------------------------------------
- attr_accessor :hunger
- attr_accessor :hunger_max
- attr_accessor :thirst
- attr_accessor :thirst_max
- attr_accessor :sleep
- attr_accessor :sleep_max
- #--------------------------------------------------------------------------
- # * Setup
- #--------------------------------------------------------------------------
- alias bravo_hts_setup setup
- def setup(actor_id)
- bravo_hts_setup(actor_id)
- @hunger = 0
- @hunger_max = actor.hunger_max
- @thirst = 0
- @thirst_max = actor.thirst_max
- @sleep = 0
- @sleep_max = actor.sleep_max
- end
- #--------------------------------------------------------------------------
- # * Check Death
- #--------------------------------------------------------------------------
- def check_death
- if @hunger > @hunger_max
- @hunger = @hunger_max
- elsif @hunger < 0
- @hunger = 0
- end
- if @thirst > @thirst_max
- @thirst = @thirst_max
- elsif @thirst < 0
- @thirst = 0
- end
- if @sleep > @sleep_max
- @sleep = @sleep_max
- elsif @sleep < 0
- @sleep = 0
- end
- if @hunger >= @hunger_max && BRAVO_HTS::HTS_DIE_MAX[0] == true
- self.hp = 0
- elsif @thirst >= @thirst_max && BRAVO_HTS::HTS_DIE_MAX[1] == true
- self.hp = 0
- elsif @sleep >= @sleep_max && BRAVO_HTS::HTS_DIE_MAX[2] == true
- self.hp = 0
- end
- SceneManager.goto(Scene_Gameover) if $game_party.all_dead?
- end
- #--------------------------------------------------------------------------
- # * Use Skill/Item
- # Called for the acting side and applies the effect to other than the user.
- #--------------------------------------------------------------------------
- def use_item(item)
- super(item)
- @hunger += item.user_hunger if BRAVO_HTS::HTS_USE[0] == true
- @thirst += item.user_thirst if BRAVO_HTS::HTS_USE[1] == true
- @sleep += item.user_sleep if BRAVO_HTS::HTS_USE[2] == true
- end
- #--------------------------------------------------------------------------
- # * Apply Effect of Skill/Item
- #--------------------------------------------------------------------------
- def item_apply(user, item)
- super(user, item)
- @hunger += item.hunger if BRAVO_HTS::HTS_USE[0] == true
- @thirst += item.thirst if BRAVO_HTS::HTS_USE[1] == true
- @sleep += item.sleep if BRAVO_HTS::HTS_USE[2] == true
- end
- #--------------------------------------------------------------------------
- # * Get Parameter
- #--------------------------------------------------------------------------
- def param(param_id)
- value = param_base(param_id) + param_plus(param_id)
- value *= param_rate(param_id) * param_buff_rate(param_id)
- case param_id
- when 2 # Attack Parameter
- if @hunger >= BRAVO_HTS::HUNGER_STAT_DECREASE[:attack][1] && BRAVO_HTS::HTS_USE[0] == true
- hunger = value * (BRAVO_HTS::HUNGER_STAT_DECREASE[:attack][0] * 0.01)
- value = value - hunger
- end
- if @thirst >= BRAVO_HTS::THIRST_STAT_DECREASE[:attack][1] && BRAVO_HTS::HTS_USE[1] == true
- thirst = value * (BRAVO_HTS::THIRST_STAT_DECREASE[:attack][0] * 0.01)
- value = value - thirst
- end
- if @sleep >= BRAVO_HTS::SLEEP_STAT_DECREASE[:attack][1] && BRAVO_HTS::HTS_USE[2] == true
- sleep = value * (BRAVO_HTS::SLEEP_STAT_DECREASE[:attack][0] * 0.01)
- value = value - sleep
- end
- when 3 # Defense Parameter
- if @hunger >= BRAVO_HTS::HUNGER_STAT_DECREASE[:defense][1] && BRAVO_HTS::HTS_USE[0] == true
- hunger = value * (BRAVO_HTS::HUNGER_STAT_DECREASE[:defense][0] * 0.01)
- value = value - hunger
- end
- if @thirst >= BRAVO_HTS::THIRST_STAT_DECREASE[:defense][1] && BRAVO_HTS::HTS_USE[1] == true
- thirst = value * (BRAVO_HTS::THIRST_STAT_DECREASE[:defense][0] * 0.01)
- value = value - thirst
- end
- if @sleep >= BRAVO_HTS::SLEEP_STAT_DECREASE[:defense][1] && BRAVO_HTS::HTS_USE[2] == true
- sleep = value * (BRAVO_HTS::SLEEP_STAT_DECREASE[:defense][0] * 0.01)
- value = value - sleep
- end
- when 4 # Magic Attack Parameter
- if @hunger >= BRAVO_HTS::HUNGER_STAT_DECREASE[:mattack][1] && BRAVO_HTS::HTS_USE[0] == true
- hunger = value * (BRAVO_HTS::HUNGER_STAT_DECREASE[:mattack][0] * 0.01)
- value = value - hunger
- end
- if @thirst >= BRAVO_HTS::THIRST_STAT_DECREASE[:mattack][1] && BRAVO_HTS::HTS_USE[1] == true
- thirst = value * (BRAVO_HTS::THIRST_STAT_DECREASE[:mattack][0] * 0.01)
- value = value - thirst
- end
- if @sleep >= BRAVO_HTS::SLEEP_STAT_DECREASE[:mattack][1] && BRAVO_HTS::HTS_USE[2] == true
- sleep = value * (BRAVO_HTS::SLEEP_STAT_DECREASE[:mattack][0] * 0.01)
- value = value - sleep
- end
- when 5 # Magic Defense Parameter
- if @hunger >= BRAVO_HTS::HUNGER_STAT_DECREASE[:mdefense][1] && BRAVO_HTS::HTS_USE[0] == true
- hunger = value * (BRAVO_HTS::HUNGER_STAT_DECREASE[:mdefense][0] * 0.01)
- value = value - hunger
- end
- if @thirst >= BRAVO_HTS::THIRST_STAT_DECREASE[:mdefense][1] && BRAVO_HTS::HTS_USE[1] == true
- thirst = value * (BRAVO_HTS::THIRST_STAT_DECREASE[:mdefense][0] * 0.01)
- value = value - thirst
- end
- if @sleep >= BRAVO_HTS::SLEEP_STAT_DECREASE[:mdefense][1] && BRAVO_HTS::HTS_USE[2] == true
- sleep = value * (BRAVO_HTS::SLEEP_STAT_DECREASE[:mdefense][0] * 0.01)
- value = value - sleep
- end
- when 6 # Agility Parameter
- if @hunger >= BRAVO_HTS::HUNGER_STAT_DECREASE[:agility][1] && BRAVO_HTS::HTS_USE[0] == true
- hunger = value * (BRAVO_HTS::HUNGER_STAT_DECREASE[:agility][0] * 0.01)
- value = value - hunger
- end
- if @thirst >= BRAVO_HTS::THIRST_STAT_DECREASE[:agility][1] && BRAVO_HTS::HTS_USE[1] == true
- thirst = value * (BRAVO_HTS::THIRST_STAT_DECREASE[:agility][0] * 0.01)
- value = value - thirst
- end
- if @sleep >= BRAVO_HTS::SLEEP_STAT_DECREASE[:agility][1] && BRAVO_HTS::HTS_USE[2] == true
- sleep = value * (BRAVO_HTS::SLEEP_STAT_DECREASE[:agility][0] * 0.01)
- value = value - sleep
- end
- end
- [[value, param_max(param_id)].min, param_min(param_id)].max.to_i
- end
- #--------------------------------------------------------------------------
- # * Hunger Rate
- #--------------------------------------------------------------------------
- def hunger_rate
- @hunger.to_f / @hunger_max
- end
- #--------------------------------------------------------------------------
- # * Thirst Rate
- #--------------------------------------------------------------------------
- def thirst_rate
- @thirst.to_f / @thirst_max
- end
- #--------------------------------------------------------------------------
- # * Sleep Rate
- #--------------------------------------------------------------------------
- def sleep_rate
- @sleep.to_f / @sleep_max
- end
- end
- #==============================================================================
- # ** Game_Party
- #==============================================================================
- class Game_Party < Game_Unit
- #--------------------------------------------------------------------------
- # * Increase Steps
- #--------------------------------------------------------------------------
- alias bravo_hts_increase_steps increase_steps
- def increase_steps
- bravo_hts_increase_steps
- members.each do |actor|
- actor.hunger += BRAVO_HTS::HTS_INCREASE[0] if BRAVO_HTS::HTS_USE[0] == true
- actor.thirst += BRAVO_HTS::HTS_INCREASE[1] if BRAVO_HTS::HTS_USE[1] == true
- actor.sleep += BRAVO_HTS::HTS_INCREASE[2] if BRAVO_HTS::HTS_USE[2] == true
- actor.check_death
- end
- end
- end
- #==============================================================================
- # ** Game_Player
- #==============================================================================
- class Game_Player < Game_Character
- #--------------------------------------------------------------------------
- # * Determine if Dashing
- #--------------------------------------------------------------------------
- alias bravo_hts_dash? dash?
- def dash?
- if BRAVO_HTS::DIASBLE_DASH_METHOD == :leader
- return false if $game_party.leader.hunger >= BRAVO_HTS::DISABLE_DASH[0]
- return false if $game_party.leader.thirst >= BRAVO_HTS::DISABLE_DASH[1]
- return false if $game_party.leader.sleep >= BRAVO_HTS::DISABLE_DASH[2]
- elsif BRAVO_HTS::DIASBLE_DASH_METHOD == :party
- $game_party.members.each do |actor|
- return false if actor.hunger >= BRAVO_HTS::DISABLE_DASH[0]
- return false if actor.thirst >= BRAVO_HTS::DISABLE_DASH[1]
- return false if actor.sleep >= BRAVO_HTS::DISABLE_DASH[2]
- end
- end
- bravo_hts_dash?
- end
- end
- #==============================================================================
- # ** Game_Interpreter
- #==============================================================================
- class Game_Interpreter
- #--------------------------------------------------------------------------
- # * Change Hunger
- #--------------------------------------------------------------------------
- def change_hunger(actor, amount)
- if actor == 0
- $game_party.members.each do |actor|
- actor.hunger += amount
- actor.check_death
- end
- else
- $game_actors[actor].hunger += amount
- $game_actors[actor].check_death
- end
- end
- #--------------------------------------------------------------------------
- # * Change Thirst
- #--------------------------------------------------------------------------
- def change_thirst(actor, amount)
- if actor == 0
- $game_party.members.each do |actor|
- actor.thirst += amount
- actor.check_death
- end
- else
- $game_actors[actor].thirst += amount
- $game_actors[actor].check_death
- end
- end
- #--------------------------------------------------------------------------
- # * Change Sleep
- #--------------------------------------------------------------------------
- def change_sleep(actor, amount)
- if actor == 0
- $game_party.members.each do |actor|
- actor.sleep += amount
- actor.check_death
- end
- else
- $game_actors[actor].sleep += amount
- $game_actors[actor].check_death
- end
- end
- #~ #--------------------------------------------------------------------------
- #~ # * Change Sleep
- #~ #--------------------------------------------------------------------------
- #~ def change_sleep(param1, param2, param3, param4, param5)
- #~ value = operate_value(param3, param4, param5)
- #~ iterate_actor_var(param1, param2) do |actor|
- #~ actor.sleep += value
- #~ actor.check_death
- #~ end
- #~ end
- end
- #==============================================================================
- # ** Window_Base
- #==============================================================================
- class Window_Base < Window
- #--------------------------------------------------------------------------
- # * Draw Hunger
- #--------------------------------------------------------------------------
- def draw_actor_hunger(actor, x, y, width = 124)
- draw_gauge(x, y, width, actor.hunger_rate, hp_gauge_color1, hp_gauge_color2)
- change_color(system_color)
- draw_text(x-17, y, 124, line_height, BRAVO_HTS::HTS_NAMES[0])
- draw_current_and_max_values(x, y, width, actor.hunger, actor.hunger_max,
- normal_color, normal_color)
- end
- #--------------------------------------------------------------------------
- # * Draw Thirst
- #--------------------------------------------------------------------------
- def draw_actor_thirst(actor, x, y, width = 124)
- draw_gauge(x, y, width, actor.thirst_rate, hp_gauge_color1, hp_gauge_color2)
- change_color(system_color)
- draw_text(x-17, y, 124, line_height, BRAVO_HTS::HTS_NAMES[1])
- draw_current_and_max_values(x, y, width, actor.thirst, actor.thirst_max,
- normal_color, normal_color)
- end
- #--------------------------------------------------------------------------
- # * Draw Sleep
- #--------------------------------------------------------------------------
- def draw_actor_sleep(actor, x, y, width = 124)
- draw_gauge(x, y, width, actor.sleep_rate, hp_gauge_color1, hp_gauge_color2)
- change_color(system_color)
- draw_text(x-17, y, 124, line_height, BRAVO_HTS::HTS_NAMES[2])
- draw_current_and_max_values(x, y, width, actor.sleep, actor.sleep_max,
- normal_color, normal_color)
- end
- end
- #==============================================================================
- # ** Window_Status
- #==============================================================================
- class Window_Status < Window_Selectable
- #--------------------------------------------------------------------------
- # * Public Instance Variables
- #--------------------------------------------------------------------------
- attr_accessor :info
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- alias bravo_hts_initialize initialize
- def initialize(actor)
- bravo_hts_initialize(actor)
- @info = 0
- end
- #--------------------------------------------------------------------------
- # * Draw Block 2
- #--------------------------------------------------------------------------
- def draw_block2(y)
- draw_actor_face(@actor, 8, y)
- draw_basic_info(136, y)
- if @info == 1
- draw_hts_info(304, y)
- else
- draw_exp_info(304, y)
- end
- draw_press_shift(0, y - line_height)
- end
- #--------------------------------------------------------------------------
- # * Draw HTS Information
- #--------------------------------------------------------------------------
- def draw_hts_info(x, y)
- draw_actor_hunger(@actor, x+17, y) if BRAVO_HTS::HTS_USE[0] == true
- if BRAVO_HTS::HTS_USE[0] == false
- draw_actor_thirst(@actor, x+17, y) if BRAVO_HTS::HTS_USE[1] == true
- else
- draw_actor_thirst(@actor, x+17, y+line_height) if BRAVO_HTS::HTS_USE[1] == true
- end
- if BRAVO_HTS::HTS_USE[0] == false || BRAVO_HTS::HTS_USE[1] == false
- draw_actor_sleep(@actor, x+17, y+line_height) if BRAVO_HTS::HTS_USE[2] == true
- else
- draw_actor_sleep(@actor, x+17, y+line_height*2) if BRAVO_HTS::HTS_USE[2] == true
- end
- end
- #--------------------------------------------------------------------------
- # * Draw Press Shift
- #--------------------------------------------------------------------------
- def draw_press_shift(x, y)
- text = "按SHIFT键查看饥饿、口渴和疲劳信息."
- draw_text(x, y, 520, line_height, text, 2)
- end
- end
- #==============================================================================
- # ** Window_HTS
- #==============================================================================
- class Window_HTS < Window_Base
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize(x, y)
- super(x, y, 165, window_height)
- self.opacity = BRAVO_HTS::HTS_HUD_OPACITY
- refresh
- end
- #--------------------------------------------------------------------------
- # * Get Window Width
- #--------------------------------------------------------------------------
- def window_height
- n = 0
- if BRAVO_HTS::HTS_USE[0] == true
- n += 1
- end
- if BRAVO_HTS::HTS_USE[1] == true
- n += 1
- end
- if BRAVO_HTS::HTS_USE[2] == true
- n += 1
- end
- return fitting_height(n)
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh
- contents.clear
- actor = $game_party.leader
- draw_actor_hunger(actor, 17, 0) if BRAVO_HTS::HTS_USE[0] == true
- if BRAVO_HTS::HTS_USE[0] == false
- draw_actor_thirst(actor, 17, 0) if BRAVO_HTS::HTS_USE[1] == true
- else
- draw_actor_thirst(actor, 17, line_height) if BRAVO_HTS::HTS_USE[1] == true
- end
- if BRAVO_HTS::HTS_USE[0] == false || BRAVO_HTS::HTS_USE[1] == false
- draw_actor_sleep(actor, 17, line_height) if BRAVO_HTS::HTS_USE[2] == true
- else
- draw_actor_sleep(actor, 17, line_height*2) if BRAVO_HTS::HTS_USE[2] == true
- end
- end
- end
- #==============================================================================
- # ** Scene_Map
- #==============================================================================
- class Scene_Map < Scene_Base
- #--------------------------------------------------------------------------
- # * Termination Processing
- #--------------------------------------------------------------------------
- alias bravo_hts_terminate terminate
- def terminate
- if BRAVO_HTS::HTS_HUD_BACK != ""
- @hts_view.dispose
- end
- bravo_hts_terminate
- end
- #--------------------------------------------------------------------------
- # * Frame Update
- #--------------------------------------------------------------------------
- alias bravo_hts_update update
- def update
- bravo_hts_update
- if $game_switches[BRAVO_HTS::HTS_HUD_SWITCH] == true
- @hts_window.show
- if BRAVO_HTS::HTS_HUD_BACK != ""
- @hts_hud.visible = true
- end
- @hts_window.refresh
- else
- @hts_window.hide
- if BRAVO_HTS::HTS_HUD_BACK != ""
- @hts_hud.visible = false
- end
- end
- end
- #--------------------------------------------------------------------------
- # * Create All Windows
- #--------------------------------------------------------------------------
- alias bravo_hts_create_all_windows create_all_windows
- def create_all_windows
- bravo_hts_create_all_windows
- @hts_window = Window_HTS.new(BRAVO_HTS::HTS_HUD_X, BRAVO_HTS::HTS_HUD_Y)
- @hts_window.hide
- if BRAVO_HTS::HTS_HUD_BACK != ""
- @hts_hud = Sprite.new
- @hts_hud.bitmap = Cache.system(BRAVO_HTS::HTS_HUD_BACK)
- @hts_hud.x = BRAVO_HTS::HTS_HUD_X
- @hts_hud.y = BRAVO_HTS::HTS_HUD_Y
- @hts_hud.visible = false
- end
- end
- end
- #==============================================================================
- # ** Scene_Status
- #==============================================================================
- class Scene_Status < Scene_MenuBase
- #--------------------------------------------------------------------------
- # * Frame Update
- #--------------------------------------------------------------------------
- def update
- super
- if Input.trigger?(:SHIFT)
- if @status_window.info == 0
- @status_window.info = 1
- elsif @status_window.info == 1
- @status_window.info = 0
- end
- @status_window.refresh
- end
- end
- end
- #==============================================================================
- # ** Scene_Battle
- #==============================================================================
- class Scene_Battle < Scene_Base
- #--------------------------------------------------------------------------
- # * Processing at End of Action
- #--------------------------------------------------------------------------
- alias bravo_hts_process_action_end process_action_end
- def process_action_end
- if @subject.is_a?(Game_Actor)
- @subject.check_death
- end
- bravo_hts_process_action_end
- end
- end
复制代码
脚本2- # )--------------------------------------------------(
- # )-- Author: Mr Trivel --(
- # )-- Name: 饥渴系统 --(
- # )-- Created: 2014-06-08 --(
- # )-- Version: 1.1 --(
- # )--------------------------------------------------(
- # )-- v1.1 - Negative Quench values can now be used--(
- # )-- to make the person more thirsty. --(
- # )--------------------------------------------------(
- # )-- Requires: None --(
- # )--------------------------------------------------(
- # )-- 说明 --(
- # )-- 角色会感到饥渴! 饥渴度= 0 时会开始失去hp --(
- # )--------------------------------------------------(
- # )-- 使用方法 --(
- # )-- 使用物品备注: <Quench: X> (该物品必须可消耗) --(
- # )-- 可以恢复 X% 的饥渴值. --(
- # )--------------------------------------------------(
- # )-- Thanks to TheoAllen for helping with item --(
- # )-- targets. --(
- # )--------------------------------------------------(
- # )-- LICENSE INFO --(
- # )--http://mrtrivelvx.wordpress.com/terms-of-use/ --(
- # )--------------------------------------------------(
- module MrTS
- module Thirst
- LEVELS = {
- # )--------------------------------------------------(
- # )-- 在菜单中显示的饥渴程度文字 --(
- # )-- 如果饥渴值 >= X, 则会显示该等级的文字--(
- # )-- X - 0..100 --(
- # )--------------------------------------------------(
- # )-- X => "文本" --(
- # )--------------------------------------------------(
- 65 => "不渴",
- 30 => "口渴",
- 1 => "脱水",
- 0 => "渴死"
- # )--------------------------------------------------(
- }
- # )--------------------------------------------------(
- # )-- 角色初始饥渴值. --(
- # )-- 默认: 70, 代表角色一开始的饥渴度为 70% . --(
- # )--------------------------------------------------(
- DEFAULT_THIRST = 70
-
- # )--------------------------------------------------(
- # )-- 每回合失去多少饥渴度. --(
- # )--------------------------------------------------(
- LOSE_THIRST_PER = 7
-
- # )--------------------------------------------------(
- # )-- 如果角色饥渴度=0,饥渴度再次减少时,会失去多少hp. --(
- # )--------------------------------------------------(
- THIRST_DAMAGE = 25
- end
- end
- # )--------------------------------------------------(
- $imported = {} if $imported.nil? # --(
- $imported["MrTS_Thirst"] = true # --(
- # )--------------------------------------------------(
- # )----------------------------------------(
- # )-- Class: Game_Actor < Game_Battler --(
- # )----------------------------------------(
- class Game_Actor < Game_Battler
-
- # )-------------------------------(
- # )-- Public access variables --(
- # )-------------------------------(
- attr_accessor :thirst
-
- # )-----------------------(
- # )-- Alias to: setup --(
- # )-----------------------(
- alias mrts_ga_setup setup
- def setup(*args)
- mrts_ga_setup(*args)
- @thirst = MrTS::Thirst::DEFAULT_THIRST
- end
-
- # )------------------------------------(
- # )-- New Method: get_thirst_level --(
- # )------------------------------------(
- def get_thirst_level
- MrTS::Thirst::LEVELS.each do |val, txt|
- if @thirst >= val
- return txt
- end
- end
- return ""
- end
-
- # )-------------------------------(
- # )-- New Method: lose_thirst --(
- # )-------------------------------(
- def lose_thirst
- if @thirst >= 1
- @thirst -= 1
- elsif @thirst <= 0
- self.hp -= MrTS::Thirst::THIRST_DAMAGE
- end
- end
-
- # )----------------------------(
- # )-- Alias to: item_apply --(
- # )----------------------------(
- alias mrts_item_apply item_apply
- def item_apply(user, item)
- mrts_item_apply(user, item)
- item.note[/<[q-qQ-Q]uench:\s*(-*\d*)>/]
- if $1
- self.thirst += $1.to_i
- self.thirst = 100 if self.thirst > 100
- self.thirst = 0 if self.thirst < 0
- end
- end
-
- # )-----------------------------------(
- # )-- Overwrite Method: item_test --(
- # )-----------------------------------(
- def item_test(user, item)
- item.note[/<[q-qQ-Q]uench:\s*(-*\d*)>/]
- return false if item.for_dead_friend? != dead?
- return true if $game_party.in_battle
- return true if item.for_opponent?
- return true if item.damage.recover? && item.damage.to_hp? && hp < mhp
- return true if item.damage.recover? && item.damage.to_mp? && mp < mmp
- return true if item_has_any_valid_effects?(user, item)
- return true if $1
-
- return false
- end
-
- end
- # )----------------------------------------------------(
- # )-- Class: Window_MenuStatus < Window_Selectable --(
- # )----------------------------------------------------(
- class Window_MenuStatus < Window_Selectable
-
- # )-----------------------------------(
- # )-- Overwrite Method: draw_item --(
- # )-----------------------------------(
- def draw_item(index)
- actor = $game_party.members[index]
- enabled = $game_party.battle_members.include?(actor)
- rect = item_rect(index)
- rect.y -= line_height/2
- draw_item_background(index)
- draw_actor_face(actor, rect.x + 1, rect.y + 1 + line_height/2, enabled)
- draw_actor_simple_status(actor, rect.x + 108, rect.y + line_height / 2)
- draw_thirst_gauge(actor, rect.x + 108 + 120, rect.y + line_height * 3 + line_height/2)
- end
- end
- # )--------------------------(
- # )-- Class: Window_Base --(
- # )--------------------------(
- class Window_Base
-
- # )-------------------------------------(
- # )-- New Method: draw_thirst_gauge --(
- # )-------------------------------------(
- def draw_thirst_gauge(actor, x, y, width=124, height=line_height)
- draw_gauge(x, y, width, actor.thirst.to_f/100.0, text_color(16), text_color(23) )
- draw_text(x, y, width, line_height, actor.get_thirst_level)
- end
- end
- # )-------------------------------------------(
- # )-- Class: Game_Player < Game_Character --(
- # )-------------------------------------------(
- class Game_Player < Game_Character
-
- # )--------------------------------(
- # )-- Alias to: increase_steps --(
- # )--------------------------------(
- alias mrts_gp_increase_steps increase_steps
- def increase_steps
- mrts_gp_increase_steps
- if $game_party.steps % MrTS::Thirst::LOSE_THIRST_PER == 0
- $game_party.all_members.each { |actor| actor.lose_thirst }
- end
- end
- end
复制代码
脚本3- #-----------------------------------------------------------------
- # 饥饿系统
- # 作者:milanda
- # 制作时间:18,7,26
- #----------------------------------------------------------------
- # 物品设置:
- # <解饿:x>
- # x为填充饥饿的数量
- #-----------------------------------------------------------------
- module Mi
- module Hunger
- #开始游戏时候以这个饥饿值开始
- DEFAULT_HUNGER = 100
- #下面是设置显示词的
- LEVELS = {
- 100 => "充实",
- 60 => "正常",
- 30 => "略饿",
- 1 => "很饿",
- 0 => "饿死"
- } #不可以删除
- LOSE_HUNGER_PER = 7 #每走x步消耗饥饿值
- HUNGER_DAMAGE = 25 #每走x步所扣的血量
- end
- end
- #---------------------------------------------
- # 开始设置
- #---------------------------------------------
- $imported = {} if $imported.nil?
- $imported["Mi_Jie"] = true
- # ----------------------------------------
- # 赋予: Game_Actor < Game_Battler
- # ----------------------------------------
- class Game_Actor < Game_Battler
-
- # -------------------------------
- # 访问变量
- # -------------------------------
- attr_accessor :hunger
-
- # -----------------------
- # 别名: setup
- # -----------------------
- alias mrts_ga_setup setup
- def setup(*args)
- mrts_ga_setup(*args)
- @hunger = Mi::Hunger::DEFAULT_HUNGER
- end
-
- # ------------------------------------
- # 新方法: get_hunger_level
- # ------------------------------------
- def get_hunger_level
- Mi::Hunger::LEVELS.each do |val, txt|
- if @hunger >= val
- return txt
- end
- end
- return ""
- end
-
- # -------------------------------
- # 新方法: lose_hunger
- # -------------------------------
- def lose_hunger
- if @hunger >= 1
- @hunger -= 1
- elsif @hunger <= 0
- self.hp -= Mi::Hunger::HUNGER_DAMAGE
- end
- end
-
- # ----------------------------
- # 新方法: item_apply
- # )----------------------------
- alias mrts_item_apply item_apply
- def item_apply(user, item)
- mrts_item_apply(user, item)
- item.note[/<[q-qQ-Q]解饿:\s*(-*\d*)>/]
- if $1
- self.hunger += $1.to_i
- self.hunger = 100 if self.hunger > 100
- self.hunger = 0 if self.hunger < 0
- end
- end
-
- # -----------------------------------
- # 覆盖方式: item_test
- # -----------------------------------
- def item_test(user, item)
- item.note[/<[q-qQ-Q]解饿:\s*(-*\d*)>/]
- return false if item.for_dead_friend? != dead?
- return true if $game_party.in_battle
- return true if item.for_opponent?
- return true if item.damage.recover? && item.damage.to_hp? && hp < mhp
- return true if item.damage.recover? && item.damage.to_mp? && mp < mmp
- return true if item_has_any_valid_effects?(user, item)
- return true if $1
-
- return false
- end
-
- end
- # ----------------------------------------------------
- # 赋予: Window_MenuStatus < Window_Selectable
- # ----------------------------------------------------
- class Window_MenuStatus < Window_Selectable
-
- # -----------------------------------
- # 覆盖方法: draw_item
- # -----------------------------------
- def draw_item(index)
- actor = $game_party.members[index]
- enabled = $game_party.battle_members.include?(actor)
- rect = item_rect(index)
- rect.y -= line_height/2
- draw_item_background(index)
- draw_actor_face(actor, rect.x + 1, rect.y + 1 + line_height/2, enabled)
- draw_actor_simple_status(actor, rect.x + 108, rect.y + line_height / 2)
- draw_hunger_gauge(actor, rect.x + 108 + 120, rect.y + line_height * 3 + line_height/2)
- end
- end
- # --------------------------
- # 分类: Window_Base
- # --------------------------
- class Window_Base
-
- # -------------------------------------
- # 新方法: draw_hunger_gauge
- # -------------------------------------
- def draw_hunger_gauge(actor, x, y, width=124, height=line_height)
- draw_gauge(x, y, width, actor.hunger.to_f/100.0, text_color(16), text_color(23) )
- draw_text(x, y, width, line_height, actor.get_hunger_level)
- end
- end
- # -------------------------------------------
- # 赋予: Game_Player < Game_Character
- # -------------------------------------------
- class Game_Player < Game_Character
-
- # --------------------------------
- # 别名: increase_steps
- # --------------------------------
- alias mrts_gp_increase_steps increase_steps
- def increase_steps
- mrts_gp_increase_steps
- if $game_party.steps % Mi::Hunger::LOSE_HUNGER_PER == 0
- $game_party.all_members.each { |actor| actor.lose_hunger }
- end
- end
- end
复制代码
|
评分
-
查看全部评分
|