WR Heart rpg
Vuoi reagire a questo messaggio? Crea un account in pochi clic o accedi per continuare.

Equipaggiamento personalizzato

Andare in basso

Iconxp Equipaggiamento personalizzato

Messaggio Da Spanciai il Gio Mag 10, 2012 7:12 pm

Un equipaggiamento personalizzato

Autore
Landreau10

Decrizione
Un nuovo tipo di equipaggiamento con molte più slot dello standard

Screen
Equipaggiamento personalizzato Lim10

Script
Spoiler:

Codice:
#=================================
#Window_Base Modification
#=================================
class Window_Base <Window
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 = normal_color
ya=item.name.dup
ya.delete!("0")
ya.delete!("1")
ya.delete!("2")
ya.delete!("3")
ya.delete!("4")
ya.delete!("5")
ya.delete!("6")
ya.delete!("7")
ya.delete!("8")

self.contents.draw_text(x + 28, y, 212, 32, ya)
end
end
#=================================
#Window_Base Ends
#=================================

#=================================
#Window_ShopBuy modification
#=================================
class Window_ShopBuy <Window_Selectable
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 = normal_color
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 == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
ya=item.name.dup
ya.delete!("0")
ya.delete!("1")
ya.delete!("2")
ya.delete!("3")
ya.delete!("4")
ya.delete!("5")
ya.delete!("6")
ya.delete!("7")
ya.delete!("8")
self.contents.draw_text(x + 28, y, 212, 32, ya, 0)
self.contents.draw_text(x + 240, y, 88, 32, item.price.to_s, 2)
end
end
#=================================
#Window_ShopBuy Ends
#=================================

#=================================
#Window_ShopSell Modifications
#=================================
class Window_ShopSell
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 = normal_color
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 == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
ya=item.name.dup
ya.delete!("0")
ya.delete!("1")
ya.delete!("2")
ya.delete!("3")
ya.delete!("4")
ya.delete!("5")
ya.delete!("6")
ya.delete!("7")
ya.delete!("8")
self.contents.draw_text(x + 28, y, 212, 32, ya, 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
#=================================
#Window_ShopSell Ends
#=================================
#=================================
#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)#Helmet
@item_window2 = Window_EquipItem.new(@actor, 1)#Earrings
@item_window3 = Window_EquipItem.new(@actor, 2)#Necklace
@item_window4 = Window_EquipItem.new(@actor, 3)#Weapon
@item_window5 = Window_EquipItem.new(@actor, 4)#Cover Armor
@item_window6 = Window_EquipItem.new(@actor, 5)#Arm pads
@item_window7 = Window_EquipItem.new(@actor, 6)#under armor
@item_window8 = Window_EquipItem.new(@actor, 7)#shield
@item_window9 = Window_EquipItem.new(@actor, 8)#leg pads
@item_window10 = Window_EquipItem.new(@actor, 9)#shoes
# ヘルプウィンドウを関連付け
@right_window.help_window = @help_window
@item_window1.help_window = @help_window
@item_window2.help_window = @help_window
@item_window3.help_window = @help_window
@item_window4.help_window = @help_window
@item_window5.help_window = @help_window
@item_window6.help_window = @help_window
@item_window7.help_window = @help_window
@item_window8.help_window = @help_window
@item_window9.help_window = @help_window
@item_window10.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
@item_window2.dispose
@item_window3.dispose
@item_window4.dispose
@item_window5.dispose
@item_window6.dispose
@item_window7.dispose
@item_window8.dispose
@item_window9.dispose
@item_window10.dispose
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
# アイテムウィンドウの可視状態設定
@item_window1.visible = (@right_window.index == 0)
@item_window2.visible = (@right_window.index == 1)
@item_window3.visible = (@right_window.index == 2)
@item_window4.visible = (@right_window.index == 3)
@item_window5.visible = (@right_window.index == 4)
@item_window6.visible = (@right_window.index == 6)
@item_window7.visible = (@right_window.index == 5)
@item_window8.visible = (@right_window.index == 7)
@item_window9.visible = (@right_window.index == 8)
@item_window10.visible = (@right_window.index == 9)
# 現在装備中のアイテムを取得
item1 = @right_window.item
# 現在のアイテムウィンドウを @item_window に設定
case @right_window.index
when 0
@item_window = @item_window1
when 1
@item_window = @item_window2
when 2
@item_window = @item_window3
when 3
@item_window = @item_window4
when 4
@item_window = @item_window5
when 6
@item_window = @item_window6
when 5
@item_window = @item_window7
when 7
@item_window = @item_window8
when 8
@item_window = @item_window9
when 9
@item_window = @item_window10
end
# ライトウィンドウがアクティブの場合
if @right_window.active
# 装備変更後のパラメータを消去
@left_window.set_new_parameters(nil, nil, nil,nil,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
new_str = @actor.str
new_dex = @actor.dex
new_agi = @actor.agi
new_int = @actor.int
# 装備を戻す
@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,new_str,new_dex,new_agi,new_int)
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 を演奏
$bit.dispose
$game_system.se_play($data_system.cancel_se)
# メニュー画面に切り替え
$scene = Scene_Menu.new(2)
return
end
if Input.trigger?(Input::A)
$adjust+=160
$adjust %=320
@left_window.refresh
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::R)
# カーソル SE を演奏
$game_system.se_play($data_system.cursor_se)
# 次のアクターへ
@actor_index += 1
@actor_index %= $game_party.actors.size
# 別の装備画面に切り替え
$scene = Scene_Equip.new(@actor_index, @right_window.index)
return
end
# L ボタンが押された場合
if 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
# 別の装備画面に切り替え
$scene = Scene_Equip.new(@actor_index, @right_window.index)
return
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (アイテムウィンドウがアクティブの場合)
#--------------------------------------------------------------------------
def update_item
if Input.trigger?(Input::A)
$adjust+=160
$adjust %=320
@left_window.refresh
end
# B ボタンが押された場合
if Input.trigger?(Input::B)
# キャンセル SE を演奏
$game_system.se_play($data_system.cancel_se)
# ライトウィンドウをアクティブ化
@right_window.active = true
@item_window.active = false
@item_window.index = -1
return
end
# C ボタンが押された場合
if Input.trigger?(Input::C)
# 装備 SE を演奏
$game_system.se_play($data_system.equip_se)
# アイテムウィンドウで現在選択されているデータを取得
item = @item_window.item
# 装備を変更
@actor.equip(@right_window.index, item == nil ? 0 : item.id)
# ライトウィンドウをアクティブ化
@right_window.active = true
@item_window.active = false
@item_window.index = -1
# ライトウィンドウ、アイテムウィンドウの内容を再作成
@right_window.refresh
@item_window.refresh
return
end
end
end
#=================================
#Scene_Equip Ends
#=================================

