Class: Battle::Move::Basic

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

Overview

Class describing a basic move (damage + potential status + potential stat)

Constant Summary

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 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?, #move_usable_by_user, #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?, #real_base_power, #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_damage(user, actual_targets)

Function that deals the damage to the pokemon

Parameters:



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'scripts/01600 Alpha 25 Battle Engine/04150 Battle_Move/00001 Mechanics/00100 Basic.rb', line 8

def deal_damage(user, actual_targets)
  return true if status?
  raise 'Badly configured move, it should have positive power' if power < 0

  successful_damages = actual_targets.map do |target|
    hp = damages(user, target)
    damage_handler = @logic.damage_handler
    damage_handler.damage_change_with_process(hp, target, user, self) do
      scene.display_message_and_wait(actual_targets.size == 1 ? parse_text(18, 84) : parse_text_with_pokemon(19, 384, target)) if critical_hit?
      efficent_message(effectiveness, target) if hp > 0
    end
    recoil(hp, user) if recoil? && damage_handler.instance_variable_get(:@reason).nil?
    next false if damage_handler.instance_variable_get(:@reason)

    next true
  end
  new_targets = actual_targets.map.with_index { |target, index| successful_damages[index] && target }.select { |target| target }
  actual_targets.clear.concat(new_targets)
  return successful_damages.include?(true)
end

#effect_working?(user, actual_targets) ⇒ Boolean

Test if the effect is working

Parameters:

Returns:

  • (Boolean)


33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'scripts/01600 Alpha 25 Battle Engine/04150 Battle_Move/00001 Mechanics/00100 Basic.rb', line 33

def effect_working?(user, actual_targets)
  if !status? && user.can_be_lowered_or_canceled?(target = actual_targets.find { |t| t.has_ability?(:shield_dust) })
    @scene.visual.show_ability(target) if effect_chance == 100
    return false
  end

  n = 1
  scene.logic.each_effects(user).each do |e|
    n *= e.effect_chance_modifier(self)
  end

  return bchance?((effect_chance * n) / 100.0) && super # super ensure that the magic_bounce & magic_coat effect works
end