Class: Battle::Move::KnockOff

Inherits:
BasicWithSuccessfulEffect show all
Defined in:
scripts/01600 Alpha 25 Battle Engine/04150 Battle_Move/00010 Definitions/00300 KnockOff.rb

Overview

Move that inflict Knock Off to the ennemy

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 Basic

#deal_damage

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, #check_specific_procedure, #clone, #critical_hit?, #critical_rate, #damages, #dance?, #data, #db_symbol, #definitive_types, #description, #direct?, #disable_reason, #disabled?, #drain_factor, #effect_chance, #efficent_message, #evasion_mod, #force_switch?, #gravity_affected?, #heal?, #initialize, #magic_coat_affected?, #mirror_move_affected?, #move_blocked_by_target?, #move_usable_by_user, #multi_hit?, #name, #no_choice_skill?, #not_very_effective?, #ohko?, #one_target?, #physical?, #powder?, #power, #power_text, #pp_text, #pre_attack?, #priority, #proceed, #proceed_internal_parental_bond, #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?, #slicing_attack?, #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?, #typeless?, #unfreeze?, #wind_attack?

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:



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'scripts/01600 Alpha 25 Battle Engine/04150 Battle_Move/00010 Definitions/00300 KnockOff.rb', line 24

def deal_effect(user, actual_targets)
  actual_targets.each do |target|
    next unless @logic.item_change_handler.can_lose_item?(target, user)
    # Specific case : dying from Rocky Helmet or Rough Skin damage prevents from removing the target's item
    next if user.dead? && target.hold_item?(:rocky_helmet) || %i[rough_skin iron_barbs].include?(target.battle_ability_db_symbol)

    additionnal_variables = {
      PFM::Text::ITEM2[2] => target.item_name,
      PFM::Text::PKNICK[1] => target.given_name
    }
    @scene.display_message_and_wait(parse_text_with_pokemon(19, 1056, user, additionnal_variables))
    if target.from_party? && !target.effects.has?(:item_stolen)
      @logic.item_change_handler.change_item(:none, false, target, user, self)
      target.effects.add(Effects::ItemStolen.new(@logic, target))
    else
      @logic.item_change_handler.change_item(:none, true, target, user, self)
    end
  end
end

#effect_working?(user, actual_targets) ⇒ Boolean

Test if the effect is working

Parameters:

Returns:

  • (Boolean)


17
18
19
# File 'scripts/01600 Alpha 25 Battle Engine/04150 Battle_Move/00010 Definitions/00300 KnockOff.rb', line 17

def effect_working?(user, actual_targets)
  return actual_targets.any? { |target| @logic.item_change_handler.can_lose_item?(target, user) }
end

#real_base_power(user, target) ⇒ Integer

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

Parameters:

Returns:

  • (Integer)


9
10
11
# File 'scripts/01600 Alpha 25 Battle Engine/04150 Battle_Move/00010 Definitions/00300 KnockOff.rb', line 9

def real_base_power(user, target)
  return effect_working?(user, [target]) ? super * 1.5 : super
end