mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-06 06:01:46 +00:00
Fixes for Battle Arena
This commit is contained in:
@@ -74,6 +74,10 @@ class Window
|
||||
attr_reader :openness
|
||||
attr_reader :stretch
|
||||
|
||||
def inspect
|
||||
return self.to_s.chop + ">"
|
||||
end
|
||||
|
||||
def windowskin
|
||||
@_windowskin
|
||||
end
|
||||
|
||||
@@ -88,10 +88,10 @@ class PokeBattle_Battler
|
||||
# Pursuit was used specially to intercept a switching foe.
|
||||
# Cancels the use of multi-turn moves and counters thereof. Note that Hyper
|
||||
# Beam's effect is NOT cancelled.
|
||||
def pbCancelMoves
|
||||
def pbCancelMoves(full_cancel = false)
|
||||
# Outragers get confused anyway if they are disrupted during their final
|
||||
# turn of using the move
|
||||
if @effects[PBEffects::Outrage]==1 && pbCanConfuseSelf?(false)
|
||||
if @effects[PBEffects::Outrage]==1 && pbCanConfuseSelf?(false) && !full_cancel
|
||||
pbConfuse(_INTL("{1} became confused due to fatigue!",pbThis))
|
||||
end
|
||||
# Cancel usage of most multi-turn moves
|
||||
|
||||
@@ -1,3 +1,37 @@
|
||||
#===============================================================================
|
||||
# Success state
|
||||
#===============================================================================
|
||||
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(full=true)
|
||||
@typeMod = Effectiveness::NORMAL_EFFECTIVE
|
||||
@useState = 0
|
||||
@protected = false
|
||||
@skill = 0 if full
|
||||
end
|
||||
|
||||
def updateSkill
|
||||
if @useState==1
|
||||
@skill = -2 if !@protected
|
||||
elsif @useState==2
|
||||
if Effectiveness.super_effective?(@typeMod); @skill = 2
|
||||
elsif Effectiveness.normal?(@typeMod); @skill = 1
|
||||
elsif Effectiveness.not_very_effective?(@typeMod); @skill = -1
|
||||
else; @skill = -2 # Ineffective
|
||||
end
|
||||
end
|
||||
clear(false)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
@@ -65,7 +99,7 @@ class PokeBattle_BattleArena < PokeBattle_Battle
|
||||
move.function=="012" # Fake Out
|
||||
return -1
|
||||
end
|
||||
if move.function=="071" || # Counter
|
||||
if move.function=="071" || # Counter
|
||||
move.function=="072" || # Mirror Coat
|
||||
move.function=="0D4" # Bide
|
||||
return 0
|
||||
@@ -93,74 +127,77 @@ class PokeBattle_BattleArena < PokeBattle_Battle
|
||||
|
||||
def pbEndOfRoundPhase
|
||||
super
|
||||
return if @decision!=0
|
||||
@count += 1
|
||||
return if @decision != 0
|
||||
# Update skill rating
|
||||
for side in 0...2
|
||||
@skill[side] += self.successStates[side].skill_level
|
||||
@skill[side] += self.successStates[side].skill
|
||||
end
|
||||
# PBDebug.log("[Mind: #{@mind.inspect}, Skill: #{@skill.inspect}]")
|
||||
if @count==3
|
||||
@battlers[0].pbCancelMoves
|
||||
@battlers[1].pbCancelMoves
|
||||
ratings1 = [0,0,0]
|
||||
ratings2 = [0,0,0]
|
||||
if @mind[0]==@mind[1]
|
||||
ratings1[0] = 1
|
||||
ratings2[0] = 1
|
||||
elsif @mind[0]>@mind[1]
|
||||
ratings1[0] = 2
|
||||
else
|
||||
ratings2[0] = 2
|
||||
end
|
||||
if @skill[0]==@skill[1]
|
||||
ratings1[1] = 1
|
||||
ratings2[1] = 1
|
||||
elsif @skill[0]>@skill[1]
|
||||
ratings1[1] = 2
|
||||
else
|
||||
ratings2[1] = 2
|
||||
end
|
||||
body = [0,0]
|
||||
body[0] = ((@battlers[0].hp*100)/[@starthp[0],1].max).floor
|
||||
body[1] = ((@battlers[1].hp*100)/[@starthp[1],1].max).floor
|
||||
if body[0]==body[1]
|
||||
ratings1[2] = 1
|
||||
ratings2[2] = 1
|
||||
elsif body[0]>body[1]
|
||||
ratings1[2] = 2
|
||||
else
|
||||
ratings2[2] = 2
|
||||
end
|
||||
@scene.pbBattleArenaJudgment(@battlers[0],@battlers[1],ratings1.clone,ratings2.clone)
|
||||
points = [0,0]
|
||||
for i in 0...ratings1.length
|
||||
points[0] += ratings1[i]
|
||||
points[1] += ratings2[i]
|
||||
end
|
||||
if points[0]==points[1]
|
||||
pbDisplay(_INTL("{1} tied the opponent\n{2} in a referee's decision!",
|
||||
@battlers[0].name,@battlers[1].name))
|
||||
# NOTE: Pokémon doesn't really lose HP, but the effect is mostly the
|
||||
# same.
|
||||
@battlers[0].hp = 0
|
||||
@battlers[0].pbFaint(false)
|
||||
@battlers[1].hp = 0
|
||||
@battlers[1].pbFaint(false)
|
||||
elsif points[0]>points[1]
|
||||
pbDisplay(_INTL("{1} defeated the opponent\n{2} in a referee's decision!",
|
||||
@battlers[0].name,@battlers[1].name))
|
||||
@battlers[1].hp = 0
|
||||
@battlers[1].pbFaint(false)
|
||||
else
|
||||
pbDisplay(_INTL("{1} lost to the opponent\n{2} in a referee's decision!",
|
||||
@battlers[0].name,@battlers[1].name))
|
||||
@battlers[0].hp = 0
|
||||
@battlers[0].pbFaint(false)
|
||||
end
|
||||
pbGainExp
|
||||
pbEORSwitch
|
||||
# Increment turn counter
|
||||
@count += 1
|
||||
return if @count < 3
|
||||
# Half all multi-turn moves
|
||||
@battlers[0].pbCancelMoves(true)
|
||||
@battlers[1].pbCancelMoves(true)
|
||||
# Calculate scores in each category
|
||||
ratings1 = [0, 0, 0]
|
||||
ratings2 = [0, 0, 0]
|
||||
if @mind[0] == @mind[1]
|
||||
ratings1[0] = 1
|
||||
ratings2[0] = 1
|
||||
elsif @mind[0] > @mind[1]
|
||||
ratings1[0] = 2
|
||||
else
|
||||
ratings2[0] = 2
|
||||
end
|
||||
if @skill[0] == @skill[1]
|
||||
ratings1[1] = 1
|
||||
ratings2[1] = 1
|
||||
elsif @skill[0] > @skill[1]
|
||||
ratings1[1] = 2
|
||||
else
|
||||
ratings2[1] = 2
|
||||
end
|
||||
body = [0, 0]
|
||||
body[0] = ((@battlers[0].hp * 100) / [@starthp[0], 1].max).floor
|
||||
body[1] = ((@battlers[1].hp * 100) / [@starthp[1], 1].max).floor
|
||||
if body[0] == body[1]
|
||||
ratings1[2] = 1
|
||||
ratings2[2] = 1
|
||||
elsif body[0] > body[1]
|
||||
ratings1[2] = 2
|
||||
else
|
||||
ratings2[2] = 2
|
||||
end
|
||||
# Show scores
|
||||
@scene.pbBattleArenaJudgment(@battlers[0], @battlers[1], ratings1.clone, ratings2.clone)
|
||||
# Calculate total scores
|
||||
points = [0, 0]
|
||||
ratings1.each { |val| points[0] += val }
|
||||
ratings2.each { |val| points[1] += val }
|
||||
# Make judgment
|
||||
if points[0] == points[1]
|
||||
pbDisplay(_INTL("{1} tied the opponent\n{2} in a referee's decision!",
|
||||
@battlers[0].name, @battlers[1].name))
|
||||
# NOTE: Pokémon doesn't really lose HP, but the effect is mostly the
|
||||
# same.
|
||||
@battlers[0].hp = 0
|
||||
@battlers[0].pbFaint(false)
|
||||
@battlers[1].hp = 0
|
||||
@battlers[1].pbFaint(false)
|
||||
elsif points[0] > points[1]
|
||||
pbDisplay(_INTL("{1} defeated the opponent\n{2} in a referee's decision!",
|
||||
@battlers[0].name, @battlers[1].name))
|
||||
@battlers[1].hp = 0
|
||||
@battlers[1].pbFaint(false)
|
||||
else
|
||||
pbDisplay(_INTL("{1} lost to the opponent\n{2} in a referee's decision!",
|
||||
@battlers[0].name, @battlers[1].name))
|
||||
@battlers[0].hp = 0
|
||||
@battlers[0].pbFaint(false)
|
||||
end
|
||||
pbGainExp
|
||||
pbEORSwitch
|
||||
end
|
||||
end
|
||||
|
||||
@@ -305,8 +342,8 @@ class PokeBattle_Scene
|
||||
ensure
|
||||
pbDisposeMessageWindow(msgwindow)
|
||||
dimmingvp.dispose
|
||||
infowindow.contents.dispose
|
||||
infowindow.dispose
|
||||
infowindow.contents.dispose if infowindow && infowindow.contents
|
||||
infowindow.dispose if infowindow
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -48,37 +48,3 @@ class PokeBattle_DamageState
|
||||
@berryWeakened = false
|
||||
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(full=true)
|
||||
@typeMod = Effectiveness::NORMAL_EFFECTIVE
|
||||
@useState = 0
|
||||
@protected = false
|
||||
@skill = 0 if full
|
||||
end
|
||||
|
||||
def updateSkill
|
||||
if @useState==1
|
||||
@skill = -2 if !@protected
|
||||
elsif @useState==2
|
||||
if Effectiveness.super_effective?(@typeMod); @skill = 2
|
||||
elsif Effectiveness.normal?(@typeMod); @skill = 1
|
||||
elsif Effectiveness.not_very_effective?(@typeMod); @skill = -1
|
||||
else; @skill = -2 # Ineffective
|
||||
end
|
||||
end
|
||||
clear(false)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -159,9 +159,10 @@ class PBPokemon
|
||||
pokemon.nature = nature
|
||||
pokemon.happiness=0
|
||||
pokemon.moves[0] = Pokemon::Move.new(self.convertMove(@move1))
|
||||
pokemon.moves[1] = Pokemon::Move.new(self.convertMove(@move2))
|
||||
pokemon.moves[2] = Pokemon::Move.new(self.convertMove(@move3))
|
||||
pokemon.moves[3] = Pokemon::Move.new(self.convertMove(@move4))
|
||||
pokemon.moves[1] = (@move2) ? Pokemon::Move.new(self.convertMove(@move2)) : nil
|
||||
pokemon.moves[2] = (@move3) ? Pokemon::Move.new(self.convertMove(@move3)) : nil
|
||||
pokemon.moves[3] = (@move4) ? Pokemon::Move.new(self.convertMove(@move4)) : nil
|
||||
pokemon.moves.compact!
|
||||
if ev.length > 0
|
||||
ev.each { |stat| pokemon.ev[stat] = Pokemon::EV_LIMIT / ev.length }
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user