Jump to content

6A3- [Scripting] Completing existing abilities


Amethyst

Recommended Posts

  • Administrators

Before we move on to getting the new content into the game, it's probably best we patch-up the existing things. It'll be much easier to say "6th gen content is incomplete" than to say "Uhhh yeah some stuff from 6th gen works but some stuff from 4th/5th gen doesn't......."

SO

Let's be clear on exactly everything that needs doing, and as help becomes available, we can hopefully knock some of these things off the list.

Stench- OK
Drizzle- OK
Speed Boost- OK
Battle Armor- OK
Sturdy- OK
Damp- OK
Limber- OK
Sand Veil- OK
Static- OK
Volt Absorb- OK
Water Absorb- OK
Oblivious- OK
Cloud Nine- OK
Compound Eyes- OK
Insomnia- OK
Color Change- OK
Immunity- OK
Flash Fire- OK
Shield Dust- OK
Own Tempo- OK
Suction Cups- OK
Intimidate- OK
Shadow Tag- OK
Rough Skin- OK
Wonder Guard- OK
Levitate- OK
Effect Spore- OK
Synchronize- OK
Clear Body- OK
Natural Cure- OK
Lightningrod- Should absorb non-damaging moves as well
Serene Grace- OK
Swift Swim- OK
Chlorophyll- OK
Illuminate- OK
Trace- OK
Huge Power- OK
Poison Point- OK

Inner Focus- OK
Magma Armor- OK
Water Veil- OK
Magnet Pull- OK
Soundproof- OK
Rain Dish- OK
Sandstream- OK
Pressure- OK
Thick Fat- OK
Early Bird- OK
Flame Body- OK
Run Away- OK
Keen Eye- OK
Hyper Cutter- OK
Pickup- OK
Truant- OK
Hustle- OK
Cute Charm- OK
Plus- OK

Minus- OK

Forecast- OK

Sticky Hold- OK

Shed Skin- OK

Guts- OK

Marvel Scale- OK

Liquid Ooze- OK

Overgrow- OK

Blaze- OK

Torrent- OK
Swarm- OK

Rock Head- OK

Drought- OK

Arena Trap- OK

Vital Spirit- OK

White Smoke- OK

Pure Power- OK

Shell Armor- OK

Airlock- OK
Tangled Feet- OK
Motor Drive- Should absorb non-damaging moves as well
Rivalry- OK
Steadfast- OK
Snow Cloak- OK

Gluttony- OK
Anger Point- OK
Unburden- OK
Heatproof- OK
Simple- OK
Dry Skin- Should absorb non-damaging moves as well
Download- OK
Iron Fist- OK
Poison Heal- OK
Adaptability- OK
Skill Link- OK
Hydration- OK
Solar Power- OK
Quick Feet- OK
Normalize- OK
Sniper- OK
Magic Guard- Needs to be coded with Life Orb, after Life Orb is added. Theoretically OK otherwise. Needs to be tested.
No Guard- OK
Stall- OK
Technician- OK
Leaf Guard- OK
Klutz- OK
Mold Breaker- OK
Super Luck- OK
Aftermath- OK
Antici...

...pation- OK
Forewarn- OK
Unaware- OK
Tinted Lens- OK
Filter- OK
Slow Start- OK
Scrappy- OK
Storm Drain- Should absorb non-damaging moves as well
Ice Body- OK
Solid Rock- OK
Snow Warning- OK
Honey Gather- OK
Frisk- OK

Reckless- OK
Multitype- OK
Flower Gift- OK
Bad Dreams- OK
Pickpocket- OK

Sheer Force- OK

Contrary- OK
Unnerve- OK
Defiant- OK
Defeatist- OK
Cursed Body- OK
Healer- OK

Friend Guard- OK

Weak Armor- OK

Heavy Metal- OK

Light Metal- OK

Multiscale- OK
Toxic Boost- OK

Flare Boost- OK
Harvest- Not yet implemented

Telepathy- Not yet implemented
Moody- OK

Overcoat- Should now resist powder attacks too

Poison Touch- OK

Regenerator- OK

Big Pecks- OK

Sand Rush- OK

Wonder Skin- OK

Analytic- Not yet implemented

Illusion- Not yet implemented

Imposter- Currently crashes if the imposter ditto is leading the party

Infiltrator- "Currently doesn't work against Mist or Safeguard." Now should hit through Substitute too
Mummy- OK

Moxie- OK

Justified- OK
Rattled- OK

Magic Bounce- "In double battles, if a Pokémon with Magic Bounce gets hit by a non-attacking move that attacks both Pokémon on the team, it protects its ally as well. This should not happen; only the Pokémon with Magic Bounce should be protected."
Sap Sipper- "This should work fully with non-damaging Grass moves (e.g. Leech Seed), but currently doesn't. Only exception is Aromatherapy." There may be more exceptions with 6th gen. "Should only up Attack once for the whole of a multi-hitting Grass move." Should absorb non-damaging moves as well

Prankster- OK

Sand Force- OK
Iron Barbs- OK

Zen Mode- OK

Victory Star- OK
Turbo Blaze- Not yet implemented

Teravolt- Not yet implemented

If you're familiar with Ruby and want to take a shot at fixing some of these things, please PM me. I'll do what I can to get you set up with a copy of RMXP and our latest script version.

All changes to the code, however, will need to be documented. So, when posting a fix for one of these things, please post it in this topic. I'll then merge it into my master copy of the scripts.

Link to comment
Share on other sites

Hello! Here are my changes so far.

More to come.

Drizzle- Needs to be changed to weather lasting 5 turns after the user is switched in. Damp Rock increases this amount to 8. --- Done, 11/14/2013 (Edited for all weathers)


