mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-07 13:15:01 +00:00
Merge branch 'master' into refactor
This commit is contained in:
@@ -432,48 +432,34 @@ class Game_Character
|
||||
end
|
||||
end
|
||||
|
||||
def move_up(turn_enabled = true)
|
||||
turn_up if turn_enabled
|
||||
if passable?(@x, @y, 8)
|
||||
turn_up
|
||||
@y -= 1
|
||||
def move_generic(dir, turn_enabled = true)
|
||||
turn_generic(dir) if turn_enabled
|
||||
x_offset = (dir == 4) ? -1 : (dir == 6) ? 1 : 0
|
||||
y_offset = (dir == 8) ? -1 : (dir == 2) ? 1 : 0
|
||||
if passable?(@x, @y, dir)
|
||||
turn_generic(dir)
|
||||
@x += x_offset
|
||||
@y += y_offset
|
||||
increase_steps
|
||||
else
|
||||
check_event_trigger_touch(@x, @y-1)
|
||||
check_event_trigger_touch(@x + x_offset, @y + y_offset)
|
||||
end
|
||||
end
|
||||
|
||||
def move_down(turn_enabled = true)
|
||||
turn_down if turn_enabled
|
||||
if passable?(@x, @y, 2)
|
||||
turn_down
|
||||
@y += 1
|
||||
increase_steps
|
||||
else
|
||||
check_event_trigger_touch(@x, @y+1)
|
||||
end
|
||||
move_generic(2, turn_enabled)
|
||||
end
|
||||
|
||||
def move_left(turn_enabled = true)
|
||||
turn_left if turn_enabled
|
||||
if passable?(@x, @y, 4)
|
||||
turn_left
|
||||
@x -= 1
|
||||
increase_steps
|
||||
else
|
||||
check_event_trigger_touch(@x-1, @y)
|
||||
end
|
||||
move_generic(4, turn_enabled)
|
||||
end
|
||||
|
||||
def move_right(turn_enabled = true)
|
||||
turn_right if turn_enabled
|
||||
if passable?(@x, @y, 6)
|
||||
turn_right
|
||||
@x += 1
|
||||
increase_steps
|
||||
else
|
||||
check_event_trigger_touch(@x+1, @y)
|
||||
end
|
||||
move_generic(6, turn_enabled)
|
||||
end
|
||||
|
||||
def move_up(turn_enabled = true)
|
||||
move_generic(8, turn_enabled)
|
||||
end
|
||||
|
||||
def move_upper_left
|
||||
@@ -696,7 +682,7 @@ class Game_Character
|
||||
end
|
||||
end
|
||||
|
||||
def turnGeneric(dir)
|
||||
def turn_generic(dir)
|
||||
return if @direction_fix
|
||||
oldDirection = @direction
|
||||
@direction = dir
|
||||
@@ -704,10 +690,10 @@ class Game_Character
|
||||
pbCheckEventTriggerAfterTurning if dir != oldDirection
|
||||
end
|
||||
|
||||
def turn_up; turnGeneric(8); end
|
||||
def turn_down; turnGeneric(2); end
|
||||
def turn_left; turnGeneric(4); end
|
||||
def turn_right; turnGeneric(6); end
|
||||
def turn_down; turn_generic(2); end
|
||||
def turn_left; turn_generic(4); end
|
||||
def turn_right; turn_generic(6); end
|
||||
def turn_up; turn_generic(8); end
|
||||
|
||||
def turn_right_90
|
||||
case @direction
|
||||
|
||||
@@ -64,75 +64,36 @@ class Game_Player < Game_Character
|
||||
@bump_se = Graphics.frame_rate/4
|
||||
end
|
||||
|
||||
def move_down(turn_enabled = true)
|
||||
turn_down if turn_enabled
|
||||
if passable?(@x, @y, 2)
|
||||
return if pbLedge(0,1)
|
||||
return if pbEndSurf(0,1)
|
||||
turn_down
|
||||
@y += 1
|
||||
$PokemonTemp.dependentEvents.pbMoveDependentEvents
|
||||
increase_steps
|
||||
else
|
||||
if !check_event_trigger_touch(@x, @y+1)
|
||||
bump_into_object
|
||||
def move_generic(dir, turn_enabled = true)
|
||||
turn_generic(dir, true) if turn_enabled
|
||||
if !$PokemonTemp.encounterTriggered
|
||||
x_offset = (dir == 4) ? -1 : (dir == 6) ? 1 : 0
|
||||
y_offset = (dir == 8) ? -1 : (dir == 2) ? 1 : 0
|
||||
if passable?(@x, @y, dir)
|
||||
return if pbLedge(x_offset, y_offset)
|
||||
return if pbEndSurf(x_offset, y_offset)
|
||||
turn_generic(dir, true)
|
||||
if !$PokemonTemp.encounterTriggered
|
||||
@x += x_offset
|
||||
@y += y_offset
|
||||
$PokemonTemp.dependentEvents.pbMoveDependentEvents
|
||||
increase_steps
|
||||
end
|
||||
else
|
||||
if !check_event_trigger_touch(@x + x_offset, @y + y_offset)
|
||||
bump_into_object
|
||||
end
|
||||
end
|
||||
end
|
||||
$PokemonTemp.encounterTriggered = false
|
||||
end
|
||||
|
||||
def move_left(turn_enabled = true)
|
||||
turn_left if turn_enabled
|
||||
if passable?(@x, @y, 4)
|
||||
return if pbLedge(-1,0)
|
||||
return if pbEndSurf(-1,0)
|
||||
turn_left
|
||||
@x -= 1
|
||||
$PokemonTemp.dependentEvents.pbMoveDependentEvents
|
||||
increase_steps
|
||||
else
|
||||
if !check_event_trigger_touch(@x-1, @y)
|
||||
bump_into_object
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def move_right(turn_enabled = true)
|
||||
turn_right if turn_enabled
|
||||
if passable?(@x, @y, 6)
|
||||
return if pbLedge(1,0)
|
||||
return if pbEndSurf(1,0)
|
||||
turn_right
|
||||
@x += 1
|
||||
$PokemonTemp.dependentEvents.pbMoveDependentEvents
|
||||
increase_steps
|
||||
else
|
||||
if !check_event_trigger_touch(@x+1, @y)
|
||||
bump_into_object
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def move_up(turn_enabled = true)
|
||||
turn_up if turn_enabled
|
||||
if passable?(@x, @y, 8)
|
||||
return if pbLedge(0,-1)
|
||||
return if pbEndSurf(0,-1)
|
||||
turn_up
|
||||
@y -= 1
|
||||
$PokemonTemp.dependentEvents.pbMoveDependentEvents
|
||||
increase_steps
|
||||
else
|
||||
if !check_event_trigger_touch(@x, @y-1)
|
||||
bump_into_object
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def turnGeneric(dir)
|
||||
def turn_generic(dir, keep_enc_indicator = false)
|
||||
old_direction = @direction
|
||||
super
|
||||
super(dir)
|
||||
if @direction != old_direction && !@move_route_forcing && !pbMapInterpreterRunning?
|
||||
Events.onChangeDirection.trigger(self, self)
|
||||
$PokemonTemp.encounterTriggered = false if !keep_enc_indicator
|
||||
end
|
||||
end
|
||||
|
||||
@@ -170,8 +131,7 @@ class Game_Player < Game_Character
|
||||
return result
|
||||
end
|
||||
|
||||
def pbCheckEventTriggerAfterTurning
|
||||
end
|
||||
def pbCheckEventTriggerAfterTurning; end
|
||||
|
||||
def pbCheckEventTriggerFromDistance(triggers)
|
||||
ret = pbTriggeredTrainerEvents(triggers)
|
||||
@@ -385,17 +345,18 @@ class Game_Player < Game_Character
|
||||
|
||||
def update_command_new
|
||||
dir = Input.dir4
|
||||
unless pbMapInterpreterRunning? or $game_temp.message_window_showing or
|
||||
$PokemonTemp.miniupdate or $game_temp.in_menu
|
||||
unless pbMapInterpreterRunning? || $game_temp.message_window_showing ||
|
||||
$PokemonTemp.miniupdate || $game_temp.in_menu
|
||||
# Move player in the direction the directional button is being pressed
|
||||
if @moved_last_frame || (dir==@lastdir && Graphics.frame_count-@lastdirframe>Graphics.frame_rate/20)
|
||||
if @moved_last_frame ||
|
||||
(dir > 0 && dir == @lastdir && Graphics.frame_count - @lastdirframe > Graphics.frame_rate / 20)
|
||||
case dir
|
||||
when 2; move_down
|
||||
when 4; move_left
|
||||
when 6; move_right
|
||||
when 8; move_up
|
||||
end
|
||||
elsif dir!=@lastdir
|
||||
elsif dir != @lastdir
|
||||
case dir
|
||||
when 2; turn_down
|
||||
when 4; turn_left
|
||||
@@ -405,7 +366,7 @@ class Game_Player < Game_Character
|
||||
end
|
||||
end
|
||||
# Record last direction input
|
||||
@lastdirframe = Graphics.frame_count if dir!=@lastdir
|
||||
@lastdirframe = Graphics.frame_count if dir != @lastdir
|
||||
@lastdir = dir
|
||||
end
|
||||
|
||||
|
||||
@@ -8,7 +8,8 @@ class PokeBattle_Battler
|
||||
if tryFlee && @battle.wildBattle? && opposes? &&
|
||||
@battle.rules["alwaysflee"] && @battle.pbCanRun?(@index)
|
||||
pbBeginTurn(choice)
|
||||
@battle.pbDisplay(_INTL("{1} fled from battle!",pbThis)) { pbSEPlay("Battle flee") }
|
||||
pbSEPlay("Battle flee")
|
||||
@battle.pbDisplay(_INTL("{1} fled from battle!",pbThis))
|
||||
@battle.decision = 3
|
||||
pbEndTurn(choice)
|
||||
return true
|
||||
|
||||
@@ -83,7 +83,7 @@ class PokeBattle_Battle
|
||||
end
|
||||
end
|
||||
|
||||
# Uses an item on a Pokémon in the player's party.
|
||||
# Uses an item on a Pokémon in the trainer's party.
|
||||
def pbUseItemOnPokemon(item,idxParty,userBattler)
|
||||
trainerName = pbGetOwnerName(userBattler.index)
|
||||
pbUseItemMessage(item,trainerName)
|
||||
@@ -100,14 +100,14 @@ class PokeBattle_Battle
|
||||
pbReturnUnusedItemToBag(item,userBattler.index)
|
||||
end
|
||||
|
||||
# Uses an item on a Pokémon in battle that belongs to the player.
|
||||
def pbUseItemOnBattler(item,idxParty,userBattler)
|
||||
# Uses an item on a Pokémon in battle that belongs to the trainer.
|
||||
def pbUseItemOnBattler(item,idxBattler,userBattler)
|
||||
trainerName = pbGetOwnerName(userBattler.index)
|
||||
pbUseItemMessage(item,trainerName)
|
||||
pkmn = pbParty(userBattler.index)[idxParty]
|
||||
battler = pbFindBattler(idxParty,userBattler.index)
|
||||
idxBattler = userBattler.index if idxBattler<0
|
||||
battler = @battlers[idxBattler]
|
||||
ch = @choices[userBattler.index]
|
||||
if ItemHandlers.triggerCanUseInBattle(item,pkmn,battler,ch[3],true,self,@scene,false)
|
||||
if ItemHandlers.triggerCanUseInBattle(item,battler.pokemon,battler,ch[3],true,self,@scene,false)
|
||||
ItemHandlers.triggerBattleUseOnBattler(item,battler,@scene)
|
||||
ch[1] = nil # Delete item from choice
|
||||
return
|
||||
|
||||
@@ -52,7 +52,8 @@ class PokeBattle_Battle
|
||||
elsif @internalBattle
|
||||
pbDisplayPaused(_INTL("No! There's no running from a Trainer battle!"))
|
||||
elsif pbDisplayConfirm(_INTL("Would you like to forfeit the match and quit now?"))
|
||||
pbDisplay(_INTL("{1} forfeited the match!",self.pbPlayer.name)) { pbSEPlay("Battle flee") }
|
||||
pbSEPlay("Battle flee")
|
||||
pbDisplay(_INTL("{1} forfeited the match!",self.pbPlayer.name))
|
||||
@decision = 3
|
||||
return 1
|
||||
end
|
||||
@@ -60,7 +61,8 @@ class PokeBattle_Battle
|
||||
end
|
||||
# Fleeing from wild battles
|
||||
if $DEBUG && Input.press?(Input::CTRL)
|
||||
pbDisplayPaused(_INTL("You got away safely!")) { pbSEPlay("Battle flee") }
|
||||
pbSEPlay("Battle flee")
|
||||
pbDisplayPaused(_INTL("You got away safely!"))
|
||||
@decision = 3
|
||||
return 1
|
||||
end
|
||||
@@ -70,7 +72,8 @@ class PokeBattle_Battle
|
||||
end
|
||||
if !duringBattle
|
||||
if battler.pbHasType?(:GHOST) && NEWEST_BATTLE_MECHANICS
|
||||
pbDisplayPaused(_INTL("You got away safely!")) { pbSEPlay("Battle flee") }
|
||||
pbSEPlay("Battle flee")
|
||||
pbDisplayPaused(_INTL("You got away safely!"))
|
||||
@decision = 3
|
||||
return 1
|
||||
end
|
||||
@@ -79,7 +82,8 @@ class PokeBattle_Battle
|
||||
if BattleHandlers.triggerRunFromBattleAbility(battler.ability,battler)
|
||||
pbShowAbilitySplash(battler,true)
|
||||
pbHideAbilitySplash(battler)
|
||||
pbDisplayPaused(_INTL("You got away safely!")) { pbSEPlay("Battle flee") }
|
||||
pbSEPlay("Battle flee")
|
||||
pbDisplayPaused(_INTL("You got away safely!"))
|
||||
@decision = 3
|
||||
return 1
|
||||
end
|
||||
@@ -87,8 +91,9 @@ class PokeBattle_Battle
|
||||
# Held items that guarantee escape
|
||||
if battler.itemActive?
|
||||
if BattleHandlers.triggerRunFromBattleItem(battler.item,battler)
|
||||
pbSEPlay("Battle flee")
|
||||
pbDisplayPaused(_INTL("{1} fled using its {2}!",
|
||||
battler.pbThis,battler.itemName)) { pbSEPlay("Battle flee") }
|
||||
battler.pbThis,battler.itemName))
|
||||
@decision = 3
|
||||
return 1
|
||||
end
|
||||
@@ -135,7 +140,8 @@ class PokeBattle_Battle
|
||||
rate += @runCommand*30
|
||||
end
|
||||
if rate>=256 || @battleAI.pbAIRandom(256)<rate
|
||||
pbDisplayPaused(_INTL("You got away safely!")) { pbSEPlay("Battle flee") }
|
||||
pbSEPlay("Battle flee")
|
||||
pbDisplayPaused(_INTL("You got away safely!"))
|
||||
@decision = 3
|
||||
return 1
|
||||
end
|
||||
|
||||
@@ -326,7 +326,7 @@ class PokemonDataBox < SpriteWrapper
|
||||
if @expFlash==0
|
||||
pbSEStop
|
||||
@expFlash = Graphics.frame_rate/5
|
||||
pbSEPlay("Exp full")
|
||||
pbSEPlay("Pkmn exp full")
|
||||
self.flash(Color.new(64,200,248,192),@expFlash)
|
||||
for i in @sprites
|
||||
i[1].flash(Color.new(64,200,248,192),@expFlash) if !i[1].disposed?
|
||||
|
||||
@@ -25,8 +25,8 @@ class PokeBattle_FakeBattler
|
||||
def shiny?; return @pokemon.shiny?; end
|
||||
alias isShiny? shiny?
|
||||
|
||||
def isSpecies?(checK_species)
|
||||
return @pokemon && @pokemon.isSpecies?(checK_species)
|
||||
def isSpecies?(check_species)
|
||||
return @pokemon && @pokemon.isSpecies?(check_species)
|
||||
end
|
||||
|
||||
def fainted?; return false; end
|
||||
@@ -462,7 +462,8 @@ class PokeBattle_SafariZone
|
||||
catchFactor *= 2 # Easier to catch
|
||||
escapeFactor *= 2 if pbRandom(100)<90 # More likely to escape
|
||||
when 3 # Run
|
||||
pbDisplayPaused(_INTL("You got away safely!")) { pbSEPlay("Battle flee") }
|
||||
pbSEPlay("Battle flee")
|
||||
pbDisplayPaused(_INTL("You got away safely!"))
|
||||
@decision = 3
|
||||
end
|
||||
catchFactor = [[catchFactor,3].max,20].min
|
||||
@@ -473,7 +474,8 @@ class PokeBattle_SafariZone
|
||||
pbDisplay(_INTL("PA: You have no Safari Balls left! Game over!"))
|
||||
@decision = 2
|
||||
elsif pbRandom(100)<5*escapeFactor
|
||||
pbDisplay(_INTL("{1} fled!",wildpoke.name)) { pbSEPlay("Battle flee") }
|
||||
pbSEPlay("Battle flee")
|
||||
pbDisplay(_INTL("{1} fled!",wildpoke.name))
|
||||
@decision = 3
|
||||
elsif cmd==1 # Bait
|
||||
pbDisplay(_INTL("{1} is eating!",wildpoke.name))
|
||||
|
||||
@@ -83,7 +83,8 @@ BattleHandlers::AbilityOnHPDroppedBelowHalf.add(:EMERGENCYEXIT,
|
||||
next false if !battle.pbCanRun?(battler.index)
|
||||
battle.pbShowAbilitySplash(battler,true)
|
||||
battle.pbHideAbilitySplash(battler)
|
||||
battle.pbDisplay(_INTL("{1} fled from battle!",battler.pbThis)) { pbSEPlay("Battle flee") }
|
||||
pbSEPlay("Battle flee")
|
||||
battle.pbDisplay(_INTL("{1} fled from battle!",battler.pbThis))
|
||||
battle.decision = 3 # Escaped
|
||||
next true
|
||||
end
|
||||
|
||||
@@ -368,32 +368,34 @@ def pbOnStepTaken(eventTriggered)
|
||||
Events.onStepTakenTransferPossible.trigger(nil,handled)
|
||||
return if handled[0]
|
||||
pbBattleOnStepTaken(repel) if !eventTriggered && !$game_temp.in_menu
|
||||
$PokemonTemp.encounterTriggered = false # This info isn't needed
|
||||
end
|
||||
|
||||
# Start wild encounters while turning on the spot
|
||||
Events.onChangeDirection += proc {
|
||||
repel = ($PokemonGlobal.repel>0)
|
||||
repel = ($PokemonGlobal.repel > 0)
|
||||
pbBattleOnStepTaken(repel) if !$game_temp.in_menu
|
||||
}
|
||||
|
||||
def pbBattleOnStepTaken(repel=false)
|
||||
return if $Trainer.ablePokemonCount==0
|
||||
def pbBattleOnStepTaken(repel = false)
|
||||
return if $Trainer.ablePokemonCount == 0
|
||||
encounterType = $PokemonEncounters.pbEncounterType
|
||||
return if encounterType<0
|
||||
return if encounterType < 0
|
||||
return if !$PokemonEncounters.isEncounterPossibleHere?
|
||||
$PokemonTemp.encounterType = encounterType
|
||||
encounter = $PokemonEncounters.pbGenerateEncounter(encounterType)
|
||||
encounter = EncounterModifier.trigger(encounter)
|
||||
if $PokemonEncounters.pbCanEncounter?(encounter,repel)
|
||||
if $PokemonEncounters.pbCanEncounter?(encounter, repel)
|
||||
if !$PokemonTemp.forceSingleBattle && !pbInSafari? && ($PokemonGlobal.partner ||
|
||||
($Trainer.ablePokemonCount>1 && PBTerrain.isDoubleWildBattle?(pbGetTerrainTag) && rand(100)<30))
|
||||
($Trainer.ablePokemonCount > 1 && PBTerrain.isDoubleWildBattle?(pbGetTerrainTag) && rand(100) < 30))
|
||||
encounter2 = $PokemonEncounters.pbEncounteredPokemon(encounterType)
|
||||
encounter2 = EncounterModifier.trigger(encounter2)
|
||||
pbDoubleWildBattle(encounter[0],encounter[1],encounter2[0],encounter2[1])
|
||||
pbDoubleWildBattle(encounter[0], encounter[1], encounter2[0], encounter2[1])
|
||||
else
|
||||
pbWildBattle(encounter[0],encounter[1])
|
||||
pbWildBattle(encounter[0], encounter[1])
|
||||
end
|
||||
$PokemonTemp.encounterType = -1
|
||||
$PokemonTemp.encounterTriggered = true
|
||||
end
|
||||
$PokemonTemp.forceSingleBattle = false
|
||||
EncounterModifier.triggerEncounterEnd
|
||||
|
||||
@@ -11,6 +11,7 @@ end
|
||||
|
||||
|
||||
class PokemonTemp
|
||||
attr_accessor :encounterTriggered
|
||||
attr_accessor :encounterType
|
||||
attr_accessor :evolutionLevels
|
||||
|
||||
@@ -251,7 +252,12 @@ def pbWildBattleCore(*args)
|
||||
playerTrainers = [$Trainer]
|
||||
playerParty = $Trainer.party
|
||||
playerPartyStarts = [0]
|
||||
if $PokemonGlobal.partner && !$PokemonTemp.battleRules["noPartner"] && foeParty.length>1
|
||||
room_for_partner = (foeParty.length > 1)
|
||||
if !room_for_partner && $PokemonTemp.battleRules["size"] &&
|
||||
!["single", "1v1", "1v2", "1v3"].include?($PokemonTemp.battleRules["size"])
|
||||
room_for_partner = true
|
||||
end
|
||||
if $PokemonGlobal.partner && !$PokemonTemp.battleRules["noPartner"] && room_for_partner
|
||||
ally = PokeBattle_Trainer.new($PokemonGlobal.partner[1],$PokemonGlobal.partner[0])
|
||||
ally.id = $PokemonGlobal.partner[2]
|
||||
ally.party = $PokemonGlobal.partner[3]
|
||||
@@ -391,7 +397,12 @@ def pbTrainerBattleCore(*args)
|
||||
playerTrainers = [$Trainer]
|
||||
playerParty = $Trainer.party
|
||||
playerPartyStarts = [0]
|
||||
if $PokemonGlobal.partner && !$PokemonTemp.battleRules["noPartner"] && foeParty.length>1
|
||||
room_for_partner = (foeParty.length > 1)
|
||||
if !room_for_partner && $PokemonTemp.battleRules["size"] &&
|
||||
!["single", "1v1", "1v2", "1v3"].include?($PokemonTemp.battleRules["size"])
|
||||
room_for_partner = true
|
||||
end
|
||||
if $PokemonGlobal.partner && !$PokemonTemp.battleRules["noPartner"] && room_for_partner
|
||||
ally = PokeBattle_Trainer.new($PokemonGlobal.partner[1],$PokemonGlobal.partner[0])
|
||||
ally.id = $PokemonGlobal.partner[2]
|
||||
ally.party = $PokemonGlobal.partner[3]
|
||||
@@ -553,6 +564,7 @@ def pbAfterBattle(decision,canLose)
|
||||
end
|
||||
end
|
||||
Events.onEndBattle.trigger(nil,decision,canLose)
|
||||
$game_player.straighten
|
||||
end
|
||||
|
||||
Events.onEndBattle += proc { |_sender,e|
|
||||
|
||||
@@ -2,7 +2,7 @@ class PokemonTemp
|
||||
attr_writer :dependentEvents
|
||||
|
||||
def dependentEvents
|
||||
@dependentEvents=DependentEvents.new if !@dependentEvents
|
||||
@dependentEvents = DependentEvents.new if !@dependentEvents
|
||||
return @dependentEvents
|
||||
end
|
||||
end
|
||||
@@ -41,7 +41,8 @@ class PokemonGlobalMetadata
|
||||
attr_writer :dependentEvents
|
||||
|
||||
def dependentEvents
|
||||
return @dependentEvents || []
|
||||
@dependentEvents = [] if !@dependentEvents
|
||||
return @dependentEvents
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -953,6 +953,7 @@ ItemHandlers::UseOnPokemon.add(:DNASPLICERS,proc { |item,pkmn,scene|
|
||||
end
|
||||
if pkmn.fainted?
|
||||
scene.pbDisplay(_INTL("This can't be used on the fainted Pokémon."))
|
||||
next false
|
||||
end
|
||||
# Fusing
|
||||
if pkmn.fused==nil
|
||||
@@ -961,13 +962,17 @@ ItemHandlers::UseOnPokemon.add(:DNASPLICERS,proc { |item,pkmn,scene|
|
||||
poke2 = $Trainer.party[chosen]
|
||||
if pkmn==poke2
|
||||
scene.pbDisplay(_INTL("It cannot be fused with itself."))
|
||||
next false
|
||||
elsif poke2.egg?
|
||||
scene.pbDisplay(_INTL("It cannot be fused with an Egg."))
|
||||
next false
|
||||
elsif poke2.fainted?
|
||||
scene.pbDisplay(_INTL("It cannot be fused with that fainted Pokémon."))
|
||||
next false
|
||||
elsif !poke2.isSpecies?(:RESHIRAM) &&
|
||||
!poke2.isSpecies?(:ZEKROM)
|
||||
scene.pbDisplay(_INTL("It cannot be fused with that Pokémon."))
|
||||
next false
|
||||
end
|
||||
newForm = 0
|
||||
newForm = 1 if poke2.isSpecies?(:RESHIRAM)
|
||||
@@ -995,12 +1000,13 @@ ItemHandlers::UseOnPokemon.add(:DNASPLICERS,proc { |item,pkmn,scene|
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:NSOLARIZER,proc { |item,pkmn,scene|
|
||||
if !pkmn.isSpecies?(:NECROZMA) || pkmn.form==0
|
||||
if !pkmn.isSpecies?(:NECROZMA) || pkmn.form == 2
|
||||
scene.pbDisplay(_INTL("It had no effect."))
|
||||
next false
|
||||
end
|
||||
if pkmn.fainted?
|
||||
scene.pbDisplay(_INTL("This can't be used on the fainted Pokémon."))
|
||||
next false
|
||||
end
|
||||
# Fusing
|
||||
if pkmn.fused==nil
|
||||
@@ -1009,12 +1015,16 @@ ItemHandlers::UseOnPokemon.add(:NSOLARIZER,proc { |item,pkmn,scene|
|
||||
poke2 = $Trainer.party[chosen]
|
||||
if pkmn==poke2
|
||||
scene.pbDisplay(_INTL("It cannot be fused with itself."))
|
||||
next false
|
||||
elsif poke2.egg?
|
||||
scene.pbDisplay(_INTL("It cannot be fused with an Egg."))
|
||||
next false
|
||||
elsif poke2.fainted?
|
||||
scene.pbDisplay(_INTL("It cannot be fused with that fainted Pokémon."))
|
||||
next false
|
||||
elsif !poke2.isSpecies?(:SOLGALEO)
|
||||
scene.pbDisplay(_INTL("It cannot be fused with that Pokémon."))
|
||||
next false
|
||||
end
|
||||
pkmn.setForm(1) {
|
||||
pkmn.fused = poke2
|
||||
@@ -1039,12 +1049,13 @@ ItemHandlers::UseOnPokemon.add(:NSOLARIZER,proc { |item,pkmn,scene|
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:NLUNARIZER,proc { |item,pkmn,scene|
|
||||
if !pkmn.isSpecies?(:NECROZMA) || pkmn.form==1
|
||||
if !pkmn.isSpecies?(:NECROZMA) || pkmn.form == 1
|
||||
scene.pbDisplay(_INTL("It had no effect."))
|
||||
next false
|
||||
end
|
||||
if pkmn.fainted?
|
||||
scene.pbDisplay(_INTL("This can't be used on the fainted Pokémon."))
|
||||
next false
|
||||
end
|
||||
# Fusing
|
||||
if pkmn.fused==nil
|
||||
@@ -1053,12 +1064,16 @@ ItemHandlers::UseOnPokemon.add(:NLUNARIZER,proc { |item,pkmn,scene|
|
||||
poke2 = $Trainer.party[chosen]
|
||||
if pkmn==poke2
|
||||
scene.pbDisplay(_INTL("It cannot be fused with itself."))
|
||||
next false
|
||||
elsif poke2.egg?
|
||||
scene.pbDisplay(_INTL("It cannot be fused with an Egg."))
|
||||
next false
|
||||
elsif poke2.fainted?
|
||||
scene.pbDisplay(_INTL("It cannot be fused with that fainted Pokémon."))
|
||||
next false
|
||||
elsif !poke2.isSpecies?(:LUNALA)
|
||||
scene.pbDisplay(_INTL("It cannot be fused with that Pokémon."))
|
||||
next false
|
||||
end
|
||||
pkmn.setForm(2) {
|
||||
pkmn.fused = poke2
|
||||
|
||||
@@ -77,7 +77,7 @@ def pbAddPokemon(pokemon,level=nil,seeform=true)
|
||||
pokemon = Pokemon.new(pokemon,level)
|
||||
end
|
||||
speciesname = PBSpecies.getName(pokemon.species)
|
||||
pbMessage(_INTL("\\me[Pkmn get]{1} obtained {2}!\1",$Trainer.name,speciesname))
|
||||
pbMessage(_INTL("{1} obtained {2}!\\me[Pkmn get]\\wtnp[80]\1",$Trainer.name,speciesname))
|
||||
pbNicknameAndStore(pokemon)
|
||||
pbSeenForm(pokemon) if seeform
|
||||
return true
|
||||
@@ -113,7 +113,7 @@ def pbAddToParty(pokemon,level=nil,seeform=true)
|
||||
pokemon = Pokemon.new(pokemon,level)
|
||||
end
|
||||
speciesname = PBSpecies.getName(pokemon.species)
|
||||
pbMessage(_INTL("\\me[Pkmn get]{1} obtained {2}!\1",$Trainer.name,speciesname))
|
||||
pbMessage(_INTL("{1} obtained {2}!\\me[Pkmn get]\\wtnp[80]\1",$Trainer.name,speciesname))
|
||||
pbNicknameAndStore(pokemon)
|
||||
pbSeenForm(pokemon) if seeform
|
||||
return true
|
||||
|
||||
@@ -208,6 +208,8 @@ def pbDebugMenuCommands(showall=true)
|
||||
_INTL("Fully compile all data."))
|
||||
commands.add("othermenu","debugconsole",_INTL("Debug Console"),
|
||||
_INTL("Open the Debug Console."))
|
||||
commands.add("othermenu","invalidtiles",_INTL("Fix Invalid Tiles"),
|
||||
_INTL("Scans all maps and erases non-existent tiles."))
|
||||
|
||||
return commands
|
||||
end
|
||||
@@ -366,7 +368,7 @@ def pbDebugMenuActions(cmd="",sprites=nil,viewport=nil)
|
||||
battle = pbListScreen(_INTL("SINGLE TRAINER"),TrainerBattleLister.new(0,false))
|
||||
if battle
|
||||
trainerdata = battle[1]
|
||||
pbTrainerBattle(trainerdata[0],trainerdata[1],"...",false,trainerdata[4],true)
|
||||
pbTrainerBattle(trainerdata[0],trainerdata[1],nil,false,trainerdata[4],true)
|
||||
end
|
||||
when "testtrainerbattleadvanced"
|
||||
trainers = []
|
||||
@@ -791,6 +793,8 @@ def pbDebugMenuActions(cmd="",sprites=nil,viewport=nil)
|
||||
pbDisposeMessageWindow(msgwindow)
|
||||
when "debugconsole"
|
||||
Console::setup_console
|
||||
when "invalidtiles"
|
||||
pbDebugFixInvalidTiles
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
@@ -796,6 +796,76 @@ def pbImportAllAnimations
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Properly erases all non-existent tiles in maps (including event graphics)
|
||||
#===============================================================================
|
||||
def pbDebugFixInvalidTiles
|
||||
num_errors = 0
|
||||
num_error_maps = 0
|
||||
@tilesets = pbLoadRxData("Data/Tilesets")
|
||||
mapData = MapData.new
|
||||
t = Time.now.to_i
|
||||
Graphics.update
|
||||
for id in mapData.mapinfos.keys.sort
|
||||
if Time.now.to_i - t >= 5
|
||||
Graphics.update
|
||||
t = Time.now.to_i
|
||||
end
|
||||
changed = false
|
||||
map = mapData.getMap(id)
|
||||
next if !map || !mapData.mapinfos[id]
|
||||
Win32API.SetWindowText(_INTL("Processing map {1} ({2})", id, mapData.mapinfos[id].name))
|
||||
passages = mapData.getTilesetPassages(map, id)
|
||||
# Check all tiles in map for non-existent tiles
|
||||
for x in 0...map.data.xsize
|
||||
for y in 0...map.data.ysize
|
||||
for i in 0...map.data.zsize
|
||||
tile_id = map.data[x, y, i]
|
||||
next if pbCheckTileValidity(tile_id, map, @tilesets, passages)
|
||||
map.data[x, y, i] = 0
|
||||
changed = true
|
||||
num_errors += 1
|
||||
end
|
||||
end
|
||||
end
|
||||
# Check all events in map for page graphics using a non-existent tile
|
||||
for key in map.events.keys
|
||||
event = map.events[key]
|
||||
for page in event.pages
|
||||
next if page.graphic.tile_id <= 0
|
||||
next if pbCheckTileValidity(page.graphic.tile_id, map, @tilesets, passages)
|
||||
page.graphic.tile_id = 0
|
||||
changed = true
|
||||
num_errors += 1
|
||||
end
|
||||
end
|
||||
next if !changed
|
||||
# Map was changed; save it
|
||||
num_error_maps += 1
|
||||
mapData.saveMap(id)
|
||||
end
|
||||
if num_error_maps == 0
|
||||
pbMessage(_INTL("No invalid tiles were found."))
|
||||
else
|
||||
pbMessage(_INTL("{1} error(s) were found across {2} map(s) and fixed.", num_errors, num_error_maps))
|
||||
pbMessage(_INTL("Close RPG Maker XP to ensure the changes are applied properly."))
|
||||
end
|
||||
end
|
||||
|
||||
def pbCheckTileValidity(tile_id, map, tilesets, passages)
|
||||
return false if !tile_id
|
||||
if tile_id > 0 && tile_id < 384
|
||||
# Check for defined autotile
|
||||
autotile_id = tile_id / 48 - 1
|
||||
autotile_name = tilesets[map.tileset_id].autotile_names[autotile_id]
|
||||
return true if autotile_name && autotile_name != ""
|
||||
else
|
||||
# Check for tileset data
|
||||
return true if passages[tile_id]
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
|
||||
Reference in New Issue
Block a user