The PokéCommunity Forums Fan Games Game Development Scripts & Tutorials
Essentials Script Gen I style Critical Hit probability

Scripts & Tutorials This forum is for scripts and code, as well as all kinds of tutorials, software, tools and so forth. Remember to give credit!
The thread revival limit does not apply here.

Reply
 
Thread Tools
  #1    
Old February 25th, 2017 (6:43 PM). Edited February 25th, 2017 by IceGod64.
IceGod64's Avatar
IceGod64 IceGod64 is offline
In the Lost & Found bin!
     
    Join Date: Oct 2008
    Location: Castelia City
    Age: 29
    Gender: Male
    Nature: Naive
    Posts: 623
    In PokeBattle_Pokemon, append the following line to the attr_accessor section:
    Code:
      attr_reader(:baseStats)     # Base Stats
    And now, in PokBattle_Move, replace the entire def pbIsCritical? with:
    Code:
      def pbIsCritical?(attacker,opponent)
        if !attacker.hasMoldBreaker
          if opponent.hasWorkingAbility(:BATTLEARMOR) ||
             opponent.hasWorkingAbility(:SHELLARMOR)
            return false
          end
        end
        return false if opponent.pbOwnSide.effects[PBEffects::LuckyChant]>0
        return true if pbCritialOverride(attacker,opponent)
        #A Jolteon is used. It's base speed stat is 130.
        b=attacker.pokemon.baseStats #Get the stat array.
          t = b[3]*100/512.round  #Jolteon's default threshold is about 25%
          t = b[3]*100/128.round if attacker.effects[PBEffects::FocusEnergy]>0
          t = b[3]*100/64.round  if hasHighCriticalRate?
        #For Jolteon, Focus Energy or a high crit move both add up to more than 100%
        if (attacker.inHyperMode? rescue false) && isConst?(self.type,PBTypes,:SHADOW)
          t*4
        end #Increased odds during hyper mode.
        if attacker.hasWorkingItem(:STICK) &&
           isConst?(attacker.species,PBSpecies,:FARFETCHD)
          t*2
        end
        if attacker.hasWorkingItem(:LUCKYPUNCH) &&
           isConst?(attacker.species,PBSpecies,:CHANSEY)
          t*2
        end
        t*2 if attacker.hasWorkingAbility(:SUPERLUCK)
        t*1.5 if attacker.hasWorkingItem(:RAZORCLAW)
        t*1.5 if attacker.hasWorkingItem(:SCOPELENS)
        return true if t>=rand(100)
        return false
      end
    So, what's the point?
    For the most part, Gen I's battle mechanics are indeed quite broken, and are undesirable to be used in a game - However, the critical hit probability, is quite an interesting exception. In Generation 1, Critical Hit Ratio is based on a Pokémon's base speed, rather than being a flat rate. Personally, I like this. The actual values, however, you may want to adjust. By default, Jolteon has a 25% chance of landing a critical hit, which is fine to me, but after using focue energy, his chance become over 100%. Moves with high critical hit ratios work similar, so you may want to alter the mechanics.

    Part of the Gen 1 mechanic that I DIDN'T bring over however, is the bug where using Focus Energy Accidentally DIVIDES your chances of getting a crit by 4, not multiplies. Because I'd consider that a bug. If you really want to do that for some reason, you can change the Focus Energy line to this:

    Code:
     t = b[3]*100/2048.round if attacker.effects[PBEffects::FocusEnergy]>0
    __________________

    Reply With Quote

    Relevant Advertising!

    Reply
    Quick Reply

    Sponsored Links
    Thread Tools

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off

    Forum Jump


    All times are GMT -8. The time now is 9:04 AM.