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

Cheek pouch fixes #2375

Closed
wants to merge 4 commits into from
Closed

Cheek pouch fixes #2375

wants to merge 4 commits into from

Conversation

hvk3
Copy link
Contributor

@hvk3 hvk3 commented Jan 14, 2016

Reference #2367

Now, the Berry's effect occurs first, and the healing takes place later.

@@ -1052,11 +1052,9 @@ BattlePokemon = (function () {
if (!sourceEffect && this.battle.effect) sourceEffect = this.battle.effect;
if (!source && this.battle.event && this.battle.event.target) source = this.battle.event.target;
item = this.getItem();
if (this.battle.runEvent('UseItem', this, null, null, item) && this.battle.runEvent('EatItem', this, null, null, item)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Without this line, berries will bypass Unnerve.

Copy link
Contributor

Choose a reason for hiding this comment

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

In fact, based on where you moved it, it means berries will bypass Unnerve, then they might possibly keep their item!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

On it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Might keep their item as in?

Copy link
Contributor

Choose a reason for hiding this comment

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

EatItem is actually a very important for making sure berries don't get consumed out of order, and is used in quite a few cases:

  • Unnerve blocking all berries
  • Heal Block blocking healing berries

The way the order is now, an eating message will appear, the effect will trigger, and then Unnerve will block the item from being "consumed" and the item will stay as held. Berry Pouch probably needs to activate in an event that occurs after EatItem, perhaps in AfterUseItem? We'll still have to do some extra checks for Bug Bite and whatnot (because those are not fixed yet)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should I continue working on this, or will Marty do it?

Copy link
Contributor

Choose a reason for hiding this comment

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

Continue working on this. The person assigned to a pull request is the one who reviews it before merging (usually), and Marty knows the most about game mechanics.

@hvk3
Copy link
Contributor Author

hvk3 commented Jan 14, 2016

Cheek pouch no longer activates with Unnerve. This was earlier causing problems, when the berry wasn't being consumed but cheek pouch was getting activated.

@@ -282,7 +282,10 @@ exports.BattleAbilities = {
desc: "If this Pokemon eats a Berry, it restores 1/3 of its maximum HP, rounded down, in addition to the Berry's effect.",
shortDesc: "If this Pokemon eats a Berry, it restores 1/3 of its max HP after the Berry's effect.",
onEatItem: function (item, pokemon) {
this.heal(pokemon.maxhp / 3);
let target = pokemon.side.foe.active[pokemon.side.foe.active.length - 1 - pokemon.position];
Copy link
Contributor

Choose a reason for hiding this comment

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

All opposing Pokemon with unnerve block berry consumption and you can't just check one of the Pokemon.

@ascriptmaster
Copy link
Contributor

You seem to have reverted your other changes regarding the cheek pouch activation order. Are you not going to work on that part any more?

@hvk3
Copy link
Contributor Author

hvk3 commented Jan 14, 2016

I tried to rectify the bigger problem first. Thinking about the other one.

Cheek pouch fix for all pokes
@hvk3
Copy link
Contributor Author

hvk3 commented Jan 14, 2016

Corrected the previous problem of checking with the first foe only.

let unnervecheck = false;
for (let i = 0; i < targets.length; i++) {
if (!targets[i] || targets[i].fainted) continue;
if (targets[i].ability.toString() === 'unnerve') {
Copy link
Member

Choose a reason for hiding this comment

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

And what if they have Gastro Acid?

Copy link
Member

Choose a reason for hiding this comment

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

(This is the entire reason hasAbility exists)

@Zarel
Copy link
Member

Zarel commented Jan 14, 2016

All my critiques here are pointless, though, since if you just wanted to fix the interaction with Unnerve, the correct way is to give a negative EatItemPriority (we usually use something like -100).

@Zarel
Copy link
Member

Zarel commented Jan 14, 2016

And if you wanted the right order, you'd probably want to rename EatItem to TryEatItem and have a normal EatItem event after Eat.

@Marty-D
Copy link
Collaborator

Marty-D commented Jan 14, 2016

Beyond all of the above, this code assumes it's impossible to eat a Berry while the opponent has Unnerve active. Consider the case where your opponent has Unnerve and you have Cheek Pouch. If you use Bug Bite on something, steal and eat a Liechi Berry for example, you get +1 Attack and then Cheek Pouch activates. This is entirely possible, if improbable.

Edit: Apparently stealing and eating a Berry isn't even activating Cheek Pouch as it is. Another bug for the Cheek Pouch list!

@Zarel
Copy link
Member

Zarel commented Jan 14, 2016

Note that the changes I suggested above (changing Priority or introducing TryEatItem) would fix all the problems mentioned above.

@hvk3
Copy link
Contributor Author

hvk3 commented Jan 19, 2016

Zarel, using TryEatItem is rendering Unnerve completely useless, since now any Pokemon can consume its Berry even though the opponent has Unnerve. Any suggestions on how to use Priority?

@Zarel
Copy link
Member

Zarel commented Jan 19, 2016

You're not using TryEatItem correctly. Unnerve should return false to TryEatItem. And if TryEatItem fails, the pokemon should not eat the berry.

@hvk3
Copy link
Contributor Author

hvk3 commented Jan 19, 2016

Doesn't work. With unnerve, tryuseitem returns the held berry's name.

@hvk3
Copy link
Contributor Author

hvk3 commented Jan 19, 2016

^Ignore that :S.

@Slayer95 Slayer95 added the WIP label Jan 23, 2016
@hvk3
Copy link
Contributor Author

hvk3 commented Jan 23, 2016

Should I close this? I'm getting nowhere with it :/

@Marty-D
Copy link
Collaborator

Marty-D commented Jan 23, 2016

Since this doesn't appear to have anything to do with Cheek Pouch anymore, I'll just close it for you.

I fixed those tooltips in smogon/pokemon-showdown-client@209b49a, by the way, which I've already pointed out to you.

@Marty-D Marty-D closed this Jan 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants