mirror of
https://github.com/mwisnowski/mtg_python_deckbuilder.git
synced 2025-12-19 00:50:13 +01:00
Implemented logic for adding creatures by themes, with weighted values. Added logic for keeping track of how many cards with what themes have been added as well
This commit is contained in:
parent
411f042af8
commit
8478bc2534
4 changed files with 706 additions and 329 deletions
|
|
@ -1,23 +1,50 @@
|
|||
from deck_builder.builder import DeckBuilder
|
||||
|
||||
# Non-interactive harness: chooses specified commander, first tag, first bracket, accepts defaults
|
||||
"""Non-interactive harness.
|
||||
|
||||
def run(command_name: str = "Rocco, Street Chef"):
|
||||
scripted_inputs = []
|
||||
# Commander query
|
||||
scripted_inputs.append(command_name) # initial query
|
||||
# After showing matches, choose first candidate (index 1)
|
||||
scripted_inputs.append("1") # select first candidate to inspect
|
||||
scripted_inputs.append("y") # confirm commander
|
||||
# Tag selection: choose eleventh tag as primary
|
||||
scripted_inputs.append("11")
|
||||
# Stop after primary (secondary prompt enters 1)
|
||||
scripted_inputs.append("1")
|
||||
# Stop after primary (tertiary prompt enters 0)
|
||||
scripted_inputs.append("0")
|
||||
# Bracket selection: choose 3 (Typical Casual mid default) else 2 maybe; pick 3
|
||||
Features:
|
||||
- Script commander selection.
|
||||
- Script primary / optional secondary / tertiary tags.
|
||||
- Apply bracket & accept default ideal counts.
|
||||
- Invoke multi-theme creature addition if available (fallback to primary-only).
|
||||
|
||||
Use run(..., secondary_choice=2, tertiary_choice=3, use_multi_theme=True) to exercise multi-theme logic.
|
||||
Indices correspond to the numbered tag list presented during interaction.
|
||||
"""
|
||||
|
||||
def run(
|
||||
command_name: str = "Finneas, Ace Archer",
|
||||
add_creatures: bool = True,
|
||||
use_multi_theme: bool = True,
|
||||
primary_choice: int = 11,
|
||||
secondary_choice: int | None = None,
|
||||
tertiary_choice: int | None = None,
|
||||
add_lands: bool = True,
|
||||
fetch_count: int | None = 3,
|
||||
dual_count: int | None = None,
|
||||
triple_count: int | None = None,
|
||||
utility_count: int | None = None,
|
||||
):
|
||||
scripted_inputs: list[str] = []
|
||||
# Commander query & selection
|
||||
scripted_inputs.append(command_name) # initial query
|
||||
scripted_inputs.append("1") # choose first search match to inspect
|
||||
scripted_inputs.append("y") # confirm commander
|
||||
# Primary tag selection
|
||||
scripted_inputs.append(str(primary_choice))
|
||||
# Secondary tag selection or stop (0)
|
||||
if secondary_choice is not None:
|
||||
scripted_inputs.append(str(secondary_choice))
|
||||
# Tertiary tag selection or stop (0)
|
||||
if tertiary_choice is not None:
|
||||
scripted_inputs.append(str(tertiary_choice))
|
||||
else:
|
||||
scripted_inputs.append("0")
|
||||
else:
|
||||
scripted_inputs.append("0") # stop at primary
|
||||
# Bracket (meta power / style) selection; keeping existing scripted value
|
||||
scripted_inputs.append("5")
|
||||
# Ideal counts prompts (8 prompts) -> press Enter (empty) to accept defaults
|
||||
# Ideal count prompts (press Enter for defaults)
|
||||
for _ in range(8):
|
||||
scripted_inputs.append("")
|
||||
|
||||
|
|
@ -26,28 +53,37 @@ def run(command_name: str = "Rocco, Street Chef"):
|
|||
return scripted_inputs.pop(0)
|
||||
raise RuntimeError("Ran out of scripted inputs for prompt: " + prompt)
|
||||
|
||||
b = DeckBuilder(input_func=scripted_input)
|
||||
b.run_initial_setup()
|
||||
b.run_deck_build_step1()
|
||||
b.run_deck_build_step2()
|
||||
b.run_land_step1()
|
||||
b.run_land_step2()
|
||||
# Land Step 3: Kindred lands (if applicable)
|
||||
b.run_land_step3()
|
||||
# Land Step 4: Fetch lands (request exactly 3)
|
||||
b.run_land_step4(requested_count=3)
|
||||
# Land Step 5: Dual lands (use default desired)
|
||||
b.run_land_step5()
|
||||
# Land Step 6: Triple lands (use default desired 1-2)
|
||||
b.run_land_step6()
|
||||
# Land Step 7: Misc utility lands
|
||||
b.run_land_step7()
|
||||
# Land Step 8: Optimize tapped lands
|
||||
b.run_land_step8()
|
||||
b.print_card_library()
|
||||
# Run post-spell (currently just analysis since spells not added in this harness)
|
||||
b.post_spell_land_adjust()
|
||||
return b
|
||||
builder = DeckBuilder(input_func=scripted_input)
|
||||
builder.run_initial_setup()
|
||||
builder.run_deck_build_step1()
|
||||
builder.run_deck_build_step2()
|
||||
|
||||
# Land sequence (optional)
|
||||
if add_lands:
|
||||
if hasattr(builder, 'run_land_step1'):
|
||||
builder.run_land_step1() # Basics / initial
|
||||
if hasattr(builder, 'run_land_step2'):
|
||||
builder.run_land_step2() # Utility basics / rebalancing
|
||||
if hasattr(builder, 'run_land_step3'):
|
||||
builder.run_land_step3() # Kindred lands if applicable
|
||||
if hasattr(builder, 'run_land_step4'):
|
||||
builder.run_land_step4(requested_count=fetch_count)
|
||||
if hasattr(builder, 'run_land_step5'):
|
||||
builder.run_land_step5(requested_count=dual_count)
|
||||
if hasattr(builder, 'run_land_step6'):
|
||||
builder.run_land_step6(requested_count=triple_count)
|
||||
if hasattr(builder, 'run_land_step7'):
|
||||
builder.run_land_step7(requested_count=utility_count)
|
||||
if hasattr(builder, 'run_land_step8'):
|
||||
builder.run_land_step8()
|
||||
|
||||
if add_creatures:
|
||||
builder.add_creatures()
|
||||
|
||||
|
||||
builder.print_card_library()
|
||||
builder.post_spell_land_adjust()
|
||||
return builder
|
||||
|
||||
if __name__ == "__main__":
|
||||
run()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue