Class: Object

Inherits:
BasicObject
Defined in:
scripts/00002 state.rb,
scripts/01000 Util/00300 Random.rb,
scripts/00700 Ajout_PSDK/01300 PSDK_Def.rb,
scripts/00700 Ajout_PSDK/00001 Graphics Debug.rb,
scripts/00000 Dependencies/00300 Patch_Ruby/00202 Object_Module_void.rb,
scripts/00000 Dependencies/00300 Patch_Ruby/00201 Object_validate_param.rb

Constant Summary collapse

EMPTY_OPTIONAL =

Array representing an empty optional key hash

[].freeze
VALIDATE_PARAM_ERROR =

Default error message

'Parameter %<param_name>s sent to %<method_name>s is incorrect : %<reason>s'
EXC_MSG =

Exception message

'Invalid param value passed to %s#%s, see previous errors to know what are the invalid params'

Instance Method Summary collapse

Instance Method Details

#_clean_name_utf8(arr) ⇒ arr

Clean an array containing object responding to #name (force utf-8)

Parameters:

  • arr (Array<#name>)

Returns:

  • (arr)

#bchance?(rate, logic = nil) ⇒ Boolean

Attempt to get for the battles

Parameters:

  • rate (Float)

    number between 0 & 1 telling how much chance we have

  • logic (Battle::Logic) (defaults to: nil)

Returns:

  • (Boolean)

#ext_text(file_id, text_id) ⇒ String

Get a text front the external text database

Parameters:

  • file_id (Integer)

    ID of the text file

  • text_id (Integer)

    ID of the text in the file

Returns:

#help

Method that shows the help

#parse_text(file_id, text_id, additionnal_var = nil) ⇒ String

Parse a text from the text database with specific informations

Parameters:

  • file_id (Integer)

    ID of the text file

  • text_id (Integer)

    ID of the text in the file

  • additionnal_var (nil, Hash{String => String}) (defaults to: nil)

    additional remplacements in the text

Returns:

  • (String)

    the text parsed and ready to be displayed

#parse_text_with_2pokemon(file_id, text_id, pokemon1, pokemon2, additionnal_var = nil) ⇒ String

Parse a text from the text database with 2 pokemon & specific information

Parameters:

  • file_id (Integer)

    ID of the text file

  • text_id (Integer)

    ID of the text in the file

  • pokemon1 (PFM::Pokemon)

    pokemon we're talking about

  • pokemon2 (PFM::Pokemon)

    pokemon who originated the “problem” (eg. bind)

  • additionnal_var (nil, Hash{String => String}) (defaults to: nil)

    additional remplacements in the text

Returns:

  • (String)

    the text parsed and ready to be displayed

#parse_text_with_pokemon(file_id, text_id, pokemon, additionnal_var = nil) ⇒ String

Parse a text from the text database with specific informations and a pokemon

Parameters:

  • file_id (Integer)

    ID of the text file

  • text_id (Integer)

    ID of the text in the file

  • pokemon (PFM::Pokemon)

    pokemon that will introduce an offset on text_id (its name is also used)

  • additionnal_var (nil, Hash{String => String}) (defaults to: nil)

    additional remplacements in the text

Returns:

  • (String)

    the text parsed and ready to be displayed

#text_file_get(file_id) ⇒ Array<String>

Get a list of text from the text database

Parameters:

  • file_id (Integer)

    ID of the text file

Returns:

  • (Array<String>)

    the list of text contained in the file.

#text_get(file_id, text_id) ⇒ String

Get a text front the text database

Parameters:

  • file_id (Integer)

    ID of the text file

  • text_id (Integer)

    ID of the text in the file

Returns:

#validate_param(method_name, *param_names, param_values)

Note:

To use a custom message, define a validate_param_message

Function that validate the input paramters

Examples:

Param with a static type

validate_param(:meth, :param, param => Type)

Param with various allowed types

validate_param(:meth, :param, param => [Type1, Type2])

Param using a validation method

validate_param(:meth, :param, param => :validation_method)

Param using a complex structure (Array of String)

validate_param(:meth, :param, param => { Array => String })

Param using a complex structure (Array of Symbol, Integer, String, repetetive)

validate_param(:meth, :param, param => { Array => [Symbol, Integer, String], :cyclic => true, min: 3, max: 9})

Param using a complex structure (Hash)

validate_param(:meth, :param, param => { Hash => { key1: Type, key2: Type2, key3: [String, Symbol] },
:optional => [:key2] })

Parameters:

  • method_name (Symbol)

    name of the method which its param are being validated

  • param_names (Array<Symbol>)

    list of the names of the params

  • param_values (Hash)

    hash associating a param value to the expected type (description)

Raises:

  • (ArgumentError)

#void(*args)

Function that does nothing and return nil

Examples:

alias function_to_disable void

#void0(*args)

Function that does nothing and return 0

Examples:

alias function_to_disable void0

#void_array(*args)

Function that does nothing and return []

Examples:

alias function_to_disable void_array

#void_false(*args)

Function that does nothing and return false

Examples:

alias function_to_disable void_false

#void_string(*args)

Function that does nothing and return “”

Examples:

alias function_to_disable void_array

#void_true(*args)

Function that does nothing and return true

Examples:

alias function_to_disable void_true