#=================================
#Window_Item modifications
#=================================
class Window_Item < Window_Selectable
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 = normal_color
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 == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
ya=item.name.dup
ya.delete!("0")
ya.delete!("1")
ya.delete!("2")
ya.delete!("3")
ya.delete!("4")
ya.delete!("5")
ya.delete!("6")
ya.delete!("7")
ya.delete!("8")
self.contents.draw_text(x + 28, y, 212, 32, ya, 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
#=================================
#Window_Item Ends
#=================================

#=================================
#Window_Selectable2
#=================================

class Window_Selectable2 < Window_Base
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_reader :index # カーソル位置
attr_reader :help_window # ヘルプウィンドウ
#--------------------------------------------------------------------------
# ● オブジェクト初期化
# x : ウィンドウの X 座標
# y : ウィンドウの Y 座標
# width : ウィンドウの幅
# height : ウィンドウの高さ
#--------------------------------------------------------------------------
def initialize(x, y, width, height)
super(x, y, width, height)
@item_max = 1
@column_max = 1
@index = -1
end
#--------------------------------------------------------------------------
# ● カーソル位置の設定
# index : 新しいカーソル位置
#--------------------------------------------------------------------------
def index=(index)
@index = index
# ヘルプテキストを更新 (update_help は継承先で定義される)
if self.active and @help_window != nil
update_help
end
# カーソルの矩形を更新
update_cursor_rect
end
#--------------------------------------------------------------------------
# ● 行数の取得
#--------------------------------------------------------------------------
def row_max
# 項目数と列数から行数を算出
return (@item_max + @column_max - 1) / @column_max
end
#--------------------------------------------------------------------------
# ● 先頭の行の取得
#--------------------------------------------------------------------------
def top_row
# ウィンドウ内容の転送元 Y 座標を、1 行の高さ 32 で割る
return self.oy / 32
end
#--------------------------------------------------------------------------
# ● 先頭の行の設定
# row : 先頭に表示する行
#--------------------------------------------------------------------------
def top_row=(row)
# row が 0 未満の場合は 0 に修正
if row < 0
row = 0
end
# row が row_max - 1 超の場合は row_max - 1 に修正
if row > row_max - 1
row = row_max - 1
end
# row に 1 行の高さ 32 を掛け、ウィンドウ内容の転送元 Y 座標とする
self.oy = row * 32
end
#--------------------------------------------------------------------------
# ● 1 ページに表示できる行数の取得
#--------------------------------------------------------------------------
def page_row_max
# ウィンドウの高さから、フレームの高さ 32 を引き、1 行の高さ 32 で割る
return (self.height - 32) / 32
end
#--------------------------------------------------------------------------
# ● 1 ページに表示できる項目数の取得
#--------------------------------------------------------------------------
def page_item_max
# 行数 page_row_max に 列数 @column_max を掛ける
return page_row_max * @column_max
end
#--------------------------------------------------------------------------
# ● ヘルプウィンドウの設定
# help_window : 新しいヘルプウィンドウ
#--------------------------------------------------------------------------
def help_window=(help_window)
@help_window = help_window
# ヘルプテキストを更新 (update_help は継承先で定義される)
if self.active and @help_window != nil
update_help
end
end
#--------------------------------------------------------------------------
# ● カーソルの矩形更新
#--------------------------------------------------------------------------
def update_cursor_rect
# カーソル位置が 0 未満の場合
if @index < 0
self.cursor_rect.empty
return
end
# 現在の行を取得
row = @index / @column_max
# 現在の行が、表示されている先頭の行より前の場合
if row < self.top_row
# 現在の行が先頭になるようにスクロール
self.top_row = row
end
# 現在の行が、表示されている最後尾の行より後ろの場合
if row > self.top_row + (self.page_row_max - 1)
# 現在の行が最後尾になるようにスクロール
self.top_row = row - (self.page_row_max - 1)
end
# カーソルの幅を計算
cursor_width = self.width / @column_max - 32
# カーソルの座標を計算
x = @index % @column_max * (cursor_width + 32)
y = @index / @column_max * 32 - self.oy
# カーソルの矩形を更新
self.cursor_rect.set(x, y, cursor_width, 32)
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
super
# カーソルの移動が可能な状態の場合
if self.active
# 方向ボタンの下が押された場合
if Input.repeat?(Input::DOWN)
@index = (@index + 1) % 10
end
# 方向ボタンの上が押された場合
if Input.repeat?(Input::UP)
@index = (@index - 1) % 10
end
# 方向ボタンの右が押された場合
if Input.repeat?(Input::RIGHT)
@index = (@index + 1) % 10
end
# 方向ボタンの左が押された場合
if Input.repeat?(Input::LEFT)
@index = (@index - 1) % 10
end
# R ボタンが押された場合
if Input.repeat?(Input::R)
# 表示されている最後尾の行が、データ上の最後の行よりも前の場合
if self.top_row + (self.page_row_max - 1) < (self.row_max - 1)
# カーソルを 1 ページ後ろに移動
$game_system.se_play($data_system.cursor_se)
@index = [@index + self.page_item_max, @item_max - 1].min
self.top_row += self.page_row_max
end
end
# L ボタンが押された場合
if Input.repeat?(Input::L)
# 表示されている先頭の行が 0 より後ろの場合
if self.top_row > 0
# カーソルを 1 ページ前に移動
$game_system.se_play($data_system.cursor_se)
@index = [@index - self.page_item_max, 0].max
self.top_row -= self.page_row_max
end
end
end
# ヘルプテキストを更新 (update_help は継承先で定義される)
if self.active and @help_window != nil
update_help
end
# カーソルの矩形を更新
update_cursor_rect
refresh
end
end
#=================================
#Window_Selectable2 Ends
#=================================

#=================================
#Window_EquipLeft replacement
#=================================

class Window_EquipLeft < Window_Base
#--------------------------------------------------------------------------
# ● オブジェクト初期化
# actor : アクター
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 64, 272, 192)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
self.contents.clear
bitmap = RPG::Cache.character(@actor.character_name, @actor.character_hue)
cw = bitmap.width / 4
ch = bitmap.height / 4
src_rect = Rect.new(0, 0, cw, ch)
$adjust=0 if $adjust==nil
self.contents.blt(120 - cw / 2, 48 - ch-$adjust, bitmap, src_rect)
draw_actor_name(@actor, 4, 0-$adjust)
draw_actor_name(@actor, 4, 160-$adjust)
draw_actor_level(@actor, 4, 32-$adjust)
draw_actor_parameter(@actor, 4, 64-$adjust, 0)
draw_actor_parameter(@actor, 4, 96-$adjust, 1)
draw_actor_parameter(@actor, 4, 128-$adjust, 2)
draw_actor_parameter(@actor, 4, 160+32-$adjust, 3)
draw_actor_parameter(@actor, 4, 192+32-$adjust, 4)
draw_actor_parameter(@actor, 4, 224+32-$adjust, 5)
draw_actor_parameter(@actor, 4, 256+32-$adjust, 6)