File: PokeBattle_Battler
Function: pbAbilitiesOnSwitchIn
Line number approx: 761


      # Weather

    if isConst?(ability,PBAbilities,:DRIZZLE) && onactive

      @battle.weather=PBWeather::RAINDANCE

      # UPDATE - 11/14

      # Changed weatherduration=5 unless DAMPROCK, then 8

      #@battle.weatherduration=-1

      @battle.weatherduration=5

      @battle.weatherduration=8 if isConst?(self.item,PBItems,:DAMPROCK)

      @battle.pbDisplay(_INTL("{1}'s Drizzle made it rain!",pbThis))

    end

    if isConst?(ability,PBAbilities,:SANDSTREAM) && onactive
      @battle.weather=PBWeather::SANDSTORM
      @battle.weatherduration=5
      @battle.weatherduration=8 if isConst?(self.item,PBItems,:SMOOTHROCK)
      @battle.pbDisplay(_INTL("{1}'s Sand Stream whipped up a sandstorm!",pbThis))
    end
    if isConst?(ability,PBAbilities,:DROUGHT) && onactive
      @battle.weather=PBWeather::SUNNYDAY
      @battle.weatherduration=5
      @battle.weatherduration=8 if isConst?(self.item,PBItems,:HEATROCK)
      @battle.pbDisplay(_INTL("{1}'s Drought intensified the sun's rays!",pbThis))
    end
    if isConst?(ability,PBAbilities,:SNOWWARNING) && onactive
      @battle.weather=PBWeather::HAIL
      @battle.weatherduration=5
      @battle.weatherduration=8 if isConst?(self.item,PBItems,:ICYROCK)
      @battle.pbDisplay(_INTL("{1}'s Snow Warning made it hail!",pbThis))
    end


Static- Must no longer affect Electric Types --- Done, 11/14/2013 - electric types can't be paralyzed anymore.


File: PokeBattle_Effects
Function: pbCanParalyze?
Line number approx: 245


  def pbCanParalyze?(showMessages)

    return false if hp<=0

    # UPDATE 11/14

    # Electric type can no longer be paralyzed

    if pbHasType?(:ELECTRIC)

      #@battle.pbDisplay("DEBUG - remove me, you can't be paralyzed")

      return false

    end


Volt Absorb- Needs to be changed to work with non-damaging Electric Moves. --- Done, 11/15/2013
Water Absorb- Needs to be changed to work with non-damaging Water Moves --- Done, 11/15/2013


File: PokeBattle_Battler
Function: pbSuccessCheck
Line number approx: 1634


    # UPDATE 11/15

    # first pass at fixing non-damaging moves not applying things like VOLTABSORB

    # this may have unintended side affects, although it seems functional so far.

    # Any potential problems are likely just verbose messages in a battle

    

    # changed from:

    #if thismove.basedamage>0 && thismove.function!=0x02 && # Struggle

    #  thismove.function!=0x111 # Future Sight

    # to:

    if thismove.function!=0x02 && thismove.function!=0x111

      type=thismove.pbType(thismove.type,user,target)

      # changed from: typemod=thismove.pbTypeModifier(type,user,target)

      typemod=thismove.pbTypeModMessages(type,user,target)

A little further down from the above...


     # UPDATE 11/16

     # should fix problems mentioned above

     # debugging

     #@battle.pbDisplay(_INTL("{1}", typemod))

     return false if typemod == 0

     # this was commented out and replaced by the above line

     # make sure you change typemod in the above changes!

      #if typemod==0

        #@battle.pbDisplay(_INTL("It doesn't affect\r\n{1}...",target.pbThis(true)))

        #return false

      #end


Oblivious- Must now block Taunt as well. --- Done, 11/16/2013


File: PokeBattle_MoveEffects
Class: PokeBattle_Move_0BA
Function: pbEffect
Line number approx: 4404


    # this was unchanged - just a reference of where the following needs to be placed.

    if opponent.effects[PBEffects::Taunt]>0

      @battle.pbDisplay(_INTL("But it failed!"))

      return -1

    end

    

    # UPDATE 11/16/2013

    # Oblivious now protects from taunt

    if isConst?(opponent.ability,PBAbilities,:OBLIVIOUS)

      @battle.pbDisplay(_INTL("It doesn't affect {1}...",opponent.pbThis(true)))

      return -1

    end


Color Change- "Should only activate after the last hit of a multi-hit move; currently activates after the first hit." --- Done, 11/16/2013


File: PokeBattle_Battler
Function: pbProcessMultiHitMove
Line number approx: 2128


# UPDATE 11/16

      # in order to get COLORCHANGE to work as intended, pbAbilitEffect

      # needs to be aware of if it is the `final hit`.

      # This isn't a very elegant solution - but it gets the job done.

      # changed from: @battle.pbAbilityEffect(thismove,user,target,damage)

      @battle.pbAbilityEffect(thismove,user,target,damage, i == numhits - 1) # last iteration, regardless of actual hits

File: PokeBattle_Battle
Function: pbAbilityEffect (changed the declaration here)
Line number approx: 1864


 # UPDATE 11/16

  # changed to understand if it was the final hit

  # only used for COLORCHANGE

  # A better solution should ultimately be taken, but this will work.

 

  # change from: def pbAbilityEffect(move,user,target,damage)

  def pbAbilityEffect(move,user,target,damage,finalhit=false)

File: PokeBattle_Battle
Function: pbAbilityEffect
Line number approx: 2002 ish
Hint: Search for :COLORCHANGE - it's only used once in the code - this goes within the if statement that uses it.


# UPDATE 11/16

      # first attempt at changing multi-hit functionality

      # (Also very sloppy)

      

      # replace these lines:

      #  target.type1=type

      #  target.type2=type

      #   pbDisplay(_INTL("{1}'s {2} made it the {3} type!",target.pbThis,

      #   PBAbilities.getName(target.ability),PBTypes.getName(type)))

      # with:

      if !move.pbIsMultiHit

        target.type1=type

        target.type2=type

        pbDisplay(_INTL("{1}'s {2} made it the {3} type!",target.pbThis,

         PBAbilities.getName(target.ability),PBTypes.getName(type)))

       elsif finalhit

         target.type1=type

         target.type2=type

         pbDisplay(_INTL("{1}'s {2} made it the {3} type!",

                         target.pbThis,

                         PBAbilities.getName(target.ability),

                         PBTypes.getName(type)

                         ))

       end


