Minor bugfiixes (#140)

* Fixed moves bounced back by Magic Coat/Bounced moves affecting Pokemon they normally shouldn't
* Fixed townmap compiler not saving any map names (doesn't make a difference; added for completionism)
* Update a few ruby utilities
* Fixed small typo bug in map renderer disposal
This commit is contained in:
Golisopod-User
2021-12-20 02:28:28 +05:30
committed by GitHub
parent 65b1a8d6c3
commit 7f86db6da9
4 changed files with 23 additions and 21 deletions

View File

@@ -26,22 +26,11 @@ class String
return ['a', 'e', 'i', 'o', 'u'].include?(self[0, 1].downcase) return ['a', 'e', 'i', 'o', 'u'].include?(self[0, 1].downcase)
end end
def first(n = 1) def first(n = 1); return self[0...n]; end
return self[0...n]
end
def last(n = 1) def last(n = 1); return self[-n..-1] || self; end
return self[-n..-1] || self
end
def blank? def blank?; return self.strip.empty?; end
blank = true
s = self.scan(/./)
for l in s
blank = false if l != ""
end
return blank
end
def cut(bitmap, width) def cut(bitmap, width)
string = self string = self

View File

@@ -64,16 +64,14 @@ class Spriteset_Map
end end
def dispose def dispose
if $scne.is_a?(Scene_Map) if $scene.is_a?(Scene_Map)
$scene.map_renderer.remove_tileset(@map.tileset_name) $scene.map_renderer.remove_tileset(@map.tileset_name)
@map.autotile_names.each { |filename| $scene.map_renderer.remove_autotile(filename) } @map.autotile_names.each { |filename| $scene.map_renderer.remove_autotile(filename) }
$scene.map_renderer.remove_extra_autotiles(@map.tileset_id) $scene.map_renderer.remove_extra_autotiles(@map.tileset_id)
end end
@panorama.dispose @panorama.dispose
@fog.dispose @fog.dispose
for sprite in @character_sprites @character_sprites.each { |sprite| sprite.dispose }
sprite.dispose
end
@weather.dispose @weather.dispose
@panorama = nil @panorama = nil
@fog = nil @fog = nil

View File

@@ -471,9 +471,20 @@ class Battle::Battler
@battle.pbHideAbilitySplash(b) if b.damageState.magicBounce @battle.pbHideAbilitySplash(b) if b.damageState.magicBounce
newChoice = choice.clone newChoice = choice.clone
newChoice[3] = user.index newChoice[3] = user.index
newTargets = pbFindTargets(newChoice, move, b) newTargets = pbFindTargets(newChoice ,move, b)
newTargets = pbChangeTargets(move, b, newTargets) newTargets = pbChangeTargets(move, b, newTargets)
success = pbProcessMoveHit(move, b, newTargets, 0, false) success = false
if !move.pbMoveFailed?(b, newTargets)
newTargets.each_with_index do |newTarget, idx|
if pbSuccessCheckAgainstTarget(move, b, newTarget, newTargets)
success = true
next
end
newTargets[idx] = nil
end
newTargets.compact!
end
pbProcessMoveHit(move, b, newTargets, 0, false) if success
b.lastMoveFailed = true if !success b.lastMoveFailed = true if !success
targets.each { |otherB| otherB.pbFaint if otherB && otherB.fainted? } targets.each { |otherB| otherB.pbFaint if otherB && otherB.fainted? }
user.pbFaint if user.fainted? user.pbFaint if user.fainted?
@@ -486,7 +497,10 @@ class Battle::Battler
@battle.pbShowAbilitySplash(mc) if magicBouncer >= 0 @battle.pbShowAbilitySplash(mc) if magicBouncer >= 0
@battle.pbDisplay(_INTL("{1} bounced the {2} back!", mc.pbThis, move.name)) @battle.pbDisplay(_INTL("{1} bounced the {2} back!", mc.pbThis, move.name))
@battle.pbHideAbilitySplash(mc) if magicBouncer >= 0 @battle.pbHideAbilitySplash(mc) if magicBouncer >= 0
success = false
if !move.pbMoveFailed?(mc, [])
success = pbProcessMoveHit(move, mc, [], 0, false) success = pbProcessMoveHit(move, mc, [], 0, false)
end
mc.lastMoveFailed = true if !success mc.lastMoveFailed = true if !success
targets.each { |b| b.pbFaint if b && b.fainted? } targets.each { |b| b.pbFaint if b && b.fainted? }
user.pbFaint if user.fainted? user.pbFaint if user.fainted?

View File

@@ -34,6 +34,7 @@ module Compiler
case settingname case settingname
when "Name" when "Name"
rgnnames[currentmap] = record rgnnames[currentmap] = record
sections[currentmap][schema[0]] = record
when "Point" when "Point"
placenames.push(record[2]) placenames.push(record[2])
placedescs.push(record[3]) placedescs.push(record[3])