if @new_atk != nil
self.contents.font.color = system_color
self.contents.draw_text(160, 64-$adjust, 40, 32, "→", 1)
self.contents.font.color = normal_color
self.contents.draw_text(200, 64-$adjust, 36, 32, @new_atk.to_s, 2)
if @new_atk>@actor.atk
bitmap = RPG::Cache.picture("equip")
cw = bitmap.width / 2
ch = bitmap.height / 2
src_rect = Rect.new(0, 0, cw, ch-1)
self.contents.blt(180, 32+42-$adjust, bitmap, src_rect)
elsif @new_atk<@actor.atk
bitmap = RPG::Cache.picture("equip")
cw = bitmap.width / 2
ch = bitmap.height / 2
src_rect = Rect.new(0+cw, 0, cw, ch-1)
self.contents.blt(180, 32+42-$adjust, bitmap, src_rect)
else
bitmap = RPG::Cache.picture("equip")
cw = bitmap.width / 2
ch = bitmap.height / 2
src_rect = Rect.new(0, 0+ch, cw, ch-1)
self.contents.blt(180, 32+42-$adjust, bitmap, src_rect)
end
end

if @new_pdef != nil
self.contents.font.color = system_color
self.contents.draw_text(160, 96-$adjust, 40, 32, "→", 1)
self.contents.font.color = normal_color
self.contents.draw_text(200, 96-$adjust, 36, 32, @new_pdef.to_s, 2)
if @new_pdef>@actor.pdef
bitmap = RPG::Cache.picture("equip")
cw = bitmap.width / 2
ch = bitmap.height / 2
src_rect = Rect.new(0, 0, cw, ch-1)
self.contents.blt(180, 64+42-$adjust, bitmap, src_rect)
elsif @new_pdef<@actor.pdef
bitmap = RPG::Cache.picture("equip")
cw = bitmap.width / 2
ch = bitmap.height / 2
src_rect = Rect.new(0+cw, 0, cw, ch-1)
self.contents.blt(180, 64+42-$adjust, bitmap, src_rect)
else
bitmap = RPG::Cache.picture("equip")
cw = bitmap.width / 2
ch = bitmap.height / 2
src_rect = Rect.new(0, 0+ch, cw, ch-1)
self.contents.blt(180, 64+42-$adjust, bitmap, src_rect)
end
end

