Class: Contest::Logic

Inherits:
Object show all
Defined in:
docs/6_Contest_04_Logic.rb

Overview

Logic part of Pokemon Contests

Defined Under Namespace

Classes: ContestInfo

Constant Summary collapse

ADJACENT_CONDITION_MAPPING =

Adjacent conditions of each conditions

Returns:

  • (Hash{Symbol => Array<Symbol>})
{cool: %i[beautiful tough], beautiful: %i[cool cute], cute: %i[beautiful clever], clever: %i[cute tough], tough: %i[clever cool]}
ENTHOUSIASM_BOOST_EFFECTS =

Effects that boost the enthousiasm gain when the user is in a specific position

Returns:

  • (Array<Symbol>)
%i[very_exciting_first very_exciting_last]
CONTEST_SCARVES =

Scarves boosting the score of each condition

Returns:

  • (Hash{Symbol => Symbol})
{cool: :red_scarf, beautiful: :blue_scarf, cute: :pink_scarf, clever: :green_scarf, tough: :yellow_scarf}
SINGLE_CONDITION_MAX_SCORE =

Maximum score that can be obtained from a single condition

Returns:

  • (Integer)
255

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scene) ⇒ Logic

Create a new Logic instance

Parameters:

  • scene (Scene) —

    scene that holds the logic object



23
24
# File 'docs/6_Contest_04_Logic.rb', line 23

def initialize(scene)
end

Instance Attribute Details

#contest_info ⇒ Contest::Logic::ContestInfo (readonly)



8
9
10
# File 'docs/6_Contest_04_Logic.rb', line 8

def contest_info
  @contest_info
end

#contestants ⇒ Array<ContestCreature> (readonly)

Get all the contestants in the current contest

Returns:

  • (Array<ContestCreature>)


20
21
22
# File 'docs/6_Contest_04_Logic.rb', line 20

def contestants
  @contestants
end

#current_contestant ⇒ ContestCreature (readonly)

The contestant whose turn it is to play

Returns:

  • (ContestCreature)


65
66
67
# File 'docs/6_Contest_04_Logic.rb', line 65

def current_contestant
  @current_contestant
end

#current_round ⇒ Integer

Get the current round (0-5)

Returns:

  • (Integer)


17
18
19
# File 'docs/6_Contest_04_Logic.rb', line 17

def current_round
  @current_round
end

#enthousiasm_locked ⇒ Boolean

If the enthousiasm is locked for the round

Returns:

  • (Boolean)


119
120
121
# File 'docs/6_Contest_04_Logic.rb', line 119

def enthousiasm_locked
  @enthousiasm_locked
end

#messages ⇒ Array<Array> (readonly)

List of messages to send to an interpreter (AI/Scene)

Returns:

  • (Array<Array>)


6
7
8
# File 'docs/6_Contest_04_Logic.rb', line 6

def messages
  @messages
end

#moves_to_play ⇒ Array[Contest::Move]

Move chosen by the current contestant to be played

Returns:



59
60
61
# File 'docs/6_Contest_04_Logic.rb', line 59

def moves_to_play
  @moves_to_play
end

#play_order ⇒ Array<ContestCreature> (readonly)

Play order for the current round

Returns:

  • (Array<ContestCreature>)


62
63
64
# File 'docs/6_Contest_04_Logic.rb', line 62

def play_order
  @play_order
end

#randomize_next_turn ⇒ Boolean

Whether to randomize the next turn's order

Returns:

  • (Boolean)


68
69
70
# File 'docs/6_Contest_04_Logic.rb', line 68

def randomize_next_turn
  @randomize_next_turn
end

#rng ⇒ Random (readonly)

Get the rng

Returns:



14
15
16
# File 'docs/6_Contest_04_Logic.rb', line 14

def rng
  @rng
end

#scene ⇒ Contest::Scene (readonly)

Get the scene used to instanciate this Logic instance

Returns:



11
12
13
# File 'docs/6_Contest_04_Logic.rb', line 11

def scene
  @scene
end

Instance Method Details

#add_move_to_play(move)

Add a move to the list of moves to play this round

Parameters:



74
75
# File 'docs/6_Contest_04_Logic.rb', line 74

def add_move_to_play(move)
end

#ai_for(contestant) ⇒ AI::Base

Get the AI linked to the current contestant

Parameters:

  • contestant (Contest::ContestCreature) —

    the contestant to get the AI for

Returns:



