Project1
标题:
〖RTAB〗二刀流
[打印本页]
作者:
yzlsym
时间:
2008-4-24 21:44
标题:
〖RTAB〗二刀流
记得站上有人问过如何设置二刀流的二次攻击
于是去找了日站的脚本
原址
http://members.jcom.home.ne.jp/cogwheel/
发现二刀流竟然更新到1.03了```
我们落后了```
现在我把它全部翻译出来了``
很强大`
比原来的设置方便多了``
只要设置职业就可以
不过只有RTAB的。。。
想要在普通应用``自己改吧``
范例省略```
#Ver 1.04二刀流
#技术支持 URL
#Http://members.jcom.home.ne.jp/cogwheel/
#==============================================================================
# ■ Game_Actor
#------------------------------------------------------------------------------
# 处理角色的类。本类在 Game_Actors 类 ($game_actors)
# 的内部使用、Game_Party 类请参考 ($game_party) 。
#==============================================================================
class Game_Actor <Game_Battler
#--------------------------------------------------------------------------
# ● 常数
#--------------------------------------------------------------------------
EDGE = 75 #二刀流发挥的能力[%]
#--------------------------------------------------------------------------
# ● 定义实例变量
#--------------------------------------------------------------------------
attr_accessor :first_weapon # 二刀流变量
attr_accessor :second_weapon # 二刀流变量
attr_reader :weapon2_id # 第二把武器
#--------------------------------------------------------------------------
# ●二刀流的职业
#--------------------------------------------------------------------------
def double_edge
case class_name
when "盗贼"
return true
else
return false
end
end
#--------------------------------------------------------------------------
# ● 二刀流装备确定
#--------------------------------------------------------------------------
def double_edge?
return (@weapon_id > 0 and @weapon2_id > 0)
end
#--------------------------------------------------------------------------
# ● 设置
# actor_id : 角色 ID
#--------------------------------------------------------------------------
alias :setup_double :setup
def setup(actor_id)
setup_double(actor_id)
@weapon2_id = 0
if double_edge
if equippable?($data_weapons[@armor1_id])
@weapon2_id = @armor1_id
end
@armor1_id = 0
end
end
#--------------------------------------------------------------------------
# ● 获取普通攻击属性
#--------------------------------------------------------------------------
def element_set
if double_edge and second_weapon
weapon = $data_weapons[@weapon2_id]
else
weapon = $data_weapons[@weapon_id]
end
return weapon != nil ? weapon.element_set : []
end
#--------------------------------------------------------------------------
# ● 获取普通攻击状态变化 (+)
#--------------------------------------------------------------------------
def plus_state_set
if double_edge and second_weapon
weapon = $data_weapons[@weapon2_id]
else
weapon = $data_weapons[@weapon_id]
end
return weapon != nil ? weapon.plus_state_set : []
end
#--------------------------------------------------------------------------
# ● 获取普通攻击状态变化 (-)
#--------------------------------------------------------------------------
def minus_state_set
if double_edge and second_weapon
weapon = $data_weapons[@weapon2_id]
else
weapon = $data_weapons[@weapon_id]
end
return weapon != nil ? weapon.minus_state_set : []
end
#--------------------------------------------------------------------------
# ● 获取基本力量
#--------------------------------------------------------------------------
def base_str
n = $data_actors[@actor_id].parameters[2, @level]
weapon = $data_weapons[@weapon_id]
weapon2 = $data_weapons[@weapon2_id]
armor1 = $data_armors[@armor1_id]
armor2 = $data_armors[@armor2_id]
armor3 = $data_armors[@armor3_id]
armor4 = $data_armors[@armor4_id]
n += weapon != nil ? weapon.str_plus : 0
n += weapon2 != nil ? weapon2.str_plus : 0
n += armor1 != nil ? armor1.str_plus : 0
n += armor2 != nil ? armor2.str_plus : 0
n += armor3 != nil ? armor3.str_plus : 0
n += armor4 != nil ? armor4.str_plus : 0
return [[n, 1].max, 999].min
end
#--------------------------------------------------------------------------
# ● 获取基本灵巧
#--------------------------------------------------------------------------
def base_dex
n = $data_actors[@actor_id].parameters[3, @level]
weapon = $data_weapons[@weapon_id]
weapon2 = $data_weapons[@weapon2_id]
armor1 = $data_armors[@armor1_id]
armor2 = $data_armors[@armor2_id]
armor3 = $data_armors[@armor3_id]
armor4 = $data_armors[@armor4_id]
n += weapon != nil ? weapon.dex_plus : 0
n += weapon2 != nil ? weapon2.dex_plus : 0
n += armor1 != nil ? armor1.dex_plus : 0
n += armor2 != nil ? armor2.dex_plus : 0
n += armor3 != nil ? armor3.dex_plus : 0
n += armor4 != nil ? armor4.dex_plus : 0
return [[n, 1].max, 999].min
end
#--------------------------------------------------------------------------
# ● 获取基本速度
#--------------------------------------------------------------------------
def base_agi
n = $data_actors[@actor_id].parameters[4, @level]
weapon = $data_weapons[@weapon_id]
weapon2 = $data_weapons[@weapon2_id]
armor1 = $data_armors[@armor1_id]
armor2 = $data_armors[@armor2_id]
armor3 = $data_armors[@armor3_id]
armor4 = $data_armors[@armor4_id]
n += weapon != nil ? weapon.agi_plus : 0
n += weapon2 != nil ? weapon2.agi_plus : 0
n += armor1 != nil ? armor1.agi_plus : 0
n += armor2 != nil ? armor2.agi_plus : 0
n += armor3 != nil ? armor3.agi_plus : 0
n += armor4 != nil ? armor4.agi_plus : 0
return [[n, 1].max, 999].min
end
#--------------------------------------------------------------------------
# ● 获取基本魔力
#--------------------------------------------------------------------------
def base_int
n = $data_actors[@actor_id].parameters[5, @level]
weapon = $data_weapons[@weapon_id]
weapon2 = $data_weapons[@weapon2_id]
armor1 = $data_armors[@armor1_id]
armor2 = $data_armors[@armor2_id]
armor3 = $data_armors[@armor3_id]
armor4 = $data_armors[@armor4_id]
n += weapon != nil ? weapon.int_plus : 0
n += weapon2 != nil ? weapon2.int_plus : 0
n += armor1 != nil ? armor1.int_plus : 0
n += armor2 != nil ? armor2.int_plus : 0
n += armor3 != nil ? armor3.int_plus : 0
n += armor4 != nil ? armor4.int_plus : 0
return [[n, 1].max, 999].min
end
#--------------------------------------------------------------------------
# ● 获取基本攻击力
#--------------------------------------------------------------------------
alias :base_atk_double :base_atk
def base_atk
if double_edge and
atk1 = $data_weapons[@weapon_id] != nil ?
$data_weapons[@weapon_id].atk : 0
atk2 = $data_weapons[@weapon2_id] != nil ?
$data_weapons[@weapon2_id].atk : 0
if first_weapon
return atk1
elsif second_weapon
return atk2
else
return (atk1 + atk2) * EDGE / 100
end
else
return base_atk_double
end
end
#--------------------------------------------------------------------------
# ● 获取基本物理防御
#--------------------------------------------------------------------------
def base_pdef
weapon = $data_weapons[@weapon_id]
weapon2 = $data_weapons[@weapon2_id]
armor1 = $data_armors[@armor1_id]
armor2 = $data_armors[@armor2_id]
armor3 = $data_armors[@armor3_id]
armor4 = $data_armors[@armor4_id]
pdef1 = weapon != nil ? weapon.pdef : 0
pdef2 = armor1 != nil ? armor1.pdef : 0
pdef3 = armor2 != nil ? armor2.pdef : 0
pdef4 = armor3 != nil ? armor3.pdef : 0
pdef5 = armor4 != nil ? armor4.pdef : 0
pdef6 = weapon2 != nil ? weapon2.pdef : 0
return pdef1 + pdef2 + pdef3 + pdef4 + pdef5 + pdef6
end
#--------------------------------------------------------------------------
# ● 获取基本魔法防御
#--------------------------------------------------------------------------
def base_mdef
weapon = $data_weapons[@weapon_id]
weapon2 = $data_weapons[@weapon2_id]
armor1 = $data_armors[@armor1_id]
armor2 = $data_armors[@armor2_id]
armor3 = $data_armors[@armor3_id]
armor4 = $data_armors[@armor4_id]
mdef1 = weapon != nil ? weapon.mdef : 0
mdef2 = armor1 != nil ? armor1.mdef : 0
mdef3 = armor2 != nil ? armor2.mdef : 0
mdef4 = armor3 != nil ? armor3.mdef : 0
mdef5 = armor4 != nil ? armor4.mdef : 0
mdef6 = weapon2 != nil ? weapon2.mdef : 0
return mdef1 + mdef2 + mdef3 + mdef4 + mdef5 + mdef6
end
#--------------------------------------------------------------------------
# ● 普通攻击 获取攻击方动画 ID
#--------------------------------------------------------------------------
def animation1_id
if double_edge and second_weapon
weapon = $data_weapons[@weapon2_id]
else
weapon = $data_weapons[@weapon_id]
end
return weapon != nil ? weapon.animation1_id : 0
end
#--------------------------------------------------------------------------
# ● 普通攻击 获取对象方动画 ID
#--------------------------------------------------------------------------
def animation2_id
if double_edge and second_weapon
weapon = $data_weapons[@weapon2_id]
else
weapon = $data_weapons[@weapon_id]
end
return weapon != nil ? weapon.animation2_id : 0
end
#--------------------------------------------------------------------------
# ● 获取类名
#--------------------------------------------------------------------------
def class_name
return $data_classes[@class_id].name
end
#--------------------------------------------------------------------------
# ● 变更装备
# equip_type : 装备类型
# id : 武器 or 防具 ID (0 为解除装备)
#--------------------------------------------------------------------------
def equip(equip_type, id)
case equip_type
when 0 # 武器
if id == 0 or $game_party.weapon_number(id) > 0
if double_edge and id > 0 and
$scene.is_a?(Scene_Map) and @weapon_id > 0
$game_party.gain_weapon(@weapon2_id, 1)
@weapon2_id = id
$game_party.lose_weapon(id, 1)
else
$game_party.gain_weapon(@weapon_id, 1)
@weapon_id = id
$game_party.lose_weapon(id, 1)
end
end
when 1 # 盾
if double_edge
if id == 0 or $game_party.weapon_number(id) > 0
$game_party.gain_weapon(@weapon2_id, 1)
@weapon2_id = id
$game_party.lose_weapon(id, 1)
else
update_auto_state($data_armors[@armor1_id], $data_armors[id])
$game_party.gain_armor(@armor1_id, 1)
@armor1_id = id
$game_party.lose_armor(id, 1)
end
else
if id == 0 or $game_party.armor_number(id) > 0
update_auto_state($data_armors[@armor1_id], $data_armors[id])
$game_party.gain_armor(@armor1_id, 1)
@armor1_id = id
$game_party.lose_armor(id, 1)
end
end
when 2 # 头
if id == 0 or $game_party.armor_number(id) > 0
update_auto_state($data_armors[@armor2_id], $data_armors[id])
$game_party.gain_armor(@armor2_id, 1)
@armor2_id = id
$game_party.lose_armor(id, 1)
end
when 3 # 身体
if id == 0 or $game_party.armor_number(id) > 0
update_auto_state($data_armors[@armor3_id], $data_armors[id])
$game_party.gain_armor(@armor3_id, 1)
@armor3_id = id
$game_party.lose_armor(id, 1)
end
when 4 # 装饰品
if id == 0 or $game_party.armor_number(id) > 0
update_auto_state($data_armors[@armor4_id], $data_armors[id])
$game_party.gain_armor(@armor4_id, 1)
@armor4_id = id
$game_party.lose_armor(id, 1)
end
when 5 #二刀流
$game_party.gain_weapon(@weapon2_id, 1)
@weapon2_id = 0
update_auto_state($data_armors[@armor1_id], $data_armors[0])
$game_party.gain_armor(@armor1_id, 1)
@armor1_id = 0
end
end
#--------------------------------------------------------------------------
# ● 更改职业 ID
# class_id : 新的职业 ID
#--------------------------------------------------------------------------
def class_id=(class_id)
if $data_classes[class_id] != nil
edge = double_edge
@class_id = class_id
# 避开无法装备的物品
unless equippable?($data_weapons[@weapon_id])
equip(0, 0)
end
unless equippable?($data_armors[@armor1_id])
equip(1, 0)
end
unless equippable?($data_armors[@armor2_id])
equip(2, 0)
end
unless equippable?($data_armors[@armor3_id])
equip(3, 0)
end
unless equippable?($data_armors[@armor4_id])
equip(4, 0)
end
if edge != double_edge
equip(5, 0)
end
end
end
end
复制代码
作者:
yzlsym
时间:
2008-4-24 21:44
接上``非连帖``
#==============================================================================
# ■ Game_Party
#------------------------------------------------------------------------------
# 处理同伴的类。包含金钱以及物品的信息。本类的实例
# 请参考 $game_party。
#==============================================================================
class Game_Party
#--------------------------------------------------------------------------
# ● 设置战斗测试用同伴
#--------------------------------------------------------------------------
def setup_battle_test_members
@actors = []
for battler in $data_system.test_battlers
actor = $game_actors[battler.actor_id]
actor.level = battler.level
gain_weapon(battler.weapon_id, 1)
if actor.double_edge
gain_weapon(battler.armor1_id, 1)
else
gain_armor(battler.armor1_id, 1)
end
gain_armor(battler.armor2_id, 1)
gain_armor(battler.armor3_id, 1)
gain_armor(battler.armor4_id, 1)
actor.equip(0, battler.weapon_id)
if actor.double_edge
if actor.equippable?($data_weapons[battler.armor1_id])
actor.equip(1, battler.armor1_id)
end
else
actor.equip(1, battler.armor1_id)
end
actor.equip(2, battler.armor2_id)
actor.equip(3, battler.armor3_id)
actor.equip(4, battler.armor4_id)
actor.recover_all
@actors.push(actor)
end
@items = {}
for i in 1...$data_items.size
if $data_items[i].name != ""
occasion = $data_items[i].occasion
if occasion == 0 or occasion == 1
@items[i] = 99
end
end
end
end
end
#==============================================================================
# ■ Window_EquipRight
#------------------------------------------------------------------------------
# 装备画面、显示角色现在装备的物品的窗口。
#==============================================================================
class Window_EquipRight <Window_Selectable
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@data = []
@data.push($data_weapons[@actor.weapon_id])
if @actor.double_edge
@data.push($data_weapons[@actor.weapon2_id])
else
@data.push($data_armors[@actor.armor1_id])
end
@data.push($data_armors[@actor.armor2_id])
@data.push($data_armors[@actor.armor3_id])
@data.push($data_armors[@actor.armor4_id])
@item_max = @data.size
self.contents.font.color = system_color
self.contents.draw_text(4, 32 * 0, 92, 32, $data_system.words.weapon)
if @actor.double_edge
self.contents.draw_text(4, 32 * 1, 92, 32, $data_system.words.weapon)
else
self.contents.draw_text(4, 32 * 1, 92, 32, $data_system.words.armor1)
end
self.contents.draw_text(4, 32 * 2, 92, 32, $data_system.words.armor2)
self.contents.draw_text(4, 32 * 3, 92, 32, $data_system.words.armor3)
self.contents.draw_text(5, 32 * 4, 92, 32, $data_system.words.armor4)
draw_item_name(@data[0], 92, 32 * 0)
draw_item_name(@data[1], 92, 32 * 1)
draw_item_name(@data[2], 92, 32 * 2)
draw_item_name(@data[3], 92, 32 * 3)
draw_item_name(@data[4], 92, 32 * 4)
end
end
#==============================================================================
# ■ Scene_Equip
#------------------------------------------------------------------------------
# 处理装备画面的类。
#==============================================================================
class Scene_Equip
#--------------------------------------------------------------------------
# ● 初始化对像
# actor_index : 角色索引
# equip_index : 装备索引
#--------------------------------------------------------------------------
def initialize(actor_index = 0, equip_index = 0)
@actor_index = actor_index
@equip_index = equip_index
end
#--------------------------------------------------------------------------
# ● 主处理
#--------------------------------------------------------------------------
def main
# 获取角色
@actor = $game_party.actors[@actor_index]
# 生成窗口
@help_window = Window_Help.new
@left_window = Window_EquipLeft.new(@actor)
@right_window = Window_EquipRight.new(@actor)
@item_window1 = Window_EquipItem.new(@actor, 0)
unless @actor.double_edge
@item_window2 = Window_EquipItem.new(@actor, 1)
end
@item_window3 = Window_EquipItem.new(@actor, 2)
@item_window4 = Window_EquipItem.new(@actor, 3)
@item_window5 = Window_EquipItem.new(@actor, 4)
# 关联帮助窗口
@right_window.help_window = @help_window
@item_window1.help_window = @help_window
unless @actor.double_edge
@item_window2.help_window = @help_window
end
@item_window3.help_window = @help_window
@item_window4.help_window = @help_window
@item_window5.help_window = @help_window
# 设置光标位置
@right_window.index = @equip_index
refresh
# 执行过渡
Graphics.transition
# 主循环
loop do
# 刷新游戏画面
Graphics.update
# 刷新输入信息
Input.update
# 刷新画面
update
# 如果画面切换的话的就中断循环
if $scene != self
break
end
end
# 准备过渡
Graphics.freeze
# 释放窗口
@help_window.dispose
@left_window.dispose
@right_window.dispose
@item_window1.dispose
# unless @actor.double_edge
# @item_window2.dispose
# end
@item_window3.dispose
@item_window4.dispose
@item_window5.dispose
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
# 设置物品窗口的可视状态
if @actor.double_edge
@item_window1.visible = (@right_window.index == 0 or @right_window.index == 1)
else
@item_window1.visible = (@right_window.index == 0)
@item_window2.visible = (@right_window.index == 1)
end
@item_window3.visible = (@right_window.index == 2)
@item_window4.visible = (@right_window.index == 3)
@item_window5.visible = (@right_window.index == 4)
# 获取当前装备中的物品
item1 = @right_window.item
# 设置当前的物品窗口到 @item_window
case @right_window.index
when 0
@item_window = @item_window1
when 1
if @actor.double_edge
@item_window = @item_window1
else
@item_window = @item_window2
end
when 2
@item_window = @item_window3
when 3
@item_window = @item_window4
when 4
@item_window = @item_window5
end
# 右窗口被激活的情况下
if @right_window.active
# 删除变更装备后的能力
@left_window.set_new_parameters(nil, nil, nil)
end
# 物品窗口被激活的情况下
if @item_window.active
# 获取现在选中的物品
item2 = @item_window.item
# 变更装备
last_hp = @actor.hp
last_sp = @actor.sp
@actor.equip(@right_window.index, item2 == nil ? 0 : item2.id)
# 获取变更装备后的能力值
new_atk = @actor.atk
new_pdef = @actor.pdef
new_mdef = @actor.mdef
# 返回到装备
@actor.equip(@right_window.index, item1 == nil ? 0 : item1.id)
@actor.hp = last_hp
@actor.sp = last_sp
# 描画左窗口
@left_window.set_new_parameters(new_atk, new_pdef, new_mdef)
end
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
# 刷新窗口
@left_window.update
@right_window.update
@item_window.update
refresh
# 右侧窗口被激活的情况下: 调用 update_right
if @right_window.active
update_right
return
end
# 物品窗口被激活的情况下: 调用 update_item
if @item_window.active
update_item
return
end
end
#--------------------------------------------------------------------------
# ● 刷新画面 (右侧窗口被激活的情况下)
#--------------------------------------------------------------------------
def update_right
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 切换到菜单画面
$scene = Scene_Menu.new(2)
return
#二刀流者唯一的武器如果左右手交换
if @actor.double_edge and @actor.weapon_id == 0 and @actor.weapon2_id > 0
weapon = @actor.weapon2_id
@actor.equip(1, 0)
@actor.equip(0, weapon)
end
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 固定装备的情况下
if @actor.equip_fix?(@right_window.index)
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
return
end
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 激活物品窗口
@right_window.active = false
@item_window.active = true
@item_window.index = 0
return
end
# 按下 R 键的情况下
if Input.trigger?(Input::RIGHT) or Input.trigger?(Input::R)
# 演奏光标 SE
$game_system.se_play($data_system.cursor_se)
# 移至下一位角色
@actor_index += 1
@actor_index %= $game_party.actors.size
@actor = $game_party.actors[@actor_index]
# 切换到别的装备画面
$scene = Scene_Equip.new(@actor_index, @right_window.index)
return
end
# 按下 L 键的情况下
if Input.trigger?(Input::LEFT) or 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
@actor = $game_party.actors[@actor_index]
# 切换到别的装备画面
$scene = Scene_Equip.new(@actor_index, @right_window.index)
return
end
end
end
#==============================================================================
# ■ Scene_Battle (分割定义 4)
#------------------------------------------------------------------------------
# 处理战斗画面的类。
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# ● 刷新画面 (主阶段步骤 3 : 行动方动画)
#--------------------------------------------------------------------------
alias :update_phase4_step3_double :update_phase4_step3
def update_phase4_step3(battler)
update_phase4_step3_double(battler)
if battler.is_a?(Game_Actor) and battler.anime1 == 0 and
battler.second_weapon
battler.white_flash = false
battler.wait = 0
end
end
#--------------------------------------------------------------------------
# ● 刷新画面 (主阶段步骤 4 : 对像方动画)
#--------------------------------------------------------------------------
def update_phase4_step4(battler)
# 对像方动画
if battler.target[0].is_a?(Game_Enemy) and battler.anime1 != 0
camera_set(battler)
end
# Miss的情况下
for target in battler.target
if battler.is_a?(Game_Actor) and battler.second_weapon
target.animation.push([battler.anime2,
(target.damage[battler] != "Miss"), true])
else
target.animation.push([battler.anime2,
(target.damage[battler] != "Miss")])
end
unless battler.anime2 == 0
battler.wait = 2 * $data_animations[battler.anime2].frame_max - 10
end
end
# 移至步骤 5
battler.phase = 5
end
#--------------------------------------------------------------------------
# ● 刷新画面 (主阶段步骤 5 : 显示伤害)
#--------------------------------------------------------------------------
alias :update_phase4_step5_double :update_phase4_step5
def update_phase4_step5(battler)
update_phase4_step5_double (battler)
if battler.is_a?(Game_Actor) and battler.target.size > 0 and
(not battler.target[0].hidden and
(battler.target[0].hp > 0 or battler.target[0].immortal)) and
battler.current_action.kind == 0 and battler.double_edge?
if battler.first_weapon
battler.first_weapon = false
battler.second_weapon = true
battler.wait = 0
battler.phase = 2
else battler.second_weapon
battler.second_weapon = false
end
elsif battler.is_a?(Game_Actor)
battler.first_weapon = false
battler.second_weapon = false
end
end
#--------------------------------------------------------------------------
# ● 开始行动
#--------------------------------------------------------------------------
def action_start(battler)
battler.phase = 1
battler.anime1 = 0
battler.anime2 = 0
battler.target = []
battler.event = 0
if battler.is_a?(Game_Actor) and battler.current_action.kind == 0
battler.first_weapon = true
battler.second_weapon = false
end
@action_battlers.unshift(battler)
end
end
#==============================================================================
# ■ Window_Status
#------------------------------------------------------------------------------
# 显示状态画面、完全规格的状态窗口。
#==============================================================================
class Window_Status <Window_Base
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
draw_actor_graphic(@actor, 44, 96)
draw_actor_battler(@actor, 426, 368)
draw_actor_name(@actor, 24, 0)
draw_actor_class(@actor, 24 + 144, 0)
draw_actor_level(@actor, 320, 16)
draw_actor_state(@actor, 320, 48)
draw_actor_hp(@actor, 68, 32, 172)
draw_actor_sp(@actor, 68, 64, 172)
draw_actor_parameter(@actor, 68, 112, 0)
draw_actor_parameter(@actor, 68, 144, 1)
draw_actor_parameter(@actor, 68, 176, 2)
draw_actor_parameter(@actor, 68, 224, 3)
draw_actor_parameter(@actor, 68, 256, 4)
draw_actor_parameter(@actor, 68, 288, 5)
draw_actor_parameter(@actor, 68, 320, 6)
self.contents.font.color = system_color
self.contents.draw_text(304, 96, 80, 32, "EXP")
self.contents.draw_text(304, 128, 80, 32, "NEXT")
self.contents.font.color = normal_color
self.contents.draw_text(304 + 80, 96, 84, 32, @actor.exp_s, 2)
self.contents.draw_text(304 + 80, 128, 84, 32, @actor.next_rest_exp_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(304, 176, 96, 32, "装备")
draw_item_name($data_weapons[@actor.weapon_id], 304 + 16, 208)
if @actor.double_edge
draw_item_name($data_weapons[@actor.weapon2_id], 304 + 16, 240)
else
draw_item_name($data_armors[@actor.armor1_id], 304 + 16, 240)
end
draw_item_name($data_armors[@actor.armor2_id], 304 + 16, 272)
draw_item_name($data_armors[@actor.armor3_id], 304 + 16, 304)
draw_item_name($data_armors[@actor.armor4_id], 304 + 16, 336)
end
end
#==============================================================================
# ■ Sprite_Battler
#------------------------------------------------------------------------------
# 战斗显示用活动块。Game_Battler 类的实例监视、
# 活动块的状态的监视。
#==============================================================================
class Sprite_Battler <RPG:: Sprite
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
super
# 战斗者为 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
self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
@width = bitmap.width
@height = bitmap.height
self.ox = @width / 2
self.oy = @height
if @battler.is_a?(Game_Enemy)
@battler.height = @height
end
# 如果是战斗不能或者是隐藏状态就把透明度设置成 0
if @battler.dead? or @battler.hidden
self.opacity = 0
end
end
# 动画 ID 与当前的情况有差异的情况下
if @battler.state_animation_id != @state_animation_id
@state_animation_id = @battler.state_animation_id
loop_animation($data_animations[@state_animation_id])
end
# 应该被显示的角色的情况下
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.size < 2 or @battler.damage_pop.size < 2)
appear
@battler_visible = true
end
end
# 伤害
for battler in @battler.damage_pop
if battler[0].class == Array
if battler[0][1] >= 0
$scene.skill_se
else
$scene.levelup_se
end
damage(@battler.damage[battler[0]], false, 2)
else
damage(@battler.damage[battler[0]], @battler.critical[battler[0]])
end
if @battler.damage_sp.include?(battler[0])
damage(@battler.damage_sp[battler[0]],
@battler.critical[battler[0]], 1)
@battler.damage_sp.delete(battler[0])
end
@battler.damage_pop.delete(battler[0])
@battler.damage.delete(battler[0])
@battler.critical.delete(battler[0])
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
# 动画
unless @battler.animation.empty?
for animation in @battler.animation.reverse
if animation[2]
animation($data_animations[animation[0]], animation[1], true)
else
animation($data_animations[animation[0]], animation[1])
end
@battler.animation.delete(animation)
end
end
# 死亡
if @battler.damage.empty? and @battler.dead?
if $scene.dead_ok?(@battler)
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
end
end
# 设置活动块的坐标
self.x = @battler.screen_x
self.y = @battler.screen_y
self.z = @battler.screen_z
if @battler.is_a?(Game_Enemy)
self.zoom_x = @battler.real_zoom * @battler.zoom
self.zoom_y = @battler.real_zoom * @battler.zoom
end
end
end
#==============================================================================
# ■ Sprite module
#------------------------------------------------------------------------------
# 管理动画的模块。
#==============================================================================
module RPG
class Sprite < ::Sprite
def animation(animation, hit, reverse = false)
return if animation == nil
num = @_animation.size
@_animation.push([animation, hit, animation.frame_max, [], reverse])
bitmap = RPG::Cache.animation(animation.animation_name,
animation.animation_hue)
if @@_reference_count.include?(bitmap)
@@_reference_count[bitmap] += 1
else
@@_reference_count[bitmap] = 1
end
if @_animation[num][0] != 3 or not @@_animations.include?(animation)
for i in 0..15
sprite = ::Sprite.new
sprite.bitmap = bitmap
sprite.visible = false
@_animation[num][3].push(sprite)
end
unless @@_animations.include?(animation)
@@_animations.push(animation)
end
end
update_animation(@_animation[num])
end
def update_animation(anime)
if anime[2] > 0
frame_index = anime[0].frame_max - anime[2]
cell_data = anime[0].frames[frame_index].cell_data
position = anime[0].position
animation_set_sprites(anime[3], cell_data, position, anime[4])
for timing in anime[0].timings
if timing.frame == frame_index
animation_process_timing(timing, anime[1])
end
end
else
@@_reference_count[anime[3][0].bitmap] -= 1
if @@_reference_count[anime[3][0].bitmap] == 0
anime[3][0].bitmap.dispose
end
for sprite in anime[3]
sprite.dispose
end
@_animation.delete(anime)
end
end
def animation_set_sprites(sprites, cell_data, position, reverse = false)
for i in 0..15
sprite = sprites[i]
pattern = cell_data[i, 0]
if sprite == nil or pattern == nil or pattern == -1
sprite.visible = false if sprite != nil
next
end
sprite.visible = true
sprite.src_rect.set(pattern % 5 * 192, pattern / 5 * 192, 192, 192)
if position == 3
if self.viewport != nil
sprite.x = self.viewport.rect.width / 2
if $game_temp.in_battle and self.battler.is_a?(Game_Enemy)
sprite.y = self.viewport.rect.height - 320
else
sprite.y = self.viewport.rect.height - 160
end
else
sprite.x = 320
sprite.y = 240
end
else
sprite.x = self.x + self.viewport.rect.x -
self.ox + self.src_rect.width / 2
if $game_temp.in_battle and self.battler.is_a?(Game_Enemy)
sprite.y = self.y - self.oy * self.zoom_y / 2 +
self.viewport.rect.y
if position == 0
sprite.y -= self.src_rect.height * self.zoom_y / 4
elsif position == 2
sprite.y += self.src_rect.height * self.zoom_y / 4
end
else
sprite.y = self.y + self.viewport.rect.y -
self.oy + self.src_rect.height / 2
sprite.y -= self.src_rect.height / 4 if position == 0
sprite.y += self.src_rect.height / 4 if position == 2
end
end
if reverse
sprite.x -= cell_data[i, 1]
else
sprite.x += cell_data[i, 1]
end
sprite.y += cell_data[i, 2]
sprite.z = 2000
sprite.ox = 96
sprite.oy = 96
sprite.zoom_x = cell_data[i, 3] / 100.0
sprite.zoom_y = cell_data[i, 3] / 100.0
if position != 3
sprite.zoom_x *= self.zoom_x
sprite.zoom_y *= self.zoom_y
end
sprite.angle = cell_data[i, 4]
if reverse
sprite.mirror = (cell_data[i, 5] == 0)
else
sprite.mirror = (cell_data[i, 5] == 1)
end
sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
sprite.blend_type = cell_data[i, 7]
end
end
end
end
#==============================================================================
# ■ Window_ShopStatus
#------------------------------------------------------------------------------
# 商店画面、显示物品所持数与角色装备的窗口。
#==============================================================================
class Window_ShopStatus < Window_Base
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
if @item == nil
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
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 200, 32, "所持数")
self.contents.font.color = normal_color
self.contents.draw_text(204, 0, 32, 32, number.to_s, 2)
if @item.is_a?(RPG::Item)
return
end
# 添加装备品信息
for i in 0...$game_party.actors.size
# 获取角色
actor = $game_party.actors[i]
# 可以装备为普通文字颜色、不能装备设置为无效文字颜色
if actor.equippable?(@item)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
# 描绘角色名字
self.contents.draw_text(4, 64 + 64 * i, 120, 32, actor.name)
# 获取当前的装备品
if @item.is_a?(RPG::Weapon)
weapon1 = $data_weapons[actor.weapon_id]
weapon2 = $data_weapons[actor.weapon2_id]
if actor.double_edge and (weapon1 != nil ? weapon1.atk : 0) >
(weapon2 != nil ? weapon2.atk : 0)
item1 = $data_weapons[actor.weapon2_id]
else
item1 = $data_weapons[actor.weapon_id]
end
elsif @item.kind == 0
item1 = $data_armors[actor.armor1_id]
elsif @item.kind == 1
item1 = $data_armors[actor.armor2_id]
elsif @item.kind == 2
item1 = $data_armors[actor.armor3_id]
else
item1 = $data_armors[actor.armor4_id]
end
# 可以装备的情况
if actor.equippable?(@item)
# 武器的情况
if @item.is_a?(RPG::Weapon)
atk1 = item1 != nil ? item1.atk : 0
atk2 = @item != nil ? @item.atk : 0
change = atk2 - atk1
end
# 防具的情况
if @item.is_a?(RPG::Armor)
pdef1 = item1 != nil ? item1.pdef : 0
mdef1 = item1 != nil ? item1.mdef : 0
pdef2 = @item != nil ? @item.pdef : 0
mdef2 = @item != nil ? @item.mdef : 0
change = pdef2 - pdef1 + mdef2 - mdef1
end
# 描绘能力值变化
self.contents.draw_text(124, 64 + 64 * i, 112, 32,
sprintf("%+d", change), 2)
end
# 描绘物品
if item1 != nil
x = 4
y = 64 + 64 * i + 32
bitmap = RPG::Cache.icon(item1.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, item1.name)
end
end
end
end
复制代码
作者:
水迭澜
时间:
2008-4-25 11:52
能不能顺便给一下原连接……
另,这个二刀流跟站上的有啥区别咩?(好吧我是不会用的人。弱弱地举手……)
作者:
yzlsym
时间:
2008-4-25 20:14
原来的只可以每把武器设置``而且不能双击
现在的只要职业设置好都可以装备了``RTAB的可以双击
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1