Skip to content
This repository has been archived by the owner on Sep 17, 2023. It is now read-only.

Commit

Permalink
Building files for 3.06 release
Browse files Browse the repository at this point in the history
  • Loading branch information
asdfusername committed Dec 11, 2022
1 parent 402d339 commit 1f9a4d3
Show file tree
Hide file tree
Showing 8 changed files with 203 additions and 176 deletions.
2 changes: 1 addition & 1 deletion Installer.iss
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
; -- MtgaDraft.iss --
[Setup]
AppName=MTGA Draft Tool
AppVersion=3.05
AppVersion=3.06
WizardStyle=modern
DefaultDirName={sd}\MtgaDraftTool
DefaultGroupName=MtgaDraftTool
Expand Down
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# MTGA_Draft_17Lands
Magic: The Gathering Arena draft tool that utilizes 17Lands data.

**Latest Supported Set:** The Brothers' War
**This application will automatically support new sets as soon as the sets are released on Arena _and_ the data is available on the https://www.17lands.com/card_ratings page.**

**Supported Events:** Premier Draft\*, Traditional Draft\*, Quick Draft, Sealed, Traditional Sealed, and Special Events\*\*
* \* For some events, the Arena log doesn't list P1P1 until after P1P2. The _Card Compare_ feature can be used as a substitute for P1P1.
Expand Down Expand Up @@ -148,6 +148,8 @@ Magic: The Gathering Arena draft tool that utilizes 17Lands data.

- **Enable Draft Log:** Records the draft in a log file within the `./Logs` folder.

- **UI Size:** Increase or decrease the size of the application text and images.

## Card Logic:

- **Win Rate Grades:** The application will use the non-zero GIHWR values to calculate the mean and standard deviation and assign a letter grade based on the number of standard deviations from the mean.
Expand Down Expand Up @@ -182,18 +184,18 @@ Magic: The Gathering Arena draft tool that utilizes 17Lands data.
- **Deck Suggester:** For each viable color combination, the deck suggester will construct multiple decks (Aggro, Mid, and Control decks), using some generic deck building requirements, from a card pool of the highest win rate cards. The suggester will rate each deck and choose the highest rated deck for each viable color combination. The deck suggester will NOT identify card synergies and build an intentionally synergistic deck.
- Deck Building Requirements:
- Aggro Deck:
- The deck must have a minimum of 13 creatures and should have no less than 17 creatures.
- The deck must have a minimum of 9 creatures and should have no less than 17 creatures.
- The deck should have at least 2 1-drops, 5 2-drops, and 3 3-drops.
- The average CMC of all of the creatures must be 2.40 or less.
- The deck has 16 lands.
- Mid Deck:
- The deck must have a minimum of 13 creatures and should have no less than 15 creatures.
- The deck must have a minimum of 9 creatures and should have no less than 15 creatures.
- The deck should have at least 4 2-drops, 3 3-drops, 2 4-drops, and 1 5-drop.
- The average CMC of all of the creatures must be 3.04 or less.
- The deck has 17 lands.
- Control Deck:
- The deck must have a minimum of 13 creatures and should have no less than 14 creatures.
- The deck should have at least 3 2-drops, 3 3-drops, 3 4-drops, 1 5-drop, and 1 6-drop.
- The deck must have a minimum of 9 creatures and should have no less than 10 creatures.
- The deck should have at least 3 2-drops, 2 3-drops, 2 4-drops, and 1 5-drop.
- The average CMC of all of the creatures must be 3.68 or less.
- The deck has 18 lands.
- Notes:
Expand Down
42 changes: 20 additions & 22 deletions card_logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ class Config:
iwd_weight: float = 0.0
override_scale_factor: float = 0.0

deck_mid: DeckType = DeckType([0,0,4,3,2,1,0], 23, 15, 3.04)
deck_aggro: DeckType = DeckType([0,2,5,3,0,0,0], 24, 17, 2.40)
deck_control: DeckType = DeckType([0,0,3,2,2,1,0], 22, 10, 3.68)
deck_mid: DeckType = DeckType([0, 0, 4, 3, 2, 1, 0], 23, 15, 3.04)
deck_aggro: DeckType = DeckType([0, 2, 5, 3, 0, 0, 0], 24, 17, 2.40)
deck_control: DeckType = DeckType([0, 0, 3, 2, 2, 1, 0], 22, 10, 3.68)

database_size: int = 0

