CODE
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/ �€”€ Battle Difficulty - KGC_BattleDifficulty �€”€ VX �€”€
#_/ �€”€ Last Update: 2008/05/09
#_/ �€”€ Written by TOMY
#_/ �€”€ Translation by Mr. Anonymous
#_/ �€”€ KGC Site:
#_/ �€”€ http://ytomy.sakura.ne.jp/
#_/ �€”€ Translator's Blog:
#_/ �€”€ http://mraprojects.wordpress.com
#_/----------------------------------------------------------------------------
#_/ This script adds battle difficulty settings to your game.
#_/============================================================================
#_/ Installation: Insert below KGC_ExtraDropItem and KGC_CustomMenuCommand.
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#==============================================================================#
# �œ€ Customization �œ€ #
#==============================================================================#
module KGC
module BattleDifficulty
# �€”€ Difficulty Variable �€”€
# Change the variable the difficulty setting is stored in.
DIFFICULTY_VARIABLE = 15
# �€”€ Difficulty �€”€
# Difficulty Format:
# DIFFICULTY << {
# :name => "Difficulty Name",
# :maxhp => MaxHP,
# :maxmp => MaxMP,
# :atk => Attack,
# :def => Defense,
# :spi => Spirit,
# :agi => Agility,
# :param => Attack �’� Defense �’� Spirit �’� Agility (Batch Specification),
# :hit => Hit Ratio,
# :eva => Evasion,
# :cri => Critical,
# :exp => Experience,
# :gold => Gold,
# :drop => Item Drop Rate,
# }
# Create by the format
# �†:atk, :def, :spi, :agi (The :param field takes highest priority�€
# The unit is a percentile of a each item.
# :name is not optional
# An omitted item is treated as a default of 100
DIFFICULTY = [] # Do not remove or modify this line!
# �ž Custom Difficulty Settings Inserted Below Here �ž
DIFFICULTY << { # Difficulty Level: 0
:name => "Easy",
:maxhp => 80,
:maxmp => 80,
:param => 80,
:cri => 50,
:drop => 90,
} # �€� Do not remove!
DIFFICULTY << { # Difficulty Level: 1
:name => "Normal",
}
DIFFICULTY << { # Difficulty Level: 2
:name => "Hard",
:maxhp => 150,
:maxmp => 130,
:atk => 120,
:spi => 120,
:agi => 110,
:drop => 120,
:exp => 90,
}
DIFFICULTY << { # Difficulty Level: 3
:name => "Very Hard",
:maxhp => 200,
:maxmp => 180,
:atk => 150,
:spi => 150,
:agi => 130,
:cri => 120,
:drop => 140,
:exp => 70,
}
DIFFICULTY << { # Difficulty Level: 4
:name => "Extreme",
:maxhp => 300,
:maxmp => 260,
:atk => 200,
:spi => 200,
:agi => 150,
:cri => 160,
:drop => 160,
:exp => 65,
}
DIFFICULTY << { # Difficulty Level: 5
:name => "Legendary",
:maxhp => 500,
:maxmp => 400,
:atk => 300,
:spi => 300,
:agi => 180,
:cri => 200,
:drop => 200,
:exp => 60,
}
# �€”€ Difficulty Initialization �€”€
# DIFFICULTY Index
# By default, 1 = Normal
INITIAL_DIFFICULTY = 1
# �€”€ Add Difficulty Command to Main Menu �€”€
# This toggle enables/disables the difficulty command selection to be added
# to the main command menu.
USE_MENU_DIFFICULTY_COMMAND = false
end
end
#------------------------------------------------------------------------------#
$imported = {} if $imported == nil
$imported["BattleDifficulty"] = true
module KGC::BattleDifficulty
# Parameters
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]
# �‚�€��’€�š�€š€™適�€�
if d[:param] != nil
rev[:atk] = rev[:def] = rev[:spi] = rev[:agi] = d[:param]
end
# �’€˜�’��’��’��€š��’€�š�€š€™適�€�
PARAMS.each { |par|
if d[par] != nil
rev[par] = d[par]
else
rev[par] = 100 if rev[par] == nil
end
}
# �’��€š��’†に追�Š�
@@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
#==============================================================================
unless $@
class RPG::Enemy::DropItem
#--------------------------------------------------------------------------
# �€”� �€�現�Ž€ 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
if method_defined?(:drop_prob)
#--------------------------------------------------------------------------
# �€”€ �’€�’��’’�’€”�Ž€ (�€��Ž��’€�š)
#--------------------------------------------------------------------------
alias drop_prob_KGC_BattleDifficulty drop_prob
def drop_prob
n = drop_prob_KGC_BattleDifficulty
if n < 100 && 0 < n
n = [[n * KGC::BattleDifficulty.get[:drop] / 100, 1].max, 100].min
end
return n
end
end
end # class
end # unless $@
#�œ€�œ€�œ€�œ€�œ€�œ€�œ€�œ€�œ€�œ€
�œ€�œ€�œ€�œ€�œ€�œ€�œ€�œ€�œ€�œ€
�œ€�œ€�œ€�œ€�œ€�œ€�œ€�œ€�œ€�œ€
œ€�œ€�œ€
�œ€�œ€�œ€�œ€�œ€�œ€
#==============================================================================
# �€“� 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
# �€��œ€œ度�€š€™�†��“Ÿ�’€“
variable_id = KGC::BattleDifficulty::DIFFICULTY_VARIABLE
$game_variables[variable_id] = KGC::BattleDifficulty::INITIAL_DIFFICULTY
end
end
#�œ€�œ€�œ€�œ€�œ€�œ€�œ€�œ€�œ€�œ€
�œ€�œ€�œ€�œ€�œ€�œ€�œ€�œ€�œ€�œ€
�œ€�œ€�œ€�œ€�œ€�œ€�œ€�œ€�œ€�œ€
œ€�œ€�œ€
�œ€�œ€�œ€�œ€�œ€�œ€
#==============================================================================
# �€“� Scene_Menu
#==============================================================================
class Scene_Menu < Scene_Base
#--------------------------------------------------------------------------
# �€”� �€š��’ž�’��’€�€š��€š��’��’€�€š�の
“�†�
#--------------------------------------------------------------------------
alias create_command_window_KGC_BattleDifficulty create_command_window
def create_command_window
create_command_window_KGC_BattleDifficulty
create_difficulty_window
return unless KGC::BattleDifficulty::USE_MENU_DIFFICULTY_COMMAND
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 terminate_KGC_BattleDifficulty terminate
def terminate
terminate_KGC_BattleDifficulty
@difficulty_window.dispose
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
# �€��œ€œ度設�šに移�’
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
# �€��œ€œ度�€š€™�€�€�
KGC::BattleDifficulty.set(@difficulty_window.index)
@command_window.replace_command(@__command_set_difficulty_index,
KGC::BattleDifficulty.get[:name])
end_difficulty_selection
end
end
end