Code:
#==============================================================================
# ** DerVV's Quickie Enemy Info Chance
#------------------------------------------------------------------------------
# by DerVVulfman
# version 1.0
# 06-28-2015
# RGSS / RMXP
#==============================================================================
# This lets you begin your own custom bestiary scan book where enemies start
# with nothing known about them except their picture/battler (not even their
# name)... and you have to keep battling them to fill their stats.
#
# NOTES: This is only a rudimentary system, and assumes a number of things...
# 1) That the party has no familiarity with any enemy (even by name)
# 2) That all stats have an equal chance to be determined
# 3) That fighting multiple of 1 type (ala party of ghosts) increases
# the chance to learn each stat.
# 4) That all data displayed is text data (otherwise no '???' shown )
#
#------------------------------------------------------------------------------
# The key sections in this script are as follows:
#
# EnemyChance This module is the configuration module, setting the
# 'chance to learn' for each enemy. I recommend expanding.
#
# Game_System As values in this class are saved in all save games,
# I created the enemy stats here. All enemy stats will
# then be saved with each save-game.
#
# Game_EnemyData The initialize method creates the empty values for each
# enemy while the refresh method assumes the player had
# fought it and is attempting to learn a facet or two. It
# is the refresh method that works the wonders of increasing
# the knowledge about each enemy. >> Here, I would make
# conditions like having 1 or 2 stats learned... not all
# having equal chances, or giving each stat a different
# percentage or something <<
#
# Game_EnemySet The initialize method creates the entire collection of
# enemy data for saving, the [] array method returns the
# data when asked (with $game_system.enemy_set[idx]), and
# the refresh method refreshes and updates an enemy called
# by its index value in the database.
#
# Scene_Battle The start_phase5 method is run when you won the battle,
# so this is where it goes through all defeated enemies
# and refreshes each. >> If you have multiples of one type
# of enemy in a troop, but only want ONE refresh, you will
# need to do work here. <<
#
# Scene_EnemyData This is a VERY rudimentary class that just shows a record
# for an individual enemy.... Only intended to show it work.
# $scene = Scene_EnemyData.new(index)
#
#
#
#==============================================================================
#==============================================================================
# ** EnemyChance
#------------------------------------------------------------------------------
# This module holds the percentage chance for each enemy that something
# may be learned after each kill.
#==============================================================================
module EnemyChance
CHANCE = {} # <--- Do not touch this value
# CHANCE PER ID [enemy_idx] % Chance
# ========================= ========
#
CHANCE[1] = 8 # Ghosts get 80%
CHANCE[4] = 3 # Hellhounds get 30%
end
#==============================================================================
# ** Game_System
#------------------------------------------------------------------------------
# This class handles data surrounding the system. Backround music, etc.
# is managed here as well. Refer to "$game_system" for the instance of
# this class.
#==============================================================================
class Game_System
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :enemy_set
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias game_system_enemy_chance_initialize initialize
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
# Perform the original call
game_system_enemy_chance_initialize
# Create a new enemyset object, saved with game_system
@enemy_set = Game_EnemySet.new
end
end
#==============================================================================
# ** Game_EnemyData
#------------------------------------------------------------------------------
# This class handles the individual enemy statistics for each enemy.
#==============================================================================
class Game_EnemyData
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(idx)
# DEFINE VISIBLE DATA
#
@enemy_idx = idx
enemy = $data_enemies[@enemy_idx]
@battler_name = enemy.battler_name
@battler_hue = enemy.battler_hue
# DEFINE HOLDERS
@name = "????"
@hp = "???"
@sp = "???"
@atk = "???"
@mdef = "???"
@pdef = "???"
@str = "???"
@agi = "???"
@dex = "???"
@int = "???"
@eva = "???"
@exp = "???"
@gold = "???"
@item_id = "???"
@weapon_id = "???"
@armor_id = "???"
@t_prob = "???"
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
# Get enemy ID
idx = @enemy_idx
# Get valid Chance
mchance = 5
mchance = EnemyChance::CHANCE[idx] unless EnemyChance::CHANCE[idx].nil?
# Set var... To actual data.... Per each roll made
@name = $data_enemies[idx].name if mchance > rand(10)
@hp = $data_enemies[idx].maxhp.to_s if mchance > rand(10)
@sp = $data_enemies[idx].maxsp.to_s if mchance > rand(10)
@atk = $data_enemies[idx].atk.to_s if mchance > rand(10)
@mdef = $data_enemies[idx].mdef.to_s if mchance > rand(10)
@pdef = $data_enemies[idx].pdef.to_s if mchance > rand(10)
@str = $data_enemies[idx].str.to_s if mchance > rand(10)
@agi = $data_enemies[idx].agi.to_s if mchance > rand(10)
@dex = $data_enemies[idx].dex.to_s if mchance > rand(10)
@int = $data_enemies[idx].int.to_s if mchance > rand(10)
@eva = $data_enemies[idx].eva.to_s if mchance > rand(10)
@exp = $data_enemies[idx].exp.to_s if mchance > rand(10)
@gold = $data_enemies[idx].gold.to_s if mchance > rand(10)
@item_id = $data_enemies[idx].item_id.to_s if mchance > rand(10)
@weapon_id = $data_enemies[idx].weapon_id.to_s if mchance > rand(10)
@armor_id = $data_enemies[idx].armor_id.to_s if mchance > rand(10)
@t_prob = $data_enemies[idx].treasure_prob.to_s if mchance > rand(10)
end
end
#==============================================================================
# ** Game_EnemySet
#------------------------------------------------------------------------------
# This class is the enemy data collective created by the Game_System class.
# Refer to $game_system.enemy_set for all instances of this class.
#==============================================================================
class Game_EnemySet
#--------------------------------------------------------------------------
# * Public Instance Values
#--------------------------------------------------------------------------
attr_accessor :data
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
# Create enemy data array
@data = []
@data.push(nil)
for i in 1..$data_enemies.size-1
@data.push(Game_EnemyData.new(i))
end
end
#--------------------------------------------------------------------------
# * Get Enemy Data
# enemy_idx : enemy index
#--------------------------------------------------------------------------
def [](enemy_idx)
return @data[enemy_idx]
end
#--------------------------------------------------------------------------
# * Refresh
# enemy_idx : enemy index
#--------------------------------------------------------------------------
def refresh(enemy_idx)
@data[enemy_idx].refresh
end
end
#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
# This class performs battle screen processing.
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias scene_battle_enemy_chance_start_phase5 start_phase5
#--------------------------------------------------------------------------
# * Start After Battle Phase
#--------------------------------------------------------------------------
def start_phase5
# Cycle through all enemies
for enemy in $game_troop.enemies
# If enemy is not hidden
unless enemy.hidden
# Add Enemy Encounter Information
$game_system.enemy_set.refresh(enemy.id)
end
end
# Perform the original call
scene_battle_enemy_chance_start_phase5
end
end
#==============================================================================
# ** Scene_EnemyData
#------------------------------------------------------------------------------
# This class performs screen processing for the Demon Picture Book
#==============================================================================
class Scene_EnemyData
#--------------------------------------------------------------------------
# * Object Initialization
# enemy_idx : index of the enemy in the database
#--------------------------------------------------------------------------
def initialize(enemy_idx=1)
@enemy_idx = enemy_idx
end
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Just show the enemy stats for the called enemy
p $game_system.enemy_set[@enemy_idx]
# And exit back to the map
$scene = Scene_Map.new
end
end