Class: Battle::Logic::AbilityChangeHandler

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

Overview

Handler responsive of answering properly ability changes requests

Constant Summary collapse

CANT_OVERWRITE_ABILITIES =

Lists of abilities that cannot be lost

%i[as_one battle_bond comatose commander disguise gulp_missile hadron_engine hunger_switch ice_face imposter multitype orichalcum_pulse power_construct protosynthesis quark_drive rks_system schooling shields_down stance_change zen_mode zero_to_hero]
RECEIVER_CANT_COPY_ABILITIES =

Lists of abilities that cannot be gained

%i[as_one battle_bond comatose commander disguise flower_gift forecast gulp_missile hadron_engine hunger_switch ice_face illusion imposter multitype neutralizing_gas orichalcum_pulse poison_puppeteer power_construct power_of_alchemy prokosynthesis protosynthesis quark_drive receiver rks_system schooling shields_down stance_change trace wonder_guard zen_mode zero_to_hero]
SKILL_BLOCKING_ABILITIES =

Lists of abilities that make these moves fail

{entrainment: %i[truant], simple_beam: %i[simple truant], worry_seed: %i[insomnia truant]}

Instance Attribute Summary

Attributes inherited from ChangeHandlerBase

#logic, #pre_checked_effects, #scene

Instance Method Summary collapse

Methods inherited from ChangeHandlerBase

#initialize, #pass_change, #prevent_change, #process_reason, #reset_reason

Constructor Details

This class inherits a constructor from Battle::Logic::ChangeHandlerBase

Instance Method Details

#ability_changed?(battler) ⇒ Boolean

Checks if the battler's current ability differs from its original ability before the battle

Parameters:

Returns:

  • (Boolean)


1577
1578
# File 'docs/5_Battle_04_Logic.rb', line 1577

def ability_changed?(battler)
end

#apply_ability_change(target, ability_db_symbol, launcher, skill = nil, &message)

Applies the ability change

Parameters:

  • target (PFM::PokemonBattler) —

    Target of ability changing

  • ability_db_symbol (Symbol) —

    db_symbol of the ability to give

  • launcher (PFM::PokemonBattler) —

    Potentiel launcher of ability changing

  • skill (Battle::Move, nil) (defaults to: nil) —

    Potential move used

  • message (Proc, nil) —

    Optional message proc for display after ability change



1566
1567
# File 'docs/5_Battle_04_Logic.rb', line 1566

def apply_ability_change(target, ability_db_symbol, launcher, skill = nil, &message)
end

#apply_ability_swap(user, target, skill = nil)

Applies the ability swap

Parameters:



1572
1573
# File 'docs/5_Battle_04_Logic.rb', line 1572

def apply_ability_swap(user, target, skill = nil)
end

#can_change_ability?(target, launcher = nil, skill = nil) ⇒ Boolean

Function that tell if this is possible to change the ability of a Pokemon

Parameters:

Returns:

  • (Boolean)


1558
1559
# File 'docs/5_Battle_04_Logic.rb', line 1558

def can_change_ability?(target, launcher = nil, skill = nil)
end

#change_ability(target, ability_db_symbol, launcher = nil, skill = nil)

Function that change the ability of a Pokemon

Parameters:

  • target (PFM::PokemonBattler) —

    Target of ability changing

  • ability_db_symbol (Symbol) —

    db_symbol of the ability to give

  • launcher (PFM::PokemonBattler, nil) (defaults to: nil) —

    Potentiel launcher of ability changing

  • skill (Battle::Move, nil) (defaults to: nil) —

    Potential move used



1545
1546
# File 'docs/5_Battle_04_Logic.rb', line 1545

def change_ability(target, ability_db_symbol, launcher = nil, skill = nil)
end

#disable_ability(target, origin, launcher = nil, skill = nil)

Function that disable the ability of a Pokemon

Parameters:

  • target (PFM::PokemonBattler) —

    Target of ability changing

  • origin (Symbol) —

    Origin of the ability change (e.g. :gastro_acid)

  • launcher (PFM::PokemonBattler, nil) (defaults to: nil) —

    Potentiel launcher of ability changing

  • skill (Battle::Move, nil) (defaults to: nil) —

    Potential move used



1552
1553
# File 'docs/5_Battle_04_Logic.rb', line 1552

def disable_ability(target, origin, launcher = nil, skill = nil)
end