Expand Down Expand Up @@ -170,7 +170,7 @@ def _retrieve_wheel_sum(self, card_list):
def _process_wheel(self, card):
"""Calculate wheel percentage"""
result = 0

try:
if self.pick_number <= len(constants.WHEEL_COEFFICIENTS):
# 0 is treated as pick 1 for PremierDraft P1P1
Expand All @@ -183,20 +183,20 @@ def _process_wheel(self, card):
result = max(result, 0)
except Exception as error:
logic_logger.info("_process_wheel error: %s", error)

return result

def _process_wheel_normalized(self, card, total_sum):
"""Calculate the normalized wheel percentage using the sum of all percentages within the card list"""
result = 0

try:
result = self._process_wheel(card)

result = round((result / total_sum)*100, 1) if total_sum > 0 else 0
except Exception as error:
logic_logger.info("_process_wheel_normalized error: %s", error)

return result

def _process_filter_fields(self, card, option, colors):
Expand Down Expand Up @@ -504,7 +504,7 @@ def auto_colors(deck, colors_max, metrics, configuration):
if deck_length > 15:
colors_dict = deck_colors(deck, colors_max, metrics, configuration)
colors = list(colors_dict.keys())
auto_select_threshold = max(55 - deck_length, 10)
auto_select_threshold = max(70 - deck_length, 25)
if colors:
if (colors_dict[colors[0]] - colors_dict[colors[1]]) > auto_select_threshold:
deck_colors_list = colors[0:1]
Expand Down Expand Up @@ -540,18 +540,18 @@ def sort_cards_win_rate(cards, filter_order, bayesian_enabled):
try:
for color_filter in filter_order:
win_rate = calculate_win_rate(card[constants.DATA_FIELD_DECK_COLORS][color_filter][constants.DATA_FIELD_GIHWR],
card[constants.DATA_FIELD_DECK_COLORS][color_filter][constants.DATA_FIELD_GIH],
bayesian_enabled)
if win_rate:
card[constants.DATA_FIELD_DECK_COLORS][color_filter][constants.DATA_FIELD_GIH],
bayesian_enabled)
if win_rate:
card["results"] = [win_rate]
break

except Exception as error:
logic_logger.info("sort_cards_win_rate error: %s", error)

sorted_cards = sorted(
cards, key=lambda k: k["results"][0], reverse=True)

return sorted_cards


Expand Down Expand Up @@ -584,20 +584,19 @@ def calculate_curve_factor(deck, color_filter, configuration):

if deck_info.total_cards < configuration.deck_control.maximum_card_count:
curve_factor -= ((configuration.deck_control.maximum_card_count - deck_info.creature_count)
/ configuration.deck_control.maximum_card_count) * curve_level
/ configuration.deck_control.maximum_card_count) * curve_level
elif deck_info.creature_count < minimum_creature_count:
curve_factor = (deck_info.creature_count
/ minimum_creature_count) * curve_level
/ minimum_creature_count) * curve_level
else:
curve_factor = curve_level



except Exception as error:
logic_logger.info("calculate_curve_factor error: %s", error)

return base_curve_factor + curve_factor


def calculate_color_affinity(deck_cards, color_filter, threshold, configuration):
"""This function identifies the main deck colors based on the GIHWR of the collected cards"""
colors = {}
Expand Down Expand Up @@ -813,7 +812,7 @@ def deck_rating(deck, deck_type, color, threshold, bayesian_enabled):
rating += gihwr
except Exception:
pass

# Deck contains the recommended number of creatures
recommended_creature_count = deck_type.recommended_creature_count
filtered_cards = deck_card_search(
Expand Down Expand Up @@ -843,7 +842,6 @@ def deck_rating(deck, deck_type, color, threshold, bayesian_enabled):
len(minimum_distribution) - 1))
distribution[index] += 1


except Exception as error:
logic_logger.info("deck_rating error: %s", error)

Expand Down Expand Up @@ -1132,8 +1130,8 @@ def build_deck(deck_type, cards, color, metrics, configuration):
constants.CARD_TYPE_SORCERY,
constants.CARD_TYPE_ENCHANTMENT,
constants.CARD_TYPE_ARTIFACT,
constants.CARD_TYPE_PLANESWALKER], True, True, False)
constants.CARD_TYPE_PLANESWALKER], True, True, False)

card_colors_sorted = sorted(
card_colors_sorted, key=lambda k: k["results"][0], reverse=True)

Expand Down
Loading

0 comments on commit 1f9a4d3

Please sign in to comment.