赞 | 0 |
VIP | 0 |
好人卡 | 11 |
积分 | 0 |
经验 | 4985 |
最后登录 | 2013-11-22 |
在线时间 | 114 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 49
- 在线时间
- 114 小时
- 注册时间
- 2011-3-17
- 帖子
- 49
|
从我很早以前的老坑里挖出来的,出处在哪忘了>W<- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
- #
- # 脚本功能:给不同物品显示不同颜色,类似暗黑破坏神,比如套装为绿色,超级为金色
- # 可以更改的种类包括物品、防具、特技、武器。
- #
- # 使用方法:对于不想为白色表示的物品,在描述中最后添加@6,@4一类的即可。
- # 数字为颜色编号,和对话框中的一样。
- # ——————————————————————————————————————
- module RPG
- class Skill
- def description
- description = @description.split(/@/)[0]
- return description != nil ? description : ''
- end
- def name_color_66RPG
- name_color = @description.split(/@/)[1]
- return name_color != nil ? name_color.to_i : 0
- end
- end
- class Weapon
- def description
- description = @description.split(/@/)[0]
- return description != nil ? description : ''
- end
- def name_color_66RPG
- name_color = @description.split(/@/)[1]
- return name_color != nil ? name_color.to_i : 0
- end
- end
- class Item
- def description
- description = @description.split(/@/)[0]
- return description != nil ? description : ''
- end
- def name_color_66RPG
- name_color = @description.split(/@/)[1]
- return name_color != nil ? name_color.to_i : 0
- end
- end
- class Armor
- def description
- description = @description.split(/@/)[0]
- return description != nil ? description : ''
- end
- def name_color_66RPG
- name_color = @description.split(/@/)[1]
- return name != nil ? name_color.to_i : 0
- end
- end
- end
- # ——————————————————————————————————————
- # 本脚本原创自www.66rpg.com,转载请保留此信息
- # ——————————————————————————————————————
- class Window_Base < Window
- #--------------------------------------------------------------------------
- # ● 描绘物品名
- # item : 物品
- # x : 描画目标 X 坐标
- # y : 描画目标 Y 坐标
- #--------------------------------------------------------------------------
- def draw_item_name(item, x, y)
- if item == nil
- return
- end
- bitmap = RPG::Cache.icon(item.icon_name)
- self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
- self.contents.font.color = text_color(item.name_color_66RPG)
- self.contents.draw_text(x + 28, y, 212, 32, item.name.to_s)
- end
- end
- # ——————————————————————————————————————
- # 本脚本原创自www.66rpg.com,转载请保留此信息
- # ——————————————————————————————————————
- class Window_Item
- #--------------------------------------------------------------------------
- # ● 描绘项目
- # index : 项目编号
- #--------------------------------------------------------------------------
- def draw_item(index)
- item = @data[index]
- case item
- when RPG::Item
- number = $game_party.item_number(item.id)
- when RPG::Weapon
- number = $game_party.weapon_number(item.id)
- when RPG::Armor
- number = $game_party.armor_number(item.id)
- end
- if item.is_a?(RPG::Item) and
- $game_party.item_can_use?(item.id)
- self.contents.font.color = text_color(item.name_color_66RPG)
- else
- self.contents.font.color = disabled_color
- end
- x = 4 + index % 2 * (288 + 32)
- y = index / 2 * 32
- rect = Rect.new(x, y, self.width / @column_max - 32, 32)
- self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
- bitmap = RPG::Cache.icon(item.icon_name)
- opacity = self.contents.font.color == disabled_color ? 128 : 255
- self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
- self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
- self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
- self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
- end
- end
- # ——————————————————————————————————————
- # 本脚本原创自www.66rpg.com,转载请保留此信息
- # ——————————————————————————————————————
- class Window_EquipItem < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 项目的描绘
- # index : 项目符号
- #--------------------------------------------------------------------------
- def draw_item(index)
- item = @data[index]
- x = 4 + index % 2 * (288 + 32)
- y = index / 2 * 32
- case item
- when RPG::Weapon
- number = $game_party.weapon_number(item.id)
- when RPG::Armor
- number = $game_party.armor_number(item.id)
- end
- bitmap = RPG::Cache.icon(item.icon_name)
- self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
- self.contents.font.color = text_color(item.name_color_66RPG)
- self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
- self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
- self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
- end
- end
- # ——————————————————————————————————————
- # 本脚本原创自www.66rpg.com,转载请保留此信息
- # ——————————————————————————————————————
- class Window_ShopBuy < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 描绘羡慕
- # index : 项目编号
- #--------------------------------------------------------------------------
- def draw_item(index)
- item = @data[index]
- # 获取物品所持数
- case item
- when RPG::Item
- number = $game_party.item_number(item.id)
- when RPG::Weapon
- number = $game_party.weapon_number(item.id)
- when RPG::Armor
- number = $game_party.armor_number(item.id)
- end
- # 价格在所持金以下、并且所持数不是 99 的情况下为普通颜色
- # 除此之外的情况设置为无效文字色
- if item.price <= $game_party.gold and number < 99
- self.contents.font.color = text_color(item.name_color_66RPG)
- else
- self.contents.font.color = disabled_color
- end
- x = 4
- y = index * 32
- rect = Rect.new(x, y, self.width - 32, 32)
- self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
- bitmap = RPG::Cache.icon(item.icon_name)
- opacity = self.contents.font.color == disabled_color ? 128 : 255
- self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
- self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
- self.contents.draw_text(x + 240, y, 88, 32, item.price.to_s, 2)
- end
- end
- # ——————————————————————————————————————
- # 本脚本原创自www.66rpg.com,转载请保留此信息
- # ——————————————————————————————————————
- class Window_ShopSell < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 描绘项目
- # index : 项目标号
- #--------------------------------------------------------------------------
- def draw_item(index)
- item = @data[index]
- case item
- when RPG::Item
- number = $game_party.item_number(item.id)
- when RPG::Weapon
- number = $game_party.weapon_number(item.id)
- when RPG::Armor
- number = $game_party.armor_number(item.id)
- end
- # 可以卖掉的显示为普通颜色、除此之外设置成无效文字颜色
- if item.price > 0
- self.contents.font.color = text_color(item.name_color_66RPG)
- else
- self.contents.font.color = disabled_color
- end
- x = 4 + index % 2 * (288 + 32)
- y = index / 2 * 32
- rect = Rect.new(x, y, self.width / @column_max - 32, 32)
- self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
- bitmap = RPG::Cache.icon(item.icon_name)
- opacity = self.contents.font.color == disabled_color ? 128 : 255
- self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
- self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
- self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
- self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
- end
- end
-
- # ——————————————————————————————————————
- # 本脚本原创自www.66rpg.com,转载请保留此信息
- # ——————————————————————————————————————
- class Window_Skill
- #--------------------------------------------------------------------------
- # ● 描绘项目
- # index : 项目编号
- #--------------------------------------------------------------------------
- def draw_item(index)
- skill = @data[index]
- if @actor.skill_can_use?(skill.id)
- self.contents.font.color = text_color(skill.name_color_66RPG)
- else
- self.contents.font.color = disabled_color
- end
- x = 4 + index % 2 * (288 + 32)
- y = index / 2 * 32
- rect = Rect.new(x, y, self.width / @column_max - 32, 32)
- self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
- bitmap = RPG::Cache.icon(skill.icon_name)
- opacity = self.contents.font.color == disabled_color ? 128 : 255
- self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
- self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
- self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
- end
- end
- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
- # ■ Window_Item
- #------------------------------------------------------------------------------
- # 物品画面、战斗画面、显示浏览物品的窗口。
- #==============================================================================
- class Window_Item < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- if self.contents != nil
- self.contents.dispose
- self.contents = nil
- end
- @data = []
- # 在战斗中以外添加武器、防具
- unless $game_temp.in_battle
- # 添加报务
- for i in 1...$data_items.size
- if $game_party.item_number(i) > 0
- @data.push($data_items[i])
- end
- end
- for i in 1...$data_weapons.size
- if $game_party.weapon_number(i) > 0
- @data.push($data_weapons[i])
- end
- end
- for i in 1...$data_armors.size
- if $game_party.armor_number(i) > 0
- @data.push($data_armors[i])
- end
- end
- else
- for i in 1...$data_items.size
- if $game_party.item_number(i) > 0
- occasion = $data_items[i].occasion
- if occasion == 0 or occasion == 1
- @data.push($data_items[i])
- end
- end
- end
- end
- # 如果项目数不是 0 就生成位图、重新描绘全部项目
- @item_max = @data.size
- if @item_max > 0
- self.contents = Bitmap.new(width - 32, row_max * 32)
- for i in 0...@item_max
- draw_item(i)
- end
- end
- end
- end
- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
- # ————————————————————————————————————
- # 本脚本来自www.66rpg.com,转载请保留此信息
- # ————————————————————————————————————
- #==============================================================================
- # ■ Game_Player
- #==============================================================================
- class Game_Player
- #--------------------------------------------------------------------------
- # ● フレーム更新
- #--------------------------------------------------------------------------
- alias old_update update
- def update
- unless moving? or $game_system.map_interpreter.running? or
- @move_route_forcing or $game_temp.message_window_showing
- if Input.press?(Input::C)
- # 速度変更
- @move_speed = 4.9
- else
- @move_speed = 4
- end
- end
- old_update
- end
- end
- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息 敌人血条
- #==============================================================================
- # ■ エネミーHP&SP(ver 0.98)
- # □ カスタマイズポイント
- #==============================================================================
- module PLAN_HPSP_DRAW
- FONT_NAME = ["黑体", "楷体", "宋体"] # フォント
- FONT_SIZE = 14 # フォントサイズ
- FONT_BOLD = true # 太字
- FONT_ITALIC = true # 斜体
- DRAW_NAME = false # 名前の描画
- DRAW_HP = true # HP の描画
- DRAW_SP = true # SP の描画
- DRAW_WIDTH = 80 # 描画幅
- DRAW_HEIGHT = 3 * 32 # 描画高さ
- DRAW_SPACE = 0 # 行間
- DRAW_Y = 36 # Y 座標修正値
- end
- #==============================================================================
- # ■ Sprite_Battler
- #==============================================================================
- class Sprite_Battler < RPG::Sprite
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- alias plan_enemy_hpsp_draw_initialize initialize
- def initialize(viewport, battler = nil)
- # 元のメソッドに戻す
- plan_enemy_hpsp_draw_initialize(viewport, battler)
- # エネミーの場合
- if @battler.is_a?(Game_Enemy)
- width = PLAN_HPSP_DRAW::DRAW_WIDTH + 32
- height = PLAN_HPSP_DRAW::DRAW_HEIGHT + 32
- x = @battler.screen_x - width / 2
- y = @battler.screen_y - height + 32 + PLAN_HPSP_DRAW::DRAW_Y
- @enemy_hpsp_window = Window_Base.new(x, y, width, height)
- @enemy_hpsp_window.contents = Bitmap.new(width - 32, height - 32)
- @enemy_hpsp_window.contents.font.name = PLAN_HPSP_DRAW::FONT_NAME
- @enemy_hpsp_window.contents.font.size = PLAN_HPSP_DRAW::FONT_SIZE
- @enemy_hpsp_window.contents.font.bold = PLAN_HPSP_DRAW::FONT_BOLD
- @enemy_hpsp_window.contents.font.italic = PLAN_HPSP_DRAW::FONT_ITALIC
- y = 0
- @old_enemy_hpsp = []
- one_line = ((PLAN_HPSP_DRAW::FONT_SIZE * 100 / 28) * 32) / 100
- if PLAN_HPSP_DRAW::DRAW_NAME
- @enemy_hpsp_window.draw_actor_name(@battler, 0, y, width - 32)
- y += one_line + PLAN_HPSP_DRAW::DRAW_SPACE
- @old_enemy_hpsp.push(@battler.name)
- end
- if PLAN_HPSP_DRAW::DRAW_HP
- @enemy_hpsp_window.draw_actor_hp2222(@battler, 0, y, width - 32)
- y += one_line + PLAN_HPSP_DRAW::DRAW_SPACE
- @old_enemy_hpsp.push(@battler.hp)
- end
- if PLAN_HPSP_DRAW::DRAW_SP
- @enemy_hpsp_window.draw_actor_sp2222(@battler, 0, y, width - 32)
- @old_enemy_hpsp.push(@battler.sp)
- end
- @enemy_hpsp_window.opacity = 0
- @enemy_hpsp_window.contents_opacity = 0
- @enemy_hpsp_window.z = -2
- end
- end
- #--------------------------------------------------------------------------
- # ● 解放
- #--------------------------------------------------------------------------
- alias plan_enemy_hpsp_draw_dispose dispose
- def dispose
- # エネミーの場合
- if @battler.is_a?(Game_Enemy)
- @enemy_hpsp_window.dispose
- end
- # 元のメソッドに戻す
- plan_enemy_hpsp_draw_dispose
- end
- #--------------------------------------------------------------------------
- # ● フレーム更新
- #--------------------------------------------------------------------------
- alias plan_enemy_hpsp_draw_update update
- def update
- # 元のメソッドに戻す
- plan_enemy_hpsp_draw_update
- # エネミーの場合
- if @battler.is_a?(Game_Enemy)
- @enemy_hpsp_window.visible = @battler_visible
- # スプライトの座標を設定
- width = PLAN_HPSP_DRAW::DRAW_WIDTH + 32
- @enemy_hpsp_window.x = self.x - width / 2
- @now_enemy_hpsp = []
- if PLAN_HPSP_DRAW::DRAW_NAME
- @now_enemy_hpsp.push(@battler.name)
- end
- if PLAN_HPSP_DRAW::DRAW_HP
- @now_enemy_hpsp.push(@battler.hp)
- end
- if PLAN_HPSP_DRAW::DRAW_SP
- @now_enemy_hpsp.push(@battler.sp)
- end
- if @old_enemy_hpsp != @now_enemy_hpsp and $game_temp.enemy_hpsp_refresh
- @old_enemy_hpsp = @now_enemy_hpsp
- @enemy_hpsp_window.contents.clear
- y = 0
- width = PLAN_HPSP_DRAW::DRAW_WIDTH + 32
- one_line = ((PLAN_HPSP_DRAW::FONT_SIZE * 100 / 28) * 32) / 100
- if PLAN_HPSP_DRAW::DRAW_NAME
- @enemy_hpsp_window.draw_actor_name(@battler, 0, y, width - 32)
- y += one_line + PLAN_HPSP_DRAW::DRAW_SPACE
- end
- if PLAN_HPSP_DRAW::DRAW_HP
- @enemy_hpsp_window.draw_actor_hp2222(@battler, 0, y, width - 32)
- y += one_line + PLAN_HPSP_DRAW::DRAW_SPACE
- end
- if PLAN_HPSP_DRAW::DRAW_SP
- @enemy_hpsp_window.draw_actor_sp2222(@battler, 0, y, width - 32)
- end
- Graphics.frame_reset
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● visible の設定
- #--------------------------------------------------------------------------
- if !method_defined?("plan_enemy_hpsp_draw_visible=")
- alias plan_enemy_hpsp_draw_visible= visible=
- end
- def visible=(bool)
- # エネミーの場合
- if @battler.is_a?(Game_Enemy)
- @enemy_hpsp_window.visible = bool
- end
- # 元のメソッドに戻す
- self.plan_enemy_hpsp_draw_visible=(bool)
- end
- #--------------------------------------------------------------------------
- # ● 不透明度の設定
- #--------------------------------------------------------------------------
- if !method_defined?("plan_enemy_hpsp_draw_opacity=")
- alias plan_enemy_hpsp_draw_opacity= opacity=
- end
- def opacity=(n)
- # 元のメソッドに戻す
- self.plan_enemy_hpsp_draw_opacity=(n)
- # エネミーの場合
- if @battler.is_a?(Game_Enemy)
- @enemy_hpsp_window.contents_opacity = n
- end
- end
- end
-
-
- #==============================================================================
- # ■ Game_Temp
- #==============================================================================
- class Game_Temp
- #--------------------------------------------------------------------------
- # ● 公開インスタンス変数
- #--------------------------------------------------------------------------
- attr_accessor :enemy_hpsp_refresh
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- alias plan_enemy_hpsp_draw_initialize initialize
- def initialize
- # 元のメソッドに戻す
- plan_enemy_hpsp_draw_initialize
- @enemy_hpsp_refresh = false
- end
- end
- #==============================================================================
- # ■ Scene_Battle
- #==============================================================================
- class Scene_Battle
- #--------------------------------------------------------------------------
- # ● プレバトルフェーズ開始 (エネミー名+アルファベット用)
- #--------------------------------------------------------------------------
- alias plan_enemy_hpsp_draw_start_phase1 start_phase1
- def start_phase1
- $game_temp.enemy_hpsp_refresh = true
- # 元のメソッドに戻す
- plan_enemy_hpsp_draw_start_phase1
- end
- #--------------------------------------------------------------------------
- # ● パーティコマンドフェーズ開始 (エネミー名+アルファベット用)
- #--------------------------------------------------------------------------
- alias plan_enemy_hpsp_draw_start_phase2 start_phase2
- def start_phase2
- $game_temp.enemy_hpsp_refresh = false
- # 元のメソッドに戻す
- plan_enemy_hpsp_draw_start_phase2
- end
- #--------------------------------------------------------------------------
- # ● フレーム更新 (メインフェーズ ステップ 5 : ダメージ表示)
- #--------------------------------------------------------------------------
- alias plan_enemy_hpsp_draw_update_phase4_step5 update_phase4_step5
- def update_phase4_step5
- # 元のメソッドに戻す
- plan_enemy_hpsp_draw_update_phase4_step5
- $game_temp.enemy_hpsp_refresh = true
- end
- #--------------------------------------------------------------------------
- # ● フレーム更新 (メインフェーズ ステップ 6 : リフレッシュ)
- #--------------------------------------------------------------------------
- alias plan_enemy_hpsp_draw_update_phase4_step6 update_phase4_step6
- def update_phase4_step6
- # 元のメソッドに戻す
- plan_enemy_hpsp_draw_update_phase4_step6
- $game_temp.enemy_hpsp_refresh = false
- end
- end
- #==============================================================================
- # ■ Window_Base
- #==============================================================================
- class Window_Base < Window
- #--------------------------------------------------------------------------
- # ● 名前の描画
- #--------------------------------------------------------------------------
- def draw_actor_name(actor, x, y, width = 120, align = 0)
- self.contents.font.color = normal_color
- align = 1 if $scene.is_a?(Scene_Battle)
- self.contents.draw_text(x, y, width, 32, actor.name, align)
- end
- #--------------------------------------------------------------------------
- # ● ステートの描画
- #--------------------------------------------------------------------------
- def draw_actor_state(actor, x, y, width = 120)
- # 元のメソッドに戻す
- text = make_battler_state_text(actor, width, true)
- self.contents.draw_text(x, y, width, 32, text, 1)
- end
- end
- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
- class Window_Base < Window
- def draw_actor_hp2222(actor, x, y, width = 100, height=8)
- y+=3
- olx = x
- oly = y
- w = width * actor.hp / [actor.maxhp,1].max
- hp_color_1 = Color.new(255, 0, 0, 192)
- hp_color_2 = Color.new(255, 255, 0, 192)
- self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
- draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
- x -= 1
- y += (height/4).floor
- self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
- draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
- x -= 1
- y += (height/4).ceil
- self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
- draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
- x -= 1
- y += (height/4).ceil
- self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
- draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
- x = olx
- y = oly-14
- # 描绘字符串 "HP"
- self.contents.font.color = system_color
- self.contents.draw_text(x, y, 32, 32, $data_system.words.hp)
- # 计算描绘 MaxHP 所需的空间
- if width - 32 >= 108
- hp_x = x + width - 108
- flag = true
- elsif width - 32 >= 48
- hp_x = x + width - 48
- flag = false
- end
- # 描绘 HP
- self.contents.font.color = actor.hp == 0 ? knockout_color :
- actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
- self.contents.draw_text(hp_x, y, 48, 32, actor.hp.to_s, 2)
- # 描绘 MaxHP
- if flag
- self.contents.font.color = normal_color
- self.contents.draw_text(hp_x + 48, y, 12, 32, "/", 1)
- self.contents.draw_text(hp_x + 60, y, 48, 32, actor.maxhp.to_s)
- end
- end
- def draw_actor_sp2222(actor, x, y, width = 100, height = 8)
- y+=3
- olx = x
- oly = y
- w = width * actor.sp / [actor.maxsp,1].max
- hp_color_1 = Color.new( 0, 0, 255, 192)
- hp_color_2 = Color.new( 0, 255, 255, 192)
- self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
- draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
- x -= 1
- y += (height/4).floor
- self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
- draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
- x -= 1
- y += (height/4).ceil
- self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
- draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
- x -= 1
- y += (height/4).ceil
- self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
- draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
- x = olx
- y = oly-14
- # 描绘字符串 "SP"
- self.contents.font.color = system_color
- self.contents.draw_text(x, y, 32, 32, $data_system.words.sp)
- # 计算描绘 MaxSP 所需的空间
- if width - 32 >= 108
- sp_x = x + width - 108
- flag = true
- elsif width - 32 >= 48
- sp_x = x + width - 48
- flag = false
- end
- # 描绘 SP
- self.contents.font.color = actor.sp == 0 ? knockout_color :
- actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
- self.contents.draw_text(sp_x, y, 48, 32, actor.sp.to_s, 2)
- # 描绘 MaxSP
- if flag
- self.contents.font.color = normal_color
- self.contents.draw_text(sp_x + 48, y, 12, 32, "/", 1)
- self.contents.draw_text(sp_x + 60, y, 48, 32, actor.maxsp.to_s)
- end
- end
- #--------------------------------------------------------------------------
- # ● ライン描画 by 桜雅 在土
- #--------------------------------------------------------------------------
- def draw_line(start_x, start_y, end_x, end_y, start_color, width = 1, end_color = start_color)
- # 描写距離の計算。大きめに直角時の長さ。
- distance = (start_x - end_x).abs + (start_y - end_y).abs
- # 描写開始
- if end_color == start_color
- for i in 1..distance
- x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
- y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
- if width == 1
- self.contents.set_pixel(x, y, start_color)
- else
- self.contents.fill_rect(x, y, width, width, start_color)
- end
- end
- else
- for i in 1..distance
- x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
- y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
- r = start_color.red * (distance-i)/distance + end_color.red * i/distance
- g = start_color.green * (distance-i)/distance + end_color.green * i/distance
- b = start_color.blue * (distance-i)/distance + end_color.blue * i/distance
- a = start_color.alpha * (distance-i)/distance + end_color.alpha * i/distance
- if width == 1
- self.contents.set_pixel(x, y, Color.new(r, g, b, a))
- else
- self.contents.fill_rect(x, y, width, width, Color.new(r, g, b, a))
- end
- end
- end
- end
- end
- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
- #-----------------------------------------------------------------
- # ● 刷新画面 防卡脚本
- #-----------------------------------------------------------------
- def update
- # 刷新点灭记数
- @blink_count = (@blink_count + 1) % 8
- # 设置传送源矩形
- if @blink_count < 4
- self.src_rect.set(128, 96, 32, 32)
- else
- self.src_rect.set(160, 96, 32, 32)
- end
- # 刷新帮助文本 (update_help 定义了继承目标)
- if @help_window != nil
- if Input.press?(Input::UP) or Input.press?(Input::DOWN) or Input.press?(Input::LEFT) or Input.press?(Input::RIGHT)
- update_help
- end
- end
- end
复制代码 |
|