Class: Battle::Move::Rest
- Inherits:
-
Battle::Move
- Object
- Battle::Move
- Battle::Move::Rest
- Defined in:
- scripts/01600 Alpha 25 Battle Engine/04150 Battle_Move/00010 Definitions/00300 Rest.rb
Overview
Class managing Rest
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
-
#deal_status(user, actual_targets)
Function that deals the status condition to the pokemon.
-
#move_blocked_by_target?(user, target) ⇒ Boolean
Function that tests if the targets blocks the move.
-
#uproar? ⇒ Boolean
If a pokemon is using Uproar.
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_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_status(user, actual_targets)
Function that deals the status condition to the pokemon
57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'scripts/01600 Alpha 25 Battle Engine/04150 Battle_Move/00010 Definitions/00300 Rest.rb', line 57 def deal_status(user, actual_targets) actual_targets.each do |target| scene.visual.(target) target.status_sleep(true, 3) # Two turns + the current turn scene.(parse_text_with_pokemon(19, 306, target)) hp = target.max_hp logic.damage_handler.heal(target, hp, test_heal_block: false) do scene.(parse_text_with_pokemon(19, 638, target)) end target.item_effect.execute_berry_effect if target.item_effect.instance_of?(Effects::Item::StatusBerry::Chesto) end end |
#move_blocked_by_target?(user, target) ⇒ Boolean
Thing that prevents the move from being used should be defined by :move_prevention_target Hook.
Function that tests if the targets blocks the move
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'scripts/01600 Alpha 25 Battle Engine/04150 Battle_Move/00010 Definitions/00300 Rest.rb', line 11 def move_blocked_by_target?(user, target) return true if super # Pseudo logic.status_change_handler.status_appliable? (because of the cure effect) # Don't forget to update this function when adding a new move # Fail if has Insomnia, Vital Spirit, Sweet Veil, Comatose if target.has_ability?(:insomnia) || target.has_ability?(:vital_spirit) || target.has_ability?(:sweet_veil) || target.has_ability?(:comatose) scene.visual.show_ability(target) scene.(parse_text_with_pokemon(19, 451, target)) return true # Fail if hp are max elsif target.hp == target.max_hp scene.(parse_text_with_pokemon(19, 451, target)) return true # Fail if affected by Heal Block elsif target.effects.has?(:heal_block) txt = parse_text_with_pokemon(19, 893, user, '[VAR PKNICK(0000)]' => user.given_name, '[VAR MOVE(0001)]' => name) scene.(txt) return true # Fail if affected by Misty Terrain elsif @logic.field_terrain_effect.misty? && target.affected_by_terrain? scene.(parse_text_with_pokemon(19, 845, target)) return true # Fail if affected by Electric Terrain elsif @logic.field_terrain_effect.electric? && target.affected_by_terrain? scene.(parse_text_with_pokemon(19, 1207, target)) return true # Fail if affected by Uproar elsif uproar? scene.(parse_text_with_pokemon(19, 709, target)) return true end return false end |
#uproar? ⇒ Boolean
If a pokemon is using Uproar
49 50 51 52 |
# File 'scripts/01600 Alpha 25 Battle Engine/04150 Battle_Move/00010 Definitions/00300 Rest.rb', line 49 def uproar? fu = @logic.all_alive_battlers.find { |pkm| pkm.effects.has?(:uproar) } return !fu.nil? end |