40
41
# File 'docs/6_Contest_04_Logic.rb', line 40

def ai_for(contestant)
end

#change_enthousiasm(move) ⇒ Integer

Change the enthousiasm based on the move used and its effects

Parameters:

Returns:

  • (Integer) —

    Score bonus/malus to give



123
124
# File 'docs/6_Contest_04_Logic.rb', line 123

def change_enthousiasm(move)
end

#contestant_after(contestant) ⇒ Array<ContestCreature>

Get the contestant that plays immediately after a contestant in the current round

Parameters:

  • contestant (ContestCreature) —

    contestant to get the contestant playing immediately after it

Returns:

  • (Array<ContestCreature>) —

    the contestant playing immediately after the given contestant,



102
103
# File 'docs/6_Contest_04_Logic.rb', line 102

def contestant_after(contestant)
end

#contestant_before(contestant) ⇒ Array<ContestCreature>

Get the contestant that plays immediately before a contestant in the current round

Parameters:

  • contestant (ContestCreature) —

    contestant to get the contestant playing immediately before it

Returns:

  • (Array<ContestCreature>) —

    the contestant playing immediately before the given contestant,



92
93
# File 'docs/6_Contest_04_Logic.rb', line 92

def contestant_before(contestant)
end

#contestant_play_order(contestant) ⇒ Integer

Get the current contestant's play order

Parameters:

  • contestant (ContestCreature) —

    contestant to get the play order for

Returns:

  • (Integer) —

    the play order of the contestant



82
83
# File 'docs/6_Contest_04_Logic.rb', line 82

def contestant_play_order(contestant)
end

#contestants_after(contestant) ⇒ Array<ContestCreature>

Get the contestants that play after a contestant in the current round

Parameters:

  • contestant (ContestCreature) —

    contestant to get the contestants playing after it

Returns:

  • (Array<ContestCreature>) —

    the contestants playing after the given contestant



97
98
# File 'docs/6_Contest_04_Logic.rb', line 97

def contestants_after(contestant)
end

#contestants_before(contestant) ⇒ Array<ContestCreature>

Get the contestants that play before a contestant in the current round

Parameters:

  • contestant (ContestCreature) —

    contestant to get the contestants playing before it

Returns:

  • (Array<ContestCreature>) —

    the contestants playing before the given contestant



87
88
# File 'docs/6_Contest_04_Logic.rb', line 87

def contestants_before(contestant)
end

#current_contestant_index ⇒ Integer

get a contestant's index

Returns:

  • (Integer)


44
45
# File 'docs/6_Contest_04_Logic.rb', line 44

def current_contestant_index
end

#determine_round_play_order

Determine the play order for the current round



70
71
# File 'docs/6_Contest_04_Logic.rb', line 70

def determine_round_play_order
end

#give_score(contestant, score)

Give score to a contestant

Parameters:

  • contestant (ContestCreature) —

    contestant to give score to

  • score (Integer) —

    score to give



107
108
# File 'docs/6_Contest_04_Logic.rb', line 107

def give_score(contestant, score)
end

#load_contestants

Create the ContestCreature object for each contestant



52
53
# File 'docs/6_Contest_04_Logic.rb', line 52

def load_contestants
end

#next_contestant

Set the next contestant to play



77
78
# File 'docs/6_Contest_04_Logic.rb', line 77

def next_contestant
end

#player_creature ⇒ ContestCreature

Get the player's creature

Returns:

  • (ContestCreature)


35
36
# File 'docs/6_Contest_04_Logic.rb', line 35

def player_creature
end

#player_creature?(creature) ⇒ Boolean

If the creature is the player's creature

Parameters:

  • creature (ContestCreature)

Returns:

  • (Boolean)


49
50
# File 'docs/6_Contest_04_Logic.rb', line 49

def player_creature?(creature)
end

#rng_seed ⇒ Integer

Get the current RNG seed

Returns:

  • (Integer)


31
32
# File 'docs/6_Contest_04_Logic.rb', line 31

def rng_seed
end

#score_primary_judging(contestant) ⇒ Integer

Calculate the score for the primary judging phase

Parameters:

  • contestant (Contest::Contestant)

Returns:

  • (Integer) —

    Score obtained



180
181
# File 'docs/6_Contest_04_Logic.rb', line 180

def score_primary_judging(contestant)
end

#to_s Also known as: inspect

Safe to_s & inspect



26
27
# File 'docs/6_Contest_04_Logic.rb', line 26

def to_s
end