jojobear13 / shinpokered

Mostly-vanilla hack of Pokémon Red/Blue focused on bugfixes and trainer ai
209 stars 42 forks source link

(Rework limits on transform) Transformed ditto sometimes uses struggle #246

Closed DiabloStorm closed 12 months ago

DiabloStorm commented 1 year ago

No idea what causes it, goodluck tho.

I transformed into the transformed ditto after. All I have to say is...nice.

image image

jojobear13 commented 1 year ago

Note to self - possibly the same source issue as #244

EDIT: Not it's not.

jojobear13 commented 1 year ago

I know what's going on here.

Genger has:

Gengar uses mimic and copies transform.

Genger has:

Ditto uses transform. Here is where things get interesting. You may have heard about how gen 1 can get stuck in an endless loop if it's a ditto vs. a ditto because only transform can be used and the PP gets reset to 5 each time. A long time ago, I tried to avoid this situation by editing transform's effect to detect when it copies the opponent's transform move and change it to struggle. That way two dittos will would struggle-out against each other.

So after Ditto transforms, it's moves are:

And Gengar can transform once more to make its moves:

This should be revisited since enemy pokemon now obey PP limitations. It would be better to copy the transform move but set its PP to zero.

DiabloStorm commented 1 year ago

It would be better to copy the transform move but set its PP to zero.

Depends... for AI only or player also? If you fatfinger transform twice (doing it purposefully in this scenario only cuts the pp of all your moves, so most wouldn't...) if then you're greeted with 0 pp for transform after that mistake and wish to transform into a different, non-ditto pokemon(or non mew?), you now can't because a developer has made the pp zero.

jojobear13 commented 1 year ago

Transform's effect is coded to apply to both player and opponent equally.

Unfortunately, I'm having trouble seeing a way out. Stadium's solution was to hard-code it so that transform straight up fails if used against a ditto or if a ditto uses it against a 'mon that has transform (looks like they forgot about mew). Gen 2 was where it can't be used against a 'mon in a transformed state. The main problem is that transform perpetuates itself by refreshing move PP. There needs to be something that makes transform have a finite amount of PP in any one battle.

Here's another idea. Transform will detect when it copies the opponent's transform move. If the opponent has between [0, 5] PP for the move remaining, then it will copy that PP amount instead of loading a constant 5. That way the transform PP between player and opponent will gradually decrease in a transformation loop and end in a struggle battle.

jojobear13 commented 1 year ago

Implemented in 8a6ff7eaef32e990217de6328acee76e847c9e60

Transform will copy the opponent's Transform move. If the PP for it on the opponent is 5 or less, that PP value is copied as well and deducted by 1 (or a deduction of 2 if the opponent goes first and also uses Transform). Transform paradox loops now have a definite end state, and either player can continue to re-Transform for several turns in case switching or a KO occurs.