Class: Battle::Logic::AbilityChangeHandler

Inherits:
ChangeHandlerBase show all
Includes:
Hooks
Defined in:
docs/01600_Alpha_25_Battle_Engine_00200_Battle_Logic.rb

Overview

Handler responsive of answering properly ability changes requests

Constant Summary collapse

CANT_OVERWRITE_ABILITIES =

List of abilities that can’t be overwritten

%i[battle_bond comatose disguise multitype power_construct rks_system schooling shields_down stance_change zen_mode gulp_missile]
RECEIVER_CANT_COPY_ABILITIES =

List of abilities the receiver/power_of_alchemy ability can’t copy

%i[receiver power_of_alchemy trace forecast flower_gift multitype illusion wonder_guard zen_mode imposter stance_change power_construct schooling comatose shields_down disguise rks_system battle_bond gulp_missile]
SKILL_BLOCKING_ABILITIES =

These moves fail if the target has these abilities

{entrainment: %i[truant], role_play: %i[flower_gift forecast illusion imposter power_of_alchemy receiver trace wonder_guard], simple_beam: %i[simple truant], skill_swap: %i[illusion wonder_guard], worry_seed: %i[gulp_missile]}
ABILITY_BLOCKING_ABILITIES =

Case of a ability that fail

{mummy: %i[mummy], wandering_spirit: %i[wandering_spirit], trace: %i[flower_gift forecast illusion imposter multitype stance_change trace zen_mode receiver power_of_alchemy], receiver: RECEIVER_CANT_COPY_ABILITIES, power_of_alchemy: RECEIVER_CANT_COPY_ABILITIES}
USER_BLOCKING_ABILITIES =

Case of a move that fail if the launcher has this ability

{entrainment: %i[disguise forecast flower_gift illusion imposter power_construct power_of_alchemy receiver trace zen_mode], role_play: CANT_OVERWRITE_ABILITIES + %i[receiver power_of_alchemy]}

Instance Attribute Summary

Attributes inherited from ChangeHandlerBase

#logic, #pre_checked_effects, #scene

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Hooks

#exec_hooks, #force_return, included, register, remove, remove_without_name

Methods inherited from ChangeHandlerBase

#initialize, #prevent_change, #process_prevention_reason, #reset_prevention_reason

Constructor Details

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

Class Method Details

.register_ability_prevention_hook(reason) {|handler, target, ability_symbol, launcher, skill| ... }

Function that registers a ability_change_prevention hook

Parameters:

  • reason (String)

    reason of the ability_change_prevention registration

Yield Parameters:

Yield Returns:

  • (:prevent, nil)

    :prevent if the ability cannot be changed



1710
1711
# File 'docs/01600_Alpha_25_Battle_Engine_00200_Battle_Logic.rb', line 1710

def register_ability_prevention_hook(reason)
end

.register_post_ability_change_hook(reason) {|handler, target, ability_symbol, launcher, skill| ... }

Function that registers a post_ability_change hook

Parameters:

  • reason (String)

    reason of the ability_change_prevention registration

Yield Parameters:

Yield Returns:

  • (:prevent, nil)

    :prevent if the ability cannot be changed



1720
1721
# File 'docs/01600_Alpha_25_Battle_Engine_00200_Battle_Logic.rb', line 1720

def register_post_ability_change_hook(reason)
end

Instance Method Details

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

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

Parameters:

Returns:

  • (Boolean)


1699
1700
# File 'docs/01600_Alpha_25_Battle_Engine_00200_Battle_Logic.rb', line 1699

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

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

Function that change the ability of a Pokemon

Parameters:



1692
1693
# File 'docs/01600_Alpha_25_Battle_Engine_00200_Battle_Logic.rb', line 1692

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