Minor refactoring to kill various Rubocop warnings

This commit is contained in:
Maruno17
2021-12-17 20:29:47 +00:00
parent b5ee1b211d
commit 5dc64f1709
46 changed files with 145 additions and 151 deletions

View File

@@ -173,9 +173,8 @@ class Battle
newLevel = growth_rate.level_from_exp(expFinal)
if newLevel<curLevel
debugInfo = "Levels: #{curLevel}->#{newLevel} | Exp: #{pkmn.exp}->#{expFinal} | gain: #{expGained}"
raise RuntimeError.new(
_INTL("{1}'s new level is less than its\r\ncurrent level, which shouldn't happen.\r\n[Debug: {2}]",
pkmn.name,debugInfo))
raise _INTL("{1}'s new level is less than its\r\ncurrent level, which shouldn't happen.\r\n[Debug: {2}]",
pkmn.name,debugInfo)
end
# Give Exp
if pkmn.shadowPokemon?

View File

@@ -138,8 +138,8 @@ class Battle::Battler
return false
end
if abilityActive?
return false if Battle::AbilityEffects.triggerStatLossImmunity(
self.ability,self,stat,@battle,showFailMsg) if !@battle.moldBreaker
return false if !@battle.moldBreaker && Battle::AbilityEffects.triggerStatLossImmunity(
self.ability,self,stat,@battle,showFailMsg)
return false if Battle::AbilityEffects.triggerStatLossImmunityNonIgnorable(
self.ability,self,stat,@battle,showFailMsg)
end

View File

@@ -488,7 +488,8 @@ class Battle::Move::ThrowUserItemAtTarget < Battle::Move
# Exp Candies
:EXPCANDYXS, :EXPCANDYS, :EXPCANDYM, :EXPCANDYL, :EXPCANDYXL
],
20 => [# Feathers
20 => [
# Feathers
:CLEVERFEATHER,:GENIUSFEATHER,:HEALTHFEATHER,:MUSCLEFEATHER,
:PRETTYFEATHER,:RESISTFEATHER,:SWIFTFEATHER,
:CLEVERWING,:GENIUSWING,:HEALTHWING,:MUSCLEWING,:PRETTYWING,

View File

@@ -199,10 +199,11 @@ class Battle::Scene
$bag.last_pocket_selections = @bagChoices if @bagChoices != nil
# Start Bag screen
itemScene = PokemonBag_Scene.new
itemScene.pbStartScene($bag, true, Proc.new { |item|
useType = GameData::Item.get(item).battle_use
next useType && useType>0
},false)
itemScene.pbStartScene($bag, true,
Proc.new { |item|
useType = GameData::Item.get(item).battle_use
next useType && useType > 0
}, false)
# Loop while in Bag screen
wasTargeting = false
loop do

View File

@@ -139,9 +139,9 @@ class Battle::Scene
end
fadeAnim.dispose
sendOutAnims.each do |a|
a[0].dispose
a[1].dispose
end
a[0].dispose
a[1].dispose
end
# Play shininess animations for shiny Pokémon
sendOuts.each do |b|
next if !@battle.showAnims || !@battle.battlers[b[0]].shiny?

View File

@@ -47,8 +47,8 @@ class Battle::DebugSceneNoLogging
def pbHPChanged(battler,oldHP,showAnim=false); end
def pbFaintBattler(battler); end
def pbEXPBar(battler,startExp,endExp,tempExp1,tempExp2); end
def pbLevelUp(pkmn,battler,oldTotalHP,oldAttack,oldDefense,
oldSpAtk,oldSpDef,oldSpeed); end
def pbLevelUp(pkmn, battler, oldTotalHP, oldAttack, oldDefense,
oldSpAtk, oldSpDef, oldSpeed); end
def pbForgetMove(pkmn,moveToLearn); return 0; end # Always forget first move
def pbCommandMenu(idxBattler,firstAction)

View File

@@ -32,7 +32,7 @@ class Battle::AI
n += 1
end
return 0 if n<2
mean = sum.to_f/n.to_f
mean = sum.to_f / n
varianceTimesN = 0
choices.each do |c|
next if c[1]<=0

View File

@@ -277,7 +277,9 @@ class Battle::Scene
dimmingvp = Viewport.new(0,0,Graphics.width,Graphics.height-msgwindow.height)
pbMessageDisplay(msgwindow,
_INTL("REFEREE: That's it! We will now go to judging to determine the winner!\\wtnp[20]")) {
pbBattleArenaUpdate; dimmingvp.update }
pbBattleArenaUpdate
dimmingvp.update
}
dimmingvp.z = 99999
infowindow = SpriteWindow_Base.new(80,0,320,224)
infowindow.contents = Bitmap.new(infowindow.width-infowindow.borderX,
@@ -303,15 +305,24 @@ class Battle::Scene
updateJudgment(infowindow,1,battler1,battler2,ratings1,ratings2)
pbMessageDisplay(msgwindow,
_INTL("REFEREE: Judging category 1, Mind!\nThe Pokémon showing the most guts!\\wtnp[40]")) {
pbBattleArenaUpdate; dimmingvp.update; infowindow.update }
pbBattleArenaUpdate
dimmingvp.update
infowindow.update
}
updateJudgment(infowindow,2,battler1,battler2,ratings1,ratings2)
pbMessageDisplay(msgwindow,
_INTL("REFEREE: Judging category 2, Skill!\nThe Pokémon using moves the best!\\wtnp[40]")) {
pbBattleArenaUpdate; dimmingvp.update; infowindow.update }
pbBattleArenaUpdate
dimmingvp.update
infowindow.update
}
updateJudgment(infowindow,3,battler1,battler2,ratings1,ratings2)
pbMessageDisplay(msgwindow,
_INTL("REFEREE: Judging category 3, Body!\nThe Pokémon with the most vitality!\\wtnp[40]")) {
pbBattleArenaUpdate; dimmingvp.update; infowindow.update }
pbBattleArenaUpdate
dimmingvp.update
infowindow.update
}
total1 = 0
total2 = 0
for i in 0...3
@@ -321,17 +332,26 @@ class Battle::Scene
if total1==total2
pbMessageDisplay(msgwindow,
_INTL("REFEREE: Judgment: {1} to {2}!\nWe have a draw!\\wtnp[40]",total1,total2)) {
pbBattleArenaUpdate; dimmingvp.update; infowindow.update }
pbBattleArenaUpdate
dimmingvp.update
infowindow.update
}
elsif total1>total2
pbMessageDisplay(msgwindow,
_INTL("REFEREE: Judgment: {1} to {2}!\nThe winner is {3}'s {4}!\\wtnp[40]",
total1,total2,@battle.pbGetOwnerName(battler1.index),battler1.name)) {
pbBattleArenaUpdate; dimmingvp.update; infowindow.update }
pbBattleArenaUpdate
dimmingvp.update
infowindow.update
}
else
pbMessageDisplay(msgwindow,
_INTL("REFEREE: Judgment: {1} to {2}!\nThe winner is {3}!\\wtnp[40]",
total1,total2,battler2.name)) {
pbBattleArenaUpdate; dimmingvp.update; infowindow.update }
pbBattleArenaUpdate
dimmingvp.update
infowindow.update
}
end
infowindow.visible = false
msgwindow.visible = false