if @new_mdef != nil
self.contents.font.color = system_color
self.contents.draw_text(160, 128-$adjust, 40, 32, "→", 1)
self.contents.font.color = normal_color
self.contents.draw_text(200, 128-$adjust, 36, 32, @new_mdef.to_s, 2)
if @new_mdef>@actor.mdef
bitmap = RPG::Cache.picture("equip")
cw = bitmap.width / 2
ch = bitmap.height / 2
src_rect = Rect.new(0, 0, cw, ch-1)
self.contents.blt(180, 96+42-$adjust, bitmap, src_rect)
elsif @new_mdef<@actor.mdef
bitmap = RPG::Cache.picture("equip")
cw = bitmap.width / 2
ch = bitmap.height / 2
src_rect = Rect.new(0+cw, 0, cw, ch-1)
self.contents.blt(180, 96+42-$adjust, bitmap, src_rect)
else
bitmap = RPG::Cache.picture("equip")
cw = bitmap.width / 2
ch = bitmap.height / 2
src_rect = Rect.new(0, 0+ch, cw, ch-1)
self.contents.blt(180, 96+42-$adjust, bitmap, src_rect)
end
end

if @new_str != nil
self.contents.font.color = system_color
self.contents.draw_text(160, 128+32-$adjust+32, 40, 32, "→", 1)
self.contents.font.color = normal_color
self.contents.draw_text(200, 128+32-$adjust+32, 36, 32, @new_str.to_s, 2)
if @new_str>@actor.str
bitmap = RPG::Cache.picture("equip")
cw = bitmap.width / 2
ch = bitmap.height / 2
src_rect = Rect.new(0, 0, cw, ch-1)
self.contents.blt(180, 96+42+32-$adjust+32, bitmap, src_rect)
elsif @new_str<@actor.str
bitmap = RPG::Cache.picture("equip")
cw = bitmap.width / 2
ch = bitmap.height / 2
src_rect = Rect.new(0+cw, 0, cw, ch-1)
self.contents.blt(180, 96+42+32-$adjust+32, bitmap, src_rect)
else
bitmap = RPG::Cache.picture("equip")
cw = bitmap.width / 2
ch = bitmap.height / 2
src_rect = Rect.new(0, 0+ch, cw, ch-1)
self.contents.blt(180, 96+42+32-$adjust+32, bitmap, src_rect)
end
end

