Class: Battle::Move::Present

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

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 BasicWithSuccessfulEffect

#effect_working?

Methods inherited from Basic

#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, #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_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_damage(user, actual_targets)

Function that deals the damage to the pokemon

Parameters:



31
32
33
34
35
36
37
38
39
40
# File 'scripts/01600 Alpha 25 Battle Engine/04150 Battle_Move/00010 Definitions/00300 Present.rb', line 31

def deal_damage(user, actual_targets)
  @real_base_power = real_base_power(user, target)
  if @real_base_power > 0
    super
    return false
  end
  return true
ensure
  @real_base_power = nil
end

#deal_effect(user, actual_targets)



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'scripts/01600 Alpha 25 Battle Engine/04150 Battle_Move/00010 Definitions/00300 Present.rb', line 42

def deal_effect(user, actual_targets)
  actual_targets.each do |target|
    hp = (target.max_hp / 4).floor
    if target.effects.has?(:heal_block)
      log_data('Heal blocked')
      scene.display_message_and_wait(parse_text_with_pokemon(19, 890, target))
    elsif target.hp == target.max_hp
      log_data('Target has MAX HP')
      scene.display_message_and_wait(parse_text_with_pokemon(19, 896, target))
    else
      log_data('Healing time')
      logic.damage_handler.heal(target, hp, test_heal_block: false)
    end
  end
end

#power



24
25
26
# File 'scripts/01600 Alpha 25 Battle Engine/04150 Battle_Move/00010 Definitions/00300 Present.rb', line 24

def power
  return @real_base_power || 0
end

#real_base_power(user, target) ⇒ Integer

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

Parameters:

Returns:

  • (Integer)


8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'scripts/01600 Alpha 25 Battle Engine/04150 Battle_Move/00010 Definitions/00300 Present.rb', line 8

def real_base_power(user, target)
  return @real_base_power if @real_base_power
  # Do your calculation here without removing the previous line (safety mesure to prevent bugs in deal_damages)
  rng = logic.generic_rng.rand(1..100)
  log_data("Rng gave you: #{rng}")
  if rng <= 40
    return 40
  elsif rng <= 70
    return 80
  elsif rng <= 80
    return 120
  else
    return 0
  end
end