Project1
标题:
用图标表示某种状态
[打印本页]
作者:
ddboybb
时间:
2006-6-30 22:09
标题:
用图标表示某种状态
各种各样扩充状态的表示方法。
比方说能够这样的事。
图标表示状态。
状态卡通片的替换顺序。
巴特勒下面表示状态。
旋转状态的表示
供角色使用的的设定
ACTOR_STATE = true 或 MENU_ST_ICON = true 需要我们设定
↓用图标在战斗表示状态。
分别插入2个……:
#==============================================================================
# 仭 僗僥乕僩昞帵奼挘 Ver.1.0.1 by Claimh
#------------------------------------------------------------------------------
# 丒僗僥乕僩偺傾僯儊乕僔儑儞昞帵傪懡廳壔偟傑偡丅乮弴乆偵愗傝懼偊乯
# 丒僶僩儔乕壓偵僗僥乕僩傪昞帵偝偣傑偡丅
#-< 嵞掕媊売強 >---------------------------------------------------------------
# Sprite_Battler僋儔僗偺慡儊僜僢僪(initialize, dispose, update)
#==============================================================================
module State_Extension
#==============================================================================
# 僇僗僞儅僀僘START
#==============================================================================
#--------------------------------------------------------------------------
# 仧 僗僥乕僩傾僯儊乕僔儑儞愝掕
#--------------------------------------------------------------------------
# 傾僯儊乕僔儑儞昞帵偺儘乕僥乕僔儑儞婡擻傪桳岠偵偡傞丠
# 僗僥乕僩傾僯儊乕僔儑儞傪弴孞傝偵曄偊傑偡丅
# 乮椺乯僗僥乕僩A 佀 僗僥乕僩B 佀 僗僥乕僩C 佀 僗僥乕僩A 丒丒丒
STATE_ANIME = true # true丗桳岠丂false丗柍岠
# 傾僯儊乕僔儑儞儖乕僾夞悢
LOOP_COUNT = 4
#--------------------------------------------------------------------------
# 仧 僗僥乕僩昞帵愝掕
#--------------------------------------------------------------------------
# 傾僋僞乕壓偵僗僥乕僩昞帵傪偡傞丠
# true丗昞帵丂false丗旕昞帵
ACTOR_STATE = true
# 僄僱儈乕壓偵僗僥乕僩昞帵傪偡傞丠
# true丗昞帵丂false丗旕昞帵
ENEMY_STATE = true
# 僗僥乕僩偺昞帵曽朄僷僞乕儞
# 0丗捠忢昞帵乮昞帵偑偱偒傞僗僥乕僩悢偵尷傝偑偱偒傑偡乯
# 1丗儘乕僥乕僔儑儞昞帵乮偄偔偮偐偺僗僥乕僩傪弴孞傝偵昞帵乯
# 2丗僗僥乕僩傾僯儊乕僔儑儞偲摨婜乮昞帵拞偺傾僯儊偲摨偠僗僥乕僩傪昞帵乯
# 仸傾僯儊乕僔儑儞偺側偄僗僥乕僩偼昞帵偝傟傑偣傫丅
STATE_PATTERN = 1
# 昞帵埵抲曗惓乮y幉曽岦乯
STATE_Y = 4
#--------------------------------------------------------------------------
# 仧 儘乕僥乕僔儑儞愝掕 丗STATE_PATTARN = 1 偺偲偒偺傒桳岠
#--------------------------------------------------------------------------
# 儘乕僥乕僔儑儞偺峏怴傪偡傞僼儗乕儉悢
ROT_COUNT = 40
#--------------------------------------------------------------------------
# 仧 僗僥乕僩偺傾僀僐儞昞帵愝掕
#--------------------------------------------------------------------------
# 愴摤拞偺僗僥乕僩傪傾僀僐儞昞帵偵偡傞丠
# true丗傾僀僐儞昞帵丂false丗僥僉僗僩昞帵(張棟廳偄)
STATE_ICON = true
# 儊僯儏乕偺僗僥乕僩傪傾僀僐儞昞帵偡傞丠
MENU_ST_ICON = true
# 奺僗僥乕僩偺傾僀僐儞巜掕
# 仸 傾僀僐儞巜掕偺側偄僗僥乕僩偼昞帵偝傟側偔側傝傑偡
STATE_ICON_FILE = {
# 僗僥乕僩ID => "傾僀僐儞僼傽僀儖柤"
3 => "045-Skill02",
4 => "046-Skill03",
5 => "046-Skill03",
6 => "049-Skill06",
7 => "050-Skill07",
8 => "050-Skill07"
}
# 傾僀僐儞偺昞帵娫妘
ICON_INTERVAL = 5
#==============================================================================
# 僇僗僞儅僀僘END
#==============================================================================
module_function
#--------------------------------------------------------------------------
# 仠 僗僥乕僩偺傾僯儊乕僔儑儞 ID 庢摼
#--------------------------------------------------------------------------
def state_animations(states)
# 僗僥乕僩偑傂偲偮傕晅壛偝傟偰偄側偄応崌
if states.size == 0
return []
end
animations = []
for i in 0...states.size
animations.push($data_states[states[i]].animation_id)
end
# 傾僯儊乕僔儑儞ID = 0傪嶍彍
animations.delete(0)
# 慡偰偺傾僯儊乕僔儑儞ID傪曉偡
return animations
end
#--------------------------------------------------------------------------
# 仠 昤夋梡偺僗僥乕僩暥帤楍嶌惉
# state : 僗僥乕僩ID孮
# width : 昤夋愭偺暆
#--------------------------------------------------------------------------
def make_state_text(bitmap, state, width)
# 妵屖偺暆傪庢摼
brackets_width = bitmap.text_size("[]").width
# 僗僥乕僩柤偺暥帤楍傪嶌惉
text = ""
for i in state
if $data_states[i].rating >= 1
if text == ""
text = $data_states[i].name
else
new_text = text + "/" + $data_states[i].name
text_width = bitmap.text_size(new_text).width
if text_width > width - brackets_width
break
end
text = new_text
end
end
end
# 僗僥乕僩柤偺暥帤楍偑嬻丠
if text != ""
# 妵屖傪偮偗傞
text = "[" + text + "]"
end
# 姰惉偟偨暥帤楍傪曉偡
return text
end
#--------------------------------------------------------------------------
# 仠 昤夋梡偺僗僥乕僩傾僀僐儞孮嶌惉
# state : 僗僥乕僩ID孮
# width : 昤夋愭偺暆
#--------------------------------------------------------------------------
def make_state_icon(state, width)
icon_width = 0
icon_states = []
for i in 0...state.size
unless STATE_ICON_FILE[state[i]].nil?
# 傾僀僐儞僼傽僀儖偺價僢僩儅僢僾撉傒崬傒
bitmap = RPG::Cache.icon(STATE_ICON_FILE[state[i]])
next_width = icon_width + bitmap.width + ICON_INTERVAL
# 昞帵斖埻傪僆乕僶乕偟偰偄側偄偐丠
if width > next_width
# 昞帵傾僀僐儞偵捛壛
icon_states.push(STATE_ICON_FILE[state[i]])
# 暆峏怴
icon_width += bitmap.width + ICON_INTERVAL
else
break
end
end
end
return icon_states
end
#--------------------------------------------------------------------------
# 仠 儘乕僥乕僔儑儞偝偣傞偐偺敾掕
# state : 僗僥乕僩ID孮
# width : 昤夋愭偺暆
#--------------------------------------------------------------------------
def do_rotation?(bitmap, state, width)
case STATE_ICON
when true # 傾僀僐儞
icon_width = 0
for i in 0...state.size
unless STATE_ICON_FILE[state[i]].nil?
# 傾僀僐儞僼傽僀儖偺價僢僩儅僢僾撉傒崬傒
bitmap = RPG::Cache.icon(STATE_ICON_FILE[state[i]])
next_width = icon_width + bitmap.width + ICON_INTERVAL
# 昞帵斖埻傪僆乕僶乕偟偰偄側偄偐丠
if width > next_width
# 暆峏怴
icon_width += bitmap.width + ICON_INTERVAL
else
# 儘乕僥乕僔儑儞偑昁梫
return true
end
end
end
when false # 僥僉僗僩
# 妵屖偺暆傪庢摼
brackets_width = bitmap.text_size("[]").width
# 僗僥乕僩柤偺暥帤楍傪嶌惉
text = ""
for i in state
if $data_states[i].rating >= 1
if text == ""
text = $data_states[i].name
else
new_text = text + "/" + $data_states[i].name
text_width = bitmap.text_size(new_text).width
if text_width > width - brackets_width
# 儘乕僥乕僔儑儞偑昁梫
return true
end
text = new_text
end
end
end
else
p "Err:STATE_ICON"
exit
end
# 儘乕僥乕僔儑儞偼晄梫
return false
end
#--------------------------------------------------------------------------
# 仠 僗僥乕僩偺儘乕僥乕僔儑儞
# state : 僗僥乕僩ID孮
# index : 儘乕僥乕僔儑儞奐巒Index
#--------------------------------------------------------------------------
def rotation_state(state, index)
rot_state = []
for i in index...state.size
rot_state.push(state[i])
end
for i in 0...index
rot_state.push(state[i])
end
return rot_state
end
#--------------------------------------------------------------------------
# 仠 僗僥乕僩梡傾僀僐儞偺昤夋奐巒埵抲偺寁嶼
# state : 僗僥乕僩ID孮
# width : 昤夋愭偺暆
#--------------------------------------------------------------------------
def make_icon_pos_x(state, width)
icon_width = 0
for i in 0...state.size
bitmap = RPG::Cache.icon(state[i])
# 暆峏怴
icon_width += bitmap.width + ICON_INTERVAL
end
# 昤夋奐巒埵抲偺寁嶼
pos_x = (width - icon_width) / 2
return pos_x
end
end
#==============================================================================
# 仭 Sprite_Battler
#==============================================================================
class Sprite_Battler < RPG::Sprite
# 僗僥乕僩昞帵椞堟偺暆丄崅偝傪掕媊
BITMAP_WIDTH = 120
BITMAP_HEIGHT = 32
#--------------------------------------------------------------------------
# 仠 僆僽僕僃僋僩弶婜壔 [嵞掕媊]
# viewport : 價儏乕億乕僩
# battler : 僶僩儔乕 (Game_Battler)
#--------------------------------------------------------------------------
def initialize(viewport, battler = nil)
super(viewport)
@battler = battler
@battler_visible = false
#-[僗僥乕僩昞帵奼挘]------
@rotation_count = 0 # 儘乕僥乕僔儑儞梡偺僇僂儞僩
@rotation_index = 0 # 儘乕僥乕僔儑儞Index
@loop_state_animation_count = 0 # 儖乕僾僇僂儞僩
@battler_state = [] # 撪晹曐帩梡僗僥乕僩
@state_update_flag = false # 僗僥乕僩峏怴僼儔僌
@sync_update_flag = false # 傾僯儊乕僔儑儞摨婜梡僼儔僌
# 僗僥乕僩昞帵梡僗僾儔僀僩傪梡堄
@state_sprite = Sprite.new(viewport)
@state_sprite.bitmap = Bitmap.new(BITMAP_WIDTH, BITMAP_HEIGHT)
#-------------------------
end
#--------------------------------------------------------------------------
# 仠 夝曻 [嵞掕媊]
#--------------------------------------------------------------------------
def dispose
#-[僗僥乕僩昞帵奼挘]------
@state_sprite.dispose
#-------------------------
if self.bitmap != nil
self.bitmap.dispose
end
super
end
#--------------------------------------------------------------------------
# 仠 僼儗乕儉峏怴 [嵞掕媊]
#--------------------------------------------------------------------------
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
# 愴摤晄擻傑偨偼塀傟忬懺側傜晄摟柧搙傪 0 偵偡傞
if @battler.dead? or @battler.hidden
self.opacity = 0
end
end
#-[僗僥乕僩昞帵奼挘]------
=begin
伀尨宆伀
# 傾僯儊乕僔儑儞 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
仾尨宆仾
=end
# 僗僥乕僩奼挘昞帵
update_state_extension
#-------------------------
# 昞帵偝傟傞傋偒傾僋僞乕偺応崌
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
# 僐儔僾僗
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
end
# 僗僾儔僀僩偺嵗昗傪愝掕
self.x = @battler.screen_x
self.y = @battler.screen_y
self.z = @battler.screen_z
end
#==============================================================================
# 仭 奼挘儊僜僢僪
#==============================================================================
#--------------------------------------------------------------------------
# 仠 僗僥乕僩奼挘昞帵偺峏怴
#--------------------------------------------------------------------------
def update_state_extension
# 晄壜帇偺応崌
unless @battler_visible
@state_sprite.bitmap.clear
return
end
# 僗僥乕僩偑峏怴偝傟偨丠
if @battler.damage == nil
if @battler_state != @battler.states
@battler_state = @battler.states.dup # 僗僥乕僩偺峏怴
@state_update_flag = true # 峏怴僼儔僌ON
end
end
# 僗僥乕僩傾僯儊乕僔儑儞偺峏怴
update_state_animation
# 僗僥乕僩昞帵偺峏怴
update_state
# 峏怴偺廔椆
@state_update_flag = false # 僗僥乕僩峏怴僼儔僌OFF
@sync_update_flag = false # 僗僥乕僩傾僯儊乕僔儑儞偺峏怴僼儔僌OFF
end
#--------------------------------------------------------------------------
# 仠 僗僥乕僩傾僯儊乕僔儑儞峏怴
#--------------------------------------------------------------------------
def update_state_animation
# 僗僥乕僩傾僯儊乕僔儑儞
if State_Extension::STATE_ANIME
# 懡廳僗僥乕僩傾僯儊乕僔儑儞傪昞帵偡傞
multiple_state_animation
else
# 捠忢偺昞帵曽朄傪慖戰
# 傾僯儊乕僔儑儞 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
end
end
#--------------------------------------------------------------------------
# 仠 懡廳僗僥乕僩傾僯儊乕僔儑儞
#--------------------------------------------------------------------------
def multiple_state_animation
# 傾僯儊乕僔儑儞偺偁傞僗僥乕僩傪撉傒崬傒
anime_states = State_Extension.state_animations(@battler_state)
# 傾僯儊乕僔儑儞偺偁傞僗僥乕僩偑晅梌偝傟偰偄傞
unless anime_states.empty?
# 僗僥乕僩偺峏怴偑側偝傟偨応崌
if @state_update_flag
# 僗僥乕僩Index傪弶婜壔
@loop_state_index = 0
# 儖乕僾傾僯儊乕僔儑儞偺愝掕
set_loop_animation(anime_states)
end
@loop_state_animation_count -= 1
# 儖乕僾僇僂儞僩偑0偵側偭偨
if @loop_state_animation_count == 0
# 僗僥乕僩Index偺峏怴
@loop_state_index += 1
if @loop_state_index == anime_states.size
@loop_state_index = 0
end
# 儖乕僾傾僯儊乕僔儑儞偺愝掕
set_loop_animation(anime_states)
end
else
# 慡僗僥乕僩夝彍帪偵儖乕僾傾僯儊乕僔儑儞傪徚偡
if @state_update_flag
# 傾僯儊乕僔儑儞偺峏怴傪専抦
@sync_update_flag = true
@loop_state_animation_count = 0
@loop_state_index = 0
loop_animation(nil)
end
end
end
#--------------------------------------------------------------------------
# 仠 儖乕僾傾僯儊乕僔儑儞愝掕
#--------------------------------------------------------------------------
def set_loop_animation(anime_states)
# 傾僯儊乕僔儑儞偺峏怴傪専抦
@sync_update_flag = true
# 昞帵偝偣傞僗僥乕僩傾僯儊乕僔儑儞ID傪撉傒崬傒
animation_id = anime_states[@loop_state_index]
# 傾僯儊乕僔儑儞撉傒崬傒
anime_data = $data_animations[animation_id]
# 僼儗乕儉悢傪愝掕
@loop_state_animation_count = anime_data.frames.size * State_Extension::LOOP_COUNT
# 儖乕僾傾僯儊乕僔儑儞傪愝掕
loop_animation(anime_data)
end
#--------------------------------------------------------------------------
# 仠 僗僥乕僩昞帵峏怴
#--------------------------------------------------------------------------
def update_state
# 昞帵桳岠敾掕
case @battler
when Game_Actor
# 傾僋僞乕桳岠丠
unless State_Extension::ACTOR_STATE
# 柍懯側偺偱僨僼僅儖僩柍岠偵丅
return
end
when Game_Enemy
# 僄僱儈乕桳岠丠
unless State_Extension::ENEMY_STATE
return
end
else
p "Err: 'Sprite_Battler' can use actor or enemy only"
exit
end
# 僗僥乕僩昞帵偺嵞僙僢僩傾僢僾
case State_Extension::STATE_PATTERN
when 0 # 捠忢昞帵
make_normal_state
when 1 # 儘乕僥乕僔儑儞
make_rotation_state
when 2 # 僗僥乕僩傾僯儊乕僔儑儞偲摨婜
make_synchronous_state
else
p "Err:STATE_PATTERN"
exit
end
# 昞帵埵抲偺峏怴丅
@state_sprite.x = @battler.screen_x - BITMAP_WIDTH / 2
@state_sprite.y = @battler.screen_y - BITMAP_HEIGHT + State_Extension::STATE_Y
@state_sprite.z = @battler.screen_z
end
#--------------------------------------------------------------------------
# 仠 捠忢偺僗僥乕僩昞帵
#--------------------------------------------------------------------------
def make_normal_state
# 僗僥乕僩偺峏怴偁傝丠
if @state_update_flag
draw_state(@battler_state)
end
end
#--------------------------------------------------------------------------
# 仠 儘乕僥乕僔儑儞偟偨僗僥乕僩昞帵
#--------------------------------------------------------------------------
def make_rotation_state
# 僗僥乕僩偑晅梌偝傟偰偄傞丠
unless @battler_state.empty?
# 儘乕僥乕僔儑儞偝偣傞傋偒偐丠
if State_Extension.do_rotation?(@state_sprite.bitmap, @battler_state, BITMAP_WIDTH)
# 儘乕僥乕僔儑儞僇僂儞僩+1
@rotation_count += 1
end
# 僗僥乕僩偺峏怴偁傝丠
if @state_update_flag
@rotation_count = State_Extension::ROT_COUNT
@rotation_index = 0
end
# 儘乕僥乕僔儑儞偺峏怴偁傝丠
if @rotation_count == State_Extension::ROT_COUNT
@rotation_count = 0
# 儘乕僥乕僔儑儞Index抣偺峏怴
@rotation_index += 1
if @rotation_index >= @battler_state.size
@rotation_index = 0
end
# 儘乕僥乕僔儑儞偟偨僗僥乕僩孮偺庢摼
state = State_Extension.rotation_state(@battler_state, @rotation_index)
draw_state(state)
end
else
# 僗僥乕僩偺峏怴偁傝丠
if @state_update_flag
# 昞帵傪僋儕傾
@state_sprite.bitmap.clear
@rotation_count = 0
@rotation_index = 0
end
end
end
#--------------------------------------------------------------------------
# 仠 傾僯儊乕僔儑儞偲摨婜偟偨僗僥乕僩昞帵偺峏怴
#--------------------------------------------------------------------------
def make_synchronous_state
# 僗僥乕僩傾僯儊乕僔儑儞偺峏怴偁傝丠
if @sync_update_flag
# 昞帵拞偺傾僯儊乕僔儑儞偵墳偠偨僗僥乕僩ID傪庢摼
state = [@battler_state[@loop_state_index]]
draw_state(state)
end
end
#--------------------------------------------------------------------------
# 仠 僗僥乕僩昞帵乮傾僀僐儞乛僥僉僗僩乯
# state : 僗僥乕僩梡傾僀僐儞僼傽僀儖孮
#--------------------------------------------------------------------------
def draw_state(state)
# 昞帵傪僋儕傾
@state_sprite.bitmap.clear
# 僗僥乕僩昞帵
case State_Extension::STATE_ICON
when false # 僥僉僗僩昞帵
text = State_Extension.make_state_text(@state_sprite.bitmap, state, BITMAP_WIDTH)
# 僗僥乕僩昤幨(捠忢)
@state_sprite.bitmap.draw_text(0, 0, BITMAP_WIDTH, BITMAP_HEIGHT, text, 1)
# 僗僥乕僩昤幨(墢暥帤)
#@state_sprite.bitmap.draw_edging_text(0, 0, BITMAP_WIDTH, BITMAP_HEIGHT, text, 1)
when true # 傾僀僐儞昞帵
# 僗僥乕僩梡傾僀僐儞偺僼傽僀儖柤傪庢摼
icon_state = State_Extension.make_state_icon(state, BITMAP_WIDTH)
# 僗僥乕僩偺傾僀僐儞昤幨
draw_state_icon(icon_state)
else
p "Err:STATE_ICON"
end
end
#--------------------------------------------------------------------------
# 仠 僗僥乕僩梡傾僀僐儞昞帵
# state : 僗僥乕僩梡傾僀僐儞僼傽僀儖孮
#--------------------------------------------------------------------------
def draw_state_icon(state)
# 昤夋奐巒埵抲偺寛掕
x = State_Extension.make_icon_pos_x(state, BITMAP_WIDTH)
for i in 0...state.size
bitmap = RPG::Cache.icon(state[i])
cw = bitmap.width
ch = bitmap.height
src_rect = Rect.new(0, 0, cw, ch)
@state_sprite.bitmap.blt(x, 0, bitmap, src_rect)
# 昤夋埵抲傪恑傔傞
x += cw + State_Extension::ICON_INTERVAL
end
end
end
复制代码
#==============================================================================
# 仭 僗僥乕僩昞帵奼挘[傾僋僞乕梡] by Claimh
#------------------------------------------------------------------------------
# 丒傾僋僞乕梡偺僗僥乕僩昞帵奼挘傪偝偣傞偨傔偺捛壛張棟丅
# 丒ACTOR_STATE = true 偺偲偒 MENU_ST_ICON = true 偺偲偒偼昁恵偱偡丅
#==============================================================================
#==============================================================================
# 仭 Window_Base
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# 仠 僗僥乕僩偺昤夋
# actor : 傾僋僞乕
# x : 昤夋愭 X 嵗昗
# y : 昤夋愭 Y 嵗昗
# width : 昤夋愭偺暆
#--------------------------------------------------------------------------
alias draw_state_normal draw_actor_state
def draw_actor_state(actor, x, y, width = 120)
# 愴摤拞丠
if $scene.is_a?(Scene_Battle)
if State_Extension::ACTOR_STATE
# 僗僥乕僩桳傝丠
unless actor.states.empty?
# 昞帵偟側偄
return
end
end
else
if State_Extension::MENU_ST_ICON
# 僗僥乕僩桳傝丠
unless actor.states.empty?
# 僗僥乕僩傪傾僀僐儞昞帵
draw_state_icon(actor, x, y, width)
return
end
end
end
# 捠忢昞帵
draw_state_normal(actor, x, y, width)
end
#--------------------------------------------------------------------------
# 仠 僗僥乕僩梡傾僀僐儞昞帵
# state : 僗僥乕僩梡傾僀僐儞僼傽僀儖孮
#--------------------------------------------------------------------------
def draw_state_icon(actor, x, y, width = 120)
# 傾僀僐儞僼傽僀儖孮傪庢摼
icon_state = State_Extension.make_state_icon(actor.states, width)
# 昤夋奐巒埵抲偺寛掕
x = 0
for i in 0...icon_state.size
bitmap = RPG::Cache.icon(icon_state[i])
cw = bitmap.width
ch = bitmap.height
src_rect = Rect.new(0, 0, cw, ch)
self.bitmap.blt(x, ch/2, bitmap, src_rect)
# 昤夋埵抲傪恑傔傞
x += cw + State_Extension::ICON_INTERVAL
end
end
end
#==============================================================================
# 仭 Window_BattleStatus
#==============================================================================
class Window_BattleStatus < Window_Base
#--------------------------------------------------------------------------
# 仠 儗儀儖傾僢僾僼儔僌偺愝掕
# actor_index : 傾僋僞乕僀儞僨僢僋僗
#--------------------------------------------------------------------------
def level_up?(actor_index)
return @level_up_flags[actor_index]
end
end
#==============================================================================
# 仭 Scene_Battle
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# 仠 傾僼僞乕僶僩儖僼僃乕僘奐巒
#--------------------------------------------------------------------------
alias start_phase5_state_ex start_phase5
def start_phase5
start_phase5_state_ex
# 儗儀儖傾僢僾昞帵帪偵僗僥乕僩傪徚偡
for i in 0...$game_party.actors.size
if @status_window.level_up?(i)
@spriteset.delete_state(i)
end
end
end
end
#==============================================================================
# 仭 Spriteset_Battle
#==============================================================================
class Spriteset_Battle
#--------------------------------------------------------------------------
# 仠 僗僥乕僩僗僾儔僀僩傪徚偡
#--------------------------------------------------------------------------
def delete_state(index)
@actor_sprites[index].del_state
end
end
#==============================================================================
# 仭 Sprite_Battler
#==============================================================================
class Sprite_Battler < RPG::Sprite
#--------------------------------------------------------------------------
# 仠 僗僥乕僩僗僾儔僀僩傪徚偡
#--------------------------------------------------------------------------
def del_state
@state_sprite.visible = false
end
end
复制代码
作者:
ddboybb
时间:
2006-6-30 22:09
标题:
用图标表示某种状态
各种各样扩充状态的表示方法。
比方说能够这样的事。
图标表示状态。
状态卡通片的替换顺序。
巴特勒下面表示状态。
旋转状态的表示
供角色使用的的设定
ACTOR_STATE = true 或 MENU_ST_ICON = true 需要我们设定
↓用图标在战斗表示状态。
分别插入2个……:
#==============================================================================
# 仭 僗僥乕僩昞帵奼挘 Ver.1.0.1 by Claimh
#------------------------------------------------------------------------------
# 丒僗僥乕僩偺傾僯儊乕僔儑儞昞帵傪懡廳壔偟傑偡丅乮弴乆偵愗傝懼偊乯
# 丒僶僩儔乕壓偵僗僥乕僩傪昞帵偝偣傑偡丅
#-< 嵞掕媊売強 >---------------------------------------------------------------
# Sprite_Battler僋儔僗偺慡儊僜僢僪(initialize, dispose, update)
#==============================================================================
module State_Extension
#==============================================================================
# 僇僗僞儅僀僘START
#==============================================================================
#--------------------------------------------------------------------------
# 仧 僗僥乕僩傾僯儊乕僔儑儞愝掕
#--------------------------------------------------------------------------
# 傾僯儊乕僔儑儞昞帵偺儘乕僥乕僔儑儞婡擻傪桳岠偵偡傞丠
# 僗僥乕僩傾僯儊乕僔儑儞傪弴孞傝偵曄偊傑偡丅
# 乮椺乯僗僥乕僩A 佀 僗僥乕僩B 佀 僗僥乕僩C 佀 僗僥乕僩A 丒丒丒
STATE_ANIME = true # true丗桳岠丂false丗柍岠
# 傾僯儊乕僔儑儞儖乕僾夞悢
LOOP_COUNT = 4
#--------------------------------------------------------------------------
# 仧 僗僥乕僩昞帵愝掕
#--------------------------------------------------------------------------
# 傾僋僞乕壓偵僗僥乕僩昞帵傪偡傞丠
# true丗昞帵丂false丗旕昞帵
ACTOR_STATE = true
# 僄僱儈乕壓偵僗僥乕僩昞帵傪偡傞丠
# true丗昞帵丂false丗旕昞帵
ENEMY_STATE = true
# 僗僥乕僩偺昞帵曽朄僷僞乕儞
# 0丗捠忢昞帵乮昞帵偑偱偒傞僗僥乕僩悢偵尷傝偑偱偒傑偡乯
# 1丗儘乕僥乕僔儑儞昞帵乮偄偔偮偐偺僗僥乕僩傪弴孞傝偵昞帵乯
# 2丗僗僥乕僩傾僯儊乕僔儑儞偲摨婜乮昞帵拞偺傾僯儊偲摨偠僗僥乕僩傪昞帵乯
# 仸傾僯儊乕僔儑儞偺側偄僗僥乕僩偼昞帵偝傟傑偣傫丅
STATE_PATTERN = 1
# 昞帵埵抲曗惓乮y幉曽岦乯
STATE_Y = 4
#--------------------------------------------------------------------------
# 仧 儘乕僥乕僔儑儞愝掕 丗STATE_PATTARN = 1 偺偲偒偺傒桳岠
#--------------------------------------------------------------------------
# 儘乕僥乕僔儑儞偺峏怴傪偡傞僼儗乕儉悢
ROT_COUNT = 40
#--------------------------------------------------------------------------
# 仧 僗僥乕僩偺傾僀僐儞昞帵愝掕
#--------------------------------------------------------------------------
# 愴摤拞偺僗僥乕僩傪傾僀僐儞昞帵偵偡傞丠
# true丗傾僀僐儞昞帵丂false丗僥僉僗僩昞帵(張棟廳偄)
STATE_ICON = true
# 儊僯儏乕偺僗僥乕僩傪傾僀僐儞昞帵偡傞丠
MENU_ST_ICON = true
# 奺僗僥乕僩偺傾僀僐儞巜掕
# 仸 傾僀僐儞巜掕偺側偄僗僥乕僩偼昞帵偝傟側偔側傝傑偡
STATE_ICON_FILE = {
# 僗僥乕僩ID => "傾僀僐儞僼傽僀儖柤"
3 => "045-Skill02",
4 => "046-Skill03",
5 => "046-Skill03",
6 => "049-Skill06",
7 => "050-Skill07",
8 => "050-Skill07"
}
# 傾僀僐儞偺昞帵娫妘
ICON_INTERVAL = 5
#==============================================================================
# 僇僗僞儅僀僘END
#==============================================================================
module_function
#--------------------------------------------------------------------------
# 仠 僗僥乕僩偺傾僯儊乕僔儑儞 ID 庢摼
#--------------------------------------------------------------------------
def state_animations(states)
# 僗僥乕僩偑傂偲偮傕晅壛偝傟偰偄側偄応崌
if states.size == 0
return []
end
animations = []
for i in 0...states.size
animations.push($data_states[states[i]].animation_id)
end
# 傾僯儊乕僔儑儞ID = 0傪嶍彍
animations.delete(0)
# 慡偰偺傾僯儊乕僔儑儞ID傪曉偡
return animations
end
#--------------------------------------------------------------------------
# 仠 昤夋梡偺僗僥乕僩暥帤楍嶌惉
# state : 僗僥乕僩ID孮
# width : 昤夋愭偺暆
#--------------------------------------------------------------------------
def make_state_text(bitmap, state, width)
# 妵屖偺暆傪庢摼
brackets_width = bitmap.text_size("[]").width
# 僗僥乕僩柤偺暥帤楍傪嶌惉
text = ""
for i in state
if $data_states[i].rating >= 1
if text == ""
text = $data_states[i].name
else
new_text = text + "/" + $data_states[i].name
text_width = bitmap.text_size(new_text).width
if text_width > width - brackets_width
break
end
text = new_text
end
end
end
# 僗僥乕僩柤偺暥帤楍偑嬻丠
if text != ""
# 妵屖傪偮偗傞
text = "[" + text + "]"
end
# 姰惉偟偨暥帤楍傪曉偡
return text
end
#--------------------------------------------------------------------------
# 仠 昤夋梡偺僗僥乕僩傾僀僐儞孮嶌惉
# state : 僗僥乕僩ID孮
# width : 昤夋愭偺暆
#--------------------------------------------------------------------------
def make_state_icon(state, width)
icon_width = 0
icon_states = []
for i in 0...state.size
unless STATE_ICON_FILE[state[i]].nil?
# 傾僀僐儞僼傽僀儖偺價僢僩儅僢僾撉傒崬傒
bitmap = RPG::Cache.icon(STATE_ICON_FILE[state[i]])
next_width = icon_width + bitmap.width + ICON_INTERVAL
# 昞帵斖埻傪僆乕僶乕偟偰偄側偄偐丠
if width > next_width
# 昞帵傾僀僐儞偵捛壛
icon_states.push(STATE_ICON_FILE[state[i]])
# 暆峏怴
icon_width += bitmap.width + ICON_INTERVAL
else
break
end
end
end
return icon_states
end
#--------------------------------------------------------------------------
# 仠 儘乕僥乕僔儑儞偝偣傞偐偺敾掕
# state : 僗僥乕僩ID孮
# width : 昤夋愭偺暆
#--------------------------------------------------------------------------
def do_rotation?(bitmap, state, width)
case STATE_ICON
when true # 傾僀僐儞
icon_width = 0
for i in 0...state.size
unless STATE_ICON_FILE[state[i]].nil?
# 傾僀僐儞僼傽僀儖偺價僢僩儅僢僾撉傒崬傒
bitmap = RPG::Cache.icon(STATE_ICON_FILE[state[i]])
next_width = icon_width + bitmap.width + ICON_INTERVAL
# 昞帵斖埻傪僆乕僶乕偟偰偄側偄偐丠
if width > next_width
# 暆峏怴
icon_width += bitmap.width + ICON_INTERVAL
else
# 儘乕僥乕僔儑儞偑昁梫
return true
end
end
end
when false # 僥僉僗僩
# 妵屖偺暆傪庢摼
brackets_width = bitmap.text_size("[]").width
# 僗僥乕僩柤偺暥帤楍傪嶌惉
text = ""
for i in state
if $data_states[i].rating >= 1
if text == ""
text = $data_states[i].name
else
new_text = text + "/" + $data_states[i].name
text_width = bitmap.text_size(new_text).width
if text_width > width - brackets_width
# 儘乕僥乕僔儑儞偑昁梫
return true
end
text = new_text
end
end
end
else
p "Err:STATE_ICON"
exit
end
# 儘乕僥乕僔儑儞偼晄梫
return false
end
#--------------------------------------------------------------------------
# 仠 僗僥乕僩偺儘乕僥乕僔儑儞
# state : 僗僥乕僩ID孮
# index : 儘乕僥乕僔儑儞奐巒Index
#--------------------------------------------------------------------------
def rotation_state(state, index)
rot_state = []
for i in index...state.size
rot_state.push(state[i])
end
for i in 0...index
rot_state.push(state[i])
end
return rot_state
end
#--------------------------------------------------------------------------
# 仠 僗僥乕僩梡傾僀僐儞偺昤夋奐巒埵抲偺寁嶼
# state : 僗僥乕僩ID孮
# width : 昤夋愭偺暆
#--------------------------------------------------------------------------
def make_icon_pos_x(state, width)
icon_width = 0
for i in 0...state.size
bitmap = RPG::Cache.icon(state[i])
# 暆峏怴
icon_width += bitmap.width + ICON_INTERVAL
end
# 昤夋奐巒埵抲偺寁嶼
pos_x = (width - icon_width) / 2
return pos_x
end
end
#==============================================================================
# 仭 Sprite_Battler
#==============================================================================
class Sprite_Battler < RPG::Sprite
# 僗僥乕僩昞帵椞堟偺暆丄崅偝傪掕媊
BITMAP_WIDTH = 120
BITMAP_HEIGHT = 32
#--------------------------------------------------------------------------
# 仠 僆僽僕僃僋僩弶婜壔 [嵞掕媊]
# viewport : 價儏乕億乕僩
# battler : 僶僩儔乕 (Game_Battler)
#--------------------------------------------------------------------------
def initialize(viewport, battler = nil)
super(viewport)
@battler = battler
@battler_visible = false
#-[僗僥乕僩昞帵奼挘]------
@rotation_count = 0 # 儘乕僥乕僔儑儞梡偺僇僂儞僩
@rotation_index = 0 # 儘乕僥乕僔儑儞Index
@loop_state_animation_count = 0 # 儖乕僾僇僂儞僩
@battler_state = [] # 撪晹曐帩梡僗僥乕僩
@state_update_flag = false # 僗僥乕僩峏怴僼儔僌
@sync_update_flag = false # 傾僯儊乕僔儑儞摨婜梡僼儔僌
# 僗僥乕僩昞帵梡僗僾儔僀僩傪梡堄
@state_sprite = Sprite.new(viewport)
@state_sprite.bitmap = Bitmap.new(BITMAP_WIDTH, BITMAP_HEIGHT)
#-------------------------
end
#--------------------------------------------------------------------------
# 仠 夝曻 [嵞掕媊]
#--------------------------------------------------------------------------
def dispose
#-[僗僥乕僩昞帵奼挘]------
@state_sprite.dispose
#-------------------------
if self.bitmap != nil
self.bitmap.dispose
end
super
end
#--------------------------------------------------------------------------
# 仠 僼儗乕儉峏怴 [嵞掕媊]
#--------------------------------------------------------------------------
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
# 愴摤晄擻傑偨偼塀傟忬懺側傜晄摟柧搙傪 0 偵偡傞
if @battler.dead? or @battler.hidden
self.opacity = 0
end
end
#-[僗僥乕僩昞帵奼挘]------
=begin
伀尨宆伀
# 傾僯儊乕僔儑儞 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
仾尨宆仾
=end
# 僗僥乕僩奼挘昞帵
update_state_extension
#-------------------------
# 昞帵偝傟傞傋偒傾僋僞乕偺応崌
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
# 僐儔僾僗
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
end
# 僗僾儔僀僩偺嵗昗傪愝掕
self.x = @battler.screen_x
self.y = @battler.screen_y
self.z = @battler.screen_z
end
#==============================================================================
# 仭 奼挘儊僜僢僪
#==============================================================================
#--------------------------------------------------------------------------
# 仠 僗僥乕僩奼挘昞帵偺峏怴
#--------------------------------------------------------------------------
def update_state_extension
# 晄壜帇偺応崌
unless @battler_visible
@state_sprite.bitmap.clear
return
end
# 僗僥乕僩偑峏怴偝傟偨丠
if @battler.damage == nil
if @battler_state != @battler.states
@battler_state = @battler.states.dup # 僗僥乕僩偺峏怴
@state_update_flag = true # 峏怴僼儔僌ON
end
end
# 僗僥乕僩傾僯儊乕僔儑儞偺峏怴
update_state_animation
# 僗僥乕僩昞帵偺峏怴
update_state
# 峏怴偺廔椆
@state_update_flag = false # 僗僥乕僩峏怴僼儔僌OFF
@sync_update_flag = false # 僗僥乕僩傾僯儊乕僔儑儞偺峏怴僼儔僌OFF
end
#--------------------------------------------------------------------------
# 仠 僗僥乕僩傾僯儊乕僔儑儞峏怴
#--------------------------------------------------------------------------
def update_state_animation
# 僗僥乕僩傾僯儊乕僔儑儞
if State_Extension::STATE_ANIME
# 懡廳僗僥乕僩傾僯儊乕僔儑儞傪昞帵偡傞
multiple_state_animation
else
# 捠忢偺昞帵曽朄傪慖戰
# 傾僯儊乕僔儑儞 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
end
end
#--------------------------------------------------------------------------
# 仠 懡廳僗僥乕僩傾僯儊乕僔儑儞
#--------------------------------------------------------------------------
def multiple_state_animation
# 傾僯儊乕僔儑儞偺偁傞僗僥乕僩傪撉傒崬傒
anime_states = State_Extension.state_animations(@battler_state)
# 傾僯儊乕僔儑儞偺偁傞僗僥乕僩偑晅梌偝傟偰偄傞
unless anime_states.empty?
# 僗僥乕僩偺峏怴偑側偝傟偨応崌
if @state_update_flag
# 僗僥乕僩Index傪弶婜壔
@loop_state_index = 0
# 儖乕僾傾僯儊乕僔儑儞偺愝掕
set_loop_animation(anime_states)
end
@loop_state_animation_count -= 1
# 儖乕僾僇僂儞僩偑0偵側偭偨
if @loop_state_animation_count == 0
# 僗僥乕僩Index偺峏怴
@loop_state_index += 1
if @loop_state_index == anime_states.size
@loop_state_index = 0
end
# 儖乕僾傾僯儊乕僔儑儞偺愝掕
set_loop_animation(anime_states)
end
else
# 慡僗僥乕僩夝彍帪偵儖乕僾傾僯儊乕僔儑儞傪徚偡
if @state_update_flag
# 傾僯儊乕僔儑儞偺峏怴傪専抦
@sync_update_flag = true
@loop_state_animation_count = 0
@loop_state_index = 0
loop_animation(nil)
end
end
end
#--------------------------------------------------------------------------
# 仠 儖乕僾傾僯儊乕僔儑儞愝掕
#--------------------------------------------------------------------------
def set_loop_animation(anime_states)
# 傾僯儊乕僔儑儞偺峏怴傪専抦
@sync_update_flag = true
# 昞帵偝偣傞僗僥乕僩傾僯儊乕僔儑儞ID傪撉傒崬傒
animation_id = anime_states[@loop_state_index]
# 傾僯儊乕僔儑儞撉傒崬傒
anime_data = $data_animations[animation_id]
# 僼儗乕儉悢傪愝掕
@loop_state_animation_count = anime_data.frames.size * State_Extension::LOOP_COUNT
# 儖乕僾傾僯儊乕僔儑儞傪愝掕
loop_animation(anime_data)
end
#--------------------------------------------------------------------------
# 仠 僗僥乕僩昞帵峏怴
#--------------------------------------------------------------------------
def update_state
# 昞帵桳岠敾掕
case @battler
when Game_Actor
# 傾僋僞乕桳岠丠
unless State_Extension::ACTOR_STATE
# 柍懯側偺偱僨僼僅儖僩柍岠偵丅
return
end
when Game_Enemy
# 僄僱儈乕桳岠丠
unless State_Extension::ENEMY_STATE
return
end
else
p "Err: 'Sprite_Battler' can use actor or enemy only"
exit
end
# 僗僥乕僩昞帵偺嵞僙僢僩傾僢僾
case State_Extension::STATE_PATTERN
when 0 # 捠忢昞帵
make_normal_state
when 1 # 儘乕僥乕僔儑儞
make_rotation_state
when 2 # 僗僥乕僩傾僯儊乕僔儑儞偲摨婜
make_synchronous_state
else
p "Err:STATE_PATTERN"
exit
end
# 昞帵埵抲偺峏怴丅
@state_sprite.x = @battler.screen_x - BITMAP_WIDTH / 2
@state_sprite.y = @battler.screen_y - BITMAP_HEIGHT + State_Extension::STATE_Y
@state_sprite.z = @battler.screen_z
end
#--------------------------------------------------------------------------
# 仠 捠忢偺僗僥乕僩昞帵
#--------------------------------------------------------------------------
def make_normal_state
# 僗僥乕僩偺峏怴偁傝丠
if @state_update_flag
draw_state(@battler_state)
end
end
#--------------------------------------------------------------------------
# 仠 儘乕僥乕僔儑儞偟偨僗僥乕僩昞帵
#--------------------------------------------------------------------------
def make_rotation_state
# 僗僥乕僩偑晅梌偝傟偰偄傞丠
unless @battler_state.empty?
# 儘乕僥乕僔儑儞偝偣傞傋偒偐丠
if State_Extension.do_rotation?(@state_sprite.bitmap, @battler_state, BITMAP_WIDTH)
# 儘乕僥乕僔儑儞僇僂儞僩+1
@rotation_count += 1
end
# 僗僥乕僩偺峏怴偁傝丠
if @state_update_flag
@rotation_count = State_Extension::ROT_COUNT
@rotation_index = 0
end
# 儘乕僥乕僔儑儞偺峏怴偁傝丠
if @rotation_count == State_Extension::ROT_COUNT
@rotation_count = 0
# 儘乕僥乕僔儑儞Index抣偺峏怴
@rotation_index += 1
if @rotation_index >= @battler_state.size
@rotation_index = 0
end
# 儘乕僥乕僔儑儞偟偨僗僥乕僩孮偺庢摼
state = State_Extension.rotation_state(@battler_state, @rotation_index)
draw_state(state)
end
else
# 僗僥乕僩偺峏怴偁傝丠
if @state_update_flag
# 昞帵傪僋儕傾
@state_sprite.bitmap.clear
@rotation_count = 0
@rotation_index = 0
end
end
end
#--------------------------------------------------------------------------
# 仠 傾僯儊乕僔儑儞偲摨婜偟偨僗僥乕僩昞帵偺峏怴
#--------------------------------------------------------------------------
def make_synchronous_state
# 僗僥乕僩傾僯儊乕僔儑儞偺峏怴偁傝丠
if @sync_update_flag
# 昞帵拞偺傾僯儊乕僔儑儞偵墳偠偨僗僥乕僩ID傪庢摼
state = [@battler_state[@loop_state_index]]
draw_state(state)
end
end
#--------------------------------------------------------------------------
# 仠 僗僥乕僩昞帵乮傾僀僐儞乛僥僉僗僩乯
# state : 僗僥乕僩梡傾僀僐儞僼傽僀儖孮
#--------------------------------------------------------------------------
def draw_state(state)
# 昞帵傪僋儕傾
@state_sprite.bitmap.clear
# 僗僥乕僩昞帵
case State_Extension::STATE_ICON
when false # 僥僉僗僩昞帵
text = State_Extension.make_state_text(@state_sprite.bitmap, state, BITMAP_WIDTH)
# 僗僥乕僩昤幨(捠忢)
@state_sprite.bitmap.draw_text(0, 0, BITMAP_WIDTH, BITMAP_HEIGHT, text, 1)
# 僗僥乕僩昤幨(墢暥帤)
#@state_sprite.bitmap.draw_edging_text(0, 0, BITMAP_WIDTH, BITMAP_HEIGHT, text, 1)
when true # 傾僀僐儞昞帵
# 僗僥乕僩梡傾僀僐儞偺僼傽僀儖柤傪庢摼
icon_state = State_Extension.make_state_icon(state, BITMAP_WIDTH)
# 僗僥乕僩偺傾僀僐儞昤幨
draw_state_icon(icon_state)
else
p "Err:STATE_ICON"
end
end
#--------------------------------------------------------------------------
# 仠 僗僥乕僩梡傾僀僐儞昞帵
# state : 僗僥乕僩梡傾僀僐儞僼傽僀儖孮
#--------------------------------------------------------------------------
def draw_state_icon(state)
# 昤夋奐巒埵抲偺寛掕
x = State_Extension.make_icon_pos_x(state, BITMAP_WIDTH)
for i in 0...state.size
bitmap = RPG::Cache.icon(state[i])
cw = bitmap.width
ch = bitmap.height
src_rect = Rect.new(0, 0, cw, ch)
@state_sprite.bitmap.blt(x, 0, bitmap, src_rect)
# 昤夋埵抲傪恑傔傞
x += cw + State_Extension::ICON_INTERVAL
end
end
end
复制代码
#==============================================================================
# 仭 僗僥乕僩昞帵奼挘[傾僋僞乕梡] by Claimh
#------------------------------------------------------------------------------
# 丒傾僋僞乕梡偺僗僥乕僩昞帵奼挘傪偝偣傞偨傔偺捛壛張棟丅
# 丒ACTOR_STATE = true 偺偲偒 MENU_ST_ICON = true 偺偲偒偼昁恵偱偡丅
#==============================================================================
#==============================================================================
# 仭 Window_Base
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# 仠 僗僥乕僩偺昤夋
# actor : 傾僋僞乕
# x : 昤夋愭 X 嵗昗
# y : 昤夋愭 Y 嵗昗
# width : 昤夋愭偺暆
#--------------------------------------------------------------------------
alias draw_state_normal draw_actor_state
def draw_actor_state(actor, x, y, width = 120)
# 愴摤拞丠
if $scene.is_a?(Scene_Battle)
if State_Extension::ACTOR_STATE
# 僗僥乕僩桳傝丠
unless actor.states.empty?
# 昞帵偟側偄
return
end
end
else
if State_Extension::MENU_ST_ICON
# 僗僥乕僩桳傝丠
unless actor.states.empty?
# 僗僥乕僩傪傾僀僐儞昞帵
draw_state_icon(actor, x, y, width)
return
end
end
end
# 捠忢昞帵
draw_state_normal(actor, x, y, width)
end
#--------------------------------------------------------------------------
# 仠 僗僥乕僩梡傾僀僐儞昞帵
# state : 僗僥乕僩梡傾僀僐儞僼傽僀儖孮
#--------------------------------------------------------------------------
def draw_state_icon(actor, x, y, width = 120)
# 傾僀僐儞僼傽僀儖孮傪庢摼
icon_state = State_Extension.make_state_icon(actor.states, width)
# 昤夋奐巒埵抲偺寛掕
x = 0
for i in 0...icon_state.size
bitmap = RPG::Cache.icon(icon_state[i])
cw = bitmap.width
ch = bitmap.height
src_rect = Rect.new(0, 0, cw, ch)
self.bitmap.blt(x, ch/2, bitmap, src_rect)
# 昤夋埵抲傪恑傔傞
x += cw + State_Extension::ICON_INTERVAL
end
end
end
#==============================================================================
# 仭 Window_BattleStatus
#==============================================================================
class Window_BattleStatus < Window_Base
#--------------------------------------------------------------------------
# 仠 儗儀儖傾僢僾僼儔僌偺愝掕
# actor_index : 傾僋僞乕僀儞僨僢僋僗
#--------------------------------------------------------------------------
def level_up?(actor_index)
return @level_up_flags[actor_index]
end
end
#==============================================================================
# 仭 Scene_Battle
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# 仠 傾僼僞乕僶僩儖僼僃乕僘奐巒
#--------------------------------------------------------------------------
alias start_phase5_state_ex start_phase5
def start_phase5
start_phase5_state_ex
# 儗儀儖傾僢僾昞帵帪偵僗僥乕僩傪徚偡
for i in 0...$game_party.actors.size
if @status_window.level_up?(i)
@spriteset.delete_state(i)
end
end
end
end
#==============================================================================
# 仭 Spriteset_Battle
#==============================================================================
class Spriteset_Battle
#--------------------------------------------------------------------------
# 仠 僗僥乕僩僗僾儔僀僩傪徚偡
#--------------------------------------------------------------------------
def delete_state(index)
@actor_sprites[index].del_state
end
end
#==============================================================================
# 仭 Sprite_Battler
#==============================================================================
class Sprite_Battler < RPG::Sprite
#--------------------------------------------------------------------------
# 仠 僗僥乕僩僗僾儔僀僩傪徚偡
#--------------------------------------------------------------------------
def del_state
@state_sprite.visible = false
end
end
复制代码
作者:
link006007
时间:
2006-6-30 22:12
感谢楼主...但不要直接复制..会乱码
作者:
ddboybb
时间:
2006-6-30 22:18
……不好意思……转的时候 ……他们的就这样……日文网站……
作者:
frantice
时间:
2006-6-30 22:18
这个应该放地球村里吧,,,,,,,全乱码的配上那截图啥都看不懂.....
作者:
link006007
时间:
2006-6-30 22:20
图标代替状态文字...叶子写过一个
作者:
ddboybb
时间:
2006-6-30 22:20
呵呵…………
图片看不懂么? 那个怪下头不是显示着几种状态……
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1