#==============================================================================
# ** KGC_BattleDifficulty (6. Februar 2008) (von KGC)
#==============================================================================
#==============================================================================
# * Einstellungen
#==============================================================================
module KGC
module BattleDifficulty
# Schwierigkeitsstufe speichern in Variable 15
DIFFICULTY_VARIABLE = 15
# Schwierigkeitsstufe
#
# DIFFICULTY << {
# :name => "Name",
# :maxhp => Maximale HP,
# :maxmp => Maximale MP,
# :atk => Angriffskraft,
# :def => Abwehrkraft,
# :spi => Mentale Stärke,
# :agi => Agilität,
# :param => atk, def, spi, adi = param,
# :hit => Trefferrate,
# :eva => Evation,
# :cri => Volltrefferrate,
# :exp => Erfahrungspunkte,
# :gold => Gold,
# :drop => Itemdroprate,
# }
# Erstelle Array
DIFFICULTY = []
# Leichtere hier einfügen
DIFFICULTY << { # Schwierigkeitsstufe 0
:name => "Leicht",
:maxhp => 80,
:maxmp => 80,
:param => 80,
:cri => 50,
:drop => 90,
}
DIFFICULTY << { # Schwierigkeitsstufe 1
:name => "Normal",
}
DIFFICULTY << { # Schwierigkeitsstufe 2
:name => "Schwer",
:maxhp => 150,
:maxmp => 130,
:atk => 120,
:spi => 120,
:agi => 110,
:drop => 120,
}
DIFFICULTY << { # Schwierigkeitsstufe 3
:name => "Extrem",
:maxhp => 200,
:maxmp => 180,
:atk => 150,
:spi => 150,
:agi => 130,
:cri => 120,
:drop => 140,
}
DIFFICULTY << { # Schwierigkeitsstufe 4
:name => "Gott",
:maxhp => 300,
:maxmp => 260,
:atk => 200,
:spi => 200,
:agi => 150,
:cri => 160,
:drop => 160,
}
# Schwerere hier einfügen
# Standardschwierigkeitsstufe
INITIAL_DIFFICULTY = 1 # (=Normal)
# Den Punkt Schwierigkeitsstufe im Menü hinzufügen
USE_MENU_DIFFICULTY_COMMAND = true # false, falls nicht
end
end
#-----------------------------------------------------------------------------
$imported = {} if $imported == nil
$imported["BattleDifficulty"] = true
module KGC::BattleDifficulty
# Liste der Parameter
PARAMS = [
:maxhp, :maxmp, :atk, :def, :spi, :agi,
:hit, :eva, :cri, :exp, :gold, :drop
]
module_function
#--------------------------------------------------------------------------
# * ????????
#--------------------------------------------------------------------------
def create_param_revs
@@param_revs = []
DIFFICULTY.each { |d|
rev = {}
rev[:name] = d[:name]
# Festgelegte Größen übernehmen
if d[:param] != nil
rev[:atk] = rev[:def] = rev[:spi] = rev[:agi] = d[:param]
end
# Zuweisen zu den festgelegten Parametern
PARAMS.each { |par|
if d[par] != nil
rev[par] = d[par]
else
rev[par] = 100 if rev[par] == nil
end
}
# Liste
@@param_revs << rev
}
end
#--------------------------------------------------------------------------
# * ????????
#--------------------------------------------------------------------------
def param_revs
return @@param_revs
end
#--------------------------------------------------------------------------
# * ???????????
#--------------------------------------------------------------------------
def get_index
vid = DIFFICULTY_VARIABLE
if $game_variables[vid] < 0 || DIFFICULTY.size <= $game_variables[vid]
$game_variables[vid] = INITIAL_DIFFICULTY
end
return $game_variables[vid]
end
#--------------------------------------------------------------------------
# * ?????
#--------------------------------------------------------------------------
def get
return @@param_revs[get_index]
end
#--------------------------------------------------------------------------
# * ?????
# index : ?????????
#--------------------------------------------------------------------------
def set(index)
index = [[index, DIFFICULTY.size - 1].min, 0].max
$game_variables[DIFFICULTY_VARIABLE] = index
end
create_param_revs
end
#==============================================================================
# ** RPG::Enemy::DropItem
#==============================================================================
class RPG::Enemy::DropItem
unless $@
#--------------------------------------------------------------------------
# * ??? 1/N ??? N
#--------------------------------------------------------------------------
alias denominator_KGC_BattleDifficulty denominator
def denominator
n = denominator_KGC_BattleDifficulty
if n > 1
n = [n * 100 / KGC::BattleDifficulty.get[:drop], 1].max
end
return n
end
end
end
#==============================================================================
# ** Game_Enemy
#==============================================================================
class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# * ?? MaxHP ???
#--------------------------------------------------------------------------
alias base_maxhp_KGC_BattleDifficulty base_maxhp
def base_maxhp
n = base_maxhp_KGC_BattleDifficulty
n = n * KGC::BattleDifficulty.get[:maxhp] / 100
return n
end
#--------------------------------------------------------------------------
# * ?? MaxMP ???
#--------------------------------------------------------------------------
alias base_maxmp_KGC_BattleDifficulty base_maxmp
def base_maxmp
n = base_maxmp_KGC_BattleDifficulty
n = n * KGC::BattleDifficulty.get[:maxmp] / 100
return n
end
#--------------------------------------------------------------------------
# * ????????
#--------------------------------------------------------------------------
alias base_atk_KGC_BattleDifficulty base_atk
def base_atk
n = base_atk_KGC_BattleDifficulty
n = n * KGC::BattleDifficulty.get[:atk] / 100
return n
end
#--------------------------------------------------------------------------
# * ????????
#--------------------------------------------------------------------------
alias base_def_KGC_BattleDifficulty base_def
def base_def
n = base_def_KGC_BattleDifficulty
n = n * KGC::BattleDifficulty.get[:def] / 100
return n
end
#--------------------------------------------------------------------------
# * ????????
#--------------------------------------------------------------------------
alias base_spi_KGC_BattleDifficulty base_spi
def base_spi
n = base_spi_KGC_BattleDifficulty
n = n * KGC::BattleDifficulty.get[:spi] / 100
return n
end
#--------------------------------------------------------------------------
# * ????????
#--------------------------------------------------------------------------
alias base_agi_KGC_BattleDifficulty base_agi
def base_agi
n = base_agi_KGC_BattleDifficulty
n = n * KGC::BattleDifficulty.get[:agi] / 100
return n
end
#--------------------------------------------------------------------------
# * ??????
#--------------------------------------------------------------------------
alias hit_KGC_BattleDifficulty hit
def hit
n = hit_KGC_BattleDifficulty
n = n * KGC::BattleDifficulty.get[:hit] / 100
return n
end
#--------------------------------------------------------------------------
# * ??????
#--------------------------------------------------------------------------
alias eva_KGC_BattleDifficulty eva
def eva
n = eva_KGC_BattleDifficulty
n = n * KGC::BattleDifficulty.get[:eva] / 100
return n
end
#--------------------------------------------------------------------------
# * ??????????
#--------------------------------------------------------------------------
alias cri_KGC_BattleDifficulty cri
def cri
n = cri_KGC_BattleDifficulty
n = n * KGC::BattleDifficulty.get[:cri] / 100
return n
end
#--------------------------------------------------------------------------
# * ??????
#--------------------------------------------------------------------------
alias exp_KGC_BattleDifficulty exp
def exp
n = exp_KGC_BattleDifficulty
n = n * KGC::BattleDifficulty.get[:exp] / 100
return n
end
#--------------------------------------------------------------------------
# * ?????
#--------------------------------------------------------------------------
alias gold_KGC_BattleDifficulty gold
def gold
n = gold_KGC_BattleDifficulty
n = n * KGC::BattleDifficulty.get[:gold] / 100
return n
end
end
#==============================================================================
# ** Window_Command
#==============================================================================
class Window_Command < Window_Selectable
unless method_defined?(:add_command)
#--------------------------------------------------------------------------
# * ???????
# ?????????
#--------------------------------------------------------------------------
def add_command(command)
@commands << command
@item_max = @commands.size
item_index = @item_max - 1
refresh_command
draw_item(item_index)
return item_index
end
#--------------------------------------------------------------------------
# * ???????????
#--------------------------------------------------------------------------
def refresh_command
buf = self.contents.clone
self.height = [self.height, row_max * WLH + 32].max
create_contents
self.contents.blt(0, 0, buf, buf.rect)
buf.dispose
end
#--------------------------------------------------------------------------
# * ???????
#--------------------------------------------------------------------------
def insert_command(index, command)
@commands.insert(index, command)
@item_max = @commands.size
refresh_command
refresh
end
#--------------------------------------------------------------------------
# * ???????
#--------------------------------------------------------------------------
def remove_command(command)
@commands.delete(command)
@item_max = @commands.size
refresh
end
end
unless method_defined?(:replace_command)
#--------------------------------------------------------------------------
# * ???????
#--------------------------------------------------------------------------
def replace_command(index, command, enabled = true)
@commands[index] = command
draw_item(index, enabled)
end
end
end
#==============================================================================
# ** Scene_Title
#==============================================================================
class Scene_Title < Scene_Base
#--------------------------------------------------------------------------
# * ??????????????
#--------------------------------------------------------------------------
alias create_game_objects_KGC_BattleDifficulty create_game_objects
def create_game_objects
create_game_objects_KGC_BattleDifficulty
# Initialisiere Schwierigkeitsstufe
variable_id = KGC::BattleDifficulty::DIFFICULTY_VARIABLE
$game_variables[variable_id] = KGC::BattleDifficulty::INITIAL_DIFFICULTY
end
end
#==============================================================================
# ** Scene_Menu
#==============================================================================
class Scene_Menu < Scene_Base
if KGC::BattleDifficulty::USE_MENU_DIFFICULTY_COMMAND
#--------------------------------------------------------------------------
# * ????????????
#--------------------------------------------------------------------------
alias create_command_window_KGC_BattleDifficulty create_command_window
def create_command_window
create_command_window_KGC_BattleDifficulty
create_difficulty_window
return if $imported["CustomMenuCommand"]
@__command_set_difficulty_index =
@command_window.add_command(KGC::BattleDifficulty.get[:name])
if @command_window.oy > 0
@command_window.oy -= Window_Base::WLH
end
@command_window.index = @menu_index
end
end
#--------------------------------------------------------------------------
# * ?????????????
#--------------------------------------------------------------------------
def create_difficulty_window
commands = []
KGC::BattleDifficulty::param_revs.each { |d|
commands << d[:name]
}
@difficulty_window = Window_Command.new(160, commands)
@difficulty_window.x = @command_window.width - 16
@difficulty_window.z = 1000
@difficulty_window.active = false
@difficulty_window.openness = 0
end
#--------------------------------------------------------------------------
# * ??????
#--------------------------------------------------------------------------
alias update_KGC_BattleDifficulty update
def update
@difficulty_window.update
if @difficulty_window.active
update_KGC_BattleDifficulty
update_difficulty_selection
return
end
update_KGC_BattleDifficulty
end
#--------------------------------------------------------------------------
# * ?????????
#--------------------------------------------------------------------------
alias update_command_selection_KGC_BattleDifficulty update_command_selection
def update_command_selection
call_ap_viewer_flag = false
if Input.trigger?(Input::C)
case @command_window.index
when @__command_set_difficulty_index # ?????
call_set_difficulty_flag = true
end
end
# Migration der Schwierigkeitsstufeneinstellungen
if call_set_difficulty_flag
Sound.play_decision
start_difficulty_selection
return
end
update_command_selection_KGC_BattleDifficulty
end
#--------------------------------------------------------------------------
# * ????????
#--------------------------------------------------------------------------
def start_difficulty_selection
@command_window.active = false
dy = @command_window.cursor_rect.y
limit_y = Graphics.height - @difficulty_window.height
@difficulty_window.y = [[dy, limit_y].min, 0].max
@difficulty_window.active = true
@difficulty_window.index = KGC::BattleDifficulty.get_index
@difficulty_window.open
end
#--------------------------------------------------------------------------
# * ????????
#--------------------------------------------------------------------------
def end_difficulty_selection
@command_window.active = true
@difficulty_window.active = false
@difficulty_window.close
end
#--------------------------------------------------------------------------
# * ????????
#--------------------------------------------------------------------------
def update_difficulty_selection
if Input.trigger?(Input::B)
Sound.play_cancel
end_difficulty_selection
elsif Input.trigger?(Input::C)
Sound.play_decision
# Schwierigkeitsstufe ändern
KGC::BattleDifficulty.set(@difficulty_window.index)
@command_window.replace_command(@__command_set_difficulty_index,
KGC::BattleDifficulty.get[:name])
end_difficulty_selection
end
end
end#==============================================================================
# ** KGC_BattleDifficulty (6. Februar 2008) (von KGC)
#==============================================================================
#==============================================================================
# * Einstellungen
#==============================================================================
module KGC
module BattleDifficulty
# Schwierigkeitsstufe speichern in Variable 154
DIFFICULTY_VARIABLE = 154
# Schwierigkeitsstufe
#
# DIFFICULTY << {
# :name => "Name",
# :maxhp => Maximale HP,
# :maxmp => Maximale MP,
# :atk => Angriffskraft,
# :def => Abwehrkraft,
# :spi => Mentale Stärke,
# :agi => Agilität,
# :param => atk, def, spi, adi = param,
# :hit => Trefferrate,
# :eva => Evation,
# :cri => Volltrefferrate,
# :exp => Erfahrungspunkte,
# :gold => Gold,
# :drop => Itemdroprate,
# }
# Erstelle Array
DIFFICULTY = []
# Leichtere hier einfügen
DIFFICULTY << { # Schwierigkeitsstufe 0
:name => "Leicht",
:maxhp => 80,
:maxmp => 80,
:param => 80,
:cri => 50,
:drop => 90,
}
DIFFICULTY << { # Schwierigkeitsstufe 1
:name => "Normal",
}
DIFFICULTY << { # Schwierigkeitsstufe 2
:name => "Schwer",
:maxhp => 150,
:maxmp => 130,
:atk => 120,
:spi => 120,
:agi => 110,
:drop => 120,
}
DIFFICULTY << { # Schwierigkeitsstufe 3
:name => "Extrem",
:maxhp => 200,
:maxmp => 180,
:atk => 150,
:spi => 150,
:agi => 130,
:cri => 120,
:drop => 140,
}
DIFFICULTY << { # Schwierigkeitsstufe 4
:name => "Todeststufe",
:maxhp => 300,
:maxmp => 260,
:atk => 200,
:spi => 200,
:agi => 150,
:cri => 160,
:drop => 180,
}
# Schwerere hier einfügen
# Standardschwierigkeitsstufe
INITIAL_DIFFICULTY = 1 # (=Normal)
# Den Punkt Schwierigkeitsstufe im Menü hinzufügen
USE_MENU_DIFFICULTY_COMMAND = false # false, falls nicht
end
end
#-----------------------------------------------------------------------------
$imported = {} if $imported == nil
$imported["BattleDifficulty"] = true
module KGC::BattleDifficulty
# Liste der Parameter
PARAMS = [
:maxhp, :maxmp, :atk, :def, :spi, :agi,
:hit, :eva, :cri, :exp, :gold, :drop
]
module_function
#--------------------------------------------------------------------------
# * ????????
#--------------------------------------------------------------------------
def create_param_revs
@@param_revs = []
DIFFICULTY.each { |d|
rev = {}
rev[:name] = d[:name]
# Festgelegte Größen übernehmen
if d[:param] != nil
rev[:atk] = rev[:def] = rev[:spi] = rev[:agi] = d[:param]
end
# Zuweisen zu den festgelegten Parametern
PARAMS.each { |par|
if d[par] != nil
rev[par] = d[par]
else
rev[par] = 100 if rev[par] == nil
end
}
# Liste
@@param_revs << rev
}
end
#--------------------------------------------------------------------------
# * ????????
#--------------------------------------------------------------------------
def param_revs
return @@param_revs
end
#--------------------------------------------------------------------------
# * ???????????
#--------------------------------------------------------------------------
def get_index
vid = DIFFICULTY_VARIABLE
if $game_variables[vid] < 0 || DIFFICULTY.size <= $game_variables[vid]
$game_variables[vid] = INITIAL_DIFFICULTY
end
return $game_variables[vid]
end
#--------------------------------------------------------------------------
# * ?????
#--------------------------------------------------------------------------
def get
return @@param_revs[get_index]
end
#--------------------------------------------------------------------------
# * ?????
# index : ?????????
#--------------------------------------------------------------------------
def set(index)
index = [[index, DIFFICULTY.size - 1].min, 0].max
$game_variables[DIFFICULTY_VARIABLE] = index
end
create_param_revs
end
#==============================================================================
# ** RPG::Enemy::DropItem
#==============================================================================
class RPG::Enemy::DropItem
unless $@
#--------------------------------------------------------------------------
# * ??? 1/N ??? N
#--------------------------------------------------------------------------
alias denominator_KGC_BattleDifficulty denominator
def denominator
n = denominator_KGC_BattleDifficulty
if n > 1
n = [n * 100 / KGC::BattleDifficulty.get[:drop], 1].max
end
return n
end
end
end
#==============================================================================
# ** Game_Enemy
#==============================================================================
class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# * ?? MaxHP ???
#--------------------------------------------------------------------------
alias base_maxhp_KGC_BattleDifficulty base_maxhp
def base_maxhp
n = base_maxhp_KGC_BattleDifficulty
n = n * KGC::BattleDifficulty.get[:maxhp] / 100
return n
end
#--------------------------------------------------------------------------
# * ?? MaxMP ???
#--------------------------------------------------------------------------
alias base_maxmp_KGC_BattleDifficulty base_maxmp
def base_maxmp
n = base_maxmp_KGC_BattleDifficulty
n = n * KGC::BattleDifficulty.get[:maxmp] / 100
return n
end
#--------------------------------------------------------------------------
# * ????????
#--------------------------------------------------------------------------
alias base_atk_KGC_BattleDifficulty base_atk
def base_atk
n = base_atk_KGC_BattleDifficulty
n = n * KGC::BattleDifficulty.get[:atk] / 100
return n
end
#--------------------------------------------------------------------------
# * ????????
#--------------------------------------------------------------------------
alias base_def_KGC_BattleDifficulty base_def
def base_def
n = base_def_KGC_BattleDifficulty
n = n * KGC::BattleDifficulty.get[:def] / 100
return n
end
#--------------------------------------------------------------------------
# * ????????
#--------------------------------------------------------------------------
alias base_spi_KGC_BattleDifficulty base_spi
def base_spi
n = base_spi_KGC_BattleDifficulty
n = n * KGC::BattleDifficulty.get[:spi] / 100
return n
end
#--------------------------------------------------------------------------
# * ????????
#--------------------------------------------------------------------------
alias base_agi_KGC_BattleDifficulty base_agi
def base_agi
n = base_agi_KGC_BattleDifficulty
n = n * KGC::BattleDifficulty.get[:agi] / 100
return n
end
#--------------------------------------------------------------------------
# * ??????
#--------------------------------------------------------------------------
alias hit_KGC_BattleDifficulty hit
def hit
n = hit_KGC_BattleDifficulty
n = n * KGC::BattleDifficulty.get[:hit] / 100
return n
end
#--------------------------------------------------------------------------
# * ??????
#--------------------------------------------------------------------------
alias eva_KGC_BattleDifficulty eva
def eva
n = eva_KGC_BattleDifficulty
n = n * KGC::BattleDifficulty.get[:eva] / 100
return n
end
#--------------------------------------------------------------------------
# * ??????????
#--------------------------------------------------------------------------
alias cri_KGC_BattleDifficulty cri
def cri
n = cri_KGC_BattleDifficulty
n = n * KGC::BattleDifficulty.get[:cri] / 100
return n
end
#--------------------------------------------------------------------------
# * ??????
#--------------------------------------------------------------------------
alias exp_KGC_BattleDifficulty exp
def exp
n = exp_KGC_BattleDifficulty
n = n * KGC::BattleDifficulty.get[:exp] / 100
return n
end
#--------------------------------------------------------------------------
# * ?????
#--------------------------------------------------------------------------
alias gold_KGC_BattleDifficulty gold
def gold
n = gold_KGC_BattleDifficulty
n = n * KGC::BattleDifficulty.get[:gold] / 100
return n
end
end
#==============================================================================
# ** Window_Command
#==============================================================================
class Window_Command < Window_Selectable
unless method_defined?(:add_command)
#--------------------------------------------------------------------------
# * ???????
# ?????????
#--------------------------------------------------------------------------
def add_command(command)
@commands << command
@item_max = @commands.size
item_index = @item_max - 1
refresh_command
draw_item(item_index)
return item_index
end
#--------------------------------------------------------------------------
# * ???????????
#--------------------------------------------------------------------------
def refresh_command
buf = self.contents.clone
self.height = [self.height, row_max * WLH + 32].max
create_contents
self.contents.blt(0, 0, buf, buf.rect)
buf.dispose
end
#--------------------------------------------------------------------------
# * ???????
#--------------------------------------------------------------------------
def insert_command(index, command)
@commands.insert(index, command)
@item_max = @commands.size
refresh_command
refresh
end
#--------------------------------------------------------------------------
# * ???????
#--------------------------------------------------------------------------
def remove_command(command)
@commands.delete(command)
@item_max = @commands.size
refresh
end
end
unless method_defined?(:replace_command)
#--------------------------------------------------------------------------
# * ???????
#--------------------------------------------------------------------------
def replace_command(index, command, enabled = true)
@commands[index] = command
draw_item(index, enabled)
end
end
end
#==============================================================================
# ** Scene_Title
#==============================================================================
class Scene_Title < Scene_Base
#--------------------------------------------------------------------------
# * ??????????????
#--------------------------------------------------------------------------
alias create_game_objects_KGC_BattleDifficulty create_game_objects
def create_game_objects
create_game_objects_KGC_BattleDifficulty
# Initialisiere Schwierigkeitsstufe
variable_id = KGC::BattleDifficulty::DIFFICULTY_VARIABLE
$game_variables[variable_id] = KGC::BattleDifficulty::INITIAL_DIFFICULTY
end
end
#==============================================================================
# ** Scene_Menu
#==============================================================================
class Scene_Menu < Scene_Base
if KGC::BattleDifficulty::USE_MENU_DIFFICULTY_COMMAND
#--------------------------------------------------------------------------
# * ????????????
#--------------------------------------------------------------------------
alias create_command_window_KGC_BattleDifficulty create_command_window
def create_command_window
create_command_window_KGC_BattleDifficulty
create_difficulty_window
return if $imported["CustomMenuCommand"]
@__command_set_difficulty_index =
@command_window.add_command(KGC::BattleDifficulty.get[:name])
if @command_window.oy > 0
@command_window.oy -= Window_Base::WLH
end
@command_window.index = @menu_index
end
end
#--------------------------------------------------------------------------
# * ?????????????
#--------------------------------------------------------------------------
def create_difficulty_window
commands = []
KGC::BattleDifficulty::param_revs.each { |d|
commands << d[:name]
}
@difficulty_window = Window_Command.new(160, commands)
@difficulty_window.x = @command_window.width - 16
@difficulty_window.z = 1000
@difficulty_window.active = false
@difficulty_window.openness = 0
end
#--------------------------------------------------------------------------
# * ??????
#--------------------------------------------------------------------------
alias update_KGC_BattleDifficulty update
def update
@difficulty_window.update
if @difficulty_window.active
update_KGC_BattleDifficulty
update_difficulty_selection
return
end
update_KGC_BattleDifficulty
end
#--------------------------------------------------------------------------
# * ?????????
#--------------------------------------------------------------------------
alias update_command_selection_KGC_BattleDifficulty update_command_selection
def update_command_selection
call_ap_viewer_flag = false
if Input.trigger?(Input::C)
case @command_window.index
when @__command_set_difficulty_index # ?????
call_set_difficulty_flag = true
end
end
# Migration der Schwierigkeitsstufeneinstellungen
if call_set_difficulty_flag
Sound.play_decision
start_difficulty_selection
return
end
update_command_selection_KGC_BattleDifficulty
end
#--------------------------------------------------------------------------
# * ????????
#--------------------------------------------------------------------------
def start_difficulty_selection
@command_window.active = false
dy = @command_window.cursor_rect.y
limit_y = Graphics.height - @difficulty_window.height
@difficulty_window.y = [[dy, limit_y].min, 0].max
@difficulty_window.active = true
@difficulty_window.index = KGC::BattleDifficulty.get_index
@difficulty_window.open
end
#--------------------------------------------------------------------------
# * ????????
#--------------------------------------------------------------------------
def end_difficulty_selection
@command_window.active = true
@difficulty_window.active = false
@difficulty_window.close
end
#--------------------------------------------------------------------------
# * ????????
#--------------------------------------------------------------------------
def update_difficulty_selection
if Input.trigger?(Input::B)
Sound.play_cancel
end_difficulty_selection
elsif Input.trigger?(Input::C)
Sound.play_decision
# Schwierigkeitsstufe ändern
KGC::BattleDifficulty.set(@difficulty_window.index)
@command_window.replace_command(@__command_set_difficulty_index,
KGC::BattleDifficulty.get[:name])
end_difficulty_selection
end
end
end
#==============================================================================
# ** KGC_BattleDifficulty (6. Februar 2008) (von KGC)
#==============================================================================
#==============================================================================
# * Einstellungen
#==============================================================================
module KGC
module BattleDifficulty
# Schwierigkeitsstufe speichern in Variable 154
DIFFICULTY_VARIABLE = 154
# Schwierigkeitsstufe
#
# DIFFICULTY << {
# :name => "Name",
# :maxhp => Maximale HP,
# :maxmp => Maximale MP,
# :atk => Angriffskraft,
# :def => Abwehrkraft,
# :spi => Mentale Stärke,
# :agi => Agilität,
# :param => atk, def, spi, adi = param,
# :hit => Trefferrate,
# :eva => Evation,
# :cri => Volltrefferrate,
# :exp => Erfahrungspunkte,
# :gold => Gold,
# :drop => Itemdroprate,
# }
# Erstelle Array
DIFFICULTY = []
# Leichtere hier einfügen
DIFFICULTY << { # Schwierigkeitsstufe 0
:name => "Leicht",
:maxhp => 80,
:maxmp => 80,
:param => 80,
:cri => 50,
:drop => 90,
}
DIFFICULTY << { # Schwierigkeitsstufe 1
:name => "Normal",
}
DIFFICULTY << { # Schwierigkeitsstufe 2
:name => "Schwer",
:maxhp => 150,
:maxmp => 130,
:atk => 120,
:spi => 120,
:agi => 110,
:drop => 120,
}
DIFFICULTY << { # Schwierigkeitsstufe 3
:name => "Extrem",
:maxhp => 200,
:maxmp => 180,
:atk => 150,
:spi => 150,
:agi => 130,
:cri => 120,
:drop => 140,
}
DIFFICULTY << { # Schwierigkeitsstufe 4
:name => "Todeststufe",
:maxhp => 300,
:maxmp => 260,
:atk => 200,
:spi => 200,
:agi => 150,
:cri => 160,
:drop => 180,
}
# Schwerere hier einfügen
# Standardschwierigkeitsstufe
INITIAL_DIFFICULTY = 1 # (=Normal)
# Den Punkt Schwierigkeitsstufe im Menü hinzufügen
USE_MENU_DIFFICULTY_COMMAND = false # false, falls nicht
end
end
#-----------------------------------------------------------------------------
$imported = {} if $imported == nil
$imported["BattleDifficulty"] = true
module KGC::BattleDifficulty
# Liste der Parameter
PARAMS = [
:maxhp, :maxmp, :atk, :def, :spi, :agi,
:hit, :eva, :cri, :exp, :gold, :drop
]
module_function
#--------------------------------------------------------------------------
# * ????????
#--------------------------------------------------------------------------
def create_param_revs
@@param_revs = []
DIFFICULTY.each { |d|
rev = {}
rev[:name] = d[:name]
# Festgelegte Größen übernehmen
if d[:param] != nil
rev[:atk] = rev[:def] = rev[:spi] = rev[:agi] = d[:param]
end
# Zuweisen zu den festgelegten Parametern
PARAMS.each { |par|
if d[par] != nil
rev[par] = d[par]
else
rev[par] = 100 if rev[par] == nil
end
}
# Liste
@@param_revs << rev
}
end
#--------------------------------------------------------------------------
# * ????????
#--------------------------------------------------------------------------
def param_revs
return @@param_revs
end
#--------------------------------------------------------------------------
# * ???????????
#--------------------------------------------------------------------------
def get_index
vid = DIFFICULTY_VARIABLE
if $game_variables[vid] < 0 || DIFFICULTY.size <= $game_variables[vid]
$game_variables[vid] = INITIAL_DIFFICULTY
end
return $game_variables[vid]
end
#--------------------------------------------------------------------------
# * ?????
#--------------------------------------------------------------------------
def get
return @@param_revs[get_index]
end
#--------------------------------------------------------------------------
# * ?????
# index : ?????????
#--------------------------------------------------------------------------
def set(index)
index = [[index, DIFFICULTY.size - 1].min, 0].max
$game_variables[DIFFICULTY_VARIABLE] = index
end
create_param_revs
end
#==============================================================================
# ** RPG::Enemy::DropItem
#==============================================================================
class RPG::Enemy::DropItem
unless $@
#--------------------------------------------------------------------------
# * ??? 1/N ??? N
#--------------------------------------------------------------------------
alias denominator_KGC_BattleDifficulty denominator
def denominator
n = denominator_KGC_BattleDifficulty
if n > 1
n = [n * 100 / KGC::BattleDifficulty.get[:drop], 1].max
end
return n
end
end
end
#==============================================================================
# ** Game_Enemy
#==============================================================================
class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# * ?? MaxHP ???
#--------------------------------------------------------------------------
alias base_maxhp_KGC_BattleDifficulty base_maxhp
def base_maxhp
n = base_maxhp_KGC_BattleDifficulty
n = n * KGC::BattleDifficulty.get[:maxhp] / 100
return n
end
#--------------------------------------------------------------------------
# * ?? MaxMP ???
#--------------------------------------------------------------------------
alias base_maxmp_KGC_BattleDifficulty base_maxmp
def base_maxmp
n = base_maxmp_KGC_BattleDifficulty
n = n * KGC::BattleDifficulty.get[:maxmp] / 100
return n
end
#--------------------------------------------------------------------------
# * ????????
#--------------------------------------------------------------------------
alias base_atk_KGC_BattleDifficulty base_atk
def base_atk
n = base_atk_KGC_BattleDifficulty
n = n * KGC::BattleDifficulty.get[:atk] / 100
return n
end
#--------------------------------------------------------------------------
# * ????????
#--------------------------------------------------------------------------
alias base_def_KGC_BattleDifficulty base_def
def base_def
n = base_def_KGC_BattleDifficulty
n = n * KGC::BattleDifficulty.get[:def] / 100
return n
end
#--------------------------------------------------------------------------
# * ????????
#--------------------------------------------------------------------------
alias base_spi_KGC_BattleDifficulty base_spi
def base_spi
n = base_spi_KGC_BattleDifficulty
n = n * KGC::BattleDifficulty.get[:spi] / 100
return n
end
#--------------------------------------------------------------------------
# * ????????
#--------------------------------------------------------------------------
alias base_agi_KGC_BattleDifficulty base_agi
def base_agi
n = base_agi_KGC_BattleDifficulty
n = n * KGC::BattleDifficulty.get[:agi] / 100
return n
end
#--------------------------------------------------------------------------
# * ??????
#--------------------------------------------------------------------------
alias hit_KGC_BattleDifficulty hit
def hit
n = hit_KGC_BattleDifficulty
n = n * KGC::BattleDifficulty.get[:hit] / 100
return n
end
#--------------------------------------------------------------------------
# * ??????
#--------------------------------------------------------------------------
alias eva_KGC_BattleDifficulty eva
def eva
n = eva_KGC_BattleDifficulty
n = n * KGC::BattleDifficulty.get[:eva] / 100
return n
end
#--------------------------------------------------------------------------
# * ??????????
#--------------------------------------------------------------------------
alias cri_KGC_BattleDifficulty cri
def cri
n = cri_KGC_BattleDifficulty
n = n * KGC::BattleDifficulty.get[:cri] / 100
return n
end
#--------------------------------------------------------------------------
# * ??????
#--------------------------------------------------------------------------
alias exp_KGC_BattleDifficulty exp
def exp
n = exp_KGC_BattleDifficulty
n = n * KGC::BattleDifficulty.get[:exp] / 100
return n
end
#--------------------------------------------------------------------------
# * ?????
#--------------------------------------------------------------------------
alias gold_KGC_BattleDifficulty gold
def gold
n = gold_KGC_BattleDifficulty
n = n * KGC::BattleDifficulty.get[:gold] / 100
return n
end
end
#==============================================================================
# ** Window_Command
#==============================================================================
class Window_Command < Window_Selectable
unless method_defined?(:add_command)
#--------------------------------------------------------------------------
# * ???????
# ?????????
#--------------------------------------------------------------------------
def add_command(command)
@commands << command
@item_max = @commands.size
item_index = @item_max - 1
refresh_command
draw_item(item_index)
return item_index
end
#--------------------------------------------------------------------------
# * ???????????
#--------------------------------------------------------------------------
def refresh_command
buf = self.contents.clone
self.height = [self.height, row_max * WLH + 32].max
create_contents
self.contents.blt(0, 0, buf, buf.rect)
buf.dispose
end
#--------------------------------------------------------------------------
# * ???????
#--------------------------------------------------------------------------
def insert_command(index, command)
@commands.insert(index, command)
@item_max = @commands.size
refresh_command
refresh
end
#--------------------------------------------------------------------------
# * ???????
#--------------------------------------------------------------------------
def remove_command(command)
@commands.delete(command)
@item_max = @commands.size
refresh
end
end
unless method_defined?(:replace_command)
#--------------------------------------------------------------------------
# * ???????
#--------------------------------------------------------------------------
def replace_command(index, command, enabled = true)
@commands[index] = command
draw_item(index, enabled)
end
end
end
#==============================================================================
# ** Scene_Title
#==============================================================================
class Scene_Title < Scene_Base
#--------------------------------------------------------------------------
# * ??????????????
#--------------------------------------------------------------------------
alias create_game_objects_KGC_BattleDifficulty create_game_objects
def create_game_objects
create_game_objects_KGC_BattleDifficulty
# Initialisiere Schwierigkeitsstufe
variable_id = KGC::BattleDifficulty::DIFFICULTY_VARIABLE
$game_variables[variable_id] = KGC::BattleDifficulty::INITIAL_DIFFICULTY
end
end
#==============================================================================
# ** Scene_Menu
#==============================================================================
class Scene_Menu < Scene_Base
if KGC::BattleDifficulty::USE_MENU_DIFFICULTY_COMMAND
#--------------------------------------------------------------------------
# * ????????????
#--------------------------------------------------------------------------
alias create_command_window_KGC_BattleDifficulty create_command_window
def create_command_window
create_command_window_KGC_BattleDifficulty
create_difficulty_window
return if $imported["CustomMenuCommand"]
@__command_set_difficulty_index =
@command_window.add_command(KGC::BattleDifficulty.get[:name])
if @command_window.oy > 0
@command_window.oy -= Window_Base::WLH
end
@command_window.index = @menu_index
end
#--------------------------------------------------------------------------
# * ?????????????
#--------------------------------------------------------------------------
def create_difficulty_window
commands = []
KGC::BattleDifficulty::param_revs.each { |d|
commands << d[:name]
}
@difficulty_window = Window_Command.new(160, commands)
@difficulty_window.x = @command_window.width - 16
@difficulty_window.z = 1000
@difficulty_window.active = false
@difficulty_window.openness = 0
end
#--------------------------------------------------------------------------
# * ??????
#--------------------------------------------------------------------------
alias update_KGC_BattleDifficulty update
def update
@difficulty_window.update
if @difficulty_window.active
update_KGC_BattleDifficulty
update_difficulty_selection
return
end
update_KGC_BattleDifficulty
end
#--------------------------------------------------------------------------
# * ?????????
#--------------------------------------------------------------------------
alias update_command_selection_KGC_BattleDifficulty update_command_selection
def update_command_selection
call_ap_viewer_flag = false
if Input.trigger?(Input::C)
case @command_window.index
when @__command_set_difficulty_index # ?????
call_set_difficulty_flag = true
end
end
# Migration der Schwierigkeitsstufeneinstellungen
if call_set_difficulty_flag
Sound.play_decision
start_difficulty_selection
return
end
update_command_selection_KGC_BattleDifficulty
end
#--------------------------------------------------------------------------
# * ????????
#--------------------------------------------------------------------------
def start_difficulty_selection
@command_window.active = false
dy = @command_window.cursor_rect.y
limit_y = Graphics.height - @difficulty_window.height
@difficulty_window.y = [[dy, limit_y].min, 0].max
@difficulty_window.active = true
@difficulty_window.index = KGC::BattleDifficulty.get_index
@difficulty_window.open
end
#--------------------------------------------------------------------------
# * ????????
#--------------------------------------------------------------------------
def end_difficulty_selection
@command_window.active = true
@difficulty_window.active = false
@difficulty_window.close
end
#--------------------------------------------------------------------------
# * ????????
#--------------------------------------------------------------------------
def update_difficulty_selection
if Input.trigger?(Input::B)
Sound.play_cancel
end_difficulty_selection
elsif Input.trigger?(Input::C)
Sound.play_decision
# Schwierigkeitsstufe ändern
KGC::BattleDifficulty.set(@difficulty_window.index)
@command_window.replace_command(@__command_set_difficulty_index,
KGC::BattleDifficulty.get[:name])
end_difficulty_selection
end
end
end
end