if @new_dex != nil
self.contents.font.color = system_color
self.contents.draw_text(160, 128+64-$adjust+32, 40, 32, "→", 1)
self.contents.font.color = normal_color
self.contents.draw_text(200, 128+64-$adjust+32, 36, 32, @new_dex.to_s, 2)
if @new_dex>@actor.dex
bitmap = RPG::Cache.picture("equip")
cw = bitmap.width / 2
ch = bitmap.height / 2
src_rect = Rect.new(0, 0, cw, ch-1)
self.contents.blt(180, 96+42+64-$adjust+32, bitmap, src_rect)
elsif @new_dex<@actor.dex
bitmap = RPG::Cache.picture("equip")
cw = bitmap.width / 2
ch = bitmap.height / 2
src_rect = Rect.new(0+cw, 0, cw, ch-1)
self.contents.blt(180, 96+42+64-$adjust+32, bitmap, src_rect)
else
bitmap = RPG::Cache.picture("equip")
cw = bitmap.width / 2
ch = bitmap.height / 2
src_rect = Rect.new(0, 0+ch, cw, ch-1)
self.contents.blt(180, 96+42+64-$adjust+32, bitmap, src_rect)
end
end

if @new_agi != nil
self.contents.font.color = system_color
self.contents.draw_text(160, 128+96-$adjust+32, 40, 32, "→", 1)
self.contents.font.color = normal_color
self.contents.draw_text(200, 128+96-$adjust+32, 36, 32, @new_agi.to_s, 2)
if @new_agi>@actor.agi
bitmap = RPG::Cache.picture("equip")
cw = bitmap.width / 2
ch = bitmap.height / 2
src_rect = Rect.new(0, 0, cw, ch-1)
self.contents.blt(180, 96+96+42-$adjust+32, bitmap, src_rect)
elsif @new_agi<@actor.agi
bitmap = RPG::Cache.picture("equip")
cw = bitmap.width / 2
ch = bitmap.height / 2
src_rect = Rect.new(0+cw, 0, cw, ch-1)
self.contents.blt(180, 96+96+42-$adjust+32, bitmap, src_rect)
else
bitmap = RPG::Cache.picture("equip")
cw = bitmap.width / 2
ch = bitmap.height / 2
src_rect = Rect.new(0, 0+ch, cw, ch-1)
self.contents.blt(180, 96+96+42-$adjust+32, bitmap, src_rect)
end
end

if @new_int != nil
self.contents.font.color = system_color
self.contents.draw_text(160, 128+128-$adjust+32, 40, 32, "→", 1)
self.contents.font.color = normal_color
self.contents.draw_text(200, 128+128-$adjust+32, 36, 32, @new_int.to_s, 2)
if @new_int>@actor.int
bitmap = RPG::Cache.picture("equip")
cw = bitmap.width / 2
ch = bitmap.height / 2
src_rect = Rect.new(0, 0, cw, ch-1)
self.contents.blt(180, 96+128+42-$adjust+32, bitmap, src_rect)
elsif @new_int<@actor.int
bitmap = RPG::Cache.picture("equip")
cw = bitmap.width / 2
ch = bitmap.height / 2
src_rect = Rect.new(0+cw, 0, cw, ch-1)
self.contents.blt(180, 96+128+42-$adjust+32, bitmap, src_rect)
else
bitmap = RPG::Cache.picture("equip")
cw = bitmap.width / 2
ch = bitmap.height / 2
src_rect = Rect.new(0, 0+ch, cw, ch-1)
self.contents.blt(180, 96+128+42-$adjust+32, bitmap, src_rect)
end
end
end
#--------------------------------------------------------------------------
# ● 装備変更後のパラメータ設定
# new_atk : 装備変更後の攻撃力
# new_pdef : 装備変更後の物理防御
# new_mdef : 装備変更後の魔法防御
#--------------------------------------------------------------------------
def set_new_parameters(new_atk, new_pdef, new_mdef,new_str,new_dex,new_agi,new_int)
if @new_atk != new_atk or @new_pdef != new_pdef or @new_mdef != new_mdef or @new_str != new_str or @new_dex !=new_dex or @new_agi !=new_agi or @new_int !=new_int
@new_atk = new_atk
@new_pdef = new_pdef
@new_mdef = new_mdef
@new_str = new_str
@new_dex = new_dex
@new_agi = new_agi
@new_int = new_int
refresh
end
end
end