Flash Fire- Needs to be changed to work with non-damaging Fire Moves --- Done, 11/16/2013 - Should be fixed generically for any future non-damaging fire moves.


File: PokeBattle_Effects
Function: pbCanBurnFromFireMove?
Line number approx: 183


    # UPDATE 11/16

    # moved above if pbHasType? ...

    # allows for non-damaging fire moves to proc FLASHFIRE

    # move this if/end block above if pbHasType? ... end

    if isConst?(self.ability,PBAbilities,:FLASHFIRE) && isConst?(move.type,PBTypes,:FIRE)

      if !@effects[PBEffects::FlashFire]

        @effects[PBEffects::FlashFire]=true

        @battle.pbDisplay(_INTL("{1}'s {2} raised its Fire power!",pbThis,PBAbilities.getName(self.ability)))

      else

        @battle.pbDisplay(_INTL("{1}'s {2} made {3} ineffective!",pbThis,PBAbilities.getName(self.ability),move.name))

      end

      return false

    end

    if pbHasType?(:FIRE) && !isConst?(self.item,PBItems,:RINGTARGET)

      @battle.pbDisplay(_INTL("It doesn't affect {1}...",pbThis(true))) if showMessages

      return false

    end

    

    # was originally here ...

Edited by Amethyst
Link to comment
Share on other sites

Second batch of updates.

More to come.


Shield Dust- "Should negate only effects that affect the bearer, but currently negates all additional effects regardless." --- Done, 11/16/2013 - Flag `m` will need to be added to the appropriate moves.


File: PokeBattle_Battler
Function: pbProcessNonMultiHitMove
Line number approx: 1952


# Additional effect

    

    # UPDATE 11/16

    # Began using a new flag to determine if SHIELDDUST should be ignored (flag m)

    # This allows for the pbEffect of a move to deal damage and the pbAdditionalEffect

    # to affect self

    

    # changed from: if target.damagestate.calcdamage>0 &&

       #!isConst?(target.ability,PBAbilities,:SHIELDDUST)

    if target.damagestate.calcdamage>0 &&

      (!isConst?(target.ability,PBAbilities,:SHIELDDUST) || thismove.hasFlags?("m"))

This change is similar to the above for a different function
File: PokeBattle_Battler
Function: pbProcessMultiHitMove
Line number approx: 2072


      # Additional effect

      

      # UPDATE 11/16

      # exact same as the process pbProcessNonMultiHitMove changes

      

      # changed from: if !isConst?(target.ability,PBAbilities,:SHIELDDUST)

      if !isConst?(target.ability,PBAbilities,:SHIELDDUST) || thismove.hasFlags?("m")

*** This one is important - I added this function to simplify flag usage
File: PokeBattle_Move
General area: Place it after the `About the move` comment block
Line number approx: 136


# UPDATE 11/16

  # simplifies flag usage - can now ask hasFlags?("m")

  # to determine if flag `m` is set.

  # or also hasFlags?("abcdef") will also work if all flags are set

  # This makes it much easier for anyone not versed in bitwise operations

  # to define new flags.

  # Note: I tested most edge cases of this - although I could've missed something

  def hasFlags?(flag)

    # must be a string

    return false if !flag.is_a? String

    

    flag.each_byte do |c|

      # must be a lower case letter

      return false if c >  122 || c < 97

      n = c - 97 # number of bits to shift

      # if the nth bit isn't set

      return false if (@flags & (1 << n)) == 0

    end

    

    return true

  end


Suction Cups- Out of battle effect needs to be added: Increases hook rate when fishing from 65% to 98% --- Done, 11/16/2013
Sticky Hold- Out of battle effect needs to be added: Increases hook rate when fishing from 65% to 98% --- Done, 11/16/2013


File: PokemonField
Function: pbFishing
Line number approx: 1590


  # UPDATE 11/16

  # now set to 98 if first Pokemon has SUCTIONCUPS or STICKYHOLD

  abl      = $Trainer.party[0].ability

  increase = isConst?(abl, PBAbilities, :SUCTIONCUPS) || isConst?(abl, PBAbilities, :STICKYHOLD)

  # changed from: bitechance=65

  # changed from: hookchance=65

  bitechance= increase ? 98 : 65

  hookchance= increase ? 98 : 65


Shadow Tag- "A special message should be shown if fleeing is prevented because of this ability. What message?" ANSWER: "The wild Wobbuffet prevents escape with Shadow Tag!" - so that needs to be coded in. -- Also must not effect Ghost types --- Done, 11/16/2013 - This should hopefully address all abilities that prevent escape having a generic message. Only tested for Shadow Tag.



File: PokeBattle_Battle
Function: pbCanSwitch?
Line number approx: 1034


# ignore first if/end, it was unchanged - just a reference for where the update belongs.

    # Multi-Turn Attacks/Mean Look

    if !pbCanSwitchLax?(idxPokemon,pkmnidxTo,showMessages)

      return false

    end

    

    # UPDATE 11/16/2013

    # Ghost type can now escape from anything

    if thispkmn.pbHasType?(:GHOST)

      return true

    end

File: PokeBattle_Battle
Function: pbCanSwitch?
Line number approx: 1088


if opp

      abilityname=PBAbilities.getName(opp.ability)

      pbDisplayPaused(_INTL("{1}'s {2} prevents switching!",opp.pbThis,abilityname)) if showMessages

      

      # UPDATE 11/16

      # now displays the proper fleeing message iff you are attempting to flee

      # Note: not very elegant, but it should work.

      pbDisplayPaused(_INTL("{1} prevents escaping with {2}!", opp.pbThis, abilityname)) if !showMessages && pkmnidxTo == -1

      return false

    end

