Class: Battle::AI::MoveHeuristicBase::ReflectMoves

Inherits:
Battle::AI::MoveHeuristicBase show all
Defined in:
scripts/01600 Alpha 25 Battle Engine/08000 Battle_AI/00001 MoveHeuristic/00005 ReflectMoves.rb

Instance Method Summary collapse

Methods inherited from Battle::AI::MoveHeuristicBase

#ignore_effectiveness?, #ignore_power?, new, #overwrite_move_kind_flag?, register

Constructor Details

#initializeReflectMoves

Create a new Rest Heuristic



6
7
8
# File 'scripts/01600 Alpha 25 Battle Engine/08000 Battle_AI/00001 MoveHeuristic/00005 ReflectMoves.rb', line 6

def initialize
  super(true, true, true)
end

Instance Method Details

#compute(move, user, target, ai) ⇒ Float

Compute the heuristic

Parameters:

Returns:

  • (Float)


16
17
18
19
20
21
22
# File 'scripts/01600 Alpha 25 Battle Engine/08000 Battle_AI/00001 MoveHeuristic/00005 ReflectMoves.rb', line 16

def compute(move, user, target, ai)
  return 0 if ai.scene.logic.bank_effects[user.bank].has?(move.db_symbol) || (move.db_symbol == :aurora_veil && !$env.hail?)
  return 0.80 if move.db_symbol == :light_screen && ai.scene.logic.foes_of(user).none? { |foe| foe.moveset.none?(&:special?) }
  return 0.80 if move.db_symbol == :reflect && ai.scene.logic.foes_of(user).none? { |foe| foe.moveset.none?(&:physical?) }

  return 0.90 + ai.scene.logic.move_damage_rng.rand(0..0.10)
end