Project1
标题:
XP口袋妖怪脚本(持续更新)
[打印本页]
作者:
残花;高飞
时间:
2014-5-3 19:11
标题:
XP口袋妖怪脚本(持续更新)
战斗系统为横版(有5个要分别打在原来的战斗脚本上替换,第五个自己插入在空白处。)
战斗系统1:
#==============================================================================
# ■ Scene_Battle (分割定义 1)
#------------------------------------------------------------------------------
# 处理战斗画面的类。
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# ● 主处理
#--------------------------------------------------------------------------
def main
######################
$game_party.remove_actor(387)
######################
# 初始化战斗用的各种暂时数据
$game_temp.in_battle = true
$game_temp.battle_turn = 0
$game_temp.battle_event_flags.clear
$game_temp.battle_abort = false
$game_temp.battle_main_phase = false
$game_temp.battleback_name = $game_map.battleback_name
$game_temp.forcing_battler = nil
# 初始化战斗用事件解释器
$game_system.battle_interpreter.setup(nil, 0)
# 准备队伍
@troop_id = $game_temp.battle_troop_id
$game_troop.setup(@troop_id)
# 生成角色命令窗口
s1 = $data_system.words.attack
s2 = $data_system.words.skill
s3 = $data_system.words.guard
s4 = $data_system.words.item
@actor_command_window = Window_Command.new(160, [s1, s2, s3, s4,"逃跑"])
@actor_command_window.y = 160
@actor_command_window.back_opacity = 160
@actor_command_window.active = false
@actor_command_window.visible = false
# 生成其它窗口
@party_command_window = Window_PartyCommand.new
@help_window = Window_Help.new
@help_window.back_opacity = 160
@help_window.visible = false
@status_window = Window_BattleStatus.new
@message_window = Window_Message.new
# 生成活动块
@spriteset = Spriteset_Battle.new
# 初始化等待计数
@wait_count = 0
###########################
$game_variables[29] = $game_temp.battle_troop_id
$game_variables[24] += 1
$game_variables[26] += 1
#战斗开始加入图片
@sprite = Sprite.new
@sprite.bitmap = RPG::Cache.picture("战斗界面" + $game_party.actors.size.to_s)
###########################
# 执行过渡
if $data_system.battle_transition == ""
Graphics.transition(20)
else
Graphics.transition(40, "Graphics/Transitions/" +
$data_system.battle_transition)
end
# 开始自由战斗回合
start_phase1
# 主循环
loop do
# 刷新游戏画面
Graphics.update
# 刷新输入信息
Input.update
# 刷新画面
update
# 如果画面切换的话就中断循环
if $scene != self
break
end
end
# 刷新地图
$game_map.refresh
# 准备过渡
Graphics.freeze
# 释放窗口
######################
#[387号人物加入]
$game_party.add_actor(387)
$game_variables[25] = 0
$game_variables[26] -= 1
$game_variables[98] = 0
$game_variables[99] = 0
######################
@sprite.bitmap.dispose
@sprite.dispose
######################
@actor_command_window.dispose
@party_command_window.dispose
@help_window.dispose
@status_window.dispose
@message_window.dispose
if @skill_window != nil
@skill_window.dispose
end
if @item_window != nil
@item_window.dispose
end
if @result_window != nil
@result_window.dispose
end
# 释放活动块
@spriteset.dispose
# 标题画面切换中的情况
if $scene.is_a?(Scene_Title)
# 淡入淡出画面
Graphics.transition
Graphics.freeze
end
# 战斗测试或者游戏结束以外的画面切换中的情况
if $BTEST and not $scene.is_a?(Scene_Gameover)
$scene = nil
end
end
#--------------------------------------------------------------------------
# ● 胜负判定
#--------------------------------------------------------------------------
def judge
# 全灭判定是真、并且同伴人数为 0 的情况下
if $game_party.all_dead? or $game_party.actors.size == 0
# 允许失败的情况下
if $game_temp.battle_can_lose
# 还原为战斗开始前的 BGM
$game_system.bgm_play($game_temp.map_bgm)
#############################
$game_variables[22] += 1
##############################
# 战斗结束
battle_end(2)
# 返回 true
return true
end
# 设置游戏结束标志
$game_temp.gameover = true
# 返回 true
return true
end
# 如果存在任意 1 个敌人就返回 false
for enemy in $game_troop.enemies
if enemy.exist?
return false
end
end
# 开始结束战斗回合 (胜利)
start_phase5
# 返回 true
return true
end
#--------------------------------------------------------------------------
# ● 战斗结束
# result : 結果 (0:胜利 1:失败 2:逃跑)
#--------------------------------------------------------------------------
def battle_end(result)
# 清除战斗中标志
$game_temp.in_battle = false
# 清除全体同伴的行动
$game_party.clear_actions
# 解除战斗用状态
for actor in $game_party.actors
actor.remove_states_battle
end
# 清除敌人
$game_troop.enemies.clear
# 调用战斗返回调用
if $game_temp.battle_proc != nil
$game_temp.battle_proc.call(result)
$game_temp.battle_proc = nil
end
# 切换到地图画面
$scene = Scene_Map.new
end
#--------------------------------------------------------------------------
# ● 设置战斗事件
#--------------------------------------------------------------------------
def setup_battle_event
# 正在执行战斗事件的情况下
if $game_system.battle_interpreter.running?
return
end
# 搜索全部页的战斗事件
for index in 0...$data_troops[@troop_id].pages.size
# 获取事件页
page = $data_troops[@troop_id].pages[index]
# 事件条件可以参考 c
c = page.condition
# 没有指定任何条件的情况下转到下一页
unless c.turn_valid or c.enemy_valid or
c.actor_valid or c.switch_valid
next
end
# 执行完毕的情况下转到下一页
if $game_temp.battle_event_flags[index]
next
end
# 确认回合条件
if c.turn_valid
n = $game_temp.battle_turn
a = c.turn_a
b = c.turn_b
if (b == 0 and n != a) or
(b > 0 and (n < 1 or n < a or n % b != a % b))
next
end
end
# 确认敌人条件
if c.enemy_valid
enemy = $game_troop.enemies[c.enemy_index]
if enemy == nil or enemy.hp * 100.0 / enemy.maxhp > c.enemy_hp
next
end
end
# 确认角色条件
if c.actor_valid
actor = $game_actors[c.actor_id]
if actor == nil or actor.hp * 100.0 / actor.maxhp > c.actor_hp
next
end
end
# 确认开关条件
if c.switch_valid
if $game_switches[c.switch_id] == false
next
end
end
# 设置事件
$game_system.battle_interpreter.setup(page.list, 0)
# 本页的范围是 [战斗] 或 [回合] 的情况下
if page.span <= 1
# 设置执行结束标志
$game_temp.battle_event_flags[index] = true
end
return
end
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
# 执行战斗事件中的情况下
if $game_system.battle_interpreter.running?
# 刷新解释器
$game_system.battle_interpreter.update
# 强制行动的战斗者不存在的情况下
if $game_temp.forcing_battler == nil
# 执行战斗事件结束的情况下
unless $game_system.battle_interpreter.running?
# 继续战斗的情况下、再执行战斗事件的设置
unless judge
setup_battle_event
end
end
# 如果不是结束战斗回合的情况下
if @phase != 5
# 刷新状态窗口
@status_window.refresh
end
end
end
# 系统 (计时器)、刷新画面
$game_system.update
$game_screen.update
# 计时器为 0 的情况下
if $game_system.timer_working and $game_system.timer == 0
# 中断战斗
$game_temp.battle_abort = true
end
# 刷新窗口
@help_window.update
@party_command_window.update
@actor_command_window.update
@status_window.update
@message_window.update
# 刷新活动块
@spriteset.update
# 处理过渡中的情况下
if $game_temp.transition_processing
# 清除处理过渡中标志
$game_temp.transition_processing = false
# 执行过渡
if $game_temp.transition_name == ""
Graphics.transition(20)
else
Graphics.transition(40, "Graphics/Transitions/" +
$game_temp.transition_name)
end
end
# 显示信息窗口中的情况下
if $game_temp.message_window_showing
return
end
# 显示效果中的情况下
if @spriteset.effect?
return
end
# 游戏结束的情况下
if $game_temp.gameover
# 切换到游戏结束画面
$scene = Scene_Gameover.new
return
end
# 返回标题画面的情况下
if $game_temp.to_title
# 切换到标题画面
$scene = Scene_Title.new
return
end
# 中断战斗的情况下
if $game_temp.battle_abort
# 还原为战斗前的 BGM
$game_system.bgm_play($game_temp.map_bgm)
# 战斗结束
battle_end(1)
return
end
# 等待中的情况下
if @wait_count > 0
# 减少等待计数
@wait_count -= 1
return
end
# 强制行动的角色存在、
# 并且战斗事件正在执行的情况下
if $game_temp.forcing_battler == nil and
$game_system.battle_interpreter.running?
return
end
# 回合分支
case @phase
when 1 # 自由战斗回合
update_phase1
when 2 # 同伴命令回合
update_phase2
when 3 # 角色命令回合
update_phase3
when 4 # 主回合
update_phase4
when 5 # 战斗结束回合
update_phase5
end
end
end
复制代码
战斗系统2:
#==============================================================================
# ■ Scene_Battle (分割定义 2)
#------------------------------------------------------------------------------
# 处理战斗画面的类。
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# ● 开始自由战斗回合
#--------------------------------------------------------------------------
def start_phase1
# 转移到回合 1
@phase = 1
# 清除全体同伴的行动
$game_party.clear_actions
# 设置战斗事件
setup_battle_event
end
#--------------------------------------------------------------------------
# ● 刷新画面 (自由战斗回合)
#--------------------------------------------------------------------------
def update_phase1
# 胜败判定
if judge
# 胜利或者失败的情况下 : 过程结束
return
end
# 开始同伴命令回合
start_phase3
end
#--------------------------------------------------------------------------
# ● 开始同伴命令回合
#--------------------------------------------------------------------------
def start_phase2
# 转移到回合 2
@phase = 2
# 设置角色为非选择状态
@actor_index = -1
@active_battler = nil
# 有效化同伴指令窗口
@party_command_window.active = true
@party_command_window.visible = true
# 无效化角色指令窗口
@actor_command_window.active = false
@actor_command_window.visible = false
# 清除主回合标志
$game_temp.battle_main_phase = false
# 清除全体同伴的行动
$game_party.clear_actions
# 不能输入命令的情况下
unless $game_party.inputable?
# 开始主回合
start_phase4
end
end
#--------------------------------------------------------------------------
# ● 刷新画面 (同伴命令回合)
#--------------------------------------------------------------------------
def update_phase2
# 开始主回合
start_phase3
end
#--------------------------------------------------------------------------
# ● 开始结束战斗回合
#--------------------------------------------------------------------------
def start_phase5
# 转移到回合 5
@phase = 5
# 演奏战斗结束 ME
$game_system.me_play($game_system.battle_end_me)
# 还原为战斗开始前的 BGM
$game_system.bgm_play($game_temp.map_bgm)
# 初始化 EXP、金钱、宝物
exp = 0
gold = 0
treasures = []
# 循环
for enemy in $game_troop.enemies
# 敌人不是隐藏状态的情况下
unless enemy.hidden
# 获得 EXP、增加金钱
exp += enemy.exp
gold += enemy.gold
# 出现宝物判定
if rand(100) < enemy.treasure_prob
if enemy.item_id > 0
treasures.push($data_items[enemy.item_id])
end
if enemy.weapon_id > 0
treasures.push($data_weapons[enemy.weapon_id])
end
if enemy.armor_id > 0
treasures.push($data_armors[enemy.armor_id])
end
end
end
end
# 限制宝物数为 6 个
treasures = treasures[0..5]
# 获得 EXP
exp=(exp/$game_party.actors.size).to_i
# 平分后避免有点数出现,要使用.to_i
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
if actor.cant_get_exp? == false
last_level = actor.level
actor.exp += exp
if actor.level > last_level
@status_window.level_up(i)
end
end
end
# 获得金钱
$game_party.gain_gold(gold)
# 获得宝物
for item in treasures
case item
when RPG::Item
$game_party.gain_item(item.id, 1)
when RPG::Weapon
$game_party.gain_weapon(item.id, 1)
when RPG::Armor
$game_party.gain_armor(item.id, 1)
end
end
# 生成战斗结果窗口
@result_window = Window_BattleResult.new(exp, gold, treasures)
# 设置等待计数
@phase5_wait_count = 100
end
#--------------------------------------------------------------------------
# ● 画面更新 (结束战斗回合)
#--------------------------------------------------------------------------
def update_phase5
# 等待计数大于 0 的情况下
if @phase5_wait_count > 0
# 减少等待计数
@phase5_wait_count -= 1
# 等待计数为 0 的情况下
if @phase5_wait_count == 0
# 显示结果窗口
@result_window.visible = true
# 清除主回合标志
$game_temp.battle_main_phase = false
# 刷新状态窗口
@status_window.refresh
end
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 战斗结束
battle_end(0)
end
end
end
复制代码
战斗系统3:
#==============================================================================
# ■ Scene_Battle (分割定义 3)
#------------------------------------------------------------------------------
# 处理战斗画面的类。
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# ● 开始角色命令回合
#--------------------------------------------------------------------------
def start_phase3
# 转移到回合 3
@phase = 3
# 设置觉得为非选择状态
@actor_index = -1
@active_battler = nil
# 输入下一个角色的命令
phase3_next_actor
end
#--------------------------------------------------------------------------
# ● 转到输入下一个角色的命令
#--------------------------------------------------------------------------
def phase3_next_actor
# 循环
begin
# 角色的明灭效果 OFF
if @active_battler != nil
@active_battler.blink = false
end
# 最后的角色的情况
if @actor_index == $game_party.actors.size-1
# 开始主回合
start_phase4
return
end
# 推进角色索引
@actor_index += 1
@active_battler = $game_party.actors[@actor_index]
@active_battler.blink = true
# 如果角色是在无法接受指令的状态就再试
end until @active_battler.inputable?
# 设置角色的命令窗口
phase3_setup_command_window
end
#--------------------------------------------------------------------------
# ● 转向前一个角色的命令输入
#--------------------------------------------------------------------------
def phase3_prior_actor
# 循环
begin
# 角色的明灭效果 OFF
if @active_battler != nil
@active_battler.blink = false
end
# 最初的角色的情况下
if @actor_index == 0
# 开始同伴指令回合
start_phase2
return
end
# 返回角色索引
@actor_index -= 1
@active_battler = $game_party.actors[@actor_index]
@active_battler.blink = true
# 如果角色是在无法接受指令的状态就再试
end until @active_battler.inputable?
# 设置角色的命令窗口
phase3_setup_command_window
end
#--------------------------------------------------------------------------
# ● 设置角色指令窗口
#--------------------------------------------------------------------------
def phase3_setup_command_window
# 同伴指令窗口无效化
@party_command_window.active = false
@party_command_window.visible = false
# 角色指令窗口无效化
@actor_command_window.active = true
@actor_command_window.visible = true
# 设置角色指令窗口的位置
@actor_command_window.x = @actor_index * 120
# 设置索引为 0
@actor_command_window.index = 0
end
#--------------------------------------------------------------------------
# ● 刷新画面 (角色命令回合)
#--------------------------------------------------------------------------
def update_phase3
# 敌人光标有效的情况下
if @enemy_arrow != nil
update_phase3_enemy_select
# 角色光标有效的情况下
elsif @actor_arrow != nil
update_phase3_actor_select
# 特技窗口有效的情况下
elsif @skill_window != nil
update_phase3_skill_select
# 物品窗口有效的情况下
elsif @item_window != nil
update_phase3_item_select
# 逃跑窗口有效的情况下
elsif @escape_window != nil
update_phase3_escape_select
# 角色指令窗口有效的情况下
elsif @actor_command_window.active
update_phase3_basic_command
end
end
#--------------------------------------------------------------------------
# ● 刷新画面 (角色命令回合 : 基本命令)
#--------------------------------------------------------------------------
def update_phase3_basic_command
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 转向前一个角色的指令输入
phase3_prior_actor
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 角色指令窗口光标位置分之
case @actor_command_window.index
when 0 # 攻击
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 设置行动
@active_battler.current_action.kind = 0
@active_battler.current_action.basic = 0
# 开始选择敌人
start_enemy_select
when 1 # 特技
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 设置行动
@active_battler.current_action.kind = 1
# 开始选择特技
start_skill_select
when 2 # 防御
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 设置行动
@active_battler.current_action.kind = 0
@active_battler.current_action.basic = 1
# 转向下一位角色的指令输入
phase3_next_actor
when 3 # 物品
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 设置行动
@active_battler.current_action.kind = 2
# 开始选择物品
start_item_select
###########################################################################
when 4 # 逃跑
if $game_temp.battle_can_escape == false
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
return
end
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 逃走处理
update_phase3_escape_select
###########################################################################
end
return
end
end
#--------------------------------------------------------------------------
# ● 刷新画面 (角色命令回合 : 选择特技)
#--------------------------------------------------------------------------
def update_phase3_skill_select
# 设置特技窗口为可视状态
@skill_window.visible = true
# 刷新特技窗口
@skill_window.update
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 结束特技选择
end_skill_select
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 获取特技选择窗口现在选择的特技的数据
@skill = @skill_window.skill
# 无法使用的情况下
if @skill == nil or not @active_battler.skill_can_use?(@skill.id)
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
return
end
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 设置行动
@active_battler.current_action.skill_id = @skill.id
# 设置特技窗口为不可见状态
@skill_window.visible = false
# 效果范围是敌单体的情况下
if @skill.scope == 1
# 开始选择敌人
start_enemy_select
# 效果范围是我方单体的情况下
elsif @skill.scope == 3 or @skill.scope == 5
# 开始选择角色
start_actor_select
# 效果范围不是单体的情况下
else
# 选择特技结束
end_skill_select
# 转到下一位角色的指令输入
phase3_next_actor
end
return
end
end
#--------------------------------------------------------------------------
# ● 刷新画面 (角色命令回合 : 选择物品)
#--------------------------------------------------------------------------
def update_phase3_item_select
# 设置物品窗口为可视状态
@item_window.visible = true
# 刷新物品窗口
@item_window.update
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 选择物品结束
end_item_select
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 获取物品窗口现在选择的物品资料
@item = @item_window.item
# 无法使用的情况下
unless $game_party.item_can_use?(@item.id)
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
return
end
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 设置行动
@active_battler.current_action.item_id = @item.id
# 设置物品窗口为不可见状态
@item_window.visible = false
# 效果范围是敌单体的情况下
if @item.scope == 1
# 开始选择敌人
start_enemy_select
# 效果范围是我方单体的情况下
elsif @item.scope == 3 or @item.scope == 5
# 开始选择角色
start_actor_select
# 效果范围不是单体的情况下
else
# 物品选择结束
end_item_select
# 转到下一位角色的指令输入
phase3_next_actor
end
return
end
end
#--------------------------------------------------------------------------
# ● 画面更新 (同伴指令回合 : 逃跑)
#--------------------------------------------------------------------------
def update_phase3_escape_select
# 计算敌人速度的平均值
enemies_agi = 0
enemies_number = 0
for enemy in $game_troop.enemies
if enemy.exist?
enemies_agi += enemy.agi
enemies_number += 1
end
end
if enemies_number > 0
enemies_agi /= enemies_number
end
# 计算角色速度的平均值
actors_agi = 0
actors_number = 0
for actor in $game_party.actors
if actor.exist?
actors_agi += actor.agi
actors_number += 1
end
end
if actors_number > 0
actors_agi /= actors_number
end
# 逃跑成功判定
success = rand(100) < 75 * actors_agi / enemies_agi
# 成功逃跑的情况下
if success
############################
$game_variables[21] += 1
############################
# 演奏逃跑 SE
$game_system.se_play($data_system.escape_se)
# 还原为战斗开始前的 BGM
$game_system.bgm_play($game_temp.map_bgm)
# 战斗结束
battle_end(1)
# 逃跑失败的情况下
else
# 清除全体同伴的行动
$game_party.clear_actions
# 开始主回合
start_phase4
end
end
#--------------------------------------------------------------------------
# ● 刷新画面画面 (角色命令回合 : 选择敌人)
#--------------------------------------------------------------------------
def update_phase3_enemy_select
# 刷新敌人箭头
@enemy_arrow.update
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 选择敌人结束
end_enemy_select
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 设置行动
@active_battler.current_action.target_index = @enemy_arrow.index
# 选择敌人结束
end_enemy_select
# 显示特技窗口中的情况下
if @skill_window != nil
# 结束特技选择
end_skill_select
end
# 显示物品窗口的情况下
if @item_window != nil
# 结束物品选择
end_item_select
end
# 转到下一位角色的指令输入
phase3_next_actor
end
end
#--------------------------------------------------------------------------
# ● 画面更新 (角色指令回合 : 选择角色)
#--------------------------------------------------------------------------
def update_phase3_actor_select
# 刷新角色箭头
@actor_arrow.update
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 选择角色结束
end_actor_select
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 设置行动
@active_battler.current_action.target_index = @actor_arrow.index
# 选择角色结束
end_actor_select
# 显示特技窗口中的情况下
if @skill_window != nil
# 结束特技选择
end_skill_select
end
# 显示物品窗口的情况下
if @item_window != nil
# 结束物品选择
end_item_select
end
# 转到下一位角色的指令输入
phase3_next_actor
end
end
#--------------------------------------------------------------------------
# ● 开始选择敌人
#--------------------------------------------------------------------------
def start_enemy_select
# 生成敌人箭头
@enemy_arrow = Arrow_Enemy.new(@spriteset.viewport1)
# 关联帮助窗口
@enemy_arrow.help_window = @help_window
# 无效化角色指令窗口
@actor_command_window.active = false
@actor_command_window.visible = false
end
#--------------------------------------------------------------------------
# ● 结束选择敌人
#--------------------------------------------------------------------------
def end_enemy_select
# 释放敌人箭头
@enemy_arrow.dispose
@enemy_arrow = nil
# 指令为 [战斗] 的情况下
if @actor_command_window.index == 0
# 有效化角色指令窗口
@actor_command_window.active = true
@actor_command_window.visible = true
# 隐藏帮助窗口
@help_window.visible = false
end
end
#--------------------------------------------------------------------------
# ● 开始选择角色
#--------------------------------------------------------------------------
def start_actor_select
# 生成角色箭头
@actor_arrow = Arrow_Actor.new(@spriteset.viewport2)
@actor_arrow.index = @actor_index
# 关联帮助窗口
@actor_arrow.help_window = @help_window
# 无效化角色指令窗口
@actor_command_window.active = false
@actor_command_window.visible = false
end
#--------------------------------------------------------------------------
# ● 结束选择角色
#--------------------------------------------------------------------------
def end_actor_select
# 释放角色箭头
@actor_arrow.dispose
@actor_arrow = nil
end
#--------------------------------------------------------------------------
# ● 开始选择特技
#--------------------------------------------------------------------------
def start_skill_select
# 生成特技窗口
@skill_window = Window_Skill.new(@active_battler)
# 关联帮助窗口
@skill_window.help_window = @help_window
# 无效化角色指令窗口
@actor_command_window.active = false
@actor_command_window.visible = false
end
#--------------------------------------------------------------------------
# ● 选择特技结束
#--------------------------------------------------------------------------
def end_skill_select
# 释放特技窗口
@skill_window.dispose
@skill_window = nil
# 隐藏帮助窗口
@help_window.visible = false
# 有效化角色指令窗口
@actor_command_window.active = true
@actor_command_window.visible = true
end
#--------------------------------------------------------------------------
# ● 开始选择物品
#--------------------------------------------------------------------------
def start_item_select
# 生成物品窗口
@item_window = Window_Item.new
# 关联帮助窗口
@item_window.help_window = @help_window
# 无效化角色指令窗口
@actor_command_window.active = false
@actor_command_window.visible = false
end
#--------------------------------------------------------------------------
# ● 结束选择物品
#--------------------------------------------------------------------------
def end_item_select
# 释放物品窗口
@item_window.dispose
@item_window = nil
# 隐藏帮助窗口
@help_window.visible = false
# 有效化角色指令窗口
@actor_command_window.active = true
@actor_command_window.visible = true
end
end
复制代码
战斗系统4:
#==============================================================================
# ■ Scene_Battle (分割定义 4)
#------------------------------------------------------------------------------
# 处理战斗画面的类。
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# ● 开始主回合
#--------------------------------------------------------------------------
def start_phase4
# 转移到回合 4
@phase = 4
# 回合数计数
$game_temp.battle_turn += 1
# 搜索全页的战斗事件
for index in 0...$data_troops[@troop_id].pages.size
# 获取事件页
page = $data_troops[@troop_id].pages[index]
# 本页的范围是 [回合] 的情况下
if page.span == 1
# 设置已经执行标志
$game_temp.battle_event_flags[index] = false
end
end
# 设置角色为非选择状态
@actor_index = -1
@active_battler = nil
# 有效化同伴指令窗口
@party_command_window.active = false
@party_command_window.visible = false
# 无效化角色指令窗口
@actor_command_window.active = false
@actor_command_window.visible = false
# 设置主回合标志
$game_temp.battle_main_phase = true
# 生成敌人行动
for enemy in $game_troop.enemies
enemy.make_action
end
# 生成行动顺序
make_action_orders
# 移动到步骤 1
@phase4_step = 1
end
#--------------------------------------------------------------------------
# ● 生成行动循序
#--------------------------------------------------------------------------
def make_action_orders
# 初始化序列 @action_battlers
@action_battlers = []
# 添加敌人到 @action_battlers 序列
for enemy in $game_troop.enemies
@action_battlers.push(enemy)
end
# 添加角色到 @action_battlers 序列
for actor in $game_party.actors
@action_battlers.push(actor)
end
# 确定全体的行动速度
for battler in @action_battlers
battler.make_action_speed
end
# 按照行动速度从大到小排列
@action_battlers.sort! {|a,b|
b.current_action.speed - a.current_action.speed }
end
#--------------------------------------------------------------------------
# ● 刷新画面 (主回合)
#--------------------------------------------------------------------------
def update_phase4
case @phase4_step
when 1
update_phase4_step1
when 2
update_phase4_step2
when 3
update_phase4_step3
when 4
update_phase4_step4
when 5
update_phase4_step5
when 6
update_phase4_step6
end
end
#--------------------------------------------------------------------------
# ● 刷新画面 (主回合步骤 1 : 准备行动)
#--------------------------------------------------------------------------
def update_phase4_step1
# 隐藏帮助窗口
@help_window.visible = false
# 判定胜败
if judge
# 胜利或者失败的情况下 : 过程结束
return
end
# 强制行动的战斗者不存在的情况下
if $game_temp.forcing_battler == nil
# 设置战斗事件
setup_battle_event
# 执行战斗事件中的情况下
if $game_system.battle_interpreter.running?
return
end
end
# 强制行动的战斗者存在的情况下
if $game_temp.forcing_battler != nil
# 在头部添加后移动
@action_battlers.delete($game_temp.forcing_battler)
@action_battlers.unshift($game_temp.forcing_battler)
end
# 未行动的战斗者不存在的情况下 (全员已经行动)
if @action_battlers.size == 0
# 开始同伴命令回合
start_phase2
return
end
# 初始化动画 ID 和公共事件 ID
@animation1_id = 0
@animation2_id = 0
@common_event_id = 0
# 未行动的战斗者移动到序列的头部
@active_battler = @action_battlers.shift
# 如果已经在战斗之外的情况下
if @active_battler.index == nil
return
end
# 连续伤害
if @active_battler.hp > 0 and @active_battler.slip_damage?
@active_battler.slip_damage_effect
@active_battler.damage_pop = true
end
# 当角色生命>0并且中了22号状态
if @active_battler.hp > 0 and @active_battler.state?(22)
@active_battler.hp += @active_battler.maxhp/10 # 恢复1/10的最大生命
end
# 自然解除状态
@active_battler.remove_states_auto
# 刷新状态窗口
@status_window.refresh
# 移至步骤 2
@phase4_step = 2
end
#--------------------------------------------------------------------------
# ● 刷新画面 (主回合步骤 2 : 开始行动)
#--------------------------------------------------------------------------
def update_phase4_step2
# 如果不是强制行动
unless @active_battler.current_action.forcing
# 限制为 [敌人为普通攻击] 或 [我方为普通攻击] 的情况下
if @active_battler.restriction == 2 or @active_battler.restriction == 3
# 设置行动为攻击
@active_battler.current_action.kind = 0
@active_battler.current_action.basic = 0
end
# 限制为 [不能行动] 的情况下
if @active_battler.restriction == 4
# 清除行动强制对像的战斗者
$game_temp.forcing_battler = nil
# 移至步骤 1
@phase4_step = 1
return
end
end
# 清除对像战斗者
@target_battlers = []
# 行动种类分支
case @active_battler.current_action.kind
when 0 # 基本
make_basic_action_result
when 1 # 特技
make_skill_action_result
when 2 # 物品
make_item_action_result
when 3 # 逃跑
make_escape_action_result
end
# 移至步骤 3
if @phase4_step == 2
@phase4_step = 3
end
end
#--------------------------------------------------------------------------
# ● 生成基本行动结果
#--------------------------------------------------------------------------
def make_basic_action_result
# 攻击的情况下
if @active_battler.current_action.basic == 0
# 设置攻击 ID
@animation1_id = @active_battler.animation1_id
@animation2_id = @active_battler.animation2_id
# 行动方的战斗者是敌人的情况下
if @active_battler.is_a?(Game_Enemy)
if @active_battler.restriction == 3
target = $game_troop.random_target_enemy
elsif @active_battler.restriction == 2
target = $game_party.random_target_actor
else
index = @active_battler.current_action.target_index
target = $game_party.smooth_target_actor(index)
end
end
# 行动方的战斗者是角色的情况下
if @active_battler.is_a?(Game_Actor)
if @active_battler.restriction == 3
target = $game_party.random_target_actor
elsif @active_battler.restriction == 2
target = $game_troop.random_target_enemy
else
index = @active_battler.current_action.target_index
target = $game_troop.smooth_target_enemy(index)
end
end
# 设置对像方的战斗者序列
@target_battlers = [target]
# 应用通常攻击效果
for target in @target_battlers
target.attack_effect(@active_battler)
end
return
end
# 防御的情况下
if @active_battler.current_action.basic == 1
# 帮助窗口显示"防御"
@help_window.set_text($data_system.words.guard, 1)
return
end
# 逃跑的情况下
if @active_battler.is_a?(Game_Enemy) and
@active_battler.current_action.basic == 2
# 帮助窗口显示"逃跑"
@help_window.set_text("逃跑", 1)
# 逃跑
@active_battler.escape
return
end
# 什么也不做的情况下
if @active_battler.current_action.basic == 3
# 清除强制行动对像的战斗者
$game_temp.forcing_battler = nil
# 移至步骤 1
@phase4_step = 1
return
end
end
#--------------------------------------------------------------------------
# ● 设置物品或特技对像方的战斗者
# scope : 特技或者是物品的范围
#--------------------------------------------------------------------------
def set_target_battlers(scope)
# 行动方的战斗者是敌人的情况下
if @active_battler.is_a?(Game_Enemy)
# 效果范围分支
case scope
when 1 # 敌单体
index = @active_battler.current_action.target_index
@target_battlers.push($game_party.smooth_target_actor(index))
when 2 # 敌全体
for actor in $game_party.actors
if actor.exist?
@target_battlers.push(actor)
end
end
when 3 # 我方单体
index = @active_battler.current_action.target_index
@target_battlers.push($game_troop.smooth_target_enemy(index))
when 4 # 我方全体
for enemy in $game_troop.enemies
if enemy.exist?
@target_battlers.push(enemy)
end
end
when 5 # 我方单体 (HP 0)
index = @active_battler.current_action.target_index
enemy = $game_troop.enemies[index]
if enemy != nil and enemy.hp0?
@target_battlers.push(enemy)
end
when 6 # 我方全体 (HP 0)
for enemy in $game_troop.enemies
if enemy != nil and enemy.hp0?
@target_battlers.push(enemy)
end
end
when 7 # 使用者
@target_battlers.push(@active_battler)
end
end
# 行动方的战斗者是角色的情况下
if @active_battler.is_a?(Game_Actor)
# 效果范围分支
case scope
when 1 # 敌单体
index = @active_battler.current_action.target_index
@target_battlers.push($game_troop.smooth_target_enemy(index))
when 2 # 敌全体
for enemy in $game_troop.enemies
if enemy.exist?
@target_battlers.push(enemy)
end
end
when 3 # 我方单体
index = @active_battler.current_action.target_index
@target_battlers.push($game_party.smooth_target_actor(index))
when 4 # 我方全体
for actor in $game_party.actors
if actor.exist?
@target_battlers.push(actor)
end
end
when 5 # 我方单体 (HP 0)
index = @active_battler.current_action.target_index
actor = $game_party.actors[index]
if actor != nil and actor.hp0?
@target_battlers.push(actor)
end
when 6 # 我方全体 (HP 0)
for actor in $game_party.actors
if actor != nil and actor.hp0?
@target_battlers.push(actor)
end
end
when 7 # 使用者
@target_battlers.push(@active_battler)
end
end
end
#--------------------------------------------------------------------------
# ● 生成特技行动结果
#--------------------------------------------------------------------------
def make_skill_action_result
# 获取特技
@skill = $data_skills[@active_battler.current_action.skill_id]
# 如果不是强制行动
unless @active_battler.current_action.forcing
# 因为 SP 耗尽而无法使用的情况下
unless @active_battler.skill_can_use?(@skill.id)
# 清除强制行动对像的战斗者
$game_temp.forcing_battler = nil
# 移至步骤 1
@phase4_step = 1
return
end
end
# 消耗 SP
@active_battler.sp -= @skill.sp_cost
# 刷新状态窗口
@status_window.refresh
# 在帮助窗口显示特技名
@help_window.set_text(@skill.name, 1)
# 设置动画 ID
@animation1_id = @skill.animation1_id
@animation2_id = @skill.animation2_id
# 设置公共事件 ID
@common_event_id = @skill.common_event_id
# 设置对像侧战斗者
set_target_battlers(@skill.scope)
# 应用特技效果
for target in @target_battlers
target.skill_effect(@active_battler, @skill)
end
end
#--------------------------------------------------------------------------
# ● 生成物品行动结果
#--------------------------------------------------------------------------
def make_item_action_result
# 获取物品
@item = $data_items[@active_battler.current_action.item_id]
# 因为物品耗尽而无法使用的情况下
unless $game_party.item_can_use?(@item.id)
# 移至步骤 1
@phase4_step = 1
return
end
# 消耗品的情况下
if @item.consumable
# 使用的物品减 1
$game_party.lose_item(@item.id, 1)
end
# 在帮助窗口显示物品名
@help_window.set_text(@item.name, 1)
# 设置动画 ID
@animation1_id = @item.animation1_id
@animation2_id = @item.animation2_id
# 设置公共事件 ID
@common_event_id = @item.common_event_id
# 确定对像
index = @active_battler.current_action.target_index
target = $game_party.smooth_target_actor(index)
# 设置对像侧战斗者
set_target_battlers(@item.scope)
# 应用物品效果
for target in @target_battlers
target.item_effect(@item)
end
end
#--------------------------------------------------------------------------
# ● 生成逃跑行动结果
#--------------------------------------------------------------------------
def make_escape_action_result
# 计算敌人速度的平均值
enemies_agi = 0
enemies_number = 0
for enemy in $game_troop.enemies
if enemy.exist?
enemies_agi += enemy.agi
enemies_number += 1
end
end
if enemies_number > 0
enemies_agi /= enemies_number
end
# 计算角色速度的平均值
actors_agi = 0
actors_number = 0
for actor in $game_party.actors
if actor.exist?
actors_agi += actor.agi
actors_number += 1
end
end
if actors_number > 0
actors_agi /= actors_number
end
# 逃跑成功判定
success = rand(100) < 75 * actors_agi / enemies_agi
# 成功逃跑的情况下
if success
############################
$game_variables[21] += 1
$data_common_events[425]
############################
# 演奏逃跑 SE
$game_system.se_play($data_system.escape_se)
# 还原为战斗开始前的 BGM
$game_system.bgm_play($game_temp.map_bgm)
# 战斗结束
battle_end(1)
# 逃跑失败的情况下
else
# 清除全体同伴的行动
$game_party.clear_actions
# 开始主回合
start_phase4
end
end
#--------------------------------------------------------------------------
# ● 刷新画面 (主回合步骤 3 : 行动方动画)
#--------------------------------------------------------------------------
def update_phase4_step3
# 行动方动画 (ID 为 0 的情况下是白色闪烁)
if @animation1_id == 0
@active_battler.white_flash = true
else
@active_battler.animation_id = @animation1_id
@active_battler.animation_hit = true
end
# 移至步骤 4
@phase4_step = 4
end
#--------------------------------------------------------------------------
# ● 刷新画面 (主回合步骤 4 : 对像方动画)
#--------------------------------------------------------------------------
def update_phase4_step4
# 对像方动画
for target in @target_battlers
target.animation_id = @animation2_id
target.animation_hit = (target.damage != "Miss")
if target.is_a?(Game_Actor)
end
end
# 限制动画长度、最低 8 帧
@wait_count = 8
# 移至步骤 5
@phase4_step = 5
end
#--------------------------------------------------------------------------
# ● 刷新画面 (主回合步骤 5 : 显示伤害)
#--------------------------------------------------------------------------
def update_phase4_step5
# 隐藏帮助窗口
@help_window.visible = false
# 刷新状态窗口
@status_window.refresh
# 显示伤害
for target in @target_battlers
if @active_battler.current_action.kind == 1 and @skill.name == "精灵球"
$game_switches[500] = false
rate_a = [( target.int*10 ),100].min
rate_b = (100 - rate_a)
bingo = (rand(100) < rate_b)
if bingo
#成功偷窃,生成偷窃物品
make_steal_result
#成功偷窃,设置伤害文字为Success
target.damage = ""
target.damage = "Success!!"
#播放偷窃成功音效
Audio.se_play("Audio/SE/"+"002-System02",100,100)
$game_switches[500] = true
$game_variables[103] += 1
else
#偷窃失败,设置伤害为Failed
target.damage = ""
target.damage = "Failed!!"
#播放偷窃失败音效
Audio.se_play("Audio/SE/"+"010-System10",100,100)
end
target.damage_pop = true
elsif target.damage != nil
target.damage_pop = true
end
end
# 移至步骤 6
@phase4_step = 6
end
#--------------------------------------------------------------------------
# ● 刷新画面 (主回合步骤 6 : 刷新)
#--------------------------------------------------------------------------
def update_phase4_step6
# 清除强制行动对像的战斗者
$game_temp.forcing_battler = nil
# 公共事件 ID 有效的情况下
if @common_event_id > 0
# 设置事件
common_event = $data_common_events[@common_event_id]
$game_system.battle_interpreter.setup(common_event.list, 0)
end
# 移至步骤 1
@phase4_step = 1
end
end
复制代码
战斗系统5:
#-----------------------------------------------------------------------
class Scene_Battle
#表示这是一个Scene_Battle类
def make_steal_result
#在这个类中定义一个方法:make_steal_result
item_ser_num = rand(50)
#获取随机数item_ser_num,值为0~49中的一个
item_ser = 0
#初始化item_ser为0,这个变量是用来表示偷到的物品种类,是武器,还是道具或者(可参照公共事件和下面的脚本理解)
item_id = 101
#初始化item_id为0,这个变量用来储存偷到的物品ID
item_num = 102
#初始化item_num为0,这个变量用来储存偷到的该物品数量
case item_ser_num
#对item_ser_num这个随机数进行条件分歧
when 0
#当其值为0的时候
item_ser = 1
#item_ser = 1,表示这是一个武器
item_id = 7
#item_id = ,表示ID为7
item_num = 1
#表示数量为1
when 1
#当其值为1的时候
item_ser = 1
#表示这是一个武器
item_id = (rand(3) + 1)
#ID为1~3中的一个
item_num = 1
#数量为1
when 2
#当其值为2的时候
item_ser = 2
#表示这是一个防具
item_id = (rand(3) + 5)
#ID为5~7中的任意一个
item_num = 1
#数量为1
when 3..9
#当其值为3~9之间的一个数字时
item_ser = 0
#表示这是一个物品
item_id = $game_variables[99]
#ID为9~11中的任意一个数
item_num = 1
#数量为1
else #酒类
#如果不是以上提到的任何数字且在49以内
item_ser = 0
#表示这是一个物品
item_id = $game_variables[99]
#ID为89~93中任意一个数字
item_num = 1
#数量为1个
end
#结束对于item_ser_num的条件分歧
case item_ser
#对于item_ser(即物品种类)进行条件分歧
when 0 #物品
$game_variables[100] = 0
#是物品的话,第100号变量 = 0,用来告诉公共事件这是个物品
when 1 #武器
$game_variables[100] = 1
#是武器的话,第100号变量 = 1,用来告诉公共事件这是个武器
when 2 #防具
$game_variables[100] = 2
#是防具的话,第100号变量 = 2,用来告诉公共事件这是个防具
end
#结束对于item_ser的条件分歧
$game_variables[101] = item_id
#用第101号变量存储得到的道具ID
$game_variables[102] = item_num
#用第102号变量存储得到的道具数量
end
end
#结束
#------------------------------------------------------------
复制代码
战斗系统行走图战斗:
#==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==============================================================================
#==============================================================================
#冲突脚本:宠物脚本1.2版(66主页拿的宠物脚本应该都会冲突)
#注意:以下一共有两个脚本,插入后就能达到战斗动画。
#插入脚本后先进入游戏进行战斗一下,然后就会明白素材问题了
#素材问题:脚本采用了战斗图自动选择行走图~~~
#使用方法:插入main前即可
#==============================================================================
#==============================================================================
# ■ Sprite_Battler
#==============================================================================
class Sprite_Battler < RPG::Sprite
#--------------------------------------------------------------------------
# ● instance变量
#--------------------------------------------------------------------------
attr_accessor :battler # butler
#--------------------------------------------------------------------------
# ● 初始化
# viewport : viewport
# battler : butler(Game_Battler)
#--------------------------------------------------------------------------
def initialize(viewport, battler = nil)
super(viewport)
@battler = battler
@battler_visible = false
# 定义动画用变量
@hoko_wait = 0
@hoko_pattern = 0
end
#--------------------------------------------------------------------------
# ● 解放
#--------------------------------------------------------------------------
def dispose
if self.bitmap != nil
self.bitmap.dispose
end
super
end
#--------------------------------------------------------------------------
# ● 更新
#--------------------------------------------------------------------------
def update
super
# butler nil 的场合
if @battler == nil
self.bitmap = nil
loop_animation(nil)
return
end
# 如果文件名或者色相与现在的东西不同
if @battler.battler_name != @battler_name or
@battler.battler_hue != @battler_hue
# 取得位图设定
@battler_name = @battler.battler_name
@battler_hue = @battler.battler_hue
# battler→character变更
#self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
self.bitmap = RPG::Cache.character(@battler_name, @battler_hue)
# width→宽度 height→高度
@width = bitmap.width / 4
@height = bitmap.height / 4
self.ox = @width / 2
self.oy = @height
self.src_rect.set(@hoko_pattern * @width, 0, @width, @height)
# 战斗不能再隐藏要是状态把不透明度做为 0
if @battler.dead? or @battler.hidden
self.opacity = 0
end
end
# 如果动画ID与现在的东西有差异
if @battler.damage == nil and
@battler.state_animation_id != @state_animation_id
@state_animation_id = @battler.state_animation_id
loop_animation($data_animations[@state_animation_id])
end
# 应该被表示actor的场合
if @battler.is_a?(Game_Actor) and @battler_visible
# 不是主要阶段的时候把不透明度稍稍下降
if $game_temp.battle_main_phase
self.opacity += 3 if self.opacity < 255
else
self.opacity -= 3 if self.opacity > 207
end
end
# 闪烁
if @battler.blink
blink_on
else
blink_off
end
# 不可见的场合
unless @battler_visible
# 出现
if not @battler.hidden and not @battler.dead? and
(@battler.damage == nil or @battler.damage_pop)
appear
@battler_visible = true
end
end
# 可见的场合
if @battler_visible
# 逃走
if @battler.hidden
$game_system.se_play($data_system.escape_se)
escape
@battler_visible = false
end
# 白闪光
if @battler.white_flash
whiten
@battler.white_flash = false
end
# 动画
if @battler.animation_id != 0
animation = $data_animations[@battler.animation_id]
animation(animation, @battler.animation_hit)
@battler.animation_id = 0
end
# 损坏
if @battler.damage_pop
damage(@battler.damage, @battler.critical)
@battler.damage = nil
@battler.critical = false
@battler.damage_pop = false
end
# korapusu
if @battler.damage == nil and @battler.dead?
if @battler.is_a?(Game_Enemy)
$game_system.se_play($data_system.enemy_collapse_se)
else
$game_system.se_play($data_system.actor_collapse_se)
end
collapse
@battler_visible = false
end
# 行走动画
hoko_anime()
# p @hoko_pattern
end
# 设定行走图位置的坐标
self.x = @battler.screen_x
self.y = @battler.screen_y - 43
self.z = @battler.screen_z
end
#--------------------------------------------------------------------------
# ● 行走动画(@hoko_pattern * @width, 0, @width, @height)能设置行走图方向
#--------------------------------------------------------------------------
def hoko_anime()
@hoko_wait += 1
if @hoko_wait > 6 # wait 等待
@hoko_wait = 0
@hoko_pattern += 1
if @hoko_pattern > 3
@hoko_pattern = 0
# p "0"
end #pattern图案/width宽度/height高度
self.src_rect.set(@hoko_pattern * @width, @height * 2, @width, @height)
if battler.is_a?(Game_Actor)
self.src_rect.set(@hoko_pattern * @width, @height, @width, @height)
end
end
end
end #enemy敌人
#==============================================================================
#冲突脚本:宠物脚本1.2版(66主页拿的宠物脚本应该都会冲突)
#注意:以下一共有两个脚本,插入后就能达到战斗动画。
#插入脚本后先进入游戏进行战斗一下,然后就会明白素材问题了
#素材问题:脚本采用了战斗图自动选择行走图~~~
#==============================================================================
#==============================================================================
# ■ Game_BattleAction
#------------------------------------------------------------------------------
#是处理动作 (战斗中的行动)的级。这个级 在 Game_Battler kura# su内部被使用。
#==============================================================================
class Game_BattleAction
#--------------------------------------------------------------------------
# ● instance变量
#--------------------------------------------------------------------------
attr_accessor :speed # 速度
attr_accessor :kind # 类别(基本/ 技艺 / 物品)
attr_accessor :basic # 基本(攻击/防御/逃跑)
attr_accessor :skill_id # 特技ID
attr_accessor :item_id # 物品ID
attr_accessor :target_index # 对象禁书目录
attr_accessor :forcing # 强制标志
#--------------------------------------------------------------------------
# ● 初始化
#--------------------------------------------------------------------------
def initialize
clear
end
#--------------------------------------------------------------------------
# ● clearness
#--------------------------------------------------------------------------
def clear
@speed = 0
@kind = 0
@basic = 3
@skill_id = 0
@item_id = 0
@target_index = -1
@forcing = false
end
#--------------------------------------------------------------------------
# ● 判断
#--------------------------------------------------------------------------
def valid?
return (not (@kind == 0 and @basic == 3))
end
#--------------------------------------------------------------------------
# ● 单体判断
#--------------------------------------------------------------------------
def for_one_friend?
# 类别特技,效果范围包含伙伴单体(HP 0 的)场合
if @kind == 1 and [3, 5].include?($data_skills[@skill_id].scope)
return true
end
# 类别以条款,效果范围包含伙伴单体(HP 0 的)场合
if @kind == 2 and [3, 5].include?($data_items[@item_id].scope)
return true
end
return false
end
#--------------------------------------------------------------------------
# ● 单体用(HP 0)判断
#--------------------------------------------------------------------------
def for_one_friend_hp0?
# 特技效果范围单体(HP 0 )的场合
if @kind == 1 and [5].include?($data_skills[@skill_id].scope)
return true
end
# 物品效果范围单体(HP 0 )的场合
if @kind == 2 and [5].include?($data_items[@item_id].scope)
return true
end
return false
end
#--------------------------------------------------------------------------
# ● random目标 (actor用)
#--------------------------------------------------------------------------
def decide_random_target_for_actor
# 效果范围分歧
if for_one_friend_hp0?
battler = $game_party.random_target_actor_hp0
elsif for_one_friend?
battler = $game_party.random_target_actor
else
battler = $game_troop.random_target_enemy
end
# 如果对象存在取得禁书目录,
# 对象不存在的情况clearness动作
if battler != nil
@target_index = battler.index
else
clear
end
end
#--------------------------------------------------------------------------
# ● random目标 (enemy用)
#--------------------------------------------------------------------------
def decide_random_target_for_enemy
# 效果范围分歧
if for_one_friend_hp0?
battler = $game_troop.random_target_enemy_hp0
elsif for_one_friend?
battler = $game_troop.random_target_enemy
else
battler = $game_party.random_target_actor
end
# 如果对象存在取得禁书目录,
# 对象不存在的情况clearness动作
if battler != nil
@target_index = battler.index
else
clear
end
end
#--------------------------------------------------------------------------
# ● 最后目标 (actor)
#--------------------------------------------------------------------------
def decide_last_target_for_actor
# 单体actor效果范围,(enemy)
if @target_index == -1
battler = nil
elsif for_one_friend?
battler = $game_party.actors[@target_index]
else
battler = $game_troop.enemies[@target_index]
end
# 对象不存在的情况clearness动作
if battler == nil or not battler.exist?
clear
end
end
#--------------------------------------------------------------------------
# ● 最后目标 (enemy)
#--------------------------------------------------------------------------
def decide_last_target_for_enemy
# 单体enemy效果范围 (actor)
if @target_index == -1
battler = nil
elsif for_one_friend?
battler = $game_troop.enemies[@target_index]
else
battler = $game_party.actors[@target_index]
end
# 对象不存在的情况clearness动作
if battler == nil or not battler.exist?
clear
end
end
end
#==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==============================================================================
复制代码
口袋妖怪新创意(加点脚本):
#==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==============================================================================
# 脚本使用设定:
LEVEL_UP_POINT = 1 # 每升一级所增加的点数
LEVEL_UP_VARIABLE = 110 # 储存角色点数的变量编号与角色id编号的差值
# 默认情况 = 100,
# 则是数据库里1号角色的加点数存于101号变量
# 3号角色的加点数存于103号变量。
# 你可以直接操作变量赠与角色可分配点数
# 每增加一次点数,各项能力值的变化:357-410行
# 使用方法介绍:
# 本脚本不会取代原猩豆δ埽皇且桓龈郊庸δ堋?BR># 也就是说,默认的升级还在,但可以用这个功能手动追加点数。
# 如果你想纯粹使用手动加点(而升级不提升能力),只要把数据库中角色升级能力,
# 1-99级全部等于一个相同数值就行了。
# 呼唤加点场景的方法:$scene = Scene_Lvup.new(角色编号,返回菜单编号)。
# 默认都是0号
# 加点场景中,page up,page down换人,如果想加点完毕后返回地图,
# 464行$scene = Scene_Menu.new(0)改为$scene = Scene_Map.new
# 推荐脚本搭配:魔法商店脚本,两者结合,制作自由型RPG
#==============================================================================
# ■ Window_Command
#------------------------------------------------------------------------------
# 一般的命令选择行窗口。(追加定义)
#==============================================================================
class Window_Command < Window_Selectable
#--------------------------------------------------------------------------
# ● 项目有效化
# index : 项目编号
#--------------------------------------------------------------------------
def able_item(index)
draw_item(index, normal_color)
end
end
#==============================================================================
# ■ Game_Actor
#------------------------------------------------------------------------------
# 处理角色的类。(再定义)
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ● 更改 EXP
# exp : 新的 EXP
#--------------------------------------------------------------------------
def exp=(exp)
@exp = [[exp, 9999999].min, 0].max
# 升级
while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
@level += 1
# 增加4点可自由分配的点数
$game_variables[self.id + LEVEL_UP_VARIABLE] += LEVEL_UP_POINT
# 学会特技
for j in $data_classes[@class_id].learnings
if j.level == @level
learn_skill(j.skill_id)
end
end
end
# 降级
while @exp < @exp_list[@level]
@level -= 1
end
# 修正当前的 HP 与 SP 超过最大值
@hp = [@hp, self.maxhp].min
@sp = [@sp, self.maxsp].min
end
end
#==============================================================================
# ■ Window_Base
#------------------------------------------------------------------------------
# 游戏中全部窗口的超级类(追加定义)
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# ● 描绘 HP
# actor : 角色
# x : 描画目标 X 坐标
# y : 描画目标 Y 坐标
# width : 描画目标的宽
#--------------------------------------------------------------------------
def draw_actor_hp_lvup(actor, x, y)
self.contents.font.color = system_color
self.contents.draw_text(x , y, 96, 32, "最大" + $data_system.words.hp)
if $temp_hp == 0
self.contents.font.color = normal_color
self.contents.draw_text(x + 120 , y, 48, 32, actor.maxhp.to_s, 2)
else
maxhp = actor.maxhp + $temp_hp
self.contents.font.color = Color.new(255, 128, 128, 255)
self.contents.draw_text(x + 120 , y, 48, 32, maxhp.to_s ,2)
self.contents.font.color = normal_color
self.contents.draw_text(x + 155, y, 36, 32, "( ", 2)
if $temp_hp >=0
self.contents.font.color = Color.new(255, 128, 128, 255)
self.contents.draw_text(x + 155, y, 36, 32, " +",2)
else
self.contents.font.color = Color.new(255,255,0,255)
self.contents.draw_text(x + 155, y, 36, 32, " -",2)
end
self.contents.draw_text(x + 200, y, 36, 32, $temp_hp.to_s, 2)
self.contents.font.color = normal_color
self.contents.draw_text(x + 215, y, 36, 32, ")", 2)
end
end
#--------------------------------------------------------------------------
# ● 描绘 SP
# actor : 角色
# x : 描画目标 X 坐标
# y : 描画目标 Y 坐标
# width : 描画目标的宽
#--------------------------------------------------------------------------
def draw_actor_sp_lvup(actor, x, y)
self.contents.font.color = system_color
self.contents.draw_text(x , y, 96, 32, "最大" + $data_system.words.sp)
if $temp_sp == 0
self.contents.font.color = normal_color
self.contents.draw_text(x + 120 , y, 48, 32, actor.maxsp.to_s, 2)
else
maxsp = actor.maxsp + $temp_sp
self.contents.font.color = Color.new(255, 128, 128, 255)
self.contents.draw_text(x + 120 , y, 48, 32, maxsp.to_s ,2)
self.contents.font.color = normal_color
self.contents.draw_text(x + 155, y, 36, 32, "( ", 2)
if $temp_sp >=0
self.contents.font.color = Color.new(255, 128, 128, 255)
self.contents.draw_text(x + 155, y, 36, 32, " +",2)
else
self.contents.font.color = Color.new(255,255,0,255)
self.contents.draw_text(x + 155, y, 36, 32, " -",2)
end
self.contents.draw_text(x + 200, y, 36, 32, $temp_sp.to_s, 2)
self.contents.font.color = normal_color
self.contents.draw_text(x + 215, y, 36, 32, ")", 2)
end
end
#--------------------------------------------------------------------------
# ● 描绘能力值
# actor : 角色
# x : 描画目标 X 坐标
# y : 描画目标 Y 坐标
# type : 能力值种类 (0~4)
#--------------------------------------------------------------------------
def draw_actor_lvup(actor, x, y, type)
# 定义数字颜色
lvup = normal_color
upcolor = Color.new(255, 128, 128, 255)
self.contents.font.color = normal_color
case type
when 0
parameter_name = $data_system.words.str
parameter_value = actor.str
parameter_value_temp = parameter_value + $temp_str
if $temp_str != 0
lvup = upcolor
self.contents.draw_text(x + 256, y, 16, 32, "(")
if $temp_str >= 0
self.contents.font.color = lvup
self.contents.draw_text(x + 272, y, 80, 32, "+",0)
else
self.contents.font.color = Color.new(255,255,0,255)
self.contents.draw_text(x + 272, y, 80, 32, "-",0)
end
self.contents.draw_text(x + 272, y, 80, 32, $temp_str.abs.to_s,1)
self.contents.font.color = normal_color
self.contents.draw_text(x + 272, y, 80, 32, ")", 2)
end
when 1
parameter_name = $data_system.words.dex
parameter_value = actor.dex
parameter_value_temp = parameter_value + $temp_dex
if $temp_dex != 0
lvup = upcolor
self.contents.draw_text(x + 256, y, 16, 32, "(")
if $temp_dex >= 0
self.contents.font.color = lvup
self.contents.draw_text(x + 272, y, 80, 32, "+",0)
else
self.contents.font.color = Color.new(255,255,0,255)
self.contents.draw_text(x + 272, y, 80, 32, "-",0)
end
self.contents.draw_text(x + 272, y, 80, 32, $temp_dex.abs.to_s,1)
self.contents.font.color = normal_color
self.contents.draw_text(x + 272, y, 80, 32, ")", 2)
end
when 2
parameter_name = $data_system.words.agi
parameter_value = actor.agi
parameter_value_temp = parameter_value + $temp_agi
if $temp_agi != 0
lvup = upcolor
self.contents.draw_text(x + 256, y, 16, 32, "(")
if $temp_agi >= 0
self.contents.font.color = lvup
self.contents.draw_text(x + 272, y, 80, 32, "+",0)
else
self.contents.font.color = Color.new(255,255,0,255)
self.contents.draw_text(x + 272, y, 80, 32, "-",0)
end
self.contents.draw_text(x + 272, y, 80, 32, $temp_agi.abs.to_s,1)
self.contents.font.color = normal_color
self.contents.draw_text(x + 272, y, 80, 32, ")", 2)
end
when 3
parameter_name = $data_system.words.int
parameter_value = actor.int
parameter_value_temp = parameter_value + $temp_int
if $temp_int != 0
lvup = upcolor
self.contents.draw_text(x + 256, y, 16, 32, "(")
if $temp_int >= 0
self.contents.font.color = lvup
self.contents.draw_text(x + 272, y, 80, 32, "+",0)
else
self.contents.font.color = Color.new(255,255,0,255)
self.contents.draw_text(x + 272, y, 80, 32, "-",0)
end
self.contents.draw_text(x + 272, y, 80, 32, $temp_int.abs.to_s,1)
self.contents.font.color = normal_color
self.contents.draw_text(x + 272, y, 80, 32, ")", 2)
end
when 4
parameter_name = "剩余点数"
parameter_value = $point
if $point != 0
lvup = upcolor
end
end
self.contents.font.color = system_color
self.contents.draw_text(x, y, 120, 32, parameter_name)
self.contents.font.color = normal_color
self.contents.draw_text(x + 120, y, 36, 32, parameter_value.to_s)
if type != 4
self.contents.draw_text(x + 150, y, 36, 32, "→")
end
self.contents.font.color = lvup
self.contents.draw_text(x + 180, y, 60, 32, parameter_value_temp.to_s)
self.contents.font.color = normal_color
end
end
#==============================================================================
# ■ Window_lvup
#------------------------------------------------------------------------------
# 显示升级状态窗口。
#==============================================================================
class Window_Lvup < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对像
# actor : 角色
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 0, 512, 320)
self.contents = Bitmap.new(width - 32, height - 32)
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
draw_actor_graphic(@actor, 40, 112)
draw_actor_name(@actor, 4, 0)
draw_actor_class(@actor, 4 + 144, 0)
draw_actor_level(@actor, 96, 32)
draw_actor_state(@actor, 96, 64)
draw_actor_hp_lvup(@actor, 96+128, 32)
draw_actor_sp_lvup(@actor, 96+128, 64)
draw_actor_lvup(@actor, 96, 128, 0)
draw_actor_lvup(@actor, 96, 160, 1)
draw_actor_lvup(@actor, 96, 192, 2)
draw_actor_lvup(@actor, 96, 224, 3)
draw_actor_lvup(@actor, 96, 256, 4)
end
end
#==============================================================================
# ■ Window_Help
#------------------------------------------------------------------------------
# 特技及物品的说明、角色的状态显示的窗口。
#==============================================================================
class Window_Lvup_Help < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
super(0, 320, 640, 160)
self.contents = Bitmap.new(width - 32, height - 32)
@test = "" #——这个东西用来检测,节约内存专用
end
#--------------------------------------------------------------------------
# ● 设置文本
#--------------------------------------------------------------------------
def lvup_text(text1, text2 = nil, text3 = nil, text4 = nil, text5 = nil)
if @test != text1
@test = text1
else
return
end
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(5, 0, self.width - 40, 32, text1)
if text2 != nil
self.contents.draw_text(5 , 32, self.width - 40, 32, text2)
end
self.contents.font.size -= 5
if text3 != nil
self.contents.draw_text(5 , 64, self.width - 40, 32, text3)
end
if text4 != nil
self.contents.draw_text(5 , 96, self.width - 40, 32, text4)
end
if text5 != nil
self.contents.draw_text(5 , 96, self.width - 40, 32, text5)
end
self.contents.font.size += 5
end
end
#==============================================================================
# ■ Scene_lvup
#------------------------------------------------------------------------------
# 处理升级画面的类。
#==============================================================================
class Scene_Lvup
#--------------------------------------------------------------------------
# ● 初始化对像
# actor_index : 角色索引
# menu_index : 选项起始位置
#--------------------------------------------------------------------------
def initialize(actor_index = 0 , menu_index = 0)
@actor_index = actor_index
@menu_index = menu_index
end
#--------------------------------------------------------------------------
# ● 主处理
#--------------------------------------------------------------------------
def main
s1 = "增加HP"
s2 = "增加PP"
s3 = "增加"+$data_system.words.str
s4 = "增加"+$data_system.words.dex
s5 = "增加"+$data_system.words.agi
s6 = "增加"+$data_system.words.int
s7 = "确认加点"
s8 = "点数重置"
@command_window = Window_Command.new(128, [s1, s2, s3, s4, s5, s6, s7, s8])
@command_window.index = @menu_index
# 获取角色
@actor = $game_party.actors[@actor_index]
# 将角色的剩余点数带入
$point = $game_variables[@actor.id + LEVEL_UP_VARIABLE]
# 初始化临时量
$temp_str = 0
$temp_dex = 0
$temp_agi = 0
$temp_int = 0
$temp_hp = 0
$temp_sp = 0
#=========================================================================
# 特别提示:这些设置也可以使用小数,但是可能出现0值意外错误
# (各种编程语言都有这种意外),建议还是使用整数,正负不限
#=========================================================================
#=========================================================================
# 每提升一次HP,提升多少附加能力
#=========================================================================
@hp_hp = 11 # 每提升一次体力提升多少HP
@hp_sp = 0 # 每提升一次体力提升多少SP
@hp_str = 0 # 每提升一次体力提升多少力量
@hp_dex = 0 # 每提升一次体力提升多少速度
@hp_agi = 0 # 每提升一次体力提升多少灵巧
@hp_int = 0 # 每提升一次体力提升多少魔力
#=========================================================================
# 每提升一次SP,提升多少附加能力
#=========================================================================
@sp_hp = 1 # 每提升一次体力提升多少HP
@sp_sp = 10 # 每提升一次体力提升多少SP
@sp_str = 0 # 每提升一次体力提升多少力量
@sp_dex = 0 # 每提升一次体力提升多少速度
@sp_agi = 0 # 每提升一次体力提升多少灵巧
@sp_int = 0 # 每提升一次体力提升多少魔力
#=========================================================================
# 每提升一次力量,提升多少附加能力
#=========================================================================
@str_hp = 1 # 每提升一次力量附加提升多少HP
@str_sp = 0 # 每提升一次力量附加提升多少SP
@str_dex = 0 # 每提升一次力量附加提升多少灵巧
@str_agi = 0 # 每提升一次力量附加提升多少速度
@str_int = 0 # 每提升一次力量附加提升多少魔力
@str_str = 1 # 每提升一次力量附加提升多少力量
#=========================================================================
# 每提升一次灵巧,提升多少附加能力
#=========================================================================
@dex_hp = 1 # 每提升一次灵巧附加提升多少HP
@dex_sp = 0 # 每提升一次灵巧附加提升多少SP
@dex_str = 0 # 每提升一次灵巧附加提升多少力量
@dex_agi = 0 # 每提升一次灵巧附加提升多少速度
@dex_int = 0 # 每提升一次灵巧附加提升多少魔力
@dex_dex = 1 # 每提升一次灵巧附加提升多少灵巧
#=========================================================================
# 每提升一次速度,提升多少附加能力
#=========================================================================
@agi_hp = 1 # 每提升一次速度附加提升多少HP
@agi_sp = 0 # 每提升一次速度附加提升多少SP
@agi_str = 0 # 每提升一次速度附加提升多少力量
@agi_dex = 0 # 每提升一次速度附加提升多少灵巧
@agi_int = 0 # 每提升一次速度附加提升多少魔力
@agi_agi = 1 # 每提升一次速度附加提升多少速度
#=========================================================================
# 每提升一次魔力,提升多少附加能力
#=========================================================================
@int_hp = 1 # 每提升一次魔力附加提升多少HP
@int_sp = 0 # 每提升一次魔力附加提升多少SP
@int_str = 0 # 每提升一次魔力附加提升多少力量
@int_dex = 0 # 每提升一次魔力附加提升多少灵巧
@int_agi = 0 # 每提升一次魔力附加提升多少速度
@int_int = 1 # 每提升一次魔力附加提升多少魔力
# 定义说明文字
@text_hp_sc = "HP可以增加生存的能力,可以延长生存的时间!"
@text_sp_sc = "PP可以增加特技的次数,还可提升自身特防!"
@text_str_sc = $data_system.words.str + "可以增加普攻的威力!"
@text_dex_sc = $data_system.words.dex + "可以提高防御力、命中率和必杀!"
@text_agi_sc = $data_system.words.agi + "可以提高回避、命中!"
@text_int_sc = $data_system.words.int + "可以提高特攻的效果!"
@text_save = "保存分配情况并返回游戏"
@text_reset= "重新分配能力点数"
@text_2 = "每增加一次此项能力值,可以提升能力值"
@text_hp = "最大" + $data_system.words.hp + "值"
@text_sp = "最大" + $data_system.words.sp + "值"
@text_str = "最大" + $data_system.words.str + "值"
@text_dex = "最大" + $data_system.words.dex + "值"
@text_agi = "最大" + $data_system.words.agi + "值"
@text_int = "最大" + $data_system.words.int + "值"
s_disable
# 生成状态窗口
@lvup_window = Window_Lvup.new(@actor)
@lvup_window.x = 128
@lvup_window.y = 0
# 生成帮助窗口并初始化帮助文本
@help_window = Window_Lvup_Help.new
# 执行过渡
Graphics.transition(0, "Graphics/Transitions/" + $data_system.battle_transition)
# 主循环
loop do
# 刷新游戏画面
Graphics.update
# 刷新输入信息
Input.update
# 刷新画面
update
# 如果切换画面就中断循环
if $scene != self
break
end
end
# 准备过渡
Graphics.freeze
# 释放窗口
@command_window.dispose
@lvup_window.dispose
@help_window.dispose
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
# 刷新窗口
@command_window.update
# 选项明暗判断(因为太消耗资源,所以屏蔽掉了)
s_disable
@lvup_window.update
#=============================================================
# 按下 B 键的情况下
#=============================================================
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 切换到地图画面
#################################################
$scene = Scene_Menu.new(3)
#################################################
return
end
#=============================================================
# 按下 C 键的情况下
#=============================================================
if Input.trigger?(Input::C)
if @command_window.index == 6
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 将角色的剩余点数带回
$game_variables[@actor.id + LEVEL_UP_VARIABLE] = $point
# 将角色点数实际加上
@actor.str += $temp_str
@actor.dex += $temp_dex
@actor.agi += $temp_agi
@actor.int += $temp_int
@actor.maxhp += $temp_hp
@actor.maxsp += $temp_sp
# 切换到地图画面
#################################################
$scene = Scene_Menu.new(3)
#################################################
return
end
if @command_window.index == 7
# 演奏确定 SE
$game_system.se_play($data_system.cancel_se)
# 将角色的剩余点数带入
$point = $game_variables[@actor.id + LEVEL_UP_VARIABLE]
# 初始化临时量
$temp_str = 0
$temp_dex = 0
$temp_agi = 0
$temp_int = 0
$temp_hp = 0
$temp_sp = 0
@lvup_window.refresh
return
end
if $point == 0
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
return
end
case @command_window.index
when 0
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
$temp_hp += @hp_hp
$temp_sp += @hp_sp
$temp_str += @hp_str
$temp_dex += @hp_dex
$temp_agi += @hp_agi
$temp_int += @hp_int
$point -= 1
@lvup_window.refresh
s_disable
return
when 1
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
$temp_sp += @sp_sp
$temp_hp += @sp_hp
$temp_str += @hp_str
$temp_dex += @hp_dex
$temp_agi += @hp_agi
$temp_int += @hp_int
$point -= 1
@lvup_window.refresh
s_disable
return
when 2
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
$temp_str += @str_str
$temp_hp += @str_hp
$temp_sp += @str_sp
$temp_dex += @str_dex
$temp_agi += @str_agi
$temp_int += @str_int
$point -= 1
@lvup_window.refresh
s_disable
return
when 3
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
$temp_dex += @dex_dex
$temp_hp += @dex_hp
$temp_sp += @dex_sp
$temp_str += @dex_str
$temp_agi += @dex_agi
$temp_int += @dex_int
$point -= 1
@lvup_window.refresh
s_disable
return
when 4
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
$temp_agi += @agi_agi
$temp_hp += @agi_hp
$temp_sp += @agi_sp
$temp_str += @agi_str
$temp_dex += @agi_dex
$temp_int += @agi_int
$point -= 1
@lvup_window.refresh
s_disable
return
when 5
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
$temp_int += @int_int
$temp_hp += @int_hp
$temp_sp += @int_sp
$temp_str += @int_str
$temp_dex += @int_dex
$temp_agi += @int_agi
$point -= 1
@lvup_window.refresh
s_disable
return
end
end
#=============================================================
# 什么都没有按下的情况
#=============================================================
case @command_window.index
when 0 # 增加HP
temptext1 = @text_hp + @hp_hp.to_s + "点 " + @text_str + @hp_str.to_s + "点 " + @text_dex + @hp_dex.to_s + "点"
temptext2 = @text_sp + @hp_sp.to_s + "点 " + @text_agi + @hp_agi.to_s + "点 " + @text_int + @hp_int.to_s + "点"
@help_window.lvup_text(@text_hp_sc , @text_2 , temptext1 , temptext2)
when 1 # 增加SP
temptext1 = @text_hp + @sp_hp.to_s + "点 " + @text_str + @sp_str.to_s + "点 " + @text_dex + @sp_dex.to_s + "点"
temptext2 = @text_sp + @sp_sp.to_s + "点 " + @text_agi + @sp_agi.to_s + "点 " + @text_int + @sp_int.to_s + "点"
@help_window.lvup_text(@text_sp_sc , @text_2 , temptext1 , temptext2)
when 2 # 增加力量
temptext1 = @text_hp + @str_hp.to_s + "点 " + @text_str + @str_str.to_s + "点 " + @text_dex + @str_dex.to_s + "点"
temptext2 = @text_sp + @str_sp.to_s + "点 " + @text_agi + @str_agi.to_s + "点 " + @text_int + @str_int.to_s + "点"
@help_window.lvup_text(@text_str_sc , @text_2 , temptext1 , temptext2)
when 3 # 增加灵巧
temptext1 = @text_hp + @dex_hp.to_s + "点 " + @text_str + @dex_agi.to_s + "点 " + @text_dex + @dex_dex.to_s + "点"
temptext2 = @text_sp + @dex_sp.to_s + "点 " + @text_agi + @dex_agi.to_s + "点 " + @text_int + @dex_int.to_s + "点"
@help_window.lvup_text(@text_dex_sc , @text_2 , temptext1 , temptext2)
when 4 # 增加速度
temptext1 = @text_hp + @agi_hp.to_s + "点 " + @text_str + @agi_str.to_s + "点 " + @text_dex + @agi_dex.to_s + "点"
temptext2 = @text_sp + @agi_sp.to_s + "点 " + @text_agi + @agi_agi.to_s + "点 " + @text_int + @agi_int.to_s + "点"
@help_window.lvup_text(@text_agi_sc , @text_2 , temptext1 , temptext2)
when 5 # 增加魔力
temptext1 = @text_hp + @int_hp.to_s + "点 " + @text_str + @int_str.to_s + "点 " + @text_dex + @int_dex.to_s + "点"
temptext2 = @text_sp + @int_sp.to_s + "点 " + @text_agi + @int_agi.to_s + "点 " + @text_int + @int_int.to_s + "点"
@help_window.lvup_text(@text_int_sc , @text_2 , temptext1 , temptext2)
when 6 # 保存设定
@help_window.lvup_text(@text_save)
when 7 # 点数重置
@help_window.lvup_text(@text_reset)
end
#=============================================================
# 按下R与L换人的情况
#=============================================================
if Input.trigger?(Input::R)
# 演奏光标 SE
$game_system.se_play($data_system.cursor_se)
# 移至下一位角色
@actor_index += 1
@actor_index %= $game_party.actors.size
# 切换到别的状态画面
$scene = Scene_Lvup.new(@actor_index , @command_window.index)
return
end
# 按下 L 键的情况下
if Input.trigger?(Input::L)
# 演奏光标 SE
$game_system.se_play($data_system.cursor_se)
# 移至上一位角色
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
# 切换到别的状态画面
$scene = Scene_Lvup.new(@actor_index , @command_window.index)
return
end
end
#--------------------------------------------------------------------------
# ● 选项明暗判断
#--------------------------------------------------------------------------
def s_disable
# 判断剩余点数是否为0,如果为0,那么增加选项表示为暗色
if $point == 0
@command_window.disable_item(0)
@command_window.disable_item(1)
@command_window.disable_item(2)
@command_window.disable_item(3)
@command_window.disable_item(4)
@command_window.disable_item(5)
else
@command_window.able_item(0)
@command_window.able_item(1)
@command_window.able_item(2)
@command_window.able_item(3)
@command_window.able_item(4)
@command_window.able_item(5)
end
end
end
#==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==============================================================================
复制代码
作者:
残花;高飞
时间:
2014-5-3 19:21
继续更新!口袋妖怪的电脑将被仓库代替
仓库代码:
#==============================================================================
# 本脚本来自www.66rpg.com,转载和使用请保留此信息
# ikki,根据柳柳真实商店改编。存东西收费1元,取东西不收费。
#==============================================================================
#
# 调用:$scene = Scene_Shop_Va.new(1)
#
#==============================================================================
# ■ Scene_Shop
#------------------------------------------------------------------------------
# 处理商店画面的类。
#==============================================================================
class Game_System
attr_accessor :goods
alias vaule_shop_66RPG_initialize initialize
def initialize
vaule_shop_66RPG_initialize
@goods = []
###########################################################################
# 初期的时候的商店物品,编号顺序:种类,ID,可卖数量
@goods[1] = [[-1,-1,-1]]
###########################################################################
end
def shop_change(shop,kind,id,delnumber)
dl = delnumber
for dt in $game_system.goods[shop]
if (dt[0]==kind) and (dt[1]==id)
dt[2] -= dl
dt[2] = [dt[2],99].min
if dt[2] == 0
$game_system.goods[shop].delete(dt)
end
return
end
end
$game_system.goods[shop].push([kind,id,-delnumber])
end
end
class Scene_Shop_Va
def initialize(shop_number)
# 当前商店编号
@shop_now = shop_number
end
#--------------------------------------------------------------------------
# ● 主处理
#--------------------------------------------------------------------------
def main
# 生成帮助窗口
@help_window = Window_Help.new
# 生成指令窗口
@command_window = Window_ShopCommand_Va.new
# 生成金钱窗口
@gold_window = Window_Gold.new
@gold_window.x = 480
@gold_window.y = 64
# 生成时间窗口
@dummy_window = Window_Base.new(0, 128, 640, 352)
# 生成购买窗口
@buy_window = Window_ShopBuy_Va.new($game_system.goods[@shop_now])
@buy_window.active = false
@buy_window.visible = false
@buy_window.help_window = @help_window
# 生成卖出窗口
@sell_window = Window_ShopSell_Va.new
@sell_window.active = false
@sell_window.visible = false
@sell_window.help_window = @help_window
# 生成数量输入窗口
@number_window = Window_ShopNumber_Va.new
@number_window.active = false
@number_window.visible = false
# 生成状态窗口
@status_window = Window_ShopStatus_Va.new
@status_window.visible = false
# 执行过渡
Graphics.transition
# 主循环
loop do
# 刷新游戏画面
Graphics.update
# 刷新输入信息
Input.update
# 刷新画面
update
# 如果画面切换的话就中断循环
if $scene != self
break
end
end
# 准备过渡
Graphics.freeze
# 释放窗口
@help_window.dispose
@command_window.dispose
@gold_window.dispose
@dummy_window.dispose
@buy_window.dispose
@sell_window.dispose
@number_window.dispose
@status_window.dispose
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
# 刷新窗口
@help_window.update
@command_window.update
@gold_window.update
@dummy_window.update
@buy_window.update
@sell_window.update
@number_window.update
@status_window.update
# 指令窗口激活的情况下: 调用 update_command
if @command_window.active
update_command
return
end
# 购买窗口激活的情况下: 调用 update_buy
if @buy_window.active
update_buy
return
end
# 卖出窗口激活的情况下: 调用 update_sell
if @sell_window.active
update_sell
return
end
# 个数输入窗口激活的情况下: 调用 update_number
if @number_window.active
update_number
return
end
end
#--------------------------------------------------------------------------
# ● 刷新画面 (指令窗口激活的情况下)
#--------------------------------------------------------------------------
def update_command
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 切换到地图画面
$scene = Scene_Map.new
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 命令窗口光标位置分支
case @command_window.index
when 0 # 购买
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 窗口状态转向购买模式
@command_window.active = false
@dummy_window.visible = false
@buy_window.active = true
@buy_window.visible = true
@buy_window.refresh
@status_window.visible = true
when 1 # 卖出
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 窗口状态转向卖出模式
@command_window.active = false
@dummy_window.visible = false
@sell_window.active = true
@sell_window.visible = true
@sell_window.refresh
when 2 # 取消
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 切换到地图画面
$scene = Scene_Map.new
end
return
end
end
#--------------------------------------------------------------------------
# ● 刷新画面 (购买窗口激活的情况下)
#--------------------------------------------------------------------------
def update_buy
# 设置状态窗口的物品
@status_window.item = @buy_window.item
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 窗口状态转向初期模式
@command_window.active = true
@dummy_window.visible = true
@buy_window.active = false
@buy_window.visible = false
@status_window.visible = false
@status_window.item = nil
# 删除帮助文本
@help_window.set_text("")
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 获取物品
@item = @buy_window.item
# 物品无效的情况下、或者价格在所持金以上的情况下
if @item == nil# or @item.price > $game_party.gold
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
return
end
# 获取物品所持数
case @item
when RPG::Item
number = $game_party.item_number(@item.id)
when RPG::Weapon
number = $game_party.weapon_number(@item.id)
when RPG::Armor
number = $game_party.armor_number(@item.id)
end
# 如果已经拥有了 99 个情况下
if number == 99
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
return
end
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 计算可以最多购买的数量
max = @item.price == 0 ? 99 : $game_party.gold / @item.price
max = [[max, 99 - number].min,@buy_window.item_number].min
# 窗口状态转向数值输入模式
@buy_window.active = false
@buy_window.visible = false
@number_window.set(@item, max, @item.price)
@number_window.active = true
@number_window.visible = true
end
end
#--------------------------------------------------------------------------
# ● 画面更新 (卖出窗口激活的情况下)
#--------------------------------------------------------------------------
def update_sell
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 窗口状态转向初期模式
@command_window.active = true
@dummy_window.visible = true
@sell_window.active = false
@sell_window.visible = false
@status_window.item = nil
# 删除帮助文本
@help_window.set_text("")
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 获取物品
@item = @sell_window.item
# 物品无效的情况下、或者价格为 0 (不能卖出) 的情况下
if @item == nil# or @item.price == 0
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
return
end
# 如果金钱为 0 G情况下
if $game_party.gold == 0
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
$game_temp.message_text = "没钱了,请续费."
# 切换到地图画面
$scene = Scene_Map.new
return
end
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 获取物品的所持数
case @item
when RPG::Item
number = $game_party.item_number(@item.id)
when RPG::Weapon
number = $game_party.weapon_number(@item.id)
when RPG::Armor
number = $game_party.armor_number(@item.id)
end
# 最大卖出个数 = 物品的所持数
max = number
# 窗口状态转向个数输入模式
@sell_window.active = false
@sell_window.visible = false
@number_window.set(@item, max, @item.price / 2)
@number_window.active = true
@number_window.visible = true
@status_window.visible = true
end
end
#--------------------------------------------------------------------------
# ● 刷新画面 (个数输入窗口激活的情况下)
#--------------------------------------------------------------------------
def update_number
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 设置个数输入窗口为不活动·非可视状态
@number_window.active = false
@number_window.visible = false
# 命令窗口光标位置分支
case @command_window.index
when 0 # 购买
# 窗口状态转向购买模式
@buy_window.active = true
@buy_window.visible = true
when 1 # 卖出
# 窗口状态转向卖出模式
@sell_window.active = true
@sell_window.visible = true
@status_window.visible = false
end
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 演奏商店 SE
$game_system.se_play($data_system.shop_se)
# 设置个数输入窗口为不活动·非可视状态
@number_window.active = false
@number_window.visible = false
# 命令窗口光标位置分支
case @command_window.index
when 0 # 购买
# 购买处理
temp = 0
case @item
when RPG::Item
$game_party.gain_item(@item.id, @number_window.number)
when RPG::Weapon
$game_party.gain_weapon(@item.id, @number_window.number)
temp = 1
when RPG::Armor
$game_party.gain_armor(@item.id, @number_window.number)
temp = 2
end
goods_del(temp,@item.id,@number_window.number)
# 刷新各窗口
@buy_window = Window_ShopBuy_Va.new($game_system.goods[@shop_now])
@gold_window.refresh
@buy_window.refresh
@status_window.refresh
# 窗口状态转向购买模式
@buy_window.active = true
@buy_window.visible = true
when 1 # 卖出
# 卖出处理
$game_party.lose_gold(@number_window.number)
temp = 0
case @item
when RPG::Item
$game_party.lose_item(@item.id, @number_window.number)
when RPG::Weapon
$game_party.lose_weapon(@item.id, @number_window.number)
temp = 1
when RPG::Armor
$game_party.lose_armor(@item.id, @number_window.number)
temp = 2
end
# 刷新各窗口
goods_del(temp,@item.id,-@number_window.number)
@buy_window = Window_ShopBuy_Va.new($game_system.goods[@shop_now])
@buy_window.active = false
@buy_window.visible = false
@buy_window.help_window = @help_window
@gold_window.refresh
@sell_window.refresh
@status_window.refresh
# 窗口状态转向卖出模式
@sell_window.active = true
@sell_window.visible = true
@status_window.visible = false
end
return
end
end
# 删除可出售商品内容
def goods_del(kind,id,delnumber)
dl = delnumber
for dt in $game_system.goods[@shop_now]
if (dt[0]==kind) and (dt[1]==id)
dt[2] -= dl
dt[2] = [dt[2],99].min
if dt[2] == 0
$game_system.goods[@shop_now].delete(dt)
end
return
end
end
$game_system.goods[@shop_now].push([kind,id,-delnumber])
end
end
#==============================================================================
# ■ Window_ShopBuy_Va
#------------------------------------------------------------------------------
# 商店画面、浏览显示可以购买的商品的窗口。
#==============================================================================
class Window_ShopBuy_Va < Window_Selectable
attr_accessor :shop_goods
#--------------------------------------------------------------------------
# ● 初始化对像
# shop_goods : 商品
#--------------------------------------------------------------------------
def initialize(shop_goods)
super(0, 128, 368, 352)
@shop_goods = shop_goods
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# ● 获取物品
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# ● 获取物品
#--------------------------------------------------------------------------
def item_number
return @data_number[self.index]
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
@data_number = []
for goods_item in @shop_goods
case goods_item[0]
when 0
item = $data_items[goods_item[1]]
when 1
item = $data_weapons[goods_item[1]]
when 2
item = $data_armors[goods_item[1]]
end
if (item != nil) and (goods_item[2] != 0)
@data.push(item)
@data_number.push(goods_item[2])
else
@data.delete(item)
end
end
# 如果项目数不是 0 就生成位图、描绘全部项目
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# ● 描绘羡慕
# index : 项目编号
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
# 获取物品所持数
case item
when RPG::Item
number = $game_party.item_number(item.id)
when RPG::Weapon
number = $game_party.weapon_number(item.id)
when RPG::Armor
number = $game_party.armor_number(item.id)
end
x = 4
y = index * 32
rect = Rect.new(x, y, self.width - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
self.contents.draw_text(x + 240, y, 88, 32, "存有 ", 2)
self.contents.draw_text(x + 240, y, 88, 32, @data_number[index].to_s, 2)
# self.contents.draw_text(x + 180, y, 88, 32, item.price.to_s, 2)
end
#--------------------------------------------------------------------------
# ● 刷新帮助文本
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end
#==============================================================================
# ■ Window_ShopCommand_Va
#------------------------------------------------------------------------------
# 商店画面、选择要做的事的窗口
#==============================================================================
class Window_ShopCommand_Va < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
super(0, 64, 480, 64)
self.contents = Bitmap.new(width - 32, height - 32)
@item_max = 3
@column_max = 3
@commands = ["取出物品", "存入电脑", "离开"]
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# ● 描绘项目
# index : 项目编号
#--------------------------------------------------------------------------
def draw_item(index)
x = 4 + index * 160
self.contents.draw_text(x, 0, 128, 32, @commands[index])
end
end
#==============================================================================
# ■ Window_ShopSell_Va
#------------------------------------------------------------------------------
# 商店画面、浏览显示可以卖掉的商品的窗口。
#==============================================================================
class Window_ShopSell_Va < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
super(0, 128, 640, 352)
@column_max = 2
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# ● 获取物品
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in 1...$data_items.size
if $game_party.item_number(i) > 0
@data.push($data_items[i])
end
end
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0
@data.push($data_weapons[i])
end
end
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0
@data.push($data_armors[i])
end
end
# 如果项目数不是 0 就生成位图、描绘全部项目
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# ● 描绘项目
# index : 项目标号
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
case item
when RPG::Item
number = $game_party.item_number(item.id)
when RPG::Weapon
number = $game_party.weapon_number(item.id)
when RPG::Armor
number = $game_party.armor_number(item.id)
end
x = 4 + index % 2 * (288 + 32)
y = index / 2 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
end
#--------------------------------------------------------------------------
# ● 刷新帮助文本
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end
#==============================================================================
# ■ Window_ShopNumber_Va
#------------------------------------------------------------------------------
# 商店画面、输入买卖数量的窗口。
#==============================================================================
class Window_ShopNumber_Va < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
super(0, 128, 368, 352)
self.contents = Bitmap.new(width - 32, height - 32)
@item = nil
@max = 1
@price = 0
@number = 1
end
#--------------------------------------------------------------------------
# ● 设置物品、最大个数、价格
#--------------------------------------------------------------------------
def set(item, max, price)
@item = item
@max = max
@price = price
@number = 1
refresh
end
#--------------------------------------------------------------------------
# ● 被输入的件数设置
#--------------------------------------------------------------------------
def number
return @number
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
draw_item_name(@item, 4, 96)
self.contents.font.color = normal_color
self.contents.draw_text(272, 96, 32, 32, "×")
self.contents.draw_text(308, 96, 24, 32, @number.to_s, 2)
self.cursor_rect.set(304, 96, 32, 32)
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
super
if self.active
# 光标右 (+1)
if Input.repeat?(Input::RIGHT) and @number < @max
$game_system.se_play($data_system.cursor_se)
@number += 1
refresh
end
# 光标左 (-1)
if Input.repeat?(Input::LEFT) and @number > 1
$game_system.se_play($data_system.cursor_se)
@number -= 1
refresh
end
# 光标上 (+10)
if Input.repeat?(Input::UP) and @number < @max
$game_system.se_play($data_system.cursor_se)
@number = [@number + 10, @max].min
refresh
end
# 光标下 (-10)
if Input.repeat?(Input::DOWN) and @number > 1
$game_system.se_play($data_system.cursor_se)
@number = [@number - 10, 1].max
refresh
end
end
end
end
#==============================================================================
# ■ Window_ShopStatus_Va
#------------------------------------------------------------------------------
# 商店画面、显示物品所持数与角色装备的窗口。
#==============================================================================
class Window_ShopStatus_Va < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
super(368, 128, 272, 352)
self.contents = Bitmap.new(width - 32, height - 32)
@item = nil
refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.font.size -= 4
self.contents.draw_text(0, 0, 252, 32, "每次存入需要1G的传输费.")
self.contents.draw_text(0, 34, 252, 32, "取出物品无须任何费用.")
self.contents.font.size += 4
end
#--------------------------------------------------------------------------
# ● 设置物品
# item : 新的物品
#--------------------------------------------------------------------------
def item=(item)
if @item != item
@item = item
refresh
end
end
end
复制代码
防卡脚本(实用):
#======================================
# ■ Anti Event Lag Script
#======================================
# By: Near Fantastica
# Date: 12.06.05
# Version: 3
#======================================
#======================================
# ■ Game_Map
#======================================
class Game_Map
#--------------------------------------------------------------------------
def in_range?(object)
screne_x = $game_map.display_x
screne_x -= 256
screne_y = $game_map.display_y
screne_y -= 256
screne_width = $game_map.display_x
screne_width += 2816
screne_height = $game_map.display_y
screne_height += 2176
return false if object.real_x <= screne_x
return false if object.real_x >= screne_width
return false if object.real_y <= screne_y
return false if object.real_y >= screne_height
return true
end
#--------------------------------------------------------------------------
def update
if $game_map.need_refresh
refresh
end
if @scroll_rest > 0
distance = 2 ** @scroll_speed
case @scroll_direction
when 2
scroll_down(distance)
when 4
scroll_left(distance)
when 6
scroll_right(distance)
when 8
scroll_up(distance)
end
@scroll_rest -= distance
end
for event in @events.values
if in_range?(event) or event.trigger == 3 or event.trigger == 4
event.update
end
end
for common_event in @common_events.values
common_event.update
end
@fog_ox -= @fog_sx / 8.0
@fog_oy -= @fog_sy / 8.0
if @fog_tone_duration >= 1
d = @fog_tone_duration
target = @fog_tone_target
@fog_tone.red = (@fog_tone.red * (d - 1) + target.red) / d
@fog_tone.green = (@fog_tone.green * (d - 1) + target.green) / d
@fog_tone.blue = (@fog_tone.blue * (d - 1) + target.blue) / d
@fog_tone.gray = (@fog_tone.gray * (d - 1) + target.gray) / d
@fog_tone_duration -= 1
end
if @fog_opacity_duration >= 1
d = @fog_opacity_duration
@fog_opacity = (@fog_opacity * (d - 1) + @fog_opacity_target) / d
@fog_opacity_duration -= 1
end
end
end
#======================================
# ■ Spriteset_Map
#======================================
class Spriteset_Map
#--------------------------------------------------------------------------
def in_range?(object)
screne_x = $game_map.display_x
screne_x -= 256
screne_y = $game_map.display_y
screne_y -= 256
screne_width = $game_map.display_x
screne_width += 2816
screne_height = $game_map.display_y
screne_height += 2176
return false if object.real_x <= screne_x
return false if object.real_x >= screne_width
return false if object.real_y <= screne_y
return false if object.real_y >= screne_height
return true
end
#--------------------------------------------------------------------------
def update
if @panorama_name != $game_map.panorama_name or
@panorama_hue != $game_map.panorama_hue
@panorama_name = $game_map.panorama_name
@panorama_hue = $game_map.panorama_hue
if @panorama.bitmap != nil
@panorama.bitmap.dispose
@panorama.bitmap = nil
end
if @panorama_name != ""
@panorama.bitmap = RPG::Cache.panorama(@panorama_name, @panorama_hue)
end
Graphics.frame_reset
end
if @fog_name != $game_map.fog_name or @fog_hue != $game_map.fog_hue
@fog_name = $game_map.fog_name
@fog_hue = $game_map.fog_hue
if @fog.bitmap != nil
@fog.bitmap.dispose
@fog.bitmap = nil
end
if @fog_name != ""
@fog.bitmap = RPG::Cache.fog(@fog_name, @fog_hue)
end
Graphics.frame_reset
end
@tilemap.ox = $game_map.display_x / 4
@tilemap.oy = $game_map.display_y / 4
@tilemap.update
@panorama.ox = $game_map.display_x / 8
@panorama.oy = $game_map.display_y / 8
@fog.zoom_x = $game_map.fog_zoom / 100.0
@fog.zoom_y = $game_map.fog_zoom / 100.0
@fog.opacity = $game_map.fog_opacity
@fog.blend_type = $game_map.fog_blend_type
@fog.ox = $game_map.display_x / 4 + $game_map.fog_ox
@fog.oy = $game_map.display_y / 4 + $game_map.fog_oy
@fog.tone = $game_map.fog_tone
i=0
for sprite in @character_sprites
if sprite.character.is_a?(Game_Event)
if in_range?(sprite.character) or sprite.character.trigger == 3 or sprite.character.trigger == 4
sprite.update
i+=1
end
else
sprite.update
i+=1
end
end
#p i
@weather.type = $game_screen.weather_type
@weather.max = $game_screen.weather_max
@weather.ox = $game_map.display_x / 4
@weather.oy = $game_map.display_y / 4
@weather.update
for sprite in @picture_sprites
sprite.update
end
@timer_sprite.update
@viewport1.tone = $game_screen.tone
@viewport1.ox = $game_screen.shake
@viewport3.color = $game_screen.flash_color
@viewport1.update
@viewport3.update
end
end
复制代码
作者:
日月星辰
时间:
2014-5-4 11:10
你知道吗 国外有rmxp的口袋改版支持双屏,全复刻黑白战斗系统 下屏菜单访做得也很像,都是模拟nds的呀~
作者:
fux2
时间:
2014-5-4 16:25
日月星辰 发表于 2014-5-4 11:10
你知道吗 国外有rmxp的口袋改版支持双屏,全复刻黑白战斗系统 下屏菜单访做得也很像,都是模拟nds的呀~ ...
这个游戏我有收藏哦《Eméraude céléste》
另外楼主发个范例吧
作者:
2744922969
时间:
2015-5-23 23:30
怎么宠物战斗
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1