summaryrefslogtreecommitdiff
path: root/app/views/characters/show.html.erb
blob: dda770eac5d5e59b5ab6cb831b9d773d819310c6 (plain)
1
2
3
4
5
6
7
8
9
10
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<h1 class="text-3xl mb-4">
  <%= @character.name %>
</h1>

<div class="text-lg mb-4">
  <ul class="flex flex-row">
    <li class="mr-2"><%= link_to "Titles", character_titles_path(@character) %></li>
    <li class="mr-2"><%= link_to "Rankings", character_rankings_path(@character) %></li>
  </ul>
</div>

<p class="mb-4">First entered the planes
  <%= pluralize((Date.current - @character.created_at.to_date).to_i, "day") %> ago.</p>

<p class="mb-4">Learned <%= @character.learned_activities.count %> recipe(s) or technique(s).</p>

<div class="my-4">
  <h2 class="text-2xl mb-2">Boons & Banes</h2>
  <% if @character.active_states.any? %>
    <ul>
      <% @character.active_states.each do |state| %>
        <ul><%= state.condition.name %> (expires in <%= distance_of_time_in_words_to_now(state.expires_at)%>)</ul>
      <% end %>
    </ul>
  <% else %>
    <p>No boons or banes affect you.</p>
  <% end %>
</div>

<% if @character == current_char %>
  <h2 class="text-2xl mb-4">Combat Styles</h2>
  <%= form_with url: character_combat_styles_path(character_id: @character) do |f| %>
    <%= f.label :offensive_style, "Offensive" %>
    <%= f.select :offensive_style, Character.offensive_styles.keys.to_a, selected: @character.offensive_style %>

    <%= f.label :defensive_style, "Defensive" %>
    <%= f.select :defensive_style, Character.defensive_styles.keys.to_a, selected: @character.defensive_style %>

    <%= f.submit "Set" %>
  <% end %>
<% end %>

<div class="my-6">
  <h2 class="text-2xl mb-4">Combat Statistics</h2>
  <table class="table-auto">
    <tbody>
      <tr>
        <th class="table-cell-padded text-right">Wounds</th>
        <td class="table-cell-padded"><%= @character.wounds %> / <%= @character.max_wounds %></td>
      </tr>
      <tr>
        <th class="table-cell-padded text-right">Max HP</th>
        <td class="table-cell-padded"><%= @character.max_hp %></td>
      </tr>
      <tr>
        <th class="table-cell-padded text-right">Speed</th>
        <td class="table-cell-padded"><%= @character.speed %></td>
      </tr>
      <tr>
        <th class="table-cell-padded text-right">Accuracy</th>
        <td class="table-cell-padded"><%= @character.accuracy(with_combat_style: true) %></td>
      </tr>
      <tr>
        <th class="table-cell-padded text-right">Power</th>
        <td class="table-cell-padded"><%= @character.power(with_combat_style: true) %></td>
      </tr>
      <tr>
        <th class="table-cell-padded text-right">Evasion</th>
        <td class="table-cell-padded"><%= @character.evasion(with_combat_style: true) %></td>
      </tr>
      <tr>
        <th class="table-cell-padded text-right">Block</th>
        <td class="table-cell-padded"><%= @character.block(with_combat_style: true) %></td>
      </tr>
      <tr>
        <th class="table-cell-padded text-right">Block Value</th>
        <td class="table-cell-padded"><%= @character.block_value %></td>
      </tr>
    </tbody>
  </table>
</div>

<div class="my-6">
  <h2 class="text-2xl mb-4">Skills</h2>

  <table class="table-auto mb-8">
    <thead>
    <tr>
      <th class="table-header-padded">Skill</th>
      <th class="table-header-padded">Level</th>
      <th class="table-header-padded">XPTNL</th>
      <th class="table-header-padded">Total XP</th>
    </tr>
    </thead>
    <tbody>
    <% @character.character_skills.ordered_by_skill_name.each do |cs| %>
      <tr>
        <td class="table-cell-padded"><%= cs.skill.name %></td>
        <td class="table-cell-padded"><%= cs.level %></td>
        <td class="table-cell-padded"><%= cs.xp_to_next_level %></td>
        <td class="table-cell-padded"><%= cs.xp %></td>
      </tr>
    <% end %>
    </tbody>
  </table>
</div>

<% if @character == current_char %>
  <div class="my-6">
    <h2 class="text-2xl mb-4">Rest</h2>
    <p class="mb-4">
      You have <%= distance_of_time_in_words_to_now(current_char.rested_until) %> of rested time.
      <% if current_char.resting? %>
        This does not include time from your current rest. That time will be added when you stop resting.
      <% end %>
    </p>
    <%= button_to current_char.resting? ? "Stop Resting" : "Start Resting", toggle_resting_path %>
  </div>

  <%= link_to "Manage account", edit_user_registration_path, class: "text-sm" %>
<% end %>