class Scene_Map
alias bestiary_battle call_battle
def call_battle
troop = $data_troops[$game_temp.battle_troop_id].members
for i in 0...troop.size
unless $pernah_ketemu.include?(troop[i].enemy_id)
$pernah_ketemu.push(troop[i].enemy_id)
end
end
bestiary_battle
end
end
class Scene_Title
alias bestiary_main main
def main
$pernah_ketemu = []
bestiary_main
end
end
class Window_Bestiary < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 64, 640, 416)
@column_max = 2
self.index = 0
refresh
end
#--------------------------------------------------------------------------
# * Get Item
#--------------------------------------------------------------------------
def enemy
return @data[self.index]
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@ga = []
@data = []
# Add item
for i in 1...$data_enemies.size
@data.push($data_enemies[i])
end
# If item count is not 0, make a bit map and draw all items
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
enemy = @data[index]
x = 4 + index % 2 * (288 + 32)
y = index / 2 * 32
width = self.contents.text_size("88888").width
if $pernah_ketemu.include?(enemy.id)
self.contents.font.color = normal_color
self.contents.draw_text(x + 28, y, 212, 32, enemy.name, 0)
self.contents.draw_text(x + 225, y, width, 32, enemy.maxhp.to_s, 2)
else
@ga.push(enemy.id)
self.contents.font.color = disabled_color
self.contents.draw_text(x + 28, y, 212, 32, "????", 0)
self.contents.draw_text(x + 225, y, width, 32, "????", 2)
end
bitmap = RPG::Cache.battler(enemy.battler_name, enemy.battler_hue)
opacity = self.contents.font.color == normal_color ? 255 : 25
src_rect = bitmap.rect
dest_rect = Rect.new(x, y + 3, 24, 24)
self.contents.stretch_blt(dest_rect, bitmap, src_rect, opacity)
end
#--------------------------------------------------------------------------
# * Help Text Update
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(@ga.include?(self.enemy.id) ? "???????" : self.enemy.name)
end
end
class Window_EnemyStatus < Window_Base
def initialize
super(0, 64, 640, 416)
self.contents = Bitmap.new(width - 32, height - 32)
end
def set(enemy)
@enemy = enemy
refresh
end
def refresh
self.contents.clear
bitmap = RPG::Cache.battler(@enemy.battler_name, @enemy.battler_hue)
src_rect = bitmap.rect
dest_rect = Rect.new(160-(180/2), 240-(224/2), 180, 224)
self.contents.stretch_blt(dest_rect, bitmap, src_rect, 255)
width = self.contents.text_size("88888").width
gold = @enemy.gold.to_s + " " + $data_system.words.gold
self.contents.font.color = system_color
self.contents.draw_text(32, 48, width, 32, $data_system.words.hp, 0)
self.contents.draw_text(32, 80, width, 32, $data_system.words.sp, 0)
self.contents.draw_text(150, 48, width, 32, "EXP", 0)
self.contents.draw_text(150, 80, width + 16, 32, "Fund", 0)
self.contents.draw_text(320, 16, width + 100, 32, "Attributes", 0)
self.contents.draw_text(320, 48, width, 32, $data_system.words.str, 0)
self.contents.draw_text(320, 80, width, 32, $data_system.words.dex, 0)
self.contents.draw_text(320, 112, width, 32, $data_system.words.agi, 0)
self.contents.draw_text(320, 144, width, 32, $data_system.words.int, 0)
self.contents.draw_text(450, 48, width + 32, 32, $data_system.words.pdef, 0)
self.contents.draw_text(450, 80, width + 32, 32, $data_system.words.mdef, 0)
self.contents.draw_text(320, 188, width + 100, 32, "Element", 0)
self.contents.draw_text(320, 224, width + 100, 32, "Fire", 0)
self.contents.draw_text(320, 256, width + 100, 32, "Thunder", 0)
self.contents.draw_text(320, 288, width + 100, 32, "Earth", 0)
self.contents.draw_text(320, 320, width + 100, 32, "Darkness", 0)
self.contents.draw_text(485, 224, width + 100, 32, "Ice", 0)
self.contents.draw_text(485, 256, width + 100, 32, "Water", 0)
self.contents.draw_text(485, 288, width + 100, 32, "Wind", 0)
self.contents.draw_text(485, 320, width + 100, 32, "Light", 0)
self.contents.font.color = normal_color
self.contents.draw_text(16, 16, 260, 32, @enemy.name.upcase, 1)
self.contents.draw_text(80, 48, width, 32, @enemy.maxhp.to_s, 0)
self.contents.draw_text(80, 80, width, 32, @enemy.maxsp.to_s, 0)
self.contents.draw_text(220, 48, width, 32, @enemy.exp.to_s, 0)
self.contents.draw_text(380, 48, width, 32, @enemy.str.to_s, 0)
self.contents.draw_text(380, 80, width, 32, @enemy.dex.to_s, 0)
self.contents.draw_text(380, 112, width, 32, @enemy.agi.to_s, 0)
self.contents.draw_text(380, 144, width, 32, @enemy.int.to_s, 0)
self.contents.draw_text(520, 48, width, 32, @enemy.pdef.to_s, 0)
self.contents.draw_text(520, 80, width, 32, @enemy.mdef.to_s, 0)
self.contents.draw_text(220, 80, width, 32, gold, 0)
for i in 1...9
case @enemy.element_ranks[i]
when 1
besar = "Double"
color = text_color(2)
when 2
besar = "Weak"
color = text_color(6)
when 3
besar = "Normal"
color = text_color(7)
when 4
besar = "Half"
color = text_color(3)
when 5
besar = "Immune"
color = text_color(4)
when 6
besar = "Absorb"
color = text_color(1)
end
case i
when 1
fire = besar
fire_color = color
when 2
ice = besar
ice_color = color
when 3
thunder = besar
thunder_color = color
when 4
water = besar
water_color = color
when 5
earth = besar
earth_color = color
when 6
wind = besar
wind_color = color
when 7
light = besar
light_color = color
when 8
darkness = besar
darkness_color = color
end
end
self.contents.font.color = fire_color
self.contents.draw_text(410, 224, width + 100, 32, fire, 0)
self.contents.font.color = thunder_color
self.contents.draw_text(410, 256, width + 100, 32, thunder, 0)
self.contents.font.color = earth_color
self.contents.draw_text(410, 288, width + 100, 32, earth, 0)
self.contents.font.color = darkness_color
self.contents.draw_text(410, 320, width + 100, 32, darkness, 0)
self.contents.font.color = ice_color
self.contents.draw_text(545, 224, width + 100, 32, ice, 0)
self.contents.font.color = water_color
self.contents.draw_text(545, 256, width + 100, 32, water, 0)
self.contents.font.color = wind_color
self.contents.draw_text(545, 288, width + 100, 32, wind, 0)
self.contents.font.color = light_color
self.contents.draw_text(545, 320, width + 100, 32, light, 0)
end
end
class Scene_Bestiary
def main
make_window
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
dispose_window
end
def make_window
@enemy_window = Window_Bestiary.new
@status_window = Window_EnemyStatus.new
@status_window.visible = false
@status_window.active = false
@help_window = Window_Help.new
@enemy_window.help_window = @help_window
end
def dispose_window
@help_window.dispose
@enemy_window.dispose
@status_window.dispose
end
def update
@help_window.update
@enemy_window.update
@status_window.update
# If item window is active: call update_item
if @enemy_window.active
update_enemy
return
end
# If target window is active: call update_target
if @status_window.active
update_status
return
end
end
def update_enemy
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to menu screen
$scene = Scene_Item.new
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# If equipment is fixed
enemy = @enemy_window.enemy
if $pernah_ketemu.include?(enemy.id)
$game_system.se_play($data_system.decision_se)
@enemy_window.active = false
@enemy_window.visible = false
@status_window.set(enemy)
@status_window.active = true
@status_window.visible = true
else
$game_system.se_play($data_system.buzzer_se)
end
return
end
def update_status
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@enemy_window.active = true
@enemy_window.visible = true
@status_window.active = false
@status_window.visible = false
return
end
if Input.trigger?(Input::C)
$game_system.se_play($data_system.cancel_se)
@enemy_window.active = true
@enemy_window.visible = true
@status_window.active = false
@status_window.visible = false
return
end
end
end
end
|
0 komentar:
Posting Komentar