Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/Data/Scripts.rxdata/[005] Sockets.rb b/Data/Scripts.rxdata/[005] Sockets.rb
- index da941b4..3cecf74 100644
- --- a/Data/Scripts.rxdata/[005] Sockets.rb
- +++ b/Data/Scripts.rxdata/[005] Sockets.rb
- @@ -204,21 +204,21 @@ class Socket
- SO_SNDBUF = 4097
- SO_RCVBUF = 4098
- SO_SNDLOWAT = 4099
- - TCP_NODELAY = 1
- + TCP_NODELAY = 1
- MSG_OOB = 1
- MSG_PEEK = 2
- MSG_DONTROUTE = 4
- - IP_OPTIONS = 1
- - IP_DEFAULT_MULTICAST_LOOP = 1
- - IP_DEFAULT_MULTICAST_TTL = 1
- - IP_MULTICAST_IF = 2
- - IP_MULTICAST_TTL = 3
- - IP_MULTICAST_LOOP = 4
- - IP_ADD_MEMBERSHIP = 5
- - IP_DROP_MEMBERSHIP = 6
- - IP_TTL = 7
- - IP_TOS = 8
- - IP_MAX_MEMBERSHIPS = 20
- + IP_OPTIONS = 1
- + IP_DEFAULT_MULTICAST_LOOP = 1
- + IP_DEFAULT_MULTICAST_TTL = 1
- + IP_MULTICAST_IF = 2
- + IP_MULTICAST_TTL = 3
- + IP_MULTICAST_LOOP = 4
- + IP_ADD_MEMBERSHIP = 5
- + IP_DROP_MEMBERSHIP = 6
- + IP_TTL = 7
- + IP_TOS = 8
- + IP_MAX_MEMBERSHIPS = 20
- EAI_ADDRFAMILY = 1
- EAI_AGAIN = 2
- EAI_BADFLAGS = 3
- diff --git a/Data/Scripts.rxdata/[019] Game_Character.rb b/Data/Scripts.rxdata/[019] Game_Character.rb
- index af7da18..911c70d 100644
- --- a/Data/Scripts.rxdata/[019] Game_Character.rb
- +++ b/Data/Scripts.rxdata/[019] Game_Character.rb
- @@ -132,9 +132,7 @@ class Game_Character
- end
- def lock
- - if @locked
- - return
- - end
- + return if @locked
- @prelock_direction = @direction
- turn_toward_player
- @locked = true
- @@ -145,9 +143,7 @@ class Game_Character
- end
- def unlock
- - unless @locked
- - return
- - end
- + return unless @locked
- @locked = false
- unless @direction_fix
- if @prelock_direction != 0
- @@ -158,12 +154,12 @@ class Game_Character
- def triggerLeaveTile
- if @oldX && @oldY && @oldMap &&
- - (@oldX!=self.x || @oldY!=self.y || @oldMap!=self.map.map_id)
- + (@oldX!=self.x || @oldY!=self.y || @oldMap!=self.map.map_id)
- Events.onLeaveTile.trigger(self,self,@oldMap,@oldX,@oldY)
- - end
- - @oldX=self.x
- - @oldY=self.y
- - @oldMap=self.map.map_id
- + end
- + @oldX=self.x
- + @oldY=self.y
- + @oldMap=self.map.map_id
- end
- def moveto(x, y)
- @@ -182,15 +178,10 @@ class Game_Character
- def screen_y
- y = (@real_y - self.map.display_y + 3) / 4 + (Game_Map::TILEHEIGHT)
- if jumping?
- - if @jump_count >= @jump_peak
- - n = @jump_count - @jump_peak
- - else
- - n = @jump_peak - @jump_count
- - end
- + n = (@jump_count - @jump_peak).abs
- return y - (@jump_peak * @jump_peak - n * n) / 2
- - else
- - return y
- end
- + return y
- end
- def screen_y_ground
- @@ -204,26 +195,26 @@ class Game_Character
- z = (@real_y - self.map.display_y + 3) / 4 + 32
- if @tile_id > 0
- return z + self.map.priorities[@tile_id] * 32
- - else
- - # Add z if height exceeds 32
- - return z + ((height > 32) ? 31 : 0)
- end
- + # Add z if height exceeds 32
- + return z + ((height > 32) ? 31 : 0)
- end
- def bush_depth
- if @tile_id > 0 or @always_on_top
- return 0
- end
- - xbehind=(@direction==4) ? @x+1 : (@direction==6) ? @x-1 : @x
- - ybehind=(@direction==8) ? @y+1 : (@direction==2) ? @y-1 : @y
- - if @jump_count <= 0 and self.map.deepBush?(@x, @y) and
- - self.map.deepBush?(xbehind, ybehind)
- - return 32
- - elsif @jump_count <= 0 and self.map.bush?(@x, @y) and !moving?
- - return 12
- - else
- - return 0
- + if @jump_count <= 0
- + xbehind=(@direction==4) ? @x+1 : (@direction==6) ? @x-1 : @x
- + ybehind=(@direction==8) ? @y+1 : (@direction==2) ? @y-1 : @y
- + if self.map.deepBush?(@x, @y) and self.map.deepBush?(xbehind, ybehind)
- + return 32
- + end
- + if self.map.bush?(@x, @y) and !moving?
- + return 12
- + end
- end
- + return 0
- end
- def terrain_tag
- @@ -233,13 +224,24 @@ class Game_Character
- # Updating stuff ###############################################################
- def update
- return if $game_temp.in_menu
- - if jumping?
- - update_jump
- - elsif moving?
- - update_move
- - else
- - update_stop
- + if jumping?; update_jump
- + elsif moving?; update_move
- + else; update_stop
- end
- + if @wait_count > 0
- + @wait_count -= 1
- + elsif @move_route_forcing
- + move_type_custom
- + elsif !@starting && !lock?
- + if @stop_count > (40 - @move_frequency * 2) * (6 - @move_frequency)
- + case @move_type
- + when 1; move_type_random
- + when 2; move_type_toward_player
- + when 3; move_type_custom
- + end
- + end
- + end
- + @anime_count=20 if not @step_anime and @stop_count > 0
- if @anime_count > 18 - @move_speed * 3
- if not @step_anime and @stop_count > 0
- @pattern = @original_pattern
- @@ -248,27 +250,6 @@ class Game_Character
- end
- @anime_count = 0
- end
- - if @wait_count > 0
- - @wait_count -= 1
- - return
- - end
- - if @move_route_forcing
- - move_type_custom
- - return
- - end
- - if @starting or lock?
- - return
- - end
- - if @stop_count > (40 - @move_frequency * 2) * (6 - @move_frequency)
- - case @move_type
- - when 1
- - move_type_random
- - when 2
- - move_type_toward_player
- - when 3
- - move_type_custom
- - end
- - end
- end
- def update_jump
- @@ -284,15 +265,15 @@ class Game_Character
- distance = 2 ** @move_speed
- realResX=Game_Map.realResX
- realResY=Game_Map.realResY
- - if @y * realResY > @real_y
- - @real_y = [@real_y + distance, @y * realResY].min
- - end
- if @x * realResX < @real_x
- @real_x = [@real_x - distance, @x * realResX].max
- end
- if @x * realResX > @real_x
- @real_x = [@real_x + distance, @x * realResX].min
- end
- + if @y * realResY > @real_y
- + @real_y = [@real_y + distance, @y * realResY].min
- + end
- if @y * realResY < @real_y
- @real_y = [@real_y - distance, @y * realResY].max
- end
- @@ -309,9 +290,6 @@ class Game_Character
- def update_stop
- if @step_anime
- @anime_count += 1
- - elsif @pattern != @original_pattern
- - @pattern=@original_pattern
- - @anime_count=0
- end
- unless @starting or lock?
- @stop_count += 1
- @@ -332,9 +310,7 @@ class Game_Character
- def move_type_toward_player
- sx = @x - $game_player.x
- sy = @y - $game_player.y
- - abs_sx = sx > 0 ? sx : -sx
- - abs_sy = sy > 0 ? sy : -sy
- - if sx + sy >= 20
- + if sx.abs + sy.abs >= 20
- move_random
- return
- end
- @@ -371,39 +347,24 @@ class Game_Character
- end
- if command.code <= 14
- case command.code
- - when 1
- - move_down
- - when 2
- - move_left
- - when 3
- - move_right
- - when 4
- - move_up
- - when 5
- - move_lower_left
- - when 6
- - move_lower_right
- - when 7
- - move_upper_left
- - when 8
- - move_upper_right
- - when 9
- - move_random
- - when 10
- - move_toward_player
- - when 11
- - move_away_from_player
- - when 12
- - move_forward
- - when 13
- - move_backward
- - when 14
- - jump(command.parameters[0], command.parameters[1])
- + when 1; move_down
- + when 2; move_left
- + when 3; move_right
- + when 4; move_up
- + when 5; move_lower_left
- + when 6; move_lower_right
- + when 7; move_upper_left
- + when 8; move_upper_right
- + when 9; move_random
- + when 10; move_toward_player
- + when 11; move_away_from_player
- + when 12; move_forward
- + when 13; move_backward
- + when 14; jump(command.parameters[0], command.parameters[1])
- end
- - if not @move_route.skippable and not moving? and not jumping?
- - return
- + if @move_route.skippable or moving? or jumping?
- + @move_route_index += 1
- end
- - @move_route_index += 1
- return
- end
- if command.code == 15
- @@ -413,28 +374,17 @@ class Game_Character
- end
- if command.code >= 16 and command.code <= 26
- case command.code
- - when 16
- - turn_down
- - when 17
- - turn_left
- - when 18
- - turn_right
- - when 19
- - turn_up
- - when 20
- - turn_right_90
- - when 21
- - turn_left_90
- - when 22
- - turn_180
- - when 23
- - turn_right_or_left_90
- - when 24
- - turn_random
- - when 25
- - turn_toward_player
- - when 26
- - turn_away_from_player
- + when 16; turn_down
- + when 17; turn_left
- + when 18; turn_right
- + when 19; turn_up
- + when 20; turn_right_90
- + when 21; turn_left_90
- + when 22; turn_180
- + when 23; turn_right_or_left_90
- + when 24; turn_random
- + when 25; turn_toward_player
- + when 26; turn_away_from_player
- end
- @move_route_index += 1
- return
- @@ -447,30 +397,18 @@ class Game_Character
- when 28
- $game_switches[command.parameters[0]] = false
- self.map.need_refresh = true
- - when 29
- - @move_speed = command.parameters[0]
- - when 30
- - @move_frequency = command.parameters[0]
- - when 31
- - @walk_anime = true
- - when 32
- - @walk_anime = false
- - when 33
- - @step_anime = true
- - when 34
- - @step_anime = false
- - when 35
- - @direction_fix = true
- - when 36
- - @direction_fix = false
- - when 37
- - @through = true
- - when 38
- - @through = false
- - when 39
- - @always_on_top = true
- - when 40
- - @always_on_top = false
- + when 29; @move_speed = command.parameters[0]
- + when 30; @move_frequency = command.parameters[0]
- + when 31; @walk_anime = true
- + when 32; @walk_anime = false
- + when 33; @step_anime = true
- + when 34; @step_anime = false
- + when 35; @direction_fix = true
- + when 36; @direction_fix = false
- + when 37; @through = true
- + when 38; @through = false
- + when 39; @always_on_top = true
- + when 40; @always_on_top = false
- when 41
- @tile_id = 0
- @character_name = command.parameters[0]
- @@ -484,14 +422,10 @@ class Game_Character
- @pattern = command.parameters[3]
- @original_pattern = @pattern
- end
- - when 42
- - @opacity = command.parameters[0]
- - when 43
- - @blend_type = command.parameters[0]
- - when 44
- - pbSEPlay(command.parameters[0])
- - when 45
- - result = eval(command.parameters[0])
- + when 42; @opacity = command.parameters[0]
- + when 43; @blend_type = command.parameters[0]
- + when 44; pbSEPlay(command.parameters[0])
- + when 45; result = eval(command.parameters[0])
- end
- @move_route_index += 1
- end
- @@ -652,7 +586,7 @@ class Game_Character
- abs_sx = sx.abs
- abs_sy = sy.abs
- if abs_sx == abs_sy
- - rand(2) == 0 ? abs_sx += 1 : abs_sy += 1
- + (rand(2) == 0) ? abs_sx += 1 : abs_sy += 1
- end
- if abs_sx > abs_sy
- sx > 0 ? move_left : move_right
- @@ -676,7 +610,7 @@ class Game_Character
- abs_sx = sx.abs
- abs_sy = sy.abs
- if abs_sx == abs_sy
- - rand(2) == 0 ? abs_sx += 1 : abs_sy += 1
- + (rand(2) == 0) ? abs_sx += 1 : abs_sy += 1
- end
- if abs_sx > abs_sy
- sx > 0 ? move_right : move_left
- diff --git a/Data/Scripts.rxdata/[020] Game_Event.rb b/Data/Scripts.rxdata/[020] Game_Event.rb
- index 6dac81b..7fbda59 100644
- --- a/Data/Scripts.rxdata/[020] Game_Event.rb
- +++ b/Data/Scripts.rxdata/[020] Game_Event.rb
- @@ -88,7 +88,7 @@ class Game_Event < Game_Character
- end
- def setTempSwitchOn(c)
- - @tempSwitches[c]=true
- + @tempSwitches[c]=true
- refresh
- end
- diff --git a/Data/Scripts.rxdata/[024] Sprite_Character.rb b/Data/Scripts.rxdata/[024] Sprite_Character.rb
- index d5588db..4f52595 100644
- --- a/Data/Scripts.rxdata/[024] Sprite_Character.rb
- +++ b/Data/Scripts.rxdata/[024] Sprite_Character.rb
- @@ -36,6 +36,7 @@ class Sprite_Character < RPG::Sprite
- super(viewport)
- @character = character
- @oldbushdepth=0
- + @bobframetime=1.0/15
- update
- end
- @@ -84,6 +85,7 @@ class Sprite_Character < RPG::Sprite
- @tile_id = @character.tile_id
- @character_name = @character.character_name
- @character_hue = @character.character_hue
- + @oldbushdepth = @character.bush_depth
- if @tile_id >= 384
- @charbitmap.dispose if @charbitmap
- @charbitmap = pbGetTileBitmap(@character.map.tileset_name,
- @@ -98,20 +100,15 @@ class Sprite_Character < RPG::Sprite
- self.oy = Game_Map::TILEHEIGHT
- else
- @charbitmap.dispose if @charbitmap
- - @charbitmap = AnimatedBitmap.new(
- - "Graphics/Characters/"[email protected]_name,
- - @character.character_hue)
- + @charbitmap = AnimatedBitmap.new("Graphics/Characters/"[email protected]_name,
- + @character.character_hue)
- @charbitmapAnimated=true
- @bushbitmap.dispose if @bushbitmap
- @bushbitmap=nil
- @cw = @charbitmap.width / 4
- @ch = @charbitmap.height / 4
- self.ox = @cw / 2
- - if @character_name[/offset/]
- - self.oy = @ch - 16
- - else
- - self.oy = @ch
- - end
- + self.oy = (@character_name[/offset/]) ? @ch - 16 : @ch
- end
- end
- @charbitmap.update if @charbitmapAnimated
- @@ -125,23 +122,18 @@ class Sprite_Character < RPG::Sprite
- end
- self.visible = (not @character.transparent)
- - if @character==$game_player && @tile_id == 0
- - if $PokemonGlobal.surfing || $PokemonGlobal.diving
- - bob=((Graphics.frame_count%60)/15).floor
- - self.oy=(bob>=2) ? @ch-16-2 : @ch-16
- - end
- - end
- if @tile_id == 0
- - if @character==$game_player && !$PokemonGlobal.fishing &&
- + [email protected] * @cw
- + if @character==$game_player &&
- ($PokemonGlobal.surfing || $PokemonGlobal.diving)
- - sx = bob * @cw
- - sy = (@character.direction - 2) / 2 * @ch
- - self.src_rect.set(sx, sy, @cw, @ch)
- - else
- - sx = @character.pattern * @cw
- - sy = (@character.direction - 2) / 2 * @ch
- - self.src_rect.set(sx, sy, @cw, @ch)
- + bob=((Graphics.frame_count%60)*@bobframetime).floor
- + self.oy=(bob>=2) ? @ch-16-2 : @ch-16
- + if !$PokemonGlobal.fishing
- + sx=bob * @cw
- + end
- end
- + sy = (@character.direction - 2) / 2 * @ch
- + self.src_rect.set(sx, sy, @cw, @ch)
- end
- if self.visible
- if $PokemonSystem.tilemap==0 ||
- diff --git a/Data/Scripts.rxdata/[030] Tilemap_XP.rb b/Data/Scripts.rxdata/[030] Tilemap_XP.rb
- index 863da1e..d6754a2 100644
- --- a/Data/Scripts.rxdata/[030] Tilemap_XP.rb
- +++ b/Data/Scripts.rxdata/[030] Tilemap_XP.rb
- @@ -782,7 +782,7 @@ class CustomTilemap
- for x in xrange
- xpos=(x*twidth)-@oxLayer0
- id = mapdata[x, y, z]
- - next if id==0 || @priorities[id]!=0 || !@priorities[id]
- + next if id==0 || !@priorities[id] || @priorities[id]!=0
- if id>=384
- tmprect.set( ((id - 384)&7)*@tileSrcWidth,((id - 384)>>3)*@tileSrcHeight,
- @tileSrcWidth,@tileSrcHeight)
- @@ -926,7 +926,7 @@ class CustomTilemap
- end
- if count<@tiles.length
- bigchange=(count<=(@tiles.length*2/3)) && (@tiles.length*2/3)>25
- - j=count;[email protected];while j<len
- + j=count; [email protected]; while j<len
- sprite=@tiles[j]
- @tiles[j+1]=-1
- if bigchange
- diff --git a/Data/Scripts.rxdata/[038] Interpreter.rb b/Data/Scripts.rxdata/[038] Interpreter.rb
- index c54d25f..6adc114 100644
- --- a/Data/Scripts.rxdata/[038] Interpreter.rb
- +++ b/Data/Scripts.rxdata/[038] Interpreter.rb
- @@ -258,7 +258,7 @@ class Interpreter
- if line[/^\s*\(/]
- message+="\r\n***Line '#{line}' shouldn't begin with '('. Try\r\n"
- message+="putting the '(' at the end of the previous line instead,\r\n"
- - message+="or using Extendtext."
- + message+="or using 'extendtext.exe'."
- end
- }
- else
- diff --git a/Data/Scripts.rxdata/[048] BitmapCache.rb b/Data/Scripts.rxdata/[048] BitmapCache.rb
- index c8d68e3..7776542 100644
- --- a/Data/Scripts.rxdata/[048] BitmapCache.rb
- +++ b/Data/Scripts.rxdata/[048] BitmapCache.rb
- @@ -49,16 +49,16 @@ class WeakRef
- begin
- rids = @@id_map[id]
- if rids
- - for rid in rids
- - @@id_rev_map.delete(rid)
- + for rid in rids
- + @@id_rev_map.delete(rid)
- end
- @@id_map.delete(id)
- end
- rid = @@id_rev_map[id]
- if rid
- - @@id_rev_map.delete(id)
- - @@id_map[rid].delete(id)
- - @@id_map.delete(rid) if @@id_map[rid].empty?
- + @@id_rev_map.delete(id)
- + @@id_map[rid].delete(id)
- + @@id_map.delete(rid) if @@id_map[rid].empty?
- end
- ensure
- Thread.critical = __old_status
- @@ -205,7 +205,7 @@ end
- module RPG
- module Cache
- def self.load_bitmap(folder_name, filename, hue = 0)
- - BitmapCache.load_bitmap(folder_name+filename.to_s,hue, true)
- + BitmapCache.load_bitmap(folder_name+filename.to_s,hue, true)
- end
- def self.animation(filename, hue)
- diff --git a/Data/Scripts.rxdata/[050] SpriteWindow.rb b/Data/Scripts.rxdata/[050] SpriteWindow.rb
- index 5676912..c71ffe7 100644
- --- a/Data/Scripts.rxdata/[050] SpriteWindow.rb
- +++ b/Data/Scripts.rxdata/[050] SpriteWindow.rb
- @@ -3057,7 +3057,7 @@ class SpriteWindow_Selectable < SpriteWindow_Base
- self.top_row = [self.top_row, self.row_max - self.page_row_max].min
- cursor_width = (self.width-self.borderX) / @column_max
- x = self.index % @column_max * (cursor_width + @column_spacing)
- - y = self.index/ @column_max * @row_height - @virtualOy
- + y = self.index / @column_max * @row_height - @virtualOy
- self.cursor_rect.set(x, y, cursor_width, @row_height)
- self.refresh if dorefresh || force
- end
- diff --git a/Data/Scripts.rxdata/[057] Scene_Intro.rb b/Data/Scripts.rxdata/[057] Scene_Intro.rb
- index b3791fc..68857c6 100644
- --- a/Data/Scripts.rxdata/[057] Scene_Intro.rb
- +++ b/Data/Scripts.rxdata/[057] Scene_Intro.rb
- @@ -75,8 +75,8 @@ class IntroEventScene < EventScene
- onCTrigger.clear
- onUpdate.clear
- # Play random cry
- - cry=pbResolveAudioSE(pbCryFile(1+rand(PBSpecies.maxValue)))
- - pbSEPlay(cry,100,100) if cry
- + cry=pbCryFile(1+rand(PBSpecies.maxValue))
- + pbSEPlay(cry,80,100) if cry
- # Fade out
- @pic.moveOpacity(15,0,0)
- @pic2.moveOpacity(15,0,0)
- @@ -92,8 +92,8 @@ class IntroEventScene < EventScene
- onCTrigger.clear
- onUpdate.clear
- # Play random cry
- - cry=pbResolveAudioSE(pbCryFile(1+rand(PBSpecies.maxValue)))
- - pbSEPlay(cry,100,100) if cry
- + cry=pbCryFile(1+rand(PBSpecies.maxValue))
- + pbSEPlay(cry,80,100) if cry
- # Fade out
- @pic.moveOpacity(15,0,0)
- @pic2.moveOpacity(15,0,0)
- diff --git a/Data/Scripts.rxdata/[066] PBTypes_Extra.rb b/Data/Scripts.rxdata/[066] PBTypes_Extra.rb
- index 5495136..3845698 100644
- --- a/Data/Scripts.rxdata/[066] PBTypes_Extra.rb
- +++ b/Data/Scripts.rxdata/[066] PBTypes_Extra.rb
- @@ -21,36 +21,41 @@ class PBTypes
- end
- def PBTypes.getEffectiveness(attackType,opponentType)
- + return 2 if !opponentType || opponentType<0
- return PBTypes.loadTypeData()[2][attackType*(PBTypes.maxValue+1)+opponentType]
- end
- - def PBTypes.getCombinedEffectiveness(attackType,opponentType1,opponentType2=nil)
- - if opponentType2==nil || opponentType1==opponentType2
- - return PBTypes.getEffectiveness(attackType,opponentType1)*2
- - else
- - mod1=PBTypes.getEffectiveness(attackType,opponentType1)
- + def PBTypes.getCombinedEffectiveness(attackType,opponentType1,opponentType2=nil,opponentType3=nil)
- + mod1=PBTypes.getEffectiveness(attackType,opponentType1)
- + mod2=2
- + if opponentType2!=nil && opponentType2>=0 && opponentType1!=opponentType2
- mod2=PBTypes.getEffectiveness(attackType,opponentType2)
- - return (mod1*mod2)
- end
- + mod3=2
- + if opponentType3!=nil && opponentType3>=0 &&
- + opponentType1!=opponentType3 && opponentType2!=opponentType3
- + mod3=PBTypes.getEffectiveness(attackType,opponentType3)
- + end
- + return (mod1*mod2*mod3)
- end
- - def PBTypes.isIneffective?(attackType,opponentType1,opponentType2=nil)
- - e=PBTypes.getCombinedEffectiveness(attackType,opponentType1,opponentType2)
- + def PBTypes.isIneffective?(attackType,opponentType1,opponentType2=nil,opponentType3=nil)
- + e=PBTypes.getCombinedEffectiveness(attackType,opponentType1,opponentType2,opponentType3)
- return e==0
- end
- - def PBTypes.isNotVeryEffective?(attackType,opponentType1,opponentType2=nil)
- - e=PBTypes.getCombinedEffectiveness(attackType,opponentType1,opponentType2)
- - return e>0 && e<4
- + def PBTypes.isNotVeryEffective?(attackType,opponentType1,opponentType2=nil,opponentType3=nil)
- + e=PBTypes.getCombinedEffectiveness(attackType,opponentType1,opponentType2,opponentType3)
- + return e>0 && e<8
- end
- - def PBTypes.isNormalEffective?(attackType,opponentType1,opponentType2=nil)
- - e=PBTypes.getCombinedEffectiveness(attackType,opponentType1,opponentType2)
- - return e==4
- + def PBTypes.isNormalEffective?(attackType,opponentType1,opponentType2=nil,opponentType3=nil)
- + e=PBTypes.getCombinedEffectiveness(attackType,opponentType1,opponentType2,opponentType3)
- + return e==8
- end
- - def PBTypes.isSuperEffective?(attackType,opponentType1,opponentType2=nil)
- - e=PBTypes.getCombinedEffectiveness(attackType,opponentType1,opponentType2)
- - return e>4
- + def PBTypes.isSuperEffective?(attackType,opponentType1,opponentType2=nil,opponentType3=nil)
- + e=PBTypes.getCombinedEffectiveness(attackType,opponentType1,opponentType2,opponentType3)
- + return e>8
- end
- end
- \ No newline at end of file
- diff --git a/Data/Scripts.rxdata/[075] PBEffects.rb b/Data/Scripts.rxdata/[075] PBEffects.rb
- index de3e6ed..0161f66 100644
- --- a/Data/Scripts.rxdata/[075] PBEffects.rb
- +++ b/Data/Scripts.rxdata/[075] PBEffects.rb
- @@ -45,69 +45,71 @@ begin
- Ingrain = 41
- KingsShield = 42
- LeechSeed = 43
- - LockOn = 44
- - LockOnPos = 45
- - LunarDance = 46
- - MagicCoat = 47
- - MagnetRise = 48
- - MeanLook = 49
- - MeFirst = 50
- - Metronome = 51
- - MicleBerry = 52
- - Minimize = 53
- - MiracleEye = 54
- - MirrorCoat = 55
- - MirrorCoatTarget = 56
- - MoveNext = 57
- - MudSport = 58
- - MultiTurn = 59 # Trapping move
- - MultiTurnAttack = 60
- - MultiTurnUser = 61
- - Nightmare = 62
- - Outrage = 63
- - ParentalBond = 64
- - PerishSong = 65
- - PerishSongUser = 66
- - PickupItem = 67
- - PickupUse = 68
- - Pinch = 69 # Battle Palace only
- - Powder = 70
- - PowerTrick = 71
- - Protect = 72
- - ProtectNegation = 73
- - ProtectRate = 74
- - Pursuit = 75
- - Quash = 76
- - Rage = 77
- - Revenge = 78
- - Roar = 79
- - Rollout = 80
- - Roost = 81
- - SkyDrop = 82
- - SmackDown = 83
- - Snatch = 84
- - SpikyShield = 85
- - Stockpile = 86
- - StockpileDef = 87
- - StockpileSpDef = 88
- - Substitute = 89
- - Taunt = 90
- - Telekinesis = 91
- - Torment = 92
- - Toxic = 93
- - Transform = 94
- - Truant = 95
- - TwoTurnAttack = 96
- - Type3 = 97
- - Unburden = 98
- - Uproar = 99
- - Uturn = 100
- - WaterSport = 101
- - WeightChange = 102
- - Wish = 103
- - WishAmount = 104
- - WishMaker = 105
- - Yawn = 106
- + LifeOrb = 44
- + LockOn = 45
- + LockOnPos = 46
- + LunarDance = 47
- + MagicCoat = 48
- + MagnetRise = 49
- + MeanLook = 50
- + MeFirst = 51
- + Metronome = 52
- + MicleBerry = 53
- + Minimize = 54
- + MiracleEye = 55
- + MirrorCoat = 56
- + MirrorCoatTarget = 57
- + MoveNext = 58
- + MudSport = 59
- + MultiTurn = 60 # Trapping move
- + MultiTurnAttack = 61
- + MultiTurnUser = 62
- + Nightmare = 63
- + Outrage = 64
- + ParentalBond = 65
- + PerishSong = 66
- + PerishSongUser = 67
- + PickupItem = 68
- + PickupUse = 69
- + Pinch = 70 # Battle Palace only
- + Powder = 71
- + PowerTrick = 72
- + Protect = 73
- + ProtectNegation = 74
- + ProtectRate = 75
- + Pursuit = 76
- + Quash = 77
- + Rage = 78
- + Revenge = 79
- + Roar = 80
- + Rollout = 81
- + Roost = 82
- + SkipTurn = 83 # For when using Poké Balls/Poké Dolls
- + SkyDrop = 84
- + SmackDown = 85
- + Snatch = 86
- + SpikyShield = 87
- + Stockpile = 88
- + StockpileDef = 89
- + StockpileSpDef = 90
- + Substitute = 91
- + Taunt = 92
- + Telekinesis = 93
- + Torment = 94
- + Toxic = 95
- + Transform = 96
- + Truant = 97
- + TwoTurnAttack = 98
- + Type3 = 99
- + Unburden = 100
- + Uproar = 101
- + Uturn = 102
- + WaterSport = 103
- + WeightChange = 104
- + Wish = 105
- + WishAmount = 106
- + WishMaker = 107
- + Yawn = 108
- ############################################################################
- # These effects apply to a side
- @@ -151,9 +153,10 @@ begin
- ############################################################################
- # These effects apply to the usage of a move
- - SpecialUsage = 0
- - PassedTrying = 1
- - TotalDamage = 2
- + SkipAccuracyCheck = 0
- + SpecialUsage = 1
- + PassedTrying = 2
- + TotalDamage = 3
- end
- rescue Exception
- diff --git a/Data/Scripts.rxdata/[079] PokeBattle_DamageState.rb b/Data/Scripts.rxdata/[079] PokeBattle_DamageState.rb
- index 73ed84b..7d803ee 100644
- --- a/Data/Scripts.rxdata/[079] PokeBattle_DamageState.rb
- +++ b/Data/Scripts.rxdata/[079] PokeBattle_DamageState.rb
- @@ -26,4 +26,46 @@ class PokeBattle_DamageState
- def initialize
- reset
- end
- +end
- +
- +
- +
- +################################################################################
- +# Success state (used for Battle Arena)
- +################################################################################
- +class PokeBattle_SuccessState
- + attr_accessor :typemod
- + attr_accessor :useState # 0 - not used, 1 - failed, 2 - succeeded
- + attr_accessor :protected
- + attr_accessor :skill
- +
- + def initialize
- + clear
- + end
- +
- + def clear
- + @typemod = 4
- + @useState = 0
- + @protected = false
- + @skill = 0
- + end
- +
- + def updateSkill
- + if @useState==1 && !@protected
- + @skill-=2
- + elsif @useState==2
- + if @typemod>4
- + @skill+=2 # "Super effective"
- + elsif @typemod>=1 && @typemod<4
- + @skill-=1 # "Not very effective"
- + elsif @typemod==0
- + @skill-=2 # Ineffective
- + else
- + @skill+=1
- + end
- + end
- + @typemod=4
- + @useState=0
- + @protected=false
- + end
- end
- \ No newline at end of file
- diff --git a/Data/Scripts.rxdata/[080] PokeBattle_Battler.rb b/Data/Scripts.rxdata/[080] PokeBattle_Battler.rb
- index 64c998d..279d29c 100644
- --- a/Data/Scripts.rxdata/[080] PokeBattle_Battler.rb
- +++ b/Data/Scripts.rxdata/[080] PokeBattle_Battler.rb
- @@ -410,6 +410,7 @@ class PokeBattle_Battler
- end
- @effects[PBEffects::Imprison] = false
- @effects[PBEffects::KingsShield] = false
- + @effects[PBEffects::LifeOrb] = false
- @effects[PBEffects::MagicCoat] = false
- @effects[PBEffects::MeanLook] = -1
- for i in 0...4
- @@ -454,6 +455,7 @@ class PokeBattle_Battler
- @effects[PBEffects::Roar] = false
- @effects[PBEffects::Rollout] = 0
- @effects[PBEffects::Roost] = false
- + @effects[PBEffects::SkipTurn] = false
- @effects[PBEffects::SkyDrop] = false
- @effects[PBEffects::SmackDown] = false
- @effects[PBEffects::Snatch] = false
- @@ -588,6 +590,17 @@ class PokeBattle_Battler
- return false
- end
- + def pbHasMoveType?(type)
- + if type.is_a?(String) || type.is_a?(Symbol)
- + type=getID(PBTypes,type)
- + end
- + return false if !type || type<0
- + for i in @moves
- + return true if i.type==type
- + end
- + return false
- + end
- +
- def pbHasMoveFunction?(code)
- return false if !code
- for i in @moves
- @@ -1109,8 +1122,8 @@ class PokeBattle_Battler
- next if foe.isFainted?
- for j in foe.moves
- movedata=PBMoveData.new(j.id)
- - eff=PBTypes.getCombinedEffectiveness(movedata.type,type1,type2)
- - if (movedata.basedamage>0 && eff>4) ||
- + eff=PBTypes.getCombinedEffectiveness(movedata.type,type1,type2,@effects[PBEffects::Type3])
- + if (movedata.basedamage>0 && eff>8) ||
- (movedata.function==0x70 && eff>0) # OHKO
- found=true
- break
- @@ -1491,7 +1504,7 @@ class PokeBattle_Battler
- end
- end
- # Life Orb
- - if user.hasWorkingItem(:LIFEORB) && !user.hasWorkingAbility(:MAGICGUARD)
- + if user.effects[PBEffects::LifeOrb] && !user.hasWorkingAbility(:MAGICGUARD)
- PBDebug.log("[Item triggered] #{user.pbThis}'s Life Orb (recoil)")
- hploss=user.pbReduceHP((user.totalhp/10).floor,true)
- if hploss>0
- @@ -2084,7 +2097,7 @@ class PokeBattle_Battler
- if targets.length==1 && isConst?(thismove.pbType(thismove.type,user,target),PBTypes,:ELECTRIC) &&
- !target.hasWorkingAbility(:LIGHTNINGROD)
- for i in priority # use Pokémon earliest in priority
- - next if target.index==i.index
- + next if user.index==i.index || target.index==i.index
- if i.hasWorkingAbility(:LIGHTNINGROD)
- PBDebug.log("[Ability triggered] #{i.pbThis}'s Lightningrod (change target)")
- target=i # X's Lightningrod took the attack!
- @@ -2097,7 +2110,7 @@ class PokeBattle_Battler
- if targets.length==1 && isConst?(thismove.pbType(thismove.type,user,target),PBTypes,:WATER) &&
- !target.hasWorkingAbility(:STORMDRAIN)
- for i in priority # use Pokémon earliest in priority
- - next if target.index==i.index
- + next if user.index==i.index || target.index==i.index
- if i.hasWorkingAbility(:STORMDRAIN)
- PBDebug.log("[Ability triggered] #{i.pbThis}'s Storm Drain (change target)")
- target=i # X's Storm Drain took the attack!
- @@ -2111,7 +2124,7 @@ class PokeBattle_Battler
- if PBTargets.targetsOneOpponent?(thismove)
- newtarget=nil; strength=100
- for i in priority # use Pokémon latest in priority
- - next if !pbIsOpposing?(i.index)
- + next if !user.pbIsOpposing?(i.index)
- i.effects[PBEffects::FollowMe]>0 && i.effects[PBEffects::FollowMe]<strength
- PBDebug.log("[Lingering effect triggered] #{i.pbThis}'s Follow Me")
- @@ -2122,9 +2135,9 @@ class PokeBattle_Battler
- target=newtarget if newtarget
- end
- # TODO: Pressure here is incorrect if Magic Coat redirects target
- - if user.index!=target.index && target.hasWorkingAbility(:PRESSURE)
- + if user.pbIsOpposing?(target.index) && target.hasWorkingAbility(:PRESSURE)
- PBDebug.log("[Ability triggered] #{target.pbThis}'s Pressure (in pbChangeTarget)")
- - pbReducePP(thismove) # Reduce PP
- + user.pbReducePP(thismove) # Reduce PP
- end
- # Change user to user of Snatch
- if thismove.canSnatch?
- @@ -2137,7 +2150,7 @@ class PokeBattle_Battler
- user=i
- # Snatch's PP is reduced if old user has Pressure
- - if target.hasWorkingAbility(:PRESSURE) && userchoice>=0
- + if target.hasWorkingAbility(:PRESSURE) && user.pbIsOpposing?(target.index) && userchoice>=0
- PBDebug.log("[Ability triggered] #{target.pbThis}'s Pressure (part of Snatch)")
- pressuremove=user.moves[userchoice]
- pbSetPP(pressuremove,pressuremove.pp-1) if pressuremove.pp>0
- @@ -2200,7 +2213,6 @@ class PokeBattle_Battler
- end
- def pbReducePP(move)
- - #TODO: Pressure
- if @effects[PBEffects::TwoTurnAttack]>0 ||
- @effects[PBEffects::Bide]>0 ||
- @effects[PBEffects::Outrage]>0 ||
- @@ -2299,7 +2311,7 @@ class PokeBattle_Battler
- end
- end
- - def pbSuccessCheck(thismove,user,target,accuracy=true)
- + def pbSuccessCheck(thismove,user,target,turneffects,accuracy=true)
- if user.effects[PBEffects::TwoTurnAttack]>0
- return true
- end
- @@ -2375,8 +2387,9 @@ class PokeBattle_Battler
- @battle.pbDisplay(_INTL("{1} protected itself!",target.pbThis))
- @battle.successStates[user.index].protected=true
- PBDebug.log("[Move failed] #{user.pbThis}'s Spiky Shield stopped the attack")
- - if thismove.isContactMove?
- - amt=target.pbReduceHP((target.totalhp/8).floor) if !target.isFainted?
- + if thismove.isContactMove? && !user.isFainted?
- + @battle.scene.pbDamageAnimation(user,0)
- + amt=user.pbReduceHP((user.totalhp/8).floor)
- @battle.pbDisplay(_INTL("{1} was hurt!",user.pbThis)) if amt>0
- end
- return false
- @@ -2469,6 +2482,7 @@ class PokeBattle_Battler
- thismove.function==0x15 || # Hurricane
- thismove.function==0x77 || # Gust
- thismove.function==0x78 || # Twister
- + thismove.function==0xCE || # Sky Drop
- thismove.function==0x11B || # Sky Uppercut
- thismove.function==0x11C # Smack Down
- end
- @@ -2477,6 +2491,7 @@ class PokeBattle_Battler
- @battle.futuresight
- override=true if USENEWBATTLEMECHANICS && thismove.function==0x06 && # Toxic
- thismove.basedamage==0 && user.pbHasType?(:POISON)
- + override=true if !miss && turneffects[PBEffects::SkipAccuracyCheck] # Called by another move
- if !override && (miss || !thismove.pbAccuracyCheck(user,target)) # Includes Counter/Mirror Coat
- PBDebug.log(sprintf("[Move failed] Failed pbAccuracyCheck (function code %02X) or target is semi-invulnerable",thismove.function))
- if thismove.target==PBTargets::AllOpposing &&
- @@ -2501,7 +2516,9 @@ class PokeBattle_Battler
- def pbTryUseMove(choice,thismove,turneffects)
- return true if turneffects[PBEffects::PassedTrying]
- # TODO: Return true if attack has been Mirror Coated once already
- - return false if !pbObedienceCheck?(choice)
- + if !turneffects[PBEffects::SkipAccuracyCheck]
- + return false if !pbObedienceCheck?(choice)
- + end
- if @effects[PBEffects::SkyDrop] # Intentionally no message here
- PBDebug.log("[Move failed] #{pbThis} can't use #{thismove.name} because of being Sky Dropped")
- return false
- @@ -2568,16 +2585,18 @@ class PokeBattle_Battler
- PBDebug.log("[Ability triggered] #{pbThis}'s Truant")
- return false
- end
- - if self.status==PBStatuses::SLEEP
- - self.statusCount-=1
- - if self.statusCount<=0
- - self.pbCureStatus
- - else
- - self.pbContinueStatus
- - PBDebug.log("[Status] #{pbThis} remained asleep (count: #{self.statusCount})")
- - if !thismove.pbCanUseWhileAsleep? # Snore/Sleep Talk/Outrage
- - PBDebug.log("[Move failed] #{pbThis} couldn't use #{thismove.name} while asleep")
- - return false
- + if !turneffects[PBEffects::SkipAccuracyCheck]
- + if self.status==PBStatuses::SLEEP
- + self.statusCount-=1
- + if self.statusCount<=0
- + self.pbCureStatus
- + else
- + self.pbContinueStatus
- + PBDebug.log("[Status] #{pbThis} remained asleep (count: #{self.statusCount})")
- + if !thismove.pbCanUseWhileAsleep? # Snore/Sleep Talk/Outrage
- + PBDebug.log("[Move failed] #{pbThis} couldn't use #{thismove.name} while asleep")
- + return false
- + end
- end
- end
- end
- @@ -2587,7 +2606,7 @@ class PokeBattle_Battler
- self.pbCureStatus(false)
- @battle.pbDisplay(_INTL("{1} melted the ice!",pbThis))
- pbCheckForm
- - elsif @battle.pbRandom(10)<2
- + elsif @battle.pbRandom(10)<2 && !turneffects[PBEffects::SkipAccuracyCheck]
- self.pbCureStatus
- pbCheckForm
- elsif !thismove.canThawUser?
- @@ -2596,18 +2615,20 @@ class PokeBattle_Battler
- return false
- end
- end
- - if @effects[PBEffects::Confusion]>0
- - @effects[PBEffects::Confusion]-=1
- - if @effects[PBEffects::Confusion]<=0
- - pbCureConfusion
- - else
- - pbContinueConfusion
- - PBDebug.log("[Status] #{pbThis} remained confused (count: #{@effects[PBEffects::Confusion]})")
- - if @battle.pbRandom(2)==0
- - pbConfusionDamage
- - @battle.pbDisplay(_INTL("It hurt itself in its confusion!"))
- - PBDebug.log("[Status] #{pbThis} hurt itself in its confusion and couldn't move")
- - return false
- + if !turneffects[PBEffects::SkipAccuracyCheck]
- + if @effects[PBEffects::Confusion]>0
- + @effects[PBEffects::Confusion]-=1
- + if @effects[PBEffects::Confusion]<=0
- + pbCureConfusion
- + else
- + pbContinueConfusion
- + PBDebug.log("[Status] #{pbThis} remained confused (count: #{@effects[PBEffects::Confusion]})")
- + if @battle.pbRandom(2)==0
- + pbConfusionDamage
- + @battle.pbDisplay(_INTL("It hurt itself in its confusion!"))
- + PBDebug.log("[Status] #{pbThis} hurt itself in its confusion and couldn't move")
- + return false
- + end
- end
- end
- end
- @@ -2622,19 +2643,21 @@ class PokeBattle_Battler
- end
- return false
- end
- - if @effects[PBEffects::Attract]>=0
- - pbAnnounceAttract(@battle.battlers[@effects[PBEffects::Attract]])
- - if @battle.pbRandom(2)==0
- - pbContinueAttract
- - PBDebug.log("[Lingering effect triggered] #{pbThis} was infatuated and couldn't move")
- - return false
- + if !turneffects[PBEffects::SkipAccuracyCheck]
- + if @effects[PBEffects::Attract]>=0
- + pbAnnounceAttract(@battle.battlers[@effects[PBEffects::Attract]])
- + if @battle.pbRandom(2)==0
- + pbContinueAttract
- + PBDebug.log("[Lingering effect triggered] #{pbThis} was infatuated and couldn't move")
- + return false
- + end
- end
- - end
- - if self.status==PBStatuses::PARALYSIS
- - if @battle.pbRandom(4)==0
- - pbContinueStatus
- - PBDebug.log("[Status] #{pbThis} was fully paralysed and couldn't move")
- - return false
- + if self.status==PBStatuses::PARALYSIS
- + if @battle.pbRandom(4)==0
- + pbContinueStatus
- + PBDebug.log("[Status] #{pbThis} was fully paralysed and couldn't move")
- + return false
- + end
- end
- end
- turneffects[PBEffects::PassedTrying]=true
- @@ -2662,7 +2685,7 @@ class PokeBattle_Battler
- target.damagestate.reset
- # Check success (accuracy/evasion calculation)
- if !nocheck &&
- - !pbSuccessCheck(thismove,user,target,i==0 || thismove.successCheckPerHit?)
- + !pbSuccessCheck(thismove,user,target,turneffects,i==0 || thismove.successCheckPerHit?)
- if thismove.function==0xBF && realnumhits>0 # Triple Kick
- break # Considered a success if Triple Kick hits at least once
- elsif thismove.function==0x10B # Hi Jump Kick, Jump Kick
- @@ -2751,7 +2774,6 @@ class PokeBattle_Battler
- end
- if target.isFainted?
- destinybond=destinybond || target.effects[PBEffects::DestinyBond]
- - target.pbFaint # no return
- end
- user.pbFaint if user.isFainted? # no return
- break if user.isFainted?
- @@ -2879,6 +2901,7 @@ class PokeBattle_Battler
- # Note: user.lastMoveUsedType IS to be updated on nested calls; is used for Conversion 2
- turneffects=[]
- turneffects[PBEffects::SpecialUsage]=specialusage
- + turneffects[PBEffects::SkipAccuracyCheck]=specialusage
- turneffects[PBEffects::PassedTrying]=false
- turneffects[PBEffects::TotalDamage]=0
- # Start using the move
- @@ -2916,21 +2939,22 @@ class PokeBattle_Battler
- self.form=1
- pbUpdate(true)
- @battle.scene.pbChangePokemon(self,@pokemon)
- - @battle.pbDisplay(_INTL("{1} changed to Blade Forme",pbThis))
- + @battle.pbDisplay(_INTL("{1} changed to Blade Forme!",pbThis))
- PBDebug.log("[Form changed] #{pbThis} changed to Blade Forme")
- elsif isConst?(thismove.id,PBMoves,:KINGSSHIELD) && self.form!=0
- self.form=0
- pbUpdate(true)
- @battle.scene.pbChangePokemon(self,@pokemon)
- - @battle.pbDisplay(_INTL("{1} changed to Shield Forme",pbThis))
- + @battle.pbDisplay(_INTL("{1} changed to Shield Forme!",pbThis))
- PBDebug.log("[Form changed] #{pbThis} changed to Shield Forme")
- end
- end
- + # Record that user has used a move this round (ot at least tried to)
- # Try to use the move
- if !pbTryUseMove(choice,thismove,turneffects)
- self.lastMoveUsed=-1
- self.lastMoveUsedType=-1
- if !turneffects[PBEffects::SpecialUsage]
- self.lastMoveUsedSketch=-1 if self.effects[PBEffects::TwoTurnAttack]==0
- self.lastRegularMoveUsed=-1
- @@ -2949,7 +2973,6 @@ class PokeBattle_Battler
- self.lastMoveUsedType=-1
- self.lastMoveUsedSketch=-1 if self.effects[PBEffects::TwoTurnAttack]==0
- self.lastRegularMoveUsed=-1
- pbEndTurn(choice)
- @battle.pbJudge # @battle.pbSwitch
- PBDebug.log("[Move failed] #{thismove.name} has no PP left")
- @@ -2973,12 +2996,10 @@ class PokeBattle_Battler
- # "X used Y!" message
- case thismove.pbDisplayUseMessage(self)
- when 2 # Continuing Bide
- return
- when 1 # Starting Bide
- self.lastMoveUsed=thismove.id
- self.lastMoveUsedType=thismove.pbType(thismove.type,self,nil)
- if !turneffects[PBEffects::SpecialUsage]
- self.lastMoveUsedSketch=thismove.id if self.effects[PBEffects::TwoTurnAttack]==0
- self.lastRegularMoveUsed=thismove.id
- @@ -2991,7 +3012,6 @@ class PokeBattle_Battler
- when -1 # Was hurt while readying Focus Punch, fails use
- self.lastMoveUsed=thismove.id
- self.lastMoveUsedType=thismove.pbType(thismove.type,self,nil)
- if !turneffects[PBEffects::SpecialUsage]
- self.lastMoveUsedSketch=thismove.id if self.effects[PBEffects::TwoTurnAttack]==0
- self.lastRegularMoveUsed=thismove.id
- @@ -3010,12 +3030,10 @@ class PokeBattle_Battler
- @battle.successStates[user.index].useState=1
- @battle.successStates[user.index].typemod=8
- # Check whether Selfdestruct works
- - selffaint=(thismove.function==0xE0) # Selfdestruct
- if !thismove.pbOnStartUse(user) # Selfdestruct, Natural Gift, Beat Up can return false here
- PBDebug.log(sprintf("[Move failed] Failed pbOnStartUse (function code %02X)",thismove.function))
- user.lastMoveUsed=thismove.id
- user.lastMoveUsedType=thismove.pbType(thismove.type,user,nil)
- if !turneffects[PBEffects::SpecialUsage]
- user.lastMoveUsedSketch=thismove.id if user.effects[PBEffects::TwoTurnAttack]==0
- user.lastRegularMoveUsed=thismove.id
- @@ -3024,10 +3042,6 @@ class PokeBattle_Battler
- @battle.lastMoveUser=user.index
- return
- end
- - if selffaint
- - user.hp=0
- - user.pbFaint # no return
- - end
- # Primordial Sea, Desolate Land
- if thismove.pbIsDamaging?
- case @battle.pbWeather
- @@ -3037,7 +3051,6 @@ class PokeBattle_Battler
- @battle.pbDisplay(_INTL("The Fire-type attack fizzled out in the heavy rain!"))
- user.lastMoveUsed=thismove.id
- user.lastMoveUsedType=thismove.pbType(thismove.type,user,nil)
- if !turneffects[PBEffects::SpecialUsage]
- user.lastMoveUsedSketch=thismove.id if user.effects[PBEffects::TwoTurnAttack]==0
- user.lastRegularMoveUsed=thismove.id
- @@ -3052,7 +3065,6 @@ class PokeBattle_Battler
- @battle.pbDisplay(_INTL("The Water-type attack evaporated in the harsh sunlight!"))
- user.lastMoveUsed=thismove.id
- user.lastMoveUsedType=thismove.pbType(thismove.type,user,nil)
- if !turneffects[PBEffects::SpecialUsage]
- user.lastMoveUsedSketch=thismove.id if user.effects[PBEffects::TwoTurnAttack]==0
- user.lastRegularMoveUsed=thismove.id
- @@ -3071,7 +3083,6 @@ class PokeBattle_Battler
- user.pbReduceHP(1+(user.totalhp/4).floor) if !user.hasWorkingAbility(:MAGICGUARD)
- user.lastMoveUsed=thismove.id
- user.lastMoveUsedType=thismove.pbType(thismove.type,user,nil)
- if !turneffects[PBEffects::SpecialUsage]
- user.lastMoveUsedSketch=thismove.id if user.effects[PBEffects::TwoTurnAttack]==0
- user.lastRegularMoveUsed=thismove.id
- @@ -3150,57 +3161,32 @@ class PokeBattle_Battler
- showanimation=false
- i+=1
- end
- - # Pokémon switching caused by Roar, Whirlwind, Circle Throw, Dragon Tail, Red Card
- - if !user.isFainted?
- - switched=[]
- - for i in 0...4
- - if @battle.battlers[i].effects[PBEffects::Roar]
- - @battle.battlers[i].effects[PBEffects::Roar]=false
- - @battle.battlers[i].effects[PBEffects::Uturn]=false
- - next if @battle.battlers[i].isFainted?
- - next if [email protected]?(i,-1,false)
- - choices=[]
- - [email protected](i)
- - for j in 0...party.length
- - choices.push(j) if @battle.pbCanSwitchLax?(i,j,false)
- - end
- - if choices.length>0
- - newpoke=choices[@battle.pbRandom(choices.length)]
- - newpokename=newpoke
- - if isConst?(party[newpoke].ability,PBAbilities,:ILLUSION)
- - newpokename=pbGetLastPokeInTeam(i)
- - end
- - switched.push(i)
- - @battle.battlers[i].pbResetForm
- - @battle.pbRecallAndReplace(i,newpoke,newpokename,false,user.hasMoldBreaker)
- - @battle.pbDisplay(_INTL("{1} was dragged out!",@battle.battlers[i].pbThis))
- - end
- - end
- - end
- - for i in @battle.pbPriority
- - next if !switched.include?(i.index)
- - i.pbAbilitiesOnSwitchIn(true)
- - end
- - end
- - # Pokémon switching caused by U-Turn, Volt Switch, Eject Button
- + end
- + # Pokémon switching caused by Roar, Whirlwind, Circle Throw, Dragon Tail, Red Card
- + if !user.isFainted?
- switched=[]
- for i in 0...4
- - if @battle.battlers[i].effects[PBEffects::Uturn]
- - @battle.battlers[i].effects[PBEffects::Uturn]=false
- + if @battle.battlers[i].effects[PBEffects::Roar]
- @battle.battlers[i].effects[PBEffects::Roar]=false
- - if [email protected][i].isFainted? && @battle.pbCanChooseNonActive?(i) &&
- - [email protected]?(@battle.pbOpposingParty(i))
- - # TODO: Pursuit should go here, and negate this effect if it KO's attacker
- - @battle.pbDisplay(_INTL("{1} went back to {2}!",@battle.battlers[i].pbThis,@battle.pbGetOwner(i).name))
- - newpoke=0
- - [email protected](i,true,false)
- + @battle.battlers[i].effects[PBEffects::Uturn]=false
- + next if @battle.battlers[i].isFainted?
- + next if [email protected]?(i,-1,false)
- + choices=[]
- + [email protected](i)
- + for j in 0...party.length
- + choices.push(j) if @battle.pbCanSwitchLax?(i,j,false)
- + end
- + if choices.length>0
- + newpoke=choices[@battle.pbRandom(choices.length)]
- newpokename=newpoke
- - if isConst?(@battle.pbParty(i)[newpoke].ability,PBAbilities,:ILLUSION)
- + if isConst?(party[newpoke].ability,PBAbilities,:ILLUSION)
- newpokename=pbGetLastPokeInTeam(i)
- end
- switched.push(i)
- @battle.battlers[i].pbResetForm
- - @battle.pbRecallAndReplace(i,newpoke,newpokename,@battle.battlers[i].effects[PBEffects::BatonPass])
- + @battle.pbRecallAndReplace(i,newpoke,newpokename,false,user.hasMoldBreaker)
- + @battle.pbDisplay(_INTL("{1} was dragged out!",@battle.battlers[i].pbThis))
- + @battle.choices[i]=[0,0,nil,-1] # Replacement Pokémon does nothing this round
- end
- end
- end
- @@ -3208,27 +3194,54 @@ class PokeBattle_Battler
- next if !switched.include?(i.index)
- i.pbAbilitiesOnSwitchIn(true)
- end
- - # Baton Pass
- - if user.effects[PBEffects::BatonPass]
- - user.effects[PBEffects::BatonPass]=false
- - if !user.isFainted? && @battle.pbCanChooseNonActive?(user.index) &&
- - [email protected]?(@battle.pbParty(target.index))
- + end
- + # Pokémon switching caused by U-Turn, Volt Switch, Eject Button
- + switched=[]
- + for i in 0...4
- + if @battle.battlers[i].effects[PBEffects::Uturn]
- + @battle.battlers[i].effects[PBEffects::Uturn]=false
- + @battle.battlers[i].effects[PBEffects::Roar]=false
- + if [email protected][i].isFainted? && @battle.pbCanChooseNonActive?(i) &&
- + [email protected]?(@battle.pbOpposingParty(i))
- + # TODO: Pursuit should go here, and negate this effect if it KO's attacker
- + @battle.pbDisplay(_INTL("{1} went back to {2}!",@battle.battlers[i].pbThis,@battle.pbGetOwner(i).name))
- newpoke=0
- - [email protected](user.index,true,false)
- + [email protected](i,true,false)
- newpokename=newpoke
- - if isConst?(@battle.pbParty(user.index)[newpoke].ability,PBAbilities,:ILLUSION)
- - newpokename=pbGetLastPokeInTeam(user.index)
- + if isConst?(@battle.pbParty(i)[newpoke].ability,PBAbilities,:ILLUSION)
- + newpokename=pbGetLastPokeInTeam(i)
- end
- - user.pbResetForm
- - @battle.pbRecallAndReplace(user.index,newpoke,newpokename,true)
- - user.pbAbilitiesOnSwitchIn(true)
- + switched.push(i)
- + @battle.battlers[i].pbResetForm
- + @battle.pbRecallAndReplace(i,newpoke,newpokename,@battle.battlers[i].effects[PBEffects::BatonPass])
- + @battle.choices[i]=[0,0,nil,-1] # Replacement Pokémon does nothing this round
- end
- end
- end
- + for i in @battle.pbPriority
- + next if !switched.include?(i.index)
- + i.pbAbilitiesOnSwitchIn(true)
- + end
- + # Baton Pass
- + if user.effects[PBEffects::BatonPass]
- + user.effects[PBEffects::BatonPass]=false
- + if !user.isFainted? && @battle.pbCanChooseNonActive?(user.index) &&
- + [email protected]?(@battle.pbParty(user.index))
- + newpoke=0
- + [email protected](user.index,true,false)
- + newpokename=newpoke
- + if isConst?(@battle.pbParty(user.index)[newpoke].ability,PBAbilities,:ILLUSION)
- + newpokename=pbGetLastPokeInTeam(user.index)
- + end
- + user.pbResetForm
- + @battle.pbRecallAndReplace(user.index,newpoke,newpokename,true)
- + @battle.choices[user.index]=[0,0,nil,-1] # Replacement Pokémon does nothing this round
- + user.pbAbilitiesOnSwitchIn(true)
- + end
- + end
- # Record move as having been used
- user.lastMoveUsed=thismove.id
- user.lastMoveUsedType=thismove.pbType(thismove.type,user,nil)
- if !turneffects[PBEffects::SpecialUsage]
- user.lastMoveUsedSketch=thismove.id if user.effects[PBEffects::TwoTurnAttack]==0
- user.lastRegularMoveUsed=thismove.id
- diff --git a/Data/Scripts.rxdata/[081] PokeBattle_BattlerEffects.rb b/Data/Scripts.rxdata/[081] PokeBattle_BattlerEffects.rb
- index a6ddd71..79654d2 100644
- --- a/Data/Scripts.rxdata/[081] PokeBattle_BattlerEffects.rb
- +++ b/Data/Scripts.rxdata/[081] PokeBattle_BattlerEffects.rb
- @@ -25,7 +25,7 @@ class PokeBattle_Battler
- return false
- end
- end
- - if attacker.hasMoldBreaker || !hasWorkingAbility(:SOUNDPROOF)
- + if (attacker && attacker.hasMoldBreaker) || !hasWorkingAbility(:SOUNDPROOF)
- for i in 0...4
- if @battle.battlers[i].effects[PBEffects::Uproar]>0
- @battle.pbDisplay(_INTL("But the uproar kept {1} awake!",pbThis(true))) if showMessages
- @@ -851,11 +851,11 @@ class PokeBattle_Battler
- _INTL("{1}'s {2} severely fell!",pbThis,PBStats.getName(stat))]
- @battle.pbDisplay(arrStatTexts[[increment-1,2].min])
- # Defiant
- - if hasWorkingAbility(:DEFIANT) && (!attacker || attacker.pbIsOpposing?(self))
- + if hasWorkingAbility(:DEFIANT) && (!attacker || attacker.pbIsOpposing?(self.index))
- pbIncreaseStatWithCause(PBStats::ATTACK,2,self,PBAbilities.getName(self.ability))
- end
- # Competitive
- - if hasWorkingAbility(:COMPETITIVE) && (!attacker || attacker.pbIsOpposing?(self))
- + if hasWorkingAbility(:COMPETITIVE) && (!attacker || attacker.pbIsOpposing?(self.index))
- pbIncreaseStatWithCause(PBStats::SPATK,2,self,PBAbilities.getName(self.ability))
- end
- return true
- @@ -894,11 +894,11 @@ class PokeBattle_Battler
- end
- @battle.pbDisplay(arrStatTexts[[increment-1,2].min]) if showmessage
- # Defiant
- - if hasWorkingAbility(:DEFIANT) && (!attacker || attacker.pbIsOpposing?(self))
- + if hasWorkingAbility(:DEFIANT) && (!attacker || attacker.pbIsOpposing?(self.index))
- pbIncreaseStatWithCause(PBStats::ATTACK,2,self,PBAbilities.getName(self.ability))
- end
- # Competitive
- - if hasWorkingAbility(:COMPETITIVE) && (!attacker || attacker.pbIsOpposing?(self))
- + if hasWorkingAbility(:COMPETITIVE) && (!attacker || attacker.pbIsOpposing?(self.index))
- pbIncreaseStatWithCause(PBStats::SPATK,2,self,PBAbilities.getName(self.ability))
- end
- return true
- diff --git a/Data/Scripts.rxdata/[082] PokeBattle_Move.rb b/Data/Scripts.rxdata/[082] PokeBattle_Move.rb
- index 484b5d7..3a82c86 100644
- --- a/Data/Scripts.rxdata/[082] PokeBattle_Move.rb
- +++ b/Data/Scripts.rxdata/[082] PokeBattle_Move.rb
- @@ -77,17 +77,19 @@ class PokeBattle_Move
- def pbModifyType(type,attacker,opponent)
- if type>=0
- - if attacker.hasWorkingAbility(:NORMALIZE)
- - type=getConst(PBTypes,:NORMAL) || 0
- - elsif attacker.hasWorkingAbility(:AERILATE)
- - type=getConst(PBTypes,:FLYING) || 0
- - @powerboost=true
- - elsif attacker.hasWorkingAbility(:REFRIGERATE)
- - type=getConst(PBTypes,:ICE) || 0
- - @powerboost=true
- - elsif attacker.hasWorkingAbility(:PIXILATE)
- - type=getConst(PBTypes,:FAIRY) || 0
- - @powerboost=true
- + if attacker.hasWorkingAbility(:NORMALIZE) && hasConst?(PBTypes,:NORMAL)
- + type=getConst(PBTypes,:NORMAL)
- + elsif isConst?(type,PBTypes,:NORMAL)
- + if attacker.hasWorkingAbility(:AERILATE) && hasConst?(PBTypes,:FLYING)
- + type=getConst(PBTypes,:FLYING)
- + @powerboost=true
- + elsif attacker.hasWorkingAbility(:REFRIGERATE) && hasConst?(PBTypes,:ICE)
- + type=getConst(PBTypes,:ICE)
- + @powerboost=true
- + elsif attacker.hasWorkingAbility(:PIXILATE) && hasConst?(PBTypes,:FAIRY)
- + type=getConst(PBTypes,:FAIRY)
- + @powerboost=true
- + end
- end
- end
- return type
- @@ -96,13 +98,13 @@ class PokeBattle_Move
- def pbType(type,attacker,opponent)
- @powerboost=false
- type=pbModifyType(type,attacker,opponent)
- - if type>=0
- + if type>=0 && hasConst?(PBTypes,:ELECTRIC)
- if @battle.field.effects[PBEffects::IonDeluge] && isConst?(type,PBTypes,:NORMAL)
- - type=getConst(PBTypes,:ELECTRIC) || 0
- + type=getConst(PBTypes,:ELECTRIC)
- @powerboost=false
- end
- if attacker.effects[PBEffects::Electrify]
- - type=getConst(PBTypes,:ELECTRIC) || 0
- + type=getConst(PBTypes,:ELECTRIC)
- @powerboost=false
- end
- end
- @@ -159,13 +161,15 @@ class PokeBattle_Move
- # Parental Bond goes here (for single target moves only)
- if attacker.hasWorkingAbility(:PARENTALBOND)
- if pbIsDamaging? && !pbTargetsMultiple?(attacker) &&
- - !pbIsMultiHit && !pbTwoTurnAttack(attacker) &&
- - [0x6E, # Endeavor
- - 0xE0, # Selfdestruct/Explosion
- - 0xE1, # Final Gambit
- - 0xF7].include?(@function) # Fling
- - attacker.effects[PBEffects::ParentalBond]=3
- - return 2
- + !pbIsMultiHit && !pbTwoTurnAttack(attacker)
- + exceptions=[0x6E, # Endeavor
- + 0xE0, # Selfdestruct/Explosion
- + 0xE1, # Final Gambit
- + 0xF7] # Fling
- + if !exceptions.include?(@function)
- + attacker.effects[PBEffects::ParentalBond]=3
- + return 2
- + end
- end
- end
- # Need to record that Parental Bond applies, to weaken the second attack
- @@ -382,8 +386,7 @@ class PokeBattle_Move
- mod3=2 if mod3==0
- end
- # Foresight
- - if attacker.hasWorkingAbility(:SCRAPPY) ||
- - opponent.effects[PBEffects::Foresight]
- + if attacker.hasWorkingAbility(:SCRAPPY) || opponent.effects[PBEffects::Foresight]
- mod1=2 if isConst?(otype1,PBTypes,:GHOST) && PBTypes.isIneffective?(atype,otype1)
- mod2=2 if isConst?(otype2,PBTypes,:GHOST) && PBTypes.isIneffective?(atype,otype2)
- mod3=2 if isConst?(otype3,PBTypes,:GHOST) && PBTypes.isIneffective?(atype,otype3)
- @@ -401,11 +404,11 @@ class PokeBattle_Move
- mod3=2 if isConst?(otype3,PBTypes,:FLYING) && PBTypes.isSuperEffective?(atype,otype3)
- end
- # Smack Down makes Ground moves work against fliers
- - if !opponent.isAirborne?(attacker.hasMoldBreaker) ||
- - @function==0x11C # Smack Down
- - mod1=2 if isConst?(otype1,PBTypes,:FLYING) && isConst?(atype,PBTypes,:GROUND)
- - mod2=2 if isConst?(otype2,PBTypes,:FLYING) && isConst?(atype,PBTypes,:GROUND)
- - mod3=2 if isConst?(otype3,PBTypes,:FLYING) && isConst?(atype,PBTypes,:GROUND)
- + if (!opponent.isAirborne?(attacker.hasMoldBreaker) || @function==0x11C) && # Smack Down
- + isConst?(atype,PBTypes,:GROUND)
- + mod1=2 if isConst?(otype1,PBTypes,:FLYING)
- + mod2=2 if isConst?(otype2,PBTypes,:FLYING)
- + mod3=2 if isConst?(otype3,PBTypes,:FLYING)
- end
- if @function==0x135 && !attacker.effects[PBEffects::Electrify] # Freeze-Dry
- mod1=4 if isConst?(otype1,PBTypes,:WATER)
- @@ -1102,6 +1105,7 @@ class PokeBattle_Move
- finaldamagemult=(finaldamagemult*1.2).round
- end
- if attacker.hasWorkingItem(:LIFEORB) && (options&SELFCONFUSE)==0
- + attacker.effects[PBEffects::LifeOrb]=true
- finaldamagemult=(finaldamagemult*1.3).round
- end
- if opponent.damagestate.typemod>8 && (options&IGNOREPKMNTYPES)==0
- @@ -1284,9 +1288,6 @@ class PokeBattle_Move
- def pbAddTarget(targets,attacker)
- end
- - def pbSuccessCheck(attacker,opponent,numtargets)
- - end
- -
- def pbDisplayUseMessage(attacker)
- # Return values:
- # -1 if the attack should exit as a failure
- diff --git a/Data/Scripts.rxdata/[083] PokeBattle_MoveEffects.rb b/Data/Scripts.rxdata/[083] PokeBattle_MoveEffects.rb
- index 3fbb268..56c8814 100644
- --- a/Data/Scripts.rxdata/[083] PokeBattle_MoveEffects.rb
- +++ b/Data/Scripts.rxdata/[083] PokeBattle_MoveEffects.rb
- @@ -74,7 +74,7 @@ class PokeBattle_Struggle < PokeBattle_Move
- @name = _INTL("Struggle")
- @basedamage = 50
- @type = -1
- - @accuracy = 100
- + @accuracy = 0
- @addlEffect = 0
- @target = 0
- @priority = 0
- @@ -91,13 +91,11 @@ class PokeBattle_Struggle < PokeBattle_Move
- def pbIsPhysical?(type); return true; end
- def pbIsSpecial?(type); return false; end
- - def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
- - ret=super(attacker,opponent,hitnum,alltargets,showanimation)
- - if opponent.damagestate.calcdamage>0
- - attacker.pbReduceHP((attacker.totalhp/4).floor)
- + def pbEffectAfterHit(attacker,opponent,turneffects)
- + if !attacker.isFainted? && turneffects[PBEffects::TotalDamage]>0
- + attacker.pbReduceHP((attacker.totalhp/4.0).round)
- @battle.pbDisplay(_INTL("{1} is damaged by recoil!",attacker.pbThis))
- end
- - return ret
- end
- def pbCalcDamage(attacker,opponent)
- @@ -156,11 +154,10 @@ class PokeBattle_Move_003 < PokeBattle_Move
- end
- def pbAdditionalEffect(attacker,opponent)
- + return if opponent.damagestate.substitute
- if opponent.pbCanSleep?(attacker,false,self)
- opponent.pbSleep
- - return true
- end
- - return false
- end
- def pbEffectAfterHit(attacker,opponent,turneffects)
- @@ -169,7 +166,7 @@ class PokeBattle_Move_003 < PokeBattle_Move
- !attacker.effects[PBEffects::Transform] &&
- !(attacker.hasWorkingAbility(:SHEERFORCE) && self.addlEffect>0) &&
- !attacker.isFainted?
- - attacker.form=(self.form+1)%2
- + attacker.form=(attacker.form+1)%2
- attacker.pbUpdate(true)
- @battle.scene.pbChangePokemon(attacker,attacker.pokemon)
- @battle.pbDisplay(_INTL("{1} transformed!",attacker.pbThis))
- @@ -213,9 +210,10 @@ class PokeBattle_Move_005 < PokeBattle_Move
- end
- def pbAdditionalEffect(attacker,opponent)
- - return false if !opponent.pbCanPoison?(attacker,false,self)
- - opponent.pbPoison(attacker)
- - return true
- + return if opponent.damagestate.substitute
- + if opponent.pbCanPoison?(attacker,false,self)
- + opponent.pbPoison(attacker)
- + end
- end
- end
- @@ -231,14 +229,15 @@ class PokeBattle_Move_006 < PokeBattle_Move
- return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
- return -1 if !opponent.pbCanPoison?(attacker,true,self)
- pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
- - opponent.pbPoison(attacker,true)
- + opponent.pbPoison(attacker,nil,true)
- return 0
- end
- def pbAdditionalEffect(attacker,opponent)
- - return false if !opponent.pbCanPoison?(attacker,false,self)
- - opponent.pbPoison(attacker,true)
- - return true
- + return if opponent.damagestate.substitute
- + if opponent.pbCanPoison?(attacker,false,self)
- + opponent.pbPoison(attacker,nil,true)
- + end
- end
- end
- @@ -274,9 +273,10 @@ class PokeBattle_Move_007 < PokeBattle_Move
- end
- def pbAdditionalEffect(attacker,opponent)
- - return false if !opponent.pbCanParalyze?(attacker,false,self)
- - opponent.pbParalyze(attacker)
- - return true
- + return if opponent.damagestate.substitute
- + if opponent.pbCanParalyze?(attacker,false,self)
- + opponent.pbParalyze(attacker)
- + end
- end
- end
- @@ -288,9 +288,10 @@ end
- ################################################################################
- class PokeBattle_Move_008 < PokeBattle_Move
- def pbAdditionalEffect(attacker,opponent)
- - return false if !opponent.pbCanParalyze?(attacker,false,self)
- - opponent.pbParalyze(attacker)
- - return true
- + return if opponent.damagestate.substitute
- + if opponent.pbCanParalyze?(attacker,false,self)
- + opponent.pbParalyze(attacker)
- + end
- end
- def pbModifyBaseAccuracy(baseaccuracy,attacker,opponent)
- @@ -311,18 +312,15 @@ end
- ################################################################################
- class PokeBattle_Move_009 < PokeBattle_Move
- def pbAdditionalEffect(attacker,opponent)
- - hadeffect=false
- + return if opponent.damagestate.substitute
- if @battle.pbRandom(10)==0
- - break if !opponent.pbCanParalyze?(attacker,false,self)
- - opponent.pbParalyze(attacker)
- - hadeffect=true
- - end
- - if @battle.pbRandom(10)==0
- - if opponent.effects[PBEffects::Substitute]==0 || ignoresSubstitute?(attacker)
- - hadeffect=true if opponent.pbFlinch(attacker)
- + if opponent.pbCanParalyze?(attacker,false,self)
- + opponent.pbParalyze(attacker)
- end
- end
- - return hadeffect
- + if @battle.pbRandom(10)==0
- + opponent.pbFlinch(attacker)
- + end
- end
- end
- @@ -351,9 +349,10 @@ class PokeBattle_Move_00A < PokeBattle_Move
- end
- def pbAdditionalEffect(attacker,opponent)
- - return false if !opponent.pbCanBurn?(attacker,false,self)
- - opponent.pbBurn(attacker)
- - return true
- + return if opponent.damagestate.substitute
- + if opponent.pbCanBurn?(attacker,false,self)
- + opponent.pbBurn(attacker)
- + end
- end
- end
- @@ -364,18 +363,15 @@ end
- ################################################################################
- class PokeBattle_Move_00B < PokeBattle_Move
- def pbAdditionalEffect(attacker,opponent)
- - hadeffect=false
- + return if opponent.damagestate.substitute
- if @battle.pbRandom(10)==0
- - break if !opponent.pbCanBurn?(attacker,false,self)
- - opponent.pbBurn(attacker)
- - hadeffect=true
- - end
- - if @battle.pbRandom(10)==0
- - if opponent.effects[PBEffects::Substitute]==0 || ignoresSubstitute?(attacker)
- - hadeffect=true if opponent.pbFlinch(attacker)
- + if opponent.pbCanBurn?(attacker,false,self)
- + opponent.pbBurn(attacker)
- end
- end
- - return hadeffect
- + if @battle.pbRandom(10)==0
- + opponent.pbFlinch(attacker)
- + end
- end
- end
- @@ -394,11 +390,10 @@ class PokeBattle_Move_00C < PokeBattle_Move
- end
- def pbAdditionalEffect(attacker,opponent)
- + return if opponent.damagestate.substitute
- if opponent.pbCanFreeze?(attacker,false,self)
- opponent.pbFreeze
- - return true
- end
- - return false
- end
- end
- @@ -417,11 +412,10 @@ class PokeBattle_Move_00D < PokeBattle_Move
- end
- def pbAdditionalEffect(attacker,opponent)
- + return if opponent.damagestate.substitute
- if opponent.pbCanFreeze?(attacker,false,self)
- opponent.pbFreeze
- - return true
- end
- - return false
- end
- def pbModifyBaseAccuracy(baseaccuracy,attacker,opponent)
- @@ -439,18 +433,15 @@ end
- ################################################################################
- class PokeBattle_Move_00E < PokeBattle_Move
- def pbAdditionalEffect(attacker,opponent)
- - hadeffect=false
- + return if opponent.damagestate.substitute
- if @battle.pbRandom(10)==0
- - break if !opponent.pbCanFreeze?(attacker,false,self)
- - opponent.pbFreeze
- - hadeffect=true
- - end
- - if @battle.pbRandom(10)==0
- - if opponent.effects[PBEffects::Substitute]==0 || ignoresSubstitute?(attacker)
- - hadeffect=true if opponent.pbFlinch(attacker)
- + if opponent.pbCanFreeze?(attacker,false,self)
- + opponent.pbFreeze
- end
- end
- - return hadeffect
- + if @battle.pbRandom(10)==0
- + opponent.pbFlinch(attacker)
- + end
- end
- end
- @@ -461,10 +452,8 @@ end
- ################################################################################
- class PokeBattle_Move_00F < PokeBattle_Move
- def pbAdditionalEffect(attacker,opponent)
- - if opponent.effects[PBEffects::Substitute]==0 || ignoresSubstitute?(attacker)
- - return opponent.pbFlinch(attacker)
- - end
- - return false
- + return if opponent.damagestate.substitute
- + opponent.pbFlinch(attacker)
- end
- end
- @@ -476,10 +465,8 @@ end
- ################################################################################
- class PokeBattle_Move_010 < PokeBattle_Move
- def pbAdditionalEffect(attacker,opponent)
- - if opponent.effects[PBEffects::Substitute]==0 || ignoresSubstitute?(attacker)
- - return opponent.pbFlinch(attacker)
- - end
- - return false
- + return if opponent.damagestate.substitute
- + opponent.pbFlinch(attacker)
- end
- def tramplesMinimize?(param=1)
- @@ -505,10 +492,8 @@ class PokeBattle_Move_011 < PokeBattle_Move
- end
- def pbAdditionalEffect(attacker,opponent)
- - if opponent.effects[PBEffects::Substitute]==0 || ignoresSubstitute?(attacker)
- - return opponent.pbFlinch(attacker)
- - end
- - return false
- + return if opponent.damagestate.substitute
- + opponent.pbFlinch(attacker)
- end
- end
- @@ -523,10 +508,8 @@ class PokeBattle_Move_012 < PokeBattle_Move
- end
- def pbAdditionalEffect(attacker,opponent)
- - if opponent.effects[PBEffects::Substitute]==0 || ignoresSubstitute?(attacker)
- - return opponent.pbFlinch(attacker)
- - end
- - return false
- + return if opponent.damagestate.substitute
- + opponent.pbFlinch(attacker)
- end
- end
- @@ -548,12 +531,11 @@ class PokeBattle_Move_013 < PokeBattle_Move
- end
- def pbAdditionalEffect(attacker,opponent)
- + return if opponent.damagestate.substitute
- if opponent.pbCanConfuse?(attacker,false,self)
- opponent.pbConfuse
- @battle.pbDisplay(_INTL("{1} became confused!",opponent.pbThis))
- - return true
- end
- - return false
- end
- end
- @@ -575,12 +557,11 @@ class PokeBattle_Move_014 < PokeBattle_Move
- end
- def pbAdditionalEffect(attacker,opponent)
- + return if opponent.damagestate.substitute
- if opponent.pbCanConfuse?(attacker,false,self)
- opponent.pbConfuse
- @battle.pbDisplay(_INTL("{1} became confused!",opponent.pbThis))
- - return true
- end
- - return false
- end
- end
- @@ -603,12 +584,11 @@ class PokeBattle_Move_015 < PokeBattle_Move
- end
- def pbAdditionalEffect(attacker,opponent)
- + return if opponent.damagestate.substitute
- if opponent.pbCanConfuse?(attacker,false,self)
- opponent.pbConfuse
- @battle.pbDisplay(_INTL("{1} became confused!",opponent.pbThis))
- - return true
- end
- - return false
- end
- def pbModifyBaseAccuracy(baseaccuracy,attacker,opponent)
- @@ -656,19 +636,21 @@ end
- ################################################################################
- class PokeBattle_Move_017 < PokeBattle_Move
- def pbAdditionalEffect(attacker,opponent)
- - [email protected](3)
- - case rnd
- + return if opponent.damagestate.substitute
- + case @battle.pbRandom(3)
- when 0
- - return false if !opponent.pbCanBurn?(attacker,false,self)
- - opponent.pbBurn(attacker)
- + if opponent.pbCanBurn?(attacker,false,self)
- + opponent.pbBurn(attacker)
- + end
- when 1
- - return false if !opponent.pbCanFreeze?(attacker,false,self)
- - opponent.pbFreeze
- + if opponent.pbCanFreeze?(attacker,false,self)
- + opponent.pbFreeze
- + end
- when 2
- - return false if !opponent.pbCanParalyze?(attacker,false,self)
- - opponent.pbParalyze(attacker)
- + if opponent.pbCanParalyze?(attacker,false,self)
- + opponent.pbParalyze(attacker)
- + end
- end
- - return true
- end
- end
- @@ -807,7 +789,7 @@ class PokeBattle_Move_01B < PokeBattle_Move
- attacker.pbCureStatus(false)
- @battle.pbDisplay(_INTL("{1} woke up.",attacker.pbThis))
- when PBStatuses::POISON
- - opponent.pbPoison(attacker,attacker.statusCount!=0)
- + opponent.pbPoison(attacker,nil,attacker.statusCount!=0)
- opponent.pbAbilityCureCheck
- attacker.pbCureStatus(false)
- @battle.pbDisplay(_INTL("{1} was cured of its poisoning.",attacker.pbThis))
- @@ -844,7 +826,6 @@ class PokeBattle_Move_01C < PokeBattle_Move
- if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
- attacker.pbIncreaseStat(PBStats::ATTACK,1,attacker,false,self)
- end
- - return true
- end
- end
- @@ -866,7 +847,6 @@ class PokeBattle_Move_01D < PokeBattle_Move
- if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
- attacker.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self)
- end
- - return true
- end
- end
- @@ -903,7 +883,6 @@ class PokeBattle_Move_01F < PokeBattle_Move
- if attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
- attacker.pbIncreaseStat(PBStats::SPEED,1,attacker,false,self)
- end
- - return true
- end
- end
- @@ -925,7 +904,6 @@ class PokeBattle_Move_020 < PokeBattle_Move
- if attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
- attacker.pbIncreaseStat(PBStats::SPATK,1,attacker,false,self)
- end
- - return true
- end
- end
- @@ -965,7 +943,6 @@ class PokeBattle_Move_022 < PokeBattle_Move
- if attacker.pbCanIncreaseStatStage?(PBStats::EVASION,attacker,false,self)
- attacker.pbIncreaseStat(PBStats::EVASION,1,attacker,false,self)
- end
- - return true
- end
- end
- @@ -992,7 +969,6 @@ class PokeBattle_Move_023 < PokeBattle_Move
- attacker.effects[PBEffects::FocusEnergy]=2
- @battle.pbDisplay(_INTL("{1} is getting pumped!",attacker.pbThis))
- end
- - return true
- end
- end
- @@ -1275,7 +1251,6 @@ class PokeBattle_Move_02D < PokeBattle_Move
- attacker.pbIncreaseStat(PBStats::SPEED,1,attacker,false,self,showanim)
- showanim=false
- end
- - return true
- end
- end
- @@ -1297,7 +1272,6 @@ class PokeBattle_Move_02E < PokeBattle_Move
- if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
- attacker.pbIncreaseStat(PBStats::ATTACK,2,attacker,false,self)
- end
- - return true
- end
- end
- @@ -1319,7 +1293,6 @@ class PokeBattle_Move_02F < PokeBattle_Move
- if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
- attacker.pbIncreaseStat(PBStats::DEFENSE,2,attacker,false,self)
- end
- - return true
- end
- end
- @@ -1341,7 +1314,6 @@ class PokeBattle_Move_030 < PokeBattle_Move
- if attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
- attacker.pbIncreaseStat(PBStats::SPEED,2,attacker,false,self)
- end
- - return true
- end
- end
- @@ -1381,7 +1353,6 @@ class PokeBattle_Move_032 < PokeBattle_Move
- if attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
- attacker.pbIncreaseStat(PBStats::SPATK,2,attacker,false,self)
- end
- - return true
- end
- end
- @@ -1403,7 +1374,6 @@ class PokeBattle_Move_033 < PokeBattle_Move
- if attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
- attacker.pbIncreaseStat(PBStats::SPDEF,2,attacker,false,self)
- end
- - return true
- end
- end
- @@ -1427,7 +1397,6 @@ class PokeBattle_Move_034 < PokeBattle_Move
- if attacker.pbCanIncreaseStatStage?(PBStats::EVASION,attacker,false,self)
- attacker.pbIncreaseStat(PBStats::EVASION,2,attacker,false,self)
- end
- - return true
- end
- end
- @@ -1546,7 +1515,6 @@ class PokeBattle_Move_038 < PokeBattle_Move
- if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
- attacker.pbIncreaseStat(PBStats::DEFENSE,3,attacker,false,self)
- end
- - return true
- end
- end
- @@ -1568,7 +1536,6 @@ class PokeBattle_Move_039 < PokeBattle_Move
- if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
- attacker.pbIncreaseStat(PBStats::SPATK,3,attacker,false,self)
- end
- - return true
- end
- end
- @@ -1777,10 +1744,10 @@ class PokeBattle_Move_042 < PokeBattle_Move
- end
- def pbAdditionalEffect(attacker,opponent)
- + return if opponent.damagestate.substitute
- if opponent.pbCanReduceStatStage?(PBStats::ATTACK,attacker,false,self)
- opponent.pbReduceStat(PBStats::ATTACK,1,attacker,false,self)
- end
- - return true
- end
- end
- @@ -1799,10 +1766,10 @@ class PokeBattle_Move_043 < PokeBattle_Move
- end
- def pbAdditionalEffect(attacker,opponent)
- + return if opponent.damagestate.substitute
- if opponent.pbCanReduceStatStage?(PBStats::DEFENSE,attacker,false,self)
- opponent.pbReduceStat(PBStats::DEFENSE,1,attacker,false,self)
- end
- - return true
- end
- end
- @@ -1821,10 +1788,10 @@ class PokeBattle_Move_044 < PokeBattle_Move
- end
- def pbAdditionalEffect(attacker,opponent)
- + return if opponent.damagestate.substitute
- if opponent.pbCanReduceStatStage?(PBStats::SPEED,attacker,false,self)
- opponent.pbReduceStat(PBStats::SPEED,1,attacker,false,self)
- end
- - return true
- end
- def pbModifyDamage(damagemult,attacker,opponent)
- @@ -1851,10 +1818,10 @@ class PokeBattle_Move_045 < PokeBattle_Move
- end
- def pbAdditionalEffect(attacker,opponent)
- + return if opponent.damagestate.substitute
- if opponent.pbCanReduceStatStage?(PBStats::SPATK,attacker,false,self)
- opponent.pbReduceStat(PBStats::SPATK,1,attacker,false,self)
- end
- - return true
- end
- end
- @@ -1873,10 +1840,10 @@ class PokeBattle_Move_046 < PokeBattle_Move
- end
- def pbAdditionalEffect(attacker,opponent)
- + return if opponent.damagestate.substitute
- if opponent.pbCanReduceStatStage?(PBStats::SPDEF,attacker,false,self)
- opponent.pbReduceStat(PBStats::SPDEF,1,attacker,false,self)
- end
- - return true
- end
- end
- @@ -1895,10 +1862,10 @@ class PokeBattle_Move_047 < PokeBattle_Move
- end
- def pbAdditionalEffect(attacker,opponent)
- + return if opponent.damagestate.substitute
- if opponent.pbCanReduceStatStage?(PBStats::ACCURACY,attacker,false,self)
- opponent.pbReduceStat(PBStats::ACCURACY,1,attacker,false,self)
- end
- - return true
- end
- end
- @@ -1918,18 +1885,18 @@ class PokeBattle_Move_048 < PokeBattle_Move
- end
- def pbAdditionalEffect(attacker,opponent)
- + return if opponent.damagestate.substitute
- if opponent.pbCanReduceStatStage?(PBStats::EVASION,attacker,false,self)
- increment=(USENEWBATTLEMECHANICS) ? 2 : 1
- opponent.pbReduceStat(PBStats::EVASION,increment,attacker,false,self)
- end
- - return true
- end
- end
- ################################################################################
- -# Decreases the target's evasion by 1 stage. Ends all barriers and entry
- +# Decreases the target's evasion by 1 stage. Ends all barriers and entry
- # hazards for the target's side OR on both sides. (Defog)
- ################################################################################
- class PokeBattle_Move_049 < PokeBattle_Move
- @@ -1959,8 +1926,10 @@ class PokeBattle_Move_049 < PokeBattle_Move
- end
- def pbAdditionalEffect(attacker,opponent)
- - if opponent.pbCanReduceStatStage?(PBStats::EVASION,attacker,false,self)
- - opponent.pbReduceStat(PBStats::EVASION,1,attacker,false,self)
- + if !opponent.damagestate.substitute
- + if opponent.pbCanReduceStatStage?(PBStats::EVASION,attacker,false,self)
- + opponent.pbReduceStat(PBStats::EVASION,1,attacker,false,self)
- + end
- end
- opponent.pbOwnSide.effects[PBEffects::Reflect] = 0
- opponent.pbOwnSide.effects[PBEffects::LightScreen] = 0
- @@ -1980,7 +1949,6 @@ class PokeBattle_Move_049 < PokeBattle_Move
- opponent.pbOpposingSide.effects[PBEffects::StickyWeb] = false
- opponent.pbOpposingSide.effects[PBEffects::ToxicSpikes] = 0
- end
- - return true
- end
- end
- @@ -2049,10 +2017,10 @@ class PokeBattle_Move_04B < PokeBattle_Move
- end
- def pbAdditionalEffect(attacker,opponent)
- + return if opponent.damagestate.substitute
- if opponent.pbCanReduceStatStage?(PBStats::ATTACK,attacker,false,self)
- opponent.pbReduceStat(PBStats::ATTACK,2,attacker,false,self)
- end
- - return true
- end
- end
- @@ -2071,10 +2039,10 @@ class PokeBattle_Move_04C < PokeBattle_Move
- end
- def pbAdditionalEffect(attacker,opponent)
- + return if opponent.damagestate.substitute
- if opponent.pbCanReduceStatStage?(PBStats::DEFENSE,attacker,false,self)
- opponent.pbReduceStat(PBStats::DEFENSE,2,attacker,false,self)
- end
- - return true
- end
- end
- @@ -2095,11 +2063,11 @@ class PokeBattle_Move_04D < PokeBattle_Move
- end
- def pbAdditionalEffect(attacker,opponent)
- + return if opponent.damagestate.substitute
- if opponent.pbCanReduceStatStage?(PBStats::SPEED,attacker,false,self)
- increment=(isConst?(@id,PBMoves,:STRINGSHOT) && !USENEWBATTLEMECHANICS) ? 1 : 2
- opponent.pbReduceStat(PBStats::SPEED,increment,attacker,false,self)
- end
- - return true
- end
- end
- @@ -2128,13 +2096,14 @@ class PokeBattle_Move_04E < PokeBattle_Move
- end
- def pbAdditionalEffect(attacker,opponent)
- - return false if attacker.gender==2 || opponent.gender==2 ||
- - attacker.gender==opponent.gender
- - return false if !attacker.hasMoldBreaker && opponent.hasWorkingAbility(:OBLIVIOUS)
- - if opponent.pbCanReduceStatStage?(PBStats::SPATK,attacker,false,self)
- - opponent.pbReduceStat(PBStats::SPATK,2,attacker,false,self)
- + return if opponent.damagestate.substitute
- + if attacker.gender!=2 && opponent.gender!=2 && attacker.gender!=opponent.gender
- + if attacker.hasMoldBreaker || !opponent.hasWorkingAbility(:OBLIVIOUS)
- + if opponent.pbCanReduceStatStage?(PBStats::SPATK,attacker,false,self)
- + opponent.pbReduceStat(PBStats::SPATK,2,attacker,false,self)
- + end
- + end
- end
- - return true
- end
- end
- @@ -2153,10 +2122,10 @@ class PokeBattle_Move_04F < PokeBattle_Move
- end
- def pbAdditionalEffect(attacker,opponent)
- + return if opponent.damagestate.substitute
- if opponent.pbCanReduceStatStage?(PBStats::SPDEF,attacker,false,self)
- opponent.pbReduceStat(PBStats::SPDEF,2,attacker,false,self)
- end
- - return true
- end
- end
- @@ -2586,24 +2555,24 @@ class PokeBattle_Move_060 < PokeBattle_Move
- @battle.pbDisplay(_INTL("But it failed!"))
- return -1
- end
- - envtypes=[
- - :NORMAL, # None
- - :GRASS, # Grass
- - :GRASS, # Tall grass
- - :WATER, # Moving water
- - :WATER, # Still water
- - :WATER, # Underwater
- - :ROCK, # Cave
- - :GROUND, # Rock
- - :GROUND, # Sand
- - :BUG, # Forest
- - :ICE, # Snow
- - :FIRE, # Volcano
- - :GHOST, # Graveyard
- - :FLYING, # Sky
- - :DRAGON # Space
- - ]
- - type=getConst(PBTypes,envtypes[@battle.environment]) || 0
- + type=getConst(PBTypes,:NORMAL) || 0
- + case @battle.environment
- + when PBEnvironment::None; type=getConst(PBTypes,:NORMAL) || 0
- + when PBEnvironment::Grass; type=getConst(PBTypes,:GRASS) || 0
- + when PBEnvironment::TallGrass; type=getConst(PBTypes,:GRASS) || 0
- + when PBEnvironment::MovingWater; type=getConst(PBTypes,:WATER) || 0
- + when PBEnvironment::StillWater; type=getConst(PBTypes,:WATER) || 0
- + when PBEnvironment::Underwater; type=getConst(PBTypes,:WATER) || 0
- + when PBEnvironment::Cave; type=getConst(PBTypes,:ROCK) || 0
- + when PBEnvironment::Rock; type=getConst(PBTypes,:GROUND) || 0
- + when PBEnvironment::Sand; type=getConst(PBTypes,:GROUND) || 0
- + when PBEnvironment::Forest; type=getConst(PBTypes,:BUG) || 0
- + when PBEnvironment::Snow; type=getConst(PBTypes,:ICE) || 0
- + when PBEnvironment::Volcano; type=getConst(PBTypes,:FIRE) || 0
- + when PBEnvironment::Graveyard; type=getConst(PBTypes,:GHOST) || 0
- + when PBEnvironment::Sky; type=getConst(PBTypes,:FLYING) || 0
- + when PBEnvironment::Space; type=getConst(PBTypes,:DRAGON) || 0
- + end
- if @battle.field.effects[PBEffects::ElectricTerrain]>0
- type=getConst(PBTypes,:ELECTRIC) if hasConst?(PBTypes,:ELECTRIC)
- elsif @battle.field.effects[PBEffects::GrassyTerrain]>0
- @@ -3153,9 +3122,9 @@ class PokeBattle_Move_074 < PokeBattle_Move
- ret=super(attacker,opponent,hitnum,alltargets,showanimation)
- if opponent.damagestate.calcdamage>0
- if opponent.pbPartner && !opponent.pbPartner.isFainted? &&
- - !opponent.pbParnter.hasWorkingAbility(:MAGICGUARD)
- + !opponent.pbPartner.hasWorkingAbility(:MAGICGUARD)
- opponent.pbPartner.pbReduceHP((opponent.pbPartner.totalhp/16).floor)
- - @battle.pbDisplay(_INTL("The bursting flame hit {1}",opponent.pbPartner.pbThis(true)))
- + @battle.pbDisplay(_INTL("The bursting flame hit {1}!",opponent.pbPartner.pbThis(true)))
- end
- end
- return ret
- @@ -3234,10 +3203,8 @@ class PokeBattle_Move_078 < PokeBattle_Move
- end
- def pbAdditionalEffect(attacker,opponent)
- - if opponent.effects[PBEffects::Substitute]==0 || ignoresSubstitute?(attacker)
- - return opponent.pbFlinch(attacker)
- - end
- - return false
- + return if opponent.damagestate.substitute
- + opponent.pbFlinch(attacker)
- end
- end
- @@ -3826,7 +3793,7 @@ end
- class PokeBattle_Move_096 < PokeBattle_Move
- def pbOnStartUse(attacker)
- if !pbIsBerry?(attacker.item) ||
- - @effects[PBEffects::Embargo]>0 ||
- + attacker.effects[PBEffects::Embargo]>0 ||
- @battle.field.effects[PBEffects::MagicRoom]>0 ||
- attacker.hasWorkingAbility(:KLUTZ) ||
- attacker.pbOpposing1.hasWorkingAbility(:UNNERVE) ||
- @@ -3907,7 +3874,7 @@ class PokeBattle_Move_096 < PokeBattle_Move
- end
- def pbEffectAfterHit(attacker,opponent,turneffects)
- - if opponent.damagestate.calcdamage>0
- + if turneffects[PBEffects::TotalDamage]>0>0
- attacker.pbConsumeItem
- end
- end
- @@ -4214,88 +4181,94 @@ end
- ################################################################################
- class PokeBattle_Move_0A4 < PokeBattle_Move
- def pbAdditionalEffect(attacker,opponent)
- + return if opponent.damagestate.substitute
- if @battle.field.effects[PBEffects::ElectricTerrain]>0
- - return false if !opponent.pbCanParalyze?(attacker,false,self)
- - opponent.pbParalyze(attacker)
- - return true
- + if opponent.pbCanParalyze?(attacker,false,self)
- + opponent.pbParalyze(attacker)
- + return
- + end
- elsif @battle.field.effects[PBEffects::GrassyTerrain]>0
- - return false if !opponent.pbCanSleep?(attacker,false,self)
- - opponent.pbSleep
- - return true
- + if opponent.pbCanSleep?(attacker,false,self)
- + opponent.pbSleep
- + return
- + end
- elsif @battle.field.effects[PBEffects::MistyTerrain]>0
- - return false if !opponent.pbCanReduceStatStage?(PBStats::SPATK,attacker,false,self)
- - opponent.pbReduceStat(PBStats::SPATK,1,attacker,false,self)
- - return true
- + if !opponent.pbCanReduceStatStage?(PBStats::SPATK,attacker,false,self)
- + opponent.pbReduceStat(PBStats::SPATK,1,attacker,false,self)
- + return
- + end
- end
- case @battle.environment
- when PBEnvironment::Grass, PBEnvironment::TallGrass, PBEnvironment::Forest
- - return false if !opponent.pbCanSleep?(attacker,false,self)
- - opponent.pbSleep
- + if opponent.pbCanSleep?(attacker,false,self)
- + opponent.pbSleep
- + end
- when PBEnvironment::MovingWater, PBEnvironment::Underwater
- - return false if !opponent.pbCanReduceStatStage?(PBStats::ATTACK,attacker,false,self)
- - opponent.pbReduceStat(PBStats::ATTACK,1,attacker,false,self)
- + if opponent.pbCanReduceStatStage?(PBStats::ATTACK,attacker,false,self)
- + opponent.pbReduceStat(PBStats::ATTACK,1,attacker,false,self)
- + end
- when PBEnvironment::StillWater, PBEnvironment::Sky
- - return false if !opponent.pbCanReduceStatStage?(PBStats::SPEED,attacker,false,self)
- - opponent.pbReduceStat(PBStats::SPEED,1,attacker,false,self)
- + if !opponent.pbCanReduceStatStage?(PBStats::SPEED,attacker,false,self)
- + opponent.pbReduceStat(PBStats::SPEED,1,attacker,false,self)
- + end
- when PBEnvironment::Sand
- - return false if !opponent.pbCanReduceStatStage?(PBStats::ACCURACY,attacker,false,self)
- - opponent.pbReduceStat(PBStats::ACCURACY,1,attacker,false,self)
- + if opponent.pbCanReduceStatStage?(PBStats::ACCURACY,attacker,false,self)
- + opponent.pbReduceStat(PBStats::ACCURACY,1,attacker,false,self)
- + end
- when PBEnvironment::Rock
- if USENEWBATTLEMECHANICS
- - return false if !opponent.pbCanReduceStatStage?(PBStats::ACCURACY,attacker,false,self)
- - opponent.pbReduceStat(PBStats::ACCURACY,1,attacker,false,self)
- + if opponent.pbCanReduceStatStage?(PBStats::ACCURACY,attacker,false,self)
- + opponent.pbReduceStat(PBStats::ACCURACY,1,attacker,false,self)
- + end
- else
- - return false if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
- - return opponent.pbFlinch(attacker)
- + if opponent.effects[PBEffects::Substitute]==0 || ignoresSubstitute?(attacker)
- + opponent.pbFlinch(attacker)
- + end
- end
- when PBEnvironment::Cave, PBEnvironment::Graveyard, PBEnvironment::Space
- - return false if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
- - return opponent.pbFlinch(attacker)
- + if opponent.effects[PBEffects::Substitute]==0 || ignoresSubstitute?(attacker)
- + opponent.pbFlinch(attacker)
- + end
- when PBEnvironment::Snow
- - return false if !opponent.pbCanFreeze?(attacker,false,self)
- - opponent.pbFreeze
- + if opponent.pbCanFreeze?(attacker,false,self)
- + opponent.pbFreeze
- + end
- when PBEnvironment::Volcano
- - return false if !opponent.pbCanBurn?(attacker,false,self)
- - opponent.pbBurn(attacker)
- + if opponent.pbCanBurn?(attacker,false,self)
- + opponent.pbBurn(attacker)
- + end
- else
- - return false if !opponent.pbCanParalyze?(attacker,false,self)
- - opponent.pbParalyze(attacker)
- + if opponent.pbCanParalyze?(attacker,false,self)
- + opponent.pbParalyze(attacker)
- + end
- end
- - return true
- end
- def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
- id=getConst(PBMoves,:BODYSLAM)
- case @battle.environment
- when PBEnvironment::Grass, PBEnvironment::TallGrass
- - id=(USENEWBATTLEMECHANICS) ? getConst(PBMoves,:VINEWHIP) : getConst(PBMoves,:NEEDLEARM)
- - when PBEnvironment::Forest
- - id=getConst(PBMoves,:RAZORLEAF)
- - when PBEnvironment::MovingWater, PBEnvironment::Underwater
- - id=getConst(PBMoves,:WATERPULSE)
- - when PBEnvironment::StillWater
- - id=getConst(PBMoves,:MUDSHOT)
- - when PBEnvironment::Cave
- - id=getConst(PBMoves,:ROCKTHROW)
- - when PBEnvironment::Rock, PBEnvironment::Sand
- - id=getConst(PBMoves,:MUDSLAP)
- - when PBEnvironment::Snow
- - id=getConst(PBMoves,:AVALANCHE) # Ice tiles in Gen 6 should be Ice Shard
- - when PBEnvironment::Volcano
- - id=getConst(PBMoves,:INCINERATE)
- - when PBEnvironment::Graveyard
- - id=getConst(PBMoves,:SHADOWSNEAK)
- - when PBEnvironment::Sky
- - id=getConst(PBMoves,:GUST)
- - when PBEnvironment::Space
- - id=getConst(PBMoves,:SWIFT)
- + id=((USENEWBATTLEMECHANICS) ? getConst(PBMoves,:VINEWHIP) : getConst(PBMoves,:NEEDLEARM)) || id
- + when PBEnvironment::MovingWater; id=getConst(PBMoves,:WATERPULSE) || id
- + when PBEnvironment::StillWater; id=getConst(PBMoves,:MUDSHOT) || id
- + when PBEnvironment::Underwater; id=getConst(PBMoves,:WATERPULSE) || id
- + when PBEnvironment::Cave; id=getConst(PBMoves,:ROCKTHROW) || id
- + when PBEnvironment::Rock; id=getConst(PBMoves,:MUDSLAP) || id
- + when PBEnvironment::Sand; id=getConst(PBMoves,:MUDSLAP) || id
- + when PBEnvironment::Forest; id=getConst(PBMoves,:RAZORLEAF) || id
- + # Ice tiles in Gen 6 should be Ice Shard
- + when PBEnvironment::Snow; id=getConst(PBMoves,:AVALANCHE) || id
- + when PBEnvironment::Volcano; id=getConst(PBMoves,:INCINERATE) || id
- + when PBEnvironment::Graveyard; id=getConst(PBMoves,:SHADOWSNEAK) || id
- + when PBEnvironment::Sky; id=getConst(PBMoves,:GUST) || id
- + when PBEnvironment::Space; id=getConst(PBMoves,:SWIFT) || id
- end
- if @battle.field.effects[PBEffects::ElectricTerrain]>0
- - id=getConst(PBMoves,:THUNDERSHOCK)
- + id=getConst(PBMoves,:THUNDERSHOCK) || id
- elsif @battle.field.effects[PBEffects::GrassyTerrain]>0
- - id=getConst(PBMoves,:VINEWHIP)
- + id=getConst(PBMoves,:VINEWHIP) || id
- elsif @battle.field.effects[PBEffects::MistyTerrain]>0
- - id=getConst(PBMoves,:FAIRYWIND)
- + id=getConst(PBMoves,:FAIRYWIND) || id
- end
- return super(id,attacker,opponent,hitnum,alltargets,showanimation) # Environment-specific anim
- end
- @@ -4682,47 +4655,23 @@ class PokeBattle_Move_0B3 < PokeBattle_Move
- move=getConst(PBMoves,:TRIATTACK) || 0
- case @battle.environment
- when PBEnvironment::Grass, PBEnvironment::TallGrass, PBEnvironment::Forest
- - if USENEWBATTLEMECHANICS
- - move=getConst(PBMoves,:ENERGYBALL) || move
- - else
- - move=getConst(PBMoves,:SEEDBOMB) || move
- - end
- - when PBEnvironment::MovingWater, PBEnvironment::Underwater
- - move=getConst(PBMoves,:HYDROPUMP) || move
- - when PBEnvironment::StillWater
- - move=getConst(PBMoves,:MUDBOMB) || move
- + move=((USENEWBATTLEMECHANICS) ? getConst(PBMoves,:ENERGYBALL) : getConst(PBMoves,:SEEDBOMB)) || move
- + when PBEnvironment::MovingWater; move=getConst(PBMoves,:HYDROPUMP) || move
- + when PBEnvironment::StillWater; move=getConst(PBMoves,:MUDBOMB) || move
- + when PBEnvironment::Underwater; move=getConst(PBMoves,:HYDROPUMP) || move
- when PBEnvironment::Cave
- - if USENEWBATTLEMECHANICS
- - move=getConst(PBMoves,:POWERGEM) || move
- - else
- - move=getConst(PBMoves,:ROCKSLIDE) || move
- - end
- + move=((USENEWBATTLEMECHANICS) ? getConst(PBMoves,:POWERGEM) : getConst(PBMoves,:ROCKSLIDE)) || move
- when PBEnvironment::Rock
- - if USENEWBATTLEMECHANICS
- - move=getConst(PBMoves,:EARTHPOWER) || move
- - else
- - move=getConst(PBMoves,:ROCKSLIDE) || move
- - end
- + move=((USENEWBATTLEMECHANICS) ? getConst(PBMoves,:EARTHPOWER) : getConst(PBMoves,:ROCKSLIDE)) || move
- when PBEnvironment::Sand
- - if USENEWBATTLEMECHANICS
- - move=getConst(PBMoves,:EARTHPOWER) || move
- - else
- - move=getConst(PBMoves,:EARTHQUAKE) || move
- - end
- + move=((USENEWBATTLEMECHANICS) ? getConst(PBMoves,:EARTHPOWER) : getConst(PBMoves,:EARTHQUAKE)) || move
- + # Ice tiles in Gen 6 should be Ice Beam
- when PBEnvironment::Snow
- - if USENEWBATTLEMECHANICS
- - move=getConst(PBMoves,:FROSTBREATH) || move # Ice tiles in Gen 6 should be Ice Beam
- - else
- - move=getConst(PBMoves,:ICEBEAM) || move
- - end
- - when PBEnvironment::Volcano
- - move=getConst(PBMoves,:LAVAPLUME) || move
- - when PBEnvironment::Graveyard
- - move=getConst(PBMoves,:SHADOWBALL) || move
- - when PBEnvironment::Sky
- - move=getConst(PBMoves,:AIRSLASH) || move
- - when PBEnvironment::Space
- - move=getConst(PBMoves,:DRACOMETEOR) || move
- + move=((USENEWBATTLEMECHANICS) ? getConst(PBMoves,:FROSTBREATH) : getConst(PBMoves,:ICEBEAM)) || move
- + when PBEnvironment::Volcano; move=getConst(PBMoves,:LAVAPLUME) || move
- + when PBEnvironment::Graveyard; move=getConst(PBMoves,:SHADOWBALL) || move
- + when PBEnvironment::Sky; move=getConst(PBMoves,:AIRSLASH) || move
- + when PBEnvironment::Space; move=getConst(PBMoves,:DRACOMETEOR) || move
- end
- if @battle.field.effects[PBEffects::ElectricTerrain]>0
- move=getConst(PBMoves,:THUNDERBOLT) || move
- @@ -4738,7 +4687,7 @@ class PokeBattle_Move_0B3 < PokeBattle_Move
- thismovename=PBMoves.getName(@id)
- movename=PBMoves.getName(move)
- @battle.pbDisplay(_INTL("{1} turned into {2}!",thismovename,movename))
- - target=(USENEWBATTLEMECHANICS) ? opponent.index : -1
- + target=(USENEWBATTLEMECHANICS && opponent) ? opponent.index : -1
- attacker.pbUseMoveSimple(move,-1,target)
- return 0
- end
- @@ -4804,7 +4753,7 @@ class PokeBattle_Move_0B4 < PokeBattle_Move
- end
- pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
- choice=choices[@battle.pbRandom(choices.length)]
- - attacker.pbUseMoveSimple(attacker.moves[choice].id,choice,attacker.pbOppositeOpposing)
- + attacker.pbUseMoveSimple(attacker.moves[choice].id,choice,attacker.pbOppositeOpposing.index)
- return 0
- end
- end
- @@ -5182,7 +5131,7 @@ end
- ################################################################################
- -# Hits twice. May poison the targer on each hit. (Twineedle)
- +# Hits twice. May poison the target on each hit. (Twineedle)
- ################################################################################
- class PokeBattle_Move_0BE < PokeBattle_Move
- def pbIsMultiHit
- @@ -5194,9 +5143,10 @@ class PokeBattle_Move_0BE < PokeBattle_Move
- end
- def pbAdditionalEffect(attacker,opponent)
- - return false if !opponent.pbCanPoison?(attacker,false,self)
- - opponent.pbPoison(attacker)
- - return true
- + return if opponent.damagestate.substitute
- + if opponent.pbCanPoison?(attacker,false,self)
- + opponent.pbPoison(attacker)
- + end
- end
- end
- @@ -5416,9 +5366,10 @@ class PokeBattle_Move_0C5 < PokeBattle_Move
- end
- def pbAdditionalEffect(attacker,opponent)
- - return false if !opponent.pbCanParalyze?(attacker,false,self)
- - opponent.pbParalyze(attacker)
- - return true
- + return if opponent.damagestate.substitute
- + if opponent.pbCanParalyze?(attacker,false,self)
- + opponent.pbParalyze(attacker)
- + end
- end
- end
- @@ -5453,9 +5404,10 @@ class PokeBattle_Move_0C6 < PokeBattle_Move
- end
- def pbAdditionalEffect(attacker,opponent)
- - return false if !opponent.pbCanBurn?(attacker,false,self)
- - opponent.pbBurn(attacker)
- - return true
- + return if opponent.damagestate.substitute
- + if opponent.pbCanBurn?(attacker,false,self)
- + opponent.pbBurn(attacker)
- + end
- end
- end
- @@ -5490,10 +5442,8 @@ class PokeBattle_Move_0C7 < PokeBattle_Move
- end
- def pbAdditionalEffect(attacker,opponent)
- - if opponent.effects[PBEffects::Substitute]==0 || ignoresSubstitute?(attacker)
- - return opponent.pbFlinch(attacker)
- - end
- - return false
- + return if opponent.damagestate.substitute
- + opponent.pbFlinch(attacker)
- end
- end
- @@ -5664,9 +5614,10 @@ class PokeBattle_Move_0CC < PokeBattle_Move
- end
- def pbAdditionalEffect(attacker,opponent)
- - return false if !opponent.pbCanParalyze?(attacker,false,self)
- - opponent.pbParalyze(attacker)
- - return true
- + return if opponent.damagestate.substitute
- + if opponent.pbCanParalyze?(attacker,false,self)
- + opponent.pbParalyze(attacker)
- + end
- end
- end
- @@ -5725,7 +5676,7 @@ class PokeBattle_Move_0CE < PokeBattle_Move
- ret=false
- ret=true if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
- ret=true if opponent.effects[PBEffects::TwoTurnAttack]>0
- - ret=true if opponent.effects[PBEffects::SkyDrop]
- + ret=true if opponent.effects[PBEffects::SkyDrop] && attacker.effects[PBEffects::TwoTurnAttack]>0
- ret=true if !opponent.pbIsOpposing?(attacker.index)
- ret=true if USENEWBATTLEMECHANICS && opponent.weight(attacker)>=2000
- return ret
- @@ -5742,9 +5693,10 @@ class PokeBattle_Move_0CE < PokeBattle_Move
- opponent.effects[PBEffects::SkyDrop]=true
- end
- return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
- + ret=super
- @battle.pbDisplay(_INTL("{1} was freed from the Sky Drop!",opponent.pbThis))
- opponent.effects[PBEffects::SkyDrop]=false
- - return super
- + return ret
- end
- def pbTypeModifier(type,attacker,opponent)
- @@ -6259,21 +6211,23 @@ end
- ################################################################################
- class PokeBattle_Move_0E0 < PokeBattle_Move
- def pbOnStartUse(attacker)
- - [email protected](:DAMP)
- - bearer=nil if attacker.hasMoldBreaker
- - if bearer
- - @battle.pbDisplay(_INTL("{1}'s {2} prevents {3} from using {4}!",
- - bearer.pbThis,PBAbilities.getName(bearer.ability),attacker.pbThis(true),@name))
- - return false
- + if !attacker.hasMoldBreaker
- + [email protected](:DAMP)
- + if bearer!=nil
- + @battle.pbDisplay(_INTL("{1}'s {2} prevents {3} from using {4}!",
- + bearer.pbThis,PBAbilities.getName(bearer.ability),attacker.pbThis(true),@name))
- + return false
- + end
- end
- - @battle.pbAnimation(@id,attacker,nil)
- - pbShowAnimation(@id,attacker,nil)
- - attacker.pbReduceHP(attacker.hp)
- return true
- end
- def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
- - return
- + super(id,attacker,opponent,hitnum,alltargets,showanimation)
- + if !attacker.isFainted?
- + attacker.pbReduceHP(attacker.hp)
- + attacker.pbFaint if attacker.isFainted?
- + end
- end
- end
- @@ -6296,8 +6250,10 @@ class PokeBattle_Move_0E1 < PokeBattle_Move
- def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
- super(id,attacker,opponent,hitnum,alltargets,showanimation)
- - attacker.pbReduceHP(attacker.hp)
- - attacker.pbFaint if attacker.isFainted?
- + if !attacker.isFainted?
- + attacker.pbReduceHP(attacker.hp)
- + attacker.pbFaint if attacker.isFainted?
- + end
- end
- end
- @@ -6392,7 +6348,7 @@ class PokeBattle_Move_0E5 < PokeBattle_Move
- return -1
- end
- pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
- - @battle.pbDisplay(_INTL("All Pokémon hearing the song will faint in three turns!"))
- + @battle.pbDisplay(_INTL("All Pokémon that hear the song will faint in three turns!"))
- for i in 0...4
- if @battle.battlers[i].effects[PBEffects::PerishSong]==0
- if !attacker.hasMoldBreaker && @battle.battlers[i].hasWorkingAbility(:SOUNDPROOF)
- @@ -6633,7 +6589,7 @@ class PokeBattle_Move_0EF < PokeBattle_Move
- if opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute &&
- !opponent.isFainted?
- if opponent.effects[PBEffects::MeanLook]<0 &&
- - (!USENEWBATTLEMECHANICS || !opponent.pbHasType(:GHOST))
- + (!USENEWBATTLEMECHANICS || !opponent.pbHasType?(:GHOST))
- opponent.effects[PBEffects::MeanLook]=attacker.index
- @battle.pbDisplay(_INTL("{1} can no longer escape!",opponent.pbThis))
- end
- @@ -6643,11 +6599,11 @@ class PokeBattle_Move_0EF < PokeBattle_Move
- if opponent.effects[PBEffects::MeanLook]>=0 ||
- (opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker))
- @battle.pbDisplay(_INTL("But it failed!"))
- - return ret
- + return -1
- end
- - if USENEWBATTLEMECHANICS && opponent.pbHasType(:GHOST)
- + if USENEWBATTLEMECHANICS && opponent.pbHasType?(:GHOST)
- @battle.pbDisplay(_INTL("It doesn't affect {1}...",opponent.pbThis(true)))
- - return ret
- + return -1
- end
- pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
- opponent.effects[PBEffects::MeanLook]=attacker.index
- @@ -6848,7 +6804,6 @@ class PokeBattle_Move_0F4 < PokeBattle_Move
- end
- end
- end
- - return ret
- end
- end
- @@ -7062,7 +7017,7 @@ class PokeBattle_Move_0F7 < PokeBattle_Move
- end
- elsif attacker.hasWorkingItem(:TOXICORB)
- if opponent.pbCanPoison?(attacker,false,self)
- - opponent.pbPoison(attacker,true)
- + opponent.pbPoison(attacker,nil,true)
- end
- elsif attacker.hasWorkingItem(:WHITEHERB)
- while true
- @@ -7135,7 +7090,7 @@ class PokeBattle_Move_0FA < PokeBattle_Move
- end
- def pbEffectAfterHit(attacker,opponent,turneffects)
- - if !attacker.isFainted? && opponent.damagestate.calcdamage>0
- + if !attacker.isFainted? && turneffects[PBEffects::TotalDamage]>0
- if !attacker.hasWorkingAbility(:ROCKHEAD) &&
- !attacker.hasWorkingAbility(:MAGICGUARD)
- attacker.pbReduceHP((turneffects[PBEffects::TotalDamage]/4.0).round)
- @@ -7156,7 +7111,7 @@ class PokeBattle_Move_0FB < PokeBattle_Move
- end
- def pbEffectAfterHit(attacker,opponent,turneffects)
- - if !attacker.isFainted? && opponent.damagestate.calcdamage>0
- + if !attacker.isFainted? && turneffects[PBEffects::TotalDamage]>0
- if !attacker.hasWorkingAbility(:ROCKHEAD) &&
- !attacker.hasWorkingAbility(:MAGICGUARD)
- attacker.pbReduceHP((turneffects[PBEffects::TotalDamage]/3.0).round)
- @@ -7178,7 +7133,7 @@ class PokeBattle_Move_0FC < PokeBattle_Move
- end
- def pbEffectAfterHit(attacker,opponent,turneffects)
- - if !attacker.isFainted? && opponent.damagestate.calcdamage>0
- + if !attacker.isFainted? && turneffects[PBEffects::TotalDamage]>0
- if !attacker.hasWorkingAbility(:ROCKHEAD) &&
- !attacker.hasWorkingAbility(:MAGICGUARD)
- attacker.pbReduceHP((turneffects[PBEffects::TotalDamage]/2.0).round)
- @@ -7200,7 +7155,7 @@ class PokeBattle_Move_0FD < PokeBattle_Move
- end
- def pbEffectAfterHit(attacker,opponent,turneffects)
- - if !attacker.isFainted? && opponent.damagestate.calcdamage>0
- + if !attacker.isFainted? && turneffects[PBEffects::TotalDamage]>0
- if !attacker.hasWorkingAbility(:ROCKHEAD) &&
- !attacker.hasWorkingAbility(:MAGICGUARD)
- attacker.pbReduceHP((turneffects[PBEffects::TotalDamage]/3.0).round)
- @@ -7210,9 +7165,10 @@ class PokeBattle_Move_0FD < PokeBattle_Move
- end
- def pbAdditionalEffect(attacker,opponent)
- - return false if !opponent.pbCanParalyze?(attacker,false,self)
- - opponent.pbParalyze(attacker)
- - return true
- + return if opponent.damagestate.substitute
- + if opponent.pbCanParalyze?(attacker,false,self)
- + opponent.pbParalyze(attacker)
- + end
- end
- end
- @@ -7228,7 +7184,7 @@ class PokeBattle_Move_0FE < PokeBattle_Move
- end
- def pbEffectAfterHit(attacker,opponent,turneffects)
- - if !attacker.isFainted? && opponent.damagestate.calcdamage>0
- + if !attacker.isFainted? && turneffects[PBEffects::TotalDamage]>0
- if !attacker.hasWorkingAbility(:ROCKHEAD) &&
- !attacker.hasWorkingAbility(:MAGICGUARD)
- attacker.pbReduceHP((turneffects[PBEffects::TotalDamage]/3.0).round)
- @@ -7238,9 +7194,10 @@ class PokeBattle_Move_0FE < PokeBattle_Move
- end
- def pbAdditionalEffect(attacker,opponent)
- - return false if !opponent.pbCanBurn?(attacker,false,self)
- - opponent.pbBurn(attacker)
- - return true
- + return if opponent.damagestate.substitute
- + if opponent.pbCanBurn?(attacker,false,self)
- + opponent.pbBurn(attacker)
- + end
- end
- end
- @@ -7935,7 +7892,7 @@ end
- ################################################################################
- class PokeBattle_Move_110 < PokeBattle_Move
- def pbEffectAfterHit(attacker,opponent,turneffects)
- - if !attacker.isFainted? && opponent.damagestate.calcdamage>0
- + if !attacker.isFainted? && turneffects[PBEffects::TotalDamage]>0
- if attacker.effects[PBEffects::MultiTurn]>0
- mtattack=PBMoves.getName(attacker.effects[PBEffects::MultiTurnAttack])
- @@ -8057,7 +8014,7 @@ class PokeBattle_Move_113 < PokeBattle_Move
- end
- def pbEffectAfterHit(attacker,opponent,turneffects)
- - if !attacker.isFainted? && opponent.damagestate.calcdamage>0
- + if !attacker.isFainted? && turneffects[PBEffects::TotalDamage]>0
- showanim=true
- if attacker.effects[PBEffects::StockpileDef]>0
- if attacker.pbCanReduceStatStage?(PBStats::DEFENSE,attacker,false,self)
- @@ -8545,11 +8502,10 @@ end
- ################################################################################
- class PokeBattle_Move_135 < PokeBattle_Move
- def pbAdditionalEffect(attacker,opponent)
- + return if opponent.damagestate.substitute
- if opponent.pbCanFreeze?(attacker,false,self)
- opponent.pbFreeze
- - return true
- end
- - return false
- end
- end
- @@ -8694,10 +8650,10 @@ class PokeBattle_Move_13B < PokeBattle_Move
- end
- def pbAdditionalEffect(attacker,opponent)
- + return if opponent.damagestate.substitute
- if opponent.pbCanReduceStatStage?(PBStats::DEFENSE,attacker,false,self)
- opponent.pbReduceStat(PBStats::DEFENSE,1,attacker,false,self)
- end
- - return true
- end
- end
- @@ -8735,10 +8691,10 @@ class PokeBattle_Move_13D < PokeBattle_Move
- end
- def pbAdditionalEffect(attacker,opponent)
- + return if opponent.damagestate.substitute
- if opponent.pbCanReduceStatStage?(PBStats::SPATK,attacker,false,self)
- opponent.pbReduceStat(PBStats::SPATK,2,attacker,false,self)
- end
- - return true
- end
- end
- @@ -8933,14 +8889,8 @@ class PokeBattle_Move_144 < PokeBattle_Move
- def pbModifyDamage(damagemult,attacker,opponent)
- type=getConst(PBTypes,:FLYING) || -1
- if type>=0
- - mult=PBTypes.getCombinedEffectiveness(type,opponent.type1,opponent.type2)
- - if opponent.effects[PBEffects::Type3]>=0 &&
- - opponent.effects[PBEffects::Type3]!=opponent.type1 &&
- - opponent.effects[PBEffects::Type3]!=opponent.type2
- - mult*=PBTypes.getEffectiveness(type,opponent.effects[PBEffects::Type3])
- - else
- - mult*=2
- - end
- + mult=PBTypes.getCombinedEffectiveness(type,
- + opponent.type1,opponent.type2,opponent.effects[PBEffects::Type3])
- return ((damagemult*mult)/8).round
- end
- return damagemult
- @@ -9166,8 +9116,7 @@ class PokeBattle_Move_14C < PokeBattle_Move
- end
- end
- if !unmoved ||
- - (!USENEWBATTLEMECHANICS &&
- - @battle.pbRandom(65536)>=(65536/attacker.effects[PBEffects::ProtectRate]).floor)
- + @battle.pbRandom(65536)>=(65536/attacker.effects[PBEffects::ProtectRate]).floor
- attacker.effects[PBEffects::ProtectRate]=1
- @battle.pbDisplay(_INTL("But it failed!"))
- return -1
- diff --git a/Data/Scripts.rxdata/[084] PokeBattle_Battle.rb b/Data/Scripts.rxdata/[084] PokeBattle_Battle.rb
- index 4539926..0323013 100644
- --- a/Data/Scripts.rxdata/[084] PokeBattle_Battle.rb
- +++ b/Data/Scripts.rxdata/[084] PokeBattle_Battle.rb
- @@ -5,84 +5,6 @@
- # 3 - Player or wild Pokémon ran from battle, or player forfeited the match
- # 4 - Wild Pokémon was caught
- # 5 - Draw
- -################################################################################
- -# Placeholder battle peer.
- -################################################################################
- -class PokeBattle_NullBattlePeer
- - def pbStorePokemon(player,pokemon)
- - if player.party.length<6
- - player.party[player.party.length]=pokemon
- - end
- - return -1
- - end
- -
- - def pbOnEnteringBattle(battle,pokemon)
- - end
- -
- - def pbGetStorageCreator()
- - return nil
- - end
- -
- - def pbCurrentBox()
- - return -1
- - end
- -
- - def pbBoxName(box)
- - return ""
- - end
- -end
- -
- -
- -
- -class PokeBattle_BattlePeer
- - def self.create
- - return PokeBattle_NullBattlePeer.new()
- - end
- -end
- -
- -
- -
- -################################################################################
- -# Success state (used for Battle Arena).
- -################################################################################
- -class PokeBattle_SuccessState
- - attr_accessor :typemod
- - attr_accessor :useState # 0 - not used, 1 - failed, 2 - succeeded
- - attr_accessor :protected
- - attr_accessor :skill
- -
- - def initialize
- - clear
- - end
- -
- - def clear
- - @typemod = 4
- - @useState = 0
- - @protected = false
- - @skill = 0
- - end
- -
- - def updateSkill
- - if @useState==1 && !@protected
- - @skill-=2
- - elsif @useState==2
- - if @typemod>4
- - @skill+=2 # "Super effective"
- - elsif @typemod>=1 && @typemod<4
- - @skill-=1 # "Not very effective"
- - elsif @typemod==0
- - @skill-=2 # Ineffective
- - else
- - @skill+=1
- - end
- - end
- - @typemod=4
- - @useState=0
- - @protected=false
- - end
- -end
- -
- -
- ################################################################################
- # Catching and storing Pokémon.
- @@ -298,6 +220,7 @@ class PokeBattle_Battle
- include PokeBattle_BattleCommon
- MAXPARTYSIZE = 6
- + MEGARINGS=[:MEGARING,:MEGABRACELET,:MEGACUFF,:MEGACHARM]
- class BattleAbortedException < Exception; end
- @@ -649,8 +572,7 @@ class PokeBattle_Battle
- def pbGetMegaRingName(battlerIndex)
- if pbBelongsToPlayer?(battlerIndex)
- - rings=[:MEGARING,:MEGABRACELET,:MEGACUFF,:MEGACHARM]
- - for i in rings
- + for i in MEGARINGS
- next if !hasConst?(PBItems,i)
- return PBItems.getName(getConst(PBItems,i)) if $PokemonBag.pbQuantity(i)>0
- end
- @@ -664,8 +586,7 @@ class PokeBattle_Battle
- def pbHasMegaRing(battlerIndex)
- return true if !pbBelongsToPlayer?(battlerIndex)
- - rings=[:MEGARING,:MEGABRACELET,:MEGACUFF,:MEGACHARM]
- - for i in rings
- + for i in MEGARINGS
- next if !hasConst?(PBItems,i)
- return true if $PokemonBag.pbQuantity(i)>0
- end
- @@ -1054,10 +975,10 @@ class PokeBattle_Battle
- thismove=thispkmn.moves[thispkmn.effects[PBEffects::EncoreIndex]]
- target=thispkmn.pbTarget(thismove)
- if target==PBTargets::SingleNonUser
- - [email protected](idxPokemon)
- + [email protected](idxPokemon,target)
- pbRegisterTarget(idxPokemon,target) if target>=0
- elsif target==PBTargets::UserOrPartner
- - [email protected](idxPokemon)
- + [email protected](idxPokemon,target)
- pbRegisterTarget(idxPokemon,target) if target>=0 && (target&1)==(idxPokemon&1)
- end
- end
- @@ -1573,18 +1494,30 @@ class PokeBattle_Battle
- end
- def pbRegisterItem(idxPokemon,idxItem,idxTarget=nil)
- - if idxTarget!=nil && idxTarget>=0 && @battlers[idxTarget].effects[PBEffects::Embargo]>0
- - pbDisplay(_INTL("Embargo's effect prevents the item's use on {1}!",@battlers[idxTarget].pbThis(true)))
- - return false
- + if idxTarget!=nil && idxTarget>=0
- + for i in 0...4
- + if !@battlers[i].pbIsOpposing?(idxPokemon) &&
- + @battlers[i].pokemonIndex==idxTarget &&
- + @battlers[i].effects[PBEffects::Embargo]>0
- + pbDisplay(_INTL("Embargo's effect prevents the item's use on {1}!",@battlers[i].pbThis(true)))
- + if pbBelongsToPlayer?(@battlers[i].index)
- + if $PokemonBag.pbCanStore?(idxItem)
- + $PokemonBag.pbStoreItem(idxItem)
- + else
- + raise _INTL("Couldn't return unused item to Bag somehow.")
- + end
- + end
- + return false
- + end
- + end
- end
- if ItemHandlers.hasUseInBattle(idxItem)
- if idxPokemon==0 # Player's first Pokémon
- if ItemHandlers.triggerBattleUseOnBattler(idxItem,@battlers[idxPokemon],self)
- + # Using Poké Balls or Poké Doll only
- ItemHandlers.triggerUseInBattle(idxItem,@battlers[idxPokemon],self)
- if @doublebattle
- - @choices[idxPokemon+2][0]=3 # "Use an item"
- - @choices[idxPokemon+2][1]=idxItem # ID of item to be used
- - @choices[idxPokemon+2][2]=idxTarget # Index of Pokémon to use item on
- + @battlers[idxPokemon+2].effects[PBEffects::SkipTurn]=true
- end
- else
- if $PokemonBag.pbCanStore?(idxItem)
- @@ -1956,6 +1889,54 @@ class PokeBattle_Battle
- level=defeated.level
- baseexp=defeated.pokemon.baseExp
- evyield=defeated.pokemon.evYield
- + # Gain effort value points, using RS effort values
- + totalev=0
- + for k in 0...6
- + totalev+=thispoke.ev[k]
- + end
- + for k in 0...6
- + evgain=evyield[k]
- + evgain*=2 if isConst?(thispoke.item,PBItems,:MACHOBRACE) ||
- + isConst?(thispoke.itemInitial,PBItems,:MACHOBRACE)
- + case k
- + when PBStats::HP
- + evgain+=4 if isConst?(thispoke.item,PBItems,:POWERWEIGHT) ||
- + isConst?(thispoke.itemInitial,PBItems,:POWERWEIGHT)
- + when PBStats::ATTACK
- + evgain+=4 if isConst?(thispoke.item,PBItems,:POWERBRACER) ||
- + isConst?(thispoke.itemInitial,PBItems,:POWERBRACER)
- + when PBStats::DEFENSE
- + evgain+=4 if isConst?(thispoke.item,PBItems,:POWERBELT) ||
- + isConst?(thispoke.itemInitial,PBItems,:POWERBELT)
- + when PBStats::SPATK
- + evgain+=4 if isConst?(thispoke.item,PBItems,:POWERLENS) ||
- + isConst?(thispoke.itemInitial,PBItems,:POWERLENS)
- + when PBStats::SPDEF
- + evgain+=4 if isConst?(thispoke.item,PBItems,:POWERBAND) ||
- + isConst?(thispoke.itemInitial,PBItems,:POWERBAND)
- + when PBStats::SPEED
- + evgain+=4 if isConst?(thispoke.item,PBItems,:POWERANKLET) ||
- + isConst?(thispoke.itemInitial,PBItems,:POWERANKLET)
- + end
- + evgain*=2 if thispoke.pokerusStage>=1 # Infected or cured
- + if evgain>0
- + # Can't exceed overall limit
- + evgain-=totalev+evgain-PokeBattle_Pokemon::EVLIMIT if totalev+evgain>PokeBattle_Pokemon::EVLIMIT
- + # Can't exceed stat limit
- + evgain-=thispoke.ev[k]+evgain-PokeBattle_Pokemon::EVSTATLIMIT if thispoke.ev[k]+evgain>PokeBattle_Pokemon::EVSTATLIMIT
- + # Add EV gain
- + thispoke.ev[k]+=evgain
- + if thispoke.ev[k]>PokeBattle_Pokemon::EVSTATLIMIT
- + print "Single-stat EV limit #{PokeBattle_Pokemon::EVSTATLIMIT} exceeded.\r\nStat: #{k} EV gain: #{evgain} EVs: #{thispoke.ev.inspect}"
- + thispoke.ev[k]=PokeBattle_Pokemon::EVSTATLIMIT
- + end
- + totalev+=evgain
- + if totalev>PokeBattle_Pokemon::EVLIMIT
- + print "EV limit #{PokeBattle_Pokemon::EVLIMIT} exceeded.\r\nTotal EVs: #{totalev} EV gain: #{evgain} EVs: #{thispoke.ev.inspect}"
- + end
- + end
- + end
- + # Gain experience
- ispartic=0
- ispartic=1 if defeated.participants.include?(index)
- haveexpshare=(isConst?(thispoke.item,PBItems,:EXPSHARE) ||
- @@ -2013,53 +1994,6 @@ class PokeBattle_Battle
- pbDisplayPaused(_INTL("{1} gained {2} Exp. Points!",thispoke.name,exp))
- end
- end
- - # Gain effort value points, using RS effort values
- - totalev=0
- - for k in 0...6
- - totalev+=thispoke.ev[k]
- - end
- - for k in 0...6
- - evgain=evyield[k]
- - evgain*=2 if isConst?(thispoke.item,PBItems,:MACHOBRACE) ||
- - isConst?(thispoke.itemInitial,PBItems,:MACHOBRACE)
- - case k
- - when PBStats::HP
- - evgain+=4 if isConst?(thispoke.item,PBItems,:POWERWEIGHT) ||
- - isConst?(thispoke.itemInitial,PBItems,:POWERWEIGHT)
- - when PBStats::ATTACK
- - evgain+=4 if isConst?(thispoke.item,PBItems,:POWERBRACER) ||
- - isConst?(thispoke.itemInitial,PBItems,:POWERBRACER)
- - when PBStats::DEFENSE
- - evgain+=4 if isConst?(thispoke.item,PBItems,:POWERBELT) ||
- - isConst?(thispoke.itemInitial,PBItems,:POWERBELT)
- - when PBStats::SPATK
- - evgain+=4 if isConst?(thispoke.item,PBItems,:POWERLENS) ||
- - isConst?(thispoke.itemInitial,PBItems,:POWERLENS)
- - when PBStats::SPDEF
- - evgain+=4 if isConst?(thispoke.item,PBItems,:POWERBAND) ||
- - isConst?(thispoke.itemInitial,PBItems,:POWERBAND)
- - when PBStats::SPEED
- - evgain+=4 if isConst?(thispoke.item,PBItems,:POWERANKLET) ||
- - isConst?(thispoke.itemInitial,PBItems,:POWERANKLET)
- - end
- - evgain*=2 if thispoke.pokerusStage>=1 # Infected or cured
- - if evgain>0
- - # Can't exceed overall limit
- - evgain-=totalev+evgain-PokeBattle_Pokemon::EVLIMIT if totalev+evgain>PokeBattle_Pokemon::EVLIMIT
- - # Can't exceed stat limit
- - evgain-=thispoke.ev[k]+evgain-PokeBattle_Pokemon::EVSTATLIMIT if thispoke.ev[k]+evgain>PokeBattle_Pokemon::EVSTATLIMIT
- - # Add EV gain
- - thispoke.ev[k]+=evgain
- - if thispoke.ev[k]>PokeBattle_Pokemon::EVSTATLIMIT
- - print "Single-stat EV limit #{PokeBattle_Pokemon::EVSTATLIMIT} exceeded.\r\nStat: #{k} EV gain: #{evgain} EVs: #{thispoke.ev.inspect}"
- - thispoke.ev[k]=PokeBattle_Pokemon::EVSTATLIMIT
- - end
- - totalev+=evgain
- - if totalev>PokeBattle_Pokemon::EVLIMIT
- - print "EV limit #{PokeBattle_Pokemon::EVLIMIT} exceeded.\r\nTotal EVs: #{totalev} EV gain: #{evgain} EVs: #{thispoke.ev.inspect}"
- - end
- - end
- - end
- newlevel=PBExperience.pbGetLevelFromExperience(newexp,growthrate)
- tempexp=0
- curlevel=thispoke.level
- @@ -2245,11 +2179,11 @@ class PokeBattle_Battle
- if pkmn.pbOwnSide.effects[PBEffects::StealthRock] && !pkmn.isFainted?
- if !pkmn.hasWorkingAbility(:MAGICGUARD)
- atype=getConst(PBTypes,:ROCK) || 0
- - eff=PBTypes.getCombinedEffectiveness(atype,pkmn.type1,pkmn.type2)
- + eff=PBTypes.getCombinedEffectiveness(atype,pkmn.type1,pkmn.type2,pkmn.effects[PBEffects::Type3])
- if eff>0
- PBDebug.log("[Entry hazard] #{pkmn.pbThis} triggered Stealth Rock")
- @scene.pbDamageAnimation(pkmn,0)
- - pkmn.pbReduceHP(((pkmn.totalhp*eff)/32).floor)
- + pkmn.pbReduceHP(((pkmn.totalhp*eff)/64).floor)
- pbDisplayPaused(_INTL("Pointed stones dug into {1}!",pkmn.pbThis))
- end
- end
- @@ -2265,9 +2199,9 @@ class PokeBattle_Battle
- elsif pkmn.pbCanPoisonSpikes?(moldbreaker)
- PBDebug.log("[Entry hazard] #{pkmn.pbThis} triggered Toxic Spikes")
- if pkmn.pbOwnSide.effects[PBEffects::ToxicSpikes]==2
- - pkmn.pbPoison(nil,_INTL("{1} was badly poisoned by the poison spikes!",i.pbThis,true))
- + pkmn.pbPoison(nil,_INTL("{1} was badly poisoned by the poison spikes!",pkmn.pbThis,true))
- else
- - pkmn.pbPoison(nil,_INTL("{1} was poisoned by the poison spikes!",i.pbThis))
- + pkmn.pbPoison(nil,_INTL("{1} was poisoned by the poison spikes!",pkmn.pbThis))
- end
- end
- end
- @@ -2681,6 +2615,7 @@ class PokeBattle_Battle
- @scene.pbBeginCommandPhase
- @scene.pbResetCommandIndices
- for i in 0...4 # Reset choices if commands can be shown
- + @battlers[i].effects[PBEffects::SkipTurn]=false
- if pbCanShowCommands?(i) || @battlers[i].isFainted?
- @choices[i][0]=0
- @choices[i][1]=0
- @@ -2693,7 +2628,7 @@ class PokeBattle_Battle
- end
- end
- # Reset choices to perform Mega Evolution if it wasn't done somehow
- - for i in 0..1
- + for i in 0...2
- for j in 0...@megaEvolution[i].length
- @megaEvolution[i][j]=-1 if @megaEvolution[i][j]>=0
- end
- @@ -2729,11 +2664,11 @@ class PokeBattle_Battle
- thismove=@battlers[i].moves[index]
- target=@battlers[i].pbTarget(thismove)
- if target==PBTargets::SingleNonUser # single non-user
- - [email protected](i)
- + [email protected](i,target)
- next if target<0
- pbRegisterTarget(i,target)
- elsif target==PBTargets::UserOrPartner # Acupressure
- - [email protected](i)
- + [email protected](i,target)
- next if target<0 || (target&1)==1
- pbRegisterTarget(i,target)
- end
- @@ -2825,12 +2760,13 @@ class PokeBattle_Battle
- # Mega Evolution
- megaevolved=[]
- for i in priority
- - next if @choices[i.index][0]!=1
- - side=(pbIsOpposing?(i.index)) ? 1 : 0
- - owner=pbGetOwnerIndex(i.index)
- - if @megaEvolution[side][owner]==i.index
- - pbMegaEvolve(i.index)
- - megaevolved.push(i.index)
- + if @choices[i.index][0]==1 && !i.effects[PBEffects::SkipTurn]
- + side=(pbIsOpposing?(i.index)) ? 1 : 0
- + owner=pbGetOwnerIndex(i.index)
- + if @megaEvolution[side][owner]==i.index
- + pbMegaEvolve(i.index)
- + megaevolved.push(i.index)
- + end
- end
- end
- if megaevolved.length>0
- @@ -2840,7 +2776,7 @@ class PokeBattle_Battle
- end
- # Call at Pokémon
- for i in priority
- - if @choices[i.index][0]==4
- + if @choices[i.index][0]==4 && !i.effects[PBEffects::SkipTurn]
- pbCall(i.index)
- end
- end
- @@ -2848,7 +2784,7 @@ class PokeBattle_Battle
- @switching=true
- switched=[]
- for i in priority
- - if @choices[i.index][0]==2
- + if @choices[i.index][0]==2 && !i.effects[PBEffects::SkipTurn]
- index=@choices[i.index][1] # party position of Pokémon to switch to
- newpokename=index
- if isConst?(pbParty(i.index)[index].ability,PBAbilities,:ILLUSION)
- @@ -2900,20 +2836,23 @@ class PokeBattle_Battle
- @switching=false
- # Use items
- for i in priority
- - if pbIsOpposing?(i.index) && @choices[i.index][0]==3
- - pbEnemyUseItem(@choices[i.index][1],i)
- - elsif @choices[i.index][0]==3
- - # Player use item
- - item=@choices[i.index][1]
- - if item>0
- - usetype=$ItemData[item][ITEMBATTLEUSE]
- - if usetype==1 || usetype==3
- - if @choices[i.index][2]>=0
- - pbUseItemOnPokemon(item,@choices[i.index][2],i,@scene)
- - end
- - elsif usetype==2 || usetype==4
- - if !ItemHandlers.hasUseInBattle(item) # Poké Ball/Poké Doll used already
- - pbUseItemOnBattler(item,@choices[i.index][2],i,@scene)
- + if @choices[i.index][0]==3 && !i.effects[PBEffects::SkipTurn]
- + if pbIsOpposing?(i.index)
- + # Opponent use item
- + pbEnemyUseItem(@choices[i.index][1],i)
- + else
- + # Player use item
- + item=@choices[i.index][1]
- + if item>0
- + usetype=$ItemData[item][ITEMBATTLEUSE]
- + if usetype==1 || usetype==3
- + if @choices[i.index][2]>=0
- + pbUseItemOnPokemon(item,@choices[i.index][2],i,@scene)
- + end
- + elsif usetype==2 || usetype==4
- + if !ItemHandlers.hasUseInBattle(item) # Poké Ball/Poké Doll used already
- + pbUseItemOnBattler(item,@choices[i.index][2],i,@scene)
- + end
- end
- end
- end
- @@ -2921,6 +2860,7 @@ class PokeBattle_Battle
- end
- # Use attacks
- for i in priority
- + next if i.effects[PBEffects::SkipTurn]
- if pbChoseMoveFunctionCode?(i.index,0x115) # Focus Punch
- pbCommonAnimation("FocusPunch",i,nil)
- pbDisplay(_INTL("{1} is tightening its focus!",i.pbThis))
- @@ -2931,7 +2871,7 @@ class PokeBattle_Battle
- advance=false
- for i in priority
- next if !i.effects[PBEffects::MoveNext]
- - next if i.hasMovedThisRound?
- + next if i.hasMovedThisRound? || i.effects[PBEffects::SkipTurn]
- advance=i.pbProcessTurn(@choices[i.index])
- break if advance
- end
- @@ -2940,7 +2880,7 @@ class PokeBattle_Battle
- # Regular priority order
- for i in priority
- next if i.effects[PBEffects::Quash]
- - next if i.hasMovedThisRound?
- + next if i.hasMovedThisRound? || i.effects[PBEffects::SkipTurn]
- advance=i.pbProcessTurn(@choices[i.index])
- break if advance
- end
- @@ -2949,7 +2889,7 @@ class PokeBattle_Battle
- # Quashed
- for i in priority
- next if !i.effects[PBEffects::Quash]
- - next if i.hasMovedThisRound?
- + next if i.hasMovedThisRound? || i.effects[PBEffects::SkipTurn]
- advance=i.pbProcessTurn(@choices[i.index])
- break if advance
- end
- @@ -2957,7 +2897,8 @@ class PokeBattle_Battle
- next if advance
- # Check for all done
- for i in priority
- - advance=true if @choices[i.index][0]==1 && !i.hasMovedThisRound?
- + advance=true if @choices[i.index][0]==1 && !i.hasMovedThisRound? &&
- + !i.effects[PBEffects::SkipTurn]
- break if advance
- end
- next if advance
- @@ -2972,18 +2913,19 @@ class PokeBattle_Battle
- def pbEndOfRoundPhase
- PBDebug.log("[End of round]")
- for i in 0...4
- - @battlers[i].effects[PBEffects::Roost]=false
- + @battlers[i].effects[PBEffects::Electrify]=false
- + @battlers[i].effects[PBEffects::Endure]=false
- + @battlers[i].effects[PBEffects::FirstPledge]=0
- + @battlers[i].effects[PBEffects::HyperBeam]-=1 if @battlers[i].effects[PBEffects::HyperBeam]>0
- + @battlers[i].effects[PBEffects::KingsShield]=false
- + @battlers[i].effects[PBEffects::LifeOrb]=false
- + @battlers[i].effects[PBEffects::MoveNext]=false
- + @battlers[i].effects[PBEffects::Powder]=false
- @battlers[i].effects[PBEffects::Protect]=false
- @battlers[i].effects[PBEffects::ProtectNegation]=false
- - @battlers[i].effects[PBEffects::KingsShield]=false
- - @battlers[i].effects[PBEffects::SpikyShield]=false
- - @battlers[i].effects[PBEffects::Endure]=false
- - @battlers[i].effects[PBEffects::HyperBeam]-=1 if @battlers[i].effects[PBEffects::HyperBeam]>0
- - @battlers[i].effects[PBEffects::Electrify]=false
- - @battlers[i].effects[PBEffects::MoveNext]=false
- @battlers[i].effects[PBEffects::Quash]=false
- - @battlers[i].effects[PBEffects::Powder]=false
- - @battlers[i].effects[PBEffects::FirstPledge]=0
- + @battlers[i].effects[PBEffects::Roost]=false
- + @battlers[i].effects[PBEffects::SpikyShield]=false
- end
- @usepriority=false # recalculate priority
- priority=pbPriority(true) # Ignoring Quick Claw here
- @@ -3020,7 +2962,7 @@ class PokeBattle_Battle
- PBDebug.log("[End of effect] Rain weather ended")
- else
- pbCommonAnimation("Rain",nil,nil)
- -# pbDisplay(_INTL("Rain continues to fall."));
- +# pbDisplay(_INTL("Rain continues to fall."))
- end
- when PBWeather::SANDSTORM
- @weatherduration=@weatherduration-1 if @weatherduration>0
- @@ -3607,7 +3549,7 @@ class PokeBattle_Battle
- next if i.isFainted?
- if i.effects[PBEffects::PerishSong]>0
- i.effects[PBEffects::PerishSong]-=1
- - pbDisplay(_INTL("{1}'s Perish count fell to {2}!",i.pbThis,i.effects[PBEffects::PerishSong]))
- + pbDisplay(_INTL("{1}'s perish count fell to {2}!",i.pbThis,i.effects[PBEffects::PerishSong]))
- PBDebug.log("[Lingering effect triggered] #{i.pbThis}'s Perish Song count dropped to #{i.effects[PBEffects::PerishSong]}")
- if i.effects[PBEffects::PerishSong]==0
- perishSongUsers.push(i.effects[PBEffects::PerishSongUser])
- diff --git a/Data/Scripts.rxdata/[085] PokeBattle_AI.rb b/Data/Scripts.rxdata/[085] PokeBattle_AI.rb
- index 39b0983..9266265 100644
- --- a/Data/Scripts.rxdata/[085] PokeBattle_AI.rb
- +++ b/Data/Scripts.rxdata/[085] PokeBattle_AI.rb
- @@ -2416,6 +2416,245 @@ class PokeBattle_Battle
- else
- score-=110
- end
- + when 0x133, 0x134
- + score-=95
- + if skill>=PBTrainerAI.highSkill
- + score=0
- + end
- + when 0x135
- + if opponent.pbCanFreeze?(attacker,false)
- + score+=30
- + if skill>=PBTrainerAI.highSkill
- + score-=20 if opponent.hasWorkingAbility(:MARVELSCALE)
- + end
- + end
- + when 0x136
- + score+=20 if attacker.stages[PBStats::DEFENSE]<0
- + when 0x137
- + if attacker.pbTooHigh?(PBStats::DEFENSE) &&
- + attacker.pbTooHigh?(PBStats::SPDEF) &&
- + !attacker.pbPartner.isFainted? &&
- + attacker.pbPartner.pbTooHigh?(PBStats::DEFENSE) &&
- + attacker.pbPartner.pbTooHigh?(PBStats::SPDEF)
- + score-=90
- + else
- + score-=attacker.stages[PBStats::DEFENSE]*10
- + score-=attacker.stages[PBStats::SPDEF]*10
- + if !attacker.pbPartner.isFainted?
- + score-=attacker.pbPartner.stages[PBStats::DEFENSE]*10
- + score-=attacker.pbPartner.stages[PBStats::SPDEF]*10
- + end
- + end
- + when 0x138
- + if !@doublebattle
- + score-=100
- + elsif attacker.pbPartner.isFainted?
- + score-=90
- + else
- + score-=attacker.pbPartner.stages[PBStats::SPDEF]*10
- + end
- + when 0x139
- + if !opponent.pbCanReduceStatStage?(PBStats::ATTACK,attacker)
- + score-=90
- + else
- + score+=opponent.stages[PBStats::ATTACK]*20
- + if skill>=PBTrainerAI.mediumSkill
- + hasphysicalattack=false
- + for thismove in opponent.moves
- + if thismove.id!=0 && thismove.basedamage>0 &&
- + thismove.pbIsPhysical?(thismove.type)
- + hasphysicalattack=true
- + end
- + end
- + if hasphysicalattack
- + score+=20
- + elsif skill>=PBTrainerAI.highSkill
- + score-=90
- + end
- + end
- + end
- + when 0x13A
- + avg=opponent.stages[PBStats::ATTACK]*10
- + avg+=opponent.stages[PBStats::SPATK]*10
- + score+=avg/2
- + when 0x13B
- + if !isConst?(attacker.species,PBSpecies,:HOOPA) || attacker.form!=1
- + score-=100
- + else
- + score+=20 if opponent.stages[PBStats::DEFENSE]>0
- + end
- + when 0x13C
- + score+=20 if opponent.stages[PBStats::SPATK]>0
- + when 0x13D
- + if !opponent.pbCanReduceStatStage?(PBStats::SPATK,attacker)
- + score-=90
- + else
- + score+=40 if attacker.turncount==0
- + score+=opponent.stages[PBStats::SPATK]*20
- + end
- + when 0x13E
- + count=0
- + for i in 0...4
- + battler=@battlers[i]
- + if battler.pbHasType?(:GRASS) && !battler.isAirborne? &&
- + (!battler.pbTooHigh?(PBStats::ATTACK) || !battler.pbTooHigh?(PBStats::SPATK))
- + count+=1
- + if attacker.pbIsOpposing?(battler)
- + score-=20
- + else
- + score-=attacker.stages[PBStats::ATTACK]*10
- + score-=attacker.stages[PBStats::SPATK]*10
- + end
- + end
- + end
- + score-=95 if count==0
- + when 0x13F
- + count=0
- + for i in 0...4
- + battler=@battlers[i]
- + if battler.pbHasType?(:GRASS) && !battler.pbTooHigh?(PBStats::DEFENSE)
- + count+=1
- + if attacker.pbIsOpposing?(battler)
- + score-=20
- + else
- + score-=attacker.stages[PBStats::DEFENSE]*10
- + end
- + end
- + end
- + score-=95 if count==0
- + when 0x140
- + count=0
- + for i in 0...4
- + battler=@battlers[i]
- + if battler.status==PBStatuses::POISON &&
- + (!battler.pbTooLow?(PBStats::ATTACK) ||
- + !battler.pbTooLow?(PBStats::SPATK) ||
- + !battler.pbTooLow?(PBStats::SPEED))
- + count+=1
- + if attacker.pbIsOpposing?(battler)
- + score+=attacker.stages[PBStats::ATTACK]*10
- + score+=attacker.stages[PBStats::SPATK]*10
- + score+=attacker.stages[PBStats::SPEED]*10
- + else
- + score-=20
- + end
- + end
- + end
- + score-=95 if count==0
- + when 0x141
- + if opponent.effects[PBEffects::Substitute]>0
- + score-=90
- + else
- + numpos=0; numneg=0
- + for i in [PBStats::ATTACK,PBStats::DEFENSE,PBStats::SPEED,
- + PBStats::SPATK,PBStats::SPDEF,PBStats::ACCURACY,PBStats::EVASION]
- + stat=opponent.stages[i]
- + (stat>0) ? numpos+=stat : numneg+=stat
- + end
- + if numpos!=0 || numneg!=0
- + score+=(numpos-numneg)*10
- + else
- + score-=95
- + end
- + end
- + when 0x142
- + if opponent.pbHasType?(:GHOST)
- + score-=90
- + end
- + when 0x143
- + if opponent.pbHasType?(:GRASS)
- + score-=90
- + end
- + when 0x144
- + when 0x145
- + aspeed=pbRoughStat(attacker,PBStats::SPEED,skill)
- + ospeed=pbRoughStat(opponent,PBStats::SPEED,skill)
- + if aspeed>ospeed
- + score-=90
- + end
- + when 0x146
- + when 0x147
- + when 0x148
- + aspeed=pbRoughStat(attacker,PBStats::SPEED,skill)
- + ospeed=pbRoughStat(opponent,PBStats::SPEED,skill)
- + if aspeed>ospeed
- + score-=90
- + else
- + score+=30 if opponent.pbHasMoveType?(:FIRE)
- + end
- + when 0x149
- + if attacker.turncount==0
- + score+=30
- + else
- + score-=90 # Because it will fail here
- + score=0 if skill>=PBTrainerAI.bestSkill
- + end
- + when 0x14A
- + when 0x14B, 0x14C
- + if attacker.effects[PBEffects::ProtectRate]>1 ||
- + opponent.effects[PBEffects::HyperBeam]>0
- + score-=90
- + else
- + if skill>=PBTrainerAI.mediumSkill
- + score-=(attacker.effects[PBEffects::ProtectRate]*40)
- + end
- + score+=50 if attacker.turncount==0
- + score+=30 if opponent.effects[PBEffects::TwoTurnAttack]!=0
- + end
- + when 0x14D
- + when 0x14E
- + if attacker.pbTooHigh?(PBStats::SPATK) &&
- + attacker.pbTooHigh?(PBStats::SPDEF) &&
- + attacker.pbTooHigh?(PBStats::SPEED)
- + score-=90
- + else
- + score-=attacker.stages[PBStats::SPATK]*10 # Only *10 isntead of *20
- + score-=attacker.stages[PBStats::SPDEF]*10 # because two-turn attack
- + score-=attacker.stages[PBStats::SPEED]*10
- + if skill>=PBTrainerAI.mediumSkill
- + hasspecialattack=false
- + for thismove in attacker.moves
- + if thismove.id!=0 && thismove.basedamage>0 &&
- + thismove.pbIsSpecial?(thismove.type)
- + hasspecialattack=true
- + end
- + end
- + if hasspecialattack
- + score+=20
- + elsif skill>=PBTrainerAI.highSkill
- + score-=90
- + end
- + end
- + if skill>=PBTrainerAI.highSkill
- + aspeed=pbRoughStat(attacker,PBStats::SPEED,skill)
- + ospeed=pbRoughStat(opponent,PBStats::SPEED,skill)
- + if aspeed<ospeed && aspeed*2>ospeed
- + score+=30
- + end
- + end
- + end
- + when 0x14F
- + if skill>=PBTrainerAI.highSkill && opponent.hasWorkingAbility(:LIQUIDOOZE)
- + score-=80
- + else
- + score+=40 if attacker.hp<=(attacker.totalhp/2)
- + end
- + when 0x150
- + score+=20 if !attacker.pbTooHigh?(:ATTACK) && opponent.hp<=(opponent.totalhp/4)
- + when 0x151
- + avg=opponent.stages[PBStats::ATTACK]*10
- + avg+=opponent.stages[PBStats::SPATK]*10
- + score+=avg/2
- + when 0x152
- + when 0x153
- + score-=95 if opponent.pbOwnSide.effects[PBEffects::StickyWeb]
- + when 0x154
- + when 0x155
- + when 0x156
- + when 0x157
- + score-=90
- + when 0x158
- + score-=90 if !attacker.pokemon || !attacker.pokemon.belch
- end
- # A score of 0 here means it should absolutely not be used
- return score if score<=0
- @@ -2455,8 +2694,7 @@ class PokeBattle_Battle
- move.function==0x95 # Magnitude
- when 0xCB # Dive
- miss=true unless move.function==0x75 || # Surf
- - move.function==0xD0 || # Whirlpool
- - move.function==0x12D # Shadow Storm
- + move.function==0xD0 # Whirlpool
- when 0xCD # Shadow Force
- miss=true
- when 0xCE # Sky Drop
- @@ -2466,6 +2704,8 @@ class PokeBattle_Battle
- move.function==0x78 || # Twister
- move.function==0x11B || # Sky Uppercut
- move.function==0x11C # Smack Down
- + when 0x14D # Phantom Force
- + miss=true
- end
- if opponent.effects[PBEffects::SkyDrop]
- miss=true unless move.function==0x08 || # Thunder
- @@ -2625,11 +2865,12 @@ class PokeBattle_Battle
- def pbTypeModifier(type,attacker,opponent)
- return 8 if type<0
- return 8 if isConst?(type,PBTypes,:GROUND) && opponent.pbHasType?(:FLYING) &&
- - opponent.hasWorkingItem(:IRONBALL)
- + opponent.hasWorkingItem(:IRONBALL) && !USENEWBATTLEMECHANICS
- atype=type
- otype1=opponent.type1
- otype2=opponent.type2
- otype3=opponent.effects[PBEffects::Type3] || -1
- + # Roost
- if isConst?(otype1,PBTypes,:FLYING) && opponent.effects[PBEffects::Roost]
- if isConst?(otype2,PBTypes,:FLYING) && isConst?(otype3,PBTypes,:FLYING)
- otype1=getConst(PBTypes,:NORMAL) || 0
- @@ -2640,59 +2881,65 @@ class PokeBattle_Battle
- if isConst?(otype2,PBTypes,:FLYING) && opponent.effects[PBEffects::Roost]
- otype2=otype1
- end
- + # Get effectivenesses
- mod1=PBTypes.getEffectiveness(atype,otype1)
- mod2=(otype1==otype2) ? 2 : PBTypes.getEffectiveness(atype,otype2)
- - mod3=(otype1==otype3 || otype2==otype3) ? 2 : PBTypes.getEffectiveness(atype,otype3)
- + mod3=(otype3<0 || otype1==otype3 || otype2==otype3) ? 2 : PBTypes.getEffectiveness(atype,otype3)
- if opponent.hasWorkingItem(:RINGTARGET)
- mod1=2 if mod1==0
- mod2=2 if mod2==0
- mod3=2 if mod3==0
- end
- - if attacker.hasWorkingAbility(:SCRAPPY) ||
- - opponent.effects[PBEffects::Foresight]
- - mod1=2 if isConst?(otype1,PBTypes,:GHOST) &&
- - (isConst?(atype,PBTypes,:NORMAL) || isConst?(atype,PBTypes,:FIGHTING))
- - mod2=2 if isConst?(otype2,PBTypes,:GHOST) &&
- - (isConst?(atype,PBTypes,:NORMAL) || isConst?(atype,PBTypes,:FIGHTING))
- - mod3=2 if isConst?(otype3,PBTypes,:GHOST) &&
- - (isConst?(atype,PBTypes,:NORMAL) || isConst?(atype,PBTypes,:FIGHTING))
- + # Foresight
- + if (attacker.hasWorkingAbility(:SCRAPPY) rescue false) || opponent.effects[PBEffects::Foresight]
- + mod1=2 if isConst?(otype1,PBTypes,:GHOST) && PBTypes.isIneffective?(atype,otype1)
- + mod2=2 if isConst?(otype2,PBTypes,:GHOST) && PBTypes.isIneffective?(atype,otype2)
- + mod3=2 if isConst?(otype3,PBTypes,:GHOST) && PBTypes.isIneffective?(atype,otype3)
- end
- + # Miracle Eye
- if opponent.effects[PBEffects::MiracleEye]
- - mod1=2 if isConst?(otype1,PBTypes,:DARK) && isConst?(atype,PBTypes,:PSYCHIC)
- - mod2=2 if isConst?(otype2,PBTypes,:DARK) && isConst?(atype,PBTypes,:PSYCHIC)
- - mod3=2 if isConst?(otype3,PBTypes,:DARK) && isConst?(atype,PBTypes,:PSYCHIC)
- + mod1=2 if isConst?(otype1,PBTypes,:DARK) && PBTypes.isIneffective?(atype,otype1)
- + mod2=2 if isConst?(otype2,PBTypes,:DARK) && PBTypes.isIneffective?(atype,otype2)
- + mod3=2 if isConst?(otype3,PBTypes,:DARK) && PBTypes.isIneffective?(atype,otype3)
- end
- - if !opponent.isAirborne?
- - mod1=2 if isConst?(otype1,PBTypes,:FLYING) && isConst?(atype,PBTypes,:GROUND)
- - mod2=2 if isConst?(otype2,PBTypes,:FLYING) && isConst?(atype,PBTypes,:GROUND)
- - mod3=2 if isConst?(otype3,PBTypes,:FLYING) && isConst?(atype,PBTypes,:GROUND)
- + # Delta Stream's weather
- + if pbWeather==PBWeather::STRONGWINDS
- + mod1=2 if isConst?(otype1,PBTypes,:FLYING) && PBTypes.isSuperEffective?(atype,otype1)
- + mod2=2 if isConst?(otype2,PBTypes,:FLYING) && PBTypes.isSuperEffective?(atype,otype2)
- + mod3=2 if isConst?(otype3,PBTypes,:FLYING) && PBTypes.isSuperEffective?(atype,otype3)
- + end
- + # Smack Down makes Ground moves work against fliers
- + if !opponent.isAirborne?((attacker.hasMoldBreaker rescue false)) && isConst?(atype,PBTypes,:GROUND)
- + mod1=2 if isConst?(otype1,PBTypes,:FLYING)
- + mod2=2 if isConst?(otype2,PBTypes,:FLYING)
- + mod3=2 if isConst?(otype3,PBTypes,:FLYING)
- end
- return mod1*mod2*mod3
- end
- def pbTypeModifier2(battlerThis,battlerOther)
- + # battlerThis isn't a Battler object, it's a Pokémon - it has no third type
- if battlerThis.type1==battlerThis.type2
- return 4*pbTypeModifier(battlerThis.type1,battlerThis,battlerOther)
- - else
- - ret=pbTypeModifier(battlerThis.type1,battlerThis,battlerOther)
- - ret*=pbTypeModifier(battlerThis.type2,battlerThis,battlerOther)
- - return ret # 0,1,2,4,8,_16_,32,64,128,256
- end
- + ret=pbTypeModifier(battlerThis.type1,battlerThis,battlerOther)
- + ret*=pbTypeModifier(battlerThis.type2,battlerThis,battlerOther)
- + return ret*2 # 0,1,2,4,_8_,16,32,64
- end
- def pbRoughStat(battler,stat,skill)
- - if skill>=PBTrainerAI.highSkill && stat==PBStats::SPEED
- - return battler.pbSpeed
- - end
- + return battler.pbSpeed if skill>=PBTrainerAI.highSkill && stat==PBStats::SPEED
- stagemul=[2,2,2,2,2,2,2,3,4,5,6,7,8]
- stagediv=[8,7,6,5,4,3,2,2,2,2,2,2,2]
- stage=battler.stages[stat]+6
- value=0
- - value=battler.attack if stat==PBStats::ATTACK
- - value=battler.defense if stat==PBStats::DEFENSE
- - value=battler.speed if stat==PBStats::SPEED
- - value=battler.spatk if stat==PBStats::SPATK
- - value=battler.spdef if stat==PBStats::SPDEF
- + case stat
- + when PBStats::ATTACK; value=battler.attack
- + when PBStats::DEFENSE; value=battler.defense
- + when PBStats::SPEED; value=battler.speed
- + when PBStats::SPATK; value=battler.spatk
- + when PBStats::SPDEF; value=battler.spdef
- + end
- return (value*1.0*stagemul[stage]/stagediv[stage]).floor
- end
- @@ -2886,6 +3133,13 @@ class PokeBattle_Battle
- #TODO
- when 0x113 # Spit Up
- basedamage*=attacker.effects[PBEffects::Stockpile]
- + when 0x144
- + type=getConst(PBTypes,:FLYING) || -1
- + if type>=0
- + mult=PBTypes.getCombinedEffectiveness(type,
- + opponent.type1,opponent.type2,opponent.effects[PBEffects::Type3])
- + basedamage=((basedamage*mult)/8).round
- + end
- end
- return basedamage
- end
- @@ -3965,7 +4219,7 @@ class PokeBattle_Battle
- end
- if movetype>=0 && pbTypeModifier(movetype,@battlers[index],@battlers[index])==0
- weight=65
- - if pbTypeModifier2(party[i],@battlers[index].pbOppositeOpposing)<16
- + if pbTypeModifier2(party[i],@battlers[index].pbOppositeOpposing)>8
- # Greater weight if new Pokemon's type is effective against opponent
- weight=85
- end
- @@ -3974,7 +4228,7 @@ class PokeBattle_Battle
- end
- elsif movetype>=0 && pbTypeModifier(movetype,@battlers[index],@battlers[index])<8
- weight=40
- - if pbTypeModifier2(party[i],@battlers[index].pbOppositeOpposing)<16
- + if pbTypeModifier2(party[i],@battlers[index].pbOppositeOpposing)>8
- # Greater weight if new Pokemon's type is effective against opponent
- weight=60
- end
- @@ -4030,10 +4284,10 @@ class PokeBattle_Battle
- md=PBMoveData.new(move.id)
- next if md.basedamage==0
- if o1
- - sum+=PBTypes.getCombinedEffectiveness(md.type,o1.type1,o1.type2)
- + sum+=PBTypes.getCombinedEffectiveness(md.type,o1.type1,o1.type2,o1.effects[PBEffects::Type3])
- end
- if o2
- - sum+=PBTypes.getCombinedEffectiveness(md.type,o2.type1,o2.type2)
- + sum+=PBTypes.getCombinedEffectiveness(md.type,o2.type1,o2.type2,o2.effects[PBEffects::Type3])
- end
- end
- if best==-1 || sum>bestSum
- diff --git a/Data/Scripts.rxdata/[087] PokeBattle_Scene.rb b/Data/Scripts.rxdata/[087] PokeBattle_Scene.rb
- index ce80b8b..58cae67 100644
- --- a/Data/Scripts.rxdata/[087] PokeBattle_Scene.rb
- +++ b/Data/Scripts.rxdata/[087] PokeBattle_Scene.rb
- @@ -348,6 +348,7 @@ class FightMenuDisplay
- @info.text=_ISPRINTF("{1:s}PP: {2: 2d}/{3: 2d}<br>TYPE/{4:s}",
- @ctag,selmove.pp,selmove.totalpp,movetype)
- end
- + @buttons.refresh(self.index,@battler ? @battler.moves : nil,@megaButton) if @buttons
- end
- def update
- @@ -2508,12 +2509,17 @@ class PokeBattle_Scene
- end
- end
- - def pbFirstTarget(index)
- - for i in 0...4
- - if i!=index && [email protected][i].isFainted? &&
- - @battle.battlers[index].pbIsOpposing?(i)
- - return i
- - end
- + def pbFirstTarget(index,targettype)
- + case targettype
- + when PBTargets::SingleNonUser
- + for i in 0...4
- + if i!=index && [email protected][i].isFainted? &&
- + @battle.battlers[index].pbIsOpposing?(i)
- + return i
- + end
- + end
- + when PBTargets::UserOrPartner
- + return index
- end
- return -1
- end
- @@ -2535,9 +2541,19 @@ class PokeBattle_Scene
- # Use this method to make the player choose a target
- # for certain moves in double battles.
- - def pbChooseTarget(index)
- + def pbChooseTarget(index,targettype)
- pbShowWindow(FIGHTBOX)
- - curwindow=pbFirstTarget(index)
- + cw = @sprites["fightwindow"]
- + [email protected][index]
- + cw.battler=battler
- + lastIndex=@lastmove[index]
- + if battler.moves[lastIndex].id!=0
- + cw.setIndex(lastIndex)
- + else
- + cw.setIndex(0)
- + end
- +
- + curwindow=pbFirstTarget(index,targettype)
- if curwindow==-1
- raise RuntimeError.new(_INTL("No targets somehow..."))
- end
- @@ -2557,22 +2573,36 @@ class PokeBattle_Scene
- if curwindow>=0
- if Input.trigger?(Input::RIGHT) || Input.trigger?(Input::DOWN)
- loop do
- - newcurwindow=3 if curwindow==0
- - newcurwindow=1 if curwindow==3
- - newcurwindow=2 if curwindow==1
- - newcurwindow=0 if curwindow==2
- + case targettype
- + when PBTargets::SingleNonUser
- + case curwindow
- + when 0; newcurwindow=2
- + when 1; newcurwindow=0
- + when 2; newcurwindow=3
- + when 3; newcurwindow=1
- + end
- + when PBTargets::UserOrPartner
- + newcurwindow=(curwindow+2)%4
- + end
- curwindow=newcurwindow
- - next if curwindow==index
- + next if targettype==PBTargets::SingleNonUser && curwindow==index
- end
- elsif Input.trigger?(Input::LEFT) || Input.trigger?(Input::UP)
- loop do
- - newcurwindow=2 if curwindow==0
- - newcurwindow=1 if curwindow==2
- - newcurwindow=3 if curwindow==1
- - newcurwindow=0 if curwindow==3
- + case targettype
- + when PBTargets::SingleNonUser
- + case curwindow
- + when 0; newcurwindow=1
- + when 1; newcurwindow=3
- + when 2; newcurwindow=0
- + when 3; newcurwindow=2
- + end
- + when PBTargets::UserOrPartner
- + newcurwindow=(curwindow+2)%4
- + end
- curwindow=newcurwindow
- - next if curwindow==index
- + next if targettype==PBTargets::SingleNonUser && curwindow==index
- end
- end
- diff --git a/Data/Scripts.rxdata/[089] PokeBattle_SafariZone.rb b/Data/Scripts.rxdata/[089] PokeBattle_SafariZone.rb
- index 106d89d..3e23687 100644
- --- a/Data/Scripts.rxdata/[089] PokeBattle_SafariZone.rb
- +++ b/Data/Scripts.rxdata/[089] PokeBattle_SafariZone.rb
- @@ -5,6 +5,7 @@ class PokeBattle_FakeBattler
- @owned=$Trainer.owned[pokemon.species]
- end
- + def index; return @index; end
- def pokemon; @pokemon; end
- def species; @pokemon.species; end
- def gender; @pokemon.gender; end
- @@ -21,10 +22,9 @@ class PokeBattle_FakeBattler
- def isMega?; return false; end
- def hasPrimal?; return false; end
- def isPrimal?; return false; end
- -
- - def index
- - return @index
- - end
- + def displayGender; return @pokemon.gender; end
- + def captured; return false; end
- + def captured=(value); end
- def pbThis(lowercase=false)
- return lowercase ? _INTL("the wild {1}",@pokemon.name) : _INTL("The wild {1}",@pokemon.name)
- @@ -230,4 +230,6 @@ class PokeBattle_SafariZone
- def pbRandom(x)
- return rand(x)
- end
- +
- + def pbGainEXP; end
- end
- \ No newline at end of file
- diff --git a/Data/Scripts.rxdata/[093] PokeBattle_OtherScenes.rb b/Data/Scripts.rxdata/[093] PokeBattle_OtherScenes.rb
- index ae6ba22..ba638d9 100644
- --- a/Data/Scripts.rxdata/[093] PokeBattle_OtherScenes.rb
- +++ b/Data/Scripts.rxdata/[093] PokeBattle_OtherScenes.rb
- @@ -348,7 +348,7 @@ class PokeBattle_DebugScene
- return -1
- end
- - def pbFirstTarget(index)
- + def pbFirstTarget(index,targettype)
- for i in 0...4
- return i
- @@ -380,8 +380,8 @@ class PokeBattle_DebugScene
- # Use this method to make the player choose a target
- # for certain moves in double battles.
- - def pbChooseTarget(index)
- - curwindow=pbFirstTarget(index)
- + def pbChooseTarget(index,targettype)
- + curwindow=pbFirstTarget(index,targettype)
- if curwindow==-1
- raise RuntimeError.new("No targets somehow...")
- end
- @@ -586,7 +586,7 @@ class PokeBattle_SceneNonInteractive < PokeBattle_Scene
- return -1
- end
- - def pbChooseTarget(index)
- + def pbChooseTarget(index,targettype)
- targets=[]
- for i in 0...4
- if @battle.battlers[index].pbIsOpposing?(i) &&
- @@ -698,7 +698,7 @@ class PokeBattle_DebugSceneNoLogging
- return -1
- end
- - def pbChooseTarget(index)
- + def pbChooseTarget(index,targettype)
- targets=[]
- for i in 0...4
- if @battle.battlers[index].pbIsOpposing?(i) &&
- @@ -879,7 +879,7 @@ class PokeBattle_DebugSceneNoGraphics
- return -1
- end
- - def pbChooseTarget(index)
- + def pbChooseTarget(index,targettype)
- targets=[]
- for i in 0...4
- if @battle.battlers[index].pbIsOpposing?(i) &&
- diff --git a/Data/Scripts.rxdata/[094] PokeBattle_BattlePeer.rb b/Data/Scripts.rxdata/[094] PokeBattle_BattlePeer.rb
- index 7c98e7a..290f2b0 100644
- --- a/Data/Scripts.rxdata/[094] PokeBattle_BattlePeer.rb
- +++ b/Data/Scripts.rxdata/[094] PokeBattle_BattlePeer.rb
- @@ -1,3 +1,29 @@
- +class PokeBattle_NullBattlePeer
- + def pbOnEnteringBattle(battle,pokemon)
- + end
- +
- + def pbStorePokemon(player,pokemon)
- + if player.party.length<6
- + player.party[player.party.length]=pokemon
- + end
- + return -1
- + end
- +
- + def pbGetStorageCreator()
- + return nil
- + end
- +
- + def pbCurrentBox()
- + return -1
- + end
- +
- + def pbBoxName(box)
- + return ""
- + end
- +end
- +
- +
- +
- class PokeBattle_RealBattlePeer
- def pbStorePokemon(player,pokemon)
- if player.party.length<6
- diff --git a/Data/Scripts.rxdata/[098] PField_Field.rb b/Data/Scripts.rxdata/[098] PField_Field.rb
- index a2b1cb8..80af919 100644
- --- a/Data/Scripts.rxdata/[098] PField_Field.rb
- +++ b/Data/Scripts.rxdata/[098] PField_Field.rb
- @@ -523,22 +523,114 @@ def pbBattleAnimation(bgm=nil,trainerid=-1,trainername="")
- $game_temp.background_bitmap.dispose
- end
- $game_temp.background_bitmap=Graphics.snap_to_bitmap
- -# Animate the screen ($game_temp.background_bitmap contains
- -# the current game screen).
- -#
- -# The following example runs a common event that does a custom animation if some
- -# condition is true. The screen should fade to black when the common event is
- -# finished:
- -#
- -# if $game_map && $game_map.map_id==20 # If on map 20
- -# pbCommonEvent(20)
- -# handled=true # Note that the battle animation is done
- -# end
- -#
- -################################################################################
- -# VS. animation, by Luka S.J.
- -# Tweaked by Maruno.
- -################################################################################
- + # Check for custom battle intro animations
- + handled=pbBattleAnimationOverride(viewport,trainerid,trainername)
- + # Default battle intro animation
- + if !handled
- + if Sprite.method_defined?(:wave_amp) && rand(15)==0
- + viewport.color=Color.new(0,0,0,255)
- + sprite = Sprite.new
- + bitmap=Graphics.snap_to_bitmap
- + bm=bitmap.clone
- + sprite.z=99999
- + sprite.bitmap = bm
- + sprite.wave_speed=500
- + for i in 0..25
- + sprite.opacity-=10
- + sprite.wave_amp+=60
- + sprite.update
- + sprite.wave_speed+=30
- + 2.times do
- + Graphics.update
- + end
- + end
- + bitmap.dispose
- + bm.dispose
- + sprite.dispose
- + elsif Bitmap.method_defined?(:radial_blur) && rand(15)==0
- + viewport.color=Color.new(0,0,0,255)
- + sprite = Sprite.new
- + bitmap=Graphics.snap_to_bitmap
- + bm=bitmap.clone
- + sprite.z=99999
- + sprite.bitmap = bm
- + for i in 0..15
- + bm.radial_blur(i,2)
- + sprite.opacity-=15
- + 2.times do
- + Graphics.update
- + end
- + end
- + bitmap.dispose
- + bm.dispose
- + sprite.dispose
- + elsif rand(10)==0 # Custom transition method
- + scroll=["ScrollDown","ScrollLeft","ScrollRight","ScrollUp",
- + "ScrollDownRight","ScrollDownLeft","ScrollUpRight","ScrollUpLeft"]
- + Graphics.freeze
- + viewport.color=Color.new(0,0,0,255)
- + Graphics.transition(50,sprintf("Graphics/Transitions/%s",scroll[rand(scroll.length)]))
- + else
- + transitions=[
- + # Transitions with graphic files
- + "021-Normal01","022-Normal02",
- + "Battle","battle1","battle2","battle3","battle4",
- + "computertr","computertrclose",
- + "hexatr","hexatrc","hexatzr",
- + "Image1","Image2","Image3","Image4",
- + # Custom transition methods
- + "Splash","Random_stripe_v","Random_stripe_h",
- + "RotatingPieces","ShrinkingPieces",
- + "BreakingGlass","Mosaic","zoomin"
- + ]
- + rnd=rand(transitions.length)
- + Graphics.freeze
- + viewport.color=Color.new(0,0,0,255)
- + Graphics.transition(40,sprintf("Graphics/Transitions/%s",transitions[rnd]))
- + end
- + 5.times do
- + Graphics.update
- + Input.update
- + pbUpdateSceneMap
- + end
- + end
- + pbPushFade
- + yield if block_given?
- + pbPopFade
- + if $game_system && $game_system.is_a?(Game_System)
- + $game_system.bgm_resume(playingBGM)
- + $game_system.bgs_resume(playingBGS)
- + end
- + $PokemonGlobal.nextBattleBGM=nil
- + $PokemonGlobal.nextBattleME=nil
- + $PokemonGlobal.nextBattleBack=nil
- + $PokemonEncounters.clearStepCount
- + for j in 0..17
- + viewport.color=Color.new(0,0,0,(17-j)*15)
- + Graphics.update
- + Input.update
- + pbUpdateSceneMap
- + end
- + viewport.dispose
- +end
- +
- +# Alias and use this method if you want to add a custom battle intro animation
- +# e.g. variants of the Vs. animation.
- +# Note that $game_temp.background_bitmap contains an image of the current game
- +# screen.
- +# When the custom animation has finished, the screen should have faded to black
- +# somehow.
- +def pbBattleAnimationOverride(viewport,trainerid=-1,trainername="")
- + # The following example runs a common event that ought to do a custom
- + # animation if some condition is true:
- + #
- + # if $game_map && $game_map.map_id==20 # If on map 20
- + # pbCommonEvent(20)
- + # return true # Note that the battle animation is done
- + # end
- + #
- + ##### VS. animation, by Luka S.J. #####
- + ##### Tweaked by Maruno #####
- if trainerid>=0
- tbargraphic=sprintf("Graphics/Transitions/vsBar%s",getConstantName(PBTrainers,trainerid)) rescue nil
- tbargraphic=sprintf("Graphics/Transitions/vsBar%d",trainerid) if !pbResolveBitmap(tbargraphic)
- @@ -687,96 +779,10 @@ def pbBattleAnimation(bgm=nil,trainerid=-1,trainername="")
- viewopp.dispose
- viewplayer.dispose
- viewport.color=Color.new(0,0,0,255)
- - handled=true
- + return true
- end
- end
- - # End of VS. sequence script
- - if !handled
- - if Sprite.method_defined?(:wave_amp) && rand(15)==0
- - viewport.color=Color.new(0,0,0,255)
- - sprite = Sprite.new
- - bitmap=Graphics.snap_to_bitmap
- - bm=bitmap.clone
- - sprite.z=99999
- - sprite.bitmap = bm
- - sprite.wave_speed=500
- - for i in 0..25
- - sprite.opacity-=10
- - sprite.wave_amp+=60
- - sprite.update
- - sprite.wave_speed+=30
- - 2.times do
- - Graphics.update
- - end
- - end
- - bitmap.dispose
- - bm.dispose
- - sprite.dispose
- - elsif Bitmap.method_defined?(:radial_blur) && rand(15)==0
- - viewport.color=Color.new(0,0,0,255)
- - sprite = Sprite.new
- - bitmap=Graphics.snap_to_bitmap
- - bm=bitmap.clone
- - sprite.z=99999
- - sprite.bitmap = bm
- - for i in 0..15
- - bm.radial_blur(i,2)
- - sprite.opacity-=15
- - 2.times do
- - Graphics.update
- - end
- - end
- - bitmap.dispose
- - bm.dispose
- - sprite.dispose
- - elsif rand(10)==0 # Custom transition method
- - scroll=["ScrollDown","ScrollLeft","ScrollRight","ScrollUp",
- - "ScrollDownRight","ScrollDownLeft","ScrollUpRight","ScrollUpLeft"]
- - Graphics.freeze
- - viewport.color=Color.new(0,0,0,255)
- - Graphics.transition(50,sprintf("Graphics/Transitions/%s",scroll[rand(scroll.length)]))
- - else
- - transitions=[
- - # Transitions with graphic files
- - "021-Normal01","022-Normal02",
- - "Battle","battle1","battle2","battle3","battle4",
- - "computertr","computertrclose",
- - "hexatr","hexatrc","hexatzr",
- - "Image1","Image2","Image3","Image4",
- - # Custom transition methods
- - "Splash","Random_stripe_v","Random_stripe_h",
- - "RotatingPieces","ShrinkingPieces",
- - "BreakingGlass","Mosaic","zoomin"
- - ]
- - rnd=rand(transitions.length)
- - Graphics.freeze
- - viewport.color=Color.new(0,0,0,255)
- - Graphics.transition(40,sprintf("Graphics/Transitions/%s",transitions[rnd]))
- - end
- - 5.times do
- - Graphics.update
- - Input.update
- - pbUpdateSceneMap
- - end
- - end
- - pbPushFade
- - yield if block_given?
- - pbPopFade
- - if $game_system && $game_system.is_a?(Game_System)
- - $game_system.bgm_resume(playingBGM)
- - $game_system.bgs_resume(playingBGS)
- - end
- - $PokemonGlobal.nextBattleBGM=nil
- - $PokemonGlobal.nextBattleME=nil
- - $PokemonGlobal.nextBattleBack=nil
- - $PokemonEncounters.clearStepCount
- - for j in 0..17
- - viewport.color=Color.new(0,0,0,(17-j)*15)
- - Graphics.update
- - Input.update
- - pbUpdateSceneMap
- - end
- - viewport.dispose
- + return false
- end
- def pbPrepareBattle(battle)
- @@ -808,22 +814,19 @@ def pbGetEnvironment
- elsif !pbGetMetadata($game_map.map_id,MetadataOutdoor)
- return PBEnvironment::None
- else
- - terrain=$game_player.terrain_tag
- - if terrain==PBTerrain::Grass # Normal grass
- - return PBEnvironment::Grass
- - elsif terrain==PBTerrain::TallGrass # Tall grass
- - return PBEnvironment::TallGrass
- - elsif terrain==PBTerrain::DeepWater || terrain==PBTerrain::Water
- - return PBEnvironment::MovingWater
- - elsif terrain==PBTerrain::StillWater
- - return PBEnvironment::StillWater
- - elsif terrain==PBTerrain::Rock
- - return PBEnvironment::Rock
- - elsif terrain==PBTerrain::Sand
- - return PBEnvironment::Sand
- + case $game_player.terrain_tag
- + when PBTerrain::Grass; return PBEnvironment::Grass # Normal grass
- + when PBTerrain::Sand; return PBEnvironment::Sand
- + when PBTerrain::Rock; return PBEnvironment::Rock
- + when PBTerrain::DeepWater; return PBEnvironment::MovingWater
- + when PBTerrain::StillWater; return PBEnvironment::StillWater
- + when PBTerrain::Water; return PBEnvironment::MovingWater
- + when PBTerrain::TallGrass; return PBEnvironment::TallGrass # Tall grass
- + when PBTerrain::SootGrass; return PBEnvironment::Grass # Sooty tall grass
- + when PBTerrain::Puddle; return PBEnvironment::StillWater
- end
- - return PBEnvironment::None
- end
- + return PBEnvironment::None
- end
- def pbGenerateWildPokemon(species,level,isroamer=false)
- @@ -1134,7 +1137,7 @@ def pbEncounter(enctype)
- return false if !encounter
- $PokemonTemp.encounterType=enctype
- pbWildBattle(encounter[0],encounter[1])
- - $PokemonTemp.encounterType=-1
- + $PokemonTemp.encounterType=-1
- return true
- end
- end
- @@ -2426,11 +2429,9 @@ def pbMoveRoute(event,commands,waitComplete=false)
- route.list.push(RPG::MoveCommand.new(PBMoveRoute::ThroughOn))
- i=0; while i<commands.length
- case commands[i]
- - when PBMoveRoute::Wait, PBMoveRoute::SwitchOn,
- - PBMoveRoute::SwitchOff, PBMoveRoute::ChangeSpeed,
- - PBMoveRoute::ChangeFreq, PBMoveRoute::Opacity,
- - PBMoveRoute::Blending, PBMoveRoute::PlaySE,
- - PBMoveRoute::Script
- + when PBMoveRoute::Wait, PBMoveRoute::SwitchOn, PBMoveRoute::SwitchOff,
- + PBMoveRoute::ChangeSpeed, PBMoveRoute::ChangeFreq, PBMoveRoute::Opacity,
- + PBMoveRoute::Blending, PBMoveRoute::PlaySE, PBMoveRoute::Script
- route.list.push(RPG::MoveCommand.new(commands[i],[commands[i+1]]))
- i+=1
- when PBMoveRoute::ScriptAsync
- diff --git a/Data/Scripts.rxdata/[102] PField_HiddenMoves.rb b/Data/Scripts.rxdata/[102] PField_HiddenMoves.rb
- index 4ec5735..fbc714f 100644
- --- a/Data/Scripts.rxdata/[102] PField_HiddenMoves.rb
- +++ b/Data/Scripts.rxdata/[102] PField_HiddenMoves.rb
- @@ -338,7 +338,7 @@ def Kernel.pbHeadbutt(event)
- if $DEBUG || movefinder
- if Kernel.pbConfirmMessage(_INTL("A Pokémon could be in this tree. Would you like to use Headbutt?"))
- speciesname=!movefinder ? $Trainer.name : movefinder.name
- - Kernel.pbMessage(_INTL("{1} used Headbutt.",speciesname))
- + Kernel.pbMessage(_INTL("{1} used Headbutt!",speciesname))
- pbHiddenMoveAnimation(movefinder)
- Kernel.pbHeadbuttEffect(event)
- end
- @@ -360,7 +360,7 @@ HiddenMoveHandlers::CanUseMove.add(:HEADBUTT,proc{|move,pkmn|
- HiddenMoveHandlers::UseMove.add(:HEADBUTT,proc{|move,pokemon|
- if !pbHiddenMoveAnimation(pokemon)
- - Kernel.pbMessage(_INTL("{1} used {2}.",pokemon.name,PBMoves.getName(move)))
- + Kernel.pbMessage(_INTL("{1} used {2}!",pokemon.name,PBMoves.getName(move)))
- end
- facingEvent=$game_player.pbFacingEvent
- Kernel.pbHeadbuttEffect(facingEvent)
- @@ -407,7 +407,7 @@ HiddenMoveHandlers::CanUseMove.add(:ROCKSMASH,proc{|move,pkmn|
- Kernel.pbMessage(_INTL("Can't use that here."))
- return false
- end
- - return true
- + return true
- })
- HiddenMoveHandlers::UseMove.add(:ROCKSMASH,proc{|move,pokemon|
- @@ -419,7 +419,7 @@ HiddenMoveHandlers::UseMove.add(:ROCKSMASH,proc{|move,pokemon|
- facingEvent.erase
- $PokemonMap.addErasedEvent(facingEvent.id)
- end
- - return true
- + return true
- })
- #===============================================================================
- @@ -470,15 +470,16 @@ HiddenMoveHandlers::CanUseMove.add(:STRENGTH,proc{|move,pkmn|
- Kernel.pbMessage(_INTL("Strength is already being used."))
- return false
- end
- - return true
- + return true
- })
- HiddenMoveHandlers::UseMove.add(:STRENGTH,proc{|move,pokemon|
- - pbHiddenMoveAnimation(pokemon)
- - Kernel.pbMessage(_INTL("{1} used {2}!",pokemon.name,PBMoves.getName(move)))
- + if !pbHiddenMoveAnimation(pokemon)
- + Kernel.pbMessage(_INTL("{1} used {2}!",pokemon.name,PBMoves.getName(move)))
- + end
- Kernel.pbMessage(_INTL("{1}'s Strength made it possible to move boulders around!",pokemon.name))
- $PokemonMap.strengthUsed=true
- - return true
- + return true
- })
- #===============================================================================
- @@ -497,9 +498,7 @@ def Kernel.pbSurf
- Kernel.pbMessage(_INTL("{1} used Surf!",speciesname))
- pbHiddenMoveAnimation(movefinder)
- surfbgm=pbGetMetadata(0,MetadataSurfBGM)
- - if surfbgm
- - pbCueBGM(surfbgm,0.5)
- - end
- + pbCueBGM(surfbgm,0.5) if surfbgm
- pbStartSurfing()
- return true
- end
- @@ -563,8 +562,6 @@ Events.onAction+=proc{|sender,e|
- }
- HiddenMoveHandlers::CanUseMove.add(:SURF,proc{|move,pkmn|
- - terrain=Kernel.pbFacingTerrainTag
- - notCliff=$game_map.passable?($game_player.x,$game_player.y,$game_player.direction)
- if !$DEBUG &&
- !(HIDDENMOVESCOUNTBADGES ? $Trainer.numbadges>=BADGEFORSURF : $Trainer.badges[BADGEFORSURF])
- Kernel.pbMessage(_INTL("Sorry, a new Badge is required."))
- @@ -582,6 +579,8 @@ HiddenMoveHandlers::CanUseMove.add(:SURF,proc{|move,pkmn|
- Kernel.pbMessage(_INTL("Let's enjoy cycling!"))
- return false
- end
- + terrain=Kernel.pbFacingTerrainTag
- + notCliff=$game_map.passable?($game_player.x,$game_player.y,$game_player.direction)
- if !PBTerrain.isSurfable?(terrain) || !notCliff
- Kernel.pbMessage(_INTL("No surfing here!"))
- return false
- @@ -590,9 +589,12 @@ HiddenMoveHandlers::CanUseMove.add(:SURF,proc{|move,pkmn|
- })
- HiddenMoveHandlers::UseMove.add(:SURF,proc{|move,pokemon|
- + $game_temp.in_menu=false
- if !pbHiddenMoveAnimation(pokemon)
- Kernel.pbMessage(_INTL("{1} used {2}!",pokemon.name,PBMoves.getName(move)))
- end
- + surfbgm=pbGetMetadata(0,MetadataSurfBGM)
- + pbCueBGM(surfbgm,0.5) if surfbgm
- pbStartSurfing()
- return true
- })
- @@ -645,7 +647,7 @@ def Kernel.pbWaterfall
- if $DEBUG || movefinder
- if Kernel.pbConfirmMessage(_INTL("It's a large waterfall. Would you like to use Waterfall?"))
- speciesname=!movefinder ? $Trainer.name : movefinder.name
- - Kernel.pbMessage(_INTL("{1} used Waterfall.",speciesname))
- + Kernel.pbMessage(_INTL("{1} used Waterfall!",speciesname))
- pbHiddenMoveAnimation(movefinder)
- pbAscendWaterfall
- return true
- @@ -687,7 +689,7 @@ HiddenMoveHandlers::CanUseMove.add(:WATERFALL,proc{|move,pkmn|
- HiddenMoveHandlers::UseMove.add(:WATERFALL,proc{|move,pokemon|
- if !pbHiddenMoveAnimation(pokemon)
- - Kernel.pbMessage(_INTL("{1} used {2}.",pokemon.name,PBMoves.getName(move)))
- + Kernel.pbMessage(_INTL("{1} used {2}!",pokemon.name,PBMoves.getName(move)))
- end
- Kernel.pbAscendWaterfall
- return true
- @@ -705,7 +707,7 @@ def Kernel.pbDive
- if $DEBUG || movefinder
- if Kernel.pbConfirmMessage(_INTL("The sea is deep here. Would you like to use Dive?"))
- speciesname=!movefinder ? $Trainer.name : movefinder.name
- - Kernel.pbMessage(_INTL("{1} used Dive.",speciesname))
- + Kernel.pbMessage(_INTL("{1} used Dive!",speciesname))
- pbHiddenMoveAnimation(movefinder)
- pbFadeOutIn(99999){
- $game_temp.player_new_map_id=divemap
- @@ -748,7 +750,7 @@ def Kernel.pbSurfacing
- (HIDDENMOVESCOUNTBADGES ? $Trainer.numbadges>=BADGEFORDIVE : $Trainer.badges[BADGEFORDIVE]) )
- if Kernel.pbConfirmMessage(_INTL("Light is filtering down from above. Would you like to use Dive?"))
- speciesname=!movefinder ? $Trainer.name : movefinder.name
- - Kernel.pbMessage(_INTL("{1} used Dive.",speciesname))
- + Kernel.pbMessage(_INTL("{1} used Dive!",speciesname))
- pbHiddenMoveAnimation(movefinder)
- pbFadeOutIn(99999){
- $game_temp.player_new_map_id=divemap
- @@ -873,7 +875,7 @@ HiddenMoveHandlers::UseMove.add(:DIVE,proc{|move,pokemon|
- end
- return false if !divemap
- if !pbHiddenMoveAnimation(pokemon)
- - Kernel.pbMessage(_INTL("{1} used {2}.",pokemon.name,PBMoves.getName(move)))
- + Kernel.pbMessage(_INTL("{1} used {2}!",pokemon.name,PBMoves.getName(move)))
- end
- pbFadeOutIn(99999){
- $game_temp.player_new_map_id=divemap
- diff --git a/Data/Scripts.rxdata/[104] PField_EncounterModifiers.rb b/Data/Scripts.rxdata/[104] PField_EncounterModifiers.rb
- index f8e091b..946d3fd 100644
- --- a/Data/Scripts.rxdata/[104] PField_EncounterModifiers.rb
- +++ b/Data/Scripts.rxdata/[104] PField_EncounterModifiers.rb
- @@ -20,7 +20,10 @@ Events.onWildPokemonCreate+=proc {|sender,e|
- Events.onWildPokemonCreate+=proc {|sender,e|
- pokemon=e[0]
- if $game_map.map_id==51
- - pokemon.level=pbBalancedLevel($Trainer.party) - 4 + rand(5) # For variety
- + newlevel=pbBalancedLevel($Trainer.party) - 4 + rand(5) # For variety
- + newlevel=1 if newlevel<1
- + newlevel=PBExperience::MAXLEVEL if newlevel>PBExperience::MAXLEVEL
- + pokemon.level=newlevel
- pokemon.calcStats
- pokemon.resetMoves
- end
- diff --git a/Data/Scripts.rxdata/[106] PField_RandomDungeons.rb b/Data/Scripts.rxdata/[106] PField_RandomDungeons.rb
- index 7c8e5a0..45b9dc8 100644
- --- a/Data/Scripts.rxdata/[106] PField_RandomDungeons.rb
- +++ b/Data/Scripts.rxdata/[106] PField_RandomDungeons.rb
- @@ -377,7 +377,7 @@ class Dungeon
- class DungeonTable
- def initialize(dungeon)
- - @dungeon=dungeon
- + @dungeon=dungeon
- end
- def xsize; @dungeon.width; end
- @@ -526,15 +526,15 @@ class Dungeon
- end
- def intersects?(r1,r2)
- - return !((( r2[0] + r2[2] <= r1[0] ) ||
- - ( r2[0] >= r1[0] + r1[2] ) ||
- - ( r2[1] + r2[3] <= r1[1] ) ||
- - ( r2[1] >= r1[1] + r1[3] ) ) &&
- - (( r1[0] <= r2[0] + r2[2] )||
- - ( r1[0] >= r2[0] + r2[2] ) ||
- - ( r1[1] + r1[3] <= r2[1] ) ||
- - ( r1[1] >= r2[1] + r2[3] ))
- - );
- + return !((( r2[0] + r2[2] <= r1[0] ) ||
- + ( r2[0] >= r1[0] + r1[2] ) ||
- + ( r2[1] + r2[3] <= r1[1] ) ||
- + ( r2[1] >= r1[1] + r1[3] ) ) &&
- + (( r1[0] <= r2[0] + r2[2] )||
- + ( r1[0] >= r2[0] + r2[2] ) ||
- + ( r1[1] + r1[3] <= r2[1] ) ||
- + ( r1[1] >= r2[1] + r2[3] ))
- + );
- end
- end
- diff --git a/Data/Scripts.rxdata/[107] PField_BerryPlants.rb b/Data/Scripts.rxdata/[107] PField_BerryPlants.rb
- index fd42e0c..5c0cbfd 100644
- --- a/Data/Scripts.rxdata/[107] PField_BerryPlants.rb
- +++ b/Data/Scripts.rxdata/[107] PField_BerryPlants.rb
- @@ -7,7 +7,8 @@ class PokemonTemp
- @berryPlantData=Marshal.load(f)
- }
- end
- - return @berryPlantData[item]
- + return @berryPlantData[item] if @berryPlantData && @berryPlantData[item]!=nil
- + return [3,15,2,5] # Hours/stage, drying/hour, min yield, max yield
- end
- end
- @@ -32,6 +33,9 @@ class BerryPlantMoistureSprite
- @event=event
- @map=map
- @light = IconSprite.new(0,0,viewport)
- + @light.ox=16
- + @light.oy=24
- + @oldmoisture=-1 # -1=none, 0=dry, 1=damp, 2=wet
- updateGraphic
- @disposed=false
- end
- @@ -48,27 +52,30 @@ class BerryPlantMoistureSprite
- end
- def updateGraphic
- - if @event.variable && @event.variable.length>6
- - if @event.variable[1]<=0
- - @light.setBitmap("")
- - elsif @event.variable[4]>50
- - @light.setBitmap("Graphics/Characters/berrytreeWet")
- - elsif @event.variable[4]>0
- - @light.setBitmap("Graphics/Characters/berrytreeDamp")
- - else
- - @light.setBitmap("Graphics/Characters/berrytreeDry")
- - end
- - else
- + case @oldmoisture
- + when -1
- @light.setBitmap("")
- + when 0
- + @light.setBitmap("Graphics/Characters/berrytreeDry")
- + when 1
- + @light.setBitmap("Graphics/Characters/berrytreeDamp")
- + when 2
- + @light.setBitmap("Graphics/Characters/berrytreeWet")
- end
- end
- def update
- return if !@light || !@event
- + newmoisture=-1
- + if @event.variable && @event.variable.length>6 && @event.variable[1]>0
- + # Berry was planted, show moisture patch
- + newmoisture=(@event.variable[4]>50) ? 2 : (@event.variable[4]>0) ? 1 : 0
- + end
- + if @oldmoisture!=newmoisture
- + @oldmoisture=newmoisture
- + updateGraphic
- + end
- @light.update
- - updateGraphic
- - @light.ox=16
- - @light.oy=24
- if (Object.const_defined?(:ScreenPosHelper) rescue false)
- @light.x = ScreenPosHelper.pbScreenX(@event)
- @light.y = ScreenPosHelper.pbScreenY(@event)
- @@ -86,7 +93,6 @@ end
- class BerryPlantSprite
- - DEFAULTBERRYVALUES = [3,15,2,5] # Hours/stage, drying/hour, min yield, max yield
- REPLANTS = 9
- def initialize(event,map,viewport)
- @@ -99,8 +105,8 @@ class BerryPlantSprite
- @oldstage=berryData[0]
- @event.character_name=""
- berryData=updatePlantDetails(berryData)
- - setGraphic(berryData,true) # Set the event's graphic
- - event.setVariable(berryData) # Set new berry data
- + setGraphic(berryData,true) # Set the event's graphic
- + @event.setVariable(berryData) # Set new berry data
- end
- def dispose
- @@ -118,120 +124,118 @@ class BerryPlantSprite
- if berryData
- berryData=updatePlantDetails(berryData) if berryData.length>6
- setGraphic(berryData)
- + @event.setVariable(berryData)
- end
- end
- def updatePlantDetails(berryData)
- + return berryData if berryData[0]==0
- berryvalues=$PokemonTemp.pbGetBerryPlantData(berryData[1])
- - berryvalues=DEFAULTBERRYVALUES if !berryvalues # Default values
- - timeperstage=berryvalues[0]
- + timeperstage=berryvalues[0]*3600
- + timenow=pbGetTimeNow
- if berryData.length>6
- # Gen 4 growth mechanisms
- - if berryData[0]>0
- - dryingrate=berryvalues[1]
- - timeperstage*=3600
- - if hasConst?(PBItems,:GROWTHMULCH) && isConst?(berryData[7],PBItems,:GROWTHMULCH)
- - timeperstage=(timeperstage*0.75).to_i
- - dryingrate=(dryingrate*1.5).ceil
- - elsif hasConst?(PBItems,:DAMPMULCH) && isConst?(berryData[7],PBItems,:DAMPMULCH)
- - timeperstage=(timeperstage*1.25).to_i
- - dryingrate=(dryingrate/2).floor
- + # Check time elapsed since last check
- + timeDiff=(timenow.to_i-berryData[3]) # in seconds
- + return berryData if timeDiff<=0
- + berryData[3]=timenow.to_i # last updated now
- + # Mulch modifiers
- + dryingrate=berryvalues[1]
- + maxreplants=REPLANTS
- + ripestages=4
- + if isConst?(berryData[7],PBItems,:GROWTHMULCH)
- + timeperstage=(timeperstage*0.75).to_i
- + dryingrate=(dryingrate*1.5).ceil
- + elsif isConst?(berryData[7],PBItems,:DAMPMULCH)
- + timeperstage=(timeperstage*1.25).to_i
- + dryingrate=(dryingrate*0.5).floor
- + elsif isConst?(berryData[7],PBItems,:GOOEYMULCH)
- + maxreplants=(maxreplants*1.5).ceil
- + elsif isConst?(berryData[7],PBItems,:STABLEMULCH)
- + ripestages=6
- + end
- + # Cycle through all replants since last check
- + loop do
- + secondsalive=berryData[2]
- + growinglife=(berryData[5]>0) ? 3 : 4 # number of growing stages
- + numlifestages=growinglife+ripestages # number of growing + ripe stages
- + # Should replant itself?
- + if secondsalive+timeDiff>=timeperstage*numlifestages
- + # Should replant
- + if berryData[5]>=maxreplants # Too many replants
- + return [0,0,0,0,0,0,0,0]
- + end
- + # Replant
- + berryData[0]=2 # replants start in sprouting stage
- + berryData[2]=0 # seconds alive
- + berryData[5]+=1 # add to replant count
- + berryData[6]=0 # yield penalty
- + timeDiff-=(timeperstage*numlifestages-secondsalive)
- + else
- + break
- end
- - # Get time elapsed since last check
- - timenow=pbGetTimeNow
- - timeDiff=(timenow.to_i-berryData[3]) # in seconds
- - return berryData if timeDiff<=0
- - berryData[3]=timenow.to_i # last updated now
- - hasreplanted=true
- - while hasreplanted
- - hasreplanted=false
- - secondsalive=berryData[2]
- - # Should replant itself?
- - growinglife=(berryData[5]>0) ? 3 : 4 # number of growing stages
- - numlifestages=growinglife+4 # number of growing + ripe stages
- - numlifestages+=2 if hasConst?(PBItems,:STABLEMULCH) &&
- - isConst?(berryData[7],PBItems,:STABLEMULCH)
- - if secondsalive+timeDiff>=timeperstage*numlifestages
- - # Should replant
- - # Has it been replanted too many times already?
- - replantmult=1
- - replantmult=1.5 if hasConst?(PBItems,:GOOEYMULCH) &&
- - isConst?(berryData[7],PBItems,:GOOEYMULCH)
- - if berryData[5]>=(REPLANTS*replantmult).ceil # Too many replants
- - berryData=nil
- - break
- - end
- - # Replant
- - berryData[0]=2 # replants start in sprouting stage
- - berryData[2]=0 # seconds alive
- - berryData[5]+=1 # add to replant count
- - berryData[6]=0 # yield penalty
- - timeDiff-=(timeperstage*numlifestages-secondsalive)
- - hasreplanted=true
- + end
- + # Update current stage and dampness
- + if berryData[0]>0
- + # Advance growth stage
- + oldlifetime=berryData[2]
- + newlifetime=oldlifetime+timeDiff
- + if berryData[0]<5
- + berryData[0]=1+(newlifetime/timeperstage).floor
- + berryData[0]+=1 if berryData[5]>0 # replants start at stage 2
- + berryData[0]=5 if berryData[0]>5
- + end
- + # Update the "seconds alive" counter
- + berryData[2]=newlifetime
- + # Reduce dampness, apply yield penalty if dry
- + growinglife=(berryData[5]>0) ? 3 : 4 # number of growing stages
- + oldhourtick=(oldlifetime/3600).floor
- + newhourtick=(([newlifetime,timeperstage*growinglife].min)/3600).floor
- + (newhourtick-oldhourtick).times do
- + if berryData[4]>0
- + berryData[4]=[berryData[4]-dryingrate,0].max
- else
- - # Reduce dampness, apply yield penalty if dry
- - oldhourtick=(secondsalive/3600).floor
- - newhourtick=(([secondsalive+timeDiff,timeperstage*growinglife].min)/3600).floor
- - (newhourtick-oldhourtick).times do
- - if berryData[4]>0
- - berryData[4]=[berryData[4]-dryingrate,0].max
- - else
- - berryData[6]+=1
- - end
- - end
- - # Advance growth stage
- - if secondsalive+timeDiff>=timeperstage*growinglife
- - berryData[0]=5
- - else
- - berryData[0]=1+((secondsalive+timeDiff)/timeperstage).floor
- - berryData[0]+=1 if berryData[0]<5 && berryData[5]>0 # replants start at stage 2
- - end
- - # Update the "seconds alive" counter
- - berryData[2]+=timeDiff
- - break
- + berryData[6]+=1
- end
- end
- end
- else
- # Gen 3 growth mechanics
- loop do
- - break if berryData[0]==0
- - levels=0
- if berryData[0]>0 && berryData[0]<5
- + levels=0
- # Advance time
- - timenow=pbGetTimeNow
- timeDiff=(timenow.to_i-berryData[3]) # in seconds
- - if timeDiff>=timeperstage*3600
- - levels+=1
- - end
- - if timeDiff>=timeperstage*2*3600
- - levels+=1
- - end
- - if timeDiff>=timeperstage*3*3600
- - levels+=1
- - end
- - if timeDiff>=timeperstage*4*3600
- + if timeDiff>=timeperstage
- levels+=1
- + if timeDiff>=timeperstage*2
- + levels+=1
- + if timeDiff>=timeperstage*3
- + levels+=1
- + if timeDiff>=timeperstage*4
- + levels+=1
- + end
- + end
- + end
- end
- levels=5-berryData[0] if levels>5-berryData[0]
- break if levels==0
- - berryData[2]=false
- - berryData[3]+=levels*timeperstage*3600
- - berryData[0]+=levels
- + berryData[2]=false # not watered this stage
- + berryData[3]+=levels*timeperstage # add to time existed
- + berryData[0]+=levels # increase growth stage
- berryData[0]=5 if berryData[0]>5
- end
- if berryData[0]>=5
- # Advance time
- - timenow=pbGetTimeNow
- - timeDiff=(timenow.to_i-berryData[3]) # in seconds
- - if timeDiff>=timeperstage*3600*4 # ripe for 4 times as long as a stage
- + timeDiff=(timenow.to_i-berryData[3]) # in seconds
- + if timeDiff>=timeperstage*4 # ripe for 4 times as long as a stage
- # Replant
- - berryData[0]=2 # restarts in sprouting stage
- - berryData[2]=false
- - berryData[3]+=timeperstage*4*3600
- - berryData[4]=0
- + berryData[0]=2 # replants start at stage 2
- + berryData[2]=false # not watered this stage
- + berryData[3]+=timeperstage*4 # add to time existed
- + berryData[4]=0 # reset total waterings count
- berryData[5]+=1 # add to replanted count
- - if berryData[5]>REPLANTS # Too many replants
- + if berryData[5]>REPLANTS # Too many replants
- berryData=[0,0,false,0,0,0]
- break
- end
- @@ -240,6 +244,7 @@ class BerryPlantSprite
- end
- end
- end
- + # Check auto-watering
- if berryData[0]>0 && berryData[0]<5
- # Reset watering
- if $game_screen &&
- @@ -258,29 +263,33 @@ class BerryPlantSprite
- end
- def setGraphic(berryData,fullcheck=false)
- - return if !berryData
- - if berryData[0]==0
- + return if !berryData || (@oldstage==berryData[0] && !fullcheck)
- + case berryData[0]
- + when 0
- @event.character_name=""
- - elsif berryData[0]==1 # X planted
- + when 1
- @event.character_name="berrytreeplanted" # Common to all berries
- @event.turn_down
- - elsif fullcheck || berryData.length>6
- + else
- filename=sprintf("berrytree%s",getConstantName(PBItems,berryData[1])) rescue nil
- filename=sprintf("berrytree%03d",berryData[1]) if !pbResolveBitmap("Graphics/Characters/"+filename)
- if pbResolveBitmap("Graphics/Characters/"+filename)
- @event.character_name=filename
- - @event.turn_down if berryData[0]==2 # X sprouted
- - @event.turn_left if berryData[0]==3 # X taller
- - @event.turn_right if berryData[0]==4 # X flowering
- - @event.turn_up if berryData[0]==5 # X berries
- + case berryData[0]
- + when 2; @event.turn_down # X sprouted
- + when 3; @event.turn_left # X taller
- + when 4; @event.turn_right # X flowering
- + when 5; @event.turn_up # X berries
- + end
- else
- @event.character_name="Object ball"
- end
- - if @oldstage!=berryData[0] && berryData.length>6
- + if @oldstage!=berryData[0] && berryData.length>6 # Gen 4 growth mechanisms
- $scene.spriteset.addUserAnimation(PLANT_SPARKLE_ANIMATION_ID,@event.x,@event.y) if $scene.spriteset
- - @oldstage=berryData[0]
- end
- end
- + @oldstage=berryData[0]
- +p "here",berryData,@oldstage if Input.trigger?(Input::CTRL)
- end
- end
- @@ -290,6 +299,7 @@ def pbBerryPlant
- interp=pbMapInterpreter
- thisEvent=interp.get_character(0)
- berryData=interp.getVariable
- +p berryData if Input.trigger?(Input::CTRL)
- if !berryData
- if NEWBERRYPLANTS
- berryData=[0,0,0,0,0,0,0,0]
- @@ -299,22 +309,18 @@ def pbBerryPlant
- end
- # Stop the event turning towards the player
- case berryData[0]
- - when 1 # X planted
- - thisEvent.turn_down
- - when 2 # X sprouted
- - thisEvent.turn_down
- - when 3 # X taller
- - thisEvent.turn_left
- - when 4 # X flowering
- - thisEvent.turn_right
- - when 5 # X berries
- - thisEvent.turn_up
- + when 1; thisEvent.turn_down # X planted
- + when 2; thisEvent.turn_down # X sprouted
- + when 3; thisEvent.turn_left # X taller
- + when 4; thisEvent.turn_right # X flowering
- + when 5; thisEvent.turn_up # X berries
- end
- watering=[]
- - watering.push(getConst(PBItems,:SPRAYDUCK)) if hasConst?(PBItems,:SPRAYDUCK)
- - watering.push(getConst(PBItems,:SQUIRTBOTTLE)) if hasConst?(PBItems,:SQUIRTBOTTLE)
- - watering.push(getConst(PBItems,:WAILMERPAIL)) if hasConst?(PBItems,:WAILMERPAIL)
- - watering.push(getConst(PBItems,:SPRINKLOTAD)) if hasConst?(PBItems,:SPRINKLOTAD)
- + watering.push(getConst(PBItems,:SPRAYDUCK))
- + watering.push(getConst(PBItems,:SQUIRTBOTTLE))
- + watering.push(getConst(PBItems,:WAILMERPAIL))
- + watering.push(getConst(PBItems,:SPRINKLOTAD))
- + watering.compact!
- berry=berryData[1]
- case berryData[0]
- when 0 # empty
- @@ -333,29 +339,33 @@ def pbBerryPlant
- ret=screen.pbChooseItemScreen
- }
- if ret>0
- - berryData[7]=ret if pbIsMulch?(ret)
- - Kernel.pbMessage(_INTL("The {1} was scattered on the soil.",PBItems.getName(ret)))
- - if Kernel.pbConfirmMessage(_INTL("Want to plant a Berry?"))
- - pbFadeOutIn(99999){
- - scene=PokemonBag_Scene.new
- - screen=PokemonBagScreen.new(scene,$PokemonBag)
- - berry=screen.pbChooseBerryScreen
- - }
- - if berry>0
- - timenow=pbGetTimeNow
- - berryData[0]=1 # growth stage (1-5)
- - berryData[1]=berry # item ID of planted berry
- - berryData[2]=0 # seconds alive
- - berryData[3]=timenow.to_i # time of last checkup (now)
- - berryData[4]=100 # dampness value
- - berryData[5]=0 # number of replants
- - berryData[6]=0 # yield penalty
- - $PokemonBag.pbDeleteItem(berry,1)
- - Kernel.pbMessage(_INTL("The {1} was planted in the soft, earthy soil.",
- - PBItems.getName(berry)))
- + if pbIsMulch?(ret)
- + berryData[7]=ret
- + Kernel.pbMessage(_INTL("The {1} was scattered on the soil.",PBItems.getName(ret)))
- + if Kernel.pbConfirmMessage(_INTL("Want to plant a Berry?"))
- + pbFadeOutIn(99999){
- + scene=PokemonBag_Scene.new
- + screen=PokemonBagScreen.new(scene,$PokemonBag)
- + berry=screen.pbChooseBerryScreen
- + }
- + if berry>0
- + timenow=pbGetTimeNow
- + berryData[0]=1 # growth stage (1-5)
- + berryData[1]=berry # item ID of planted berry
- + berryData[2]=0 # seconds alive
- + berryData[3]=timenow.to_i # time of last checkup (now)
- + berryData[4]=100 # dampness value
- + berryData[5]=0 # number of replants
- + berryData[6]=0 # yield penalty
- + $PokemonBag.pbDeleteItem(berry,1)
- + Kernel.pbMessage(_INTL("The {1} was planted in the soft, earthy soil.",
- + PBItems.getName(berry)))
- + end
- end
- + interp.setVariable(berryData)
- + else
- + Kernel.pbMessage(_INTL("That won't fertilize the soil!"))
- end
- - interp.setVariable(berryData)
- return
- end
- elsif cmd==1 # Plant Berry
- @@ -455,7 +465,6 @@ def pbBerryPlant
- end
- when 5 # X berries
- berryvalues=$PokemonTemp.pbGetBerryPlantData(berryData[1])
- - berryvalues=DEFAULTBERRYVALUES if !berryvalues # Default values
- # Get berry yield (berrycount)
- berrycount=1
- if berryData.length>6
- diff --git a/Data/Scripts.rxdata/[108] PField_DayCare.rb b/Data/Scripts.rxdata/[108] PField_DayCare.rb
- index a7d4ed5..34f39b1 100644
- --- a/Data/Scripts.rxdata/[108] PField_DayCare.rb
- +++ b/Data/Scripts.rxdata/[108] PField_DayCare.rb
- @@ -207,7 +207,7 @@ def pbDayCareGenerateEgg
- if k[0]<=EGGINITIALLEVEL
- moves.push(k[1])
- else
- - othermoves.push(k[1]) if mother.knowsMove?(k[1]) && father.knowsMove?(k[1])
- + othermoves.push(k[1]) if mother.hasMove?(k[1]) && father.hasMove?(k[1])
- end
- end
- # Inheriting Natural Moves
- @@ -221,7 +221,7 @@ def pbDayCareGenerateEgg
- atk=$ItemData[i][ITEMMACHINE]
- next if !atk || atk==0
- if egg.isCompatibleWithMove?(atk)
- - moves.push(atk) if movefather.knowsMove?(atk)
- + moves.push(atk) if movefather.hasMove?(atk)
- end
- end
- end
- @@ -235,7 +235,7 @@ def pbDayCareGenerateEgg
- f.pos=offset
- i=0; loop do break unless i<length
- atk=f.fgetw
- - moves.push(atk) if movefather.knowsMove?(atk)
- + moves.push(atk) if movefather.hasMove?(atk)
- i+=1
- end
- end
- @@ -250,7 +250,7 @@ def pbDayCareGenerateEgg
- f.pos=offset
- i=0; loop do break unless i<length
- atk=f.fgetw
- - moves.push(atk) if movemother.knowsMove?(atk)
- + moves.push(atk) if movemother.hasMove?(atk)
- i+=1
- end
- end
- diff --git a/Data/Scripts.rxdata/[112] PokeBattle_Trainer.rb b/Data/Scripts.rxdata/[112] PokeBattle_Trainer.rb
- index 2158aff..fd33f40 100644
- --- a/Data/Scripts.rxdata/[112] PokeBattle_Trainer.rb
- +++ b/Data/Scripts.rxdata/[112] PokeBattle_Trainer.rb
- @@ -99,7 +99,8 @@ class PokeBattle_Trainer
- end
- def hasSkillCode(code)
- - return true if skillCode[/#{code}/]
- + c=skillCode
- + return true if c!=nil && c!="" && c[/#{code}/]
- return false
- end
- @@ -115,7 +116,7 @@ class PokeBattle_Trainer
- ret=2 # 2 = gender unknown
- pbRgssOpen("Data/trainertypes.dat","rb"){|f|
- trainertypes=Marshal.load(f)
- - if !trainertypes[trainertype]
- + if !trainertypes || !trainertypes[trainertype]
- ret=2
- else
- ret=trainertypes[trainertype][7]
- diff --git a/Data/Scripts.rxdata/[113] PTrainer_NPCTrainers.rb b/Data/Scripts.rxdata/[113] PTrainer_NPCTrainers.rb
- index 56dde88..a143881 100644
- --- a/Data/Scripts.rxdata/[113] PTrainer_NPCTrainers.rb
- +++ b/Data/Scripts.rxdata/[113] PTrainer_NPCTrainers.rb
- @@ -205,7 +205,7 @@ def pbMissingTrainer(trainerid, trainername, trainerparty)
- traineridstring="#{trainerid}"
- traineridstring=getConstantName(PBTrainers,trainerid) rescue "-"
- if $DEBUG
- - message=""
- + message=""
- if trainerparty!=0
- message=(_INTL("Add new trainer ({1}, {2}, ID {3})?",traineridstring,trainername,trainerparty))
- else
- diff --git a/Data/Scripts.rxdata/[115] PItem_Items.rb b/Data/Scripts.rxdata/[115] PItem_Items.rb
- index 8aefc54..d15d691 100644
- --- a/Data/Scripts.rxdata/[115] PItem_Items.rb
- +++ b/Data/Scripts.rxdata/[115] PItem_Items.rb
- @@ -580,6 +580,8 @@ def pbConsumeItemInBattle(bag,item)
- end
- end
- +# Only called when in the party screen and having chosen an item to be used on
- +# the selected Pokémon
- def pbUseItemOnPokemon(item,pokemon,scene)
- if $ItemData[item][ITEMUSE]==3 || $ItemData[item][ITEMUSE]==4 # TM or HM
- machine=$ItemData[item][ITEMMACHINE]
- @@ -608,6 +610,8 @@ def pbUseItemOnPokemon(item,pokemon,scene)
- return false
- else
- ret=ItemHandlers.triggerUseOnPokemon(item,pokemon,scene)
- + scene.pbClearAnnotations
- + scene.pbHardRefresh
- if ret && $ItemData[item][ITEMUSE]==1 # Usable on Pokémon, consumed
- $PokemonBag.pbDeleteItem(item)
- end
- @@ -714,7 +718,7 @@ def pbUseItem(bag,item,bagscene=nil)
- end
- end
- -def Kernel.pbChooseItem(var=0)
- +def Kernel.pbChooseItem(var=0,*args)
- ret=0
- scene=PokemonBag_Scene.new
- screen=PokemonBagScreen.new(scene,$PokemonBag)
- diff --git a/Data/Scripts.rxdata/[116] PItem_ItemEffects.rb b/Data/Scripts.rxdata/[116] PItem_ItemEffects.rb
- index f3640bf..d9d03f8 100644
- --- a/Data/Scripts.rxdata/[116] PItem_ItemEffects.rb
- +++ b/Data/Scripts.rxdata/[116] PItem_ItemEffects.rb
- @@ -293,8 +293,10 @@ ItemHandlers::UseOnPokemon.add(:FIRESTONE,proc{|item,pokemon,scene|
- evo.pbStartScreen(pokemon,newspecies)
- evo.pbEvolution(false)
- evo.pbEndScreen
- - scene.pbRefreshAnnotations(proc{|p| pbCheckEvolution(p,item)>0 })
- - scene.pbRefresh
- + if scene.is_a?(PokemonBag_Scene)
- + scene.pbRefreshAnnotations(proc{|p| pbCheckEvolution(p,item)>0 })
- + scene.pbRefresh
- + end
- }
- next true
- end
- diff --git a/Data/Scripts.rxdata/[122] PokeBattle_Pokemon.rb b/Data/Scripts.rxdata/[122] PokeBattle_Pokemon.rb
- index 291e450..a5a1b80 100644
- --- a/Data/Scripts.rxdata/[122] PokeBattle_Pokemon.rb
- +++ b/Data/Scripts.rxdata/[122] PokeBattle_Pokemon.rb
- @@ -134,7 +134,9 @@ class PokeBattle_Pokemon
- def isEgg?
- return @eggsteps>0
- end
- -
- +
- + def egg?; return isEgg?; end
- +
- # Returns this Pokemon's growth rate.
- def growthrate
- dexdata=pbOpenDexData
- @@ -245,6 +247,19 @@ class PokeBattle_Pokemon
- return ret1
- end
- +# Returns whether this Pokémon has a particular ability.
- + def hasAbility?(value=0)
- + if value==0
- + return self.ability>0
- + else
- + if value.is_a?(String) || value.is_a?(Symbol)
- + value=getID(PBAbilities,value)
- + end
- + return self.ability==value
- + end
- + return false
- + end
- +
- # Sets this Pokémon's ability to a particular ability (if possible).
- def setAbility(value)
- @abilityflag=value
- @@ -284,6 +299,19 @@ class PokeBattle_Pokemon
- return @personalID%25
- end
- +# Returns whether this Pokémon has a particular nature.
- + def hasNature?(value=-1)
- + if value<0
- + return self.nature>=0
- + else
- + if value.is_a?(String) || value.is_a?(Symbol)
- + value=getID(PBNatures,value)
- + end
- + return self.nature==value
- + end
- + return false
- + end
- +
- # Sets this Pokémon's nature to a particular nature.
- def setNature(value)
- if value.is_a?(String) || value.is_a?(Symbol)
- @@ -395,7 +423,7 @@ class PokeBattle_Pokemon
- end
- # Returns true if the Pokémon knows the given move.
- - def knowsMove?(move)
- + def hasMove?(move)
- if move.is_a?(String) || move.is_a?(Symbol)
- move=getID(PBMoves,move)
- end
- @@ -406,6 +434,8 @@ class PokeBattle_Pokemon
- return false
- end
- + def knowsMove?(move); return self.hasMove?(move); end
- +
- # Returns the list of moves this Pokémon can learn by levelling up.
- def getMoveList
- movelist=[]
- @@ -943,6 +973,10 @@ class PokeBattle_Pokemon
- @moves[j]=PBMove.new(moveid)
- j+=1
- end
- + else
- + for i in 0...4
- + @moves[i]=PBMove.new(0)
- + end
- end
- end
- end
- \ No newline at end of file
- diff --git a/Data/Scripts.rxdata/[123] Pokemon_MultipleForms.rb b/Data/Scripts.rxdata/[123] Pokemon_MultipleForms.rb
- index c593c50..95bedf7 100644
- --- a/Data/Scripts.rxdata/[123] Pokemon_MultipleForms.rb
- +++ b/Data/Scripts.rxdata/[123] Pokemon_MultipleForms.rb
- @@ -13,9 +13,9 @@ class PokeBattle_Pokemon
- def form=(value)
- @form=value
- + MultipleForms.call("onSetForm",self,value)
- self.calcStats
- pbSeenForm(self)
- - MultipleForms.call("onSetForm",self,value)
- end
- def formNoCall=(value)
- @@ -694,8 +694,7 @@ MultipleForms.register(:DARMANITAN,{
- MultipleForms.register(:DEERLING,{
- "getForm"=>proc{|pokemon|
- - time=pbGetTimeNow
- - next (time.month-1)%4
- + next pbGetSeason
- }
- })
- @@ -778,10 +777,8 @@ MultipleForms.register(:KYUREM,{
- },
- "getAbilityList"=>proc{|pokemon|
- case pokemon.form
- - when 1; next [[getID(PBAbilities,:PRESSURE),0],
- - [getID(PBAbilities,:TURBOBLAZE),2]] # White Kyurem
- - when 2; next [[getID(PBAbilities,:PRESSURE),0],
- - [getID(PBAbilities,:TERAVOLT),2]] # Black Kyurem
- + when 1; next [[getID(PBAbilities,:TURBOBLAZE),0]] # White Kyurem
- + when 2; next [[getID(PBAbilities,:TERAVOLT),0]] # Black Kyurem
- else; next # Kyurem
- end
- },
- @@ -816,8 +813,8 @@ MultipleForms.register(:KYUREM,{
- MultipleForms.register(:KELDEO,{
- "getForm"=>proc{|pokemon|
- - next 1 if pokemon.knowsMove?(:SECRETSWORD) # Resolute Form
- - next 0 # Ordinary Form
- + next 1 if pokemon.hasMove?(:SECRETSWORD) # Resolute Form
- + next 0 # Ordinary Form
- }
- })
- @@ -864,9 +861,7 @@ MultipleForms.copy(:FLABEBE,:FLOETTE,:FLORGES)
- MultipleForms.register(:FURFROU,{
- "getForm"=>proc{|pokemon|
- - timenow=pbGetTimeNow
- - if pokemon.form>0 && (!pokemon.formTime ||
- - timenow.to_i>pokemon.formTime.to_i+60*60*24*5) # 5 days
- + if !pokemon.formTime || pbGetTimeNow.to_i>pokemon.formTime.to_i+60*60*24*5 # 5 days
- next 0
- end
- next
- @@ -969,9 +964,7 @@ MultipleForms.register(:XERNEAS,{
- MultipleForms.register(:HOOPA,{
- "getForm"=>proc{|pokemon|
- - timenow=pbGetTimeNow
- - if pokemon.form>0 && (!pokemon.formTime ||
- - timenow.to_i>pokemon.formTime.to_i+60*60*24*3) # 3 days
- + if !pokemon.formTime || pbGetTimeNow.to_i>pokemon.formTime.to_i+60*60*24*3 # 3 days
- next 0
- end
- next
- diff --git a/Data/Scripts.rxdata/[124] Pokemon_MegaEvolution.rb b/Data/Scripts.rxdata/[124] Pokemon_MegaEvolution.rb
- index 2c4eb4e..dc7612a 100644
- --- a/Data/Scripts.rxdata/[124] Pokemon_MegaEvolution.rb
- +++ b/Data/Scripts.rxdata/[124] Pokemon_MegaEvolution.rb
- @@ -22,7 +22,7 @@ class PokeBattle_Pokemon
- def makeUnmega
- v=MultipleForms.call("getUnmegaForm",self)
- - self.form=(v!=nil) ? v : 0
- + self.form=v if v!=nil
- end
- def megaName
- @@ -52,7 +52,7 @@ class PokeBattle_Pokemon
- def makeUnprimal
- v=MultipleForms.call("getUnprimalForm",self)
- - self.form=(v!=nil) ? v : 0
- + self.form=v if v!=nil
- end
- end
- @@ -974,7 +974,7 @@ MultipleForms.register(:LATIOS,{
- MultipleForms.register(:RAYQUAZA,{
- "getMegaForm"=>proc{|pokemon|
- - next 1 if pokemon.knowsMove?(:DRAGONASCENT)
- + next 1 if pokemon.hasMove?(:DRAGONASCENT)
- next
- },
- "megaMessage"=>proc{|pokemon|
- diff --git a/Data/Scripts.rxdata/[125] Pokemon_ShadowPokemon.rb b/Data/Scripts.rxdata/[125] Pokemon_ShadowPokemon.rb
- index c5bf673..1afd3a8 100644
- --- a/Data/Scripts.rxdata/[125] Pokemon_ShadowPokemon.rb
- +++ b/Data/Scripts.rxdata/[125] Pokemon_ShadowPokemon.rb
- @@ -734,19 +734,18 @@ end
- # User takes recoil damage equal to 1/2 of its current HP. (Shadow End)
- ################################################################################
- class PokeBattle_Move_130 < PokeBattle_Move
- - def isRecoilMove?
- - return true
- - end
- -
- def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
- ret=super(attacker,opponent,hitnum,alltargets,showanimation)
- - if opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute
- - attacker.pbReduceHP([1,((attacker.hp+1)/2).floor].max)
- - @battle.pbDisplay(_INTL("{1} is damaged by the recoil!",attacker.pbThis))
- - end
- attacker.pbHyperMode if ret>=0
- return ret
- end
- +
- + def pbEffectAfterHit(attacker,opponent,turneffects)
- + if !attacker.isFainted? && turneffects[PBEffects::TotalDamage]>0
- + attacker.pbReduceHP((attacker.hp/2.0).round)
- + @battle.pbDisplay(_INTL("{1} is damaged by recoil!",attacker.pbThis))
- + end
- + end
- end
- diff --git a/Data/Scripts.rxdata/[128] Pokemon_Sprites.rb b/Data/Scripts.rxdata/[128] Pokemon_Sprites.rb
- index 24ed6c6..2451050 100644
- --- a/Data/Scripts.rxdata/[128] Pokemon_Sprites.rb
- +++ b/Data/Scripts.rxdata/[128] Pokemon_Sprites.rb
- @@ -43,7 +43,7 @@ class PokemonSprite < SpriteWrapper
- def setSpeciesBitmap(species,female=false,form=0,shiny=false,shadow=false,back=false,egg=false)
- @_iconbitmap.dispose if @_iconbitmap
- - @_iconbitmap=species>0 ? pbLoadSpeciesBitmap(species,female,form,shiny,shadow,back,egg) : nil
- + @_iconbitmap=pbLoadSpeciesBitmap(species,female,form,shiny,shadow,back,egg)
- self.bitmap=@_iconbitmap ? @_iconbitmap.bitmap : nil
- end
- end
- diff --git a/Data/Scripts.rxdata/[133] PScreen_Party.rb b/Data/Scripts.rxdata/[133] PScreen_Party.rb
- index f816d9b..4fd5a9d 100644
- --- a/Data/Scripts.rxdata/[133] PScreen_Party.rb
- +++ b/Data/Scripts.rxdata/[133] PScreen_Party.rb
- @@ -777,6 +777,8 @@ class PokemonScreen_Scene
- for i in 0...6
- if annot
- @sprites["pokemon#{i}"].text=annot[i]
- + else
- + @sprites["pokemon#{i}"].text=nil
- end
- end
- end
- @@ -1178,6 +1180,10 @@ class PokemonScreen
- @scene.pbAnnotate(annot)
- end
- + def pbClearAnnotations
- + @scene.pbAnnotate(nil)
- + end
- +
- def pbPokemonDebug(pkmn,pkmnid)
- command=0
- loop do
- @@ -1812,34 +1818,34 @@ class PokemonScreen
- break if pkmnid<0
- pkmn=@party[pkmnid]
- - commands=[]
- - cmdSummary=-1
- - cmdDebug=-1
- - cmdMoves=[-1,-1,-1,-1]
- - cmdSwitch=-1
- - cmdMail=-1
- - cmdItem=-1
- + commands = []
- + cmdSummary = -1
- + cmdDebug = -1
- + cmdMoves = [-1,-1,-1,-1]
- + cmdSwitch = -1
- + cmdMail = -1
- + cmdItem = -1
- # Build the commands
- - commands[cmdSummary=commands.length]=_INTL("Summary")
- - commands[cmdDebug=commands.length]=_INTL("Debug") if $DEBUG
- + commands[cmdSummary=commands.length] = _INTL("Summary")
- + commands[cmdDebug=commands.length] = _INTL("Debug") if $DEBUG
- for i in 0...pkmn.moves.length
- move=pkmn.moves[i]
- # Check for hidden moves and add any that were found
- if !pkmn.isEgg? && (isConst?(move.id,PBMoves,:MILKDRINK) ||
- isConst?(move.id,PBMoves,:SOFTBOILED) ||
- HiddenMoveHandlers.hasHandler(move.id))
- - commands[cmdMoves[i]=commands.length]=PBMoves.getName(move.id)
- + commands[cmdMoves[i]=commands.length] = PBMoves.getName(move.id)
- end
- end
- - commands[cmdSwitch=commands.length]=_INTL("Switch") if @party.length>1
- + commands[cmdSwitch=commands.length] = _INTL("Switch") if @party.length>1
- if !pkmn.isEgg?
- if pkmn.mail
- - commands[cmdMail=commands.length]=_INTL("Mail")
- + commands[cmdMail=commands.length] = _INTL("Mail")
- else
- - commands[cmdItem=commands.length]=_INTL("Item")
- + commands[cmdItem=commands.length] = _INTL("Item")
- end
- end
- - commands[commands.length]=_INTL("Cancel")
- + commands[commands.length] = _INTL("Cancel")
- havecommand=false
- for i in 0...4
- @@ -1847,7 +1853,8 @@ class PokemonScreen
- havecommand=true
- if isConst?(pkmn.moves[i].id,PBMoves,:SOFTBOILED) ||
- isConst?(pkmn.moves[i].id,PBMoves,:MILKDRINK)
- - if pkmn.hp<=(pkmn.totalhp/5).floor
- + amt=[(pkmn.totalhp/5).floor,1].max
- + if pkmn.hp<=amt
- pbDisplay(_INTL("Not enough HP..."))
- break
- end
- @@ -1865,12 +1872,12 @@ class PokemonScreen
- elsif newpkmn.hp==0 || newpkmn.hp==newpkmn.totalhp
- pbDisplay(_INTL("{1} can't be used on that Pokémon.",PBMoves.getName(pkmn.moves[i].id)))
- else
- - pkmn.hp-=(pkmn.totalhp/5).floor
- - hpgain=pbItemRestoreHP(newpkmn,(pkmn.totalhp/5).floor)
- + pkmn.hp-=amt
- + hpgain=pbItemRestoreHP(newpkmn,amt)
- @scene.pbDisplay(_INTL("{1}'s HP was restored by {2} points.",newpkmn.name,hpgain))
- pbRefresh
- end
- - break if pkmn.hp<=(pkmn.totalhp/5).floor
- + break if pkmn.hp<=amt
- end
- break
- elsif Kernel.pbCanUseHiddenMove?(pkmn,pkmn.moves[i].id)
- @@ -1918,17 +1925,17 @@ class PokemonScreen
- pbRefreshSingle(pkmnid)
- end
- elsif cmdItem>=0 && command==cmdItem
- - itemcommands=[]
- - cmdUseItem=-1
- - cmdGiveItem=-1
- - cmdTakeItem=-1
- - cmdMoveItem=-1
- + itemcommands = []
- + cmdUseItem = -1
- + cmdGiveItem = -1
- + cmdTakeItem = -1
- + cmdMoveItem = -1
- # Build the commands
- - itemcommands[cmdUseItem=itemcommands.length]=_INTL("Use")
- - itemcommands[cmdGiveItem=itemcommands.length]=_INTL("Give")
- - itemcommands[cmdTakeItem=itemcommands.length]=_INTL("Take") if pkmn.hasItem?
- - itemcommands[cmdMoveItem=itemcommands.length]=_INTL("Move") if pkmn.hasItem? && !pbIsMail?(pkmn.item)
- - itemcommands[itemcommands.length]=_INTL("Cancel")
- + itemcommands[cmdUseItem=itemcommands.length] = _INTL("Use")
- + itemcommands[cmdGiveItem=itemcommands.length] = _INTL("Give")
- + itemcommands[cmdTakeItem=itemcommands.length] = _INTL("Take") if pkmn.hasItem?
- + itemcommands[cmdMoveItem=itemcommands.length] = _INTL("Move") if pkmn.hasItem? && !pbIsMail?(pkmn.item)
- + itemcommands[itemcommands.length] = _INTL("Cancel")
- if cmdUseItem>=0 && command==cmdUseItem # Use
- diff --git a/Data/Scripts.rxdata/[135] PScreen_Bag.rb b/Data/Scripts.rxdata/[135] PScreen_Bag.rb
- index 042e161..e3f90cf 100644
- --- a/Data/Scripts.rxdata/[135] PScreen_Bag.rb
- +++ b/Data/Scripts.rxdata/[135] PScreen_Bag.rb
- @@ -234,7 +234,7 @@ class PokemonBag_Scene
- end
- # Called when the item screen wants an item to be chosen from the screen
- - def pbChooseItem
- + def pbChooseItem(lockpocket=false)
- pbRefresh
- @sprites["helpwindow"].visible=false
- itemwindow=@sprites["itemwindow"]
- @@ -264,19 +264,21 @@ class PokemonBag_Scene
- # Update selected item for current pocket
- @bag.setChoice(itemwindow.pocket,itemwindow.index)
- end
- - # Change pockets if Left/Right pressed
- - numpockets=PokemonBag.numPockets
- - if Input.trigger?(Input::LEFT)
- - if !sorting
- - itemwindow.pocket=(itemwindow.pocket==1) ? numpockets : itemwindow.pocket-1
- - @bag.lastpocket=itemwindow.pocket
- - pbRefresh
- - end
- - elsif Input.trigger?(Input::RIGHT)
- - if !sorting
- - itemwindow.pocket=(itemwindow.pocket==numpockets) ? 1 : itemwindow.pocket+1
- - @bag.lastpocket=itemwindow.pocket
- - pbRefresh
- + if !lockpocket
- + # Change pockets if Left/Right pressed
- + numpockets=PokemonBag.numPockets
- + if Input.trigger?(Input::LEFT)
- + if !sorting
- + itemwindow.pocket=(itemwindow.pocket==1) ? numpockets : itemwindow.pocket-1
- + @bag.lastpocket=itemwindow.pocket
- + pbRefresh
- + end
- + elsif Input.trigger?(Input::RIGHT)
- + if !sorting
- + itemwindow.pocket=(itemwindow.pocket==numpockets) ? 1 : itemwindow.pocket+1
- + @bag.lastpocket=itemwindow.pocket
- + pbRefresh
- + end
- end
- end
- # Select item for switching if A is pressed
- @@ -398,7 +400,7 @@ class PokemonBagScreen
- @scene.pbStartScene(@bag)
- item=0
- loop do
- + [email protected](true)
- break if item==0
- itemname=PBItems.getName(item)
- if !pbIsBerry?(item)
- @@ -544,12 +546,12 @@ class PokemonBagScreen
- loop do
- break if item==0
- - cmdUse=-1
- - cmdRegister=-1
- - cmdGive=-1
- - cmdToss=-1
- - cmdRead=-1
- - cmdMysteryGift=-1
- + cmdUse = -1
- + cmdRegister = -1
- + cmdGive = -1
- + cmdToss = -1
- + cmdRead = -1
- + cmdMysteryGift = -1
- commands=[]
- # Generate command list
- commands[cmdRead=commands.length]=_INTL("Read") if pbIsMail?(item)
- diff --git a/Data/Scripts.rxdata/[141] PScreen_Load.rb b/Data/Scripts.rxdata/[141] PScreen_Load.rb
- index 4870976..513fee0 100644
- --- a/Data/Scripts.rxdata/[141] PScreen_Load.rb
- +++ b/Data/Scripts.rxdata/[141] PScreen_Load.rb
- @@ -322,6 +322,7 @@ class PokemonLoad
- @scene.pbStartScene(commands,showContinue,trainer,framecount,mapid)
- @scene.pbSetParty(trainer) if showContinue
- @scene.pbStartScene2
- + $ItemData = readItemList("Data/items.dat")
- loop do
- if cmdContinue>=0 && command==cmdContinue
- @@ -347,7 +348,6 @@ class PokemonLoad
- $game_player = Marshal.load(f)
- $PokemonGlobal = Marshal.load(f)
- metadata = Marshal.load(f)
- - $ItemData = readItemList("Data/items.dat")
- $PokemonBag = Marshal.load(f)
- $PokemonStorage = Marshal.load(f)
- magicNumberMatches=false
- @@ -415,7 +415,6 @@ class PokemonLoad
- $game_self_switches = Game_SelfSwitches.new
- $game_screen = Game_Screen.new
- $game_player = Game_Player.new
- - $ItemData = readItemList("Data/items.dat")
- $PokemonMap = PokemonMapMetadata.new
- $PokemonGlobal = PokemonGlobalMetadata.new
- $PokemonStorage = PokemonStorage.new
- diff --git a/Data/Scripts.rxdata/[143] PScreen_Options.rb b/Data/Scripts.rxdata/[143] PScreen_Options.rb
- index 5c28817..3566fbb 100644
- --- a/Data/Scripts.rxdata/[143] PScreen_Options.rb
- +++ b/Data/Scripts.rxdata/[143] PScreen_Options.rb
- @@ -484,8 +484,10 @@ class PokemonOptionScene
- EnumOption.new(_INTL("Running Key"),[_INTL("Hold"),_INTL("Toggle")],
- proc { $PokemonSystem.runstyle },
- proc {|value|
- - $PokemonSystem.runstyle=value
- - $PokemonGlobal.runtoggle=false if $PokemonGlobal
- + if $PokemonSystem.runstyle!=value
- + $PokemonSystem.runstyle=value
- + $PokemonGlobal.runtoggle=false if $PokemonGlobal
- + end
- }
- ),
- NumberOption.new(_INTL("Speech Frame"),1,$SpeechFrames.length,
- diff --git a/Data/Scripts.rxdata/[144] PScreen_Storage.rb b/Data/Scripts.rxdata/[144] PScreen_Storage.rb
- index 6dbe68f..e94b1bc 100644
- --- a/Data/Scripts.rxdata/[144] PScreen_Storage.rb
- +++ b/Data/Scripts.rxdata/[144] PScreen_Storage.rb
- @@ -699,62 +699,50 @@ class PokemonStorageScreen
- pbBoxCommands
- else
- pokemon=@storage[selected[0],selected[1]]
- - commands=[
- - _INTL("Move"),
- - _INTL("Summary"),
- - _INTL("Withdraw"),
- - _INTL("Item"),
- - _INTL("Mark"),
- - _INTL("Release")
- - ]
- - commands.push(_INTL("Debug")) if $DEBUG
- - commands.push(_INTL("Cancel"))
- heldpoke=pbHeldPokemon
- + next if !pokemon && !heldpoke
- + commands = []
- + cmdMove = -1
- + cmdSummary = -1
- + cmdWithdraw = -1
- + cmdItem = -1
- + cmdMark = -1
- + cmdRelease = -1
- + cmdDebug = -1
- + cmdCancel = -1
- if heldpoke
- helptext=_INTL("{1} is selected.",heldpoke.name)
- - commands[0]=pokemon ? _INTL("Shift") : _INTL("Place")
- + commands[cmdMove=commands.length] = (pokemon) ? _INTL("Shift") : _INTL("Place")
- elsif pokemon
- helptext=_INTL("{1} is selected.",pokemon.name)
- - commands[0]=_INTL("Move")
- - else
- - next
- - end
- - if selected[0]==-1
- - commands[2]=_INTL("Store")
- - else
- - commands[2]=_INTL("Withdraw")
- + commands[cmdMove=commands.length] = _INTL("Move")
- end
- + commands[cmdSummary=commands.length] = _INTL("Summary")
- + commands[cmdWithdraw=commands.length] = (selected[0]==-1) ? _INTL("Store") : _INTL("Withdraw")
- + commands[cmdItem=commands.length] = _INTL("Item")
- + commands[cmdMark=commands.length] = _INTL("Mark")
- + commands[cmdRelease=commands.length] = _INTL("Release")
- + commands[cmdDebug=commands.length] = _INTL("Debug") if $DEBUG
- + commands[cmdCancel=commands.length] = _INTL("Cancel")
- command=pbShowCommands(helptext,commands)
- - case command
- - when 0 # Move/Shift/Place
- - if @heldpkmn && pokemon
- - pbSwap(selected)
- - elsif @heldpkmn
- - pbPlace(selected)
- + if cmdMove>=0 && command==cmdMove # Move/Shift/Place
- + if @heldpkmn
- + (pokemon) ? pbSwap(selected) : pbPlace(selected)
- else
- pbHold(selected)
- end
- - when 1 # Summary
- + elsif cmdSummary>=0 && command==cmdSummary # Summary
- pbSummary(selected,@heldpkmn)
- - when 2 # Withdraw
- - if selected[0]==-1
- - pbStore(selected,@heldpkmn)
- - else
- - pbWithdraw(selected,@heldpkmn)
- - end
- - when 3 # Item
- + elsif cmdWithdraw>=0 && command==cmdWithdraw # Withdraw/Store
- + (selected[0]==-1) ? pbStore(selected,@heldpkmn) : pbWithdraw(selected,@heldpkmn)
- + elsif cmdItem>=0 && command==cmdItem # Item
- pbItem(selected,@heldpkmn)
- - when 4 # Mark
- + elsif cmdMark>=0 && command==cmdMark # Mark
- pbMark(selected,@heldpkmn)
- - when 5 # Release
- + elsif cmdRelease>=0 && command==cmdRelease # Release
- pbRelease(selected,@heldpkmn)
- - when 6
- - if $DEBUG
- - pkmn=@heldpkmn ? @heldpkmn : pokemon
- - debugMenu(selected,pkmn,heldpoke)
- - else
- - next
- - end
- + elsif cmdDebug>=0 && command==cmdDebug # Debug
- + debugMenu(selected,(@heldpkmn) ? @heldpkmn : pokemon,heldpoke)
- end
- end
- end
- @@ -2335,29 +2323,29 @@ class PokemonStorageScene
- else
- textstrings.push([_INTL("No item"),85,342,2,nonbase,nonshadow])
- end
- + if pokemon.isShiny?
- + imagepos=[(["Graphics/Pictures/shiny",156,198,0,0,-1,-1])]
- + pbDrawImagePositions(overlay,imagepos)
- + end
- + typebitmap=AnimatedBitmap.new(_INTL("Graphics/Pictures/types"))
- + type1rect=Rect.new(0,pokemon.type1*28,64,28)
- + type2rect=Rect.new(0,pokemon.type2*28,64,28)
- + if pokemon.type1==pokemon.type2
- + overlay.blt(52,272,typebitmap.bitmap,type1rect)
- + else
- + overlay.blt(18,272,typebitmap.bitmap,type1rect)
- + overlay.blt(88,272,typebitmap.bitmap,type2rect)
- + end
- + drawMarkings(overlay,66,240,128,20,pokemon.markings)
- end
- pbSetSystemFont(overlay)
- pbDrawTextPositions(overlay,textstrings)
- - textstrings.clear
- if !pokemon.isEgg?
- + textstrings.clear
- textstrings.push([_INTL("Lv."),10,238,false,base,shadow])
- + pbSetSmallFont(overlay)
- + pbDrawTextPositions(overlay,textstrings)
- end
- - pbSetSmallFont(overlay)
- - pbDrawTextPositions(overlay,textstrings)
- - if pokemon.isShiny?
- - imagepos=[(["Graphics/Pictures/shiny",156,198,0,0,-1,-1])]
- - pbDrawImagePositions(overlay,imagepos)
- - end
- - typebitmap=AnimatedBitmap.new(_INTL("Graphics/Pictures/types"))
- - type1rect=Rect.new(0,pokemon.type1*28,64,28)
- - type2rect=Rect.new(0,pokemon.type2*28,64,28)
- - if pokemon.type1==pokemon.type2
- - overlay.blt(52,272,typebitmap.bitmap,type1rect)
- - else
- - overlay.blt(18,272,typebitmap.bitmap,type1rect)
- - overlay.blt(88,272,typebitmap.bitmap,type2rect)
- - end
- - drawMarkings(overlay,66,240,128,20,pokemon.markings)
- @sprites["pokemon"].setPokemonBitmap(pokemon)
- pbPositionPokemonSprite(@sprites["pokemon"],26,70)
- end
- diff --git a/Data/Scripts.rxdata/[147] PScreen_MoveRelearner.rb b/Data/Scripts.rxdata/[147] PScreen_MoveRelearner.rb
- index 8510c96..9d5381d 100644
- --- a/Data/Scripts.rxdata/[147] PScreen_MoveRelearner.rb
- +++ b/Data/Scripts.rxdata/[147] PScreen_MoveRelearner.rb
- @@ -13,14 +13,14 @@ def pbGetRelearnableMoves(pokemon)
- return [] if !pokemon || pokemon.isEgg? || (pokemon.isShadow? rescue false)
- moves=[]
- pbEachNaturalMove(pokemon){|move,level|
- - if level<=pokemon.level && !pokemon.knowsMove?(move)
- + if level<=pokemon.level && !pokemon.hasMove?(move)
- moves.push(move) if !moves.include?(move)
- end
- }
- tmoves=[]
- if pokemon.firstmoves
- for i in pokemon.firstmoves
- - tmoves.push(i) if !pokemon.knowsMove?(i) && !moves.include?(i)
- + tmoves.push(i) if !pokemon.hasMove?(i) && !moves.include?(i)
- end
- end
- moves=tmoves+moves
- diff --git a/Data/Scripts.rxdata/[148] PScreen_PurifyChamber.rb b/Data/Scripts.rxdata/[148] PScreen_PurifyChamber.rb
- index c30a85b..1e04adb 100644
- --- a/Data/Scripts.rxdata/[148] PScreen_PurifyChamber.rb
- +++ b/Data/Scripts.rxdata/[148] PScreen_PurifyChamber.rb
- @@ -7,7 +7,7 @@ class PurifyChamberSet
- end
- def length
- - return @list.length
- + return @list.length
- end
- def initialize
- @@ -16,15 +16,15 @@ class PurifyChamberSet
- end
- def facing=(value)
- - if value>=0 && value<@list.length
- - @facing=value
- - end
- + if value>=0 && value<@list.length
- + @facing=value
- + end
- end
- def shadow=(value)
- - if value==nil || value.isShadow?
- - @shadow=value
- - end
- + if value==nil || value.isShadow?
- + @shadow=value
- + end
- end
- =begin
- @@ -33,15 +33,15 @@ Boosted if center has advantage over facing Pokemon
- Boosted based on number of best circles
- =end
- def flow
- - ret=0
- - return 0 if !@shadow
- - for i in [email protected]
- - ret+=(PurifyChamberSet.isSuperEffective(@list[i],@list[(i+1)%@list.length])) ? 1 : 0
- - end
- - if @list[@facing]
- - ret+=PurifyChamberSet.isSuperEffective(@shadow,@list[@facing]) ? 1 : 0
- - end
- - return [ret+(@list.length/2),4].min
- + ret=0
- + return 0 if !@shadow
- + for i in [email protected]
- + ret+=(PurifyChamberSet.isSuperEffective(@list[i],@list[(i+1)%@list.length])) ? 1 : 0
- + end
- + if @list[@facing]
- + ret+=PurifyChamberSet.isSuperEffective(@shadow,@list[@facing]) ? 1 : 0
- + end
- + return [ret+(@list.length/2),4].min
- end
- def shadowAffinity
- @@ -57,19 +57,19 @@ Boosted based on number of best circles
- # Tempo refers to the type advantages of each Pokemon in a certain set in a
- # clockwise direction. Tempo also depends on the number of Pokemon in the set
- def tempo
- - ret=0
- - for i in [email protected]
- - ret+=(PurifyChamberSet.isSuperEffective(@list[i],@list[(i+1)%@list.length])) ? 1 : 0
- - end
- - return partialSum(@list.length)+ret
- + ret=0
- + for i in [email protected]
- + ret+=(PurifyChamberSet.isSuperEffective(@list[i],@list[(i+1)%@list.length])) ? 1 : 0
- + end
- + return partialSum(@list.length)+ret
- end
- def list
- - return @list.clone
- + return @list.clone
- end
- def [](index)
- - return @list[index]
- + return @list[index]
- end
- def insertAfter(index,value)
- @@ -239,9 +239,9 @@ class PurifyChamber # German: der Kryptorbis
- species=getID(PBSpecies,species)
- pkmn=PseudoPokemon.new(shadow,type1,type2||type1)
- if pkmn.isShadow?
- - self.setShadow(set,pkmn)
- + self.setShadow(set,pkmn)
- else
- - self.insertAfter(set,setCount(set),pkmn)
- + self.insertAfter(set,setCount(set),pkmn)
- end
- end
- end
- @@ -256,7 +256,7 @@ class PokemonGlobalMetadata
- if !@purifyChamber
- @purifyChamber=PurifyChamber.new()
- end
- - return @purifyChamber
- + return @purifyChamber
- end
- end
- @@ -341,13 +341,13 @@ module PurifyChamberHelper
- def self.adjustOnInsert(position)
- if position>0
- - position-=1
- - oldpos=position/2
- - if position%2==0
- + position-=1
- + oldpos=position/2
- + if position%2==0
- return position+1
- - else
- - return ((oldpos+1)*2)+1
- - end
- + else
- + return ((oldpos+1)*2)+1
- + end
- end
- return position
- end
- @@ -363,7 +363,7 @@ module PurifyChamberHelper
- chamber.insertAfter(chamber.currentSet,position/2,value)
- end
- end
- - end
- + end
- end
- @@ -395,8 +395,8 @@ class PurifyChamberScreen
- @scene.pbShift(position,pkmn)
- else
- @scene.pbPlace(position,pkmn)
- - end
- - PurifyChamberHelper.pbSetPokemon(@chamber,position,pkmn)
- + end
- + PurifyChamberHelper.pbSetPokemon(@chamber,position,pkmn)
- @scene.pbRefresh()
- else
- @scene.pbDisplay(_INTL("Only a Shadow Pokémon can go there."))
- @@ -409,8 +409,8 @@ class PurifyChamberScreen
- @scene.pbShift(position,pkmn)
- else
- @scene.pbPlace(position,pkmn)
- - end
- - PurifyChamberHelper.pbSetPokemon(@chamber,position,pkmn)
- + end
- + PurifyChamberHelper.pbSetPokemon(@chamber,position,pkmn)
- @scene.pbRefresh()
- else
- @scene.pbDisplay(_INTL("Can't place a Shadow Pokémon there."))
- @@ -470,7 +470,7 @@ class PurifyChamberScreen
- if !heldpkmn && curpkmn
- commands[cmdReplace=commands.length]=_INTL("REPLACE")
- end
- - commands.push(_INTL("CANCEL"))
- + commands.push(_INTL("CANCEL"))
- _INTL("What shall I do with this {1}?",
- heldpkmn ? heldpkmn.name : curpkmn.name),commands)
- @@ -479,7 +479,7 @@ class PurifyChamberScreen
- if pbPlace(heldpkmn,cmd[1]) # calls place or shift as appropriate
- if !curpkmn
- pbOnPlace(heldpkmn)
- - @scene.pbPositionHint(PurifyChamberHelper.adjustOnInsert(cmd[1]))
- + @scene.pbPositionHint(PurifyChamberHelper.adjustOnInsert(cmd[1]))
- heldpkmn=nil # Pokemon was placed
- else
- heldpkmn=curpkmn # Pokemon was shifted
- @@ -501,7 +501,7 @@ class PurifyChamberScreen
- $PokemonStorage.pbStoreCaught(heldpkmn)
- heldpkmn=nil
- @scene.pbRefresh()
- - else
- + else
- # Store and delete Pokemon.
- @scene.pbWithdraw(cmd[1],heldpkmn)
- $PokemonStorage.pbStoreCaught(curpkmn)
- @@ -527,7 +527,7 @@ class PurifyChamberScreen
- @scene.pbReplace(cmd,pos)
- PurifyChamberHelper.pbSetPokemon(@chamber,cmd[1],newpkmn)
- $PokemonStorage[pos[0],pos[1]]=curpkmn
- - @scene.pbRefresh()
- + @scene.pbRefresh()
- pbOnPlace(curpkmn)
- end
- end
- @@ -538,7 +538,7 @@ class PurifyChamberScreen
- if pbPlacePokemon(pos,cmd[1])
- curpkmn=PurifyChamberHelper.pbGetPokemon(@chamber,cmd[1])
- pbOnPlace(curpkmn)
- - @scene.pbPositionHint(PurifyChamberHelper.adjustOnInsert(cmd[1]))
- + @scene.pbPositionHint(PurifyChamberHelper.adjustOnInsert(cmd[1]))
- end
- end
- elsif cmd[0]==1 # Change the active set
- @@ -920,7 +920,7 @@ class PurifyChamberSetView < SpriteWrapper
- if @chamber.setCount(@set)==PurifyChamber::SETSIZE
- points=[points/2,1].max
- pos/=2
- - end
- + end
- seg=pos*8/points
- if seg==7 || seg==0
- pos-=1 if button==Input::LEFT
- @@ -967,30 +967,30 @@ class PurifyChamberSetView < SpriteWrapper
- pbSetSmallFont(@info.bitmap)
- textpos=[]
- if pkmn
- - if pkmn.type1==pkmn.type2
- + if pkmn.type1==pkmn.type2
- textpos.push([_INTL("{1} Lv{2} {3}",pkmn.name,pkmn.level,PBTypes.getName(pkmn.type1)),2,0,0,
- - Color.new(248,248,248),Color.new(128,128,128)])
- + Color.new(248,248,248),Color.new(128,128,128)])
- else
- textpos.push([_INTL("{1} Lv{2} {3}/{4}",pkmn.name,pkmn.level,PBTypes.getName(pkmn.type1),
- - PBTypes.getName(pkmn.type2)),2,0,0,
- - Color.new(248,248,248),Color.new(128,128,128)])
- + PBTypes.getName(pkmn.type2)),2,0,0,
- + Color.new(248,248,248),Color.new(128,128,128)])
- end
- - Color.new(248,248,248),Color.new(128,128,128)])
- - # draw heart gauge
- - pbDrawGauge(@info.bitmap,Rect.new(@info.bitmap.width*3/4,8,@info.bitmap.width*1/4,8),
- - Color.new(192,0,256),pkmn.heartgauge,
- + Color.new(248,248,248),Color.new(128,128,128)])
- + # draw heart gauge
- + pbDrawGauge(@info.bitmap,Rect.new(@info.bitmap.width*3/4,8,@info.bitmap.width*1/4,8),
- + Color.new(192,0,256),pkmn.heartgauge,
- PokeBattle_Pokemon::HEARTGAUGESIZE)
- - # draw flow gauge
- + # draw flow gauge
- pbDrawGauge(@info.bitmap,Rect.new(@info.bitmap.width*3/4,24+8,@info.bitmap.width*1/4,8),
- - Color.new(0,0,248),@chamber.chamberFlow(@set),6)
- + Color.new(0,0,248),@chamber.chamberFlow(@set),6)
- end
- if @chamber.setCount(@set)>0
- textpos.push([_INTL("TEMPO"),2,24,0,
- - Color.new(248,248,248),Color.new(128,128,128)])
- + Color.new(248,248,248),Color.new(128,128,128)])
- # draw tempo gauge
- pbDrawGauge(@info.bitmap,Rect.new(@info.bitmap.width*1/4,24+8,@info.bitmap.width*1/4,8),
- - Color.new(0,0,248),@chamber[@set].tempo,
- + Color.new(0,0,248),@chamber[@set].tempo,
- PurifyChamber.maximumTempo())
- end
- pbDrawTextPositions(@info.bitmap,textpos)
- diff --git a/Data/Scripts.rxdata/[150] PScreen_MysteryGift.rb b/Data/Scripts.rxdata/[150] PScreen_MysteryGift.rb
- index 8594636..b69c795 100644
- --- a/Data/Scripts.rxdata/[150] PScreen_MysteryGift.rb
- +++ b/Data/Scripts.rxdata/[150] PScreen_MysteryGift.rb
- @@ -50,9 +50,9 @@ def pbEditMysteryGift(type,item,id=0,giftname="")
- item.obtainText=obtainname
- break
- end
- - return nil if Kernel.pbConfirmMessage(_INTL("Stop editng this gift?"))
- + return nil if Kernel.pbConfirmMessage(_INTL("Stop editing this gift?"))
- elsif command==-1
- - return nil if Kernel.pbConfirmMessage(_INTL("Stop editng this gift?"))
- + return nil if Kernel.pbConfirmMessage(_INTL("Stop editing this gift?"))
- end
- end
- elsif type>0 # Item
- @@ -63,7 +63,7 @@ def pbEditMysteryGift(type,item,id=0,giftname="")
- loop do
- newtype=Kernel.pbMessageChooseNumber(_INTL("Choose a quantity."),params)
- if newtype==0
- - return nil if Kernel.pbConfirmMessage(_INTL("Stop editng this gift?"))
- + return nil if Kernel.pbConfirmMessage(_INTL("Stop editing this gift?"))
- else
- type=newtype
- break
- @@ -84,7 +84,7 @@ def pbEditMysteryGift(type,item,id=0,giftname="")
- loop do
- newid=Kernel.pbMessageChooseNumber(_INTL("Choose a unique ID for this gift."),params)
- if newid==0
- - return nil if Kernel.pbConfirmMessage(_INTL("Stop editng this gift?"))
- + return nil if Kernel.pbConfirmMessage(_INTL("Stop editing this gift?"))
- else
- if idlist.include?(newid)
- Kernel.pbMessage(_INTL("That ID is already used by a Mystery Gift."))
- @@ -101,7 +101,7 @@ def pbEditMysteryGift(type,item,id=0,giftname="")
- giftname=newgiftname
- break
- end
- - return nil if Kernel.pbConfirmMessage(_INTL("Stop editng this gift?"))
- + return nil if Kernel.pbConfirmMessage(_INTL("Stop editing this gift?"))
- end
- return [id,type,item,giftname]
- rescue
- diff --git a/Data/Scripts.rxdata/[155] PBattle_OrgBattle.rb b/Data/Scripts.rxdata/[155] PBattle_OrgBattle.rb
- index 34282c3..779c752 100644
- --- a/Data/Scripts.rxdata/[155] PBattle_OrgBattle.rb
- +++ b/Data/Scripts.rxdata/[155] PBattle_OrgBattle.rb
- @@ -186,7 +186,7 @@ class PBPokemon
- def convertMove(move)
- if isConst?(move,PBMoves,:RETURN) && hasConst?(PBMoves,:FRUSTRATION)
- - move=getConst(PBMoves,:FRUSTRATION)
- + move=getConst(PBMoves,:FRUSTRATION)
- end
- return move
- end
- @@ -899,8 +899,8 @@ def pbBattleFactoryPokemon(rule,numwins,numswaps,rentals)
- if (table[i*4+1]<0 || table[i*4+1]>=numwins)
- pokemonNumbers=[
- table[i*4+2]*btpokemon.length/882,
- - table[i*4+3]*btpokemon.length/882
- - ]
- + table[i*4+3]*btpokemon.length/882
- + ]
- end
- end
- end
- diff --git a/Data/Scripts.rxdata/[156] PBattle_OrgBattleRules.rb b/Data/Scripts.rxdata/[156] PBattle_OrgBattleRules.rb
- index 3aec8b8..4c3bb62 100644
- --- a/Data/Scripts.rxdata/[156] PBattle_OrgBattleRules.rb
- +++ b/Data/Scripts.rxdata/[156] PBattle_OrgBattleRules.rb
- @@ -622,8 +622,8 @@ class LittleCupRestriction
- def isValid?(pokemon)
- return false if isConst?(pokemon.item,PBItems,:BERRYJUICE)
- return false if isConst?(pokemon.item,PBItems,:DEEPSEATOOTH)
- - return false if pokemon.knowsMove?(:SONICBOOM)
- - return false if pokemon.knowsMove?(:DRAGONRAGE)
- + return false if pokemon.hasMove?(:SONICBOOM)
- + return false if pokemon.hasMove?(:DRAGONRAGE)
- return false if isConst?(pokemon.species,PBSpecies,:SCYTHER)
- return false if isConst?(pokemon.species,PBSpecies,:SNEASEL)
- return false if isConst?(pokemon.species,PBSpecies,:MEDITITE)
- diff --git a/Data/Scripts.rxdata/[157] PBattle_OrgBattleGenerator.rb b/Data/Scripts.rxdata/[157] PBattle_OrgBattleGenerator.rb
- index 46c8a28..00097c8 100644
- --- a/Data/Scripts.rxdata/[157] PBattle_OrgBattleGenerator.rb
- +++ b/Data/Scripts.rxdata/[157] PBattle_OrgBattleGenerator.rb
- @@ -121,31 +121,31 @@ def pbGetLegalMoves2(species,maxlevel)
- end
- # Delete less powerful moves
- deleteAll=proc{|a,item|
- - while a.include?(item)
- - a.delete(item)
- - end
- + while a.include?(item)
- + a.delete(item)
- + end
- }
- for move in moves
- md=moveData(move)
- for move2 in movedatas
- if md.function==0xA5 && move2[1].function==0 && md.type==move2[1].type &&
- md.basedamage>=move2[1].basedamage
- - deleteAll.call(moves,move2[0])
- + deleteAll.call(moves,move2[0])
- elsif md.function==move2[1].function && md.basedamage==0 &&
- md.accuracy>move2[1].accuracy
- # Supersonic vs. Confuse Ray, etc.
- deleteAll.call(moves,move2[0])
- elsif md.function==0x06 && move2[1].function==0x05
- - deleteAll.call(moves,move2[0])
- + deleteAll.call(moves,move2[0])
- elsif md.function==move2[1].function && md.basedamage!=0 &&
- - md.type==move2[1].type &&
- - (md.totalpp==15 || md.totalpp==10 || md.totalpp==move2[1].totalpp) &&
- - (md.basedamage>move2[1].basedamage ||
- - (md.basedamage==move2[1].basedamage && md.accuracy>move2[1].accuracy))
- - # Surf, Flamethrower, Thunderbolt, etc.
- - deleteAll.call(moves,move2[0])
- - end
- - end
- + md.type==move2[1].type &&
- + (md.totalpp==15 || md.totalpp==10 || md.totalpp==move2[1].totalpp) &&
- + (md.basedamage>move2[1].basedamage ||
- + (md.basedamage==move2[1].basedamage && md.accuracy>move2[1].accuracy))
- + # Surf, Flamethrower, Thunderbolt, etc.
- + deleteAll.call(moves,move2[0])
- + end
- + end
- end
- return moves
- end
- @@ -920,13 +920,12 @@ def pbDecideWinnerEffectiveness(move,otype1,otype2,ability,scores)
- return 0 if data.basedamage==0
- atype=data.type
- typemod=4
- - if isConst?(ability,PBAbilities,:LEVITATE) &&
- - isConst?(data.type,PBTypes,:GROUND)
- + if isConst?(ability,PBAbilities,:LEVITATE) && isConst?(data.type,PBTypes,:GROUND)
- typemod=4
- else
- mod1=PBTypes.getEffectiveness(atype,otype1)
- mod2=(otype1==otype2) ? 2 : PBTypes.getEffectiveness(atype,otype2)
- - if(isConst?(ability,PBAbilities,:WONDERGUARD))
- + if isConst?(ability,PBAbilities,:WONDERGUARD)
- mod1=2 if mod1!=4
- mod2=2 if mod2!=4
- end
- @@ -968,16 +967,16 @@ def pbDecideWinnerScore(party0,party1,rating)
- end
- def pbDecideWinner(party0,party1,rating0,rating1)
- - rating0=(rating0*15.0/100).round
- - rating1=(rating1*15.0/100).round
- - score0=pbDecideWinnerScore(party0,party1,rating0)
- - score1=pbDecideWinnerScore(party1,party0,rating1)
- - if score0==score1
- - return 5 if rating0==rating1
- - return (rating0>rating1) ? 1 : 2
- - else
- - return (score0>score1) ? 1 : 2
- - end
- + rating0=(rating0*15.0/100).round
- + rating1=(rating1*15.0/100).round
- + score0=pbDecideWinnerScore(party0,party1,rating0)
- + score1=pbDecideWinnerScore(party1,party0,rating1)
- + if score0==score1
- + return 5 if rating0==rating1
- + return (rating0>rating1) ? 1 : 2
- + else
- + return (score0>score1) ? 1 : 2
- + end
- end
- def pbRuledBattle(team1,team2,rule)
- @@ -1073,7 +1072,7 @@ def pbTrainerInfo(pokemonlist,trfile,rules)
- gender=(!trainertypes[trainerid] ||
- !trainertypes[trainerid][7]) ? 2 : trainertypes[trainerid][7]
- randomName=getRandomNameEx(gender,nil,0,12)
- - tr=[trainerid,randomName,_INTL("Here I come!"),
- + tr=[trainerid,randomName,_INTL("Here I come!"),
- _INTL("Yes, I won!"),_INTL("Man, I lost!"),[]]
- bttrainers.push(tr)
- end
- @@ -1178,11 +1177,11 @@ def pbTrainerInfo(pokemonlist,trfile,rules)
- end
- break if numbers.length>=6 && rules.ruleset.hasValidTeam?(numbersPokemon)
- end
- - if numbers.length<6 || !rules.ruleset.hasValidTeam?(numbersPokemon)
- + if numbers.length<6 || !rules.ruleset.hasValidTeam?(numbersPokemon)
- while numbers.length<pokemonlist.length &&
- (numbers.length<6 || !rules.ruleset.hasValidTeam?(numbersPokemon))
- index=rand(pokemonlist.length)
- - if !numbers.include?(index)
- + if !numbers.include?(index)
- numbers.push(index)
- numbersPokemon.push(pokemonlist[index])
- end
- diff --git a/Data/Scripts.rxdata/[160] PMinigame_Duel.rb b/Data/Scripts.rxdata/[160] PMinigame_Duel.rb
- index 2e033af..14f53c2 100644
- --- a/Data/Scripts.rxdata/[160] PMinigame_Duel.rb
- +++ b/Data/Scripts.rxdata/[160] PMinigame_Duel.rb
- @@ -72,12 +72,10 @@ class PokemonDuel
- @oldeventspeed=event.move_speed
- pbMoveRoute($game_player,[
- PBMoveRoute::ChangeSpeed,2,
- - PBMoveRoute::DirectionFixOn
- - ])
- + PBMoveRoute::DirectionFixOn])
- pbMoveRoute(event,[
- PBMoveRoute::ChangeSpeed,2,
- - PBMoveRoute::DirectionFixOn
- - ])
- + PBMoveRoute::DirectionFixOn])
- pbWait(30)
- end
- @@ -124,12 +122,10 @@ class PokemonDuel
- pbWait(30)
- pbMoveRoute($game_player,[
- PBMoveRoute::DirectionFixOff,
- - PBMoveRoute::ChangeSpeed,@oldmovespeed
- - ])
- + PBMoveRoute::ChangeSpeed,@oldmovespeed])
- pbMoveRoute(@event,[
- PBMoveRoute::DirectionFixOff,
- - PBMoveRoute::ChangeSpeed,@oldeventspeed
- - ])
- + PBMoveRoute::ChangeSpeed,@oldeventspeed])
- 16.times do
- @sprites["player"].opacity-=16
- @sprites["opponent"].opacity-=16
- @@ -200,28 +196,24 @@ class PokemonDuel
- PBMoveRoute::ScriptAsync,"moveRight90",
- PBMoveRoute::ScriptAsync,"moveLeft90",
- PBMoveRoute::ScriptAsync,"moveLeft90",
- - PBMoveRoute::ScriptAsync,"moveRight90"
- - ])
- + PBMoveRoute::ScriptAsync,"moveRight90"])
- pbMoveRoute(event,[
- PBMoveRoute::ScriptAsync,"moveLeft90",
- PBMoveRoute::ScriptAsync,"moveRight90",
- PBMoveRoute::ScriptAsync,"moveRight90",
- - PBMoveRoute::ScriptAsync,"moveLeft90"
- - ])
- + PBMoveRoute::ScriptAsync,"moveLeft90"])
- pbWait(10*2)
- Kernel.pbMessage(_INTL("You study each other's movements..."))
- elsif action==0 && command==1
- pbMoveRoute($game_player,[
- PBMoveRoute::ChangeSpeed,4,
- - PBMoveRoute::Forward
- - ])
- + PBMoveRoute::Forward])
- pbWait(8*2)
- pbShake(9,9,8)
- pbFlashScreens(false,true)
- pbMoveRoute($game_player,[
- PBMoveRoute::ChangeSpeed,2,
- - PBMoveRoute::Backward
- - ])
- + PBMoveRoute::Backward])
- @hp[1]-=1
- Kernel.pbMessage(_INTL("Your attack was not blocked!"))
- elsif action==0 && command==2
- @@ -241,8 +233,8 @@ class PokemonDuel
- Kernel.pbMessage(_INTL("Your attack was evaded!"))
- elsif (action==0 || action==1 || action==2) && command==3
- pbMoveRoute($game_player,[
- - PBMoveRoute::ChangeSpeed,4,
- - PBMoveRoute::ScriptAsync,"jumpForward"])
- + PBMoveRoute::ChangeSpeed,4,
- + PBMoveRoute::ScriptAsync,"jumpForward"])
- pbWait(8*2)
- pbMoveRoute(event,[
- PBMoveRoute::ChangeSpeed,5,
- @@ -262,15 +254,13 @@ class PokemonDuel
- elsif action==1 && command==0
- pbMoveRoute(event,[
- PBMoveRoute::ChangeSpeed,4,
- - PBMoveRoute::Forward
- - ])
- + PBMoveRoute::Forward])
- pbWait(8*2)
- pbShake(9,9,8)
- pbFlashScreens(true,false)
- pbMoveRoute(event,[
- PBMoveRoute::ChangeSpeed,2,
- - PBMoveRoute::Backward
- - ])
- + PBMoveRoute::Backward])
- @hp[0]-=1
- Kernel.pbMessage(_INTL("You fail to block the opponent's attack!"))
- elsif action==1 && command==1
- @@ -357,24 +347,20 @@ class PokemonDuel
- pbMoveRoute($game_player,[PBMoveRoute::Backward])
- pbMoveRoute($game_player,[
- PBMoveRoute::ChangeSpeed,4,
- - PBMoveRoute::ScriptAsync,"jumpForward"
- - ])
- + PBMoveRoute::ScriptAsync,"jumpForward"])
- pbMoveRoute(event,[
- PBMoveRoute::Wait,15,
- PBMoveRoute::ChangeSpeed,4,
- - PBMoveRoute::ScriptAsync,"jumpForward"
- - ])
- + PBMoveRoute::ScriptAsync,"jumpForward"])
- pbWait(20*2)
- pbMoveRoute(event,[
- PBMoveRoute::ChangeSpeed,5,
- PBMoveRoute::Backward,
- - PBMoveRoute::ChangeSpeed,2
- - ])
- + PBMoveRoute::ChangeSpeed,2])
- pbMoveRoute($game_player,[
- PBMoveRoute::ChangeSpeed,5,
- PBMoveRoute::Backward,
- - PBMoveRoute::ChangeSpeed,2
- - ])
- + PBMoveRoute::ChangeSpeed,2])
- pbShake(9,9,8)
- pbFlash(Color.new(255,255,255,255),20)
- pbFlashScreens(true,true)
- diff --git a/Data/Scripts.rxdata/[161] PMinigame_TripleTriad.rb b/Data/Scripts.rxdata/[161] PMinigame_TripleTriad.rb
- index ced70b6..8bed697 100644
- --- a/Data/Scripts.rxdata/[161] PMinigame_TripleTriad.rb
- +++ b/Data/Scripts.rxdata/[161] PMinigame_TripleTriad.rb
- @@ -37,10 +37,11 @@ class TriadCard
- def bonus(opponent)
- atype=@type
- otype=opponent.type
- - mod=PBTypes.getEffectiveness(atype,otype)
- - return -2 if mod==0
- - return -1 if mod==1
- - return 1 if mod==4
- + case PBTypes.getEffectiveness(atype,otype)
- + when 0; return -2
- + when 1; return -1
- + when 4; return 1
- + end
- return 0
- end
- diff --git a/Data/Scripts.rxdata/[170] PSystem_Utilities.rb b/Data/Scripts.rxdata/[170] PSystem_Utilities.rb
- index e2bc992..a020edd 100644
- --- a/Data/Scripts.rxdata/[170] PSystem_Utilities.rb
- +++ b/Data/Scripts.rxdata/[170] PSystem_Utilities.rb
- @@ -1987,10 +1987,11 @@ def pbBalancedLevel(party)
- mean/=weightSum
- # Round to nearest number
- mean=mean.round
- + # Adjust level to minimum
- + mean=1 if mean<1
- # Add 2 to the mean to challenge the player
- mean+=2
- - # Adjust level to minimum and maximum
- - mean=1 if mean<1
- + # Adjust level to maximum
- mean=PBExperience::MAXLEVEL if mean>PBExperience::MAXLEVEL
- return mean
- end
- @@ -2131,8 +2132,7 @@ def pbChoosePokemonForTrade(variableNumber,nameVarNumber,wanted)
- if wanted.is_a?(String) || wanted.is_a?(Symbol)
- wanted=getID(PBSpecies,wanted)
- end
- - return !poke.isEgg? && !(poke.isShadow? rescue false) &&
- - isConst?(poke.species,PBSpecies,wanted)
- + return !poke.isEgg? && !(poke.isShadow? rescue false) && poke.species==wanted
- })
- end
- diff --git a/Data/Scripts.rxdata/[175] Editor.rb b/Data/Scripts.rxdata/[175] Editor.rb
- index 9e97c20..8ab4a8f 100644
- --- a/Data/Scripts.rxdata/[175] Editor.rb
- +++ b/Data/Scripts.rxdata/[175] Editor.rb
- @@ -19,10 +19,10 @@ module MakeshiftConsts
- def self.get(c,i,modname=nil)
- if !@@consts[c]
- - @@consts[c]=[]
- + @@consts[c]=[]
- end
- if @@consts[c][i]
- - return @@consts[c][i]
- + return @@consts[c][i]
- end
- if modname
- v=getConstantName(modname,i) rescue nil
- @@ -44,7 +44,7 @@ module MakeshiftConsts
- trconst="T_"+trconst
- end
- while @@consts[c].include?(trconst)
- - trconst=sprintf("%s_%03d",trconst,i)
- + trconst=sprintf("%s_%03d",trconst,i)
- end
- @@consts[c][i]=trconst
- return trconst
- @@ -140,7 +140,9 @@ def pbSavePokemonData
- kind=messages.get(MessageTypes::Kinds,i)
- entry=messages.get(MessageTypes::Entries,i)
- formnames=messages.get(MessageTypes::FormNames,i)
- - pbDexDataOffset(dexdata,i,6)
- + pbDexDataOffset(dexdata,i,2)
- + ability1=dexdata.fgetw
- + ability2=dexdata.fgetw
- color=dexdata.fgetb
- habitat=dexdata.fgetb
- type1=dexdata.fgetb
- @@ -159,19 +161,17 @@ def pbSavePokemonData
- for j in 0...6
- effort.push(dexdata.fgetb)
- end
- - ability1=dexdata.fgetb
- - ability2=dexdata.fgetb
- + pbDexDataOffset(dexdata,i,31)
- compat1=dexdata.fgetb
- compat2=dexdata.fgetb
- height=dexdata.fgetw
- weight=dexdata.fgetw
- pbDexDataOffset(dexdata,i,38)
- baseexp=dexdata.fgetw
- - hiddenability1=dexdata.fgetb
- - hiddenability2=dexdata.fgetb
- - hiddenability3=dexdata.fgetb
- - hiddenability4=dexdata.fgetb
- - pbDexDataOffset(dexdata,i,48)
- + hiddenability1=dexdata.fgetw
- + hiddenability2=dexdata.fgetw
- + hiddenability3=dexdata.fgetw
- + hiddenability4=dexdata.fgetw
- item1=dexdata.fgetw
- item2=dexdata.fgetw
- item3=dexdata.fgetw
- @@ -185,14 +185,24 @@ def pbSavePokemonData
- pokedata.write("Type2=#{ctype2}\r\n")
- end
- pokedata.write("BaseStats=#{basestats[0]},#{basestats[1]},#{basestats[2]},#{basestats[3]},#{basestats[4]},#{basestats[5]}\r\n")
- - pokedata.write("GenderRate=AlwaysMale\r\n") if gender==0
- - pokedata.write("GenderRate=FemaleOneEighth\r\n") if gender==31
- - pokedata.write("GenderRate=Female25Percent\r\n") if gender==63
- - pokedata.write("GenderRate=Female50Percent\r\n") if gender==127
- - pokedata.write("GenderRate=Female75Percent\r\n") if gender==191
- - pokedata.write("GenderRate=FemaleSevenEighths\r\n") if gender==223
- - pokedata.write("GenderRate=AlwaysFemale\r\n") if gender==254
- - pokedata.write("GenderRate=Genderless\r\n") if gender==255
- + case gender
- + when 0
- + pokedata.write("GenderRate=AlwaysMale\r\n")
- + when 31
- + pokedata.write("GenderRate=FemaleOneEighth\r\n")
- + when 63
- + pokedata.write("GenderRate=Female25Percent\r\n")
- + when 127
- + pokedata.write("GenderRate=Female50Percent\r\n")
- + when 191
- + pokedata.write("GenderRate=Female75Percent\r\n")
- + when 223
- + pokedata.write("GenderRate=FemaleSevenEighths\r\n")
- + when 254
- + pokedata.write("GenderRate=AlwaysFemale\r\n")
- + when 255
- + pokedata.write("GenderRate=Genderless\r\n")
- + end
- pokedata.write("GrowthRate=" + ["Medium","Erratic","Fluctuating","Parabolic","Fast","Slow"][growthrate]+"\r\n")
- pokedata.write("BaseEXP=#{baseexp}\r\n")
- pokedata.write("EffortPoints=#{effort[0]},#{effort[1]},#{effort[2]},#{effort[3]},#{effort[4]},#{effort[5]}\r\n")
- @@ -449,11 +459,11 @@ def pbSaveItems
- if data[ITEMMACHINE]>0
- machine=getConstantName(PBMoves,data[ITEMMACHINE]) rescue pbGetMoveConst(data[ITEMMACHINE]) rescue ""
- end
- - f.write(sprintf("%d,%s,%s,%d,%d,%s,%d,%d,%d,%s\r\n",
- + f.write(sprintf("%d,%s,%s,%s,%d,%d,%s,%d,%d,%d,%s\r\n",
- data[ITEMID],csvquote(cname),csvquote(data[ITEMNAME]),
- - data[ITEMPOCKET],data[ITEMPRICE],csvquote(data[ITEMDESC]),
- - data[ITEMUSE],data[ITEMBATTLEUSE],data[ITEMTYPE],
- - csvquote(machine)
- + csvquote(data[ITEMPLURAL]),data[ITEMPOCKET],data[ITEMPRICE],
- + csvquote(data[ITEMDESC]),data[ITEMUSE],data[ITEMBATTLEUSE],
- + data[ITEMTYPE],csvquote(machine)
- ))
- end
- }
- diff --git a/Data/Scripts.rxdata/[176] Compiler.rb b/Data/Scripts.rxdata/[176] Compiler.rb
- index 08a529c..e8c5fa4 100644
- --- a/Data/Scripts.rxdata/[176] Compiler.rb
- +++ b/Data/Scripts.rxdata/[176] Compiler.rb
- @@ -113,7 +113,11 @@ module FileLineData
- def self.linereport
- if @section
- - return _INTL("File {1}, section {2}, key {3}\r\n{4}\r\n",@file,@section,@key,@value)
- + if @key!=nil
- + return _INTL("File {1}, section {2}, key {3}\r\n{4}\r\n",@file,@section,@key,@value)
- + else
- + return _INTL("File {1}, section {2}\r\n{3}\r\n",@file,@section,@value)
- + end
- else
- return _INTL("File {1}, line {2}\r\n{3}\r\n",@file,@lineno,@linedata)
- end
- @@ -180,9 +184,11 @@ def pbEachFileSectionEx(f)
- lastsection={}
- else
- if sectionname==nil
- + FileLineData.setLine(line,lineno)
- raise _INTL("Expected a section at the beginning of the file. This error may also occur if the file was not saved in UTF-8.\r\n{1}",FileLineData.linereport)
- end
- if !line[/^\s*(\w+)\s*=\s*(.*)$/]
- + FileLineData.setSection(sectionname,nil,line)
- raise _INTL("Bad line syntax (expected syntax like XXX=YYY)\r\n{1}",FileLineData.linereport)
- end
- r1=$~[1]
- @@ -2103,10 +2109,11 @@ def pbExtractTrainers
- rescue
- next
- end
- - f.write(sprintf("%d,%s,%s,%d,%s,%s,%s,%s\r\n",
- + f.write(sprintf("%d,%s,%s,%d,%s,%s,%s,%s,%d,%s\r\n",
- record[0],csvquote(cnst),csvquote(record[2]),
- record[3],csvquote(record[4]),csvquote(record[5]),csvquote(record[6]),
- - record[7] ? ["Male","Female","Mixed"][record[7]] : "Mixed"
- + record[7] ? ["Male","Female","Mixed"][record[7]] : "Mixed",
- + record[8],record[9]
- ))
- end
- }
- @@ -2119,7 +2126,7 @@ def pbCompileTrainers
- count=0
- maxValue=0
- pbCompilerEachPreppedLine("PBS/trainertypes.txt"){|line,lineno|
- - record=pbGetCsvRecord(line,lineno,[0,"unsUSSSeUs", # ID can be 0
- + record=pbGetCsvRecord(line,lineno,[0,"unsUSSSeUS", # ID can be 0
- nil,nil,nil,nil,nil,nil,nil,{
- ""=>2,"Male"=>0,"M"=>0,"0"=>0,"Female"=>1,"F"=>1,"1"=>1,"Mixed"=>2,"X"=>2,"2"=>2
- },nil,nil]
- @@ -2132,12 +2139,11 @@ def pbCompileTrainers
- raise _INTL("Bad skill value (must be from 0 through 255)\r\n{1}",FileLineData.linereport)
- end
- record[8]=record[3] if !record[8]
- - record[9]="" if !record[9]
- - trainernames[record[0]]=record[2]
- if records[record[0]]
- raise _INTL("Two trainer types ({1} and {2}) have the same ID ({3}), which is not allowed.\r\n{4}",
- records[record[0]][1],record[1],record[0],FileLineData.linereport)
- end
- + trainernames[record[0]]=record[2]
- records[record[0]]=record
- maxValue=[maxValue,record[0]].max
- }
- @@ -2148,9 +2154,9 @@ def pbCompileTrainers
- next if !rec
- code+="#{rec[1]}=#{rec[0]}\r\n"
- end
- - code+="\r\ndef PBTrainers.getName(id)\r\nreturn pbGetMessage(MessageTypes::TrainerTypes,id)\r\nend"
- - code+="\r\ndef PBTrainers.getCount\r\nreturn #{count}\r\nend"
- - code+="\r\ndef PBTrainers.maxValue\r\nreturn #{maxValue}\r\nend\r\nend"
- + code+="\r\ndef self.getName(id)\r\nreturn pbGetMessage(MessageTypes::TrainerTypes,id)\r\nend"
- + code+="\r\ndef self.getCount\r\nreturn #{count}\r\nend"
- + code+="\r\ndef self.maxValue\r\nreturn #{maxValue}\r\nend\r\nend"
- eval(code)
- pbAddScript(code,"PBTrainers")
- File.open("Data/trainertypes.dat","wb"){|f|
- @@ -2468,6 +2474,7 @@ def pbCompileTrainerLists
- MessageTypes.setMessagesAsHash(MessageTypes::EndSpeechWin,[])
- MessageTypes.setMessagesAsHash(MessageTypes::EndSpeechLose,[])
- File.open("PBS/trainerlists.txt","rb"){|f|
- + FileLineData.file="PBS/trainerlists.txt"
- pbEachFileSectionEx(f){|section,name|
- next if name!="DefaultTrainerList" && name!="TrainerList"
- rsection=[]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement