Class: Battle::Logic::BattleInfo

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

Overview

Class describing the informations about the battle

Constant Summary collapse

MONEY_ITEMS =

List of item decupling money

%i[amulet_coin luck_incense]
AI_LEVELS_BASE_MONEY =

List of base money giving AI levels (if strictly below the value)

[16, 20, 36, 48, 80, 100, 200, Float::INFINITY]
BACKGROUND_NAMES =

Name of the background according to their processed zone_type

['back_building', 'back_grass', 'back_tall_grass', 'back_taller_grass', 'back_cave', 'back_mount', 'back_sand', 'back_pond', 'back_sea', 'back_under_water', 'back_ice', 'back_snow']
TIMED_BACKGROUND_SUFFIXES =

List of of suffix for the timed background. Order is morning, day, sunset, night.

Returns:

[['morning', 'day'], ['day'], ['sunset', 'night'], ['night']]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash = {}) ⇒ BattleInfo

Create a new Battle Info

Parameters:

  • hash (Hash) (defaults to: {}) —

    basic info about the battle



545
546
# File 'docs/5_Battle_04_Logic.rb', line 545

def initialize(hash = {})
end

Instance Attribute Details

#additional_money ⇒ Integer

Get the additionnal money

Returns:

  • (Integer)


536
537
538
# File 'docs/5_Battle_04_Logic.rb', line 536

def additional_money
  @additional_money
end

#ai_levels ⇒ Array<Array<Integer>>

Returns:

  • (Array<Array<Integer>>)


507
508
509
# File 'docs/5_Battle_04_Logic.rb', line 507

def ai_levels
  @ai_levels
end

#background_name ⇒ String

Get the background name

Returns:



679
680
681
# File 'docs/5_Battle_04_Logic.rb', line 679

def background_name
  @background_name
end

#bags ⇒ Array<Array<PFM::Bag>>

Returns List of the bags of the battlers according to the bank.

Returns:

  • (Array<Array<PFM::Bag>>) —

    List of the bags of the battlers according to the bank



503
504
505
# File 'docs/5_Battle_04_Logic.rb', line 503

def bags
  @bags
end

#base_moneys ⇒ Array<Array<Integer>>

Returns List of the base money of the battlers according to the bank.

Returns:

  • (Array<Array<Integer>>) —

    List of the base money of the battlers according to the bank



509
510
511
# File 'docs/5_Battle_04_Logic.rb', line 509

def base_moneys
  @base_moneys
end

#battle_id ⇒ Integer

Returns ID of the battle (for event loading).

Returns:

  • (Integer) —

    ID of the battle (for event loading)



521
522
523
# File 'docs/5_Battle_04_Logic.rb', line 521

def battle_id
  @battle_id
end

#battlers ⇒ Array<Array<String>>

Returns List of the battler (image) name of the battlers according to the bank.

Returns:

  • (Array<Array<String>>) —

    List of the battler (image) name of the battlers according to the bank



501
502
503
# File 'docs/5_Battle_04_Logic.rb', line 501

def battlers
  @battlers
end

#caught_pokemon ⇒ PFM::PokemonBattler

Get the caught Pokemon

Returns:



530
531
532
# File 'docs/5_Battle_04_Logic.rb', line 530

def caught_pokemon
  @caught_pokemon
end

#classes ⇒ Array<Array<String>>

Returns List of the classes of the battlers according to the bank & their position.

Returns:

  • (Array<Array<String>>) —

    List of the classes of the battlers according to the bank & their position



499
500
501
# File 'docs/5_Battle_04_Logic.rb', line 499

def classes
  @classes
end

#defeat_texts ⇒ Array<String>

Get the defeat text of the enemy trainers

Returns:



542
543
544
# File 'docs/5_Battle_04_Logic.rb', line 542

def defeat_texts
  @defeat_texts
end

#fishing ⇒ Boolean

Tell if the battle follows a fishing attempt

Returns:

  • (Boolean)


527
528
529
# File 'docs/5_Battle_04_Logic.rb', line 527

def fishing
  @fishing
end

#flee_attempt_count ⇒ Integer

Get the number of time the player tried to flee

Returns:

  • (Integer)


524
525
526
# File 'docs/5_Battle_04_Logic.rb', line 524

def flee_attempt_count
  @flee_attempt_count
end

#max_level ⇒ Integer?

Returns Maximum level allowed for the battle.

Returns:

  • (Integer, nil) —

    Maximum level allowed for the battle



511
512
513
# File 'docs/5_Battle_04_Logic.rb', line 511

def max_level
  @max_level
end

#names ⇒ Array<Array<String>>

Returns List of the name of the battlers according to the bank & their position.

Returns:

  • (Array<Array<String>>) —

    List of the name of the battlers according to the bank & their position



