Closed nosas closed 3 years ago
Example of expected failure
tests\battle\test_battle_toon_wins.py
[^] Initializing BattleContext...
[lvl 2 "Flunky" (12/12hp), lvl 4 "Micromanager" (30/30hp)]
[+] BattleContext `update()` pre-update state : ToonAttackState
[+] `handle_attacks()` ToonAttackState
[+] Toon "Astro" (65/65hp) targets Cog lvl 2 "Flunky" (12/12hp)
[-] `choose_attack()` : lvl 1 Drop "Sandbag" ((6, 1), 18dmg)
[+] Toon "Ostra" (69/69hp) targets Cog lvl 2 "Flunky" (12/12hp)
[-] `choose_attack()` : lvl 1 Lure "Small Magnet" ((2, 1), 0dmg)
[>] Gag Track : Lure
[-] Toon `do_attack()` "Ostra" (69/69hp) Small Magnet hits lvl 2 "Flunky" (12/12hp) -> 12hp-0dmg
[>] is_lured : False -> True on lvl 2 "Flunky" (12/12hp)
[-] Toon `do_attack()` "Ostra" (69/69hp) Small Magnet hits lvl 4 "Micromanager" (30/30hp) -> 30hp-0dmg
[>] is_lured : False -> True on lvl 4 "Micromanager" (30/30hp)
[>] Gag Track : Drop
[-] Toon `do_attack()` "Astro" (65/65hp) Sandbag misses lvl 2 "Flunky" (12/12hp) -> 12hp-0dmg
[+] `transition_to()` transition : ToonAttackState -> CogAttackState
[-] `transition_to()` completed states : ['ToonAttackState']
[-] BattleContext `update()` post-update state : CogAttackState
[+] BattleContext `update()` pre-update state : CogAttackState
[+] `handle_attacks()` CogAttackState
[+] CogAttackState Cog lvl 2 "Flunky" (12/12hp) targets Toon "Astro" (100/65hp)
[-] Cog `do_attack()` Skip lured lvl 2 "Flunky" (12/12hp)
[+] CogAttackState Cog lvl 4 "Micromanager" (30/30hp) targets Toon "Astro" (100/65hp)
[-] Cog `do_attack()` Skip lured lvl 4 "Micromanager" (30/30hp)
[+] `transition_to()` transition : CogAttackState -> ToonAttackState
[-] `transition_to()` completed states : ['ToonAttackState', 'CogAttackState']
[-] BattleContext `update()` post-update state : ToonAttackState
[+] BattleContext `update()` pre-update state : ToonAttackState
[+] `handle_attacks()` ToonAttackState
[+] Toon "Astro" (100/65hp) targets Cog lvl 4 "Micromanager" (30/30hp)
[-] `choose_attack()` : lvl 3 Throw "Whole Fruit Pie" ((4, 3), 27dmg)
[+] Toon "Ostra" (100/69hp) targets Cog lvl 4 "Micromanager" (30/30hp)
[-] `choose_attack()` : lvl 1 Trap "Rake" ((1, 1), 20dmg)
[>] Gag Track : Trap
[-] Toon `do_attack()` "Ostra" (100/69hp) Rake misses lvl 4 "Micromanager" (30/30hp) -> 30hp-0dmg
[>] Gag Track : Throw
[-] Toon `do_attack()` "Astro" (100/65hp) Whole Fruit Pie hits lvl 4 "Micromanager" (3/30hp) -> 30hp-27dmg
[>] is_lured : True -> False on lvl 4 "Micromanager" (3/30hp)
[+] `transition_to()` transition : ToonAttackState -> CogAttackState
[-] `transition_to()` completed states : ['ToonAttackState', 'CogAttackState', 'ToonAttackState']
[-] BattleContext `update()` post-update state : CogAttackState
[+] BattleContext `update()` pre-update state : CogAttackState
[+] `handle_attacks()` CogAttackState
[+] CogAttackState Cog lvl 2 "Flunky" (12/12hp) targets Toon "Astro" (100/65hp)
[-] Cog `do_attack()` Skip lured lvl 2 "Flunky" (12/12hp)
[+] CogAttackState Cog lvl 4 "Micromanager" (3/30hp) targets Toon "Astro" (100/65hp)
[-] Cog `do_attack()` lvl 4 "Micromanager" (3/30hp) Demotion hits "Astro" (94/65hp) -> 100hp-6dmg
[+] `transition_to()` transition : CogAttackState -> ToonAttackState
[-] `transition_to()` completed states : ['ToonAttackState', 'CogAttackState', 'ToonAttackState', 'CogAttackState']
[-] BattleContext `update()` post-update state : ToonAttackState
[+] BattleContext `update()` pre-update state : ToonAttackState
[+] `handle_attacks()` ToonAttackState
[+] Toon "Astro" (100/65hp) targets Cog lvl 4 "Micromanager" (3/30hp)
[-] `choose_attack()` : lvl 1 Throw "Fruit Pie Slice" ((4, 1), 10dmg)
[+] Toon "Ostra" (100/69hp) targets Cog lvl 4 "Micromanager" (3/30hp)
[-] `choose_attack()` : lvl 1 Throw "Fruit Pie Slice" ((4, 1), 10dmg)
[>] Gag Track : Throw
[-] Toon `do_attack()` "Astro" (100/65hp) Fruit Pie Slice hits lvl 4 "Micromanager" (-7/30hp) -> 3hp-10dmg
[-] Toon `do_attack()` "Ostra" (100/69hp) Fruit Pie Slice hits lvl 4 "Micromanager" (-17/30hp) -> -7hp-10dmg
[-] Cog lvl 4 "Micromanager" (-17/30hp) is defeated
[+] `transition_to()` transition : ToonAttackState -> CogAttackState
[-] `transition_to()` completed states : ['ToonAttackState', 'CogAttackState', 'ToonAttackState', 'CogAttackState', 'ToonAttackState']
[-] BattleContext `update()` post-update state : CogAttackState
[+] BattleContext `update()` pre-update state : CogAttackState
[+] `handle_attacks()` CogAttackState
[+] CogAttackState Cog lvl 2 "Flunky" (12/12hp) targets Toon "Ostra" (100/69hp)
[-] Cog `do_attack()` Skip lured lvl 2 "Flunky" (12/12hp)
[+] `transition_to()` transition : CogAttackState -> ToonAttackState
[-] `transition_to()` completed states : ['ToonAttackState', 'CogAttackState', 'ToonAttackState', 'CogAttackState', 'ToonAttackState', 'CogAttackState']
[-] BattleContext `update()` post-update state : ToonAttackState
[+] BattleContext `update()` pre-update state : ToonAttackState
[+] `handle_attacks()` ToonAttackState
[+] Toon "Astro" (100/65hp) targets Cog lvl 2 "Flunky" (12/12hp)
[-] `choose_attack()` : lvl 1 Throw "Fruit Pie Slice" ((4, 1), 10dmg)
[+] Toon "Ostra" (100/69hp) targets Cog lvl 2 "Flunky" (12/12hp)
[-] `choose_attack()` : lvl 1 Throw "Fruit Pie Slice" ((4, 1), 10dmg)
[>] Gag Track : Throw
[-] Toon `do_attack()` "Astro" (100/65hp) Fruit Pie Slice hits lvl 2 "Flunky" (2/12hp) -> 12hp-10dmg
[>] is_lured : True -> False on lvl 2 "Flunky" (2/12hp)
[-] Toon `do_attack()` "Ostra" (100/69hp) Fruit Pie Slice hits lvl 2 "Flunky" (-8/12hp) -> 2hp-10dmg
[-] Cog lvl 2 "Flunky" (-8/12hp) is defeated
[+] `transition_to()` transition : ToonAttackState -> WinState
[-] `transition_to()` completed states : ['ToonAttackState', 'CogAttackState', 'ToonAttackState', 'CogAttackState', 'ToonAttackState', 'CogAttackState', 'ToonAttackState']
[-] BattleContext `update()` post-update state : WinState
[+] BattleContext `update()` pre-update state : WinState
[+] `handle_win_lose()` WinState
[-] TODO #9, #37, #46
[+] `transition_to()` transition : WinState -> EndState
[-] `transition_to()` completed states : ['ToonAttackState', 'CogAttackState', 'ToonAttackState', 'CogAttackState', 'ToonAttackState', 'CogAttackState', 'ToonAttackState', 'WinState']
[-] BattleContext `update()` post-update state : EndState
[$] `calculate_rewards()` for all Toons
[>] "Ostra" (100/69hp) +2 Lure exp (lvl 1 Lure "Small Magnet" ((2, 1), 0dmg)) against lvl 2 "Flunky" (-8/12hp)
[>] "Ostra" (100/69hp) +2 Lure exp (lvl 1 Lure "Small Magnet" ((2, 1), 0dmg)) against lvl 4 "Micromanager" (-17/30hp)
[>] "Astro" (100/65hp) 0 Drop exp (lvl 1 Drop "Sandbag" ((6, 1), 18dmg)) against lvl 2 "Flunky" (-8/12hp)
[>] "Ostra" (100/69hp) 0 Trap exp (lvl 1 Trap "Rake" ((1, 1), 20dmg)) against lvl 4 "Micromanager" (-17/30hp)
[>] "Astro" (100/65hp) +4 Throw exp (lvl 3 Throw "Whole Fruit Pie" ((4, 3), 27dmg)) against lvl 4 "Micromanager" (-17/30hp)
[>] "Astro" (100/65hp) +2 Throw exp (lvl 1 Throw "Fruit Pie Slice" ((4, 1), 10dmg)) against lvl 4 "Micromanager" (-17/30hp)
[>] "Ostra" (100/69hp) +2 Throw exp (lvl 1 Throw "Fruit Pie Slice" ((4, 1), 10dmg)) against lvl 4 "Micromanager" (-17/30hp)
[>] "Astro" (100/65hp) +2 Throw exp (lvl 1 Throw "Fruit Pie Slice" ((4, 1), 10dmg)) against lvl 2 "Flunky" (-8/12hp)
[>] "Ostra" (100/69hp) +2 Throw exp (lvl 1 Throw "Fruit Pie Slice" ((4, 1), 10dmg)) against lvl 2 "Flunky" (-8/12hp)
[+] `calculate_rewards()` for Toon "Astro" (100/65hp)
[-] Total rewards for Toon "Astro" (100/65hp) : [0, 0, 0, 0, 8, 0, 0]
[+] `calculate_rewards()` for Toon "Ostra" (100/69hp)
[-] Total rewards for Toon "Ostra" (100/69hp) : [0, 0, 4, 0, 4, 0, 0]
[-] `calculate_rewards()` all rewards ...
.
Issue #83 should have resolved this issue. However, I want to close issue #82 and create proper tests before closing this issue.
I'm completely re-designing the Battle so this issue is no longer valid.
This scenario should never happen because you're not allowed to choose Trap against Lured Cogs