#=================================
#Window_EquipLeft Ends
#=================================

#=================================
#Window_EquipRight replacement
#=================================

class Window_EquipRight < Window_Selectable2
#--------------------------------------------------------------------------
# ● オブジェクト初期化
# actor : アクター
#--------------------------------------------------------------------------
def initialize(actor)
super(272, 64, 368, 192+224)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype # "Equip" right side (Equiped Items) window font
self.contents.font.size = $defaultfontsize
@actor = actor
$bit=Sprite.new
$bit.bitmap=RPG::Cache.battler("001-Fighter01 kopiera", 0)
$bit.x=400
$bit.y=80
$bit.z=100
$bit.zoom_x=2
$bit.zoom_y=2
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# ● アイテムの取得
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
self.contents.clear

@data = []
@data.push($data_armors[@actor.armor1_id])
@data.push($data_armors[@actor.armor2_id])
@data.push($data_armors[@actor.armor3_id])
@data.push($data_weapons[@actor.weapon_id])
@data.push($data_armors[@actor.armor4_id])
@data.push($data_armors[@actor.armor5_id])
@data.push($data_armors[@actor.armor6_id])
@data.push($data_armors[@actor.armor7_id])
@data.push($data_armors[@actor.armor8_id])
@data.push($data_armors[@actor.armor9_id])
@item_max = @data.size
@items=["Helmet","Earrings","Necklace","Weapon","Covering Armor","Arm Pads","Underlying Armor","Shield","Leg Pads", "Shoes"]
self.contents.font.color = system_color
if $data_armors[@actor.armor1_id] != nil
draw_item_name(@data[0], 32, 32 * 1)
else
self.contents.draw_text(32, 32 * 1, 92, 32, "Helmet")
end
if $data_armors[@actor.armor2_id] != nil
draw_item_name(@data[1], 32, 32 * 2)
else
self.contents.draw_text(32, 32 * 2, 92, 32, "Earrings")
end
if $data_armors[@actor.armor3_id] != nil
draw_item_name(@data[2], 32, 32 * 3)
else
self.contents.draw_text(32, 32 * 3, 92, 32, "Necklace")
end
if $data_armors[@actor.weapon_id] != nil
draw_item_name(@data[3], 32, 32 * 4)
else
self.contents.draw_text(32, 32 * 4, 92, 32, "Weapon")
end
if $data_armors[@actor.armor4_id] != nil
draw_item_name(@data[4], 32, 32 * 5)
else
self.contents.draw_text(32, 32 * 5, 150, 32, "Covering Armor")
end
if $data_armors[@actor.armor5_id] != nil
draw_item_name(@data[5], 32, 32 * 6)
else
self.contents.draw_text(32, 32 * 6, 150, 32, "Underlying Armor")
end
if $data_armors[@actor.armor6_id] != nil
draw_item_name(@data[6],32, 32*7)
else
self.contents.draw_text(32, 32*7,92, 32, "Arm Pads")
end
if $data_armors[@actor.armor7_id] != nil
draw_item_name(@data[7], 32, 32 * 8)
else
self.contents.draw_text(32, 32 * 8, 92, 32, "Shield")
end
if $data_armors[@actor.armor8_id] != nil
draw_item_name(@data[8], 32, 32 * 9)
else
self.contents.draw_text(32, 32 * 9, 92, 32, "Leg Pads")
end
if $data_armors[@actor.armor9_id] != nil
draw_item_name(@data[9], 32, 32 * 10)
else
self.contents.draw_text(32, 32 * 10, 92, 32, "Shoes")
end
update_cursor_rect
bitmap = RPG::Cache.picture("equip")
cw = bitmap.width / 2
ch = bitmap.height / 2
src_rect = Rect.new(0+cw, 0+ch, cw, ch)
self.contents.blt(@x2, @y2, bitmap, src_rect)
end
#--------------------------------------------------------------------------
# ● ヘルプテキスト更新
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end

def update_cursor_rect
case self.index
when 0
@x=32
@y=32
@x2=232
@y2=0
when 1
@x=32
@y=64
@x2=268
@y2=32
when 2
@x=32
@y=96
@x2=232
@y2=64
when 3
@x=32
@y=128
@x2=132
@y2=70
when 4
@x=32
@y=160
@x2=232
@y2=96
when 5
@x=32
@y=192
@x2=232
@y2=112
when 6
@x=32
@y=224
@x2=192
@y2=112
when 7
@x=32
@y=256
@x2=288
@y2=112
when 8
@x=32
@y=288
@x2=244
@y2=200
when 9
@x=32
@y=320
@x2=244
@y2=288
else
@x=0
@y=-32
@x2=0
@y2=-32
end

