Генератор колоды Beta

This commit is contained in:
2026-03-26 19:19:00 +05:00
parent d16af289fe
commit 112d101f54
15 changed files with 1362 additions and 110 deletions

View File

@@ -0,0 +1,88 @@
<style>
body {
font-family: Arial, sans-serif;
max-width: 960px;
margin: 40px auto;
padding: 0 16px;
background: #111;
color: #f5f5f5;
}
h1 {
margin-bottom: 12px;
}
button {
background: #ff6b00;
color: white;
border: none;
padding: 12px 18px;
border-radius: 8px;
cursor: pointer;
font-size: 16px;
}
.stats, .cards {
margin-top: 24px;
}
.card {
border: 1px solid #333;
border-radius: 10px;
padding: 12px;
margin-bottom: 10px;
background: #1a1a1a;
}
.meta {
color: #4ade80;
font-weight: bold;
}
.non-meta {
color: #f87171;
font-weight: bold;
}
.muted {
color: #aaa;
font-size: 14px;
}
</style>
<h1>Clash Deck Generator</h1>
<p>Generate a deck based on roles, meta cards, and special slot rules.</p>
<form action="/decks/generate" method="post">
<button type="submit">Generate deck</button>
</form>
<% if deck.any? %>
<div class="stats">
<h2>Deck stats</h2>
<p><strong>Average elixir:</strong> <%= stats[:average_elixir] %></p>
<p><strong>Meta cards:</strong> <%= stats[:meta_cards_count] %></p>
<p><strong>Spells:</strong> <%= stats[:spells_count] %></p>
<p><strong>Troops:</strong> <%= stats[:troops_count] %></p>
<p><strong>Buildings:</strong> <%= stats[:buildings_count] %></p>
<p><strong>Champions:</strong> <%= stats[:champions_count] %></p>
<p><strong>Heroes:</strong> <%= stats[:heroes_count] %></p>
<p><strong>Evolutions:</strong> <%= stats[:evolutions_count] %></p>
</div>
<div class="cards">
<h2>Deck cards</h2>
<% deck.each_with_index do |card, index| %>
<% meta_class = card.is_meta == 1 ? "meta" : "non-meta" %>
<% meta_text = card.is_meta == 1 ? "META" : "NON-META" %>
<div class="card">
<div><strong><%= index + 1 %>. <%= card.name %></strong></div>
<div class="muted"><%= card.rarity %> | <%= card.type %> | <%= card.elixir_cost %> elixir</div>
<div class="<%= meta_class %>"><%= meta_text %></div>
<div class="muted">Roles: <%= roles_repo.roles_for(card.name).join(", ") %></div>
</div>
<% end %>
</div>
<% end %>

View File

@@ -4,11 +4,8 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Clash deck generator2</title>
<%= favicon_tag %>
<%= stylesheet_tag "app" %>
</head>
<body>
<%= yield %>
<%= javascript_tag "app" %>
</body>
</html>
</html>