Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================
- # ■ Game_Actor
- #------------------------------------------------------------------------------
- # アクターを扱うクラスです。このクラスは Game_Actors クラス ($game_actors)
- # の内部で使用され、Game_Party クラス ($game_party) からも参照されます。
- #==============================================================================
- class Game_Actor < Game_Battler
- #--------------------------------------------------------------------------
- # ● 公開インスタンス変数
- #--------------------------------------------------------------------------
- # EDIT
- #==============================================================================
- attr_reader :actor_id
- attr_accessor :mandatory
- attr_accessor :unavailable
- #==============================================================================
- # END EDIT
- 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 :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)
- # EDIT
- #==============================================================================
- mandatory = false
- unavailable = false
- #==============================================================================
- # END EDIT
- 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
- @weapon_id = actor.weapon_id
- @armor1_id = actor.armor1_id
- @armor2_id = actor.armor2_id
- @armor3_id = actor.armor3_id
- @armor4_id = actor.armor4_id
- @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])
- 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]
- 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
- #--------------------------------------------------------------------------
- # ● ステート有効度の取得
- #--------------------------------------------------------------------------
- def state_ranks
- return $data_classes[@class_id].state_ranks
- end
- #--------------------------------------------------------------------------
- # ● ステート防御判定
- # state_id : ステート ID
- #--------------------------------------------------------------------------
- def state_guard?(state_id)
- for i in [@armor1_id, @armor2_id, @armor3_id, @armor4_id]
- armor = $data_armors[i]
- if armor != nil
- if armor.guard_state_set.include?(state_id)
- return true
- end
- end
- end
- return false
- end
- #--------------------------------------------------------------------------
- # ● 通常攻撃の属性取得
- #--------------------------------------------------------------------------
- def element_set
- weapon = $data_weapons[@weapon_id]
- return weapon != nil ? weapon.element_set : []
- end
- #--------------------------------------------------------------------------
- # ● 通常攻撃のステート変化 (+) 取得
- #--------------------------------------------------------------------------
- def plus_state_set
- weapon = $data_weapons[@weapon_id]
- return weapon != nil ? weapon.plus_state_set : []
- end
- #--------------------------------------------------------------------------
- # ● 通常攻撃のステート変化 (-) 取得
- #--------------------------------------------------------------------------
- def minus_state_set
- weapon = $data_weapons[@weapon_id]
- return weapon != nil ? weapon.minus_state_set : []
- end
- #--------------------------------------------------------------------------
- # ● MaxHP の取得
- #--------------------------------------------------------------------------
- def maxhp
- n = [[base_maxhp + @maxhp_plus, 1].max, 9999].min
- for i in @states
- n *= $data_states[i].maxhp_rate / 100.0
- end
- n = [[Integer(n), 1].max, 9999].min
- return n
- end
- #--------------------------------------------------------------------------
- # ● 基本 MaxHP の取得
- #--------------------------------------------------------------------------
- def base_maxhp
- return $data_actors[@actor_id].parameters[0, @level]
- end
- #--------------------------------------------------------------------------
- # ● 基本 MaxSP の取得
- #--------------------------------------------------------------------------
- def base_maxsp
- return $data_actors[@actor_id].parameters[1, @level]
- end
- #--------------------------------------------------------------------------
- # ● 基本腕力の取得
- #--------------------------------------------------------------------------
- def base_str
- n = $data_actors[@actor_id].parameters[2, @level]
- weapon = $data_weapons[@weapon_id]
- armor1 = $data_armors[@armor1_id]
- armor2 = $data_armors[@armor2_id]
- armor3 = $data_armors[@armor3_id]
- armor4 = $data_armors[@armor4_id]
- n += weapon != nil ? weapon.str_plus : 0
- n += armor1 != nil ? armor1.str_plus : 0
- n += armor2 != nil ? armor2.str_plus : 0
- n += armor3 != nil ? armor3.str_plus : 0
- n += armor4 != nil ? armor4.str_plus : 0
- return [[n, 1].max, 999].min
- end
- #--------------------------------------------------------------------------
- # ● 基本器用さの取得
- #--------------------------------------------------------------------------
- def base_dex
- n = $data_actors[@actor_id].parameters[3, @level]
- weapon = $data_weapons[@weapon_id]
- armor1 = $data_armors[@armor1_id]
- armor2 = $data_armors[@armor2_id]
- armor3 = $data_armors[@armor3_id]
- armor4 = $data_armors[@armor4_id]
- n += weapon != nil ? weapon.dex_plus : 0
- n += armor1 != nil ? armor1.dex_plus : 0
- n += armor2 != nil ? armor2.dex_plus : 0
- n += armor3 != nil ? armor3.dex_plus : 0
- n += armor4 != nil ? armor4.dex_plus : 0
- return [[n, 1].max, 999].min
- end
- #--------------------------------------------------------------------------
- # ● 基本素早さの取得
- #--------------------------------------------------------------------------
- def base_agi
- n = $data_actors[@actor_id].parameters[4, @level]
- weapon = $data_weapons[@weapon_id]
- armor1 = $data_armors[@armor1_id]
- armor2 = $data_armors[@armor2_id]
- armor3 = $data_armors[@armor3_id]
- armor4 = $data_armors[@armor4_id]
- n += weapon != nil ? weapon.agi_plus : 0
- n += armor1 != nil ? armor1.agi_plus : 0
- n += armor2 != nil ? armor2.agi_plus : 0
- n += armor3 != nil ? armor3.agi_plus : 0
- n += armor4 != nil ? armor4.agi_plus : 0
- return [[n, 1].max, 999].min
- end
- #--------------------------------------------------------------------------
- # ● 基本魔力の取得
- #--------------------------------------------------------------------------
- def base_int
- n = $data_actors[@actor_id].parameters[5, @level]
- weapon = $data_weapons[@weapon_id]
- armor1 = $data_armors[@armor1_id]
- armor2 = $data_armors[@armor2_id]
- armor3 = $data_armors[@armor3_id]
- armor4 = $data_armors[@armor4_id]
- n += weapon != nil ? weapon.int_plus : 0
- n += armor1 != nil ? armor1.int_plus : 0
- n += armor2 != nil ? armor2.int_plus : 0
- n += armor3 != nil ? armor3.int_plus : 0
- n += armor4 != nil ? armor4.int_plus : 0
- return [[n, 1].max, 999].min
- end
- #--------------------------------------------------------------------------
- # ● 基本攻撃力の取得
- #--------------------------------------------------------------------------
- def base_atk
- weapon = $data_weapons[@weapon_id]
- return weapon != nil ? weapon.atk : 0
- end
- #--------------------------------------------------------------------------
- # ● 基本物理防御の取得
- #--------------------------------------------------------------------------
- def base_pdef
- weapon = $data_weapons[@weapon_id]
- armor1 = $data_armors[@armor1_id]
- armor2 = $data_armors[@armor2_id]
- armor3 = $data_armors[@armor3_id]
- armor4 = $data_armors[@armor4_id]
- pdef1 = weapon != nil ? weapon.pdef : 0
- pdef2 = armor1 != nil ? armor1.pdef : 0
- pdef3 = armor2 != nil ? armor2.pdef : 0
- pdef4 = armor3 != nil ? armor3.pdef : 0
- pdef5 = armor4 != nil ? armor4.pdef : 0
- return pdef1 + pdef2 + pdef3 + pdef4 + pdef5
- end
- #--------------------------------------------------------------------------
- # ● 基本魔法防御の取得
- #--------------------------------------------------------------------------
- def base_mdef
- weapon = $data_weapons[@weapon_id]
- armor1 = $data_armors[@armor1_id]
- armor2 = $data_armors[@armor2_id]
- armor3 = $data_armors[@armor3_id]
- armor4 = $data_armors[@armor4_id]
- mdef1 = weapon != nil ? weapon.mdef : 0
- mdef2 = armor1 != nil ? armor1.mdef : 0
- mdef3 = armor2 != nil ? armor2.mdef : 0
- mdef4 = armor3 != nil ? armor3.mdef : 0
- mdef5 = armor4 != nil ? armor4.mdef : 0
- return mdef1 + mdef2 + mdef3 + mdef4 + mdef5
- end
- #--------------------------------------------------------------------------
- # ● 基本回避修正の取得
- #--------------------------------------------------------------------------
- def base_eva
- armor1 = $data_armors[@armor1_id]
- armor2 = $data_armors[@armor2_id]
- armor3 = $data_armors[@armor3_id]
- armor4 = $data_armors[@armor4_id]
- eva1 = armor1 != nil ? armor1.eva : 0
- eva2 = armor2 != nil ? armor2.eva : 0
- eva3 = armor3 != nil ? armor3.eva : 0
- eva4 = armor4 != nil ? armor4.eva : 0
- return eva1 + eva2 + eva3 + eva4
- end
- #--------------------------------------------------------------------------
- # ● 通常攻撃 攻撃側アニメーション ID の取得
- #--------------------------------------------------------------------------
- def animation1_id
- weapon = $data_weapons[@weapon_id]
- return weapon != nil ? weapon.animation1_id : 0
- end
- #--------------------------------------------------------------------------
- # ● 通常攻撃 対象側アニメーション ID の取得
- #--------------------------------------------------------------------------
- def animation2_id
- weapon = $data_weapons[@weapon_id]
- return weapon != nil ? weapon.animation2_id : 0
- end
- #--------------------------------------------------------------------------
- # ● クラス名の取得
- #--------------------------------------------------------------------------
- def class_name
- return $data_classes[@class_id].name
- end
- #--------------------------------------------------------------------------
- # ● EXP の文字列取得
- #--------------------------------------------------------------------------
- def exp_s
- return @exp_list[@level+1] > 0 ? @exp.to_s : "-------"
- end
- #--------------------------------------------------------------------------
- # ● 次のレベルの EXP の文字列取得
- #--------------------------------------------------------------------------
- def next_exp_s
- return @exp_list[@level+1] > 0 ? @exp_list[@level+1].to_s : "-------"
- end
- #--------------------------------------------------------------------------
- # ● 次のレベルまでの EXP の文字列取得
- #--------------------------------------------------------------------------
- def next_rest_exp_s
- return @exp_list[@level+1] > 0 ?
- (@exp_list[@level+1] - @exp).to_s : "-------"
- end
- #--------------------------------------------------------------------------
- # ● オートステートの更新
- # old_armor : 外した防具
- # new_armor : 装備した防具
- #--------------------------------------------------------------------------
- def update_auto_state(old_armor, new_armor)
- # 外した防具のオートステートを強制解除
- if old_armor != nil and old_armor.auto_state_id != 0
- remove_state(old_armor.auto_state_id, true)
- end
- # 装備した防具のオートステートを強制付加
- if new_armor != nil and new_armor.auto_state_id != 0
- add_state(new_armor.auto_state_id, true)
- end
- end
- #--------------------------------------------------------------------------
- # ● 装備固定判定
- # equip_type : 装備タイプ
- #--------------------------------------------------------------------------
- def equip_fix?(equip_type)
- case equip_type
- when 0 # 武器
- return $data_actors[@actor_id].weapon_fix
- when 1 # 盾
- return $data_actors[@actor_id].armor1_fix
- when 2 # 頭
- return $data_actors[@actor_id].armor2_fix
- when 3 # 身体
- return $data_actors[@actor_id].armor3_fix
- when 4 # 装飾品
- return $data_actors[@actor_id].armor4_fix
- end
- return false
- end
- #--------------------------------------------------------------------------
- # ● 装備の変更
- # equip_type : 装備タイプ
- # id : 武器 or 防具 ID (0 なら装備解除)
- #--------------------------------------------------------------------------
- def equip(equip_type, id)
- case equip_type
- when 0 # 武器
- if id == 0 or $game_party.weapon_number(id) > 0
- $game_party.gain_weapon(@weapon_id, 1)
- @weapon_id = id
- $game_party.lose_weapon(id, 1)
- end
- when 1 # 盾
- if id == 0 or $game_party.armor_number(id) > 0
- update_auto_state($data_armors[@armor1_id], $data_armors[id])
- $game_party.gain_armor(@armor1_id, 1)
- @armor1_id = id
- $game_party.lose_armor(id, 1)
- end
- when 2 # 頭
- if id == 0 or $game_party.armor_number(id) > 0
- update_auto_state($data_armors[@armor2_id], $data_armors[id])
- $game_party.gain_armor(@armor2_id, 1)
- @armor2_id = id
- $game_party.lose_armor(id, 1)
- end
- when 3 # 身体
- if id == 0 or $game_party.armor_number(id) > 0
- update_auto_state($data_armors[@armor3_id], $data_armors[id])
- $game_party.gain_armor(@armor3_id, 1)
- @armor3_id = id
- $game_party.lose_armor(id, 1)
- end
- when 4 # 装飾品
- if id == 0 or $game_party.armor_number(id) > 0
- update_auto_state($data_armors[@armor4_id], $data_armors[id])
- $game_party.gain_armor(@armor4_id, 1)
- @armor4_id = id
- $game_party.lose_armor(id, 1)
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 装備可能判定
- # item : アイテム
- #--------------------------------------------------------------------------
- def equippable?(item)
- # 武器の場合
- if item.is_a?(RPG::Weapon)
- # 現在のクラスの装備可能な武器に含まれている場合
- if $data_classes[@class_id].weapon_set.include?(item.id)
- return true
- end
- end
- # 防具の場合
- if item.is_a?(RPG::Armor)
- # 現在のクラスの装備可能な防具に含まれている場合
- if $data_classes[@class_id].armor_set.include?(item.id)
- return true
- end
- end
- return false
- end
- #--------------------------------------------------------------------------
- # ● EXP の変更
- # exp : 新しい EXP
- #--------------------------------------------------------------------------
- def exp=(exp)
- @exp = [[exp, 9999999].min, 0].max
- # レベルアップ
- while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
- @level += 1
- # スキル習得
- for j in $data_classes[@class_id].learnings
- if j.level == @level
- learn_skill(j.skill_id)
- end
- end
- end
- # レベルダウン
- while @exp < @exp_list[@level]
- @level -= 1
- end
- # 現在の HP と SP が最大値を超えていたら修正
- @hp = [@hp, self.maxhp].min
- @sp = [@sp, self.maxsp].min
- end
- #--------------------------------------------------------------------------
- # ● レベルの変更
- # level : 新しいレベル
- #--------------------------------------------------------------------------
- def level=(level)
- # 上下限チェック
- level = [[level, $data_actors[@actor_id].final_level].min, 1].max
- # EXP を変更
- self.exp = @exp_list[level]
- end
- #--------------------------------------------------------------------------
- # ● スキルを覚える
- # skill_id : スキル ID
- #--------------------------------------------------------------------------
- def learn_skill(skill_id)
- if skill_id > 0 and not skill_learn?(skill_id)
- @skills.push(skill_id)
- @skills.sort!
- end
- end
- #--------------------------------------------------------------------------
- # ● スキルを忘れる
- # skill_id : スキル ID
- #--------------------------------------------------------------------------
- def forget_skill(skill_id)
- @skills.delete(skill_id)
- end
- #--------------------------------------------------------------------------
- # ● スキルの習得済み判定
- # skill_id : スキル ID
- #--------------------------------------------------------------------------
- def skill_learn?(skill_id)
- return @skills.include?(skill_id)
- end
- #--------------------------------------------------------------------------
- # ● スキルの使用可能判定
- # skill_id : スキル ID
- #--------------------------------------------------------------------------
- def skill_can_use?(skill_id)
- if not skill_learn?(skill_id)
- return false
- end
- return super
- end
- #--------------------------------------------------------------------------
- # ● 名前の変更
- # name : 新しい名前
- #--------------------------------------------------------------------------
- def name=(name)
- @name = name
- end
- #--------------------------------------------------------------------------
- # ● クラス ID の変更
- # class_id : 新しいクラス ID
- #--------------------------------------------------------------------------
- def class_id=(class_id)
- if $data_classes[class_id] != nil
- @class_id = class_id
- # 装備できなくなったアイテムを外す
- unless equippable?($data_weapons[@weapon_id])
- equip(0, 0)
- end
- unless equippable?($data_armors[@armor1_id])
- equip(1, 0)
- end
- unless equippable?($data_armors[@armor2_id])
- equip(2, 0)
- end
- unless equippable?($data_armors[@armor3_id])
- equip(3, 0)
- end
- unless equippable?($data_armors[@armor4_id])
- equip(4, 0)
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● グラフィックの変更
- # character_name : 新しいキャラクター ファイル名
- # character_hue : 新しいキャラクター 色相
- # battler_name : 新しいバトラー ファイル名
- # battler_hue : 新しいバトラー 色相
- #--------------------------------------------------------------------------
- def set_graphic(character_name, character_hue, battler_name, battler_hue)
- @character_name = character_name
- @character_hue = character_hue
- @battler_name = battler_name
- @battler_hue = battler_hue
- end
- #--------------------------------------------------------------------------
- # ● バトル画面 X 座標の取得
- #--------------------------------------------------------------------------
- def screen_x
- # パーティ内の並び順から X 座標を計算して返す
- if self.index != nil
- return self.index * 160 + 80
- else
- return 0
- end
- end
- #--------------------------------------------------------------------------
- # ● バトル画面 Y 座標の取得
- #--------------------------------------------------------------------------
- def screen_y
- return 464
- end
- #--------------------------------------------------------------------------
- # ● バトル画面 Z 座標の取得
- #--------------------------------------------------------------------------
- def screen_z
- # パーティ内の並び順から Z 座標を計算して返す
- if self.index != nil
- return 4 - self.index
- else
- return 0
- end
- end
- end
- #==============================================================================
- # ■ Game_Actors
- #------------------------------------------------------------------------------
- # アクターの配列を扱うクラスです。このクラスのインスタンスは $game_actors で
- # 参照されます。
- #==============================================================================
- class Game_Actors
- # EDIT
- #==============================================================================
- attr_accessor :data
- #==============================================================================
- # END EDIT
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- def initialize
- @data = []
- end
- #--------------------------------------------------------------------------
- # ● アクターの取得
- # actor_id : アクター ID
- #--------------------------------------------------------------------------
- def [](actor_id)
- if actor_id > 999 or $data_actors[actor_id] == nil
- return nil
- end
- if @data[actor_id] == nil
- @data[actor_id] = Game_Actor.new(actor_id)
- end
- return @data[actor_id]
- end
- end
- #==============================================================================
- # ■ Game_Party
- #------------------------------------------------------------------------------
- # パーティを扱うクラスです。ゴールドやアイテムなどの情報が含まれます。このク
- # ラスのインスタンスは $game_party で参照されます。
- #==============================================================================
- class Game_Party
- #--------------------------------------------------------------------------
- # ● 公開インスタンス変数
- #--------------------------------------------------------------------------
- # EDIT
- #==============================================================================
- attr_accessor :actors
- #==============================================================================
- # END EDIT
- attr_reader :gold # ゴールド
- attr_reader :steps # 歩数
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- def initialize
- # アクターの配列を作成
- @actors = []
- # ゴールドと歩数を初期化
- @gold = 0
- @steps = 0
- # アイテム、武器、防具の所持数ハッシュを作成
- @items = {}
- @weapons = {}
- @armors = {}
- end
- #--------------------------------------------------------------------------
- # ● 初期パーティのセットアップ
- #--------------------------------------------------------------------------
- def setup_starting_members
- @actors = []
- for i in $data_system.party_members
- @actors.push($game_actors[i])
- end
- end
- #--------------------------------------------------------------------------
- # ● 戦闘テスト用パーティのセットアップ
- #--------------------------------------------------------------------------
- def setup_battle_test_members
- @actors = []
- for battler in $data_system.test_battlers
- actor = $game_actors[battler.actor_id]
- actor.level = battler.level
- gain_weapon(battler.weapon_id, 1)
- gain_armor(battler.armor1_id, 1)
- gain_armor(battler.armor2_id, 1)
- gain_armor(battler.armor3_id, 1)
- gain_armor(battler.armor4_id, 1)
- actor.equip(0, battler.weapon_id)
- actor.equip(1, battler.armor1_id)
- actor.equip(2, battler.armor2_id)
- actor.equip(3, battler.armor3_id)
- actor.equip(4, battler.armor4_id)
- actor.recover_all
- @actors.push(actor)
- end
- @items = {}
- for i in 1...$data_items.size
- if $data_items[i].name != ""
- occasion = $data_items[i].occasion
- if occasion == 0 or occasion == 1
- @items[i] = 99
- end
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● パーティメンバーのリフレッシュ
- #--------------------------------------------------------------------------
- def refresh
- # ゲームデータをロードした直後はアクターオブジェクトが
- # $game_actors から分離してしまっている。
- # ロードのたびにアクターを再設定することで問題を回避する。
- new_actors = []
- for i in 0...@actors.size
- if $data_actors[@actors[i].id] != nil
- new_actors.push($game_actors[@actors[i].id])
- end
- end
- @actors = new_actors
- end
- #--------------------------------------------------------------------------
- # ● 最大レベルの取得
- #--------------------------------------------------------------------------
- def max_level
- # パーティ人数が 0 人の場合
- if @actors.size == 0
- return 0
- end
- # ローカル変数 level を初期化
- level = 0
- # パーティメンバーの最大レベルを求める
- for actor in @actors
- if level < actor.level
- level = actor.level
- end
- end
- return level
- end
- #--------------------------------------------------------------------------
- # ● アクターを加える
- # actor_id : アクター ID
- #--------------------------------------------------------------------------
- def add_actor(actor_id)
- # アクターを取得
- actor = $game_actors[actor_id]
- # パーティ人数が 4 人未満で、このアクターがパーティにいない場合
- if @actors.size < 4 and not @actors.include?(actor)
- # アクターを追加
- @actors.push(actor)
- # プレイヤーをリフレッシュ
- $game_player.refresh
- end
- end
- #--------------------------------------------------------------------------
- # ● アクターを外す
- # actor_id : アクター ID
- #--------------------------------------------------------------------------
- def remove_actor(actor_id)
- # アクターを削除
- @actors.delete($game_actors[actor_id])
- # プレイヤーをリフレッシュ
- $game_player.refresh
- end
- #--------------------------------------------------------------------------
- # ● ゴールドの増加 (減少)
- # n : 金額
- #--------------------------------------------------------------------------
- def gain_gold(n)
- @gold = [[@gold + n, 0].max, 9999999].min
- end
- #--------------------------------------------------------------------------
- # ● ゴールドの減少
- # n : 金額
- #--------------------------------------------------------------------------
- def lose_gold(n)
- # 数値を逆転して gain_gold を呼ぶ
- gain_gold(-n)
- end
- #--------------------------------------------------------------------------
- # ● 歩数増加
- #--------------------------------------------------------------------------
- def increase_steps
- @steps = [@steps + 1, 9999999].min
- end
- #--------------------------------------------------------------------------
- # ● アイテムの所持数取得
- # item_id : アイテム ID
- #--------------------------------------------------------------------------
- def item_number(item_id)
- # ハッシュに個数データがあればその数値を、なければ 0 を返す
- return @items.include?(item_id) ? @items[item_id] : 0
- end
- #--------------------------------------------------------------------------
- # ● 武器の所持数取得
- # weapon_id : 武器 ID
- #--------------------------------------------------------------------------
- def weapon_number(weapon_id)
- # ハッシュに個数データがあればその数値を、なければ 0 を返す
- return @weapons.include?(weapon_id) ? @weapons[weapon_id] : 0
- end
- #--------------------------------------------------------------------------
- # ● 防具の所持数取得
- # armor_id : 防具 ID
- #--------------------------------------------------------------------------
- def armor_number(armor_id)
- # ハッシュに個数データがあればその数値を、なければ 0 を返す
- return @armors.include?(armor_id) ? @armors[armor_id] : 0
- end
- #--------------------------------------------------------------------------
- # ● アイテムの増加 (減少)
- # item_id : アイテム ID
- # n : 個数
- #--------------------------------------------------------------------------
- def gain_item(item_id, n)
- # ハッシュの個数データを更新
- if item_id > 0
- @items[item_id] = [[item_number(item_id) + n, 0].max, 99].min
- end
- end
- #--------------------------------------------------------------------------
- # ● 武器の増加 (減少)
- # weapon_id : 武器 ID
- # n : 個数
- #--------------------------------------------------------------------------
- def gain_weapon(weapon_id, n)
- # ハッシュの個数データを更新
- if weapon_id > 0
- @weapons[weapon_id] = [[weapon_number(weapon_id) + n, 0].max, 99].min
- end
- end
- #--------------------------------------------------------------------------
- # ● 防具の増加 (減少)
- # armor_id : 防具 ID
- # n : 個数
- #--------------------------------------------------------------------------
- def gain_armor(armor_id, n)
- # ハッシュの個数データを更新
- if armor_id > 0
- @armors[armor_id] = [[armor_number(armor_id) + n, 0].max, 99].min
- end
- end
- #--------------------------------------------------------------------------
- # ● アイテムの減少
- # item_id : アイテム ID
- # n : 個数
- #--------------------------------------------------------------------------
- def lose_item(item_id, n)
- # 数値を逆転して gain_item を呼ぶ
- gain_item(item_id, -n)
- end
- #--------------------------------------------------------------------------
- # ● 武器の減少
- # weapon_id : 武器 ID
- # n : 個数
- #--------------------------------------------------------------------------
- def lose_weapon(weapon_id, n)
- # 数値を逆転して gain_weapon を呼ぶ
- gain_weapon(weapon_id, -n)
- end
- #--------------------------------------------------------------------------
- # ● 防具の減少
- # armor_id : 防具 ID
- # n : 個数
- #--------------------------------------------------------------------------
- def lose_armor(armor_id, n)
- # 数値を逆転して gain_armor を呼ぶ
- gain_armor(armor_id, -n)
- end
- #--------------------------------------------------------------------------
- # ● アイテムの使用可能判定
- # item_id : アイテム ID
- #--------------------------------------------------------------------------
- def item_can_use?(item_id)
- # アイテムの個数が 0 個の場合
- if item_number(item_id) == 0
- # 使用不能
- return false
- end
- # 使用可能時を取得
- occasion = $data_items[item_id].occasion
- # バトルの場合
- if $game_temp.in_battle
- # 使用可能時が 0 (常時) または 1 (バトルのみ) なら使用可能
- return (occasion == 0 or occasion == 1)
- end
- # 使用可能時が 0 (常時) または 2 (メニューのみ) なら使用可能
- return (occasion == 0 or occasion == 2)
- end
- #--------------------------------------------------------------------------
- # ● 全員のアクションクリア
- #--------------------------------------------------------------------------
- def clear_actions
- # パーティ全員のアクションをクリア
- for actor in @actors
- actor.current_action.clear
- end
- end
- #--------------------------------------------------------------------------
- # ● コマンド入力可能判定
- #--------------------------------------------------------------------------
- def inputable?
- # 一人でもコマンド入力可能なら true を返す
- for actor in @actors
- if actor.inputable?
- return true
- end
- end
- return false
- end
- #--------------------------------------------------------------------------
- # ● 全滅判定
- #--------------------------------------------------------------------------
- def all_dead?
- # パーティ人数が 0 人の場合
- if $game_party.actors.size == 0
- return false
- end
- # HP 0 以上のアクターがパーティにいる場合
- for actor in @actors
- if actor.hp > 0
- return false
- end
- end
- # 全滅
- return true
- end
- #--------------------------------------------------------------------------
- # ● スリップダメージチェック (マップ用)
- #--------------------------------------------------------------------------
- def check_map_slip_damage
- for actor in @actors
- if actor.hp > 0 and actor.slip_damage?
- actor.hp -= [actor.maxhp / 100, 1].max
- if actor.hp == 0
- $game_system.se_play($data_system.actor_collapse_se)
- end
- $game_screen.start_flash(Color.new(255,0,0,128), 4)
- $game_temp.gameover = $game_party.all_dead?
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 対象アクターのランダムな決定
- # hp0 : HP 0 のアクターに限る
- #--------------------------------------------------------------------------
- def random_target_actor(hp0 = false)
- # ルーレットを初期化
- roulette = []
- # ループ
- for actor in @actors
- # 条件に該当する場合
- if (not hp0 and actor.exist?) or (hp0 and actor.hp0?)
- # アクターのクラスの [位置] を取得
- position = $data_classes[actor.class_id].position
- # 前衛のとき n = 4、中衛のとき n = 3、後衛のとき n = 2
- n = 4 - position
- # ルーレットにアクターを n 回追加
- n.times do
- roulette.push(actor)
- end
- end
- end
- # ルーレットのサイズが 0 の場合
- if roulette.size == 0
- return nil
- end
- # ルーレットを回し、アクターを決定
- return roulette[rand(roulette.size)]
- end
- #--------------------------------------------------------------------------
- # ● 対象アクターのランダムな決定 (HP 0)
- #--------------------------------------------------------------------------
- def random_target_actor_hp0
- return random_target_actor(true)
- end
- #--------------------------------------------------------------------------
- # ● 対象アクターのスムーズな決定
- # actor_index : アクターインデックス
- #--------------------------------------------------------------------------
- def smooth_target_actor(actor_index)
- # アクターを取得
- actor = @actors[actor_index]
- # アクターが存在する場合
- if actor != nil and actor.exist?
- return actor
- end
- # ループ
- for actor in @actors
- # アクターが存在する場合
- if actor.exist?
- return actor
- end
- end
- end
- end
- #==============================================================================
- # ■ Scene_Title
- #==============================================================================
- class Scene_Title
- def main
- # edit #
- #==============================================================================
- #-------------------------------------------------------------------------- # Item ID numbers
- $basic_items_ids = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]
- $quest_items_ids = [23,24,25,26,27,28,29,30,31,32]
- #-------------------------------------------------------------------------- # Weapon ID numbers
- $weapon_ids = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,
- 19,20,21,22,23,24,25,26,27,28,29,30,31,32]
- #-------------------------------------------------------------------------- # Shield ID numbers
- $armor_ids = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24]
- $accessory_ids = [25,26,27,28,29,30,31,32]
- #==============================================================================
- # end edit #
- if $BTEST
- battle_test
- return
- end
- $data_actors = load_data("Data/Actors.rxdata")
- $data_classes = load_data("Data/Classes.rxdata")
- $data_skills = load_data("Data/Skills.rxdata")
- $data_items = load_data("Data/Items.rxdata")
- $data_weapons = load_data("Data/Weapons.rxdata")
- $data_armors = load_data("Data/Armors.rxdata")
- $data_enemies = load_data("Data/Enemies.rxdata")
- $data_troops = load_data("Data/Troops.rxdata")
- $data_states = load_data("Data/States.rxdata")
- $data_animations = load_data("Data/Animations.rxdata")
- $data_tilesets = load_data("Data/Tilesets.rxdata")
- $data_common_events = load_data("Data/CommonEvents.rxdata")
- $data_system = load_data("Data/System.rxdata")
- # edit #
- #==============================================================================
- $map_infos = load_data("Data/MapInfos.rxdata")
- for key in $map_infos.keys
- $map_infos[key] = $map_infos[key].name
- end
- $game_time = Game_Time.new
- #==============================================================================
- # end edit #
- $game_system = Game_System.new
- @sprite = Sprite.new
- @sprite.bitmap = RPG::Cache.title($data_system.title_name)
- s1 = "New Game"
- s2 = "Continue"
- s3 = "Shutdown"
- @command_window = Window_Command.new(192, [s1, s2, s3])
- @command_window.back_opacity = 160
- @command_window.x = 320 - @command_window.width / 2
- @command_window.y = 288
- @continue_enabled = false
- for i in 0..3
- if FileTest.exist?("Save#{i+1}.rxdata")
- @continue_enabled = true
- end
- end
- if @continue_enabled
- @command_window.index = 1
- else
- @command_window.disable_item(1)
- end
- $game_system.bgm_play($data_system.title_bgm)
- Audio.me_stop
- Audio.bgs_stop
- # トランジション実行
- Graphics.transition
- # メインループ
- loop do
- # ゲーム画面を更新
- Graphics.update
- # 入力情報を更新
- Input.update
- # フレーム更新
- update
- # 画面が切り替わったらループを中断
- if $scene != self
- break
- end
- end
- # トランジション準備
- Graphics.freeze
- # コマンドウィンドウを解放
- @command_window.dispose
- # タイトルグラフィックを解放
- @sprite.bitmap.dispose
- @sprite.dispose
- end
- #--------------------------------------------------------------------------
- # ● フレーム更新
- #--------------------------------------------------------------------------
- def update
- # コマンドウィンドウを更新
- @command_window.update
- # C ボタンが押された場合
- if Input.trigger?(Input::C)
- # コマンドウィンドウのカーソル位置で分岐
- case @command_window.index
- when 0 # ニューゲーム
- command_new_game
- when 1 # コンティニュー
- command_continue
- when 2 # シャットダウン
- command_shutdown
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● コマンド : ニューゲーム
- #--------------------------------------------------------------------------
- def command_new_game
- # 決定 SE を演奏
- $game_system.se_play($data_system.decision_se)
- # BGM を停止
- Audio.bgm_stop
- # プレイ時間計測用のフレームカウントをリセット
- Graphics.frame_count = 0
- # 各種ゲームオブジェクトを作成
- $game_temp = Game_Temp.new
- $game_system = Game_System.new
- $game_switches = Game_Switches.new
- $game_variables = Game_Variables.new
- $game_self_switches = Game_SelfSwitches.new
- $game_screen = Game_Screen.new
- $game_actors = Game_Actors.new
- $game_party = Game_Party.new
- $game_troop = Game_Troop.new
- $game_map = Game_Map.new
- $game_player = Game_Player.new
- # 初期パーティをセットアップ
- $game_party.setup_starting_members
- # 初期位置のマップをセットアップ
- $game_map.setup($data_system.start_map_id)
- # プレイヤーを初期位置に移動
- $game_player.moveto($data_system.start_x, $data_system.start_y)
- # プレイヤーをリフレッシュ
- $game_player.refresh
- # マップに設定されている BGM と BGS の自動切り替えを実行
- $game_map.autoplay
- # マップを更新 (並列イベント実行)
- $game_map.update
- # マップ画面に切り替え
- $scene = Scene_Map.new
- end
- #--------------------------------------------------------------------------
- # ● コマンド : コンティニュー
- #--------------------------------------------------------------------------
- def command_continue
- # コンティニューが無効の場合
- unless @continue_enabled
- # ブザー SE を演奏
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # 決定 SE を演奏
- $game_system.se_play($data_system.decision_se)
- # ロード画面に切り替え
- $scene = Scene_Load.new
- end
- #--------------------------------------------------------------------------
- # ● コマンド : シャットダウン
- #--------------------------------------------------------------------------
- def command_shutdown
- # 決定 SE を演奏
- $game_system.se_play($data_system.decision_se)
- # BGM、BGS、ME をフェードアウト
- Audio.bgm_fade(800)
- Audio.bgs_fade(800)
- Audio.me_fade(800)
- # シャットダウン
- $scene = nil
- end
- #--------------------------------------------------------------------------
- # ● 戦闘テスト
- #--------------------------------------------------------------------------
- def battle_test
- # データベース (戦闘テスト用) をロード
- $data_actors = load_data("Data/BT_Actors.rxdata")
- $data_classes = load_data("Data/BT_Classes.rxdata")
- $data_skills = load_data("Data/BT_Skills.rxdata")
- $data_items = load_data("Data/BT_Items.rxdata")
- $data_weapons = load_data("Data/BT_Weapons.rxdata")
- $data_armors = load_data("Data/BT_Armors.rxdata")
- $data_enemies = load_data("Data/BT_Enemies.rxdata")
- $data_troops = load_data("Data/BT_Troops.rxdata")
- $data_states = load_data("Data/BT_States.rxdata")
- $data_animations = load_data("Data/BT_Animations.rxdata")
- $data_tilesets = load_data("Data/BT_Tilesets.rxdata")
- $data_common_events = load_data("Data/BT_CommonEvents.rxdata")
- $data_system = load_data("Data/BT_System.rxdata")
- # プレイ時間計測用のフレームカウントをリセット
- Graphics.frame_count = 0
- # 各種ゲームオブジェクトを作成
- $game_temp = Game_Temp.new
- $game_system = Game_System.new
- $game_switches = Game_Switches.new
- $game_variables = Game_Variables.new
- $game_self_switches = Game_SelfSwitches.new
- $game_screen = Game_Screen.new
- $game_actors = Game_Actors.new
- $game_party = Game_Party.new
- $game_troop = Game_Troop.new
- $game_map = Game_Map.new
- $game_player = Game_Player.new
- # 戦闘テスト用のパーティをセットアップ
- $game_party.setup_battle_test_members
- # トループ ID、逃走可能フラグ、バトルバックを設定
- $game_temp.battle_troop_id = $data_system.test_troop_id
- $game_temp.battle_can_escape = true
- $game_map.battleback_name = $data_system.battleback_name
- # バトル開始 SE を演奏
- $game_system.se_play($data_system.battle_start_se)
- # バトル BGM を演奏
- $game_system.bgm_play($game_system.battle_bgm)
- # バトル画面に切り替え
- $scene = Scene_Battle.new
- end
- end
- #==============================================================================
- # ■ Scene_Save
- #------------------------------------------------------------------------------
- # セーブ画面の処理を行うクラスです。
- #==============================================================================
- class Scene_Save < Scene_File
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- def initialize
- super("Which file do you want to save to?")
- end
- #--------------------------------------------------------------------------
- # ● 決定時の処理
- #--------------------------------------------------------------------------
- def on_decision(filename)
- # セーブ SE を演奏
- $game_system.se_play($data_system.save_se)
- # セーブデータの書き込み
- file = File.open(filename, "wb")
- write_save_data(file)
- file.close
- # イベントから呼び出されている場合
- if $game_temp.save_calling
- # セーブ呼び出しフラグをクリア
- $game_temp.save_calling = false
- # マップ画面に切り替え
- $scene = Scene_Map.new
- return
- end
- # メニュー画面に切り替え
- $scene = Scene_Menu.new(9)
- end
- #--------------------------------------------------------------------------
- # ● キャンセル時の処理
- #--------------------------------------------------------------------------
- def on_cancel
- # キャンセル SE を演奏
- $game_system.se_play($data_system.cancel_se)
- # イベントから呼び出されている場合
- if $game_temp.save_calling
- # セーブ呼び出しフラグをクリア
- $game_temp.save_calling = false
- # マップ画面に切り替え
- $scene = Scene_Map.new
- return
- end
- # メニュー画面に切り替え
- $scene = Scene_Menu.new(9)
- end
- #--------------------------------------------------------------------------
- # ● セーブデータの書き込み
- # file : 書き込み用ファイルオブジェクト (オープン済み)
- #--------------------------------------------------------------------------
- def write_save_data(file)
- # セーブファイル描画用のキャラクターデータを作成
- characters = []
- for i in 0...$game_party.actors.size
- actor = $game_party.actors[i]
- characters.push([actor.character_name, actor.character_hue])
- end
- # セーブファイル描画用のキャラクターデータを書き込む
- Marshal.dump(characters, file)
- # プレイ時間計測用のフレームカウントを書き込む
- Marshal.dump(Graphics.frame_count, file)
- # セーブ回数を 1 増やす
- $game_system.save_count += 1
- # マジックナンバーを保存する
- # (エディタで保存するたびにランダムな値に書き換えられる)
- $game_system.magic_number = $data_system.magic_number
- # 各種ゲームオブジェクトを書き込む
- Marshal.dump($game_system, file)
- Marshal.dump($game_switches, file)
- Marshal.dump($game_variables, file)
- Marshal.dump($game_self_switches, file)
- Marshal.dump($game_screen, file)
- Marshal.dump($game_actors, file)
- Marshal.dump($game_party, file)
- Marshal.dump($game_troop, file)
- Marshal.dump($game_map, file)
- Marshal.dump($game_player, file)
- # edit #
- #==============================================================================
- Marshal.dump($game_time,file)
- #==============================================================================
- # end edit #
- end
- end
- #==============================================================================
- # ■ Scene_Load
- #------------------------------------------------------------------------------
- # ロード画面の処理を行うクラスです。
- #==============================================================================
- class Scene_Load < Scene_File
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- def initialize
- # テンポラリオブジェクトを再作成
- $game_temp = Game_Temp.new
- # タイムスタンプが最新のファイルを選択
- $game_temp.last_file_index = 0
- latest_time = Time.at(0)
- for i in 0..3
- filename = make_filename(i)
- if FileTest.exist?(filename)
- file = File.open(filename, "r")
- if file.mtime > latest_time
- latest_time = file.mtime
- $game_temp.last_file_index = i
- end
- file.close
- end
- end
- super("Which file do you wish to load from?")
- end
- #--------------------------------------------------------------------------
- # ● 決定時の処理
- #--------------------------------------------------------------------------
- def on_decision(filename)
- # ファイルが存在しない場合
- unless FileTest.exist?(filename)
- # ブザー SE を演奏
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # ロード SE を演奏
- $game_system.se_play($data_system.load_se)
- # セーブデータの書き込み
- file = File.open(filename, "rb")
- read_save_data(file)
- file.close
- # BGM、BGS を復帰
- $game_system.bgm_play($game_system.playing_bgm)
- $game_system.bgs_play($game_system.playing_bgs)
- # マップを更新 (並列イベント実行)
- $game_map.update
- # マップ画面に切り替え
- $scene = Scene_Map.new
- end
- #--------------------------------------------------------------------------
- # ● キャンセル時の処理
- #--------------------------------------------------------------------------
- def on_cancel
- # キャンセル SE を演奏
- $game_system.se_play($data_system.cancel_se)
- # タイトル画面に切り替え
- $scene = Scene_Title.new
- end
- #--------------------------------------------------------------------------
- # ● セーブデータの読み込み
- # file : 読み込み用ファイルオブジェクト (オープン済み)
- #--------------------------------------------------------------------------
- def read_save_data(file)
- # セーブファイル描画用のキャラクターデータを読み込む
- characters = Marshal.load(file)
- # プレイ時間計測用のフレームカウントを読み込む
- Graphics.frame_count = Marshal.load(file)
- # 各種ゲームオブジェクトを読み込む
- $game_system = Marshal.load(file)
- $game_switches = Marshal.load(file)
- $game_variables = Marshal.load(file)
- $game_self_switches = Marshal.load(file)
- $game_screen = Marshal.load(file)
- $game_actors = Marshal.load(file)
- $game_party = Marshal.load(file)
- $game_troop = Marshal.load(file)
- $game_map = Marshal.load(file)
- $game_player = Marshal.load(file)
- # edit #
- #==============================================================================
- $game_time =Marshal.load(file)
- #==============================================================================
- # end edit #
- # マジックナンバーがセーブ時と異なる場合
- # (エディタで編集が加えられている場合)
- if $game_system.magic_number != $data_system.magic_number
- # マップをリロード
- $game_map.setup($game_map.map_id)
- $game_player.center($game_player.x, $game_player.y)
- end
- # パーティメンバーをリフレッシュ
- $game_party.refresh
- end
- end
- #==============================================================================
- # Custom Menu System
- # Written by Diego
- # Bug-fixing by ccoa
- #==============================================================================
- # - Fully Animated
- # Includes:
- # - Quest/Key Item Support
- # - Organized Menus by Items, Weapons, Armors, Accessories and Quest/Key Items
- # - Advanced Equip Screen (by RPG-Advocate)
- # - Reorganized Status Screen
- # - Elemental Resistance Circle
- # - Map Name Window
- # - Icons in Menu
- # - Options
- # - Support for Deke/Near Fantastica's Day/Night System
- #
- # Instructions Manual:
- #
- # Step 1 - copy and paste these lines into Scene_Title just under def main
- # #-------------------------------------------------------------------------- # Item ID numbers
- # $basic_items_ids = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]
- # $quest_items_ids = [23,24,25,26,27,28,29,30,31,32]
- # #-------------------------------------------------------------------------- # Weapon ID numbers
- # $weapon_ids = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,
- #19,20,21,22,23,24,25,26,27,28,29,30,31,32]
- # #-------------------------------------------------------------------------- # Armor ID numbers
- # $armor_ids = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24]
- # $accessory_ids = [25,26,27,28,29,30,31,32]
- # This is for organizing your items.
- #
- # Step 2 - copy and paste these lines into Scene_Title just under $data_system = load_data("Data/System.rxdata")
- # $map_infos = load_data("Data/MapInfos.rxdata")
- # for key in $map_infos.keys
- # $map_infos[key] = $map_infos[key].name
- # end
- # $game_time = Game_Time.new
- # This is support for Window_NewTime and Window_NewLocation
- #
- # Step 3 - copy and paste this line into Scene_Save just under Marshal.dump($game_player, file)
- # Marshal.dump($game_time,file)
- # also change this line $scene = Scene_Menu.new(4) into this $scene = Scene_Menu.new(9) in def on_decision(filename)
- # This is support for Window_NewTime
- #
- # Step 4 - copy and paste this line into Scene_Load just under $game_player = Marshal.load(file)
- # $game_time =Marshal.load(file)
- # This is support for Window_NewTime
- #
- # Support for Deke/Near Fantastica's Day and Night System:
- # You can copy and paste the D&N system script into a new section above main,
- # just make sure that the D&N system script is below this one in the list
- #
- #
- # That's all. Enjoy ^^;
- # - Diego
- #==============================================================================
- # ■ Bestiary
- #------------------------------------------------------------------------------
- # Created by Momomo
- # Modified by Thousand Dragoon Link
- #==============================================================================
- module Enemy_Book_Config
- DROP_ITEM_NEED_ANALYZE = false
- EVA_NAME = "Evasion"
- SHOW_COMPLETE_TYPE = 3
- end
- class Game_Temp
- attr_accessor :enemy_book_data
- alias temp_enemy_book_data_initialize initialize
- def initialize
- temp_enemy_book_data_initialize
- @enemy_book_data = Data_MonsterBook.new
- end
- end
- class Game_Party
- attr_accessor :enemy_info
- #--------------------------------------------------------------------------
- alias book_info_initialize initialize
- def initialize
- book_info_initialize
- @enemy_info = {}
- end
- #--------------------------------------------------------------------------
- def add_enemy_info(enemy_id, type = 0)
- case type
- when 0
- if @enemy_info[enemy_id] == 2
- return false
- end
- @enemy_info[enemy_id] = 1
- when 1
- @enemy_info[enemy_id] = 2
- when -1
- @enemy_info[enemy_id] = 0
- end
- end
- #--------------------------------------------------------------------------
- def enemy_book_max
- return $game_temp.enemy_book_data.id_data.size - 1
- end
- #--------------------------------------------------------------------------
- def enemy_book_now
- now_enemy_info = @enemy_info.keys
- no_add = $game_temp.enemy_book_data.no_add_element
- new_enemy_info = []
- for i in now_enemy_info
- enemy = $data_enemies[i]
- next if enemy.name == ""
- if enemy.element_ranks[no_add] == 1
- next
- end
- new_enemy_info.push(enemy.id)
- end
- return new_enemy_info.size
- end
- #--------------------------------------------------------------------------
- def enemy_book_complete_percentage
- e_max = enemy_book_max.to_f
- e_now = enemy_book_now.to_f
- comp = e_now / e_max * 100
- return comp.truncate
- end
- end
- class Interpreter
- def enemy_book_max
- return $game_party.enemy_book_max
- end
- def enemy_book_now
- return $game_party.enemy_book_now
- end
- def enemy_book_comp
- return $game_party.enemy_book_complete_percentage
- end
- end
- class Scene_Battle
- alias add_enemy_info_start_phase5 start_phase5
- def start_phase5
- for enemy in $game_troop.enemies
- unless enemy.hidden
- $game_party.add_enemy_info(enemy.id, 0)
- end
- end
- add_enemy_info_start_phase5
- end
- end
- class Window_Base < Window
- #--------------------------------------------------------------------------
- def draw_enemy_drop_item(enemy, x, y)
- self.contents.font.color = normal_color
- treasures = []
- if enemy.item_id > 0
- treasures.push($data_items[enemy.item_id])
- end
- if enemy.weapon_id > 0
- treasures.push($data_weapons[enemy.weapon_id])
- end
- if enemy.armor_id > 0
- treasures.push($data_armors[enemy.armor_id])
- end
- if treasures.size > 0
- item = treasures[0]
- bitmap = RPG::Cache.icon(item.icon_name)
- opacity = 255
- self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
- name = treasures[0].name
- else
- self.contents.font.color = disabled_color
- name = "No Item"
- end
- self.contents.draw_text(x+28, y, 212, 32, name)
- end
- #--------------------------------------------------------------------------
- def draw_actor_hp2(actor, x, y, width = 144)
- self.contents.font.color = system_color
- self.contents.draw_text(x, y, 32, 32, $data_system.words.hp)
- if width - 32 >= 108
- hp_x = x + width - 108
- flag = true
- elsif width - 32 >= 48
- hp_x = x + width - 48
- flag = false
- end
- 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)
- 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 + 84, y, 48, 32, actor.maxhp.to_s)
- end
- end
- #--------------------------------------------------------------------------
- def draw_actor_sp2(actor, x, y, width = 144)
- self.contents.font.color = system_color
- self.contents.draw_text(x, y, 32, 32, $data_system.words.sp)
- if width - 32 >= 108
- sp_x = x + width - 108
- flag = true
- elsif width - 32 >= 48
- sp_x = x + width - 48
- flag = false
- end
- 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)
- 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 + 84, y, 48, 32, actor.maxsp.to_s)
- end
- end
- #--------------------------------------------------------------------------
- def draw_enemy_book_id(enemy, x, y)
- self.contents.font.color = normal_color
- id = $game_temp.enemy_book_data.id_data.index(enemy.id)
- self.contents.draw_text(x, y, 32, 32, id.to_s)
- end
- #--------------------------------------------------------------------------
- def draw_enemy_name(enemy, x, y)
- self.contents.font.color = normal_color
- self.contents.draw_text(x, y, 152, 32, enemy.name)
- end
- #--------------------------------------------------------------------------
- def draw_enemy_graphic(enemy, x, y, opacity = 255)
- bitmap = RPG::Cache.battler(enemy.battler_name, enemy.battler_hue)
- cw = bitmap.width
- ch = bitmap.height
- src_rect = Rect.new(0, 0, cw, ch)
- x = x + (cw / 2 - x) if cw / 2 > x
- self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect, opacity)
- end
- #--------------------------------------------------------------------------
- def draw_enemy_exp(enemy, x, y)
- self.contents.font.color = system_color
- self.contents.draw_text(x, y, 120, 32, "EXP")
- self.contents.font.color = normal_color
- self.contents.draw_text(x + 120, y, 36, 32, enemy.exp.to_s, 2)
- end
- #--------------------------------------------------------------------------
- def draw_enemy_gold(enemy, x, y)
- self.contents.font.color = system_color
- self.contents.draw_text(x, y, 120, 32, $data_system.words.gold)
- self.contents.font.color = normal_color
- self.contents.draw_text(x + 120, y, 36, 32, enemy.gold.to_s, 2)
- end
- end
- class Game_Enemy_Book < Game_Enemy
- #--------------------------------------------------------------------------
- def initialize(enemy_id)
- super(2, 1)
- @enemy_id = enemy_id
- enemy = $data_enemies[@enemy_id]
- @battler_name = enemy.battler_name
- @battler_hue = enemy.battler_hue
- @hp = maxhp
- @sp = maxsp
- end
- end
- class Data_MonsterBook
- attr_reader :id_data
- #--------------------------------------------------------------------------
- def initialize
- @id_data = enemy_book_id_set
- end
- #--------------------------------------------------------------------------
- def no_add_element
- no_add = 0
- for i in 1...$data_system.elements.size
- if $data_system.elements[i] =~ /図鑑登録無効/
- no_add = i
- break
- end
- end
- return no_add
- end
- #--------------------------------------------------------------------------
- def enemy_book_id_set
- data = [0]
- no_add = no_add_element
- for i in 1...$data_enemies.size
- enemy = $data_enemies[i]
- next if enemy.name == ""
- if enemy.element_ranks[no_add] == 1
- next
- end
- data.push(enemy.id)
- end
- return data
- end
- end
- class Window_MonsterBook < Window_Selectable
- attr_reader :data
- #--------------------------------------------------------------------------
- def initialize(index=0)
- super(0, 64, 576, 352)
- @column_max = 2
- @book_data = $game_temp.enemy_book_data
- @data = @book_data.id_data.dup
- @data.shift
- #@data.sort!
- @item_max = @data.size
- self.index = 0
- refresh if @item_max > 0
- end
- #--------------------------------------------------------------------------
- def data_set
- data = $game_party.enemy_info.keys
- data.sort!
- newdata = []
- for i in data
- next if $game_party.enemy_info[i] == 0
- if book_id(i) != nil
- newdata.push(i)
- end
- end
- return newdata
- end
- #--------------------------------------------------------------------------
- def show?(id)
- if $game_party.enemy_info[id] == 0 or $game_party.enemy_info[id] == nil
- return false
- else
- return true
- end
- end
- #--------------------------------------------------------------------------
- def book_id(id)
- return @book_data.index(id)
- end
- #--------------------------------------------------------------------------
- def item
- return @data[self.index]
- end
- #--------------------------------------------------------------------------
- def refresh
- if self.contents != nil
- self.contents.dispose
- self.contents = nil
- end
- self.contents = Bitmap.new(width - 32, row_max * 32)
- self.contents.font.name= $fontface
- self.contents.font.size= 20
- if @item_max > 0
- for i in 0...@item_max
- draw_item(i)
- end
- end
- end
- #--------------------------------------------------------------------------
- def draw_item(index)
- enemy = $data_enemies[@data[index]]
- return if enemy == nil
- x = 4 + index % 2 * (256 + 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))
- self.contents.font.color = normal_color
- draw_enemy_book_id(enemy, x, y)
- if show?(enemy.id)
- self.contents.draw_text(x + 28+16, y, 212, 32, enemy.name, 0)
- else
- self.contents.draw_text(x + 28+16, y, 212, 32, "????????????????", 0)
- return
- end
- if analyze?(@data[index])
- self.contents.font.color = text_color(3)
- self.contents.draw_text(x + 256, y, 24, 32, "済", 2)
- end
- end
- #--------------------------------------------------------------------------
- def analyze?(enemy_id)
- if $game_party.enemy_info[enemy_id] == 2
- return true
- else
- return false
- end
- end
- end
- class Window_MonsterBook_Info < Window_Base
- include Enemy_Book_Config
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0+64, 576, 416-64)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.contents.font.name= $fontface
- self.contents.font.size= 20
- end
- #--------------------------------------------------------------------------
- def refresh(enemy_id)
- self.contents.clear
- enemy = Game_Enemy_Book.new(enemy_id)
- draw_enemy_graphic(enemy, 0, 240+48, 200)
- draw_enemy_book_id(enemy, 4, 0)
- draw_enemy_name(enemy, 48, 0)
- draw_actor_hp2(enemy, 227, 0)
- draw_actor_sp2(enemy, 227+160, 0)
- draw_actor_parameter(enemy, 227 , 32, 0)
- self.contents.font.color = normal_color
- draw_actor_parameter(enemy, 288+100, 32, 7)
- draw_actor_parameter(enemy, 227 , 64, 3)
- draw_actor_parameter(enemy, 288+100, 64, 4)
- draw_actor_parameter(enemy, 227 , 96, 5)
- draw_actor_parameter(enemy, 288+100, 96, 6)
- draw_actor_parameter(enemy, 227 , 128, 1)
- draw_actor_parameter(enemy, 288+100, 128, 2)
- draw_enemy_exp(enemy, 227, 160)
- draw_enemy_gold(enemy, 227+160, 160)
- if analyze?(enemy.id) or !DROP_ITEM_NEED_ANALYZE
- self.contents.draw_text(260, 192, 96, 32, "Drop Item")
- draw_enemy_drop_item(enemy, 288+96+4, 192)
- self.contents.font.color = normal_color
- #draw_element_guard(enemy, 320-32, 160-16+96)
- end
- end
- #--------------------------------------------------------------------------
- def analyze?(enemy_id)
- if $game_party.enemy_info[enemy_id] == 2
- return true
- else
- return false
- end
- end
- end
- #==============================================================================
- # END BESTIARY
- #==============================================================================
- # Window_SwitchParty class definition
- #------------------------------------------------------------------------------
- # A window that displays all 4 character slots in the party, and offers a
- # cursor to modify it.
- #
- # By exseiken, October 04, 2004
- #==============================================================================
- class Window_SwitchParty < Window_Selectable
- #----------------------------------------------------------------------------
- # Create public access variables
- #----------------------------------------------------------------------------
- attr_reader :new_party # The party shown in the window [R-O]
- #----------------------------------------------------------------------------
- # Window's constructor. Create the window's contents, makes a copy of the
- # current party, then stocks it into member variable new_party, for later
- # use.
- #----------------------------------------------------------------------------
- def initialize()
- # create the window and its contents
- super(32, 32, 224, 416)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.contents.font.name = $fontface
- self.contents.font.size = 20
- # copy the party
- @new_party = $game_party.actors.clone
- # always 4 party members
- @item_max = 4
- # select the first character
- if @new_party.size > 0
- @index = @new_party.index(@new_party.first )
- else
- @index = 0
- end
- # draw the window's contents
- refresh
- # update the cursor rectangle
- update_cursor_rect
- end
- #----------------------------------------------------------------------------
- # Return the actor currently selected.
- #----------------------------------------------------------------------------
- def actor
- # return the selected actor, or nil if none
- @new_party[@index]
- end
- #----------------------------------------------------------------------------
- # Update the contents of the window: clear the contents bitmap, then rebuild
- # it.
- #----------------------------------------------------------------------------
- def refresh
- # clear the contents of the bitmap
- self.contents.clear
- # draw each non-null party member
- for i in 0..@new_party.size - 1
- # get the actor
- actor = @new_party[i]
- # if the actor is valid, draw it on the screen
- if actor != nil
- # calculate the y coordinate
- y = 96 * i
- # draw the actor's graphic
- draw_actor_graphic(actor, 24, y + 80)
- # draw the actor's name
- draw_actor_name(actor, 64, y + 32)
- # if the actor is not available, write in red "can't select"
- if actor.mandatory
- self.contents.font.color = Color.new(255, 0, 0, 255)
- self.contents.draw_text(0, y, 224, 32, "Unswitchable", 1)
- end
- end
- end
- end
- #----------------------------------------------------------------------------
- # Update the position rectangle of the cursor.
- #----------------------------------------------------------------------------
- def update_cursor_rect
- # reset the cursor rectangle
- self.cursor_rect.set(0, 96 * @index, width - 32, 96)
- end
- #----------------------------------------------------------------------------
- # Change the actor selected for another, then redraw the entire window.
- #
- # Parameters:
- # actors: The actor that will replace the selected one
- #----------------------------------------------------------------------------
- def change_selection(actor)
- # change the actor (can be nil to remove it)
- @new_party[@index] = actor
- # redraw the window
- refresh
- end
- #----------------------------------------------------------------------------
- # Update the help window. (Here, the help window is really the actor status
- # window.)
- #----------------------------------------------------------------------------
- def update_help
- # draw the selected actor's name, level, status conditions and stats
- @help_window.draw_actor_status(@new_party[@index])
- end
- end
- #==============================================================================
- # Window_SwitchReserve class definition
- #------------------------------------------------------------------------------
- # A window that displays all characters available to pick in the party. Offers
- # a cursor to select them
- #
- # By exseiken, October 06, 2004 (v. 1.01)
- #==============================================================================
- class Window_SwitchReserve < Window_Selectable
- #----------------------------------------------------------------------------
- # Window constructor. Create the contents bitmap and fill it with all
- # characters that are not into the party, but that are loaded in the data
- # member of the Game_Actors global object.
- #
- # Parameters:
- # max_size: The maximum of characters that can fit into that
- # window
- #----------------------------------------------------------------------------
- def initialize(max_size)
- # initialize the window and its contents
- super(256, 160, 352, 288)
- self.contents = Bitmap.new(width - 32, ((max_size & ~(0x01)) << 5) + ((max_size & 0x01) << 6))
- self.contents.font.name = $fontface
- self.contents.font.size = 20
- # initialize the list for the first time
- @actor_list = $game_actors.data.clone
- # remove currently active party members
- $game_party.actors.each do |actor|
- @actor_list[actor.actor_id] = nil
- end
- # remove all actors that are unavailable
- $game_actors.data.each do |actor|
- if actor != nil and actor.unavailable
- @actor_list[actor.actor_id] = nil
- end
- end
- # remove all holes in the list
- @actor_list.compact!
- # set the maximum of characters the list can contain
- @item_max = max_size
- # 2 columns
- @column_max = 2
- # select the first item
- @index = 0
- # default: unactive
- self.active = false
- # draw the window's contents
- refresh
- # draw the cursor rectangle
- update_cursor_rect
- end
- #----------------------------------------------------------------------------
- # Update the contents of the window: clear the contents bitmap, then rebuild
- # it.
- #----------------------------------------------------------------------------
- def refresh
- # clear the contents of the bitmap
- self.contents.clear
- # display all actors
- for i in 0..@actor_list.size
- # get the concerned actor
- actor = @actor_list[i]
- # if the actor is non-nil, draw it
- if actor != nil
- # get the coordinates
- x = (i & 0x01) == 1 ? self.width / @column_max : 0
- y = (i >> 0x01) * 64
- # draw the actor's sprite
- draw_actor_graphic(actor, x + 24, y + 48)
- # draw the actor's name
- draw_actor_name(actor, x + 64, y + 16)
- end
- end
- end
- #----------------------------------------------------------------------------
- # Update the position rectangle of the cursor.
- #----------------------------------------------------------------------------
- def update_cursor_rect
- # if the screen is not active, or the cursor is invalid, don't display the
- # cursor
- if not active or @index < 0
- # set an empty cursor
- self.cursor_rect.empty
- # stop
- return
- end
- # get the row of the item
- row = @index / @column_max
- # if the cursor went over the window, scroll up
- if row < self.top_row
- # set the top row as the current row
- self.top_row = row
- end
- # if the cursor went farther than the bottom of the window, scroll down
- if row > self.top_row + (self.page_row_max - 1)
- # set the bottom row as the current row
- self.top_row = row - (self.page_row_max - 1)
- end
- # set the width of the cursor
- cursor_width = self.width / @column_max - 32
- # get the upper-left coordinates of the window
- x = @index % @column_max * (cursor_width + 32)
- y = @index / @column_max * 64 - self.oy
- # set the cursor rectangle
- self.cursor_rect.set(x, y, cursor_width, 64)
- end
- #----------------------------------------------------------------------------
- # Takes a character, put in into the list at the selected position, and
- # returns the character that was presently there. If there was no
- # character, returns nil.
- #
- # Parameters:
- # actor_to_switch: The character to put at the selected position
- #----------------------------------------------------------------------------
- def swap_characters(actor_to_switch)
- # store the old actor (needed for swapping)
- old_actor = @actor_list[@index]
- # put the new actor at the place
- @actor_list[@index] = actor_to_switch
- # redraw the window
- refresh
- # return the old actor
- return old_actor
- end
- #----------------------------------------------------------------------------
- # Update the help window. (Here, the help window is really the actor status
- # window.)
- #----------------------------------------------------------------------------
- def update_help
- # draw the selected actor's name, level, status conditions and stats
- @help_window.draw_actor_status(@actor_list[@index])
- end
- #--------------------------------------------------------------------------
- # Return the index of the top row, that is, the first row that is displayed
- # on the window.
- #--------------------------------------------------------------------------
- def top_row
- # divide the coordinate of the top of the bitmap by the cursor's height,
- # 64, returning the index of the top row
- return self.oy / 64
- end
- #--------------------------------------------------------------------------
- # Validate, and set the top row to a new value. The validation makes sure
- # that the new row is not off-limits.
- #
- # Parameters:
- # row : the index of the row to be set as the new top row
- #--------------------------------------------------------------------------
- def top_row=(row)
- # forces the new row to be positive
- if row < 0
- row = 0
- end
- # forces the new row to be less or equal to the maximum
- if row > row_max - 1
- row = row_max - 1
- end
- # return the top of the window by multiplying it by the height of the
- # cursor window: 64.
- self.oy = row * 64
- end
- #--------------------------------------------------------------------------
- # Return the maximum amount of rows that can
- #--------------------------------------------------------------------------
- def page_row_max
- # return the maximum of rows fitting in a page by dividing the
- # height of the bitmap by the height of a window, 64
- return (self.height - 32) / 64
- end
- end
- #==============================================================================
- # Window_SwitchStatus class definition
- #------------------------------------------------------------------------------
- # A window that displays the status of a character being selected.
- #
- # By exseiken, October 06, 2004 (v. 1.01)
- #==============================================================================
- class Window_SwitchStatus < Window_Base
- #----------------------------------------------------------------------------
- # Construct the window: create the contents bitmap.
- #----------------------------------------------------------------------------
- def initialize
- # create the window and initialize its contents
- super(256, 32, 352, 128)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.contents.font.name = $fontface
- self.contents.font.size = 20
- end
- #----------------------------------------------------------------------------
- # Draw the status on an actor on the window's contents.
- #
- # Parameters:
- # actor: The actor to put on the screen
- #----------------------------------------------------------------------------
- def draw_actor_status(actor)
- # clear the contents of the bitmap
- self.contents.clear
- # if the actor to draw is nil, leave the window empty
- if actor == nil
- return
- end
- # draw the actor's graphic
- draw_actor_graphic(actor, 24, 64)
- # draw the actor's name, level
- draw_actor_name(actor, 64, 0)
- draw_actor_level(actor, 256, 0)
- draw_actor_hp(actor, 64, 32)
- draw_actor_sp(actor, 64, 64)
- end
- end
- #==============================================================================
- # END SWITCH SCREEN
- #==============================================================================
- # ■ Game_System
- #==============================================================================
- class Game_System
- attr_reader :map_interpreter
- attr_reader :battle_interpreter
- attr_accessor :timer
- attr_accessor :timer_working
- attr_accessor :save_disabled
- attr_accessor :menu_disabled
- attr_accessor :encounter_disabled
- attr_accessor :message_position
- attr_accessor :message_frame
- attr_accessor :save_count
- attr_accessor :magic_number
- attr_accessor :bgm_volume
- attr_accessor :se_volume
- def initialize
- @map_interpreter = Interpreter.new(0, true)
- @battle_interpreter = Interpreter.new(0, false)
- @timer = 0
- @timer_working = false
- @save_disabled = false
- @menu_disabled = false
- @encounter_disabled = false
- @message_position = 2
- @message_frame = 0
- @save_count = 0
- @magic_number = 0
- @bgm_volume = 100
- @se_volume = 100
- end
- def bgm_play(bgm)
- @playing_bgm = bgm
- if bgm != nil and bgm.name != ""
- Audio.bgm_play("Audio/BGM/" + bgm.name , bgm.volume * bgm_volume / 100, bgm.pitch)
- else
- Audio.bgm_stop
- end
- Graphics.frame_reset
- end
- def bgs_play(bgs)
- @playing_bgs = bgs
- if bgs != nil and bgs.name != ""
- Audio.bgs_play("Audio/BGS/" + bgs.name, bgs.volume * se_volume / 100, bgs.pitch)
- else
- Audio.bgs_stop
- end
- Graphics.frame_reset
- end
- def me_play(me)
- if me != nil and me.name != ""
- Audio.me_play("Audio/ME/" + me.name, me.volume * se_volume / 100, me.pitch)
- else
- Audio.me_stop
- end
- Graphics.frame_reset
- end
- def se_play(se)
- if se != nil and se.name != ""
- Audio.se_play("Audio/SE/" + se.name, se.volume * se_volume / 100, se.pitch)
- end
- end
- end
- #==============================================================================
- # ■ Game_Actor
- #==============================================================================
- class Game_Actor < Game_Battler
- def now_exp
- return @exp - @exp_list[@level]
- end
- def next_exp
- return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
- end
- end
- #==============================================================================
- # ■ Game_Map
- #==============================================================================
- class Game_Map
- def name
- $map_infos[@map_id]
- end
- end
- #==============================================================================
- # ■ class Game_Time
- # written by Deke
- #--------------------------------------------------------------------------------------------------------------------------------------------
- #==============================================================================
- class Game_Time
- attr_accessor :minute_length
- def initialize
- @minute_length=2.0 #length of game minute in real seconds
- @hour_length= 60.0 #minute in an hour
- @day_length=24.0 #hours in a day
- @month_length=30.0 #days in a month
- @year_length=12.0 #months in a year
- @minutes=0 #starting minute count
- start_minute=0
- add_minutes(start_minute)
- start_hour=23 #starting hour count
- add_hours(start_hour)
- start_day=13 #starting day count
- add_days(start_day)
- start_month=4 #starting month count
- add_months(start_month-1)
- start_year=1207 #starting year count
- add_years(start_year)
- end
- def add_minutes(minutes)
- @minutes +=minutes
- end
- def add_hours(hours)
- @minutes +=hours*@hour_length
- end
- def add_days(days)
- @minutes += days*@hour_length*@day_length
- end
- def add_months(months)
- @minutes +=months * @hour_length*@day_length*@month_length
- end
- def add_years(years)
- @minutes += years * @hour_length*@day_length*@month_length * @year_length
- end
- def get_year
- minutes=get_total_minutes
- year=minutes / @hour_length / @day_length / @month_length / @year_length
- return year
- end
- def get_month
- minutes=get_total_minutes
- month=minutes / @hour_length / @day_length / @month_length % @year_length + 1
- return month
- end
- def get_day
- minutes=get_total_minutes
- day=minutes / @hour_length / @day_length % @month_length
- return day
- end
- def get_hour
- minutes=get_total_minutes
- hour=minutes / @hour_length % @day_length
- return hour
- end
- def get_total_minutes
- total_sec=Graphics.frame_count / Graphics.frame_rate
- minute=(total_sec/@minute_length+@minutes)
- return minute
- end
- def get_minute
- minutes=get_total_minutes % @hour_length
- return minutes
- end
- def get_tone
- period_length=Math::PI*(get_hour / @day_length)
- red_shift= -100+ 115*Math.sin(period_length)
- green_shift= -140+ 155*Math.sin(period_length)
- blue_shift= -150+ 165*Math.sin(period_length)
- return Tone.new(red_shift, green_shift, blue_shift, 0)
- end
- end
- #==============================================================================
- # ■ Window_Base
- #==============================================================================
- class Window_Base < Window
- def draw_actor_battler(actor, x, y)
- bitmap = RPG::Cache.battler(actor.battler_name, actor.battler_hue)
- cw =bitmap.width
- ch = bitmap.height
- src_rect = Rect.new(0, 0, cw,ch)
- self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
- end
- FONT_SIZE = 16
- NUMBER_OF_ELEMENTS = 8
- ELEMENT_ORDER = [1,2,3,4,5,6, 7, 8]
- GRAPH_SCALINE_COLOR = Color.new(255, 255, 255, 128)
- GRAPH_SCALINE_COLOR_SHADOW = Color.new( 0, 0, 0, 192)
- GRAPH_LINE_COLOR = Color.new(255, 255, 64, 255)
- GRAPH_LINE_COLOR_MINUS = Color.new( 64, 255, 255, 255)
- GRAPH_LINE_COLOR_PLUS = Color.new(255, 64, 64, 255)
- def draw_actor_element_radar_graph(actor, x, y, radius = 43)
- cx = x + radius + FONT_SIZE + 48
- cy = y + radius + FONT_SIZE + 32
- for loop_i in 0..NUMBER_OF_ELEMENTS
- if loop_i == 0
- else
- @pre_x = @now_x
- @pre_y = @now_y
- @pre_ex = @now_ex
- @pre_ey = @now_ey
- @color1 = @color2
- end
- if loop_i == NUMBER_OF_ELEMENTS
- eo = ELEMENT_ORDER[0]
- else
- eo = ELEMENT_ORDER[loop_i]
- end
- er = actor.element_rate(eo)
- estr = $data_system.elements[eo]
- @color2 = er < 0 ? GRAPH_LINE_COLOR_MINUS : er > 100 ? GRAPH_LINE_COLOR_PLUS : GRAPH_LINE_COLOR
- er = er.abs
- th = Math::PI * (0.5 - 2.0 * loop_i / NUMBER_OF_ELEMENTS)
- @now_x = cx + (radius * Math.cos(th)).floor
- @now_y = cy - (radius * Math.sin(th)).floor
- @now_wx = cx - 6 + ((radius + FONT_SIZE * 3 / 2) * Math.cos(th)).floor - FONT_SIZE
- @now_wy = cy - ((radius + FONT_SIZE * 1 / 2) * Math.sin(th)).floor - FONT_SIZE/2
- @now_vx = cx + ((radius + FONT_SIZE * 8 / 2) * Math.cos(th)).floor - FONT_SIZE
- @now_vy = cy - ((radius + FONT_SIZE * 3 / 2) * Math.sin(th)).floor - FONT_SIZE/2
- @now_ex = cx + (er*radius/100 * Math.cos(th)).floor
- @now_ey = cy - (er*radius/100 * Math.sin(th)).floor
- if loop_i == 0
- @pre_x = @now_x
- @pre_y = @now_y
- @pre_ex = @now_ex
- @pre_ey = @now_ey
- @color1 = @color2
- else
- end
- next if loop_i == 0
- self.contents.draw_line(cx+1,cy+1, @now_x+1,@now_y+1, GRAPH_SCALINE_COLOR_SHADOW)
- self.contents.draw_line(@pre_x+1,@pre_y+1, @now_x+1,@now_y+1, GRAPH_SCALINE_COLOR_SHADOW)
- self.contents.draw_line(cx,cy, @now_x,@now_y, GRAPH_SCALINE_COLOR)
- self.contents.draw_line(@pre_x,@pre_y, @now_x,@now_y, GRAPH_SCALINE_COLOR)
- self.contents.draw_line(@pre_ex,@pre_ey, @now_ex,@now_ey, @color1, 2, @color2)
- self.contents.font.color = system_color
- self.contents.draw_text(@now_wx,@now_wy, FONT_SIZE*3.1, FONT_SIZE, estr, 1)
- self.contents.font.color = Color.new(255,255,255,128)
- self.contents.draw_text(@now_vx,@now_vy, FONT_SIZE*2, FONT_SIZE, er.to_s + "%", 2)
- self.contents.font.color = normal_color
- end
- end
- alias :draw_actor_hp_original :draw_actor_hp
- def draw_actor_hp(actor, x, y, width = 144)
- if actor.maxhp != 0
- rate = actor.hp.to_f / actor.maxhp
- else
- rate = 0
- end
- plus_x = 0
- rate_x = 0
- plus_y = 25
- plus_width = 0
- rate_width = 100
- height = 10
- align1 = 1
- align2 = 2
- align3 = 0
- grade1 = 1
- grade2 = 0
- color1 = Color.new(0, 0, 0, 192)
- color2 = Color.new(255, 255, 192, 192)
- color3 = Color.new(0, 0, 0, 192)
- color4 = Color.new(64, 0, 0, 192)
- color5 = Color.new(80 - 24 * rate, 80 * rate, 14 * rate, 192)
- color6 = Color.new(240 - 72 * rate, 240 * rate, 62 * rate, 192)
- if actor.maxhp != 0
- hp = (width + plus_width) * actor.hp * rate_width / 100 / actor.maxhp
- else
- hp = 0
- end
- gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
- width, plus_width + width * rate_width / 100,
- height, hp, align1, align2, align3,
- color1, color2, color3, color4, color5, color6, grade1, grade2)
- draw_actor_hp_original(actor, x, y, width)
- end
- alias :draw_actor_sp_original :draw_actor_sp
- def draw_actor_sp(actor, x, y, width = 144)
- if actor.maxsp != 0
- rate = actor.sp.to_f / actor.maxsp
- else
- rate = 1
- end
- plus_x = 0
- rate_x = 0
- plus_y = 25
- plus_width = 0
- rate_width = 100
- height = 10
- align1 = 1
- align2 = 2
- align3 = 0
- grade1 = 1
- grade2 = 0
- color1 = Color.new(0, 0, 0, 192)
- color2 = Color.new(255, 255, 192, 192)
- color3 = Color.new(0, 0, 0, 192)
- color4 = Color.new(0, 64, 0, 192)
- color5 = Color.new(14 * rate, 80 - 24 * rate, 80 * rate, 192)
- color6 = Color.new(62 * rate, 240 - 72 * rate, 240 * rate, 192)
- if actor.maxsp != 0
- sp = (width + plus_width) * actor.sp * rate_width / 100 / actor.maxsp
- else
- sp = (width + plus_width) * rate_width / 100
- end
- gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
- width, plus_width + width * rate_width / 100,
- height, sp, align1, align2, align3,
- color1, color2, color3, color4, color5, color6, grade1, grade2)
- draw_actor_sp_original(actor, x, y, width)
- end
- alias :draw_actor_exp_original :draw_actor_exp
- def draw_actor_exp(actor, x, y, width = 204)
- if actor.next_exp != 0
- rate = actor.now_exp.to_f / actor.next_exp
- else
- rate = 1
- end
- plus_x = 0
- rate_x = 0
- plus_y = 25
- plus_width = 0
- rate_width = 100
- height = 10
- align1 = 1
- align2 = 2
- align3 = 0
- grade1 = 1
- grade2 = 0
- color1 = Color.new(0, 0, 0, 192)
- color2 = Color.new(255, 255, 192, 192)
- color3 = Color.new(0, 0, 0, 192)
- color4 = Color.new(64, 0, 0, 192)
- color5 = Color.new(80 * rate, 80 - 80 * rate ** 2, 80 - 80 * rate, 192)
- color6 = Color.new(240 * rate, 240 - 240 * rate ** 2, 240 - 240 * rate, 192)
- if actor.next_exp != 0
- exp = (width + plus_width) * actor.now_exp * rate_width /
- 100 / actor.next_exp
- else
- exp = (width + plus_width) * rate_width / 100
- end
- gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
- width, plus_width + width * rate_width / 100,
- height, exp, align1, align2, align3,
- color1, color2, color3, color4, color5, color6, grade1, grade2)
- draw_actor_exp_original(actor, x, y)
- end
- def gauge_rect(x, y, rect_width, width, height, gauge, align1, align2, align3,
- color1, color2, color3, color4, color5, color6, grade1, grade2)
- case align1
- when 1
- x += (rect_width - width) / 2
- when 2
- x += rect_width - width
- end
- case align2
- when 1
- y -= height / 2
- when 2
- y -= height
- end
- # ˜g•`‰æ
- self.contents.fill_rect(x, y, width, height, color1)
- self.contents.fill_rect(x + 1, y + 1, width - 2, height - 2, color2)
- if align3 == 0
- if grade1 == 2
- grade1 = 3
- end
- if grade2 == 2
- grade2 = 3
- end
- end
- if (align3 == 1 and grade1 == 0) or grade1 > 0
- color = color3
- color3 = color4
- color4 = color
- end
- if (align3 == 1 and grade2 == 0) or grade2 > 0
- color = color5
- color5 = color6
- color6 = color
- end
- self.contents.gradation_rect(x + 2, y + 2, width - 4, height - 4,
- color3, color4, grade1)
- if align3 == 1
- x += width - gauge
- end
- self.contents.gradation_rect(x + 2, y + 2, gauge - 4, height - 4,
- color5, color6, grade2)
- end
- def up_color
- return Color.new(74, 210, 74)
- end
- def down_color
- return Color.new(170, 170, 170)
- end
- def draw_actor_parameter(actor, x, y, type)
- case type
- when 0
- parameter_name = $data_system.words.atk
- parameter_value = actor.atk
- when 1
- parameter_name = $data_system.words.pdef
- parameter_value = actor.pdef
- when 2
- parameter_name = $data_system.words.mdef
- parameter_value = actor.mdef
- when 3
- parameter_name = $data_system.words.str
- parameter_value = actor.str
- when 4
- parameter_name = $data_system.words.dex
- parameter_value = actor.dex
- when 5
- parameter_name = $data_system.words.agi
- parameter_value = actor.agi
- when 6
- parameter_name = $data_system.words.int
- parameter_value = actor.int
- when 7
- parameter_name = "Evasion"
- parameter_value = actor.eva
- end
- self.contents.font.color = system_color
- self.contents.draw_text(x, y, 120, 32, parameter_name)
- self.contents.font.color = normal_color
- self.contents.draw_text(x + 120, y, 36, 32, parameter_value.to_s, 2)
- end
- end
- #==============================================================================
- # ■ Bitmap
- #==============================================================================
- class Bitmap
- 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.set_pixel(x, y, start_color)
- else
- self.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.set_pixel(x, y, Color.new(r, g, b, a))
- else
- self.fill_rect(x, y, width, width, Color.new(r, g, b, a))
- end
- end
- end
- end
- def gradation_rect(x, y, width, height, color1, color2, align = 0)
- if align == 0
- for i in x...x + width
- red = color1.red + (color2.red - color1.red) * (i - x) / (width - 1)
- green = color1.green +
- (color2.green - color1.green) * (i - x) / (width - 1)
- blue = color1.blue +
- (color2.blue - color1.blue) * (i - x) / (width - 1)
- alpha = color1.alpha +
- (color2.alpha - color1.alpha) * (i - x) / (width - 1)
- color = Color.new(red, green, blue, alpha)
- fill_rect(i, y, 1, height, color)
- end
- elsif align == 1
- for i in y...y + height
- red = color1.red +
- (color2.red - color1.red) * (i - y) / (height - 1)
- green = color1.green +
- (color2.green - color1.green) * (i - y) / (height - 1)
- blue = color1.blue +
- (color2.blue - color1.blue) * (i - y) / (height - 1)
- alpha = color1.alpha +
- (color2.alpha - color1.alpha) * (i - y) / (height - 1)
- color = Color.new(red, green, blue, alpha)
- fill_rect(x, i, width, 1, color)
- end
- elsif align == 2
- for i in x...x + width
- for j in y...y + height
- red = color1.red + (color2.red - color1.red) *
- ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
- green = color1.green + (color2.green - color1.green) *
- ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
- blue = color1.blue + (color2.blue - color1.blue) *
- ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
- alpha = color1.alpha + (color2.alpha - color1.alpha) *
- ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
- color = Color.new(red, green, blue, alpha)
- set_pixel(i, j, color)
- end
- end
- elsif align == 3
- for i in x...x + width
- for j in y...y + height
- red = color1.red + (color2.red - color1.red) *
- ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
- green = color1.green + (color2.green - color1.green) *
- ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
- blue = color1.blue + (color2.blue - color1.blue) *
- ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
- alpha = color1.alpha + (color2.alpha - color1.alpha) *
- ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
- color = Color.new(red, green, blue, alpha)
- set_pixel(i, j, color)
- end
- end
- end
- end
- end
- #==============================================================================
- # ■ Sprite
- #==============================================================================
- module RPG
- class Sprite < ::Sprite
- def damage(value, critical)
- dispose_damage
- if value.is_a?(Numeric)
- damage_string = value.abs.to_s
- else
- damage_string = value.to_s
- end
- bitmap = Bitmap.new(160, 48)
- bitmap.font.name = "Arial Black"
- bitmap.font.size = 32
- bitmap.font.color.set(0, 0, 0)
- bitmap.draw_text(-1, 12-1, 160, 36, damage_string, 1)
- bitmap.draw_text(+1, 12-1, 160, 36, damage_string, 1)
- bitmap.draw_text(-1, 12+1, 160, 36, damage_string, 1)
- bitmap.draw_text(+1, 12+1, 160, 36, damage_string, 1)
- if value.is_a?(Numeric) and value < 0
- bitmap.font.color.set(176, 255, 144)
- else
- bitmap.font.color.set(255, 255, 255)
- end
- bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
- if critical
- bitmap.font.size = 20
- bitmap.font.color.set(0, 0, 0)
- bitmap.draw_text(-1, -1, 160, 20, "CRITICAL", 1)
- bitmap.draw_text(+1, -1, 160, 20, "CRITICAL", 1)
- bitmap.draw_text(-1, +1, 160, 20, "CRITICAL", 1)
- bitmap.draw_text(+1, +1, 160, 20, "CRITICAL", 1)
- bitmap.font.color.set(255, 255, 255)
- bitmap.draw_text(0, 0, 160, 20, "CRITICAL", 1)
- end
- @_damage_sprite = ::Sprite.new
- @_damage_sprite.bitmap = bitmap
- @_damage_sprite.ox = 80 + self.viewport.ox
- @_damage_sprite.oy = 20 + self.viewport.oy
- @_damage_sprite.x = self.x + self.viewport.rect.x
- @_damage_sprite.y = self.y - self.oy / 2 + self.viewport.rect.y
- @_damage_sprite.z = 3000
- @_damage_duration = 40
- end
- def animation(animation, hit)
- dispose_animation
- @_animation = animation
- return if @_animation == nil
- @_animation_hit = hit
- @_animation_duration = @_animation.frame_max
- animation_name = @_animation.animation_name
- animation_hue = @_animation.animation_hue
- bitmap = RPG::Cache.animation(animation_name, animation_hue)
- if @@_reference_count.include?(bitmap)
- @@_reference_count[bitmap] += 1
- else
- @@_reference_count[bitmap] = 1
- end
- @_animation_sprites = []
- if @_animation.position != 3 or not @@_animations.include?(animation)
- for i in 0..15
- sprite = ::Sprite.new
- sprite.bitmap = bitmap
- sprite.visible = false
- @_animation_sprites.push(sprite)
- end
- unless @@_animations.include?(animation)
- @@_animations.push(animation)
- end
- end
- update_animation
- end
- def loop_animation(animation)
- return if animation == @_loop_animation
- dispose_loop_animation
- @_loop_animation = animation
- return if @_loop_animation == nil
- @_loop_animation_index = 0
- animation_name = @_loop_animation.animation_name
- animation_hue = @_loop_animation.animation_hue
- bitmap = RPG::Cache.animation(animation_name, animation_hue)
- if @@_reference_count.include?(bitmap)
- @@_reference_count[bitmap] += 1
- else
- @@_reference_count[bitmap] = 1
- end
- @_loop_animation_sprites = []
- for i in 0..15
- sprite = ::Sprite.new
- sprite.bitmap = bitmap
- sprite.visible = false
- @_loop_animation_sprites.push(sprite)
- end
- update_loop_animation
- end
- def animation_set_sprites(sprites, cell_data, position)
- for i in 0..15
- sprite = sprites[i]
- pattern = cell_data[i, 0]
- if sprite == nil or pattern == nil or pattern == -1
- sprite.visible = false if sprite != nil
- next
- end
- sprite.visible = true
- sprite.src_rect.set(pattern % 5 * 192, pattern / 5 * 192, 192, 192)
- if position == 3
- if self.viewport != nil
- sprite.x = self.viewport.rect.width / 2
- sprite.y = self.viewport.rect.height - 160
- else
- sprite.x = 320
- sprite.y = 240
- end
- else
- sprite.x = self.x + self.viewport.rect.x -
- self.ox + self.src_rect.width / 2
- sprite.y = self.y + self.viewport.rect.y -
- self.oy + self.src_rect.height / 2
- sprite.y -= self.src_rect.height / 4 if position == 0
- sprite.y += self.src_rect.height / 4 if position == 2
- end
- sprite.x += cell_data[i, 1]
- sprite.y += cell_data[i, 2]
- sprite.z = 2000
- sprite.ox = 96
- sprite.oy = 96
- sprite.zoom_x = cell_data[i, 3] / 100.0
- sprite.zoom_y = cell_data[i, 3] / 100.0
- sprite.angle = cell_data[i, 4]
- sprite.mirror = (cell_data[i, 5] == 1)
- sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
- sprite.blend_type = cell_data[i, 7]
- end
- end
- end
- end
- #==============================================================================
- # ■ Window_MenuCommand
- #==============================================================================
- class Window_MenuCommand < Window_Selectable
- def initialize(width, commands)
- super(0, 0, width, commands.size * 32 + 32)
- @item_max = commands.size
- @commands = commands
- self.contents = Bitmap.new(width - 32, @item_max * 32)
- self.contents.font.name = $fontface
- self.contents.font.size = 20
- refresh
- self.index = 0
- end
- def refresh
- self.contents.clear
- self.contents.font.name = $fontface
- self.contents.font.size = 20
- for i in 0...@item_max
- draw_item(i, normal_color)
- end
- end
- def draw_item(index, color)
- self.contents.font.color = color
- rect = Rect.new(24, 32 * index, self.contents.width - 8, 32)
- self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
- bitmap = RPG::Cache.icon("menu" + index.to_s)
- self.contents.blt(x + 3, index * 32 +4, bitmap, Rect.new(0, 0, 24, 24), opacity)
- self.contents.draw_text(rect, @commands[index])
- end
- def disable_item(index)
- draw_item(index, normal_color)
- end
- end
- #==============================================================================
- # ■ Window_ItemMenuCommand
- #==============================================================================
- class Window_ItemMenuCommand < Window_Selectable
- def initialize(width, commands)
- super(0, 0, width, commands.size * 32 + 32)
- @item_max = commands.size
- @commands = commands
- self.contents = Bitmap.new(width - 32, @item_max * 32)
- self.contents.font.name = $fontface
- self.contents.font.size = 20
- refresh
- self.index = 0
- end
- def refresh
- self.contents.clear
- for i in 0...@item_max
- draw_item(i, normal_color)
- end
- end
- def draw_item(index, color)
- self.contents.font.color = color
- rect = Rect.new(12, 32 * index, self.contents.width - 8, 32)
- self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
- bitmap = RPG::Cache.icon("submenu" + index.to_s)
- self.contents.blt(x + 3, index * 32 +4, bitmap, Rect.new(0, 0, 24, 24), opacity)
- self.contents.draw_text(rect, @commands[index])
- end
- def disable_item(index)
- draw_item(index, disabled_color)
- end
- end
- #==============================================================================
- # ■ Window_NewMenuStatus
- #==============================================================================
- class Window_NewMenuStatus < Window_Selectable
- def initialize
- super(0, 0, 432, $game_party.actors.size * 88 + 32)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.contents.font.name = $fontface
- self.contents.font.size = 20
- refresh
- self.active = false
- self.index = -1
- end
- def refresh
- self.contents.clear
- self.height = $game_party.actors.size * 88 + 32
- @item_max = $game_party.actors.size
- for i in 0...$game_party.actors.size
- x = 64
- y = i * 90
- actor = $game_party.actors[i]
- draw_actor_graphic(actor, x, y + 80)
- draw_actor_name(actor, x - 10, y)
- draw_actor_class(actor, x + 154, y)
- draw_actor_level(actor, x + 80, y)
- draw_actor_state(actor, x + 240, y)
- draw_actor_hp(actor, x + 32, y + 32)
- draw_actor_sp(actor, x + 192, y + 32)
- end
- end
- def update_cursor_rect
- if @index < 0
- self.cursor_rect.empty
- else
- self.cursor_rect.set(0, @index * 88, self.width - 32, 92)
- end
- end
- end
- #==============================================================================
- # ■ Window_Basic_Item
- #==============================================================================
- class Window_Basic_Item < Window_Selectable
- def initialize
- super(0, 64, 384, 352)
- @column_max = 1
- refresh
- self.index = 0
- if $game_temp.in_battle
- self.y = 64
- self.height = 272
- self.back_opacity = 160
- end
- end
- def item
- return @data[self.index]
- end
- def refresh
- if self.contents != nil
- self.contents.dispose
- self.contents = nil
- end
- @data = []
- for i in 1...$data_items.size
- if $game_party.item_number(i) > 0
- for x in 0...$basic_items_ids.size
- if i == $basic_items_ids[x]
- @data.push($data_items [i] )
- end
- end
- end
- end
- @item_max = @data.size
- if @item_max > 0
- self.contents = Bitmap.new(width - 32, row_max * 32)
- self.contents.font.name = $fontface
- self.contents.font.size = 20
- for i in 0...@item_max
- draw_item(i)
- end
- end
- end
- def draw_item(index)
- item = @data[index]
- case item
- when RPG::Item
- number = $game_party.item_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 % 1 * (240 + 32)
- y = index / 1 * 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)
- self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
- self.contents.draw_text(x + 304, y, 16, 32, ":", 1)
- self.contents.draw_text(x + 320, y, 24, 32, number.to_s, 2)
- end
- def update_help
- @help_window.set_text(self.item == nil ? "" : self.item.description)
- end
- end
- #==============================================================================
- # ■ Window_NewTarget
- #==============================================================================
- class Window_NewTarget < Window_Selectable
- def initialize
- super(0, 0, 192, 352)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.contents.font.name = $fontface
- self.contents.font.size = 20
- self.z += 10
- @item_max = $game_party.actors.size
- refresh
- end
- def refresh
- self.contents.clear
- for i in 0...$game_party.actors.size
- x = 4
- y = i * 80
- actor = $game_party.actors[i]
- draw_actor_name(actor, x, y)
- draw_actor_state(actor, x + 80, y)
- draw_actor_hp(actor, x, y + 24)
- draw_actor_sp(actor, x, y + 48)
- end
- end
- def update_cursor_rect
- if self.active == false
- self.cursor_rect.empty
- end
- if self.index >= 0 and self.active
- self.cursor_rect.set(0, @index * 80, self.width - 32, 80)
- elsif self.index >= -1 and self.active
- self.cursor_rect.set(0, 0, self.width - 32, self.height - 32)
- end
- end
- end
- #==============================================================================
- # ■ Window_NewHelp
- #==============================================================================
- class Window_NewHelp < Window_Base
- def initialize
- super(0, 0, 576, 64)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.contents.font.name = $fontface
- self.contents.font.size = 20
- end
- def set_text(text, align = 0)
- if text != @text or align != @align
- self.contents.clear
- self.contents.font.name = $fontface
- self.contents.font.size = 20
- self.contents.font.color = normal_color
- self.contents.draw_text(4, 0, self.width - 40, 32, text, align)
- @text = text
- @align = align
- @actor = nil
- end
- self.visible = true
- end
- def set_actor(actor)
- if actor != @actor
- self.contents.clear
- self.contents.font.name = $fontface
- self.contents.font.size = 20
- draw_actor_name(actor, 4, 0)
- draw_actor_state(actor, 140, 0)
- draw_actor_hp(actor, 284, 0)
- draw_actor_sp(actor, 460, 0)
- @actor = actor
- @text = nil
- self.visible = true
- end
- end
- def set_enemy(enemy)
- self.contents.clear
- self.contents.font.name = $fontface
- self.contents.font.size = 20
- text = enemy.name
- state_text = make_battler_state_text(enemy, 112, false)
- if state_text != ""
- text += " " + state_text
- end
- set_text(text, 1)
- end
- end
- #==============================================================================
- # ■ Window_Quest_Item
- #==============================================================================
- class Window_Quest_Item < Window_Selectable
- def initialize
- super(0, 64, 576, 128)
- @column_max = 3
- refresh
- self.index = 0
- if $game_temp.in_battle
- self.y = 64
- self.height = 256
- self.back_opacity = 160
- end
- end
- def item
- return @data[self.index]
- end
- def refresh
- if self.contents != nil
- self.contents.dispose
- self.contents = nil
- end
- @data = []
- for i in 1...$data_items.size
- if $game_party.item_number(i) > 0
- for x in 0...$quest_items_ids.size
- if i == $quest_items_ids[x]
- @data.push($data_items [i] )
- end
- end
- end
- end
- @item_max = @data.size
- if @item_max > 0
- self.contents = Bitmap.new(width - 32, row_max * 32)
- self.contents.font.name = $fontface
- self.contents.font.size = 20
- for i in 0...@item_max
- draw_item(i)
- end
- end
- end
- 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 % 3 * (160 + 32)
- y = index / 3 * 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)
- self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
- self.contents.draw_text(x + 112, y, 16, 32, ":", 1)
- self.contents.draw_text(x + 128, y, 24, 32, number.to_s, 2)
- end
- def update_help
- @help_window.set_text(self.item == nil ? "" : self.item.description)
- end
- end
- #==============================================================================
- # ■ Window_Weapons
- #==============================================================================
- class Window_Weapons < Window_Selectable
- def initialize
- super(0, 64, 224, 352)
- @column_max = 1
- refresh
- self.index = 0
- if $game_temp.in_battle
- self.y = 64
- self.height = 256
- self.back_opacity = 160
- end
- end
- def item
- return @data[self.index]
- end
- def refresh
- if self.contents != nil
- self.contents.dispose
- self.contents = nil
- end
- @data = []
- for i in 1...$data_weapons.size
- if $game_party.weapon_number(i) > 0
- for x in 0...$weapon_ids.size
- if i == $weapon_ids[x]
- @data.push($data_weapons [i] )
- end
- end
- end
- end
- @item_max = @data.size
- if @item_max > 0
- self.contents = Bitmap.new(width - 32, row_max * 32)
- self.contents.font.name = $fontface
- self.contents.font.size = 20
- for i in 0...@item_max
- draw_item(i)
- end
- end
- end
- 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 % 1 * (288 + 32)
- y = index / 1 * 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)
- self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
- self.contents.draw_text(x + 144, y, 16, 32, ":", 1)
- self.contents.draw_text(x + 160, y, 24, 32, number.to_s, 2)
- end
- def update_help
- @help_window.set_text(self.item == nil ? "" : self.item.description)
- end
- end
- #==============================================================================
- # ■ Window_Weapon_Stats
- #==============================================================================
- class Window_Weapon_Stats < Window_Base
- def initialize
- super(0, 0, 352, 352)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.contents.font.name = $fontface
- self.contents.font.size = 20
- @item = nil
- refresh
- end
- def refresh
- self.contents.clear
- if @item == nil
- return
- end
- case @item
- when RPG::Item
- number = $game_party.item_number(@item.id)
- when RPG::Weapon
- number = $game_party.weapon_number(@item.id)
- when RPG::Armor
- number = $game_party.armor_number(@item.id)
- end
- if @item.is_a?(RPG::Item)
- return
- end
- for i in 0...$game_party.actors.size
- actor = $game_party.actors[i]
- if @item.is_a?(RPG::Weapon)
- item1 = $data_weapons[actor.weapon_id]
- elsif @item.kind == 0
- item1 = $data_armors[actor.armor1_id]
- elsif @item.kind == 1
- item1 = $data_armors[actor.armor2_id]
- elsif @item.kind == 2
- item1 = $data_armors[actor.armor3_id]
- else
- item1 = $data_armors[actor.armor4_id]
- end
- if not actor.equippable?(@item)
- draw_actor_graphic(actor, 16, 68 + (84 * i))
- draw_actor_name(actor, 0, -6 + (84 * i))
- draw_actor_level(actor, 86, -6 + (84 * i))
- draw_actor_class(actor, 150, -6 + (84 * i))
- draw_actor_state(actor, 230, -6 + (84 * i))
- self.contents.draw_text(150, 44 + (84 * i), 150, 32, @item.name)
- self.contents.font.name = $fontface
- self.contents.font.size = 20
- self.contents.font.color = normal_color
- self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Cannot Equip")
- end
- if actor.equippable?(@item)
- draw_actor_graphic(actor, 16, 68 + (84 * i))
- draw_actor_name(actor, 0, -6 + (84 * i))
- draw_actor_level(actor, 86, -6 + (84 * i))
- draw_actor_class(actor, 150, -6 + (84 * i))
- draw_actor_state(actor, 230, -6 + (84 * i))
- self.contents.draw_text(150, 44 + (84 * i), 150, 32, @item.name)
- atk1 = 0
- atk2 = 0
- eva1 = 0
- eva2 = 0
- str1 = 0
- str2 = 0
- dex1 = 0
- dex2 = 0
- agi1 = 0
- agi2 = 0
- int1 = 0
- int2 = 0
- pdf1 = 0
- pdf2 = 0
- mdf1 = 0
- mdf2 = 0
- eva1 = 0
- eva2 = 0
- str1 = item1 != nil ? item1.str_plus : 0
- str2 = @item != nil ? @item.str_plus : 0
- dex1 = item1 != nil ? item1.dex_plus : 0
- dex2 = @item != nil ? @item.dex_plus : 0
- agi1 = item1 != nil ? item1.agi_plus : 0
- agi2 = @item != nil ? @item.agi_plus : 0
- int1 = item1 != nil ? item1.int_plus : 0
- int2 = @item != nil ? @item.int_plus : 0
- pdf1 = item1 != nil ? item1.pdef : 0
- pdf2 = @item != nil ? @item.pdef : 0
- mdf1 = item1 != nil ? item1.mdef : 0
- mdf2 = @item != nil ? @item.mdef : 0
- if @item.is_a?(RPG::Weapon)
- atk1 = item1 != nil ? item1.atk : 0
- atk2 = @item != nil ? @item.atk : 0
- end
- if @item.is_a?(RPG::Armor)
- eva1 = item1 != nil ? item1.eva : 0
- eva2 = @item != nil ? @item.eva : 0
- end
- str_change = str2 - str1
- dex_change = dex2 - dex1
- agi_change = agi2 - agi1
- int_change = int2 - int1
- pdf_change = pdf2 - pdf1
- mdf_change = mdf2 - mdf1
- atk_change = atk2 - atk1
- eva_change = eva2 - eva1
- if item1 == nil
- name1 = ""
- else
- name1 = item1.name
- end
- if @item == nil
- name2 = ""
- else
- name2 = @item.name
- end
- if str_change == 0 && dex_change == 0 && agi_change == 0 &&
- pdf_change == 0 && mdf_change == 0 && atk_change == 0 &&
- eva_change == 0 && name1 != name2
- self.contents.font.name = $fontface
- self.contents.font.size = 20
- self.contents.draw_text(48, 18 + (84 * i), 288, 32, "No Change")
- end
- if name1 == name2
- self.contents.font.name = $fontface
- self.contents.font.size = 20
- self.contents.draw_text(48, 18 + (84 * i), 288, 32, "Currently Equipped")
- end
- self.contents.font.name = $fontface
- self.contents.font.size = 20
- self.contents.font.color = normal_color
- if @item.is_a?(RPG::Weapon) && atk_change != 0
- self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
- end
- if @item.is_a?(RPG::Armor) && eva_change != 0
- self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
- end
- if pdf_change != 0
- self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
- end
- if mdf_change != 0
- self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
- end
- if str_change != 0
- self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
- end
- if dex_change != 0
- self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
- end
- if agi_change != 0
- self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
- end
- if str_change != 0
- self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
- end
- end
- end
- end
- def item=(item)
- if @item != item
- @item = item
- refresh
- end
- end
- def draw_actor_graphic(actor, x, y)
- 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)
- self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
- end
- end
- #==============================================================================
- # ■ Window_Armor
- #==============================================================================
- class Window_Armor < Window_Selectable
- def initialize
- super(0, 64, 224, 352)
- @column_max = 1
- refresh
- self.index = 0
- if $game_temp.in_battle
- self.y = 64
- self.height = 256
- self.back_opacity = 160
- end
- end
- def item
- return @data[self.index]
- end
- def refresh
- if self.contents != nil
- self.contents.dispose
- self.contents = nil
- end
- @data = []
- for i in 1...$data_armors.size
- if $game_party.armor_number(i) > 0
- for x in 0...$armor_ids.size
- if i == $armor_ids[x]
- @data.push($data_armors [i] )
- end
- end
- end
- end
- @item_max = @data.size
- if @item_max > 0
- self.contents = Bitmap.new(width - 32, row_max * 32)
- self.contents.font.name = $fontface
- self.contents.font.size = 20
- for i in 0...@item_max
- draw_item(i)
- end
- end
- end
- 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 % 1 * (288 + 32)
- y = index / 1 * 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)
- self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
- self.contents.draw_text(x + 144, y, 16, 32, ":", 1)
- self.contents.draw_text(x + 160, y, 24, 32, number.to_s, 2)
- end
- def update_help
- @help_window.set_text(self.item == nil ? "" : self.item.description)
- end
- end
- #==============================================================================
- # ■ Window_Armor_Stats
- #==============================================================================
- class Window_Armor_Stats < Window_Base
- def initialize
- super(0, 0, 352, 352)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.contents.font.name = $fontface
- self.contents.font.size = 20
- @item = nil
- refresh
- end
- def refresh
- self.contents.clear
- if @item == nil
- return
- end
- case @item
- when RPG::Item
- number = $game_party.item_number(@item.id)
- when RPG::Weapon
- number = $game_party.weapon_number(@item.id)
- when RPG::Armor
- number = $game_party.armor_number(@item.id)
- end
- if @item.is_a?(RPG::Item)
- return
- end
- for i in 0...$game_party.actors.size
- actor = $game_party.actors[i]
- if @item.is_a?(RPG::Weapon)
- item1 = $data_weapons[actor.weapon_id]
- elsif @item.kind == 0
- item1 = $data_armors[actor.armor1_id]
- elsif @item.kind == 1
- item1 = $data_armors[actor.armor2_id]
- elsif @item.kind == 2
- item1 = $data_armors[actor.armor3_id]
- else
- item1 = $data_armors[actor.armor4_id]
- end
- if not actor.equippable?(@item)
- draw_actor_graphic(actor, 16, 68 + (84 * i))
- draw_actor_name(actor, 0, -6 + (84 * i))
- draw_actor_level(actor, 86, -6 + (84 * i))
- draw_actor_class(actor, 150, -6 + (84 * i))
- draw_actor_state(actor, 230, -6 + (84 * i))
- self.contents.draw_text(150, 44 + (84 * i), 150, 32, @item.name)
- self.contents.font.name = $fontface
- self.contents.font.size = 20
- self.contents.font.color = normal_color
- self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Cannot Equip")
- end
- if actor.equippable?(@item)
- draw_actor_graphic(actor, 16, 68 + (84 * i))
- draw_actor_name(actor, 0, -6 + (84 * i))
- draw_actor_level(actor, 86, -6 + (84 * i))
- draw_actor_class(actor, 150, -6 + (84 * i))
- draw_actor_state(actor, 230, -6 + (84 * i))
- self.contents.draw_text(150, 44 + (84 * i), 150, 32, @item.name)
- atk1 = 0
- atk2 = 0
- eva1 = 0
- eva2 = 0
- str1 = 0
- str2 = 0
- dex1 = 0
- dex2 = 0
- agi1 = 0
- agi2 = 0
- int1 = 0
- int2 = 0
- pdf1 = 0
- pdf2 = 0
- mdf1 = 0
- mdf2 = 0
- eva1 = 0
- eva2 = 0
- str1 = item1 != nil ? item1.str_plus : 0
- str2 = @item != nil ? @item.str_plus : 0
- dex1 = item1 != nil ? item1.dex_plus : 0
- dex2 = @item != nil ? @item.dex_plus : 0
- agi1 = item1 != nil ? item1.agi_plus : 0
- agi2 = @item != nil ? @item.agi_plus : 0
- int1 = item1 != nil ? item1.int_plus : 0
- int2 = @item != nil ? @item.int_plus : 0
- pdf1 = item1 != nil ? item1.pdef : 0
- pdf2 = @item != nil ? @item.pdef : 0
- mdf1 = item1 != nil ? item1.mdef : 0
- mdf2 = @item != nil ? @item.mdef : 0
- if @item.is_a?(RPG::Weapon)
- atk1 = item1 != nil ? item1.atk : 0
- atk2 = @item != nil ? @item.atk : 0
- end
- if @item.is_a?(RPG::Armor)
- eva1 = item1 != nil ? item1.eva : 0
- eva2 = @item != nil ? @item.eva : 0
- end
- str_change = str2 - str1
- dex_change = dex2 - dex1
- agi_change = agi2 - agi1
- int_change = int2 - int1
- pdf_change = pdf2 - pdf1
- mdf_change = mdf2 - mdf1
- atk_change = atk2 - atk1
- eva_change = eva2 - eva1
- if item1 == nil
- name1 = ""
- else
- name1 = item1.name
- end
- if @item == nil
- name2 = ""
- else
- name2 = @item.name
- end
- if str_change == 0 && dex_change == 0 && agi_change == 0 &&
- pdf_change == 0 && mdf_change == 0 && atk_change == 0 &&
- eva_change == 0 && name1 != name2
- self.contents.font.name = $fontface
- self.contents.font.size = 20
- self.contents.draw_text(48, 18 + (84 * i), 288, 32, "No Change")
- end
- if name1 == name2
- self.contents.font.name = $fontface
- self.contents.font.size = 20
- self.contents.draw_text(48, 18 + (84 * i), 288, 32, "Currently Equipped")
- end
- self.contents.font.name = $fontface
- self.contents.font.size = 20
- self.contents.font.color = normal_color
- if @item.is_a?(RPG::Weapon) && atk_change != 0
- self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
- end
- if @item.is_a?(RPG::Armor) && eva_change != 0
- self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
- end
- if pdf_change != 0
- self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
- end
- if mdf_change != 0
- self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
- end
- if str_change != 0
- self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
- end
- if dex_change != 0
- self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
- end
- if agi_change != 0
- self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
- end
- if str_change != 0
- self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
- end
- end
- end
- end
- def item=(item)
- if @item != item
- @item = item
- refresh
- end
- end
- def draw_actor_graphic(actor, x, y)
- 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)
- self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
- end
- end
- #==============================================================================
- # ■ Window_Accessory
- #==============================================================================
- class Window_Accessory < Window_Selectable
- def initialize
- super(0, 64, 224, 352)
- @column_max = 1
- refresh
- self.index = 0
- if $game_temp.in_battle
- self.y = 64
- self.height = 256
- self.back_opacity = 160
- end
- end
- def item
- return @data[self.index]
- end
- def refresh
- if self.contents != nil
- self.contents.dispose
- self.contents = nil
- end
- @data = []
- for i in 1...$data_armors.size
- if $game_party.armor_number(i) > 0
- for x in 0...$accessory_ids.size
- if i == $accessory_ids[x]
- @data.push($data_armors [i] )
- end
- end
- end
- end
- @item_max = @data.size
- if @item_max > 0
- self.contents = Bitmap.new(width - 32, row_max * 32)
- self.contents.font.name = $fontface
- self.contents.font.size = 20
- for i in 0...@item_max
- draw_item(i)
- end
- end
- end
- 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 % 1 * (288 + 32)
- y = index / 1 * 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)
- self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
- self.contents.draw_text(x + 144, y, 16, 32, ":", 1)
- self.contents.draw_text(x + 160, y, 24, 32, number.to_s, 2)
- end
- def update_help
- @help_window.set_text(self.item == nil ? "" : self.item.description)
- end
- end
- #==============================================================================
- # ■ Window_Accessory_Stats
- #==============================================================================
- class Window_Accessory_Stats < Window_Base
- def initialize
- super(0, 0, 352, 352)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.contents.font.name = $fontface
- self.contents.font.size = 20
- @item = nil
- refresh
- end
- def refresh
- self.contents.clear
- if @item == nil
- return
- end
- case @item
- when RPG::Item
- number = $game_party.item_number(@item.id)
- when RPG::Weapon
- number = $game_party.weapon_number(@item.id)
- when RPG::Armor
- number = $game_party.armor_number(@item.id)
- end
- if @item.is_a?(RPG::Item)
- return
- end
- for i in 0...$game_party.actors.size
- actor = $game_party.actors[i]
- if @item.is_a?(RPG::Weapon)
- item1 = $data_weapons[actor.weapon_id]
- elsif @item.kind == 0
- item1 = $data_armors[actor.armor1_id]
- elsif @item.kind == 1
- item1 = $data_armors[actor.armor2_id]
- elsif @item.kind == 2
- item1 = $data_armors[actor.armor3_id]
- else
- item1 = $data_armors[actor.armor4_id]
- end
- if not actor.equippable?(@item)
- draw_actor_graphic(actor, 16, 68 + (84 * i))
- draw_actor_name(actor, 0, -6 + (84 * i))
- draw_actor_level(actor, 86, -6 + (84 * i))
- draw_actor_class(actor, 150, -6 + (84 * i))
- draw_actor_state(actor, 230, -6 + (84 * i))
- self.contents.draw_text(150, 44 + (84 * i), 150, 32, @item.name)
- self.contents.font.name = $fontface
- self.contents.font.size = 20
- self.contents.font.color = normal_color
- self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Cannot Equip")
- end
- if actor.equippable?(@item)
- draw_actor_graphic(actor, 16, 68 + (84 * i))
- draw_actor_name(actor, 0, -6 + (84 * i))
- draw_actor_level(actor, 86, -6 + (84 * i))
- draw_actor_class(actor, 150, -6 + (84 * i))
- draw_actor_state(actor, 230, -6 + (84 * i))
- self.contents.draw_text(150, 44 + (84 * i), 150, 32, @item.name)
- atk1 = 0
- atk2 = 0
- eva1 = 0
- eva2 = 0
- str1 = 0
- str2 = 0
- dex1 = 0
- dex2 = 0
- agi1 = 0
- agi2 = 0
- int1 = 0
- int2 = 0
- pdf1 = 0
- pdf2 = 0
- mdf1 = 0
- mdf2 = 0
- eva1 = 0
- eva2 = 0
- str1 = item1 != nil ? item1.str_plus : 0
- str2 = @item != nil ? @item.str_plus : 0
- dex1 = item1 != nil ? item1.dex_plus : 0
- dex2 = @item != nil ? @item.dex_plus : 0
- agi1 = item1 != nil ? item1.agi_plus : 0
- agi2 = @item != nil ? @item.agi_plus : 0
- int1 = item1 != nil ? item1.int_plus : 0
- int2 = @item != nil ? @item.int_plus : 0
- pdf1 = item1 != nil ? item1.pdef : 0
- pdf2 = @item != nil ? @item.pdef : 0
- mdf1 = item1 != nil ? item1.mdef : 0
- mdf2 = @item != nil ? @item.mdef : 0
- if @item.is_a?(RPG::Weapon)
- atk1 = item1 != nil ? item1.atk : 0
- atk2 = @item != nil ? @item.atk : 0
- end
- if @item.is_a?(RPG::Armor)
- eva1 = item1 != nil ? item1.eva : 0
- eva2 = @item != nil ? @item.eva : 0
- end
- str_change = str2 - str1
- dex_change = dex2 - dex1
- agi_change = agi2 - agi1
- int_change = int2 - int1
- pdf_change = pdf2 - pdf1
- mdf_change = mdf2 - mdf1
- atk_change = atk2 - atk1
- eva_change = eva2 - eva1
- if item1 == nil
- name1 = ""
- else
- name1 = item1.name
- end
- if @item == nil
- name2 = ""
- else
- name2 = @item.name
- end
- if str_change == 0 && dex_change == 0 && agi_change == 0 &&
- pdf_change == 0 && mdf_change == 0 && atk_change == 0 &&
- eva_change == 0 && name1 != name2
- self.contents.font.name = $fontface
- self.contents.font.size = 20
- self.contents.draw_text(48, 18 + (84 * i), 288, 32, "Equippable")
- end
- if name1 == name2
- self.contents.font.name = $fontface
- self.contents.font.size = 20
- self.contents.draw_text(48, 18 + (84 * i), 288, 32, "Currently Equipped")
- end
- self.contents.font.name = $fontface
- self.contents.font.size = 20
- self.contents.font.color = normal_color
- if @item.is_a?(RPG::Weapon) && atk_change != 0
- self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
- end
- if @item.is_a?(RPG::Armor) && eva_change != 0
- self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
- end
- if pdf_change != 0
- self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
- end
- if mdf_change != 0
- self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
- end
- if str_change != 0
- self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
- end
- if dex_change != 0
- self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
- end
- if agi_change != 0
- self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
- end
- if str_change != 0
- self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
- end
- end
- end
- end
- def item=(item)
- if @item != item
- @item = item
- refresh
- end
- end
- def draw_actor_graphic(actor, x, y)
- 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)
- self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
- end
- end
- #==============================================================================
- # ■ Window_NewSkill
- #==============================================================================
- class Window_NewSkill < Window_Selectable
- def initialize(actor)
- super(0, 64, 384, 352)
- @actor = actor
- @column_max = 1
- refresh
- self.index = 0
- if $game_temp.in_battle
- self.y = 64
- self.height = 256
- self.back_opacity = 160
- end
- end
- def skill
- return @data[self.index]
- end
- def update_actor(actor)
- @actor = actor
- refresh
- end
- def refresh
- if self.contents != nil
- self.contents.dispose
- self.contents = nil
- end
- @data = []
- for i in 0...@actor.skills.size
- skill = $data_skills[@actor.skills[i]]
- if skill != nil
- @data.push(skill)
- end
- end
- @item_max = @data.size
- if @item_max > 0
- self.contents = Bitmap.new(width - 32, row_max * 32)
- self.contents.font.name = $fontface
- self.contents.font.size = 20
- for i in 0...@item_max
- draw_item(i)
- end
- end
- end
- def draw_item(index)
- skill = @data[index]
- if @actor.skill_can_use?(skill.id)
- self.contents.font.color = normal_color
- else
- self.contents.font.color = disabled_color
- end
- x = 4 + index % 1 * (240 + 32)
- y = index / 1 * 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 == normal_color ? 255 : 128
- self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
- self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
- self.contents.draw_text(x + 288, y, 48, 32, skill.sp_cost.to_s, 2)
- end
- def update_help
- @help_window.set_text(self.skill == nil ? "" : self.skill.description)
- end
- end
- #==============================================================================
- # ■ Window_NewEquipLeft
- #==============================================================================
- class Window_NewEquipLeft < Window_Base
- attr_accessor :mode
- attr_accessor :changes
- def initialize(actor)
- super(32, 96, 272, 352)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.contents.font.name = $fontface
- self.contents.font.size = 20
- self.z += 100
- @actor = actor
- @mode = 0
- @changes = [0, 0, 0, 0, 0, 0, 0, 0]
- @elem_text = ""
- @stat_text = ""
- refresh
- end
- def update_actor(actor)
- @actor = actor
- refresh
- end
- def refresh
- self.contents.clear
- draw_actor_name(@actor, 4, 0)
- draw_actor_level(@actor, 180, 0)
- draw_actor_parameter(@actor, 4, 24, 0)
- draw_actor_parameter(@actor, 4, 48, 1)
- draw_actor_parameter(@actor, 4, 72, 2)
- draw_actor_parameter(@actor, 4, 96, 3)
- draw_actor_parameter(@actor, 4, 120, 4)
- draw_actor_parameter(@actor, 4, 144, 5)
- draw_actor_parameter(@actor, 4, 168, 6)
- if @mode == 0
- self.contents.font.color = up_color
- self.contents.draw_text(4, 216, 200, 32, "Elemental Attack:")
- self.contents.draw_text(4, 264, 200, 32, "Status Attack:")
- end
- if @mode == 1
- self.contents.font.color = up_color
- self.contents.draw_text(4, 216, 200, 32, "Elemental Defense:")
- self.contents.draw_text(4, 264, 200, 32, "Status Defense:")
- end
- self.contents.font.color = normal_color
- self.contents.draw_text(24, 240, 220, 32, @elem_text)
- self.contents.draw_text(24, 288, 220, 32, @stat_text)
- if @new_atk != nil
- self.contents.font.color = system_color
- self.contents.draw_text(168, 24, 40, 32, "»»", 1)
- if @changes[0] == 0
- self.contents.font.color = normal_color
- elsif @changes[0] == -1
- self.contents.font.color = down_color
- else
- self.contents.font.color = up_color
- end
- self.contents.draw_text(200, 24, 36, 32, @new_atk.to_s, 2)
- end
- if @new_pdef != nil
- self.contents.font.color = system_color
- self.contents.draw_text(168, 48, 40, 32, "»»", 1)
- if @changes[1] == 0
- self.contents.font.color = normal_color
- elsif @changes[1] == -1
- self.contents.font.color = down_color
- else
- self.contents.font.color = up_color
- end
- self.contents.draw_text(200, 48, 36, 32, @new_pdef.to_s, 2)
- end
- if @new_mdef != nil
- self.contents.font.color = system_color
- self.contents.draw_text(168, 72, 40, 32, "»»", 1)
- if @changes[2] == 0
- self.contents.font.color = normal_color
- elsif @changes[2] == -1
- self.contents.font.color = down_color
- else
- self.contents.font.color = up_color
- end
- self.contents.draw_text(200, 72, 36, 32, @new_mdef.to_s, 2)
- end
- if @new_str != nil
- self.contents.font.color = system_color
- self.contents.draw_text(168, 96, 40, 32, "»»", 1)
- if @changes[3] == 0
- self.contents.font.color = normal_color
- elsif @changes[3] == -1
- self.contents.font.color = down_color
- else
- self.contents.font.color = up_color
- end
- self.contents.draw_text(200, 96, 36, 32, @new_str.to_s, 2)
- end
- if @new_dex != nil
- self.contents.font.color = system_color
- self.contents.draw_text(168, 120, 40, 32, "»»", 1)
- if @changes[4] == 0
- self.contents.font.color = normal_color
- elsif @changes[4] == -1
- self.contents.font.color = down_color
- else
- self.contents.font.color = up_color
- end
- self.contents.draw_text(200, 120, 36, 32, @new_dex.to_s, 2)
- end
- if @new_agi != nil
- self.contents.font.color = system_color
- self.contents.draw_text(168, 144, 40, 32, "»»", 1)
- if @changes[5] == 0
- self.contents.font.color = normal_color
- elsif @changes[5] == -1
- self.contents.font.color = down_color
- else
- self.contents.font.color = up_color
- end
- self.contents.draw_text(200, 144, 36, 32, @new_agi.to_s, 2)
- end
- if @new_int != nil
- self.contents.font.color = system_color
- self.contents.draw_text(168, 168, 40, 32, "»»", 1)
- if @changes[6] == 0
- self.contents.font.color = normal_color
- elsif @changes[6] == -1
- self.contents.font.color = down_color
- else
- self.contents.font.color = up_color
- end
- self.contents.draw_text(200, 168, 36, 32, @new_int.to_s, 2)
- end
- end
- def set_new_parameters(new_atk, new_pdef, new_mdef, new_str, new_dex,
- new_agi, new_int, new_eva, elem_text, stat_text)
- flag = false
- if new_atk != @new_atk || new_pdef != @new_pdef || new_mdef != @new_mdef
- flag = true
- end
- if new_str != @new_str || new_dex != @new_dex || new_agi != @new_agi
- flag = true
- end
- if new_eva != @new_eva || elem_text != @elem_text || stat_text != @stat_text
- flag = true
- end
- @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
- @new_eva = new_eva
- @elem_text = elem_text
- @stat_text = stat_text
- if flag
- refresh
- end
- end
- end
- #==============================================================================
- # ■ Window_NewEquipRight
- #==============================================================================
- class Window_NewEquipRight < Window_Selectable
- def initialize(actor)
- super(304, 96, 304, 192)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.contents.font.name = $fontface
- self.contents.font.size = 20
- @actor = actor
- refresh
- self.index = 0
- end
- def item
- return @data[self.index]
- end
- def update_actor(actor)
- @actor = actor
- refresh
- end
- def refresh
- self.contents.clear
- @data = []
- @data.push($data_weapons[@actor.weapon_id])
- @data.push($data_armors[@actor.armor1_id])
- @data.push($data_armors[@actor.armor2_id])
- @data.push($data_armors[@actor.armor3_id])
- @data.push($data_armors[@actor.armor4_id])
- @item_max = @data.size
- self.contents.font.color = system_color
- self.contents.draw_text(4, 32 * 0, 92, 32, $data_system.words.weapon)
- self.contents.draw_text(4, 32 * 1, 92, 32, $data_system.words.armor1)
- self.contents.draw_text(4, 32 * 2, 92, 32, $data_system.words.armor2)
- self.contents.draw_text(4, 32 * 3, 92, 32, $data_system.words.armor3)
- self.contents.draw_text(5, 32 * 4, 92, 32, $data_system.words.armor4)
- draw_item_name(@data[0], 92, 32 * 0)
- draw_item_name(@data[1], 92, 32 * 1)
- draw_item_name(@data[2], 92, 32 * 2)
- draw_item_name(@data[3], 92, 32 * 3)
- draw_item_name(@data[4], 92, 32 * 4)
- end
- def update_help
- @help_window.set_text(self.item == nil ? "" : self.item.description)
- end
- end
- #==============================================================================
- # ■ Window_NewEquipItem
- #==============================================================================
- class Window_NewEquipItem < Window_Selectable
- def initialize(actor, equip_type)
- super(304, 288, 304, 160)
- @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 update_actor(actor, equip_type)
- @actor = actor
- @equip_type = equip_type
- refresh
- end
- def refresh
- if self.contents != nil
- self.contents.dispose
- self.contents = nil
- end
- @data = []
- if @equip_type == 0
- 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 != 0
- 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 $data_armors[i].kind == @equip_type-1
- @data.push($data_armors[i])
- end
- end
- end
- end
- @data.push(nil)
- @item_max = @data.size
- self.contents = Bitmap.new(width - 32, row_max * 32)
- self.contents.font.name = $fontface
- self.contents.font.size = 20
- for i in 0...@item_max-1
- draw_item(i)
- end
- s = @data.size-1
- self.contents.draw_text(4, s*32, 100, 32, "[Remove]")
- end
- def draw_item(index)
- item = @data[index]
- 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
- 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
- self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
- self.contents.draw_text(x + 208, y, 16, 32, ":", 1)
- self.contents.draw_text(x + 224, y, 24, 32, number.to_s, 2)
- end
- def update_help
- @help_window.set_text(self.item == nil ? "" : self.item.description)
- end
- end
- #==============================================================================
- # ■ Window_NewStatus
- #==============================================================================
- class Window_NewStatus < Window_Base
- def initialize(actor)
- super(0, 0, 576, 416)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.contents.font.name = $fontface
- self.contents.font.size = 20
- @actor = actor
- refresh
- end
- def refresh
- self.contents.clear
- draw_actor_name(@actor, 54, 0)
- draw_actor_battler(@actor, 80, 200)
- draw_actor_class(@actor, 254, 0)
- draw_actor_level(@actor, 184, 0)
- draw_actor_state(@actor, 184, 40)
- draw_actor_hp(@actor, 184, 80, 172)
- draw_actor_sp(@actor, 184, 120, 172)
- draw_actor_exp(@actor, 184, 160, 172)
- draw_actor_parameter(@actor, 386, 0, 0)
- draw_actor_parameter(@actor, 386, 24, 1)
- draw_actor_parameter(@actor, 386, 48, 2)
- draw_actor_parameter(@actor, 386, 72, 3)
- draw_actor_parameter(@actor, 386, 96, 4)
- draw_actor_parameter(@actor, 386, 120, 5)
- draw_actor_parameter(@actor, 386, 144, 6)
- draw_actor_parameter(@actor, 386, 168, 7)
- self.contents.font.color = system_color
- self.contents.draw_text(45, 196, 180, 32, "Elemental Vulnerability" )
- self.contents.font.size = 16
- draw_actor_element_radar_graph(@actor, 14, 204)
- self.contents.font.size = 20
- self.contents.font.color = system_color
- self.contents.draw_text(360, 200, 96, 32, "Equipment")
- self.contents.draw_text(280, 228, 96, 32, "Weapon")
- self.contents.draw_text(280, 256, 96, 32, "Shield")
- self.contents.draw_text(280, 284, 96, 32, "Helmet")
- self.contents.draw_text(280, 312, 96, 32, "Armor")
- self.contents.draw_text(280, 340, 96, 32, "Accessory")
- equip = $data_weapons[@actor.weapon_id]
- if @actor.equippable?(equip)
- draw_item_name($data_weapons[@actor.weapon_id], 386, 228)
- else
- self.contents.font.color = knockout_color
- self.contents.draw_text(386, 228, 192, 32, "Nothing equipped")
- end
- equip1 = $data_armors[@actor.armor1_id]
- if @actor.equippable?(equip1)
- draw_item_name($data_armors[@actor.armor1_id], 386, 256)
- else
- self.contents.font.color = crisis_color
- self.contents.draw_text(386, 256, 192, 32, "Nothing equipped")
- end
- equip2 = $data_armors[@actor.armor2_id]
- if @actor.equippable?(equip2)
- draw_item_name($data_armors[@actor.armor2_id], 386, 284)
- else
- self.contents.font.color = crisis_color
- self.contents.draw_text(386, 284, 192, 32, "Nothing equipped")
- end
- equip3 = $data_armors[@actor.armor3_id]
- if @actor.equippable?(equip3)
- draw_item_name($data_armors[@actor.armor3_id], 386, 312)
- else
- self.contents.font.color = crisis_color
- self.contents.draw_text(386, 312, 192, 32, "Nothing equipped")
- end
- equip4 = $data_armors[@actor.armor4_id]
- if @actor.equippable?(equip4)
- draw_item_name($data_armors[@actor.armor4_id], 386, 340)
- else
- self.contents.font.color = crisis_color
- self.contents.draw_text(386, 340, 192, 32, "Nothing equipped")
- end
- end
- def update_actor(actor)
- @actor = actor
- refresh
- end
- def dummy
- self.contents.font.color = system_color
- self.contents.draw_text(320, 112, 96, 32, $data_system.words.weapon)
- self.contents.draw_text(320, 176, 96, 32, $data_system.words.armor1)
- self.contents.draw_text(320, 240, 96, 32, $data_system.words.armor2)
- self.contents.draw_text(320, 304, 96, 32, $data_system.words.armor3)
- self.contents.draw_text(320, 368, 96, 32, $data_system.words.armor4)
- draw_item_name($data_weapons[@actor.weapon_id], 320 + 24, 144)
- draw_item_name($data_armors[@actor.armor1_id], 320 + 24, 208)
- draw_item_name($data_armors[@actor.armor2_id], 320 + 24, 272)
- draw_item_name($data_armors[@actor.armor3_id], 320 + 24, 336)
- draw_item_name($data_armors[@actor.armor4_id], 320 + 24, 400)
- end
- end
- #==============================================================================
- # ■ Window_NewGold
- #==============================================================================
- class Window_NewGold < Window_Base
- def initialize
- super(0, 0, 160, 64)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.contents.font.name = $fontface
- self.contents.font.size = 20
- refresh
- end
- def refresh
- self.contents.clear
- cx = contents.text_size($data_system.words.gold).width
- self.contents.font.color = normal_color
- self.contents.draw_text(4, 0, 120-cx-2, 32, $game_party.gold.to_s + " ", 2)
- self.contents.font.color = system_color
- self.contents.draw_text(124-cx, 0, cx, 32, $data_system.words.gold, 2)
- end
- end
- #==============================================================================
- # ■ class Window_NewTime
- # written by Deke
- #--------------------------------------------------------------------------------------------------------------------------------------------
- #==============================================================================
- class Window_NewTime < Window_Base
- def initialize
- super(0, 0, 160, 96)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.contents.font.name = $fontface
- self.contents.font.size = 20
- refresh
- end
- def refresh
- self.contents.clear
- self.windowskin = RPG::Cache.windowskin($game_system.windowskin_name)
- self.contents.font.name = $fontface
- self.contents.font.size = 20
- @total_sec = Graphics.frame_count / Graphics.frame_rate
- @minute=$game_time.get_minute.floor
- hour = $game_time.get_hour
- pm_flag= hour >=12 ? true : false
- hour= hour >= 12 ? hour-12 : hour
- day=$game_time.get_day
- month=$game_time.get_month
- year=$game_time.get_year
- if hour.floor==0
- text=sprintf("%02d:%02d",12,@minute)
- else
- text=sprintf("%02d:%02d",hour,@minute)
- end
- if pm_flag
- text += " PM"
- else
- text += " AM"
- end
- self.contents.font.color = normal_color
- self.contents.draw_text(16, 32, 110, 32, text, 2)
- text = sprintf("%02d - %02d - %02d", month, day, year)
- self.contents.font.color = system_color
- self.contents.draw_text(4,0,120,32,text)
- end
- def update
- if $game_time.get_minute.floor != @minute
- refresh
- end
- end
- end
- #==============================================================================
- # ■ Window_NewLocation
- #==============================================================================
- class Window_NewLocation < Window_Base
- def initialize
- super(0, 0, 160, 96)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.contents.font.name = $fontface
- self.contents.font.size = 20
- refresh
- end
- def refresh
- self.contents.clear
- self.contents.font.color = system_color
- self.contents.draw_text(4, 0, 120, 32, "Location")
- self.contents.font.color = normal_color
- self.contents.draw_text(4, 32, 120, 32, $game_map.name.to_s, 2)
- end
- end
- #==============================================================================
- # ■ Window_OptionMenuCommand
- #==============================================================================
- class Window_OptionMenuCommand < Window_Selectable
- def initialize(width, commands)
- super(0, 0, width, commands.size * 32 + 32)
- @item_max = commands.size
- @commands = commands
- self.contents = Bitmap.new(width - 32, @item_max * 32)
- self.contents.font.name = $fontface
- self.contents.font.size = 20
- refresh
- self.index = 0
- end
- def refresh
- self.contents.clear
- for i in 0...@item_max
- draw_item(i, normal_color)
- end
- end
- def draw_item(index, color)
- self.contents.font.color = color
- rect = Rect.new(12, 32 * index, self.contents.width - 8, 32)
- self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
- bitmap = RPG::Cache.icon("optionmenu" + index.to_s)
- self.contents.blt(x + 3, index * 32 +4, bitmap, Rect.new(0, 0, 24, 24), opacity)
- self.contents.draw_text(rect, @commands[index])
- end
- def disable_item(index)
- draw_item(index, disabled_color)
- end
- end
- #==============================================================================
- # ■ Window_CurrentWindowSkin
- #==============================================================================
- class Window_CurrentWindowSkin < Window_Base
- def initialize
- super(0, 0, 192, 96)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.contents.font.name = $fontface
- self.contents.font.size = 20
- end
- def refresh
- self.contents.clear
- self.contents.font.color = system_color
- self.contents.draw_text(4, 0, 120, 32, "Current skin")
- self.contents.font.color = normal_color
- self.contents.draw_text(4, 32, 120, 32, $game_system.windowskin_name.to_s, 2.9)
- end
- end
- #==============================================================================
- # ■ Window_WindowSkin
- #==============================================================================
- class Window_WindowSkin < Window_Selectable
- def initialize(width, commands)
- super(0, 0, width, commands.size * 32 + 32)
- @item_max = commands.size
- @commands = commands
- self.contents = Bitmap.new(width - 32, @item_max * 32)
- self.contents.font.name = $fontface
- self.contents.font.size = 20
- refresh
- self.index = 0
- end
- def refresh
- self.contents.clear
- for i in 0...@item_max
- draw_item(i, normal_color)
- end
- end
- def draw_item(index, color)
- self.contents.font.color = color
- rect = Rect.new(12, 32 * index, self.contents.width - 8, 32)
- self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
- bitmap = RPG::Cache.icon("skin" + index.to_s)
- self.contents.blt(x + 3, index * 32 +4, bitmap, Rect.new(0, 0, 24, 24), opacity)
- self.contents.draw_text(rect, @commands[index])
- end
- def disable_item(index)
- draw_item(index, disabled_color)
- end
- end
- #==============================================================================
- # ■ Window_CurrentFontType
- #==============================================================================
- class Window_CurrentFontType < Window_Base
- def initialize
- super(0, 0, 192, 96)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.contents.font.name = $fontface
- self.contents.font.size = 20
- end
- def refresh
- self.contents.clear
- self.contents.font.color = system_color
- self.contents.draw_text(4, 0, 120, 32, "Current Font")
- self.contents.font.color = normal_color
- self.contents.draw_text(4, 32, 120, 32, $fontface.to_s, 2.9)
- end
- end
- #==============================================================================
- # ■ Window_FontType
- #==============================================================================
- class Window_FontType < Window_Selectable
- def initialize(width, commands)
- super(0, 0, width, commands.size * 32 + 32)
- @item_max = commands.size
- @commands = commands
- self.contents = Bitmap.new(width - 32, @item_max * 32)
- self.contents.font.name = $fontface
- self.contents.font.size = 20
- refresh
- self.index = 0
- end
- def refresh
- self.contents.clear
- for i in 0...@item_max
- draw_item(i, normal_color)
- end
- end
- def draw_item(index, color)
- self.contents.font.color = color
- rect = Rect.new(4, 32 * index, self.contents.width - 8, 32)
- self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
- self.contents.draw_text(rect, @commands[index])
- end
- def disable_item(index)
- draw_item(index, disabled_color)
- end
- end
- #==============================================================================
- # ■ Window_CurrentBGM_Volume
- #==============================================================================
- class Window_CurrentBGM_Volume < Window_Base
- def initialize
- super(0, 0, 192, 96)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.contents.font.name = $fontface
- self.contents.font.size = 20
- end
- def refresh
- self.contents.clear
- self.contents.font.color = system_color
- self.contents.draw_text(4, 0, 160, 32, "Current BGM Volume")
- self.contents.font.color = normal_color
- self.contents.draw_text(4, 32, 120, 32, $game_system.bgm_volume.to_s + "%", 2.9)
- end
- end
- #==============================================================================
- # ■ Window_BGM_Volume
- #==============================================================================
- class Window_BGM_Volume < Window_Selectable
- def initialize(width, commands)
- super(0, 0, width, commands.size * 32 + 32)
- @item_max = commands.size
- @commands = commands
- self.contents = Bitmap.new(width - 32, @item_max * 32)
- self.contents.font.name = $fontface
- self.contents.font.size = 20
- refresh
- self.index = 0
- end
- def refresh
- self.contents.clear
- self.contents.font.name = $fontface
- self.contents.font.size = 20
- for i in 0...@item_max
- draw_item(i, normal_color)
- end
- end
- def draw_item(index, color)
- self.contents.font.color = color
- rect = Rect.new(4, 32 * index, self.contents.width - 8, 32)
- self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
- self.contents.draw_text(rect, @commands[index])
- end
- def disable_item(index)
- draw_item(index, disabled_color)
- end
- end
- #==============================================================================
- # ■ Window_CurrentSFX_Volume
- #==============================================================================
- class Window_CurrentSFX_Volume < Window_Base
- def initialize
- super(0, 0, 192, 96)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.contents.font.name = $fontface
- self.contents.font.size = 20
- end
- def refresh
- self.contents.clear
- self.contents.font.color = system_color
- self.contents.draw_text(4, 0, 160, 32, "Current SFX Volume")
- self.contents.font.color = normal_color
- self.contents.draw_text(4, 32, 120, 32, $game_system.se_volume.to_s + "%", 2.9)
- end
- end
- #==============================================================================
- # ■ Window_SFX_Volume
- #==============================================================================
- class Window_SFX_Volume < Window_Selectable
- def initialize(width, commands)
- super(0, 0, width, commands.size * 32 + 32)
- @item_max = commands.size
- @commands = commands
- self.contents = Bitmap.new(width - 32, @item_max * 32)
- self.contents.font.name = $fontface
- self.contents.font.size = 20
- refresh
- self.index = 0
- end
- def refresh
- self.contents.clear
- self.contents.font.name = $fontface
- self.contents.font.size = 20
- for i in 0...@item_max
- draw_item(i, normal_color)
- end
- end
- def draw_item(index, color)
- self.contents.font.color = color
- rect = Rect.new(4, 32 * index, self.contents.width - 8, 32)
- self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
- self.contents.draw_text(rect, @commands[index])
- end
- def disable_item(index)
- draw_item(index, disabled_color)
- end
- end
- #==============================================================================
- # ■ Window_NewCommand
- #==============================================================================
- class Window_NewCommand < Window_Selectable
- def initialize(width, commands)
- super(0, 0, width, commands.size * 32 + 32)
- @item_max = commands.size
- @commands = commands
- self.contents = Bitmap.new(width - 32, @item_max * 32)
- self.contents.font.name = $fontface
- self.contents.font.size = 20
- refresh
- self.index = 0
- end
- def refresh
- self.contents.clear
- for i in 0...@item_max
- draw_item(i, normal_color)
- end
- end
- def draw_item(index, color)
- self.contents.font.color = color
- rect = Rect.new(4, 32 * index, self.contents.width - 8, 32)
- self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
- self.contents.draw_text(rect, @commands[index])
- end
- def disable_item(index)
- draw_item(index, disabled_color)
- end
- end
- #==============================================================================
- # ■ Scene_Menu
- #==============================================================================
- class Scene_Menu
- def initialize(menu_index = 0, actor_index = 0, equip_index = 0, min_size = 1, max_size = 4)
- @menu_index = menu_index
- @actor_index = actor_index
- @equip_index = equip_index
- @min_size = [[min_size, 1].max, 4].min
- @max_size = [[max_size, @min_size].max, 4].min
- end
- def main
- $game_temp.enemy_book_data = Data_MonsterBook.new
- @actor = $game_party.actors[@actor_index]
- @spriteset = Spriteset_Map.new
- s1 = " " + $data_system.words.item
- s2 = " " + $data_system.words.skill
- s3 = " " + $data_system.words.equip
- s4 = " " + "Status"
- s5 = " " + $data_system.words.gold
- s6 = " " + "Time"
- s7 = " " + "Location"
- s8 = " " + "Options"
- s9 = " " + "Party"
- s10 = " " + "Bestiary"
- s11 = " " + "Load"
- s12 = " " + "Save"
- s13 = " " + "Exit"
- u1 = " " + "Basic"
- u2 = " " + "Weapons"
- u3 = " " + "Armor"
- u4 = " " + "Accessory"
- u5 = " " + "Quest"
- v1 = " " + "Window Skin"
- v2 = " " + "Font Type"
- v3 = " " + "BGM Volume"
- v4 = " " + "SFX Volume"
- r1 = ""
- r2 = ""
- r3 = ""
- r4 = ""
- r5 = ""
- r6 = ""
- r7 = ""
- r8 = ""
- f1 = "Arial"
- f2 = "Bookman Old Style"
- f3 = "Comic Sans MS"
- f4 = "Mistral"
- f5 = "Papyrus"
- f6 = "Tahoma"
- f7 = "Times New Roman"
- b1 = "0%"
- b2 = "17%"
- b3 = "34%"
- b4 = "50%"
- b5 = "67%"
- b6 = "84%"
- b7 = "100%"
- m1 = "0%"
- m2 = "17%"
- m3 = "34%"
- m4 = "50%"
- m5 = "67%"
- m6 = "84%"
- m7 = "100%"
- e1 = "To Title"
- e2 = "Shutdown"
- e3 = "Cancel"
- @command_window = Window_MenuCommand.new(160, [s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13])
- @command_window.index = @menu_index
- @command_window.x = 640
- @command_window.y = 32
- @command_window.z = 999
- if $game_party.actors.size == 0
- @command_window.disable_item(0)
- @command_window.disable_item(1)
- @command_window.disable_item(2)
- @command_window.disable_item(3)
- end
- if $game_system.save_disabled
- @command_window.disable_item(11)
- end
- @item_command_window = Window_ItemMenuCommand.new(192, [u1, u2, u3, u4, u5])
- @item_command_window.active = false
- @item_command_window.x = -192
- @item_command_window.y = 32
- @item_command_window.z = 1999
- @status_window = Window_NewMenuStatus.new
- @status_window.active = false
- @status_window.x = -432
- @status_window.y = 64
- @help_window = Window_NewHelp.new
- @help_window.active = false
- @help_window.x = 48
- @help_window.y = -352
- @help_window.z = 2999
- @basic_item_window = Window_Basic_Item.new
- @basic_item_window.active = false
- @basic_item_window.x = 240
- @basic_item_window.y = 480
- @basic_item_window.z = 2999
- @basic_item_window.help_window = @help_window
- @target_window = Window_NewTarget.new
- @target_window.active = false
- @target_window.visible = false
- @target_window.x = 48
- @target_window.y = 480
- @target_window.z = 2999
- @weapons_window = Window_Weapons.new
- @weapons_window.active = false
- @weapons_window.x = 400
- @weapons_window.y = 480
- @weapons_window.z = 1999
- @weapons_window.help_window = @help_window
- @weapon_stats_window = Window_Weapon_Stats.new
- @weapon_stats_window.active = false
- @weapon_stats_window.x = 48
- @weapon_stats_window.y = 480
- @weapon_stats_window.z = 2999
- @armor_window = Window_Armor.new
- @armor_window.active = false
- @armor_window.x = 400
- @armor_window.y = 480
- @armor_window.z = 1999
- @armor_window.help_window = @help_window
- @armor_stats_window = Window_Armor_Stats.new
- @armor_stats_window.active = false
- @armor_stats_window.x = 48
- @armor_stats_window.y = 480
- @armor_stats_window.z = 2999
- @accessory_window = Window_Accessory.new
- @accessory_window.active = false
- @accessory_window.x = 400
- @accessory_window.y = 480
- @accessory_window.z = 1999
- @accessory_window.help_window = @help_window
- @accessory_stats_window = Window_Accessory_Stats.new
- @accessory_stats_window.active = false
- @accessory_stats_window.x = 48
- @accessory_stats_window.y = 480
- @accessory_stats_window.z = 2999
- @quest_item_window = Window_Quest_Item.new
- @quest_item_window.active = false
- @quest_item_window.x = 48
- @quest_item_window.y = 480
- @quest_item_window.z = 2999
- @quest_item_window.help_window = @help_window
- @skill_window = Window_NewSkill.new(@actor)
- @skill_window.active = false
- @skill_window.x = 240
- @skill_window.y = 480
- @skill_window.z = 2999
- @skill_window.help_window = @help_window
- @skilltarget_window = Window_NewTarget.new
- @skilltarget_window.active = false
- @skilltarget_window.visible = false
- @skilltarget_window.x = 48
- @skilltarget_window.y = 480
- @skilltarget_window.z = 2999
- @left_window = Window_NewEquipLeft.new(@actor)
- @left_window.active = false
- @left_window.x = -352
- @left_window.y = 96
- @left_window.z = 2999
- @right_window = Window_NewEquipRight.new(@actor)
- @right_window.help_window = @help_window
- @right_window.active = false
- @right_window.x = 688
- @right_window.y = 96
- @right_window.z = 2999
- @right_window.index = @equip_index
- @item_window1 = Window_NewEquipItem.new(@actor, 0)
- @item_window1.help_window = @help_window
- @item_window1.visible = false
- @item_window1.active = false
- @item_window1.x = 304
- @item_window1.y = 672
- @item_window1.z = 2999
- @item_window2 = Window_NewEquipItem.new(@actor, 1)
- @item_window2.help_window = @help_window
- @item_window2.visible = false
- @item_window2.active = false
- @item_window2.x = 304
- @item_window2.y = 672
- @item_window2.z = 2999
- @item_window3 = Window_NewEquipItem.new(@actor, 2)
- @item_window3.help_window = @help_window
- @item_window3.visible = false
- @item_window3.active = false
- @item_window3.x = 304
- @item_window3.y = 672
- @item_window3.z = 2999
- @item_window4 = Window_NewEquipItem.new(@actor, 3)
- @item_window4.help_window = @help_window
- @item_window4.visible = false
- @item_window4.active = false
- @item_window4.x = 304
- @item_window4.y = 672
- @item_window4.z = 2999
- @item_window5 = Window_NewEquipItem.new(@actor, 4)
- @item_window5.help_window = @help_window
- @item_window5.visible = false
- @item_window5.active = false
- @item_window5.x = 304
- @item_window5.y = 672
- @item_window5.z = 2999
- @playerstatus_window = Window_NewStatus.new(@actor)
- @playerstatus_window.active= false
- @playerstatus_window.x = 640
- @playerstatus_window.y = 32
- @playerstatus_window.z = 1999
- @gold_window = Window_NewGold.new
- @gold_window.active = false
- @gold_window.x = -160
- @gold_window.y = 160
- @gold_window.z = 1999
- @time_window = Window_NewTime.new
- @time_window.active = false
- @time_window.x = -160
- @time_window.y = 192
- @time_window.z = 1999
- @location_window = Window_NewLocation.new
- @location_window.active = false
- @location_window.x = -160
- @location_window.y = 224
- @location_window.z = 1999
- @option_command_window = Window_OptionMenuCommand.new(192, [v1, v2, v3, v4])
- @option_command_window.active = false
- @option_command_window.x = -208
- @option_command_window.y = 256
- @option_command_window.z = 1999
- @windowskin_window = Window_WindowSkin.new(64, [r1, r2, r3, r4, r5, r6, r7])
- @windowskin_window.active = false
- @windowskin_window.x = -80
- @windowskin_window.y = 160
- @windowskin_window.z = 2999
- @currentwindowskin_window = Window_CurrentWindowSkin.new
- @currentwindowskin_window.active = false
- @currentwindowskin_window.x = 208
- @currentwindowskin_window.y = -288
- @currentwindowskin_window.z = 1999
- @fonttype_window = Window_FontType.new(192, [f1, f2, f3, f4, f5, f6, f7])
- @fonttype_window.active = false
- @fonttype_window.x = -208
- @fonttype_window.y = 160
- @fonttype_window.z = 2999
- @currentfonttype_window = Window_CurrentFontType.new
- @currentfonttype_window.active = false
- @currentfonttype_window.x = 208
- @currentfonttype_window.y = -416
- @currentfonttype_window.z = 1999
- @bgm_window = Window_BGM_Volume.new(80, [b1, b2, b3, b4, b5, b6, b7])
- @bgm_window.active = false
- @bgm_window.x = -208
- @bgm_window.y = 160
- @bgm_window.z = 2999
- @currentbgm_window = Window_CurrentBGM_Volume.new
- @currentbgm_window.active = false
- @currentbgm_window.x = 208
- @currentbgm_window.y = -416
- @currentbgm_window.z = 1999
- @sfx_window = Window_SFX_Volume.new(80, [m1, m2, m3, m4, m5, m6, m7])
- @sfx_window.active = false
- @sfx_window.x = -208
- @sfx_window.y = 160
- @sfx_window.z = 2999
- @currentsfx_window = Window_CurrentSFX_Volume.new
- @currentsfx_window.active = false
- @currentsfx_window.x = 208
- @currentsfx_window.y = -416
- @currentsfx_window.z = 1999
- @party_window = Window_SwitchParty.new
- @party_window.active = false
- @party_window.x = -352
- @party_window.y = 32
- @party_window.z = 2999
- @reserve_window = Window_SwitchReserve.new(20)
- @reserve_window.active = false
- @reserve_window.visible = false
- @reserve_window.x = 256
- @reserve_window.y = 544
- @reserve_window.z = 2999
- @switchstatus_window = Window_SwitchStatus.new
- @switchstatus_window.active = false
- @switchstatus_window.x = 640
- @switchstatus_window.y = 32
- @switchstatus_window.z = 2999
- if $game_party.actors.size == 0
- @party_window.active = false
- else
- @reserve_window.active = false
- end
- @party_window.help_window = @switchstatus_window
- @reserve_window.help_window = @switchstatus_window
- @title_window = Window_Base.new(-576, 32, 576, 64)
- @title_window.contents = Bitmap.new(576 - 32, 64 - 32)
- @title_window.contents.font.name = $fontface
- @title_window.contents.font.size = 20
- @title_window.contents.draw_text(4, 0, 320, 32, "Bestiary", 0)
- e_now = $game_party.enemy_book_now
- e_max = $game_party.enemy_book_max
- comp = $game_party.enemy_book_complete_percentage
- text = e_now.to_s + " / " + e_max.to_s + " " + comp.to_s + " %"
- @title_window.contents.draw_text(256, 0, 288, 32, text, 2)
- @title_window.active = false
- @title_window.z = 2999
- @main_window = Window_MonsterBook.new
- @main_window.active = false
- @main_window.x = 640
- @main_window.y = 96
- @main_window.z = 2999
- @info_window = Window_MonsterBook_Info.new
- @info_window.active = false
- @info_window.visible = false
- @info_window.x = 640
- @info_window.y = 96
- @info_window.z = 3999
- @end_window = Window_NewCommand.new(128, [e1, e2, e3])
- @end_window.active = false
- @end_window.x = -192
- @end_window.y = 352
- @end_window.z = 1999
- Graphics.transition
- loop do
- Graphics.update
- Input.update
- update
- if $scene != self
- break
- end
- end
- @spriteset.dispose
- @command_window.dispose
- @item_command_window.dispose
- @status_window.dispose
- @help_window.dispose
- @basic_item_window.dispose
- @target_window.dispose
- @weapons_window.dispose
- @weapon_stats_window.dispose
- @armor_window.dispose
- @armor_stats_window.dispose
- @accessory_window.dispose
- @accessory_stats_window.dispose
- @quest_item_window.dispose
- @skill_window.dispose
- @skilltarget_window.dispose
- @left_window.dispose
- @right_window.dispose
- @item_window1.dispose
- @item_window2.dispose
- @item_window3.dispose
- @item_window4.dispose
- @item_window5.dispose
- @playerstatus_window.dispose
- @gold_window.dispose
- @time_window.dispose
- @location_window.dispose
- @option_command_window.dispose
- @windowskin_window.dispose
- @currentwindowskin_window.dispose
- @fonttype_window.dispose
- @currentfonttype_window.dispose
- @bgm_window.dispose
- @currentbgm_window.dispose
- @sfx_window.dispose
- @currentsfx_window.dispose
- @switchstatus_window.dispose
- @reserve_window.dispose
- @party_window.dispose
- @main_window.dispose
- @info_window.dispose
- @title_window.dispose
- @end_window.dispose
- end
- def equip_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)
- item1 = @right_window.item
- case @right_window.index
- when 0
- @item_window = @item_window1
- newmode = 0
- when 1
- @item_window = @item_window2
- newmode = 1
- when 2
- @item_window = @item_window3
- newmode = 1
- when 3
- @item_window = @item_window4
- newmode = 1
- when 4
- @item_window = @item_window5
- newmode = 1
- end
- if newmode != @left_window.mode
- @left_window.mode = newmode
- @left_window.refresh
- end
- if @right_window.active
- @left_window.set_new_parameters(nil, nil, nil, nil, nil, nil, nil, nil,"", "")
- end
- if @item_window.active
- item2 = @item_window.item
- last_hp = @actor.hp
- last_sp = @actor.sp
- old_atk = @actor.atk
- old_pdef = @actor.pdef
- old_mdef = @actor.mdef
- old_str = @actor.str
- old_dex = @actor.dex
- old_agi = @actor.agi
- old_int = @actor.int
- old_eva = @actor.eva
- @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
- new_eva = @actor.eva
- @left_window.changes = [0, 0, 0, 0, 0, 0, 0, 0]
- if new_atk > old_atk
- @left_window.changes[0] = 1
- end
- if new_atk < old_atk
- @left_window.changes[0] = -1
- end
- if new_pdef > old_pdef
- @left_window.changes[1] = 1
- end
- if new_pdef < old_pdef
- @left_window.changes[1] = -1
- end
- if new_mdef > old_mdef
- @left_window.changes[2] = 1
- end
- if new_mdef < old_mdef
- @left_window.changes[2] = -1
- end
- if new_str > old_str
- @left_window.changes[3] = 1
- end
- if new_str < old_str
- @left_window.changes[3] = -1
- end
- if new_dex > old_dex
- @left_window.changes[4] = 1
- end
- if new_dex < old_dex
- @left_window.changes[4] = -1
- end
- if new_agi > old_agi
- @left_window.changes[5] = 1
- end
- if new_agi < old_agi
- @left_window.changes[5] = -1
- end
- if new_int > old_int
- @left_window.changes[6] = 1
- end
- if new_int < old_int
- @left_window.changes[6] = -1
- end
- if new_eva > old_eva
- @left_window.changes[7] = 1
- end
- if new_eva < old_eva
- @left_window.changes[7] = -1
- end
- elem_text = make_elem_text(item2)
- stat_text = make_stat_text(item2)
- @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, new_eva, elem_text, stat_text)
- end
- end
- def make_elem_text(item)
- text = ""
- flag = false
- if item.is_a?(RPG::Weapon)
- for i in item.element_set
- if flag
- text += ", "
- end
- text += $data_system.elements[i]
- flag = true
- end
- end
- if item.is_a?(RPG::Armor)
- for i in item.guard_element_set
- if flag
- text += ", "
- end
- text += $data_system.elements[i]
- flag = true
- end
- end
- return text
- end
- def make_stat_text(item)
- text = ""
- flag = false
- if item.is_a?(RPG::Weapon)
- for i in item.plus_state_set
- if flag
- text += ", "
- end
- text += $data_states[i].name
- flag = true
- end
- end
- if item.is_a?(RPG::Armor)
- for i in item.guard_state_set
- if flag
- text += ", "
- end
- text += $data_states[i].name
- flag = true
- end
- end
- return text
- end
- def update
- @command_window.update
- @item_command_window.update
- @status_window.update
- @help_window.update
- @basic_item_window.update
- @target_window.update
- @weapons_window.update
- @weapon_stats_window.update
- @armor_window.update
- @armor_stats_window.update
- @accessory_window.update
- @accessory_stats_window.update
- @quest_item_window.update
- @skill_window.update
- @skilltarget_window.update
- @left_window.update
- @right_window.update
- @playerstatus_window.update
- @gold_window.update
- @time_window.update
- @location_window.update
- @option_command_window.update
- @windowskin_window.update
- @currentwindowskin_window.update
- @fonttype_window.update
- @currentfonttype_window.update
- @bgm_window.update
- @currentbgm_window.update
- @sfx_window.update
- @currentsfx_window.update
- @party_window.update
- @reserve_window.update
- @switchstatus_window.update
- @main_window.update
- @info_window.update
- @end_window.update
- if @command_window.x > 48
- @command_window.x -= 16
- end
- if @item_command_window.active
- if @item_command_window.x < 208
- @item_command_window.x += 16
- end
- end
- if @status_window.x < 160
- @status_window.x += 16
- end
- if @help_window.active
- if @help_window.y < 32
- @help_window.y += 16
- end
- end
- if @basic_item_window.active
- if @basic_item_window.y > 96
- @basic_item_window.y -= 16
- end
- end
- if @target_window.visible
- if @target_window.y > 96
- @target_window.y -= 16
- end
- end
- if @weapons_window.active
- if @weapons_window.y > 96
- @weapons_window.y -= 16
- end
- end
- if @weapon_stats_window.active
- if @weapon_stats_window.y > 96
- @weapon_stats_window.y -= 16
- end
- end
- if @armor_window.active
- if @armor_window.y > 96
- @armor_window.y -= 16
- end
- end
- if @armor_stats_window.active
- if @armor_stats_window.y > 96
- @armor_stats_window.y -= 16
- end
- end
- if @accessory_window.active
- if @accessory_window.y > 96
- @accessory_window.y -= 16
- end
- end
- if @accessory_stats_window.active
- if @accessory_stats_window.y > 96
- @accessory_stats_window.y -= 16
- end
- end
- if @quest_item_window.active
- if @quest_item_window.y > 96
- @quest_item_window.y -= 16
- end
- end
- if @skill_window.active
- if @skill_window.y > 96
- @skill_window.y -= 16
- end
- end
- if @skilltarget_window.visible
- if @skilltarget_window.y > 96
- @skilltarget_window.y -= 16
- end
- end
- if @item_window != nil
- if @item_window.visible
- equip_refresh
- @item_window.update
- @item_window2.y = 288
- @item_window3.y = 288
- @item_window4.y = 288
- @item_window5.y = 288
- end
- end
- if @item_window1.visible
- if @item_window1.y > 288
- @item_window1.y -= 16
- end
- end
- if @left_window.active
- if @left_window.x < 32
- @left_window.x += 16
- end
- end
- if @right_window.active
- if @right_window.x > 304
- @right_window.x -= 16
- end
- end
- if @playerstatus_window.active
- if @playerstatus_window.x > 32
- @playerstatus_window.x -= 16
- end
- end
- if @gold_window.active
- if @gold_window.x < 198
- @gold_window.x += 16
- end
- end
- if @time_window.active
- if @time_window.x < 198
- @time_window.x += 16
- end
- end
- if @location_window.active
- if @location_window.x < 198
- @location_window.x += 16
- end
- end
- if @option_command_window.active
- if @option_command_window.x < 208
- @option_command_window.x += 16
- end
- end
- if @windowskin_window.active
- if @windowskin_window.x < 400
- @windowskin_window.x += 16
- end
- end
- if @currentwindowskin_window.active
- if @currentwindowskin_window.y < 152
- @currentwindowskin_window.y += 16
- end
- end
- if @fonttype_window.active
- if @fonttype_window.x < 400
- @fonttype_window.x += 16
- end
- end
- if @currentfonttype_window.active
- if @currentfonttype_window.y < 160
- @currentfonttype_window.y += 16
- end
- end
- if @bgm_window.active
- if @bgm_window.x < 400
- @bgm_window.x += 16
- end
- end
- if @currentbgm_window.active
- if @currentbgm_window.y < 160
- @currentbgm_window.y += 16
- end
- end
- if @sfx_window.active
- if @sfx_window.x < 400
- @sfx_window.x += 16
- end
- end
- if @currentsfx_window.active
- if @currentsfx_window.y < 160
- @currentsfx_window.y += 16
- end
- end
- if @title_window.active
- if @title_window.x < 32
- @title_window.x += 16
- end
- end
- if @switchstatus_window.active
- if @switchstatus_window.x > 256
- @switchstatus_window.x -= 16
- end
- end
- if @party_window.active
- if @party_window.x < 32
- @party_window.x += 16
- end
- end
- if @reserve_window.visible
- if @reserve_window.y > 160
- @reserve_window.y -= 16
- end
- end
- if @main_window.active
- if @main_window.x > 32
- @main_window.x -= 16
- end
- end
- if @info_window.visible
- if @info_window.x > 32
- @info_window.x -= 16
- end
- end
- if @end_window.active
- if @end_window.x < 208
- @end_window.x += 16
- end
- end
- if @command_window.active
- update_command
- return
- end
- if @item_command_window.active
- update_item_command
- return
- end
- if @status_window.active
- update_status
- return
- end
- if @basic_item_window.active
- update_item
- return
- end
- if @target_window.active
- update_target
- return
- end
- if @weapons_window.active
- update_weapons
- return
- end
- if @armor_window.active
- update_armor
- return
- end
- if @accessory_window.active
- update_accessory
- return
- end
- if @quest_item_window.active
- update_quest_item
- return
- end
- if @skill_window.active
- update_skill
- return
- end
- if @skilltarget_window.active
- update_skilltarget
- return
- end
- if @right_window.active
- update_right_equip
- return
- end
- if @item_window != nil
- if @item_window.active
- update_eitem
- return
- end
- end
- if @playerstatus_window.active
- update_playerstatus
- return
- end
- if @gold_window.active
- update_gold
- return
- end
- if @time_window.active
- update_time
- return
- end
- if @location_window.active
- update_location
- return
- end
- if @option_command_window.active
- update_option_command
- return
- end
- if @windowskin_window.active
- update_windowskin
- return
- end
- if @fonttype_window.active
- update_fonttype
- return
- end
- if @bgm_window.active
- update_bgm
- return
- end
- if @sfx_window.active
- update_sfx
- return
- end
- if @info_window.active
- update_info
- return
- end
- if @party_window.active
- update_party
- return
- end
- if @reserve_window.active
- update_reserve
- return
- end
- if @main_window.active
- update_main
- return
- end
- if @end_window.active
- update_end
- return
- end
- end
- def delay(seconds)
- for i in 0...(seconds * 1)
- sleep 0.01
- Graphics.update
- end
- end
- def update_command
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- $scene = Scene_Map.new
- return
- end
- if Input.trigger?(Input::C)
- if $game_party.actors.size == 0 and @command_window.index < 4
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- case @command_window.index
- when 0
- $game_system.se_play($data_system.decision_se)
- @item_command_window.active = true
- @command_window.active = false
- when 1
- $game_system.se_play($data_system.decision_se)
- @command_window.active = false
- @status_window.active = true
- @status_window.index = 0
- when 2
- $game_system.se_play($data_system.decision_se)
- @command_window.active = false
- @status_window.active = true
- @status_window.index = 0
- when 3
- $game_system.se_play($data_system.decision_se)
- @command_window.active = false
- @status_window.active = true
- @status_window.index = 0
- when 4
- $game_system.se_play($data_system.decision_se)
- @gold_window.active = true
- @command_window.active = false
- when 5
- $game_system.se_play($data_system.decision_se)
- @time_window.active = true
- @command_window.active = false
- when 6
- $game_system.se_play($data_system.decision_se)
- @location_window.active = true
- @command_window.active = false
- when 7
- $game_system.se_play($data_system.decision_se)
- @option_command_window.active = true
- @command_window.active = false
- when 8
- $game_system.se_play($data_system.decision_se)
- @switchstatus_window.active = true
- @party_window.active = true
- @reserve_window.visible = true
- @command_window.active = false
- when 9
- $game_system.se_play($data_system.decision_se)
- @title_window.active = true
- @main_window.active = true
- @command_window.active = false
- when 10
- $game_system.se_play($data_system.decision_se)
- $scene = Scene_NewLoad.new
- when 11
- if $game_system.save_disabled
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- $game_system.se_play($data_system.decision_se)
- $scene = Scene_Save.new
- when 12
- $game_system.se_play($data_system.decision_se)
- @end_window.active = true
- @command_window.active = false
- end
- return
- end
- end
- def update_status
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- @status_window.active = false
- @command_window.active = true
- @status_window.index = -1
- return
- end
- if Input.trigger?(Input::C)
- case @command_window.index
- when 1
- if $game_party.actors[@status_window.index].restriction >= 2
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- $game_system.se_play($data_system.decision_se)
- @actor = $game_party.actors[@status_window.index]
- @skill_window.update_actor(@actor)
- @skill_window.active = true
- @skilltarget_window.visible = true
- @help_window.active = true
- @status_window.active = false
- when 2
- $game_system.se_play($data_system.decision_se)
- @actor = $game_party.actors[@status_window.index]
- @right_window.update_actor(@actor)
- @right_window.active = true
- @left_window.update_actor(@actor)
- @left_window.active = true
- @help_window.x = 32
- @help_window.active = true
- @item_window1.visible = true
- @item_window2.visible = true
- @item_window3.visible = true
- @item_window4.visible = true
- @item_window5.visible = true
- @item_window1.update_actor(@actor, 0)
- @item_window2.update_actor(@actor, 1)
- @item_window3.update_actor(@actor, 2)
- @item_window4.update_actor(@actor, 3)
- @item_window5.update_actor(@actor, 4)
- @status_window.active = false
- equip_refresh
- return
- when 3
- $game_system.se_play($data_system.decision_se)
- @actor = $game_party.actors[@status_window.index]
- @playerstatus_window.update_actor(@actor)
- @playerstatus_window.active = true
- @status_window.active = false
- end
- return
- end
- end
- def update_item_command
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- @item_command_window.active = false
- @item_command_window.x = -192
- @command_window.active = true
- @item_command_window.index = 0
- @status_window.index = -1
- return
- end
- if Input.trigger?(Input::C)
- case @item_command_window.index
- when 0
- $game_system.se_play($data_system.decision_se)
- @item_command_window.active = false
- @basic_item_window.active = true
- @help_window.active = true
- @target_window.visible = true
- when 1
- $game_system.se_play($data_system.decision_se)
- @item_command_window.active = false
- @weapons_window.active = true
- @help_window.active = true
- @weapon_stats_window.active = true
- when 2
- $game_system.se_play($data_system.decision_se)
- @item_command_window.active = false
- @armor_window.active = true
- @help_window.active = true
- @armor_stats_window.active = true
- when 3
- $game_system.se_play($data_system.decision_se)
- @item_command_window.active = false
- @accessory_window.active = true
- @help_window.active = true
- @accessory_stats_window.active = true
- when 4
- $game_system.se_play($data_system.decision_se)
- @item_command_window.active = false
- @quest_item_window.active = true
- @help_window.active = true
- end
- return
- end
- end
- def update_item
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- @basic_item_window.active = false
- @basic_item_window.y = 480
- @basic_item_window.index = 0
- @help_window.active = false
- @help_window.y = -352
- @item_command_window.active = true
- @target_window.visible = false
- @target_window.y = 480
- return
- end
- if Input.trigger?(Input::C)
- @item = @basic_item_window.item
- unless @item.is_a?(RPG::Item)
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- unless $game_party.item_can_use?(@item.id)
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- $game_system.se_play($data_system.decision_se)
- if @item.scope >= 3
- @basic_item_window.active = false
- @target_window.visible = true
- @target_window.active = true
- if @item.scope == 4 || @item.scope == 6
- @target_window.index = -1
- else
- @target_window.index = 0
- end
- else
- if @item.common_event_id > 0
- $game_temp.common_event_id = @item.common_event_id
- $game_system.se_play(@item.menu_se)
- if @item.consumable
- $game_party.lose_item(@item.id, 1)
- @basic_item_window.draw_item(@basic_item_window.index)
- end
- $scene = Scene_Map.new
- return
- end
- end
- return
- end
- end
- def update_target
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- unless $game_party.item_can_use?(@item.id)
- @basic_item_window.refresh
- end
- @basic_item_window.active = true
- @target_window.active = false
- return
- end
- if Input.trigger?(Input::C)
- if $game_party.item_number(@item.id) == 0
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- if @target_window.index == -1
- used = false
- for i in $game_party.actors
- used |= i.item_effect(@item)
- end
- end
- if @target_window.index >= 0
- target = $game_party.actors[@target_window.index]
- used = target.item_effect(@item)
- end
- if used
- $game_system.se_play(@item.menu_se)
- if @item.consumable
- $game_party.lose_item(@item.id, 1)
- @basic_item_window.draw_item(@basic_item_window.index)
- end
- @target_window.refresh
- @skilltarget_window.refresh
- @status_window.refresh
- if $game_party.all_dead?
- $scene = Scene_Gameover.new
- return
- end
- if @item.common_event_id > 0
- $game_temp.common_event_id = @item.common_event_id
- $scene = Scene_Map.new
- return
- end
- end
- unless used
- $game_system.se_play($data_system.buzzer_se)
- end
- return
- end
- end
- def update_weapons
- @weapon_stats_window.item = @weapons_window.item
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- @weapons_window.active = false
- @weapons_window.y = 480
- @weapons_window.index = 0
- @help_window.active = false
- @help_window.y = -352
- @item_command_window.active = true
- @weapon_stats_window.active = false
- @weapon_stats_window.y = 480
- @weapon_stats_window.item = nil
- return
- end
- if Input.trigger?(Input::C)
- @item = @weapons_window.item
- unless @item.is_a?(RPG::Item)
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- unless $game_party.item_can_use?(@item.id)
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- $game_system.se_play($data_system.decision_se)
- return
- end
- end
- def update_armor
- @armor_stats_window.item = @armor_window.item
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- @armor_window.active = false
- @armor_window.y = 480
- @armor_window.index = 0
- @help_window.active = false
- @help_window.y = -352
- @item_command_window.active = true
- @armor_stats_window.active = false
- @armor_stats_window.y = 480
- @armor_stats_window.item = nil
- return
- end
- if Input.trigger?(Input::C)
- @item = @armor_window.item
- unless @item.is_a?(RPG::Item)
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- unless $game_party.item_can_use?(@item.id)
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- $game_system.se_play($data_system.decision_se)
- return
- end
- end
- def update_accessory
- @accessory_stats_window.item = @accessory_window.item
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- @accessory_window.active = false
- @accessory_window.y = 480
- @accessory_window.index = 0
- @help_window.active = false
- @help_window.y = -352
- @item_command_window.active = true
- @accessory_stats_window.active = false
- @accessory_stats_window.y = 480
- @accessory_stats_window.item = nil
- return
- end
- if Input.trigger?(Input::C)
- @item = @accessory_window.item
- unless @item.is_a?(RPG::Item)
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- unless $game_party.item_can_use?(@item.id)
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- $game_system.se_play($data_system.decision_se)
- return
- end
- end
- def update_quest_item
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- @quest_item_window.active = false
- @quest_item_window.y = 480
- @quest_item_window.index = 0
- @help_window.active = false
- @help_window.y = -352
- @item_command_window.active = true
- return
- end
- if Input.trigger?(Input::C)
- @item = @quest_item_window.item
- unless @item.is_a?(RPG::Item)
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- unless $game_party.item_can_use?(@item.id)
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- $game_system.se_play($data_system.decision_se)
- return
- end
- end
- def update_skill
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- @skill_window.active = false
- @skill_window.y = 480
- @skill_window.index = 0
- @skilltarget_window.visible = false
- @skilltarget_window.y = 480
- @help_window.active = false
- @help_window.y = -352
- @command_window.active = true
- @status_window.index = -1
- return
- end
- if Input.trigger?(Input::C)
- @skill = @skill_window.skill
- if @skill == nil or not @actor.skill_can_use?(@skill.id)
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- $game_system.se_play($data_system.decision_se)
- if @skill.scope >= 3
- @skill_window.active = false
- @skilltarget_window.visible = true
- @skilltarget_window.active = true
- if @skill.scope == 4 || @skill.scope == 6
- @skilltarget_window.index = -1
- elsif @skill.scope == 7
- @skilltarget_window.index = @actor_index - 10
- else
- @skilltarget_window.index = 0
- end
- else
- if @skill.common_event_id > 0
- $game_temp.common_event_id = @skill.common_event_id
- $game_system.se_play(@skill.menu_se)
- @actor.sp -= @skill.sp_cost
- @status_window.refresh
- @skill_window.refresh
- @skilltarget_window.refresh
- $scene = Scene_Map.new
- return
- end
- end
- return
- end
- end
- def update_skilltarget
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- @skill_window.active = true
- @skilltarget_window.active = false
- return
- end
- if Input.trigger?(Input::C)
- unless @actor.skill_can_use?(@skill.id)
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- if @skilltarget_window.index == -1
- used = false
- for i in $game_party.actors
- used |= i.skill_effect(@actor, @skill)
- end
- end
- if @skilltarget_window.index <= -2
- target = $game_party.actors[@skilltarget_window.index + 10]
- used = target.skill_effect(@actor, @skill)
- end
- if @skilltarget_window.index >= 0
- target = $game_party.actors[@skilltarget_window.index]
- used = target.skill_effect(@actor, @skill)
- end
- if used
- $game_system.se_play(@skill.menu_se)
- @actor.sp -= @skill.sp_cost
- @target_window.refresh
- @status_window.refresh
- @skill_window.refresh
- @skilltarget_window.refresh
- if $game_party.all_dead?
- $scene = Scene_Gameover.new
- return
- end
- if @skill.common_event_id > 0
- $game_temp.common_event_id = @skill.common_event_id
- $scene = Scene_Map.new
- return
- end
- end
- unless used
- $game_system.se_play($data_system.buzzer_se)
- end
- return
- end
- end
- def update_right_equip
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- @right_window.active = false
- @right_window.x = 688
- @right_window.index = 0
- @left_window.active = false
- @left_window.x = -352
- @help_window.active = false
- @help_window.y = -352
- @help_window.x = 48
- @item_window.y = 672
- @item_window.visible = false
- @item_window1.y = 672
- @item_window2.y = 672
- @item_window3.y = 672
- @item_window4.y = 672
- @item_window5.y = 672
- @command_window.active = true
- @status_window.index = -1
- return
- end
- if Input.trigger?(Input::C)
- if @actor.equip_fix?(@right_window.index)
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- $game_system.se_play($data_system.decision_se)
- @right_window.active = false
- @item_window.active = true
- @item_window.index = 0
- return
- end
- end
- def update_eitem
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- @right_window.active = true
- @item_window.active = false
- @item_window.index = -1
- return
- end
- if Input.trigger?(Input::C)
- $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
- @item_window1.refresh
- @item_window2.refresh
- @item_window3.refresh
- @item_window4.refresh
- @item_window5.refresh
- return
- end
- end
- def update_playerstatus
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- @playerstatus_window.active = false
- @playerstatus_window.x = 640
- @command_window.active = true
- @status_window.index = -1
- end
- end
- def update_gold
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- @gold_window.active = false
- @gold_window.x = -160
- @command_window.active = true
- end
- end
- def update_time
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- @time_window.active = false
- @time_window.x = -160
- @command_window.active = true
- end
- end
- def update_location
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- @location_window.active = false
- @location_window.x = -160
- @command_window.active = true
- end
- end
- def update_option_command
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- @option_command_window.active = false
- @option_command_window.x = -192
- @option_command_window.index = 0
- @command_window.active = true
- return
- end
- if Input.trigger?(Input::C)
- case @option_command_window.index
- when 0
- $game_system.se_play($data_system.decision_se)
- @option_command_window.active = false
- @windowskin_window.active = true
- @currentwindowskin_window.active = true
- @currentwindowskin_window.refresh
- when 1
- $game_system.se_play($data_system.decision_se)
- @option_command_window.active = false
- @fonttype_window.active = true
- @currentfonttype_window.active = true
- @currentfonttype_window.refresh
- when 2
- $game_system.se_play($data_system.decision_se)
- @option_command_window.active = false
- @bgm_window.active = true
- @currentbgm_window.active = true
- @currentbgm_window.refresh
- when 3
- $game_system.se_play($data_system.decision_se)
- @option_command_window.active = false
- @sfx_window.active = true
- @currentsfx_window.active = true
- @currentsfx_window.refresh
- end
- return
- end
- end
- def update_windowskin
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- @windowskin_window.active = false
- @windowskin_window.x = -80
- @windowskin_window.index = 0
- @currentwindowskin_window.active = false
- @currentwindowskin_window.y = -304
- @option_command_window.active = true
- return
- end
- if Input.trigger?(Input::C)
- case @windowskin_window.index
- when 0
- $game_system.se_play($data_system.decision_se)
- $game_system.windowskin_name = "Black"
- @currentwindowskin_window.refresh
- @time_window.refresh
- when 1
- $game_system.se_play($data_system.decision_se)
- $game_system.windowskin_name = "Old"
- @currentwindowskin_window.refresh
- @time_window.refresh
- when 2
- $game_system.se_play($data_system.decision_se)
- $game_system.windowskin_name = "Red"
- @currentwindowskin_window.refresh
- @time_window.refresh
- when 3
- $game_system.se_play($data_system.decision_se)
- $game_system.windowskin_name = "Chaos"
- @currentwindowskin_window.refresh
- @time_window.refresh
- when 4
- $game_system.se_play($data_system.decision_se)
- $game_system.windowskin_name = "Grey"
- @currentwindowskin_window.refresh
- @time_window.refresh
- when 5
- $game_system.se_play($data_system.decision_se)
- $game_system.windowskin_name = "Sky"
- @currentwindowskin_window.refresh
- @time_window.refresh
- when 6
- $game_system.se_play($data_system.decision_se)
- $game_system.windowskin_name = "Army"
- @currentwindowskin_window.refresh
- @time_window.refresh
- end
- return
- end
- end
- def update_fonttype
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- @fonttype_window.active = false
- @fonttype_window.x = -192
- @fonttype_window.index = 0
- @currentfonttype_window.active = false
- @currentfonttype_window.y = -416
- @option_command_window.active = true
- return
- end
- if Input.trigger?(Input::C)
- case @fonttype_window.index
- when 0
- $game_system.se_play($data_system.decision_se)
- $fontface = "Arial"
- $scene = Scene_Menu.new
- when 1
- $game_system.se_play($data_system.decision_se)
- $fontface = "Bookman Old Style"
- $scene = Scene_Menu.new
- when 2
- $game_system.se_play($data_system.decision_se)
- $fontface = "Comic Sans MS"
- $scene = Scene_Menu.new
- when 3
- $game_system.se_play($data_system.decision_se)
- $fontface = "Mistral"
- $scene = Scene_Menu.new
- when 4
- $game_system.se_play($data_system.decision_se)
- $fontface = "Papyrus"
- $scene = Scene_Menu.new
- when 5
- $game_system.se_play($data_system.decision_se)
- $fontface = "Tahoma"
- $scene = Scene_Menu.new
- when 6
- $game_system.se_play($data_system.decision_se)
- $fontface = "Times New Roman"
- $scene = Scene_Menu.new
- end
- return
- end
- end
- def update_bgm
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- @bgm_window.active = false
- @bgm_window.x = -192
- @bgm_window.index = 0
- @currentbgm_window.active = false
- @currentbgm_window.y = -416
- @option_command_window.active = true
- return
- end
- if Input.trigger?(Input::C)
- case @bgm_window.index
- when 0
- $game_system.bgm_volume = 0
- $game_system.bgm_play($game_system.bgm_memorize)
- @currentbgm_window.refresh
- when 1
- $game_system.bgm_volume = 17
- $game_system.bgm_play($game_system.bgm_memorize)
- @currentbgm_window.refresh
- when 2
- $game_system.bgm_volume = 34
- $game_system.bgm_play($game_system.bgm_memorize)
- @currentbgm_window.refresh
- when 3
- $game_system.bgm_volume = 50
- $game_system.bgm_play($game_system.bgm_memorize)
- @currentbgm_window.refresh
- when 4
- $game_system.bgm_volume = 67
- $game_system.bgm_play($game_system.bgm_memorize)
- @currentbgm_window.refresh
- when 5
- $game_system.bgm_volume = 84
- $game_system.bgm_play($game_system.bgm_memorize)
- @currentbgm_window.refresh
- when 6
- $game_system.bgm_volume = 100
- $game_system.bgm_play($game_system.bgm_memorize)
- @currentbgm_window.refresh
- end
- return
- end
- end
- def update_sfx
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- @sfx_window.active = false
- @sfx_window.x = -192
- @sfx_window.index = 0
- @currentsfx_window.active = false
- @currentsfx_window.y = -416
- @option_command_window.active = true
- return
- end
- if Input.trigger?(Input::C)
- case @sfx_window.index
- when 0
- $game_system.se_volume = 0
- $game_system.se_play($data_system.decision_se)
- @currentsfx_window.refresh
- when 1
- $game_system.se_volume = 17
- $game_system.se_play($data_system.decision_se)
- @currentsfx_window.refresh
- when 2
- $game_system.se_volume = 34
- $game_system.se_play($data_system.decision_se)
- @currentsfx_window.refresh
- when 3
- $game_system.se_volume = 50
- $game_system.se_play($data_system.decision_se)
- @currentsfx_window.refresh
- when 4
- $game_system.se_volume = 67
- $game_system.se_play($data_system.decision_se)
- @currentsfx_window.refresh
- when 5
- $game_system.se_volume = 84
- $game_system.se_play($data_system.decision_se)
- @currentsfx_window.refresh
- when 6
- $game_system.se_volume = 100
- $game_system.se_play($data_system.decision_se)
- @currentsfx_window.refresh
- end
- return
- end
- end
- def update_party
- if Input.trigger?(Input::B)
- new_party = @party_window.new_party.compact
- n = new_party.size
- if n < @min_size or n > @max_size
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- $game_system.se_play($data_system.decision_se)
- $game_party.actors = new_party
- @status_window.refresh
- @party_window.active = false
- @party_window.x = -352
- @switchstatus_window.active = false
- @switchstatus_window.x = 640
- @reserve_window.visible = false
- @reserve_window.y = 544
- @command_window.active = true
- $game_player.refresh
- return
- elsif Input.trigger?(Input::C)
- if(@party_window.actor != nil and @party_window.actor.mandatory)
- $game_system.se_play($data_system.buzzer_se)
- else
- $game_system.se_play($data_system.decision_se)
- @party_window.active = false
- @reserve_window.active = true
- end
- end
- end
- def update_reserve
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.decision_se)
- @reserve_window.active = false
- @party_window.active = true
- return
- elsif Input.trigger?(Input::C)
- $game_system.se_play($data_system.decision_se)
- @party_window.change_selection(@reserve_window.swap_characters(@party_window.actor))
- @reserve_window.active = false
- @party_window.active = true
- end
- end
- def update_main
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- @title_window.active = false
- @title_window.x = -576
- @main_window.active = false
- @main_window.x = 640
- @info_window.active = false
- @info_window.visible = false
- @info_window.x = 640
- @command_window.active = true
- return
- end
- if Input.trigger?(Input::C)
- if @main_window.item == nil or @main_window.show?(@main_window.item) == false
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- $game_system.se_play($data_system.decision_se)
- @main_window.active = false
- @info_window.active = true
- @info_window.visible = true
- @visible_index = @main_window.index
- @info_window.refresh(@main_window.item)
- return
- end
- end
- def update_info
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- @main_window.active = true
- @info_window.active = false
- @info_window.x = 640
- return
- end
- if Input.trigger?(Input::C)
- $game_system.se_play($data_system.decision_se)
- return
- end
- if Input.trigger?(Input::L)
- $game_system.se_play($data_system.decision_se)
- loop_end = false
- while loop_end == false
- if @visible_index != 0
- @visible_index -= 1
- else
- @visible_index = @main_window.data.size - 1
- end
- loop_end = true if @main_window.show?(@main_window.data[@visible_index])
- end
- id = @main_window.data[@visible_index]
- @info_window.refresh(id)
- return
- end
- if Input.trigger?(Input::R)
- $game_system.se_play($data_system.decision_se)
- loop_end = false
- while loop_end == false
- if @visible_index != @main_window.data.size - 1
- @visible_index += 1
- else
- @visible_index = 0
- end
- loop_end = true if @main_window.show?(@main_window.data[@visible_index])
- end
- id = @main_window.data[@visible_index]
- @info_window.refresh(id)
- return
- end
- end
- def update_end
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- @end_window.active = false
- @end_window.x = -192
- @command_window.active = true
- return
- end
- if Input.trigger?(Input::C)
- case @end_window.index
- when 0
- command_to_title
- when 1
- command_shutdown
- when 2
- command_cancel
- end
- return
- end
- end
- def command_to_title
- $game_system.se_play($data_system.decision_se)
- Audio.bgm_fade(800)
- Audio.bgs_fade(800)
- Audio.me_fade(800)
- $scene = Scene_Title.new
- end
- def command_shutdown
- $game_system.se_play($data_system.decision_se)
- Audio.bgm_fade(800)
- Audio.bgs_fade(800)
- Audio.me_fade(800)
- $scene = nil
- end
- def command_cancel
- $game_system.se_play($data_system.cancel_se)
- @end_window.active = false
- @end_window.x = -192
- @command_window.active = true
- end
- end
- #==============================================================================
- # ■ Scene_NewLoad
- #==============================================================================
- class Scene_NewLoad < Scene_File
- def initialize
- $game_temp = Game_Temp.new
- $game_temp.last_file_index = 0
- latest_time = Time.at(0)
- for i in 0..3
- filename = make_filename(i)
- if FileTest.exist?(filename)
- file = File.open(filename, "r")
- if file.mtime > latest_time
- latest_time = file.mtime
- $game_temp.last_file_index = i
- end
- file.close
- end
- end
- super("Which file do you wish to load from?")
- end
- def on_decision(filename)
- unless FileTest.exist?(filename)
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- $game_system.se_play($data_system.load_se)
- file = File.open(filename, "rb")
- read_save_data(file)
- file.close
- $game_system.bgm_play($game_system.playing_bgm)
- $game_system.bgs_play($game_system.playing_bgs)
- $game_map.update
- $scene = Scene_Map.new
- end
- def on_cancel
- $game_system.se_play($data_system.cancel_se)
- $scene = Scene_Menu.new(10)
- end
- def read_save_data(file)
- characters = Marshal.load(file)
- Graphics.frame_count = Marshal.load(file)
- $game_system = Marshal.load(file)
- $game_switches = Marshal.load(file)
- $game_variables = Marshal.load(file)
- $game_self_switches = Marshal.load(file)
- $game_screen = Marshal.load(file)
- $game_actors = Marshal.load(file)
- $game_party = Marshal.load(file)
- $game_troop = Marshal.load(file)
- $game_map = Marshal.load(file)
- $game_player = Marshal.load(file)
- $game_time =Marshal.load(file)
- if $game_system.magic_number != $data_system.magic_number
- $game_map.setup($game_map.map_id)
- $game_player.center($game_player.x, $game_player.y)
- end
- $game_party.refresh
- end
- end
Add Comment
Please, Sign In to add comment