# カーソルの座標を計算
# カーソルの矩形を更新
cursor_width= 175
self.cursor_rect.set(@x-32, @y, cursor_width, 32)
end

def draw_item_name(item, x, y)
if item == nil
return
end
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.blt(x-32, y + 4, bitmap, Rect.new(0, 0, 24, 24))
self.contents.font.color = normal_color
ya=item.name.dup
ya.delete!("0")
ya.delete!("1")
ya.delete!("2")
ya.delete!("3")
ya.delete!("4")
ya.delete!("5")
ya.delete!("6")
ya.delete!("7")
ya.delete!("8")

self.contents.draw_text(x-4, y, 114, 32, ya)
self.contents.font.color = system_color
end
end

#=================================
#Window_EquipRight Ends
#=================================

#=================================
#Window_EquipItem replacement
#=================================
#==============================================================================
# ■ Window_EquipItem
#------------------------------------------------------------------------------
#  装備画面で、装備変更の候補となるアイテムの一覧を表示するウィンドウです。
#==============================================================================

class Window_EquipItem < Window_Selectable
#--------------------------------------------------------------------------
# ● オブジェクト初期化
# actor : アクター
# equip_type : 装備部位 (0~3)
#--------------------------------------------------------------------------
def initialize(actor, equip_type)
super(0, 256, 272, 224)
@actor = actor
@equip_type = equip_type
@column_max = 1
refresh
self.active = false
self.index = -1
end
#--------------------------------------------------------------------------
# ● アイテムの取得
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
# 装備可能な武器を追加
if @equip_type == 3
weapon_set = $data_classes[@actor.class_id].weapon_set
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0 and weapon_set.include?(i)
@data.push($data_weapons[i])
end
end
end
# 装備可能な防具を追加
if @equip_type != 3
armor_set = $data_classes[@actor.class_id].armor_set
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0 and armor_set.include?(i)

if @equip_type >3
ha=(@equip_type-1).to_s
@data.push($data_armors[i]) if $data_armors[i].name.include?(ha)
else
ha=@equip_type.to_s
@data.push($data_armors[i]) if $data_armors[i].name.include?(ha)
end
end
end
end
# 空白を追加
@data.push(nil)
# ビットマップを作成し、全項目を描画
@item_max = @data.size
self.contents = Bitmap.new(width - 32, row_max * 32)
self.contents.font.name = $defaultfonttype # "Equip" bottom (Item List) window font
self.contents.font.size = $defaultfontsize
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# ● 項目の描画
# index : 項目番号
#--------------------------------------------------------------------------
def draw_item(index)
@item = @data[index]
if @item != nil
#p @item
@yal=@item.name.dup
end
x = 4
y = index * 32
case @item
when RPG::Weapon
number = $game_party.weapon_number(@item.id)
when RPG::Armor
number = $game_party.armor_number(@item.id)
end
if @item==nil
self.contents.draw_text(x + 28, y, 212, 32, "Un-Equipped", 0)
else
bitmap = RPG::Cache.icon(@item.icon_name)
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
self.contents.font.color = normal_color
if @equip_type<3
ha=@equip_type.to_s
else
ha=(@equip_type-1).to_s
end
@yal.delete!(ha)
self.contents.draw_text(x + 28, y, 212, 32, @yal, 0)
self.contents.draw_text(x + 192, y, 16, 32, ":", 1)
self.contents.draw_text(x + 208, y, 24, 32, number.to_s, 2)
end
end
#--------------------------------------------------------------------------
# ● ヘルプテキスト更新
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end

#=================================
#Window_EquipItem Ends
#=================================

#=================================
#Game_Actor replacement
#=================================
#==============================================================================
# ■ Game_Actor
#------------------------------------------------------------------------------
#  アクターを扱うクラスです。このクラスは Game_Actors クラス ($game_actors)
# の内部で使用され、Game_Party クラス ($game_party) からも参照されます。
#==============================================================================

