nosas / OmniToon

[WIP] ToonTown AI - Python Plays ToonTown
3 stars 0 forks source link

Improve Toon attack selection #83

Closed nosas closed 3 years ago

nosas commented 3 years ago

We're seeing a lot of issues when selecting a viable Gag, especially when picking a Lure/Trap gag against Cogs that are already Lured/Trapped.

This is happening because we're allowing None value to be passed in for the target argument in Toon.choose_attack() when choosing an attack.

To correct this behavior, we're going to make the target arg a required argument and follow this pattern in ToonAttackState:

1. Get viable attacks against all Cogs
2. Randomly pick one viable attack Gags list to use
    2a. Must have at least 1 viable Gag in the list
    2b. If no viable Gags available for any target, we pass/stall
3. Randomly pick one attack from the viable 

This refactoring should fix issues #69, #71, #72

nosas commented 3 years ago

First thing to do is make choose_attack's target argument be mandatory. We're also going to change the target argument to targets, so we can pass in the list of possible targets.

nosas commented 3 years ago

Toon no longer has a .choose_attack() function, instead they return a list of possible/viable attacks against each target.