Class: Battle::AI::MoveHeuristicBase

Inherits:
Object
  • Object
show all
Defined in:
docs/5_Battle_30_AI_1_MoveHeuristic.rb

Overview

Class responsive of handling the heuristics of moves

Direct Known Subclasses

CuringMove, HealingMoves, ReflectMoves, Rest

Defined Under Namespace

Classes: CuringMove, HealingMoves, ReflectMoves, Rest

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ignore_effectiveness = false, ignore_power = false, overwrite_move_kind_flag = false) ⇒ MoveHeuristicBase

Create a new MoveHeusristicBase

Parameters:

  • ignore_effectiveness (Boolean) (defaults to: false)

    if this heuristic ignore effectiveness (wants to compute it themself)

  • ignore_power (Boolean) (defaults to: false)

    if this heuristic ignore power (wants to compute it themself)

  • overwrite_move_kind_flag (Boolean) (defaults to: false)

    if the effect overwrite (to true) the can see move kind flag



10
11
# File 'docs/5_Battle_30_AI_1_MoveHeuristic.rb', line 10

def initialize(ignore_effectiveness = false, ignore_power = false, overwrite_move_kind_flag = false)
end

Class Method Details

.new(db_symbol, level) ⇒ MoveHeuristicBase

Get a MoveHeuristic by db_symbol and level

Parameters:

  • db_symbol (Symbol)

    db_symbol of the move

  • level (Integer)

    level of the current AI

Returns:



44
45
# File 'docs/5_Battle_30_AI_1_MoveHeuristic.rb', line 44

def new(db_symbol, level)
end

.register(db_symbol, klass, min_level = 0)

Note:

If there’s several min_level, the highest condition matching with current AI level is choosen.

Register a new move heuristic

Parameters:

  • db_symbol (Symbol)

    db_symbol of the move

  • klass (Class<MoveHeuristicBase>, nil)

    klass holding the logic for this heuristic

  • min_level (Integer) (defaults to: 0)

    minimum level when the heuristic acts



38
39
# File 'docs/5_Battle_30_AI_1_MoveHeuristic.rb', line 38

def register(db_symbol, klass, min_level = 0)
end

Instance Method Details

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

Compute the heuristic

Parameters:

Returns:

  • (Float)


30
31
# File 'docs/5_Battle_30_AI_1_MoveHeuristic.rb', line 30

def compute(move, user, target, ai)
end

#ignore_effectiveness?Boolean

Is this heuristic ignoring effectiveness

Returns:

  • (Boolean)


14
15
# File 'docs/5_Battle_30_AI_1_MoveHeuristic.rb', line 14

def ignore_effectiveness?
end

#ignore_power?Boolean

Is this heuristic ignoring power

Returns:

  • (Boolean)


18
19
# File 'docs/5_Battle_30_AI_1_MoveHeuristic.rb', line 18

def ignore_power?
end

#overwrite_move_kind_flag?Boolean

Is this heuristic ignoring power

Returns:

  • (Boolean)


22
23
# File 'docs/5_Battle_30_AI_1_MoveHeuristic.rb', line 22

def overwrite_move_kind_flag?
end