Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What determines pet ability priority in event of an attack tie? #89

Open
jolpica opened this issue Sep 25, 2022 · 1 comment
Open

What determines pet ability priority in event of an attack tie? #89

jolpica opened this issue Sep 25, 2022 · 1 comment

Comments

@jolpica
Copy link

jolpica commented Sep 25, 2022

It is stated that pet priority is determined by health in the event of a tie.

In a versus battle against myself, running these mosquitos over and over always lead to the right-hand mosquito going first

  • When they had equal 2-2 stats at level 1
  • When left was 4-4 level 2, and right was 4-4 level 1
  • When left was 4-5 level 2, and right was 4-4 level 1

Not sure if this is versus exclusive, or effects arena mode the same, but it seems that health does not prioritise pets at all.
Also seems that on attack ties, the outcome is not random as something (maybe player data?) always favours one team over the other.
Screenshot_4

Should the health tie-break be removed? (and possibly the random tie-break)?

@manny405
Copy link
Owner

You are correct. This was done very early and is obviously not how the game operates.

The health tie-break should be removed and a random tie-break needs to be added. With this change, random-state updating will need to be included so battles can continue to be seeded for a deterministic outcome.

For example:

def test_spider_fly(self):
ref_team = Team(["zombie-fly", "spider", "turtle", "fly"], battle=True)
ref_team[0].obj._attack = 4
ref_team[0].obj._health = 4
ref_team[1].obj._attack = 1
ref_team[1].obj._health = 1
ref_team[1].obj.level = 3
### Spider spaws everything at 2/2
ref_team[2].obj._attack = 2
ref_team[2].obj._health = 2
ref_team[2].obj.level = 3
ref_team[3].obj.ability_counter = 1
seed_state = np.random.RandomState(seed=3).get_state()
t0 = Team(["spider", "fly"], seed_state=seed_state)
t0[0].obj.eat(Food("mushroom"))
t0[0].obj.level = 3
t0[0].obj._health = 1
t1 = Team(["dolphin"])
b = run_sob(t0, t1)
self.assertEqual(minimal_state(b.t0), minimal_state(ref_team))

@jolpica jolpica mentioned this issue Sep 27, 2022
manny405 pushed a commit that referenced this issue Sep 29, 2022
* use self in update_pet_priority and rename to calculate_pet_priority

* add pet priority tests

* refactor calculate_pet_priority fixes: #89

* use f-strings and type annotations

* use f-strings and type annotations

* remove comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants