Project1
标题:
重复上回合动作
[打印本页]
作者:
yehaojie
时间:
2008-7-31 23:33
标题:
重复上回合动作
http://rpg.blue/web/htm/news315.htm
#==============================================================================
# 本脚本来自www.66rpg.com,转载和使用请保留此信息
#重复上回合动作 v1.1
#by 叶子 Date: 12-12-2005
#QQ:121058265
#本脚本根据66rpg的站长柳柳提出的思路制作
#如发现有bug请与作者联系或上66rpg发贴说明
#==============================================================================
#当战斗时按下T键,
#当前角色就会重复上回合的动作(包括攻击,特技,防御,物品)。
#当战斗时按下R键,
#所有角色就会重复上回合的动作。
#当战斗时按下F键,
#所有角色就会普通攻击同一个敌人。
#脚本占用了第一号开关。
#当第一号开关打开时,重复上回合动作功能关闭。
#如果想用其他开关,改第130,263,323行中相应内容。
#--------------------------------------------------------------------------
class Game_Battler
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
@battler_name = ""
@battler_hue = 0
@hp = 0
@sp = 0
@states = []
@states_turn = {}
@maxhp_plus = 0
@maxsp_plus = 0
@str_plus = 0
@dex_plus = 0
@agi_plus = 0
@int_plus = 0
@hidden = false
@immortal = false
@damage_pop = false
@damage = nil
@critical = false
@animation_id = 0
@animation_hit = false
@white_flash = false
@blink = false
@current_action = Game_BattleAction.new
@last_action = Game_BattleAction.new
end
#--------------------------------------------------------------------------
# ● 获取前一回合的动作
#--------------------------------------------------------------------------
def last_action
return @last_action
end
end
class Game_Party
def last_actions
for actor in @actors
actor.last_action.kind = actor.current_action.kind
actor.last_action.basic = actor.current_action.basic
actor.last_action.forcing = actor.current_action.forcing
actor.last_action.target_index = actor.current_action.target_index
actor.last_action.skill_id = actor.current_action.skill_id
actor.last_action.item_id = actor.current_action.item_id
end
end
end
class Scene_Battle
#--------------------------------------------------------------------------
# ● 开始同伴命令回合
#--------------------------------------------------------------------------
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.last_actions
# 清除全体同伴的行动
$game_party.clear_actions
# 不能输入命令的情况下
unless $game_party.inputable?
# 开始主回合
start_phase4
end
end
#--------------------------------------------------------------------------
# ● 刷新画面 (同伴命令回合)
#--------------------------------------------------------------------------
def update_phase2
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 同伴指令窗口光标位置分支
case @party_command_window.index
when 0 # 战斗
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 开始角色的命令回合
start_phase3
when 1 # 逃跑
# 不能逃跑的情况下
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_phase2_escape
end
return
end
#------------------------------
# 按下 R 键的情况下
#------------------------------
if Kboard.keyboard($R_Key_R)
#如果一号开关打开就禁止重复上回合动作
if $game_switches[1] == true #开关号可以改,把那个1改成你要的开关号
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
return
end
for a in $game_party.actors
if a.inputable?
case a.last_action.kind
when 0 # 攻击,防御
#防御
if a.last_action.basic == 1
# 设置行动
a.current_action.kind = 0
a.current_action.basic = 1
#攻击
else
# 设置行动
a.current_action.kind = 0
a.current_action.basic = 0
a.current_action.target_index = a.last_action.target_index
end
when 1 # 特技
skill_id = a.last_action.skill_id
if a.skill_learn?(skill_id) and a.skill_can_use?(skill_id)
# 设置行动
a.current_action.kind = 1
a.current_action.skill_id = a.last_action.skill_id
a.current_action.target_index = a.last_action.target_index
else
# 不能使用就攻击
if $data_skills[skill_id].scope < 3
a.current_action.kind = 0
a.current_action.basic = 0
a.current_action.target_index = a.last_action.target_index
else
a.current_action.kind = 0
a.current_action.basic = 0
a.current_action.target_index = 0
end
end
when 2 # 物品
item_id = a.last_action.item_id
if $game_party.item_can_use?(item_id)
# 设置行动
a.current_action.kind = 2
a.current_action.item_id = a.last_action.item_id
a.current_action.target_index = a.last_action.target_index
else
# 不能使用就攻击
a.current_action.kind = 0
a.current_action.basic = 0
a.current_action.target_index = 0
end
end
end
end
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
start_phase4
return
end
#------------------------------
# 按下 F 键的情况下
#------------------------------
if Kboard.keyboard($R_Key_T)
for a in $game_party.actors
if a.inputable?
a.current_action.kind = 0
a.current_action.basic = 0
a.current_action.target_index = 0
end
end
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
start_phase4
return
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
end
return
end
#------------------------------
# 按下 T 建的情况下
#------------------------------
if Kboard.keyboard($R_Key_T)
#如果一号开关打开就禁止重复上回合动作
if $game_switches[1] == true #开关号可以改,把那个1改成你要的开关号
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
return
end
case @active_battler.last_action.kind
when 0 # 攻击,防御
#防御
if @active_battler.last_action.basic == 1
# 设置行动
@active_battler.current_action.kind = 0
@active_battler.current_action.basic = 1
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
phase3_next_actor
#攻击
else
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 设置行动
@active_battler.current_action.kind = 0
@active_battler.current_action.basic = 0
@active_battler.current_action.target_index = @active_battler.last_action.target_index
phase3_next_actor
end
when 1 # 特技
skill_id = @active_battler.last_action.skill_id
if @active_battler.skill_learn?(skill_id) and @active_battler.skill_can_use?(skill_id)
# 设置行动
@active_battler.current_action.kind = 1
@active_battler.current_action.skill_id = @active_battler.last_action.skill_id
@active_battler.current_action.target_index = @active_battler.last_action.target_index
phase3_next_actor
else
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
end
when 2 # 物品
item_id = @active_battler.last_action.item_id
if $game_party.item_can_use?(item_id)
# 设置行动
@active_battler.current_action.kind = 2
@active_battler.current_action.item_id = @active_battler.last_action.item_id
@active_battler.current_action.target_index = @active_battler.last_action.target_index
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
phase3_next_actor
else
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
end
end
return
end
#------------------------------
# 按下 R 键的情况下
#------------------------------
if Kboard.keyboard($R_Key_R)
#如果一号开关打开就禁止重复上回合动作
if $game_switches[1] == true #开关号可以改,把那个1改成你要的开关号
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
return
end
for a in $game_party.actors
if a.inputable?
case a.last_action.kind
when 0 # 攻击,防御
#防御
if a.last_action.basic == 1
# 设置行动
a.current_action.kind = 0
a.current_action.basic = 1
#攻击
else
# 设置行动
a.current_action.kind = 0
a.current_action.basic = 0
a.current_action.target_index = a.last_action.target_index
end
when 1 # 特技
skill_id = a.last_action.skill_id
if a.skill_learn?(skill_id) and a.skill_can_use?(skill_id)
# 设置行动
a.current_action.kind = 1
a.current_action.skill_id = a.last_action.skill_id
a.current_action.target_index = a.last_action.target_index
elsif
# 不能使用就攻击
if $data_skills[skill_id].scope < 3
a.current_action.kind = 0
a.current_action.basic = 0
a.current_action.target_index = a.last_action.target_index
else
a.current_action.kind = 0
a.current_action.basic = 0
a.current_action.target_index = 0
end
end
when 2 # 物品
item_id = a.last_action.item_id
if $game_party.item_can_use?(item_id)
# 设置行动
a.current_action.kind = 2
a.current_action.item_id = a.last_action.item_id
a.current_action.target_index = a.last_action.target_index
else
# 不能使用就攻击
a.current_action.kind = 0
a.current_action.basic = 0
a.current_action.target_index = 0
end
end
end
# 角色的明灭效果 OFF
if a != nil
a.blink = false
end
end
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
start_phase4
return
end
#------------------------------
# 按下 F 键的情况下
#------------------------------
if Kboard.keyboard($R_Key_F)
for a in $game_party.actors
if a.inputable?
a.current_action.kind = 0
a.current_action.basic = 0
a.current_action.target_index = 0
end
# 角色的明灭效果 OFF
if a != nil
a.blink = false
end
end
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
start_phase4
return
end
end
end
#==============================================================================
# 本脚本来自www.66rpg.com,转载和使用请保留此信息
#==============================================================================
复制代码
#==============================================================================
# ■ 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_phase2
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
# 按下 C 键的情况下
# if Input.trigger?(Input::C)
# 同伴指令窗口光标位置分支
# case @party_command_window.index
# when 0 # 战斗
# 演奏确定 SE
# $game_system.se_play($data_system.decision_se)
# 开始角色的命令回合
start_phase3
# when 1 # 逃跑
# 不能逃跑的情况下
# 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_phase2_escape
# end
# return
# end
end
#--------------------------------------------------------------------------
# ● 画面更新 (同伴指令回合 : 逃跑)
#--------------------------------------------------------------------------
def update_phase2_escape
# 计算敌人速度的平均值
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
# 计算敌人魔法防御的平均值
enemies_mdef = 0
enemies_number = 0
for enemy in $game_troop.enemies
if enemy.exist?
enemies_mdef += enemy.mdef
enemies_number += 1
end
end
if enemies_number > 0
enemies_mdef /= enemies_number
end
# 计算角色魔法防御的平均值
actors_mdef = 0
actors_number = 0
for actor in $game_party.actors
if actor.exist?
actors_mdef += actor.agi
actors_number += 1
end
end
if actors_number > 0
actors_mdef /= actors_number
end
# 逃跑成功判定
success = rand(100) < 50 * actors_agi / enemies_agi * actors_mdef / enemies_mdef
# 成功逃跑的情况下
if success
# 演奏逃跑 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
@help_window.set_text("逃跑失败", 1)#显示『逃走失败』字样
@wait_count = 40
# 开始主回合
start_phase4
end
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]
# 获得金钱
$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 = 10
end
#--------------------------------------------------------------------------
# ● 画面更新 (结束战斗回合)
#--------------------------------------------------------------------------
def update_phase5
# 等待计数大于 0 的情况下
if @phase5_wait_count > 0
# 减少等待计数
@phase5_wait_count -= 1
# 等待计数为 0 的情况下
if @phase5_wait_count == 0
# 准备过渡
Graphics.freeze
# 生成战斗胜利图形
@sprite = Sprite.new
@sprite.z = 9999
@sprite.bitmap = RPG::Cache.gameover("胜利")
# 执行过渡
Graphics.transition(40)
@wait_count = 40
# 准备过渡
Graphics.freeze
# 释放战斗胜利图形
@sprite.bitmap.dispose
# 执行过渡
Graphics.transition(40)
# 显示结果窗口
@result_window.visible = true
# 清除主回合标志
$game_temp.battle_main_phase = false
# 刷新状态窗口
@status_window.refresh
end
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 关闭结果窗口
@result_window.visible = false
# 获得 EXP
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
# 战斗结束
battle_end(0)
end
end
end
复制代码
(内有逃跑)
这两个Scene_Battle合下 {/gg}能不能修改下? [LINE]1,#dddddd[/LINE]
此贴于 2008-8-4 2:24:12 被版主darkten提醒,请楼主看到后对本贴做出回应。
作者:
yehaojie
时间:
2008-8-1 21:37
没人知道吗?我只要改成当按下R键所有角色重复上一回合就行了{/gg}
作者:
yehaojie
时间:
2008-8-2 04:20
等了两天.......
作者:
yehaojie
时间:
2008-8-2 23:47
{/gg}真的没人吗?
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1