1. Welcome to Smogon! Check out the Smogon Info Hub for everything you need to know about starting out in the community. Don't forget to introduce yourself in the Introduction Thread, too!
  2. Welcome to Smogon Forums! Please take a minute to read the rules.

All Gens Past Gens Research Thread

Discussion in 'Ruins of Alph' started by Jellicent, May 15, 2014.

  1. Jellicent

    Jellicent
    is a member of the Site Staffis a Battle Server Administratoris a Smogon Social Media Contributoris a Super Moderatoris a Community Contributoris a Contributor to Smogonis a Smogon Media Contributor
    Ruiner of Alph

    Joined:
    Sep 28, 2011
    Messages:
    3,504
    Cheers, all. Welcome to the Past Gens Research Thread. Links to the most recent research threads of each of the older generations are compiled below as a handy resource. I don't expect this thread to see much use, but there are still potentially mechanics that need to be researched, and as such, it's best to consolidate it. There are a few ground rules, however~

    Don't use this thread for simple questions. We have an SQSA for that. You can ask mechanics-related questions, but look to see if they've already been answered in the older research threads. "How does X move work?" is not a good question. "Does X move still function in Y condition?" is a much better one. Be specific.

    This is not a discussion thread. We don't need to chat about how mechanics affect a metagame. We have plenty of other threads here for that sort of thing. Only post if you have a question concerning a game mechanic or if you are answering a question.

    Don't test mechanics on simulators. It should go without saying, since the simulators are based off our research. When testing, in-game is the preferred method and the best possible source. Please cite how you tested any mechanics or where you found any answers.

    This is only for past gens. Duh, that's in the title. XY research is here :P

    BW Research
    DPP Research
    ADV Research
    GSC Research
    RBY Research
  2. Crystal_

    Crystal_ I ruined RBY!
    is a Pokemon Researcheris a Smogon Media Contributoris a Contributor Alumnusis a Past SPL Winner

    Joined:
    Dec 20, 2009
    Messages:
    1,034
    I'm going to do a quite exhaustive research on Gen I & II mechanics. Ahem... for no particular reason. I hope it can be useful for either Pokemon simulators or just for future reference. Most of these things will probably be alerady known; ultimately the goal is to have a lot of information organized in the same thread. I'm going to skip information that has no impact on competitive battling, like mechanics and formulas for catching Pokemon, running away, gaining experience, Safari Zone...
    Please, if there's something in particular you'd want me to reseach, just ask!

    Generation I

    Main Battle Function

    Whenever a Pokemon enters the field:

    - Quarter its current Speed stat if paralyzed. Flooring applied. If Speed would become 0, it becomes 1.
    - Halve its current Attack stat if burned. Flooring applied. If Attack would become 0, it becomes 1.
    - Attack, Defense, Special, Speed, Evasion, and Accuracy stat mods are set to "+0".
    - All volatile status of the Pokemon sent out are cleared as well as Disable status (in case the previous Pokemon had any of them active). These include: using Bide, using Thrash/Petal Dance, flinched, charging up (e.g. Fly, Solarbeam...), using or being the target of a trap move (e.g. Wrap), invulnerabilty (from Fly/Dig), confused, protected by Mist, Focus Energy, substitute up, need to recharge, using Rage, seeded, bad poison (Toxic), Light Screen, Reflect, transformed.

    For each stat, the game keeps track of two separate stat values: the original, and a current stat affected by paralysis, burn and stat mods (both cap at 999 and have a minimum value of 1).

    Stat modifier ratios:
    From -6 to +6; first number is numerator, second number is denominatior. Flooring applied.

    -6: 25, 100
    -5: 28, 100
    -4: 33, 100
    -3: 40, 100
    -2: 50, 100
    -1: 66, 100
    +0: 1, 1
    +1: 15, 10
    +2: 2, 1
    +3: 25, 10
    +4: 3, 1
    +5: 35, 10
    +6: 4, 1

    During a turn: Who moves first?
    - If one Pokemon is using Quick Attack, whoever is using it
    - If one Pokemon is using Counter, whoever isn't using it
    - If neither, or both players are using Quick Attack or Counter, whoever's current Speed stat is higher.

    If enemy moves first:
    1. Execute enemy move*
    2. Player faint check (if so, turn is over)
    3. Substract health from enemy if poisoned/seeded/burned**
    4. Enemy faint check (if so, turn is over)
    5. Execute player move*
    6. Enemy faint check (if so, turn is over)
    7. Substract health from player if poisoned/seeded/burned**
    8. Player faint check (if so, turn is over)
    9. Reset player/enemy trapping move status (Wrap, etc) if player/enemy has no more attacks left in the sequence

    If player moves first:
    1. Execute player move*
    2. Enemy faint check (if so, turn is over)
    3. Substract health from player if poisoned/seeded/burned**
    4. Player faint check (if so, turn is over)
    5. Execute enemy move*
    6. Player faint check (if so, turn is over)
    7. Substract health from enemy if poisoned/seeded/burned**
    8. Enemy faint check (if so, turn is over)
    9. Reset player/enemy Trap move status (Wrap, etc) if player/enemy has no more attacks left in the sequence

    *
    Move selection is skipped if any of the following occurs (note that this does not imply that no move will be executed this turn, just that the player's main battle menu won't pop up; if a move is executed it will be the move contained in the player's last selected move address):
    - Under Rage effect
    - Needs to recharge
    - Thrashing about
    - Charging up for an attack (Fly/Dig and moves like Solarbeam)

    For the following cases, the main battle menu will pop up, but the move selection menu won't after clicking "Fight":
    - Under Bide effect
    - Asleep or frozen
    - Using Wrap or an equivalent attack
    - Opponent is using Wrap or an equivalent attack

    If a disabled move or a move with 0 PP is selected print the appropriate text and then print the menu again, so another move can be selected.

    If the "Fight" menu pops up, Struggle is loaded as the selected move by default. If no move can be selected due to all moves having 0 PP and/or being disabled, Struggle will be used.

    **
    - For each status, substract HP from the affected Pokemon equal to Min(X,Y), where X = floor(maxHP/16) and Y is its current HP. First Poison/Burn is applied, then Leech Seed. If the Pokemon is badly poisoned, multiply X by the "Toxic counter". (Leech Seed is applied even if the affected Pokemon just fainted to burn or poison).
    - This "Toxic counter" increments every time a badly poisoned Pokemon is substracted HP because of burn/posion/leech seed (player and enemy have separate toxic counters). Notice that a Pokemon can't be burned or normal poisoned if it's badly poisoned, but can still be seeded, leading to the Leech Seed/Toxic bug.
    - If X or Y HP was substracted as a result of Leech Seed, the other Pokemon gains X (not Y) HP. HP gain is also capped if the healed Pokemon's maximum HP is reached.


    Handle Status and Move Effects (execute player/enemy move)

    Either move has already been selected, or move selection has already been skipped.

    - Decrement sleep counter if Pokemon is asleep. Wake up when counter hits 0. Can't use move this turn.
    - If Pokemon is frozen, can't use move this turn.
    - If Pokemon is flinched, can't use move this turn. Remove flinched status.
    - If Pokemon is trapped (Wrap, etc.), can't use move this turn.
    - If Pokemon has to recharge from Hyper Beam, can't use move this turn (recharge instead). Remove Hyper Beam status.
    - Decrement Disable counter if active. Move no longer disabled when counter hits 0.
    - Decrement Confused counter if active. Pokemon no longer confused when counter hits 0.
    - Apply confusion: A confused Pokemon has a 50% chance (random number >= 128) to hit itself in confusion (can't use move this turn). If a Pokemon hurts itself in confusion, a 40 Base Powered attack is applied to it, using its Attack and Defense current stats. Critical Hit Test, Apply STAB and Type Matchup, and Apply Random Factor is skipped from the damage calculation mechanics. (*)
    - Apply paralysis: A paralyzed Pokemon has a 25% chance (random number < 64) to be fully paralyzed (can't use move this turn).
    - If a Pokemon hits itself in confusion or is fully paralyzed, remove Bide, thrashing about, charging up (e.g. Fly, Dig, SolarBeam, Skull Bash...), and using a trap move (Wrap, etc.) status. Note that removing charging up status does not remove the invulneravility status of Fly and Dig.
    - If Pokemon is (in the middle of) using Bide, decrement Bide counter. Unleash energy and remove Bide status if counter hits 0. If unleashing energy, skip Damage calculation mechanics (damage will be handled differently) and move hit/miss test (i.e. never miss), and don't decrement PP. If not unleashing energy (counter didn't hit 0) no move will be used this turn.
    - If Pokemon is (in the middle of) using Thrash or Petal Dance, decrement Thrashing About counter and don't decrement PP. If counter hits 0, clear thrashing about status and activate confused status.
    - If Pokemon is (in the middle of) using a Trap move (e.g Wrap), skip Damage calculation mechanics (deal damage equal to the damage dealt by the last attack used in battle) and move hit/miss test (i.e. never miss), and don't decrement PP. Decrement Trap move counter.
    - If Pokemon is charging up for an attack (e.g. Fly, SolarBeam), remove charging up and invulneravility status (bug: if charging up status was removed due to self-confusion or full paralysis, condition does not meet so invulneravility status stays).
    - Decrement PP of move used unless when specified before by "don't decrement PP" or unless one of the following status is active: Bide, Trashing about (already skipped anyway), multiple-hit attack (e.g. Double Kick), and Rage.
    - Damage calculation as well as move and move effect exclusive functions are executed now. (e.g. Sleep Powder putting the target to sleep, Swords Dance raising Attack, Explosion setting attacker's HP to 0, setting status bit and counters for moves like Thrash and Wrap, etc...). All moves except those with "No additional Effect" and some other exceptions have this (the exceptions are the moves whose effects are handled separately, like Counter or Mirror Move). (TODO: Move effects will be expanded in the last section: Move Effects).


    (*) Bug: If the confused Pokemon has a Substitute up, damage will be dealt to the opponent's Substitute instead. If the opponent doesn't have a Substitute up, no damage will be dealt.


    Damage Calculation Mechanics

    Non-damaging moves either skip all of this or only execute 1. and 2. (and 3., partly). In addition, special damage moves and Super Fang skip this damage calculation process and handle it their own way ("predefinied" damage).

    The following moves or the moves with the following effects skip everything:
    - Conversion
    - Haze
    - Teleport
    - Mist
    - Focus Energy
    - Confusion effect (e.g. Supersonic)
    - Heal effect (e.g. Recover)
    - Transform
    - Light Screen
    - Reflect
    - Poison effect (e.g. Poisonpowder)
    - Paralyze effect (e.g. Thunder Wave)
    - Substitute
    - Mimic
    - Leech Seed
    - Splash

    Other non-damaging moves execute only 1. and 2., returning early from 3. due to having 0 base power.

    1. CRITICAL HIT TEST

    Determine if current used move will be a critical hit. The following calculations are done:

    - Read attacker's Base Speed.
    - Divide it by 2. Floor the result.
    -
    --- If Focus Energy is NOT active: Multiply result so far by 2. Cap the result at 255.
    --- If Focus Energy is active: Divide result so far by 2. Floor the result.
    -
    --- If move used is NOT a high critical hit rate move: Divide result so far by 2 and floor the result
    --- If the move used is a hligh critical hit rate move: Multiply result so far by 4 and cap the result at 255

    - Compare the result with a random number from 0 through 255. If the random number is lower, the move will be a critical hit.

    2. GET DAMAGE VARIABLES

    First off, the game clear the address used to keep track of the last move's damage, and reads the current move's base power and type. Move may be physical or special.

    As described in Main Battle Function, Current defense stat means the stat with stat level modifications applied; Original defense stat means stat level modifications are ignored.

    1. Move is physical:

    - Take defenders's current Defense stat. If Reflect is active, double it (no cap).
    - If move is a critical hit, take original defense stat instead (this means that apart from stat levels, the Reflect boost is ignored too).
    - Take attacker's current Attack stat. If either the attacker's Attack stat or the defender's Defense stat (after Reflect boost) is equal or higher than 256, both stats are temporarily divided by 4 (flooring applied), and then modded by 256, for damage calculation only. (*) If the attacker's Attack would become 0, it becomes 1.
    - Take attacker's Level. Double it if the move was a Critical Hit.

    2. Move is special:

    - Take defenders's current Special stat. If Light Screen is active, double it (no cap).
    - If move is a critical hit, take original special stat instead (this means that apart from stat levels, the Light Screen boost is ignored too).
    - Take attacker's current Special stat. If either the attacker's Special stat or the defender's Special stat (after Light Screen boost) is equal or higher than 256, both stats are temporarily divided by 4 (flooring applied), and then modded by 256, for damage calculation only (*). If the attacker's Special would become 0, it becomes 1.
    - Take attacker's Level. Double it if the move was a Critical Hit.

    (*) This leads to a couple of bugs. If the attacker has over 255 Attack/Special and the defender less than 4 Defense/Special (possible only with a negative stat level), the stat would become 0 when divided by 4, and the game will freeze when trying to divide by 0 during damage calculation. The other bug is related to Reflect/Light Screen: since there's no cap, the stat can be as high as 999 * 2 = 1998 (with positive stat level); if it's higher than 1023, the defense value will become 256 points lower when modded by 256, leading to unusually high damage dealt. Moreover, Defense/Special stat of 512/513 will freeze the game during damage calculation (divide by 0 again) if Reflect/Light Screen is active.

    The resulting Attack/Special, Defense/Special and Level variables will be used in the damage formula for the damage calculation.


    3. DAMAGE CALCULATION

    As usual, even if I don't mention it anymore, every single division must be floored.

    Attack/Special (attacker), Defense/Special (defender) and Level (attacker) are taken from 2. GET DAMAGE VARIABLES, not from scratch. Needless to say, Attack and Defense are used for physical attacks, and Special and Special for special attacks.

    - Take the Defense value we got so far, and halve it if move used is Explosion or Selfdestruct.

    - If OHKO move, execute OHKO move effect function (see Move Effects) and skip the remaining of 3. DAMAGE CALCULATION.

    Every single step will output a result. The next step is applied over the last step's result.

    - Start off with Level, and multiply it by 2
    - Divide by 5
    - Add 2
    - Multiply by move's Base Power
    - Multiply by Attack/Special
    - Divide by Defense/Special
    - Divide by 50. Cap at 997
    - Add 2

    4. APPLY STAB & TYPE MATCHUP

    - Start off with the damage value after damage calculation
    - If move gets STAB, add damage/2.
    - If move is super-effective to target's Type 1, multiply by 20, then divide by 10
    - If move is neutral to target's Type 1, multiply by 10, then divide by 10
    - If move is not very effective to target's Type 1, multiply by 5, then divide by 10
    - If move is super-effective to target's Type 2, multiply by 20, then divide by 10
    - If move is neutral to target's Type 2, multiply by 10, then divide by 10
    - If move is not very effective to target's Type 2, multiply by 5, then divide by 10

    - If target is immune, the move misses.

    If damage becomes 0, the move is made to miss (this occurs when damage was either 2 or 3 prior to applying STAB/Type matchup, and target is 4x resistant to the move).


    Damage from a OHKO move will overflow if applied stab, but it will never become lower than 999 reglardless.

    5. APPLY RANDOM FACTOR

    - If damage is equal to 1, the random factor is not applied (and damage dealt is 1). Otherwise:
    - Start off with the damage value after applying STAB and Type matchup
    - Multiply by a random number between 217 and 255
    - Divide by 255
    - Cap at target's current HP
    - And finally, this is the damage that will be dealt to the target (unless the move misses; yes, damage is calculated before checking whether the move will miss).

    Move Hit/Miss Test

    Move hit/miss test occurs after damage calculation for every single damaging move, unless stated otherwise in Handle Status and Move Effects (execute player/enemy move). It doesn't occur yet for non-damaging moves.

    Non-damaging moves will only perform Move hit/miss test or any other type of accuracy test if it's executed as part of their exclusive effect functions. See section Move Effects.


    - Dream Eater misses against a non-sleeping target
    - If move is Swift, don't apply more checks (so yes, Swift NEVER misses)
    - Move misses if target has invulneravility status (flying/underground)
    - If target's Mist is active, any stat down move (Growl, Tail Whip, Leer, String Shot, Sand-Attack, Smokescreen, Kinesis, Flash, Screech) plus Conversion misses

    - Take move's accuracy (value in the range 0 - 255). Multiply it by attacker's accuracy level
    - Multply the result by defender's evasion level inverted (e.g. if evasion level = +3 -> use evasion level = -3)
    - Cap at 255. Minimum value is 1.
    - Generate a random number between 0 and 255. If the random number is greater or equal to the resulting accuracy, the move misses. If the move misses, clear Trap (e.g. Wrap) status from one or both players if active.

    Additionally, special checks are applied if the move used is Counter (other than this, Counter is hardcoded as a "No Additional Effect" move). However, rather than after APPLY RANDOM FACTOR these tests are executed between CRITICAL HIT TEST and GET DAMAGE VARIABLES.
    - Counter misses if the opponent's last selected move's Base Power is 0.
    - Counter misses if the opponent's last selected move's type is not Normal or Fighting, or if the move is Counter
    - Counter misses if the last move used in battle that is not present in the list shown in Damage Calculation Mechanics did no damage to its target. In other words, Counter misses if the damage address contains 0.
    - If these three tests were passed, damage dealt by Counter will be equal to twice the damage dealt by the last move used in battle (note that Counter might also miss later as a consequence of Move hit/miss test).


    Just like Counter, Mirror Move and Metronome also have special handlers. These occur between Move Hit/Miss Test and Apply Damage to Target.

    Mirror Move reads the move to use from a variable that is updated whenever the opponent uses a new move; in particular, when the text "[Pokemon] used [move]" (so even if that move missed). That variable is set to 0 whenever the opponent is fast asleep or frozen solid, or when a switch occurs in either side. Mirror Move misses if:

    - The variable contains Mirror Move (for that to happen, the opponent's Mirror Move must have missed, else the variable would've been overwritten with the move Mirror Move copied)
    - The variable contains 0
    If Mirror Move is succesful, the move that was read will be used, and go back to Damage Calculation Mechanics

    Metronome
    - Generate a random move excluding Metronome and Struggle
    - Go back to Damage Calculation Mechanics. The move used will be the random move genereated.

    Finally, If Jump Kick or Hi-Jump Kick was used and the move missed, the user takes 1 HP damage (this is a bug; a damage of floor[damage that would be dealt/8] was intended). In addition, if the Pokemon has a Substitute up, damage will be dealt to the opponent's Substitute instead. If the opponent doesn't have a Substitute up, no damage will be dealt.


    Apply Damage to Target

    If the damaging move didn't miss, damage is dealt to the target.

    - Super Fang deals damage equal to Max [floor(target's current HP/2) , 1]
    - Seismic Toss and Night Shade deal damage equal to the attacker's level.
    - Dragon Rage deals 40 damage.
    - Psywave: A random number between 0 and 255 is generated until it meets these two conditions: It's not 0 (*), and it's lower than Attacker's level + floor (Attacker's level/2). Damage dealt is equal to the last random number generated.
    - For other moves, damage was already calculated.
    - If the target doesn't have a Substitute up, apply damage to the Pokemon. Damage dealt becomes X = Min (Target's current HP , Calculated Damage), and X HP will be substracted from the target.
    - If the target has a Substiute up, apply damage to the Substitute. If the calculated damage is higher than 255, or higher than Substitute's current HP, the Substitute breaks (damage dealt can be higher than Substitute's current HP). Else, substract HP from the Substitute equal to the calculated damage.

    For multiple attack moves (e.g. Double Kick, Fury Attack), decrement the number of attacks left counter, and apply the attack until said counter hits 0. Damage calculation and accuracy tests are skipped for all attacks but the first one.

    (*) This is true for player side only. For enemy side, 0 is accepted and Psywave may deal 0 damage in that case. This can lead to desyncs in a link battle.

    Additional notes about damage calculation and how certain moves and effects affect the damage


    Move Effects

    Move-exclusive effects.

    Non-damaging move effects are always executed provided the move doesn't miss, but side effects of damaging moves may or will not be executed if the target is KO'd or if the target's Substitute is broken. Side effects occur after damage calculation (side effects are those with the word "side (effect)" in them).

    If the target is KO'd, only the following side effects are executed:
    - Drain HP effect (e.g. Absorb)
    - Explode effect (e.g. Explosion)
    - Dream Eater effect
    - Pay Day effect (irrelevant in link battle)
    - 2-5 hits effect (irrelevant because the loop to attack again finishes as soon as the target is KO'd)
    - Attack twice effect (irrelevant because the loop to attack again finishes as soon as the target is KO'd)
    - Recoil effect (e.g. Double-Edge)
    - Twineedle effect
    - Rage effect*

    *The Rage effect described below (under RAGE EFFECT) is executed first, but there's also a Rage handler. If the target has Rage status active and it's attack level is +5 or lower, turn is temporarilly given to the target and it will execute the STAT UP EFFECT 1 effect for the attack stat. This part only occurs if the target didn't faint.

    If the target's Substitute is broken, no side effect will be executed as the address that stores the move effect is cleared during Apply Damage to Target (not even Explode effect, Recoil effect, Drain HP effect, etc will occur).

    NO ADDITIONAL EFFECT

    Moves included: Moves with no additional effect (e.g. Surf), Mirror Move, Swift, Super Fang, Seismic Toss, Night Shade, Dragon Rage, Psywave, Jump Kick, Hi-Jump Kick, Metronome

    No effect in link battles or useless effect: Pay Day, Teleport, Roar, Whirlwind, Splash

    SLEEP EFFECT

    Moves included: Hypnosis, Spore, Lovely Kiss, Sleep Powder, Sing

    - Remove Hyper Beam (recharge) status from target
    - Fail against a Pokemon that is already sleeping
    - Fail against a Pokemon already frozen, burned, paralyzed, or poisoned, unless the target has Hyper Beam (recharge) status active (bug)
    - Apply Move Hit/Miss test unless the target has Hyper Beam (recharge) status active (bug)
    - Set target's Sleep counter to a random value between 1 and 7

    POISON EFFECT

    Moves included: Poison Gas, Poisonpowder, Toxic

    - Can't poison a Substitute target
    - Can't poison a Poison-type target
    - Apply Move Hit/Miss test. Poison the target if successful
    - Set Bad Poison status and reset Bad Poison counter if move used was Toxic

    POISON SIDE EFFECT 1

    Moves included: Poison Sting

    - Can't poison a Substitute target
    - Can't poison a Poison-type target
    - 52/256 chance to poison the target otherwise

    POISON SIDE EFFECT 2

    Moves included: Smog, Sludge

    - Can't poison a Substitute target
    - Can't poison a Poison-type target
    - 103/256 chance to poison the target otherwise


    BURN SIDE EFFECT 1

    Moves included: Fire Punch, Ember, Flamethrower


    - No side effect against a Substitute target. Otherwise:
    - Defrost the target is the move is a Fire-type
    - 0 chance to burn a target with a type matching the type of the move. 26/256 chance to burn any other target
    - If target is burned, its current Attack stat is halved immediately

    BURN SIDE EFFECT 2

    Moves included: Fire Blast

    - No side effect against a Substitute target. Otherwise:
    - Defrost the target is the move is a Fire-type
    - 0 chance to burn a target with a type matching the type of the move. 77/256 chance to burn the target
    - If target is burned, its current Attack stat is halved immediately


    FREEZE SIDE EFFECT

    Moves included: Ice Punch, Ice Beam, Blizzard


    - Can't freeze a Substitute target
    - 0 chance to freeze a target with a type matching the type of the move. 26/256 chance to freeze the target otherwise
    - Clear Hyper Beam (recharge) status from target

    PARALYSIS SIDE EFFECT 1

    Moves included: Thunderpunch, Thundershock, Thunderbolt, Thunder


    - Can't paralyze a Substitute target
    - 0 chance to paralyze a target with a type matching the type of the move. 26/256 chance to paralyze the target otherwise
    - If target is paralyzed, its current Speed stat is quartered immediately


    PARALYSIS SIDE EFFECT 2

    Moves included: Body Slam, Lick


    - Can't paralyze a Substitute target
    - 0 chance to paralyze a target with a type matching the type of the move. 77/256 chance to burn the target otherwise
    - If target is paralyzed, its current Speed stat is quartered immediately


    DRAIN HP SIDE EFFECT // DREAM EATER SIDE EFFECT

    Moves included: Absorb, Mega Drain, Leech Life, Dream Eater

    - Calculate max (floor[damage dealt/2] , 1) where damage dealt is taken from the damage address. Update damage dealt with the new value (might make a difference with Counter).
    - Add to the attacker's HP, HP equal to the (just updated) damage dealt. HP gain is capped if the healed Pokemon's maximum HP is reached.

    EXPLODE SIDE EFFECT

    Moves included:
    Selfdestruct, Explosion

    - Set attacker's current HP to 0.
    - Clear attacker's non-volatile status (sleep/burn/freeze/poison/paralysis) and seeded status.

    STAT UP EFFECT 1

    Moves included:
    Growth, Meditate, Double Team, Harden, Minimize, Withdraw, Defense Curl, Sharpen (do I really need to make a separate case for each stat effect?)

    - Raise corresponding stat level by +1, unless it's already +6
    - For Attack, Defense, Special, and Speed, recalculate the Pokemon's current stat (only the stat affected) according to the new stat level. Cap at 999.
    - Bug: When the stat gets recalculated, ignore any attack drop from burn and any speed drop from paralysis. If the opponent is burned or paralyzed, apply the corresponding stat penalties to him (again). This is a bug, for example: My opponent has 20 attack. During my turn, I use Ember and burn it, its attack stat becoming 10. In my next turn I use Double Team, a move under Stat Up effect 1 or Stat Up effect 2. Not only my Evasion will be raised due to Double Team's effect, but my opponent's attack stat will be halved again, becoming 5. Read more

    STAT UP EFFECT 2

    Moves included:
    Swords Dance, Agility, Barrier, Amnesia, Acid Armor (do I really need to make a separate case for each stat effect?)

    - Raise corresponding stat level by +1, unless it's already +6
    - Raise corresponding stat level by +1, unless it's already +6
    - For Attack, Defense, Special, and Speed, recalculate the Pokemon's current stat (only the stat affected) according to the new stat level. Cap at 999.
    - Bug: When the stat gets recalculated, ignore any attack drop from burn and any speed drop from paralysis. If the opponent is burned or paralyzed, apply the corresponding stat penalties to him (again). This is a bug, see explanation above, under Stat Up Effect 1.

    STAT DOWN EFFECT 1

    Moves included:
    Sand-Attack, Tail Whip, Leer, Growl, String Shot, Smokescreen, Kinesis, Flash

    - Miss against Substitute or invulnerability (Fly/Dig) status. Apply Move Hit/Miss test.
    -
    Decrement corresponding stat level by -1, unless it's already -6.
    - For Attack, Defense, Special, and Speed, recalculate the Pokemon's current stat (only the stat affected) according to the new stat level. Cap at 999, minimum is 1.
    - Bug: When the stat gets recalculated, ignore any attack drop from burn and any speed drop from paralysis. If the target is burned or paralyzed, apply the corresponding stat penalties to him (again). This is a bug, see explanation above, under Stat Up Effect. Read more

    STAT DOWN EFFECT 2

    Moves included: Screech

    - Miss against Substitute or invulnerability (Fly/Dig) status. Apply Move Hit/Miss test.
    -
    Decrement corresponding stat level by -1, unless it's already -6.
    - Decrement corresponding stat level by -1, unless it's already -6.
    - For Attack, Defense, Special, and Speed, recalculate the Pokemon's current stat (only the stat affected) according to the new stat level. Cap at 999, minimum is 1.
    - Bug: When the stat gets recalculated, ignore any attack drop from burn and any speed drop from paralysis. If the target is burned or paralyzed, apply the corresponding stat penalties to him (again). This is a bug, see explanation above, under Stat Up Effect 1.

    STAT DOWN SIDE EFFECT

    Moves included:
    Acid, BubbleBeam, Aurora Beam, Psychic, Constrict, Bubble

    - Doesn't occur against Substitute or invulnerability (Fly/Dig) status. Otherwise 85/256 chance to occur (~33.2%).
    - Decrement corresponding stat level by -1, unless it's already -6.
    - For Attack, Defense, Special, and Speed, recalculate the Pokemon's current stat (only the stat affected) according to the new stat level. Cap at 999, minimum is 1.
    - Bug: When the stat gets recalculated, ignore any attack drop from burn and any speed drop from paralysis. If the target is burned or paralyzed, apply the corresponding stat penalties to him (again). This is a bug, see explanation above, under Stat Up Effect 1.

    CONVERSION EFFECT

    Moves included:
    Convesion

    - Fail against an invulnerable target (Fly/Dig)
    - Convert user's Type 1 into enemy's Type 1 (for as long as the user stays in the field)

    HAZE EFFECT

    Moves included:
    Haze

    - Reset the stat levels of both players to 0
    - Reset the stats of both players to their original values
    - Clear the status (par/brn/frz/psn/slp) of the Pokemon who didn't use this move. That Pokemon won't use an attack this turn if a freeze or sleep status was cleared. Bug: If a Pokemon that was frozen or put to sleep with either Charging, Bide, Rage, or Thrashing About status active is cured Sleep or Freeze by Haze, that Pokemon will be unable to select and use a move for as long as it stays on the field (Rage may still build). This applies to Hyper Beam too but only if the status is freeze.
    - Clear Disable status from both players
    - Clear the following volatile statuses from both players: Confused, Mist, Focus Energy, Leech Seed, Bad Poison, Light Screen, Reflect

    BIDE EFFECT

    Moves included:
    Bide

    - Set attacker's Bide status and set Bide counter to a random number between 2 and 3

    THRASH EFFECT

    Moves included:
    Thrash, Petal Dance

    This effect is executed prior to damage calculation.

    - Set attacker's Thrashing About status and set Thrashing About counter to a random number between 2 and 3

    MULTIPLE ATTACKS SIDE EFFECT

    Moves included:
    DoubleSlap, Comet Punch, Double Kick, Fury Attack, Twineedle, Pin Missile, Spike Cannon, Barrage, Fury Sweepes, Bonemerang

    - Set attacking multiple times status
    - For Double Kick, Bonemerang, and Twineedle, set number of attacks counter to 2
    - For any of the other moves, set number of attacks counter to a random number between 2 and 5 with the following chances: 3/8 chance for 2 and 3, and 1/8 chance for 4 and 5.
    - Set Twineedle's effect to Poison Side Effect 1. This effect will be executed only when all the hits are over.

    FLINCH SIDE EFFECT 1

    Moves included:
    Bite, Bone Club, Hyper Fang

    - No side effect against a Substitute target
    - 26/256 chance to flinch the target (to set target's flinch status)
    - If successful, clear Hyper Beam (recharge) status from target

    FLINCH SIDE EFFECT 2

    Moves included:
    Stomp, Rolling Kick, Headbutt, Low Kick

    - No side effect against a Substitute target
    - 77/256 chance to flinch the target (to set target's flinch status)
    - If successful, clear Hyper Beam (recharge) status from target

    ONE HIT KO SIDE EFFECT

    Moves included: Fissure, Guillotine, Horn Drill

    This effect is executed durng damage calculation, as seen under Damage calculation mechanics

    - If the user's current speed is lower than the target's, the move misses
    - Set damage to 65535 otherwise (move may still miss due to APPLY STAB & TYPE MATCHUP i.e. immunities, or Move hit/miss test)

    CHARGE EFFECT

    Moves included:
    Razor Wind, Solar Beam, Dig, Skull Bash, Sky Attack, Fly

    - Set the user's charging status
    - Set the user's invulnerability status if the move is either Dig or Fly

    MIST EFFECT

    Moves included: Mist

    - Activate user's Mist status unless it's already active

    FOCUS ENERGY EFFECT

    Moves included: Focus Energy


    - Activate user's Focus Energy status unless it's already active

    RECOIL SIDE EFFECT

    Moves included: Take Down, Double-Edge, Submission, Struggle

    - Substract HP from user equal to floor(damage dealt/2) for Struggle or floor(damage dealt/4) for any other move.
    - If recoil damage is higher than the user's current HP, set its current HP to 0

    TRAPPING SIDE EFFECT

    Moves included:
    Wrap, Fire Spin, Bind, Clamp

    - Do nothing if user is already using a trapping move (trapping status already active)
    - Set user's trapping status
    - Set number of attacks counter to a random number between 2 and 5 with the following chances: 3/8 chance for 2 and 3, and 1/8 chance for 4 and 5.
    - Clear Hyper Beam (recharge) status from target

    CONFUSION SIDE EFFECT

    Moves included:
    Confusion, Psybeam

    - Do nothing if target is already confused
    - 25/256 chance to confuse the target
    - If successful, set target's confusion counter to a random number between 2 and 5

    CONFUSION EFFECT

    Moves included:
    Supersonic, Confuse Ray

    - Fail against Substitute
    - Apply Move Hit/Miss test
    - Do nothing if target is already confused
    - If successful, set target's confusion counter to a random number between 2 and 5

    PARALYZE EFFECT

    SUBSTITUTE EFFECT


    HYPER BEAM SIDE EFFECT

    Moves included:
    Hyper Beam

    - Ser user's Recharge status

    RAGE SIDE EFFECT

    Moves included:
    Rage

    - Ser user's Rage status

    MIMIC EFFECT

    Moves included:
    Mimic
    Last edited: Apr 8, 2015
  3. Xeze

    Xeze

    Joined:
    Dec 28, 2012
    Messages:
    113
    Two Gen II mechanics that are not correctly implemented on PO and probably on PS as well:
    - Counter and Mirror Coat always fail against a move selected by Sleep Talk. Currently Counter works against any attacking move Sleep Talk selects, which is wrong.
    - Encore fails if used on an opponent's Sleep Talk. Currently it locks the opponent into Sleep Talk, like in the newer gens.

    I did this research on an emulator using the link battle feature.
  4. magic9mushroom

    magic9mushroom

    Joined:
    Dec 7, 2012
    Messages:
    810
    What about that thing UPC mentioned where if the damage is >=768 it also doesn't apply the random factor? Are you saying that that was wrong?
  5. Crystal_

    Crystal_ I ruined RBY!
    is a Pokemon Researcheris a Smogon Media Contributoris a Contributor Alumnusis a Past SPL Winner

    Joined:
    Dec 20, 2009
    Messages:
    1,034
    Nope, the previous check only makes sure that if we are dealing 1 damage so far the random factor is skipped. I went as far as to check this in game as I did with a few other things so I'm 100% sure about it. I saw 1878 damage becoming 1811 damage, and 800-something being affected similarly too. It does seem to me that he (whoever wrote that in UPC) went through the same portion of code I went through and that he interpreted the "1 damage check" wrongly; if you switch the damage most significant byte of the current damage with the least significant byte (the order if which they get loaded), you get that the random factor is skiped for uhm... <512 damage, but if you interpret the compare instruction the other way around as well... you get that >=768.
  6. magic9mushroom

    magic9mushroom

    Joined:
    Dec 7, 2012
    Messages:
    810
    Understood. Glad we have that sorted out.
  7. Crystal_

    Crystal_ I ruined RBY!
    is a Pokemon Researcheris a Smogon Media Contributoris a Contributor Alumnusis a Past SPL Winner

    Joined:
    Dec 20, 2009
    Messages:
    1,034
    Done with RBY stuff. Can't say there no single mistake but I did make sure to test in the games anything I had trouble understanding at first from the code or some other things I didn't know about. Now it's about going through move and move effect exclusive functions (see last step in "Handle status and move effects") but the core of the battle mechanics is already covered.
  8. Disaster Area

    Disaster Area formerly Piexplode

    Joined:
    Oct 26, 2013
    Messages:
    1,740
    Crystal_ can you get that new info on counter here? :)
    Last edited: Dec 4, 2014
  9. Crystal_

    Crystal_ I ruined RBY!
    is a Pokemon Researcheris a Smogon Media Contributoris a Contributor Alumnusis a Past SPL Winner

    Joined:
    Dec 20, 2009
    Messages:
    1,034
    - Counter misses if the opponent's last selected move's Base Power is 0.
    - Counter misses if the opponent's last selected move's type is not Normal or Fighting, or if the move is Counter
    - Counter misses if the last move used in the battle (by either player) did no damage to its target. If Counter doesn't miss, damage dealt is based on this move's damage, even if it was the Counter user who used it.

    http://pokemon-online.eu/threads/rby-innacurate-counter-mechanics.29513/
    Joim and Disaster Area like this.
  10. Crystal_

    Crystal_ I ruined RBY!
    is a Pokemon Researcheris a Smogon Media Contributoris a Contributor Alumnusis a Past SPL Winner

    Joined:
    Dec 20, 2009
    Messages:
    1,034
    Filled up a lot of things. I'm going to start with move effects now. I think everything else is more or less covered.
    Joim and Disaster Area like this.
  11. Joim

    Joim Pixels matter
    is a member of the Site Staffis a Battle Server Administratoris a Programmeris an Administratoris a Tiering Contributor Alumnusis a Contributor Alumnusis a Smogon Media Contributor Alumnus
    Programmer

    Joined:
    Oct 9, 2012
    Messages:
    2,419
    Done and done.
    Disaster Area likes this.
  12. Crystal_

    Crystal_ I ruined RBY!
    is a Pokemon Researcheris a Smogon Media Contributoris a Contributor Alumnusis a Past SPL Winner

    Joined:
    Dec 20, 2009
    Messages:
    1,034
    Gamebreaking mechanic here (Gen 1): Paralysis side effects can't paralyze pokemon that are the same type of the attack (if dual type, either of the two types). e.g. Lick can't paralyze Gengar, Thunderbolt can't paralyze Zapdos/Jolteon and... Body Slam can't paralyze Tauros/Snorlax/Chansey. Note that this doesn't apply to non-side effects like Thunder Wave or Stun Spore. These have their own paralysis-only effect handler, while paralysis side effect is grouped with burn and freeze side effetcs.

    So yeah, as you can guess, this is the same mechanic used to make burn side effects unable to burn fire pokemon and freeze side effects unable to freeze ice pokemon. Moves with these side effects are always fire and ice type respectively.
  13. Disaster Area

    Disaster Area formerly Piexplode

    Joined:
    Oct 26, 2013
    Messages:
    1,740
    can someone who's not ICBB post a new thread to discuss this? It's sorta the biggest thing to affect RBY um ever? lol
    Longfellow likes this.
  14. Jorgen

    Jorgen World's Strongest Fairy
    is a Forum Moderator Alumnusis a Community Contributor Alumnusis a Contributor Alumnusis a Past SPL Winner

    Joined:
    Jun 5, 2010
    Messages:
    1,470
    Does this mean Twineedle can poison Poison-types but not Bug-types? Pardon me if this should be common knowledge-ish, but in my defense who seriously uses Beedrill?

    Also is there a link to the (commented please) bit of code that does this? We should have objective verification of this crazy new finding before we all lose our minds, it's kind of a big deal.
    Disaster Area likes this.
  15. Crystal_

    Crystal_ I ruined RBY!
    is a Pokemon Researcheris a Smogon Media Contributoris a Contributor Alumnusis a Past SPL Winner

    Joined:
    Dec 20, 2009
    Messages:
    1,034
    Poison side effect works differently. Instead of being ineffective to the Pokemon sharing the move's type, it's ineffecive to poison-types, as simple as that.

    Marcoasd didn't believe this so he wen't and did some testing in cartridge bodyslamming snorlax after snorlax (don't know the details).

    Other than that, this is the best proof I have, but I'm not sure how to explain it:

    [​IMG]

    I had just body slammed that rattata (this is a link battle btw), and I set a breakpoint at the paralysis/burn/freeze side effect routine. We are going to return from that routine before doing anything at line 0F:7329 because the type at CFD5 (move type) matches the type at CFEA (target first type). If they didn't match, CFD5 would be compared to CFEB (target second type) in case the second type matched. Prior to line 0F:7321 is stuff that makes the effect miss against substitute or an already statused mon and makes fire-type moves defrost the target. This is the code for player side, it has the equivalent code for opponent side (using the opposite variables)

    And here's it with (some) commentary: https://github.com/iimarckus/pokered/blob/master/engine/battle/core.asm#L7314
    Last edited: Dec 27, 2014
  16. Disaster Area

    Disaster Area formerly Piexplode

    Joined:
    Oct 26, 2013
    Messages:
    1,740
    (15:57) Marcoasd: yeah
    (15:57) Marcoasd: sadly
    (15:57) Marcoasd: i could not believe it
    (15:57) Marcoasd: when my snorlax ditto ended with no para
    (15:57) Marcoasd: three times

    Piexplode with all the insider details.

    lol

    if there's anything more to add to it I'm sure he can add it B]
    marcoasd and Crystal_ like this.
  17. breh

    breh 強いだね

    Joined:
    Feb 6, 2010
    Messages:
    3,236
    This might be a silly question to ask, but does gsc function the same way as rby here?
  18. Crystal_

    Crystal_ I ruined RBY!
    is a Pokemon Researcheris a Smogon Media Contributoris a Contributor Alumnusis a Past SPL Winner

    Joined:
    Dec 20, 2009
    Messages:
    1,034
    For freeze and burn, it does, with only one exception: if the move is normal-type i.e. tri-attack (at this point i'm not sure if tri attack can burn/freeze fire/ice mons).

    However, for paralysis it doesn't work the same; any pokemon can be paralyzed unless it's strictly immune to the move's type (e.g. thunder wave vs a ground type)
  19. breh

    breh 強いだね

    Joined:
    Feb 6, 2010
    Messages:
    3,236
    So the all-important Twinneedle is also unable to poison bug-types in gsc?
  20. Crystal_

    Crystal_ I ruined RBY!
    is a Pokemon Researcheris a Smogon Media Contributoris a Contributor Alumnusis a Past SPL Winner

    Joined:
    Dec 20, 2009
    Messages:
    1,034
    Yes
  21. marcoasd

    marcoasd

    Joined:
    Nov 18, 2013
    Messages:
    108
    Here you are:

    [​IMG]

    So yeah, basically "porco dio" is the main proof. I was unable to believe this wasn't nothing but a joke, but if you don't believe it, feel free to take a couple cartridges and spend a 6 Snorlax vs 6 Snorlax match trying to paraslam.
    Disaster Area and ZoroDark like this.
  22. Slayer95

    Slayer95 Wi-Fi Whitelisted
    is a Battle Server Administratoris a Programmeris a Forum Moderator
    Moderator

    Joined:
    Nov 14, 2013
    Messages:
    485
    If I am reading the code correctly, a random number is not grabbed for status when using Body Slam on a Normal type, is it?
  23. Crystal_

    Crystal_ I ruined RBY!
    is a Pokemon Researcheris a Smogon Media Contributoris a Contributor Alumnusis a Past SPL Winner

    Joined:
    Dec 20, 2009
    Messages:
    1,034
    Yes, basically since both types match, anything past line 7318 of that routine isn't executed. This skips the random number generation, which, when we return, is the same as if the number was generated but it wasn't low enough to make the effect occur (that is, the same as if re returned at line 7333).
  24. breh

    breh 強いだね

    Joined:
    Feb 6, 2010
    Messages:
    3,236
    I got tri attack to burn a vulpix in gold; I imagine it'll also freeze ice mons.
    Disaster Area and Crystal_ like this.
  25. trc

    trc it was ZINC
    is a Community Contributoris a Tiering Contributoris a Smogon Media Contributoris a Site Staff Alumnusis a Smogon Social Media Contributor Alumnusis a Forum Moderator Alumnusis a Contributor Alumnus

    Joined:
    Nov 16, 2013
    Messages:
    2,429
    [​IMG]
    we've been fools and we didn't even know

Users Viewing Thread (Users: 1, Guests: 0)