Class: Battle::Move::Pledge

Inherits:
Basic show all
Defined in:
scripts/01600 Alpha 25 Battle Engine/04150 Battle_Move/00001 Mechanics/00130 Pledge.rb

Overview

Class describing a Pledge move (moves combining for different effects)

Constant Summary collapse

PLEDGE_MOVES =

List the db_symbol for every Pledge moves

Returns:

  • (Array<Symbol>)
%i[water_pledge fire_pledge grass_pledge]
COMBINATION_LIST =

Return the combination for each effect triggered by Pledge combination

Returns:

  • (Hash { Symbol => Array<Symbol, Array<>> })

    Hash { Symbol => Array<Symbol, Array<>> }

{
  rainbow: %i[water_pledge fire_pledge],
  sea_of_fire: %i[fire_pledge grass_pledge],
  swamp: %i[grass_pledge water_pledge]
}

Constants inherited from Battle::Move

OneTarget, REGISTERED_MOVES, R_RANGE, TargetNoAsk

Instance Attribute Summary

Attributes inherited from Battle::Move

#consecutive_use_count, #damage_dealt, #effectiveness, #forced_next_move_decrease_pp, #id, #logic, #original, #pp, #ppmax, #scene, #used

Instance Method Summary collapse

Methods inherited from Basic

#deal_damage, #effect_working?

Methods inherited from Battle::Move

[], #accuracy, #accuracy_mod, #accuracy_text, #atk_class, #authentic?, #ballistics?, #battle_stage_mod, #battler_targets, #be_method, #bite?, #blocable?, #blocked_by?, #bypass_chance_of_hit?, #calc_stab, #chance_of_hit, #clone, #critical_hit?, #critical_rate, #damages, #dance?, #data, #db_symbol, #definitive_types, #description, #direct?, #disable_reason, #disabled?, #effect_chance, #evasion_mod, #force_switch?, #gravity_affected?, #heal?, #initialize, #magic_coat_affected?, #mirror_move_affected?, #move_blocked_by_target?, #name, #no_choice_skill?, #not_very_effective?, #ohko?, #one_target?, #physical?, #powder?, #power, #power_text, #pp_text, #pre_attack?, #priority, #proceed, #proceed_pre_attack, #pulse?, #punching?, #recoil?, #recoil_factor, register, register_move_disabled_check_hook, register_move_prevention_target_hook, register_move_prevention_user_hook, register_move_type_change_hook, register_single_type_multiplier_overwrite_hook, #relative_priority, #self_user_switch?, #snatchable?, #sound_attack?, #special?, #status?, #status_effects, #super_effective?, #target, #to_s, #trigger_king_rock?, #type, #type?, #type_dark?, #type_dragon?, #type_electric?, #type_fairy?, #type_fighting?, #type_fire?, #type_flying?, #type_ghost?, #type_grass?, #type_ground?, #type_ice?, #type_insect?, #type_modifier, #type_normal?, #type_poison?, #type_psychic?, #type_rock?, #type_steel?, #type_water?, #unfreeze?

Methods included from Hooks

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

Constructor Details

This class inherits a constructor from Battle::Move

Instance Method Details

#deal_effect(user, actual_targets)

Function that deals the effect to the pokemon

Parameters:



45
46
47
48
49
50
51
52
53
54
55
56
# File 'scripts/01600 Alpha 25 Battle Engine/04150 Battle_Move/00001 Mechanics/00130 Pledge.rb', line 45

def deal_effect(user, actual_targets)
  return false unless @combined_pledge

  comb_arr = [db_symbol, @combined_pledge]
  effect_symbol = nil
  COMBINATION_LIST.each { |key, value| effect_symbol = key if comb_arr & value == comb_arr }
  return unless effect_symbol

  send(effect_symbol, user, actual_targets)
  @combined_pledge = nil
  return true
end

#move_usable_by_user(user, targets) ⇒ Boolean

Note:

Thing that prevents the move from being used should be defined by :move_prevention_user Hook

Function that tests if the user is able to use the move

Parameters:

Returns:

  • (Boolean)

    if the procedure can continue



22
23
24
25
26
27
# File 'scripts/01600 Alpha 25 Battle Engine/04150 Battle_Move/00001 Mechanics/00130 Pledge.rb', line 22

def move_usable_by_user(user, targets)
  return false unless super
  return check_order_of_attack(user, targets) if scene.logic.battle_info.vs_type > 1 && scene.logic.alive_battlers(user.bank).size >= 2

  return true
end

#post_accuracy_check_move(user, actual_targets)

Function which permit things to happen before the move's animation



38
39
40
# File 'scripts/01600 Alpha 25 Battle Engine/04150 Battle_Move/00001 Mechanics/00130 Pledge.rb', line 38

def post_accuracy_check_move(user, actual_targets)
  scene.display_message_and_wait(parse_text(18, 193)) if @combined_pledge
end

#real_base_power(user, target) ⇒ Integer

Get the real base power of the move (taking in account all parameter)

Parameters:

Returns:



33
34
35
# File 'scripts/01600 Alpha 25 Battle Engine/04150 Battle_Move/00001 Mechanics/00130 Pledge.rb', line 33

def real_base_power(user, target)
  return @combined_pledge ? 160 : super
end

#register_pledge_combination(effect_symbol, first_pledge_symbol, second_pledge_symbol)

Register a pledge combination

Parameters:

  • effect_symbol (Symbol)
  • first_pledge_symbol (Symbol)
  • second_pledge_symbol


68
69
70
# File 'scripts/01600 Alpha 25 Battle Engine/04150 Battle_Move/00001 Mechanics/00130 Pledge.rb', line 68

def register_pledge_combination(effect_symbol, first_pledge_symbol, second_pledge_symbol)
  COMBINATION_LIST[effect_symbol] = [first_pledge_symbol, second_pledge_symbol]
end

#register_pledge_move(db_symbol)

Register a Pledge move as one in the System

Parameters:

  • db_symbol (Symbol)

    db_symbol of the move



60
61
62
# File 'scripts/01600 Alpha 25 Battle Engine/04150 Battle_Move/00001 Mechanics/00130 Pledge.rb', line 60

def register_pledge_move(db_symbol)
  PLEDGE_MOVES << db_symbol unless PLEDGE_MOVES.include?(db_symbol)
end