File: PokeBattle_Battle
Function: pbRun
Line number approx: 1433


# if/end is a reference point

    if !duringBattle && !pbCanSwitch?(idxPokemon,-1,false) # TODO: Use real messages

      # UPDATE 11/16

      # changes to pbCanSwitch? made the following message redundant.

      #pbDisplayPaused(_INTL("Can't escape!"))

      return 0

    end



Rough Skin- May stop EXP from being awarded; please test. --- ??? Could not reproduce for Rough Skin, Iron Barbs or Aftermath.
Aftermath- Currently seems to negate EXP Gain- needs to be fixed --- Could not reproduce
Effect Spore- Should no longer effect Grass types. Also must no longer paralyze electric types- but should not have a great chance of giving them other statuses instead. --- Done, 11/16/2013


File: PokeBattle_Battle
Function: pbAbilityEffect
Line number approx: 1904


# UPDATE 11/16/2013

      # effect spore no longer affects grass types

      # changed from: if isConst?(target.ability,PBAbilities,:EFFECTSPORE) && self.pbRandom(10)<3

      if !target.pbHasType?(:GRASS) &&

        isConst?(target.ability,PBAbilities,:EFFECTSPORE) && self.pbRandom(10)<3


Synchronize- "Bad poison is currently passed on as regular poison, and should be bad poison." Also out of battle, should make wild Pokemon have a 50% chance of having the same nature as the bearer, when leading the party. --- Done, 11/17/2013 - In combat portion - will address out of combat stuff soon.


File: PokeBattle_Battle
Function: pbAbilityEffect
Line number approx: 2065


 # UPDATE 11/17/2013

        # allows for transfering of `badly poisoned` instead of just poison.

        #changed from: tbattler.pbPoison(sbattler)

        tbattler.pbPoison(sbattler, sbattler.statusCount == 1)


Bounceback - Fixed a bug where it was stating that the receiving Pokemon was the one that bounced the move back --- 11/17/2013


File: PokeBattle_Battler
Function: pbChangeTarget
Line number approx: 1477


      # Target refers to the move's old user

      # UPDATE 11/17/2013

      # not a listed bug - but I came across it.

      # was previously stating the incorrect Pokemon name (not the one that bounced it back

      # but instead the one that received it).

      # changed from: @battle.pbDisplay(_INTL("{1} bounced the {2} back!",target.pbThis,thismove.name))

      @battle.pbDisplay(_INTL("{1} bounced the {2} back!",user.pbThis,thismove.name))


Lightningrod- Needs to be changed to work with non-damaging Electric Moves. --- Should have been fixed by my previous tweaks to get Voltabsorb working - I think I've seen it, not confirmed.

Keen Eye- Should now ignore all enemy evasion boosts --- Done, 11/17/2013 - not tested


File: PokeBattle_Move
Function: pbAccuracyCheck
Line number approx: 359


    # UPDATE 11/17/2013

    # keen eye should now ignore evasion increases

    # since in the above nothing can lower evasion, this will work

    # this is not a solution if the above code can lower evasion - that would

    # be counter-intuitive to keen-eye.

    evasion = 1 if isConst?(attacker.ability,PBAbilities,:KEENEYE)

    return @battle.pbRandom(100)<(baseaccuracy*accuracy/evasion)


Pickup- Ame broke it, she doesn't know why, halp --- Done, 11/17/2013
Arena Trap- Needs to no longer affect Ghost types --- Done, 11/16/2013 - See Shadow Tag.

Link to comment
Share on other sites

Round 3:

Double battles fix - Can no longer use items indefinitely in a double battle --- 11/17/2013


