赞 | 0 |
VIP | 44 |
好人卡 | 0 |
积分 | 1 |
经验 | 200 |
最后登录 | 2014-1-18 |
在线时间 | 1 小时 |
Lv1.梦旅人 天壤
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 1 小时
- 注册时间
- 2008-7-18
- 帖子
- 1435
|
這是"防具加狀態"
下面那個是"狀態加技能"
要兩個連用
MS麻煩了點
#說明 + @s + 狀態ID1, 狀態ID2, 狀態ID3
#==============================================================================
# 附加多於一個自動狀態
# 禾西
#==============================================================================
module RPG
class Weapon
def auto_state_set
auto_state_set = []
return [] if @description.split(/@s/)[1].nil?
a = @description.split(/@s/)[1].split(/,/)
a.each {|i| auto_state_set.push(i.to_i)}
return auto_state_set.nil? ? [] : auto_state_set
end
def description
description = @description.split(/@s/)[0]
return description.nil? ? '' : description
end
end
class Armor
def auto_state_set
auto_state_set = []
return [] if @description.split(/@s/)[1].nil?
a = @description.split(/@s/)[1].split(/,/)
a.each {|i| auto_state_set.push(i.to_i)}
return auto_state_set.nil? ? [] : auto_state_set
end
def description
description = @description.split(/@s/)[0]
return description.nil? ? '' : description
end
end
end
#==============================================================================
# ■ Game_Actor
#------------------------------------------------------------------------------
# 处理角色的类。本类在 Game_Actors 类 ($game_actors)
# 的内部使用、Game_Party 类请参考 ($game_party) 。
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------#
# ● 更新自动状态組(新方法) #
# old_armor : 卸下防具 #
# new_armor : 装备防具 #
#--------------------------------------------------------------------------#
def update_auto_state_set(old_armor, new_armor)
# 强制解除卸下防具的自动状态
if old_armor != nil and old_armor.auto_state_set.empty? != true
for i in 0...old_armor.auto_state_set.size
if @states.include? old_armor.auto_state_set
remove_state(old_armor.auto_state_set, true)
end
end
end
# 强制附加装备防具的自动状态
if new_armor != nil and new_armor.auto_state_set.empty? != true
for i in 0...new_armor.auto_state_set.size
add_state(new_armor.auto_state_set, true)
end
end
end
#----------------------------------------------------------------------------
# ● 召喚舊方法
#----------------------------------------------------------------------------
#--------------------------------------------------------------------------
# ● 设置
# actor_id : 角色 ID
#--------------------------------------------------------------------------
alias sidaf_setup setup
def setup(actor_id)
sidaf_setup(actor_id)
#---------------------刷新自动状态組---------------------#
update_auto_state_set(nil, $data_weapons[@weapon_id])
update_auto_state_set(nil, $data_armors[@armor1_id])
update_auto_state_set(nil, $data_armors[@armor2_id])
update_auto_state_set(nil, $data_armors[@armor3_id])
update_auto_state_set(nil, $data_armors[@armor4_id])
#--------------------------------------------------------#
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
# 刷新自動狀態組---------------------------------------------------------
update_auto_state_set($data_weapons[@weapon_id], $data_weapons[id])
# 完了-------------------------------------------------------------------------
$game_party.gain_weapon(@weapon_id, 1)
@weapon_id = id
$game_party.lose_weapon(id, 1)
end
when 1 # 盾
if id == 0 or $game_party.armor_number(id) > 0
# 刷新自動狀態組---------------------------------------------------------
update_auto_state_set($data_armors[@armor1_id], $data_armors[id])
# 完了-------------------------------------------------------------------------
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
when 2 # 头
if id == 0 or $game_party.armor_number(id) > 0
# 刷新自動狀態組---------------------------------------------------------
update_auto_state_set($data_armors[@armor2_id], $data_armors[id])
# 完了-------------------------------------------------------------------------
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_set($data_armors[@armor3_id], $data_armors[id])
# 完了-------------------------------------------------------------------------
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_set($data_armors[@armor4_id], $data_armors[id])
# 完了-------------------------------------------------------------------------
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
end
end
end
{/dy}
module State_Skill
#--------------------------------------------------------------------------
# ● 參考數組取得
#--------------------------------------------------------------------------
STATE_SKILL = []
$data_skills = load_data("Data/Skills.rxdata") if $data_skills == nil
$data_states = load_data("Data/States.rxdata") if $data_states == nil
# @state_skill.push [狀態ID,技能ID]
# 查找「基本同名」的「狀態」與「技能」
for i in 1...$data_states.size
for i2 in 1...$data_skills.size
if ("skill" + $data_skills[i2].name) == $data_states.name
STATE_SKILL.push [i,i2]
end
end
end
end
#----------------------------------------------------------------------------
# ● 召喚原方法
#----------------------------------------------------------------------------
class Game_Battler
include State_Skill
alias oxox_add_state add_state
alias oxox_remove_state remove_state
#--------------------------------------------------------------------------
# ● 附加状态
# state_id : 状态 ID
# force : 强制附加标志 (处理自动状态时使用)
#--------------------------------------------------------------------------
def add_state(state_id, force = false)
oxox_add_state(state_id, force)
STATE_SKILL.each{|i|
if i[0] == state_id
if i[1] != 0
learn_skill(i[1])
@states.delete(state_id) unless force
end
end}
end
#--------------------------------------------------------------------------
# ● ステートの解除
# state_id : ステート ID
# force : 強制解除フラグ (オートステートの処理で使用)
#--------------------------------------------------------------------------
def remove_state(state_id, force = false)
oxox_remove_state(state_id, force)
STATE_SKILL.each{|i|
if i[0] == state_id
if i[1] != 0
forget_skill(i[1])
end
end}
end
end 版主对此帖的认可:『正确回答,补上积分。谢谢你的热心解答……』,积分『+100』。 |
|