497
498
499
# File 'docs/5_Battle_04_Logic.rb', line 497

def names
  @names
end

#parties ⇒ Array<Array<Array<PFM::Pokemon>>>

Returns List of the "Party" of the battlers according to the bank & their position.

Returns:

  • (Array<Array<Array<PFM::Pokemon>>>) —

    List of the "Party" of the battlers according to the bank & their position



505
506
507
# File 'docs/5_Battle_04_Logic.rb', line 505

def parties
  @parties
end

#trainer_is_couple ⇒ Boolean

Returns if the trainer battle is a "couple" battle.

Returns:

  • (Boolean) —

    if the trainer battle is a "couple" battle



517
518
519
# File 'docs/5_Battle_04_Logic.rb', line 517

def trainer_is_couple
  @trainer_is_couple
end

#trainer_is_triplet ⇒ Boolean

Returns if the trainer battle is a "couple" battle.

Returns:

  • (Boolean) —

    if the trainer battle is a "couple" battle



519
520
521
# File 'docs/5_Battle_04_Logic.rb', line 519

def trainer_is_triplet
  @trainer_is_triplet
end

#victory_bgm ⇒ RPG::AudioFile, String

Get the victory BGM (victory of the enemies)

Returns:



533
534
535
# File 'docs/5_Battle_04_Logic.rb', line 533

def victory_bgm
  @victory_bgm
end

#victory_texts ⇒ Array<String>

Get the victory texts of the enemy trainers

Returns:



539
540
541
# File 'docs/5_Battle_04_Logic.rb', line 539

def victory_texts
  @victory_texts
end

#vs_type ⇒ Integer

Returns Number of Pokemon fighting at the same time.

Returns:

  • (Integer) —

    Number of Pokemon fighting at the same time



513
514
515
# File 'docs/5_Battle_04_Logic.rb', line 513

def vs_type
  @vs_type
end

#wild_battle_reason ⇒ Integer

Returns Reason of the wild battle.

Returns:

  • (Integer) —

    Reason of the wild battle



515
516
517
# File 'docs/5_Battle_04_Logic.rb', line 515

def wild_battle_reason
  @wild_battle_reason
end

Class Method Details

.add_trainer(battle_info, bank, id_trainer)

Add a trainer to the battle_info object

Parameters:

  • battle_info (BattleInfo)
  • bank (Integer) —

    bank of the trainer

  • id_trainer (Integer) —

    ID of the trainer in the database



565
566
# File 'docs/5_Battle_04_Logic.rb', line 565

def add_trainer(battle_info, bank, id_trainer)
end

.ai_level(base_money) ⇒ Integer

Guess the AI level based on the base money (or a variable)

Parameters:

  • base_money (Integer)

Returns:

  • (Integer)


570
571
# File 'docs/5_Battle_04_Logic.rb', line 570

def ai_level(base_money)
end

.change_battle_bgms(battle_info, trainer)

Give the new BGMs to the Battle_Info if the current BGMs are the guessed one This means the first trainer added will give its info to the Battle_Info

Parameters:



576
577
# File 'docs/5_Battle_04_Logic.rb', line 576

def change_battle_bgms(battle_info, trainer)
end

.from_old_psdk_settings(id_trainer1, id_trainer2 = 0, id_friend = 0, id_trainer3 = 0, id_friend2 = 0) ⇒ Battle::Logic::BattleInfo

Configure a PSDK battle from old settings

Parameters:

  • id_trainer1 (Integer)
  • id_trainer2 (Integer) (defaults to: 0)
  • id_trainer3 (Integer) (defaults to: 0)
  • id_friend (Integer) (defaults to: 0)
  • id_friend2 (Integer) (defaults to: 0)

Returns:



559
560
# File 'docs/5_Battle_04_Logic.rb', line 559

def from_old_psdk_settings(id_trainer1, id_trainer2 = 0, id_friend = 0, id_trainer3 = 0, id_friend2 = 0)
end

Instance Method Details

#add_party(bank, party, name = nil, klass = nil, battler = nil, bag = nil, base_money = nil, ai_level = nil, victory_text = nil, defeat_text = nil)

Add a party to a bank

