Class: Rubygoal::CoachDefinitionAway

Inherits:
CoachDefinition show all
Defined in:
lib/rubygoal/coaches/coach_definition_away.rb

Instance Method Summary collapse

Methods inherited from CoachDefinition

method_missing, name, #name, players, #players, team, team_players

Instance Method Details

#formation(match) ⇒ Object



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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/rubygoal/coaches/coach_definition_away.rb', line 11

def formation(match)
  formation = Formation.new

  if match.me.winning?
    formation.lineup do
      defenders :average1, :fast1, :none, :fast3, :average5
      midfielders :average2, :none, :captain, :none, :average6
      att_midfielders :average3
      attackers :none, :none, :fast2, :average4, :none
    end
  elsif match.me.draw?
    formation.lineup do
      lines do
        defenders 13
        midfielders 40
        attackers 65
      end

      defenders :average1, :fast1, :none, :average3, :average5
      midfielders :average2, :none, :none, :none, :average6
      attackers :none, :fast2, :none, :average4, :none

      custom_position do
        player :fast3
        position 30, 10
      end
      custom_position do
        player :captain
        position match.ball.x, match.ball.y
      end
    end
  elsif match.me.losing?
    if match.time < 30
      formation.lineup do
        defenders :none, :average2, :average4, :average5, :none
        midfielders :average1, :none, :none, :fast2, :average6
        attackers :none, :average3, :none, :fast3, :none

        custom_position do
          player :fast1
          position 33, 50
        end
        custom_position do
          player :captain
          position 67, 50
        end
      end
    else
      formation.lineup do
        defenders :none, :average2, :fast1, :average5, :none
        def_midfielders :average4
        midfielders :average1, :none, :none, :captain, :average6
        att_midfielders :fast2
        attackers :none, :average3, :none, :fast3, :none
      end
    end
  end

  formation
end