Class: Battle::Logic::ItemChangeHandler

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

Overview

Handler responsive of answering properly item changes requests

Constant Summary collapse

PROTECTED_ITEMS =

List of item that cannot be knocked off

%i[exp_share lucky_egg amulet_coin oak_s_letter gram_1 gram_2 gram_3 prof_s_letter letter greet_mail favored_mail rsvp_mail thanks_mail inquiry_mail like_mail reply_mail bridge_mail_s bridge_mail_d bridge_mail_t bridge_mail_v bridge_mail_m]
PROTECTED_POKEMON_ITEMS =

TO DO : Add Z-Crystals to PROTECTED_ITEMS (7G) List of items that cannot be knocked off if the holder is a specific Pokemon

{giratina: %i[griseous_orb], arceus: %i[flame_plate splash_plate zap_plate meadow_plate icicle_plate fist_plate toxic_plate earth_plate sky_plate mind_plate insect_plate stone_plate spooky_plate draco_plate dread_plate iron_plate pixie_plate], genesect: %i[shock_drive burn_drive chill_drive douse_drive], silvally: %i[bug_memory dark_memory dragon_memory electry_memory fairy_memory fighting_memory fire_memory flying_memory ghost_memory grass_memory ground_memory ice_memory poison_memory psychic_memory rock_memory steel_memory water_memory], kyogre: %i[blue_orb], groudon: %i[red_orb], zacian: %i[rusted_sword], zamazenta: %i[rusted_shield], ogerpon: %i[wellspring_mask hearthflame_mask cornerstone_mask], venusaur: %i[venusaurite], charizard: %i[charizardite_x charizardite_y], blatoise: %i[blastoisinite], alakazam: %i[alakazite], gengar: %i[gengarite], kangaskhan: %i[kangaskhanite], pinsir: %i[pinsirite], gyarados: %i[gyaradosite], aerodactyl: %i[aerodactylite], mewtwo: %i[mewtwonite_x mewtwonite_y], ampharos: %i[ampharosite], scizor: %i[scizorite], heracross: %i[heracronite], houndoom: %i[houndoominite], tyranitar: %i[tyranitarite], blaziken: %i[blazikenite], gardevoir: %i[gardevoirite], mawile: %i[mawilite], aggron: %i[aggronite], medicham: %i[medichamite], manectric: %i[manectite], banette: %i[banettite], absol: %i[absolite], latias: %i[latiasite], latios: %i[latiosite], garchomp: %i[garchompite], lucario: %i[lucarionite], abomasnow: %i[abomasite], beedril: %i[beedrillite], pidgeot: %i[pidgeotite], slowbro: %i[slowbronite], steelix: %i[steelixite], sceptile: %i[sceptilite], swamper: %i[swampertite], sableye: %i[sablenite], sharpedo: %i[sharpedoite], camerupt: %i[cameruptite], altaria: %i[altarianite], glalie: %i[glalitite], salamence: %i[salamencite], metagross: %i[metagrossite], lopunny: %i[lopunnite]}

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

#can_give_item?(giver, target) ⇒ Boolean

Function that checks if the Pokemon can give its item to a target

Parameters:

Returns:

  • (Boolean)


889
890
# File 'docs/5_Battle_04_Logic.rb', line 889

def can_give_item?(giver, target)
end

#can_lose_item?(target, launcher = nil) ⇒ Boolean

Function that checks if the Pokemon can lose its item

Parameters:

Returns:

  • (Boolean)


883
884
# File 'docs/5_Battle_04_Logic.rb', line 883

def can_lose_item?(target, launcher = nil)
end

#change_item(db_symbol, overwrite, target, launcher = nil, skill = nil) ⇒ Boolean

Function that change the item held by a Pokemon

Parameters:

  • db_symbol (Symbol, :none) —

    Symbol ID of the item

  • overwrite (Boolean) —

    if the actual item held should be overwritten

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

    Potential launcher of a move

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

    Potential move used

Returns:

  • (Boolean) —

    if the operation was successful



861
862
# File 'docs/5_Battle_04_Logic.rb', line 861

def change_item(db_symbol, overwrite, target, launcher = nil, skill = nil)
end

#handle_post_change_events(db_symbol, overwrite, target, launcher, skill)

Function that checks for post item change events

Parameters:

  • db_symbol (Symbol, :none) —

    Symbol ID of the item

  • overwrite (Boolean) —

    if the actual item held should be overwritten

  • target (PFM::PokemonBattler)
  • launcher (PFM::PokemonBattler, nil) —

    Potential launcher of a move

  • skill (Battle::Move, nil) —

    Potential move used



877
878
# File 'docs/5_Battle_04_Logic.rb', line 877

def handle_post_change_events(db_symbol, overwrite, target, launcher, skill)
end

#handle_pre_change_events(db_symbol, overwrite, target, launcher, skill)

Function that checks for pre item change events

Parameters:

  • db_symbol (Symbol, :none) —

    Symbol ID of the item

  • overwrite (Boolean) —

    if the actual item held should be overwritten

  • target (PFM::PokemonBattler)
  • launcher (PFM::PokemonBattler, nil) —

    Potential launcher of a move

  • skill (Battle::Move, nil) —

    Potential move used



869
870
# File 'docs/5_Battle_04_Logic.rb', line 869

def handle_pre_change_events(db_symbol, overwrite, target, launcher, skill)
end