flarestar
0
+0
Jun 18 '05
these are backup codes incase anyone messes around with the basic script
(note i have added neo_b's important code fix)
RPG Maker backup codes
#==============================================================================
# ■ Game_Temp
#------------------------------------------------------------------------------
# セーブデータに含まれない、一時的なデータを扱うクラスです。このクラスのイン
# スタンスは $game_temp で参照されます。
#==============================================================================
class Game_Temp
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_accessor :map_bgm # マップ画面 BGM (バトル時記憶用)
attr_accessor :message_text # メッセージ 文章
attr_accessor :message_proc # メッセージ コールバック (Proc)
attr_accessor :choice_start # 選択肢 開始行
attr_accessor :choice_max # 選択肢 項目数
attr_accessor :choice_cancel_type # 選択肢 キャンセルの場合
attr_accessor :choice_proc # 選択肢 コールバック (Proc)
attr_accessor :num_input_start # 数値入力 開始行
attr_accessor :num_input_variable_id # 数値入力 変数 ID
attr_accessor :num_input_digits_max # 数値入力 桁数
attr_accessor :message_window_showing # メッセージウィンドウ表示中
attr_accessor :common_event_id # コモンイベント ID
attr_accessor :in_battle # 戦闘中フラグ
attr_accessor :battle_calling # バトル 呼び出しフラグ
attr_accessor :battle_troop_id # バトル トループ ID
attr_accessor :battle_can_escape # バトル 逃走可能フラグ
attr_accessor :battle_can_lose # バトル 敗北可能フラグ
attr_accessor :battle_proc # バトル コールバック (Proc)
attr_accessor :battle_turn # バトル ターン数
attr_accessor :battle_event_flags # バトル イベント実行済みフラグ
attr_accessor :battle_abort # バトル 中断フラグ
attr_accessor :battle_main_phase # バトル メインフェーズフラグ
attr_accessor :battleback_name # バトルバック ファイル名
attr_accessor :forcing_battler # アクション強制対象のバトラー
attr_accessor :shop_calling # ショップ 呼び出しフラグ
attr_accessor :shop_goods # ショップ 商品リスト
attr_accessor :name_calling # 名前入力 呼び出しフラグ
attr_accessor :name_actor_id # 名前入力 アクター ID
attr_accessor :name_max_char # 名前入力 最大文字数
attr_accessor :menu_calling # メニュー 呼び出しフラグ
attr_accessor :menu_beep # メニュー SE 演奏フラグ
attr_accessor :save_calling # セーブ 呼び出しフラグ
attr_accessor :debug_calling # デバッグ 呼び出しフラグ
attr_accessor :player_transferring # プレイヤー場所移動フラグ
attr_accessor :player_new_map_id # プレイヤー移動先 マップ ID
attr_accessor :player_new_x # プレイヤー移動先 X 座標
attr_accessor :player_new_y # プレイヤー移動先 Y 座標
attr_accessor :player_new_direction # プレイヤー移動先 向き
attr_accessor :transition_processing # トランジション処理中フラグ
attr_accessor :transition_name # トランジション ファイル名
attr_accessor :gameover # ゲームオーバーフラグ
attr_accessor :to_title # タイトル画面に戻すフラグ
attr_accessor :last_file_index # 最後にセーブしたファイルの番号
attr_accessor :debug_top_row # デバッグ画面 状態保存用
attr_accessor :debug_index # デバッグ画面 状態保存用
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
@map_bgm = nil
@message_text = nil
@message_proc = nil
@choice_start = 99
@choice_max = 0
@choice_cancel_type = 0
@choice_proc = nil
@num_input_start = 99
@num_input_variable_id = 0
@num_input_digits_max = 0
@message_window_showing = false
@common_event_id = 0
@in_battle = false
@battle_calling = false
@battle_troop_id = 0
@battle_can_escape = false
@battle_can_lose = false
@battle_proc = nil
@battle_turn = 0
@battle_event_flags = {}
@battle_abort = false
@battle_main_phase = false
@battleback_name = ''
@forcing_battler = nil
@shop_calling = false
@shop_id = 0
@name_calling = false
@name_actor_id = 0
@name_max_char = 0
@menu_calling = false
@menu_beep = false
@save_calling = false
@debug_calling = false
@player_transferring = false
@player_new_map_id = 0
@player_new_x = 0
@player_new_y = 0
@player_new_direction = 0
@transition_processing = false
@transition_name = ""
@gameover = false
@to_title = false
@last_file_index = 0
@debug_top_row = 0
@debug_index = 0
end
end
#==============================================================================
# ■ Game_System
#------------------------------------------------------------------------------
# システム周りのデータを扱うクラスです。BGM などの管理も行います。このクラス
# のインスタンスは $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 # マジックナンバー
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
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
end
#--------------------------------------------------------------------------
# ● BGM の演奏
# bgm : 演奏する BGM
#--------------------------------------------------------------------------
def bgm_play(bgm)
@playing_bgm = bgm
if bgm != nil and bgm.name != ""
Audio.bgm_play("Audio/BGM/" + bgm.name, bgm.volume, bgm.pitch)
else
Audio.bgm_stop
end
Graphics.frame_reset
end
#--------------------------------------------------------------------------
# ● BGM の停止
#--------------------------------------------------------------------------
def bgm_stop
Audio.bgm_stop
end
#--------------------------------------------------------------------------
# ● BGM のフェードアウト
# time : フェードアウト時間 (秒)
#--------------------------------------------------------------------------
def bgm_fade(time)
@playing_bgm = nil
Audio.bgm_fade(time * 1000)
end
#--------------------------------------------------------------------------
# ● BGM の記憶
#--------------------------------------------------------------------------
def bgm_memorize
@memorized_bgm = @playing_bgm
end
#--------------------------------------------------------------------------
# ● BGM の復帰
#--------------------------------------------------------------------------
def bgm_restore
bgm_play(@memorized_bgm)
end
#--------------------------------------------------------------------------
# ● BGS の演奏
# bgs : 演奏する BGS
#--------------------------------------------------------------------------
def bgs_play(bgs)
@playing_bgs = bgs
if bgs != nil and bgs.name != ""
Audio.bgs_play("Audio/BGS/" + bgs.name, bgs.volume, bgs.pitch)
else
Audio.bgs_stop
end
Graphics.frame_reset
end
#--------------------------------------------------------------------------
# ● BGS のフェードアウト
# time : フェードアウト時間 (秒)
#--------------------------------------------------------------------------
def bgs_fade(time)
@playing_bgs = nil
Audio.bgs_fade(time * 1000)
end
#--------------------------------------------------------------------------
# ● BGS の記憶
#--------------------------------------------------------------------------
def bgs_memorize
@memorized_bgs = @playing_bgs
end
#--------------------------------------------------------------------------
# ● BGS の復帰
#--------------------------------------------------------------------------
def bgs_restore
bgs_play(@memorized_bgs)
end
#--------------------------------------------------------------------------
# ● ME の演奏
# me : 演奏する ME
#--------------------------------------------------------------------------
def me_play(me)
if me != nil and me.name != ""
Audio.me_play("Audio/ME/" + me.name, me.volume, me.pitch)
else
Audio.me_stop
end
Graphics.frame_reset
end
#--------------------------------------------------------------------------
# ● SE の演奏
# se : 演奏する SE
#--------------------------------------------------------------------------
def se_play(se)
if se != nil and se.name != ""
Audio.se_play("Audio/SE/" + se.name, se.volume, se.pitch)
end
end
#--------------------------------------------------------------------------
# ● SE の停止
#--------------------------------------------------------------------------
def se_stop
Audio.se_stop
end
#--------------------------------------------------------------------------
# ● 演奏中 BGM の取得
#--------------------------------------------------------------------------
def playing_bgm
return @playing_bgm
end
#--------------------------------------------------------------------------
# ● 演奏中 BGS の取得
#--------------------------------------------------------------------------
def playing_bgs
return @playing_bgs
end
#--------------------------------------------------------------------------
# ● ウィンドウスキン ファイル名の取得
#--------------------------------------------------------------------------
def windowskin_name
if @windowskin_name == nil
return $data_system.windowskin_name
else
return @windowskin_name
end
end
#--------------------------------------------------------------------------
# ● ウィンドウスキン ファイル名の設定
# windowskin_name : 新しいウィンドウスキン ファイル名
#--------------------------------------------------------------------------
def windowskin_name=(windowskin_name)
@windowskin_name = windowskin_name
end
#--------------------------------------------------------------------------
# ● バトル BGM の取得
#--------------------------------------------------------------------------
def battle_bgm
if @battle_bgm == nil
return $data_system.battle_bgm
else
return @battle_bgm
end
end
#--------------------------------------------------------------------------
# ● バトル BGM の設定
# battle_bgm : 新しいバトル BGM
#--------------------------------------------------------------------------
def battle_bgm=(battle_bgm)
@battle_bgm = battle_bgm
end
#--------------------------------------------------------------------------
# ● バトル終了 BGM の取得
#--------------------------------------------------------------------------
def battle_end_me
if @battle_end_me == nil
return $data_system.battle_end_me
else
return @battle_end_me
end
end
#--------------------------------------------------------------------------
# ● バトル終了 BGM の設定
# battle_end_me : 新しいバトル終了 BGM
#--------------------------------------------------------------------------
def battle_end_me=(battle_end_me)
@battle_end_me = battle_end_me
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
# タイマーを 1 減らす
if @timer_working and @timer > 0
@timer -= 1
end
end
end
#==============================================================================
# ■ Game_Switches
#------------------------------------------------------------------------------
# スイッチを扱うクラスです。組み込みクラス Array のラッパーです。このクラス
# のインスタンスは $game_switches で参照されます。
#==============================================================================
class Game_Switches
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
@data = []
end
#--------------------------------------------------------------------------
# ● スイッチの取得
# switch_id : スイッチ ID
#--------------------------------------------------------------------------
def [](switch_id)
if switch_id <= 5000 and @data[switch_id] != nil
return @data[switch_id]
else
return false
end
end
#--------------------------------------------------------------------------
# ● スイッチの設定
# switch_id : スイッチ ID
# value : ON (true) / OFF (false)
#--------------------------------------------------------------------------
def []=(switch_id, value)
if switch_id <= 5000
@data[switch_id] = value
end
end
end
#==============================================================================
# ■ Game_Variables
#------------------------------------------------------------------------------
# 変数を扱うクラスです。組み込みクラス Array のラッパーです。このクラスのイ
# ンスタンスは $game_variables で参照されます。
#==============================================================================
class Game_Variables
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
@data = []
end
#--------------------------------------------------------------------------
# ● 変数の取得
# variable_id : 変数 ID
#--------------------------------------------------------------------------
def [](variable_id)
if variable_id <= 5000 and @data[variable_id] != nil
return @data[variable_id]
else
return 0
end
end
#--------------------------------------------------------------------------
# ● 変数の設定
# variable_id : 変数 ID
# value : 変数の値
#--------------------------------------------------------------------------
def []=(variable_id, value)
if variable_id <= 5000
@data[variable_id] = value
end
end
end
#==============================================================================
# ■ Game_SelfSwitches
#------------------------------------------------------------------------------
# セルフスイッチを扱うクラスです。組み込みクラス Hash のラッパーです。このク
# ラスのインスタンスは $game_self_switches で参照されます。
#==============================================================================
class Game_SelfSwitches
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
@data = {}
end
#--------------------------------------------------------------------------
# ● セルフスイッチの取得
# key : キー
#--------------------------------------------------------------------------
def [](key)
return @data[key] == true ? true : false
end
#--------------------------------------------------------------------------
# ● セルフスイッチの設定
# key : キー
# value : ON (true) / OFF (false)
#--------------------------------------------------------------------------
def []=(key, value)
@data[key] = value
end
end
#==============================================================================
# ■ Game_Screen
#------------------------------------------------------------------------------
# 色調変更やフラッシュなど、画面全体に関係する処理のデータを保持するクラスで
# す。このクラスのインスタンスは $game_screen で参照されます。
#==============================================================================
class Game_Screen
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_reader :tone # 色調
attr_reader :flash_color # フラッシュ色
attr_reader :shake # シェイク位置
attr_reader :pictures # ピクチャ
attr_reader :weather_type # 天候 タイプ
attr_reader :weather_max # 天候 画像の最大数
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
@tone = Tone.new(0, 0, 0, 0)
@tone_target = Tone.new(0, 0, 0, 0)
@tone_duration = 0
@flash_color = Color.new(0, 0, 0, 0)
@flash_duration = 0
@shake_power = 0
@shake_speed = 0
@shake_duration = 0
@shake_direction = 1
@shake = 0
@pictures = [nil]
for i in 1..100
@pictures.push(Game_Picture.new(i))
end
@weather_type = 0
@weather_max = 0.0
@weather_type_target = 0
@weather_max_target = 0.0
@weather_duration = 0
end
#--------------------------------------------------------------------------
# ● 色調変更の開始
# tone : 色調
# duration : 時間
#--------------------------------------------------------------------------
def start_tone_change(tone, duration)
@tone_target = tone.clone
@tone_duration = duration
if @tone_duration == 0
@tone = @tone_target.clone
end
end
#--------------------------------------------------------------------------
# ● フラッシュの開始
# color : 色
# duration : 時間
#--------------------------------------------------------------------------
def start_flash(color, duration)
@flash_color = color.clone
@flash_duration = duration
end
#--------------------------------------------------------------------------
# ● シェイクの開始
# power : 強さ
# speed : 速さ
# duration : 時間
#--------------------------------------------------------------------------
def start_shake(power, speed, duration)
@shake_power = power
@shake_speed = speed
@shake_duration = duration
end
#--------------------------------------------------------------------------
# ● 天候の設定
# type : タイプ
# power : 強さ
# duration : 時間
#--------------------------------------------------------------------------
def weather(type, power, duration)
@weather_type_target = type
if @weather_type_target != 0
@weather_type = @weather_type_target
end
if @weather_type_target == 0
@weather_max_target = 0.0
else
@weather_max_target = (power + 1) * 4.0
end
@weather_duration = duration
if @weather_duration == 0
@weather_type = @weather_type_target
@weather_max = @weather_max_target
end
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
if @tone_duration >= 1
d = @tone_duration
@tone.red = (@tone.red * (d - 1) + @tone_target.red) / d
@tone.green = (@tone.green * (d - 1) + @tone_target.green) / d
@tone.blue = (@tone.blue * (d - 1) + @tone_target.blue) / d
@tone.gray = (@tone.gray * (d - 1) + @tone_target.gray) / d
@tone_duration -= 1
end
if @flash_duration >= 1
d = @flash_duration
@flash_color.alpha = @flash_color.alpha * (d - 1) / d
@flash_duration -= 1
end
if @shake_duration >= 1 or @shake != 0
delta = (@shake_power * @shake_speed * @shake_direction) / 10.0
if @shake_duration <= 1 and @shake * (@shake + delta) < 0
@shake = 0
else
@shake += delta
end
if @shake > @shake_power * 2
@shake_direction = -1
end
if @shake < - @shake_power * 2
@shake_direction = 1
end
if @shake_duration >= 1
@shake_duration -= 1
end
end
if @weather_duration >= 1
d = @weather_duration
@weather_max = (@weather_max * (d - 1) + @weather_max_target) / d
@weather_duration -= 1
if @weather_duration == 0
@weather_type = @weather_type_target
end
end
if $game_temp.in_battle
for i in 51..100
@pictures[i].update
end
else
for i in 1..50
@pictures[i].update
end
end
end
end
#==============================================================================
# ■ Game_Picture
#------------------------------------------------------------------------------
# ピクチャを扱うクラスです。このクラスは Game_Screen クラス ($game_screen)
# の内部で使用されます。
#==============================================================================
class Game_Picture
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_reader :number # ピクチャ番号
attr_reader :name # ファイル名
attr_reader :origin # 原点
attr_reader :x # X 座標
attr_reader :y # Y 座標
attr_reader :zoom_x # X 方向拡大率
attr_reader :zoom_y # Y 方向拡大率
attr_reader :opacity # 不透明度
attr_reader :blend_type # ブレンド方法
attr_reader :tone # 色調
attr_reader :angle # 回転角度
#--------------------------------------------------------------------------
# ● オブジェクト初期化
# number : ピクチャ番号
#--------------------------------------------------------------------------
def initialize(number)
@number = number
@name = ""
@origin = 0
@x = 0.0
@y = 0.0
@zoom_x = 100.0
@zoom_y = 100.0
@opacity = 255.0
@blend_type = 1
@duration = 0
@target_x = @x
@target_y = @y
@target_zoom_x = @zoom_x
@target_zoom_y = @zoom_y
@target_opacity = @opacity
@tone = Tone.new(0, 0, 0, 0)
@tone_target = Tone.new(0, 0, 0, 0)
@tone_duration = 0
@angle = 0
@rotate_speed = 0
end
#--------------------------------------------------------------------------
# ● ピクチャの表示
# name : ファイル名
# origin : 原点
# x : X 座標
# y : Y 座標
# zoom_x : X 方向拡大率
# zoom_y : Y 方向拡大率
# opacity : 不透明度
# blend_type : ブレンド方法
#--------------------------------------------------------------------------
def show(name, origin, x, y, zoom_x, zoom_y, opacity, blend_type)
@name = name
@origin = origin
@x = x.to_f
@y = y.to_f
@zoom_x = zoom_x.to_f
@zoom_y = zoom_y.to_f
@opacity = opacity.to_f
@blend_type = blend_type
@duration = 0
@target_x = @x
@target_y = @y
@target_zoom_x = @zoom_x
@target_zoom_y = @zoom_y
@target_opacity = @opacity
@tone = Tone.new(0, 0, 0, 0)
@tone_target = Tone.new(0, 0, 0, 0)
@tone_duration = 0
@angle = 0
@rotate_speed = 0
end
#--------------------------------------------------------------------------
# ● ピクチャの移動
# duration : 時間
# origin : 原点
# x : X 座標
# y : Y 座標
# zoom_x : X 方向拡大率
# zoom_y : Y 方向拡大率
# opacity : 不透明度
# blend_type : ブレンド方法
#--------------------------------------------------------------------------
def move(duration, origin, x, y, zoom_x, zoom_y, opacity, blend_type)
@duration = duration
@origin = origin
@target_x = x.to_f
@target_y = y.to_f
@target_zoom_x = zoom_x.to_f
@target_zoom_y = zoom_y.to_f
@target_opacity = opacity.to_f
@blend_type = blend_type
end
#--------------------------------------------------------------------------
# ● 回転速度の変更
# speed : 回転速度
#--------------------------------------------------------------------------
def rotate(speed)
@rotate_speed = speed
end
#--------------------------------------------------------------------------
# ● 色調変更の開始
# tone : 色調
# duration : 時間
#--------------------------------------------------------------------------
def start_tone_change(tone, duration)
@tone_target = tone.clone
@tone_duration = duration
if @tone_duration == 0
@tone = @tone_target.clone
end
end
#--------------------------------------------------------------------------
# ● ピクチャの消去
#--------------------------------------------------------------------------
def erase
@name = ""
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
if @duration >= 1
d = @duration
@x = (@x * (d - 1) + @target_x) / d
@y = (@y * (d - 1) + @target_y) / d
@zoom_x = (@zoom_x * (d - 1) + @target_zoom_x) / d
@zoom_y = (@zoom_y * (d - 1) + @target_zoom_y) / d
@opacity = (@opacity * (d - 1) + @target_opacity) / d
@duration -= 1
end
if @tone_duration >= 1
d = @tone_duration
@tone.red = (@tone.red * (d - 1) + @tone_target.red) / d
@tone.green = (@tone.green * (d - 1) + @tone_target.green) / d
@tone.blue = (@tone.blue * (d - 1) + @tone_target.blue) / d
@tone.gray = (@tone.gray * (d - 1) + @tone_target.gray) / d
@tone_duration -= 1
end
if @rotate_speed != 0
@angle += @rotate_speed / 2.0
while @angle < 0
@angle += 360
end
@angle %= 360
end
end
end
#==============================================================================
# ■ Game_Battler (分割定義 1)
#------------------------------------------------------------------------------
# バトラーを扱うクラスです。このクラスは Game_Actor クラスと Game_Enemy クラ
# スのスーパークラスとして使用されます。
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_reader :battler_name # バトラー ファイル名
attr_reader :battler_hue # バトラー 色相
attr_reader :hp # HP
attr_reader :sp # SP
attr_reader :states # ステート
attr_accessor :hidden # 隠れフラグ
attr_accessor :immortal # 不死身フラグ
attr_accessor :damage_pop # ダメージ表示フラグ
attr_accessor :damage # ダメージ値
attr_accessor :critical # クリティカルフラグ
attr_accessor :animation_id # アニメーション ID
attr_accessor :animation_hit # アニメーション ヒットフラグ
attr_accessor :white_flash # 白フラッシュフラグ
attr_accessor :blink # 明滅フラグ
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
@battler_name = ""
@battler_hue = 0
@hp = 0
@sp = 0
@states = []
@states_turn = {}
@maxhp_plus = 0
@maxsp_plus = 0
@str_plus = 0
@dex_plus = 0
@agi_plus = 0
@int_plus = 0
@hidden = false
@immortal = false
@damage_pop = false
@damage = nil
@critical = false
@animation_id = 0
@animation_hit = false
@white_flash = false
@blink = false
@current_action = Game_BattleAction.new
end
#--------------------------------------------------------------------------
# ● MaxHP の取得
#--------------------------------------------------------------------------
def maxhp
n = [[base_maxhp + @maxhp_plus, 1].max, 999999].min
for i in @states
n *= $data_states[i].maxhp_rate / 100.0
end
n = [[Integer(n), 1].max, 999999].min
return n
end
#--------------------------------------------------------------------------
# ● MaxSP の取得
#--------------------------------------------------------------------------
def maxsp
n = [[base_maxsp + @maxsp_plus, 0].max, 9999].min
for i in @states
n *= $data_states[i].maxsp_rate / 100.0
end
n = [[Integer(n), 0].max, 9999].min
return n
end
#--------------------------------------------------------------------------
# ● 腕力の取得
#--------------------------------------------------------------------------
def str
n = [[base_str + @str_plus, 1].max, 999].min
for i in @states
n *= $data_states[i].str_rate / 100.0
end
n = [[Integer(n), 1].max, 999].min
return n
end
#--------------------------------------------------------------------------
# ● 器用さの取得
#--------------------------------------------------------------------------
def dex
n = [[base_dex + @dex_plus, 1].max, 999].min
for i in @states
n *= $data_states[i].dex_rate / 100.0
end
n = [[Integer(n), 1].max, 999].min
return n
end
#--------------------------------------------------------------------------
# ● 素早さの取得
#--------------------------------------------------------------------------
def agi
n = [[base_agi + @agi_plus, 1].max, 999].min
for i in @states
n *= $data_states[i].agi_rate / 100.0
end
n = [[Integer(n), 1].max, 999].min
return n
end
#--------------------------------------------------------------------------
# ● 魔力の取得
#--------------------------------------------------------------------------
def int
n = [[base_int + @int_plus, 1].max, 999].min
for i in @states
n *= $data_states[i].int_rate / 100.0
end
n = [[Integer(n), 1].max, 999].min
return n
end
#--------------------------------------------------------------------------
# ● MaxHP の設定
# maxhp : 新しい MaxHP
#--------------------------------------------------------------------------
def maxhp=(maxhp)
@maxhp_plus += maxhp - self.maxhp
@maxhp_plus = [[@maxhp_plus, -9999].max, 9999].min
@hp = [@hp, self.maxhp].min
end
#--------------------------------------------------------------------------
# ● MaxSP の設定
# maxsp : 新しい MaxSP
#--------------------------------------------------------------------------
def maxsp=(maxsp)
@maxsp_plus += maxsp - self.maxsp
@maxsp_plus = [[@maxsp_plus, -9999].max, 9999].min
@sp = [@sp, self.maxsp].min
end
#--------------------------------------------------------------------------
# ● 腕力の設定
# str : 新しい腕力
#--------------------------------------------------------------------------
def str=(str)
@str_plus += str - self.str
@str_plus = [[@str_plus, -999].max, 999].min
end
#--------------------------------------------------------------------------
# ● 器用さの設定
# dex : 新しい器用さ
#--------------------------------------------------------------------------
def dex=(dex)
@dex_plus += dex - self.dex
@dex_plus = [[@dex_plus, -999].max, 999].min
end
#--------------------------------------------------------------------------
# ● 素早さの設定
# agi : 新しい素早さ
#--------------------------------------------------------------------------
def agi=(agi)
@agi_plus += agi - self.agi
@agi_plus = [[@agi_plus, -999].max, 999].min
end
#--------------------------------------------------------------------------
# ● 魔力の設定
# int : 新しい魔力
#--------------------------------------------------------------------------
def int=(int)
@int_plus += int - self.int
@int_plus = [[@int_plus, -999].max, 999].min
end
#--------------------------------------------------------------------------
# ● 命中率の取得
#--------------------------------------------------------------------------
def hit
n = 100
for i in @states
n *= $data_states[i].hit_rate / 100.0
end
return Integer(n)
end
#--------------------------------------------------------------------------
# ● 攻撃力の取得
#--------------------------------------------------------------------------
def atk
n = base_atk
for i in @states
n *= $data_states[i].atk_rate / 100.0
end
return Integer(n)
end
#--------------------------------------------------------------------------
# ● 物理防御の取得
#--------------------------------------------------------------------------
def pdef
n = base_pdef
for i in @states
n *= $data_states[i].pdef_rate / 100.0
end
return Integer(n)
end
#--------------------------------------------------------------------------
# ● 魔法防御の取得
#--------------------------------------------------------------------------
def mdef
n = base_mdef
for i in @states
n *= $data_states[i].mdef_rate / 100.0
end
return Integer(n)
end
#--------------------------------------------------------------------------
# ● 回避修正の取得
#--------------------------------------------------------------------------
def eva
n = base_eva
for i in @states
n += $data_states[i].eva
end
return n
end
#--------------------------------------------------------------------------
# ● HP の変更
# hp : 新しい HP
#--------------------------------------------------------------------------
def hp=(hp)
@hp = [[hp, maxhp].min, 0].max
# 戦闘不能を付加または解除
for i in 1...$data_states.size
if $data_states[i].zero_hp
if self.dead?
add_state(i)
else
remove_state(i)
end
end
end
end
#--------------------------------------------------------------------------
# ● SP の変更
# sp : 新しい SP
#--------------------------------------------------------------------------
def sp=(sp)
@sp = [[sp, maxsp].min, 0].max
end
#--------------------------------------------------------------------------
# ● 全回復
#--------------------------------------------------------------------------
def recover_all
@hp = maxhp
@sp = maxsp
for i in @states.clone
remove_state(i)
end
end
#--------------------------------------------------------------------------
# ● カレントアクションの取得
#--------------------------------------------------------------------------
def current_action
return @current_action
end
#--------------------------------------------------------------------------
# ● アクションスピードの決定
#--------------------------------------------------------------------------
def make_action_speed
@current_action.speed = agi + rand(10 + agi / 4)
end
#--------------------------------------------------------------------------
# ● 戦闘不能判定
#--------------------------------------------------------------------------
def dead?
return (@hp == 0 and not @immortal)
end
#--------------------------------------------------------------------------
# ● 存在判定
#--------------------------------------------------------------------------
def exist?
return (not @hidden and (@hp > 0 or @immortal))
end
#--------------------------------------------------------------------------
# ● HP 0 判定
#--------------------------------------------------------------------------
def hp0?
return (not @hidden and @hp == 0)
end
#--------------------------------------------------------------------------
# ● コマンド入力可能判定
#-----