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

Don't double-use waffles #1365

Merged
merged 14 commits into from
Oct 1, 2023
Merged

Don't double-use waffles #1365

merged 14 commits into from
Oct 1, 2023

Conversation

dsimich
Copy link
Member

@dsimich dsimich commented Sep 19, 2023

Description

Currently double-use waffles. Trying to update code so that it doesn't do that.

How Has This Been Tested?

Running through normal Standard Sauceror for as quick a run as possible.

Checklist:

  • My code follows the style guidelines of this project.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have based my pull request against the main branch or have a good reason not to.

@dsimich
Copy link
Member Author

dsimich commented Sep 19, 2023

Latest Waffle.txt

gausie
gausie previously approved these changes Sep 20, 2023
Copy link
Contributor

@gausie gausie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@Alium58
Copy link
Member

Alium58 commented Sep 20, 2023

There is some weirdness going on in your log there

> [INFO] auto_combat initialized fighting [beefy bodyguard bat]: atk = 78. def = 74. HP = 77. LA = 52
Preference _auto_combatState changed from  to (it11311)
Preference auto_replaces changed from  to (1:beefy bodyguard bat:none:14)
Round 1: erct657 uses the waffle and uses the waffle!
Round 2: beefy bodyguard bat takes 2 damage.
Round 2: beefy bodyguard bat takes 3 damage.
Round 2: beefy bodyguard bat takes 6 damage.
Round 2: You lose 1 hit point
Adjusted combat item count: waffle (2)

1 - We shouldn't update auto_replaces unless the replacement works. Currently we assume it will work and track it before using the replacer. This is a bit of a refactor and could be in a different PR

2 - Having troubles lining up what is in log vs what your code is. Code seems that it would abort if we are going to replace the enemy, but log shows we got to round 2 before aborting for not being able to find a replacer. Which is good as we used waffle and don't want to use it again. Also why does log show combat state gets "replacer" added? That should always be added before using the waffle. Are you sure this code is the same as what you were using when log was generated?

@dsimich
Copy link
Member Author

dsimich commented Sep 21, 2023

There is some weirdness going on in your log there

> [INFO] auto_combat initialized fighting [beefy bodyguard bat]: atk = 78. def = 74. HP = 77. LA = 52
Preference _auto_combatState changed from  to (it11311)
Preference auto_replaces changed from  to (1:beefy bodyguard bat:none:14)
Round 1: erct657 uses the waffle and uses the waffle!
Round 2: beefy bodyguard bat takes 2 damage.
Round 2: beefy bodyguard bat takes 3 damage.
Round 2: beefy bodyguard bat takes 6 damage.
Round 2: You lose 1 hit point
Adjusted combat item count: waffle (2)

1 - We shouldn't update auto_replaces unless the replacement works. Currently we assume it will work and track it before using the replacer. This is a bit of a refactor and could be in a different PR

2 - Having troubles lining up what is in log vs what your code is. Code seems that it would abort if we are going to replace the enemy, but log shows we got to round 2 before aborting for not being able to find a replacer. Which is good as we used waffle and don't want to use it again. Also why does log show combat state gets "replacer" added? That should always be added before using the waffle. Are you sure this code is the same as what you were using when log was generated?

Yeah, the log was just showing that the couple of iterations of useItem I went through weren't effective. After I did the cigarette lighter trick of useItems($item[waffle], $item[none]); it works better and then after I fixed the combat tracking section in stage2 it works perfectly as expected. It uses 1 and logs it properly.

@dsimich dsimich closed this Sep 21, 2023
@dsimich dsimich reopened this Sep 21, 2023
@@ -375,7 +375,7 @@ string auto_edCombatHandler(int round, monster enemy, string text)
combat_status_add("banishercheck");
}

if (!combat_status_check("replacercheck") && canReplace(enemy) && auto_wantToReplace(enemy, my_location()))
if (!combat_status_check("replacercheck") && auto_wantToReplace(enemy, my_location()))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking out loud. Don't need to add support for parsing funkslinging like you did in the general combat code because Ed can't throw 2 items in a single round of combat. True fact?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never ran Ed but looking through the wiki that makes sense to me since you lose your skills and there is no funkslinging equivalent in the skill tree

{
return "item " + $item[waffle];
return useItems($item[waffle], $item[none]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return useItems($item[waffle], $item[none]);
return useItem($item[waffle]);

useItem() has handling for funkslinging, no need to complicate it unnecessarily.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It didn't work with useItem. It tried to double use them, BUT that was before I updated the replacer logger in stage2. Will try useItem again and see if it works now

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, useItem double uses waffle for some reason. I changed it back to useItem and this happened.
useItem waffle.txt

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could the issue be none vs nothing?
image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it still double use when using useItem + change useItem to have none as the second item?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm did a quick test by using 2 different custom combat scripts. One for each of the returned value above. Both resulted in only 1 waffle being used. So none vs nothing doesn't seem to be the issue

@Alium58 Alium58 merged commit edc175b into loathers:main Oct 1, 2023
1 check passed
@Alium58
Copy link
Member

Alium58 commented Oct 1, 2023

@Malibu-Stacey agree with you useItem should be used but isn't obvious why it double uses waffles. Folks are running into this issue so over rode you request and merged it. We can make an issue for it

@dsimich dsimich deleted the wafflefix branch October 1, 2023 20:06
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

Successfully merging this pull request may close these issues.

4 participants