Class: Battle::AI::Base

Inherits:
Object show all
Defined in:
docs/5_Battle_30_AI.rb

Overview

Base class of AI, it holds the most important data

Constant Summary collapse

BOOSTING_ITEMS =

List of boosting items

%i[x_attack x_sp_atk x_speed x_defense x_sp_def dire_hit guard_spec]
HEALING_ITEMS =

List of healing items

%i[full_restore hyper_potion energy_root moomoo_milk lemonade super_potion energy_powder soda_pop fresh_water potion berry_juice sweet_heart sitrus_berry oran_berry]
POISON_HEAL_ITEMS =

List of item that heal from poison

%i[antidote full_heal heal_powder lava_cookie old_gateau pecha_berry lum_berry casteliacone lumiose_galette shalour_sable]
BURN_HEAL_ITEMS =

List of item that heals from burn state

%i[burn_heal full_heal heal_powder lava_cookie old_gateau rawst_berry lum_berry casteliacone lumiose_galette shalour_sable]
PARALYZE_HEAL_ITEMS =

List of item that heals from paralysis

%i[paralyze_heal full_heal heal_powder lava_cookie old_gateau cheri_berry lum_berry casteliacone lumiose_galette shalour_sable]
FREEZE_HEAL_ITEMS =

List of item that heals from frozen state

%i[ice_heal full_heal heal_powder lava_cookie old_gateau aspear_berry lum_berry casteliacone lumiose_galette shalour_sable]
WAKE_UP_ITEMS =

List of item that wake the Pokemon up

%i[awakening full_heal heal_powder lava_cookie old_gateau blue_flute chesto_berry lum_berry casteliacone lumiose_galette shalour_sable]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scene, bank, party_id, level) ⇒ Base

Create a new AI instance

Parameters:

  • scene (Battle::Scene) —

    scene that hold the logic object

  • bank (Integer) —

    bank where the AI acts

  • party_id (Integer) —

    ID of the party the AI look for Pokemon info

  • level (Integer) —

    level of tha AI



161
162
# File 'docs/5_Battle_30_AI.rb', line 161

def initialize(scene, bank, party_id, level)
end

Instance Attribute Details

#bank ⇒ Integer (readonly)

Get the bank the AI controls

Returns:

  • (Integer)


151
152
153
# File 'docs/5_Battle_30_AI.rb', line 151

def bank
  @bank
end

#party_id ⇒ Integer (readonly)

Get the party the AI controls

Returns:

  • (Integer)


154
155
156
# File 'docs/5_Battle_30_AI.rb', line 154

def party_id
  @party_id
end

#scene ⇒ Battle::Scene (readonly)

Get the scene that initialized the AI

Returns:



148
149
150
# File 'docs/5_Battle_30_AI.rb', line 148

def scene
  @scene
end

Class Method Details

.register(level, klass)

Register a new AI

Parameters:

  • level (Integer) —

    level of the AI

  • klass (Class<Base>)


171
172
# File 'docs/5_Battle_30_AI.rb', line 171

def register(level, klass)
end

.registered(level) ⇒ Class<Battle::AI::Base>

Get a registered AI

Parameters:

  • level (Integer) —

    level of the AI

Returns:



176
177
# File 'docs/5_Battle_30_AI.rb', line 176

def registered(level)
end

Instance Method Details

#controlled_pokemon ⇒ Array<PFM::PokemonBattler>

Get all the controlled Pokemon

Returns:



185
186
# File 'docs/5_Battle_30_AI.rb', line 185

def controlled_pokemon
end

#party ⇒ Array<PFM::PokemonBattler>

Get all Pokemon in the party of the AI

Returns:



181
182
# File 'docs/5_Battle_30_AI.rb', line 181

def party
end

#request_switch(who) ⇒ PFM::PokemonBattler?

Function returning pokemon to switch with on request

Parameters:

Returns:



279
280
# File 'docs/5_Battle_30_AI.rb', line 279

def request_switch(who)
end

#trigger ⇒ Array<Actions::Base>

Get the action the AI wants to do

Returns:



165
166
# File 'docs/5_Battle_30_AI.rb', line 165

def trigger
end