Parameters:

  • bank (Integer) —

    bank where the party should be defined

  • party (Array<PFM::Pokemon>) —

    Pokemon of the battler

  • name (String, nil) (defaults to: nil) —

    name of the battler (don't set it if Wild Battle)

  • klass (String, nil) (defaults to: nil) —

    name of the battler (don't set it if Wild Battle)

  • battler (String, nil) (defaults to: nil) —

    name of the battler image (don't set it if Wild Battle)

  • bag (String, nil) (defaults to: nil) —

    bag used by the party

  • base_money (Integer) (defaults to: nil)
  • ai_level (Integer) (defaults to: nil)


596
597
# File 'docs/5_Battle_04_Logic.rb', line 596

def add_party(bank, party, name = nil, klass = nil, battler = nil, bag = nil, base_money = nil, ai_level = nil, victory_text = nil, defeat_text = nil)
end

#bag(battler) ⇒ PFM::Bag

Get the bag of a battler

Parameters:

Returns:



616
617
# File 'docs/5_Battle_04_Logic.rb', line 616

def bag(battler)
end

#base_money(battler) ⇒ Integer

Get the base money of a battler

Parameters:

Returns:

  • (Integer)


626
627
# File 'docs/5_Battle_04_Logic.rb', line 626

def base_money(battler)
end

#battle_bgm ⇒ RPG::AudioFile

Get the battle bgm music

Returns:



651
652
# File 'docs/5_Battle_04_Logic.rb', line 651

def battle_bgm
end

#battle_bgm=(bgm)

Set the battle_bgm

Parameters:

  • bgm (RPG::AudioFile, String, Array) —

    String if it's the filename only, Array if volume/pitch/fade are forwarded



655
656
# File 'docs/5_Battle_04_Logic.rb', line 655

def battle_bgm=(bgm)
end

#defeat_bgm ⇒ RPG::AudioFile

Get the defeat bgm music

Returns:

  • (RPG::AudioFile) —

    string if it's the filename only, Array if volume/pitch/fade are forwarded



639
640
# File 'docs/5_Battle_04_Logic.rb', line 639

def defeat_bgm
end

#defeat_bgm=(bgm)

Set the defeat_bgm

Parameters:

  • bgm (RPG::AudioFile, String, Array) —

    String if it's the filename only, Array if volume/pitch/fade are forwarded



643
644
# File 'docs/5_Battle_04_Logic.rb', line 643

def defeat_bgm=(bgm)
end

#determine_battler(resources, bank) ⇒ String

Determine the battler that should be sent back

Parameters:

Returns:



601
602
# File 'docs/5_Battle_04_Logic.rb', line 601

def determine_battler(resources, bank)
end

#disallow_exp? ⇒ Boolean

Tell if the battle allow exp

Returns:

  • (Boolean)


549
550
# File 'docs/5_Battle_04_Logic.rb', line 549

def disallow_exp?
end

#find_background_name_to_display(prefix = nil, &block) {|background_name| ... } ⇒ String

Get the correct background name to display

Parameters:

  • prefix (String, nil) (defaults to: nil) —

    prefix to add to all suggested background

  • block (Proc) —

    proc responsive of telling weither the filename param exists and can be used

Yield Parameters:

Yield Returns:

  • (Boolean)

Returns:

  • (String) —

    found background name



686
687
# File 'docs/5_Battle_04_Logic.rb', line 686

def find_background_name_to_display(prefix = nil, &block)
end

#guess_battle_bgm ⇒ RPG::AudioFile

Function that guess the battle bgm

Returns:



659
660
# File 'docs/5_Battle_04_Logic.rb', line 659

def guess_battle_bgm
end

#guess_defeat_bgm ⇒ RPG::AudioFile

Function that guess the defeat bgm (defeat of the enemy trainer/wild Pokemon)

Returns:



663
664
# File 'docs/5_Battle_04_Logic.rb', line 663

def guess_defeat_bgm
end

#money_item_multiplier?(logic) ⇒ Boolean

Tell if the money item multiplier is active

Parameters:

Returns:

  • (Boolean)


635
636
# File 'docs/5_Battle_04_Logic.rb', line 635

def money_item_multiplier?(logic)
end

#party(battler) ⇒ Array<PFM::Pokemon>

Get the party of a battler

Parameters:

Returns:



621
622
# File 'docs/5_Battle_04_Logic.rb', line 621

def party(battler)
end

#player_basic_info ⇒ Array

Return the basic info about the player

Returns:

  • (Array)


585
586
# File 'docs/5_Battle_04_Logic.rb', line 585

def player_basic_info
end

#total_money(logic)

Get the total money

Parameters:



630
631
# File 'docs/5_Battle_04_Logic.rb', line 630

def total_money(logic)
end

#trainer_battle? ⇒ Boolean

Tell if the battle is a trainer battle

Returns:

  • (Boolean)


581
582
# File 'docs/5_Battle_04_Logic.rb', line 581

def trainer_battle?
end

#trainer_class(battler) ⇒ String

Get the trainer class of a battler

Parameters:

Returns:



611
612
# File 'docs/5_Battle_04_Logic.rb', line 611

def trainer_class(battler)
end

#trainer_name(battler) ⇒ String

Get the trainer name of a battler

Parameters:

Returns:



606
607
# File 'docs/5_Battle_04_Logic.rb', line 606

def trainer_name(battler)
end