File: PokeBattle_ActualScene
Function: pbCommandMenuEx
Line number approx: 2111


      # UPDATE 11/17/2013

      # Fix for being able to take potions indefinitely in a double battle

      # changed from: elsif Input.trigger?(Input:: && index==2 && @lastcmd[0]!=2

      elsif Input.trigger?(Input:: && index==2 && @lastcmd[0]!=2 && @lastcmd[0]!=1

        # UPDATE --- Remove

        #Kernel.pbMessage(_INTL("Within pbCommandMenuEx: {1}", @lastcmd[0]))



Magnet Pull- When out of battle, should increase the chance of finding Steel Types by 50% --- Done, 11/19/2013


File: PokemonEncounters
General location: After pbMapEncounter, before pbEncounteredPokemon
Line number approx: 185-229


 # UPDATE 11/18/2013

  # the following functions were copied from PokeBattle_Pokemon and slightly

  # modified to fit the needs for this problem.

  # they are used to determine the type of possible pokemon encounters

  def hasType?(species, type)

    if type.is_a?(String) || type.is_a?(Symbol)

      return isConst?(type1(species),PBTypes,type)||isConst?(type2(species),PBTypes,type)

    else

      return type1==type || type2==type

    end

  end

  # Returns this Pokémon's first type.

  def type1(species)

    dexdata=pbOpenDexData

    pbDexDataOffset(dexdata,species,8)

    ret=dexdata.fgetb

    dexdata.close

    return ret

  end



# Returns this Pokémon's second type.

  def type2(species)

    dexdata=pbOpenDexData

    pbDexDataOffset(dexdata,species,9)

    ret=dexdata.fgetb

    dexdata.close

    return ret

  end

 

  # adjusts the chances of finding a Pokemon of type by mult

  # Note: This does NOT increase the find chance by mult (strictly speaking)

  # Since a random number is created between 0 <= r < sum of chances

  # Increasing these numbers will shift around the find rate of all of them.

  def shiftChances(chances, enctype, type, mult)

    

    for i in 0...chances.length

      pkmn = @enctypes[enctype][i]

      chances[i] *= mult if hasType?(pkmn[0], type)

      chances[i] = 1 if chances[i] < 1

      chances[i] = chances[i].to_i

    end

    

    return chances

  end

  # end of update

File: Same as above
Function: pbEncounteredPokemon
Line number approx: 238


 chances=EncounterTypes::EnctypeChances[enctype]

    

    # UPDATE 11/18/2013

    # I assumed multiple abilities would change the encounter rate.

    # (Apparently it's only Magnet Pull)

    # But if more exist in the future, this will make it easy to add them

    

    # First Pokemon has Magnet Pull

    if !$Trainer.party[0].egg?

      abl = $Trainer.party[0].ability

      if isConst?(abl,PBAbilities,:MAGNETPULL)

        chances = shiftChances(chances, enctype, :STEEL, 1.5)

      end

     

    end

    # end of update


Cute Charm- "When out of battle: If the bearer is at the front of the party, 2/3 chance of wild Pokémon being the opposite gender to the bearer, regardless of gender ratios (if possible)." --- Done, 11/19/2013
Synchronize- Out of battle, should make wild Pokemon have a 50% chance of having the same nature as the bearer, when leading the party. --- Done, 11/19/2013


File: PokemonEncounterModifiers
General area: Bottom of the file
Line number approx: Anything after 20


# UPDATE 11/19/2013

# Cute Charm now gives a 2/3 chance of being opposite gender

Events.onWildPokemonCreate+=proc {|sender,e|

  pokemon=e[0]

  if !$Trainer.party[0].egg?

    ourpkmn = $Trainer.party[0]

    abl = ourpkmn.ability

    if isConst?(abl, PBAbilities, :CUTECHARM) && rand(3) < 2

      pokemon.setGender(ourpkmn.gender == 0 ? 1 : 0)

    end

  end

}



# UPDATE 11/19/2013

# sync will now give a 50% chance of encountered pokemon having

# the same nature as the party leader

Events.onWildPokemonCreate+=proc {|sender,e|

  pokemon=e[0]

 

  if !$Trainer.party[0].egg?

    ours = $Trainer.party[0]

    if isConst?(ours.ability, PBAbilities, :SYNCHRONIZE) && rand(2) == 0

      pokemon.setNature(ours.nature)

    end

  end

}


Pressure- May have some inconsistencies in-battle (What inconsistencies?). Out of battle, should increase the chance of finding higher levels by 50% --- Done, 11/19/2013
Hustle- Should, when leading out of battle, increase the chance of finding higher leveled wild pokemon by 50% --- Done, 11/19/2013
Vital Spirit- "When out of battle if bearer is at the front of the party, ups chance of wild Pokémon being a higher level by 50%." --- Done, 11/19/2013


File: PokemonEncounters
Function: pbEncounteredPokemon
Line number approx: 267


    return nil if !encounter

    

    # UPDATE 11/19/2013

    # pressure, hustle and vital spirit will now have a 150% chance of

    # finding higher leveled pokemon in encounters

    if !Trainer.party[0].egg?

      abl = $Trainer.party[0].ability

      if (isConst?(abl, PBAbilities, :PRESSURE) ||

         isConst?(abl, PBAbilities, :HUSTLE)   ||

         isConst?(abl, PBAbilities, :VITALSPIRIT)) &&

         rand(2) == 0

         # increase the lower bound to half way in-between lower and upper

         encounter[1] += (encounter[2] - encounter[1]) / 2

       end

    end

    # end of update

    level=encounter[1]+rand(1+encounter[2]-encounter[1])

    return [encounter[0],level]

Edited by Guhorden
Link to comment
Share on other sites

Updates round 4:

Unburden- Not yet implemented --- Done, 11/19/2013


File: PokeBattle_Battler
Function: item=(value)
Line number approx: 114


  def item=(value)

    # UPDATE 11/19/2013

    # Initial pass for implementing UNBURDEN

    # pokemon has lost their item

    if @item != 0 && value == 0

      if isConst?(@ability, PBAbilities, :UNBURDEN) && !@unburdened

        @speed *= 2

        @unburdened = true

      end

    end

    # end update

    @item=value

    @pokemon.item=value if @pokemon

  end

Add this to the bottom of the list of attr_accessor fields in the top of this file


  # UPDATE 11/19/2013

  # Added to prevent unburdened

  attr_accessor :unburdened

File: same as above
Function header: def initialize(btl,index)
Line number approx: 143
Add this into the initialize function:


@unburdened   = false


Fix Fling --- Done, 11/21/2013


File: PokeBattle_MoveEffects
Class PokeBattle_Move_0F7
Line number approx: 6115


################################################################################

# User flings its item at the target.  Power and effect depend on the item.

################################################################################

class PokeBattle_Move_0F7 < PokeBattle_Move

  # UPDATE 11/21/2013

  # fix for fling not working at all

  # Ruby wasn't initializing this instance variable like other languages would

  # In my lack of knowledge of the language, I just made return from a function instead.

    def getDamagearray

      return {

     130 => [:IRONBALL],

     100 => [:ARMORFOSSIL,:CLAWFOSSIL,:COVERFOSSIL,:DOMEFOSSIL,:HARDSTONE,

             :HELIXFOSSIL,:OLDAMBER,:PLUMEFOSSIL,:RAREBONE,:ROOTFOSSIL,

             :SKULLFOSSIL],

      90 => [:DEEPSEATOOTH,:DRACOPLATE,:DREADPLATE,:EARTHPLATE,:FISTPLATE,

             :FLAMEPLATE,:GRIPCLAW,:ICICLEPLATE,:INSECTPLATE,:IRONPLATE,

             :MEADOWPLATE,:MINDPLATE,:SKYPLATE,:SPLASHPLATE,:SPOOKYPLATE,

             :STONEPLATE,:THICKCLUB,:TOXICPLATE,:ZAPPLATE],

      80 => [:DAWNSTONE,:DUSKSTONE,:ELECTIRIZER,:MAGMARIZER,:ODDKEYSTONE,

             :OVALSTONE,:PROTECTOR,:QUICKCLAW,:RAZORCLAW,:SHINYSTONE,

             :STICKYBARB],

      70 => [:BURNDRIVE,:CHILLDRIVE,:DOUSEDRIVE,:DRAGONFANG,:POISONBARB,

             :POWERANKLET,:POWERBAND,:POWERBELT,:POWERBRACER,:POWERLENS,

             :POWERWEIGHT,:SHOCKDRIVE],

      60 => [:ADAMANTORB,:DAMPROCK,:HEATROCK,:LUSTROUSORB,:MACHOBRACE,

             :ROCKYHELMET,:STICK],

      50 => [:DUBIOUSDISC,:SHARPBEAK],

      40 => [:EVIOLITE,:ICYROCK,:LUCKYPUNCH],

      30 => [:ABILITYURGE,:ABSORBBULB,:AMULETCOIN,:ANTIDOTE,:AWAKENING,

             :BALMMUSHROOM,:BERRYJUICE,:BIGMUSHROOM,:BIGNUGGET,:BIGPEARL,

             :BINDINGBAND,:BLACKBELT,:BLACKFLUTE,:BLACKGLASSES,:BLACKSLUDGE,

             :BLUEFLUTE,:BLUESHARD,:BURNHEAL,:CALCIUM,:CARBOS,

             :CASTELIACONE,:CELLBATTERY,:CHARCOAL,:CLEANSETAG,:COMETSHARD,

             :DAMPMULCH,:DEEPSEASCALE,:DIREHIT,:DIREHIT2,:DIREHIT3,

             :DRAGONSCALE,:EJECTBUTTON,:ELIXIR,:ENERGYPOWDER,:ENERGYROOT,

             :ESCAPEROPE,:ETHER,:EVERSTONE,:EXPSHARE,:FIRESTONE,

             :FLAMEORB,:FLOATSTONE,:FLUFFYTAIL,:FRESHWATER,:FULLHEAL,

             :FULLRESTORE,:GOOEYMULCH,:GREENSHARD,:GROWTHMULCH,:GUARDSPEC,

             :HEALPOWDER,:HEARTSCALE,:HONEY,:HPUP,:HYPERPOTION,

             :ICEHEAL,:IRON,:ITEMDROP,:ITEMURGE,:KINGSROCK,

             :LAVACOOKIE,:LEAFSTONE,:LEMONADE,:LIFEORB,:LIGHTBALL,

             :LIGHTCLAY,:LUCKYEGG,:MAGNET,:MAXELIXIR,:MAXETHER,

             :MAXPOTION,:MAXREPEL,:MAXREVIVE,:METALCOAT,:METRONOME,

             :MIRACLESEED,:MOOMOOMILK,:MOONSTONE,:MYSTICWATER,:NEVERMELTICE,

             :NUGGET,:OLDGATEAU,:PARLYZHEAL,:PEARL,:PEARLSTRING,

             :POKEDOLL,:POKETOY,:POTION,:PPMAX,:PPUP,

             :PRISMSCALE,:PROTEIN,:RAGECANDYBAR,:RARECANDY,:RAZORFANG,

             :REDFLUTE,:REDSHARD,:RELICBAND,:RELICCOPPER,:RELICCROWN,

             :RELICGOLD,:RELICSILVER,:RELICSTATUE,:RELICVASE,:REPEL,

             :RESETURGE,:REVIVALHERB,:REVIVE,:SACREDASH,:SCOPELENS,

             :SHELLBELL,:SHOALSALT,:SHOALSHELL,:SMOKEBALL,:SODAPOP,

             :SOULDEW,:SPELLTAG,:STABLEMULCH,:STARDUST,:STARPIECE,

             :SUNSTONE,:SUPERPOTION,:SUPERREPEL,:SWEETHEART,:THUNDERSTONE,

             :TINYMUSHROOM,:TOXICORB,:TWISTEDSPOON,:UPGRADE,:WATERSTONE,

             :WHITEFLUTE,:XACCURACY,:XACCURACY2,:XACCURACY3,:XACCURACY6,

             :XATTACK,:XATTACK2,:XATTACK3,:XATTACK6,:XDEFEND,

             :XDEFEND2,:XDEFEND3,:XDEFEND6,:XSPDEF,:XSPDEF2,

             :XSPDEF3,:XSPDEF6,:XSPECIAL,:XSPECIAL2,:XSPECIAL3,

             :XSPECIAL6,:XSPEED,:XSPEED2,:XSPEED3,:XSPEED6,

             :YELLOWFLUTE,:YELLOWSHARD,:ZINC],

      20 => [:CLEVERWING,:GENIUSWING,:HEALTHWING,:MUSCLEWING,:PRETTYWING,

             :RESISTWING,:SWIFTWING],

      10 => [:AIRBALLOON,:BIGROOT,:BLUESCARF,:BRIGHTPOWDER,:CHOICEBAND,

             :CHOICESCARF,:CHOICESPECS,:DESTINYKNOT,:EXPERTBELT,:FOCUSBAND,

             :FOCUSSASH,:FULLINCENSE,:GREENSCARF,:LAGGINGTAIL,:LAXINCENSE,

             :LEFTOVERS,:LUCKINCENSE,:MENTALHERB,:METALPOWDER,:MUSCLEBAND,

             :ODDINCENSE,:PINKSCARF,:POWERHERB,:PUREINCENSE,:QUICKPOWDER,

             :REAPERCLOTH,:REDCARD,:REDSCARF,:RINGTARGET,:ROCKINCENSE,

             :ROSEINCENSE,:SEAINCENSE,:SHEDSHELL,:SILKSCARF,:SILVERPOWDER,

             :SMOOTHROCK,:SOFTSAND,:SOOTHEBELL,:WAVEINCENSE,:WHITEHERB,

             :WIDELENS,:WISEGLASSES,:YELLOWSCARF,:ZOOMLENS]

    }

  end



  def pbMoveFailed(attacker,opponent)

    

    return trueif attacker.item==0 ||

                   @battle.pbIsUnlosableItem(attacker,attacker.item(true)) ||

                   pbIsPokeBall?(attacker.item(true)) ||

                   isConst?(attacker.ability,PBAbilities,:KLUTZ) ||

                   attacker.effects[PBEffects::Embargo]>0

    

    # This was added

    damagearray=getDamagearray

    # removed the @ signs in front of the rest of them

    for i in damagearray.keys

      data=damagearray[i]

      if data

        for j in data

          return false if isConst?(attacker.item,PBItems,j)

        end

      end

    end

    return false if pbIsBerry?(attacker.item)

    return true

  end



  def pbBaseDamage(basedmg,attacker,opponent)

    # Added - also removed @ symbols

    damagearray = getDamagearray

    for i in damagearray.keys

      data=damagearray[i]

      if data

        for j in data

          return i if isConst?(attacker.item,PBItems,j)

        end

      end

    end

    return 10 if pbIsBerry?(attacker.item)

    return 1

  end


Klutz- Not yet implemented --- ? Looks like it is implemented...
Ending a round moves the cursor back to FIGHT instead of the previously selected value --- 11/21/2013


File: PokeBattle_ActualScene
Function: pbCommandMenuEx
Line number approx: 2098


    # UPDATE 11/21/2013

    # end of round will put the cursor back on FIGHT now

    #changed from: cw2.index=@lastcmd[index]

    cw2.index=0


Sheer Force- Not yet implemented --- Done, 11/21/2013


I don't like this solution, but it should work fine.

File: PokeBattle_Battler
Function: pbProcessNonMultiHitMove
Line number approx: 1962 and 1996


    end

    # UPDATE 11/21/2013

    # Implementation of sheer force

    # Note: this is not ideal - I had to change an immutable field to be mutable

    # for this to work.

    temp = thismove.basedamage

    thismove.basedamage = (thismove.basedamage * 1.3).to_i if isConst?(user.ability, PBAbilities, :SHEERFORCE) && thismove.addlEffect > 0

    damage=thismove.pbEffect(user,target) # Recoil/drain, etc. are applied here

    thismove.basedamage = temp

    if user.hp<=0

      user.pbFaint # no return

    end


      if @battle.pbRandom(100)<addleffect

        # UPDATE 11/21/2013

        # Prevent additional effects from applying if sheer force

        thismove.pbAdditionalEffect(user,target) if !isConst?(user.ability, PBAbilities, :SHEERFORCE)

      end

File: PokeBattle_Move
Class: PokeBattle_Move
Line number approx: 24 (among the list of attr_reader and such)


  # UPDATE 11/21/2013

  # Changed from immutable to mutable to allow for sheer force

  # changed from: attr_reader(:basedamage)

  attr_accessor(:basedamage)



Stall- Not yet implemented --- Done, 11/23/2013


File: PokeBattle_Battle
Function: def pbPriority
Line number approx: 890


  # UPDATE 11/23/2013

  # implementing STALL

  def pbPriority

    if @usepriority

      # use stored priority if round isn't over yet

      return @priority

    end

    speeds=[]

    quickclaw=[]

    stall=[] # <--- Add this here

    lagtail=[] # <--- This too

    incense=[] # <--- ... and this

    priorities=[]

    temp=[]

    @priority.clear

    maxpri=0

    minpri=0

    # Calculate each Pokémon's speed

    

    ### Simplified below

    #speeds[0]=@battlers[0].pbSpeed

    #speeds[1]=@battlers[1].pbSpeed

    #speeds[2]=@battlers[2].pbSpeed

    #speeds[3]=@battlers[3].pbSpeed

    #quickclaw[0]=isConst?(@battlers[0].item,PBItems,:QUICKCLAW)

    #quickclaw[1]=isConst?(@battlers[1].item,PBItems,:QUICKCLAW)

    #quickclaw[2]=isConst?(@battlers[2].item,PBItems,:QUICKCLAW)

    #quickclaw[3]=isConst?(@battlers[3].item,PBItems,:QUICKCLAW)

    ###

    

    # Find the maximum and minimum priority

    for i in 0..3

      ### add these here

      speeds[i]    = @battlers[i].pbSpeed

      quickclaw[i] = isConst?(@battlers[i].item, PBItems, :QUICKCLAW)

      stall[i]     = isConst?(@battlers[i].ability, PBAbilities, :STALL)

      lagtail[i]   = isConst?(@battlers[i].item, PBItems, :LAGGINGTAIL)

      incense[i]   = isConst?(@battlers[i].item, PBItems, :FULLINCENSE)

      ###

      

      # For this function, switching and using items

Same file/function, slightly lower down
Line number approx: 961


          for i in 1..n-1

            if quickclaw[temp[i]] && usequickclaw

              cmp=(quickclaw[temp[i-1]]) ? 0 : -1 #Rank higher if without Quick Claw, or equal if with it

            elsif quickclaw[temp[i-1]] && usequickclaw

              cmp=1 # Rank lower

            # UPDATE 11/23/2013

            # stall ability

            # add the following two elsif blocks

            ####

            # ignored if we have full incense or lagging tail

            elsif stall[temp[i]] && !(incense[temp[i]] || lagtail[temp[i]])

              # if they also have stall

              if stall[temp[i-1]] && !(incense[temp[i-1]] || lagtail[temp[i-1]])

                # higher speed -> lower priority

                cmp=speeds[temp[i]] > speeds[temp[i-1]] ? 1 : -1

              elsif lagtail[temp[i-1]] || incense[temp[i-1]]

                cmp=-1

              else

                cmp=1

              end

            elsif stall[temp[i-1]] && !(incense[temp[i-1]] || lagtail[temp[i-1]])

              cmp= lagtail[temp[i]] || incense[temp[i]] ? 1 : -1

            # end of update

            elsif speeds[temp[i]]!=speeds[temp[i-1]]

              cmp=(speeds[temp[i]]>speeds[temp[i-1]]) ? -1 : 1 #Rank higher to higher-speed battler

            else

              cmp=0

            end

Link to comment
Share on other sites

More updates:

Pickpocket- "Should fail if the ability Sheer Force applies to the attack." --- Done, 11/29/2013


File: PokeBattle_Battle
Function: pbAbilityEffect
Line number approx: 2003


      # UPDATE 11/29/2013

      # Pickpocket now fails if user has sheer force

      # changed from: if isConst?(target.ability,PBAbilities,:PICKPOCKET) && target.hp>0

      if isConst?(target.ability,PBAbilities,:PICKPOCKET) &&

         target.hp>0 &&

         !isConst?(user.ability, PBAbilities, :SHEERFORCE)

      # end update


Contrary- Not yet implemented --- Done, 11/29/2013


File: PokeBattle_Effects
Function: pbIncreaseStat
Line number approx: 396


  # UPDATE 11/29/2013

  # Contrary

  # calls reduce stat from here if we have contrary

  # Added an extra parameter to determine if this was called from reduce stat

  # changed from: def pbIncreaseStat(stat,increment,showMessages,moveid=nil,attacker=nil,upanim=true)

  def pbIncreaseStat(stat,increment,showMessages,moveid=nil,attacker=nil,upanim=true, cont_call=false)

    

    # here we call reduce instead

    if isConst?(self.ability, PBAbilities, :CONTRARY) && !cont_call

      ret=pbReduceStat(stat,increment,showMessages,moveid,attacker,upanim,false,true)

      if !ret

        return pbReduceStat(stat,increment,showMessages,moveid,attacker,upanim,true,true)

      else

        return ret

      end

    end

    # end of update

File: PokeBattle_Effects
Function: pbReduceStat
Line number approx: 538


  # UPDATE 11/29/2013

  # Contrary

  # Call increase stat if we have contrary

  # Added another parameter to determine if we called from within increase

  # changed from: def pbReduceStat(stat,increment,showMessages,moveid=nil,attacker=nil,downanim=true,selfreduce=false)

  def pbReduceStat(stat,increment,showMessages,moveid=nil,attacker=nil,downanim=true,selfreduce=false, cont_call=false)



    # here we call increase if we have contrary

    return pbIncreaseStat(stat,increment,showMessages,moveid,attacker,downanim,true) if isConst?(self.ability, PBAbilities, :CONTRARY) && !cont_call

    # end of update


Default stat increase/decrease messages are no longer displayed when they shouldn't be --- 11/30/2013


File: PokeBattle_Effects
Function: pbIncreaseStat
Line number approx: 454 (Will be slightly off at this time - I've made undocumented changes to my own)


    if pbCanIncreaseStatStage?(stat,showMessages)

      @battle.pbAnimation(moveid,attacker,self) if moveid

      pbIncreaseStatBasic(stat,increment)

      @battle.pbCommonAnimation("StatUp",self,nil) if upanim

      # UPDATE 11/30/2013

      # Defiant / other ad hoc messages

      # add the `if showMessages` to the end of these lines

      if increment==3

        @battle.pbDisplay(arrStatTexts[2]) if showMessages

      elsif increment==2

        @battle.pbDisplay(arrStatTexts[1]) if showMessages

      else

        @battle.pbDisplay(arrStatTexts[0]) if showMessages

      end

File: same as above
Function: pbReduceStat
Line number approx: 594


      @battle.pbAnimation(moveid,attacker,self) if moveid

      pbReduceStatBasic(stat,increment)

      @battle.pbCommonAnimation("StatDown",self,nil) if downanim

      # UPDATE 11/30/2013

      # ad hoc messages fix

      # add the `if showMessages` condition after the pbDisplay s below

      if increment==2

        @battle.pbDisplay(arrStatTexts[1]) if showMessages

      else

        @battle.pbDisplay(arrStatTexts[0]) if showMessages

      end

      # end update


Defiant- Not yet implemented --- Done, 11/30/2013


File: PokeBattle_Effects
Function: pbReduceStat
Line number approx: 603
First update text is from the previous (for a positioning reference for the Defiant update)


      # UPDATE 11/30/2013

      # ad hoc messages fix

      # add the `if showMessages` condition after the pbDisplay s below

      if increment==2

        @battle.pbDisplay(arrStatTexts[1]) if showMessages

      else

        @battle.pbDisplay(arrStatTexts[0]) if showMessages

      end

      # end update

      # UPDATE 11/30/2013

      # Defiant

      if !selfreduce && isConst?(self.ability, PBAbilities, :DEFIANT)

        pbIncreaseStat(PBStats::ATTACK,2,false)

        @battle.pbDisplay(_INTL("Defiant sharply raised {1}'s Attack!", pbThis)) if showMessages

      end

      # end of update

      return true


Friend Guard- Not yet implemented --- Done, 11/29/2013


File: PokeBattle_Move
Function: pbCalcDamage
Line number approx: 881 (This is likely off slightly - it goes at the end of the function)
Code above and below is for placement reference.


    #Damage weighting

    if (options&NOWEIGHTING)==0

      random=85+@battle.pbRandom(16)

      damage=(damage*random/100).floor

    end

    if opponent.damagestate.critical

      damage*=2

    end

    

    # UPDATE 11/29/2013

    # Friend Guard

    # will now lower damage taken if ally has friend guard

    if @battle.doublebattle &&

    isConst?(opponent.pbPartner.ability, PBAbilities, :FRIENDGUARD)

      damage=(damage*0.75).floor

    end

    # end of update

    damage=1 if damage<1

    opponent.damagestate.calcdamage=damage

    return damage

  end

Edited by Guhorden
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...