class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_reader :name # 名前
attr_reader :character_name # キャラクター ファイル名
attr_reader :character_hue # キャラクター 色相
attr_reader :class_id # クラス ID
attr_reader :weapon_id # 武器 ID
attr_reader :armor1_id # 盾 ID
attr_reader :armor2_id # 頭防具 ID
attr_reader :armor3_id # 体防具 ID
attr_reader :armor4_id # 装飾品 ID
attr_reader :armor5_id # 盾 ID
attr_reader :armor6_id # 頭防具 ID
attr_reader :armor7_id # 体防具 ID
attr_reader :armor8_id # 装飾品 ID
attr_reader :armor9_id # 装飾品 ID
attr_reader :level # レベル
attr_reader :exp # EXP
attr_reader :skills # スキル
#--------------------------------------------------------------------------
# ● オブジェクト初期化
# actor_id : アクター ID
#--------------------------------------------------------------------------
def initialize(actor_id)
super()
setup(actor_id)
end
#--------------------------------------------------------------------------
# ● セットアップ
# actor_id : アクター ID
#--------------------------------------------------------------------------
def setup(actor_id)
actor = $data_actors[actor_id]
@actor_id = actor_id
@name = actor.name
@character_name = actor.character_name
@character_hue = actor.character_hue
@battler_name = actor.battler_name
@battler_hue = actor.battler_hue
@class_id = actor.class_id
@items=["Helmet","Earrings","Necklace","Weapon","Covering Armor","Arm Pads","Underlying Armor","Shield","Leg Pads", "Shoes"]
@weapon_id = actor.weapon_id
@armor1_id = actor.armor2_id
@armor2_id = actor.armor4_id
@armor3_id = 0
@armor4_id = actor.armor3_id
@armor5_id = 0
@armor6_id = 0
@armor7_id = actor.armor1_id
@armor8_id = 0
@armor9_id = 0
@level = actor.initial_level
@exp_list = Array.new(101)
make_exp_list
@exp = @exp_list[@level]
@skills = []
@hp = maxhp
@sp = maxsp
@states = []
@states_turn = {}
@maxhp_plus = 0
@maxsp_plus = 0
@str_plus = 0
@dex_plus = 0
@agi_plus = 0
@int_plus = 0
# スキル習得
for i in 1..@level
for j in $data_classes[@class_id].learnings
if j.level == i
learn_skill(j.skill_id)
end
end
end
# オートステートを更新
update_auto_state(nil, $data_armors[@armor1_id])
update_auto_state(nil, $data_armors[@armor2_id])
update_auto_state(nil, $data_armors[@armor3_id])
update_auto_state(nil, $data_armors[@armor4_id])
update_auto_state(nil, $data_armors[@armor5_id])
update_auto_state(nil, $data_armors[@armor6_id])
update_auto_state(nil, $data_armors[@armor7_id])
update_auto_state(nil, $data_armors[@armor8_id])
update_auto_state(nil, $data_armors[@armor9_id])
end
#--------------------------------------------------------------------------
# ● アクター ID 取得
#--------------------------------------------------------------------------
def id
return @actor_id
end
#--------------------------------------------------------------------------
# ● インデックス取得
#--------------------------------------------------------------------------
def index
return $game_party.actors.index(self)
end
#--------------------------------------------------------------------------
# ● EXP 計算
#--------------------------------------------------------------------------
def make_exp_list
actor = $data_actors[@actor_id]
@exp_list[1] = 0
pow_i = 2.4 + actor.exp_inflation / 100.0
for i in 2..100
if i > actor.final_level
@exp_list[i] = 0
else
n = actor.exp_basis * ((i + 3) ** pow_i) / (5 ** pow_i)
@exp_list[i] = @exp_list[i-1] + Integer(n)
end
end
end
#--------------------------------------------------------------------------
# ● 属性補正値の取得
# element_id : 属性 ID
#--------------------------------------------------------------------------
def element_rate(element_id)
# 属性有効度に対応する数値を取得
table = [0,200,150,100,50,0,-100]
result = table[$data_classes[@class_id].element_ranks[element_id]]
# 防具でこの属性が防御されている場合は半減
for i in [@armor1_id, @armor2_id, @armor3_id, @armor4_id,@armor5_id,@armor6_id,@armor7_id,@armor8_id,@armor9_id]
armor = $data_armors[i]
if armor != nil and armor.guard_element_set.include?(element_id)
result /= 2
end
end
# ステートでこの属性が防御されている場合は半減
for i in @states
if $data_states[i].guard_element_set.include?(element_id)
result /= 2
end
end
# メソッド終了
return result
end
#--------------------------------------------
Spanciai
Spanciai

Data d'iscrizione : 08.07.11
Età : 40
Località : Tap Mountain

Torna in alto Andare in basso

Torna in alto


 
Permessi in questa sezione del forum:
Non puoi rispondere agli argomenti in questo forum.