wild fusions

This commit is contained in:
infinitefusion
2022-04-30 11:22:01 -04:00
parent 56544412ca
commit ce93ca7919
6 changed files with 529 additions and 495 deletions

View File

@@ -32,7 +32,6 @@ module RPG
end end
def self.need_clearing() def self.need_clearing()
p @cache.size
return @cache.size >= 100 return @cache.size >= 100
end end

View File

@@ -2,11 +2,11 @@
# Constant checks # Constant checks
#=============================================================================== #===============================================================================
# Pokérus check # Pokérus check
Events.onMapUpdate += proc { |_sender,_e| Events.onMapUpdate += proc { |_sender, _e|
next if !$Trainer next if !$Trainer
last = $PokemonGlobal.pokerusTime last = $PokemonGlobal.pokerusTime
now = pbGetTimeNow now = pbGetTimeNow
if !last || last.year!=now.year || last.month!=now.month || last.day!=now.day if !last || last.year != now.year || last.month != now.month || last.day != now.day
for i in $Trainer.pokemon_party for i in $Trainer.pokemon_party
i.lowerPokerusCount i.lowerPokerusCount
end end
@@ -19,21 +19,17 @@ Events.onMapUpdate += proc { |_sender,_e|
def pbPokerus? def pbPokerus?
return false if $game_switches[Settings::SEEN_POKERUS_SWITCH] return false if $game_switches[Settings::SEEN_POKERUS_SWITCH]
for i in $Trainer.party for i in $Trainer.party
return true if i.pokerusStage==1 return true if i.pokerusStage == 1
end end
return false return false
end end
class PokemonTemp class PokemonTemp
attr_accessor :batterywarning attr_accessor :batterywarning
attr_accessor :cueBGM attr_accessor :cueBGM
attr_accessor :cueFrames attr_accessor :cueFrames
end end
def pbBatteryLow? def pbBatteryLow?
pstate = System.power_state pstate = System.power_state
# If it's not discharging, it doesn't matter if it's low # If it's not discharging, it doesn't matter if it's low
@@ -46,12 +42,12 @@ def pbBatteryLow?
return false return false
end end
Events.onMapUpdate += proc { |_sender,_e| Events.onMapUpdate += proc { |_sender, _e|
if !$PokemonTemp.batterywarning && pbBatteryLow? if !$PokemonTemp.batterywarning && pbBatteryLow?
if !$game_temp.in_menu && !$game_temp.in_battle && if !$game_temp.in_menu && !$game_temp.in_battle &&
!$game_player.move_route_forcing && !$game_temp.message_window_showing && !$game_player.move_route_forcing && !$game_temp.message_window_showing &&
!pbMapInterpreterRunning? !pbMapInterpreterRunning?
if pbGetTimeNow.sec==0 if pbGetTimeNow.sec == 0
pbMessage(_INTL("The game has detected that the battery is low. You should save soon to avoid losing your progress.")) pbMessage(_INTL("The game has detected that the battery is low. You should save soon to avoid losing your progress."))
$PokemonTemp.batterywarning = true $PokemonTemp.batterywarning = true
end end
@@ -59,17 +55,15 @@ Events.onMapUpdate += proc { |_sender,_e|
end end
if $PokemonTemp.cueFrames if $PokemonTemp.cueFrames
$PokemonTemp.cueFrames -= 1 $PokemonTemp.cueFrames -= 1
if $PokemonTemp.cueFrames<=0 if $PokemonTemp.cueFrames <= 0
$PokemonTemp.cueFrames = nil $PokemonTemp.cueFrames = nil
if $game_system.getPlayingBGM==nil if $game_system.getPlayingBGM == nil
pbBGMPlay($PokemonTemp.cueBGM) pbBGMPlay($PokemonTemp.cueBGM)
end end
end end
end end
} }
#=============================================================================== #===============================================================================
# Checks per step # Checks per step
#=============================================================================== #===============================================================================
@@ -77,19 +71,19 @@ Events.onMapUpdate += proc { |_sender,_e|
Events.onStepTaken += proc { Events.onStepTaken += proc {
$PokemonGlobal.happinessSteps = 0 if !$PokemonGlobal.happinessSteps $PokemonGlobal.happinessSteps = 0 if !$PokemonGlobal.happinessSteps
$PokemonGlobal.happinessSteps += 1 $PokemonGlobal.happinessSteps += 1
if $PokemonGlobal.happinessSteps>=128 if $PokemonGlobal.happinessSteps >= 128
for pkmn in $Trainer.able_party for pkmn in $Trainer.able_party
pkmn.changeHappiness("walking") if rand(2)==0 pkmn.changeHappiness("walking") if rand(2) == 0
end end
$PokemonGlobal.happinessSteps = 0 $PokemonGlobal.happinessSteps = 0
end end
} }
# Poison party Pokémon # Poison party Pokémon
Events.onStepTakenTransferPossible += proc { |_sender,e| Events.onStepTakenTransferPossible += proc { |_sender, e|
handled = e[0] handled = e[0]
next if handled[0] next if handled[0]
if $PokemonGlobal.stepcount%4==0 && Settings::POISON_IN_FIELD if $PokemonGlobal.stepcount % 4 == 0 && Settings::POISON_IN_FIELD
flashed = false flashed = false
for i in $Trainer.able_party for i in $Trainer.able_party
if i.status == :POISON && !i.hasAbility?(:IMMUNITY) if i.status == :POISON && !i.hasAbility?(:IMMUNITY)
@@ -97,15 +91,15 @@ Events.onStepTakenTransferPossible += proc { |_sender,e|
pbFlash(Color.new(163, 73, 164, 128), 8) pbFlash(Color.new(163, 73, 164, 128), 8)
flashed = true flashed = true
end end
i.hp -= 1 if i.hp>1 || Settings::POISON_FAINT_IN_FIELD i.hp -= 1 if i.hp > 1 || Settings::POISON_FAINT_IN_FIELD
if i.hp==1 && !Settings::POISON_FAINT_IN_FIELD if i.hp == 1 && !Settings::POISON_FAINT_IN_FIELD
i.status = :NONE i.status = :NONE
pbMessage(_INTL("{1} survived the poisoning.\\nThe poison faded away!\1",i.name)) pbMessage(_INTL("{1} survived the poisoning.\\nThe poison faded away!\1", i.name))
next next
elsif i.hp==0 elsif i.hp == 0
i.changeHappiness("faint") i.changeHappiness("faint")
i.status = :NONE i.status = :NONE
pbMessage(_INTL("{1} fainted...",i.name)) pbMessage(_INTL("{1} fainted...", i.name))
end end
if $Trainer.able_pokemon_count == 0 if $Trainer.able_pokemon_count == 0
handled[0] = true handled[0] = true
@@ -127,19 +121,19 @@ def pbCheckAllFainted
end end
# Gather soot from soot grass # Gather soot from soot grass
Events.onStepTakenFieldMovement += proc { |_sender,e| Events.onStepTakenFieldMovement += proc { |_sender, e|
event = e[0] # Get the event affected by field movement event = e[0] # Get the event affected by field movement
thistile = $MapFactory.getRealTilePos(event.map.map_id,event.x,event.y) thistile = $MapFactory.getRealTilePos(event.map.map_id, event.x, event.y)
map = $MapFactory.getMap(thistile[0]) map = $MapFactory.getMap(thistile[0])
for i in [2, 1, 0] for i in [2, 1, 0]
tile_id = map.data[thistile[1],thistile[2],i] tile_id = map.data[thistile[1], thistile[2], i]
next if tile_id == nil next if tile_id == nil
next if GameData::TerrainTag.try_get(map.terrain_tags[tile_id]).id != :SootGrass next if GameData::TerrainTag.try_get(map.terrain_tags[tile_id]).id != :SootGrass
if event == $game_player && GameData::Item.exists?(:SOOTSACK) if event == $game_player && GameData::Item.exists?(:SOOTSACK)
$Trainer.soot += 1 if $PokemonBag.pbHasItem?(:SOOTSACK) $Trainer.soot += 1 if $PokemonBag.pbHasItem?(:SOOTSACK)
end end
# map.data[thistile[1], thistile[2], i] = 0 # map.data[thistile[1], thistile[2], i] = 0
# $scene.createSingleSpriteset(map.map_id) # $scene.createSingleSpriteset(map.map_id)
break break
end end
} }
@@ -168,7 +162,7 @@ Events.onStepTakenFieldMovement += proc { |_sender, e|
def pbOnStepTaken(eventTriggered) def pbOnStepTaken(eventTriggered)
if $game_player.move_route_forcing || pbMapInterpreterRunning? if $game_player.move_route_forcing || pbMapInterpreterRunning?
Events.onStepTakenFieldMovement.trigger(nil,$game_player) Events.onStepTakenFieldMovement.trigger(nil, $game_player)
return return
end end
$PokemonGlobal.stepcount = 0 if !$PokemonGlobal.stepcount $PokemonGlobal.stepcount = 0 if !$PokemonGlobal.stepcount
@@ -177,9 +171,9 @@ def pbOnStepTaken(eventTriggered)
repel_active = ($PokemonGlobal.repel > 0) || $PokemonTemp.pokeradar repel_active = ($PokemonGlobal.repel > 0) || $PokemonTemp.pokeradar
Events.onStepTaken.trigger(nil) Events.onStepTaken.trigger(nil)
# Events.onStepTakenFieldMovement.trigger(nil,$game_player) # Events.onStepTakenFieldMovement.trigger(nil,$game_player)
handled = [nil] handled = [nil]
Events.onStepTakenTransferPossible.trigger(nil,handled) Events.onStepTakenTransferPossible.trigger(nil, handled)
return if handled[0] return if handled[0]
pbBattleOnStepTaken(repel_active) if !eventTriggered && !$game_temp.in_menu pbBattleOnStepTaken(repel_active) if !eventTriggered && !$game_temp.in_menu
$PokemonTemp.encounterTriggered = false # This info isn't needed here $PokemonTemp.encounterTriggered = false # This info isn't needed here
@@ -191,6 +185,19 @@ Events.onChangeDirection += proc {
pbBattleOnStepTaken(repel_active) if !$game_temp.in_menu pbBattleOnStepTaken(repel_active) if !$game_temp.in_menu
} }
def isFusionForced?
return false if $game_switches[RANDOMIZED_WILD_POKEMON_SWITCH]
return $game_switches[FORCE_FUSE_NEXT_POKEMON_SWITCH] || $game_switches[FORCE_ALL_WILD_FUSIONS_SWITCH]
end
def isFusedEncounter
return false if !FUSED_WILD_POKEMON_SWITCH[35]
return false if $game_switches[RANDOMIZED_WILD_POKEMON_SWITCH]
return true if isFusionForced?()
chance = pbGet(WILD_FUSION_RATE_VAR) == 0 ? 5 : pbGet(WILD_FUSION_RATE_VAR)
return (rand(chance) == 0)
end
def pbBattleOnStepTaken(repel_active) def pbBattleOnStepTaken(repel_active)
return if $Trainer.able_pokemon_count == 0 return if $Trainer.able_pokemon_count == 0
return if !$PokemonEncounters.encounter_possible_here? return if !$PokemonEncounters.encounter_possible_here?
@@ -199,6 +206,14 @@ def pbBattleOnStepTaken(repel_active)
return if !$PokemonEncounters.encounter_triggered?(encounter_type, repel_active) return if !$PokemonEncounters.encounter_triggered?(encounter_type, repel_active)
$PokemonTemp.encounterType = encounter_type $PokemonTemp.encounterType = encounter_type
encounter = $PokemonEncounters.choose_wild_pokemon(encounter_type) encounter = $PokemonEncounters.choose_wild_pokemon(encounter_type)
if isFusedEncounter()
encounter_fusedWith = $PokemonEncounters.choose_wild_pokemon(encounter_type)
if encounter[0] != encounter_fusedWith[0]
encounter[0] = getFusionSpecies(encounter[0], encounter_fusedWith[0])
end
end
$game_switches[FORCE_FUSE_NEXT_POKEMON_SWITCH] = false
encounter = EncounterModifier.trigger(encounter) encounter = EncounterModifier.trigger(encounter)
if $PokemonEncounters.allow_encounter?(encounter, repel_active) if $PokemonEncounters.allow_encounter?(encounter, repel_active)
if $PokemonEncounters.have_double_wild_battle? if $PokemonEncounters.have_double_wild_battle?
@@ -215,8 +230,6 @@ def pbBattleOnStepTaken(repel_active)
EncounterModifier.triggerEncounterEnd EncounterModifier.triggerEncounterEnd
end end
#=============================================================================== #===============================================================================
# Checks when moving between maps # Checks when moving between maps
#=============================================================================== #===============================================================================
@@ -307,15 +320,13 @@ Events.onMapSceneChange += proc { |_sender, e|
end end
} }
#=============================================================================== #===============================================================================
# Event locations, terrain tags # Event locations, terrain tags
#=============================================================================== #===============================================================================
# NOTE: Assumes the event is 1x1 tile in size. Only returns one tile. # NOTE: Assumes the event is 1x1 tile in size. Only returns one tile.
def pbFacingTile(direction=nil,event=nil) def pbFacingTile(direction = nil, event = nil)
return $MapFactory.getFacingTile(direction,event) if $MapFactory return $MapFactory.getFacingTile(direction, event) if $MapFactory
return pbFacingTileRegular(direction,event) return pbFacingTileRegular(direction, event)
end end
# NOTE: Assumes the event is 1x1 tile in size. Only returns one tile. # NOTE: Assumes the event is 1x1 tile in size. Only returns one tile.
@@ -392,21 +403,19 @@ def pbFacingEachOther(event1, event2)
return pbEventFacesPlayer?(event1, event2, 1) && pbEventFacesPlayer?(event2, event1, 1) return pbEventFacesPlayer?(event1, event2, 1) && pbEventFacesPlayer?(event2, event1, 1)
end end
#=============================================================================== #===============================================================================
# Audio playing # Audio playing
#=============================================================================== #===============================================================================
def pbCueBGM(bgm,seconds,volume=nil,pitch=nil) def pbCueBGM(bgm, seconds, volume = nil, pitch = nil)
return if !bgm return if !bgm
bgm = pbResolveAudioFile(bgm,volume,pitch) bgm = pbResolveAudioFile(bgm, volume, pitch)
playingBGM = $game_system.playing_bgm playingBGM = $game_system.playing_bgm
if !playingBGM || playingBGM.name!=bgm.name || playingBGM.pitch!=bgm.pitch if !playingBGM || playingBGM.name != bgm.name || playingBGM.pitch != bgm.pitch
pbBGMFade(seconds) pbBGMFade(seconds)
if !$PokemonTemp.cueFrames if !$PokemonTemp.cueFrames
$PokemonTemp.cueFrames = (seconds*Graphics.frame_rate)*3/5 $PokemonTemp.cueFrames = (seconds * Graphics.frame_rate) * 3 / 5
end end
$PokemonTemp.cueBGM=bgm $PokemonTemp.cueBGM = bgm
elsif playingBGM elsif playingBGM
pbBGMPlay(bgm) pbBGMPlay(bgm)
end end
@@ -430,8 +439,6 @@ def pbAutoplayOnSave
end end
end end
#=============================================================================== #===============================================================================
# Event movement # Event movement
#=============================================================================== #===============================================================================
@@ -484,32 +491,30 @@ module PBMoveRoute
ScriptAsync = 101 # 1 param ScriptAsync = 101 # 1 param
end end
def pbMoveRoute(event, commands, waitComplete = false)
def pbMoveRoute(event,commands,waitComplete=false)
route = RPG::MoveRoute.new route = RPG::MoveRoute.new
route.repeat = false route.repeat = false
route.skippable = true route.skippable = true
route.list.clear route.list.clear
route.list.push(RPG::MoveCommand.new(PBMoveRoute::ThroughOn)) route.list.push(RPG::MoveCommand.new(PBMoveRoute::ThroughOn))
i=0 i = 0
while i<commands.length while i < commands.length
case commands[i] case commands[i]
when PBMoveRoute::Wait, PBMoveRoute::SwitchOn, PBMoveRoute::SwitchOff, when PBMoveRoute::Wait, PBMoveRoute::SwitchOn, PBMoveRoute::SwitchOff,
PBMoveRoute::ChangeSpeed, PBMoveRoute::ChangeFreq, PBMoveRoute::Opacity, PBMoveRoute::ChangeSpeed, PBMoveRoute::ChangeFreq, PBMoveRoute::Opacity,
PBMoveRoute::Blending, PBMoveRoute::PlaySE, PBMoveRoute::Script PBMoveRoute::Blending, PBMoveRoute::PlaySE, PBMoveRoute::Script
route.list.push(RPG::MoveCommand.new(commands[i],[commands[i+1]])) route.list.push(RPG::MoveCommand.new(commands[i], [commands[i + 1]]))
i += 1 i += 1
when PBMoveRoute::ScriptAsync when PBMoveRoute::ScriptAsync
route.list.push(RPG::MoveCommand.new(PBMoveRoute::Script,[commands[i+1]])) route.list.push(RPG::MoveCommand.new(PBMoveRoute::Script, [commands[i + 1]]))
route.list.push(RPG::MoveCommand.new(PBMoveRoute::Wait,[0])) route.list.push(RPG::MoveCommand.new(PBMoveRoute::Wait, [0]))
i += 1 i += 1
when PBMoveRoute::Jump when PBMoveRoute::Jump
route.list.push(RPG::MoveCommand.new(commands[i],[commands[i+1],commands[i+2]])) route.list.push(RPG::MoveCommand.new(commands[i], [commands[i + 1], commands[i + 2]]))
i += 2 i += 2
when PBMoveRoute::Graphic when PBMoveRoute::Graphic
route.list.push(RPG::MoveCommand.new(commands[i], route.list.push(RPG::MoveCommand.new(commands[i],
[commands[i+1],commands[i+2],commands[i+3],commands[i+4]])) [commands[i + 1], commands[i + 2], commands[i + 3], commands[i + 4]]))
i += 4 i += 4
else else
route.list.push(RPG::MoveCommand.new(commands[i])) route.list.push(RPG::MoveCommand.new(commands[i]))
@@ -532,17 +537,15 @@ def pbWait(numFrames)
end end
end end
#=============================================================================== #===============================================================================
# Player/event movement in the field # Player/event movement in the field
#=============================================================================== #===============================================================================
def pbLedge(_xOffset,_yOffset) def pbLedge(_xOffset, _yOffset)
if $game_player.pbFacingTerrainTag.ledge if $game_player.pbFacingTerrainTag.ledge
if pbJumpToward(2,true) if pbJumpToward(2, true)
$scene.spriteset.addUserAnimation(Settings::DUST_ANIMATION_ID,$game_player.x,$game_player.y,true,1) $scene.spriteset.addUserAnimation(Settings::DUST_ANIMATION_ID, $game_player.x, $game_player.y, true, 1)
$game_player.increase_steps $game_player.increase_steps
$game_player.check_event_trigger_here([1,2]) $game_player.check_event_trigger_here([1, 2])
end end
return true return true
end end
@@ -582,13 +585,13 @@ def pbSlideOnWater
loop do loop do
break if !$game_player.can_move_in_direction?(direction) break if !$game_player.can_move_in_direction?(direction)
break if !$game_player.pbTerrainTag.waterCurrent break if !$game_player.pbTerrainTag.waterCurrent
if $game_map.passable?($game_player.x,$game_player.y,8) if $game_map.passable?($game_player.x, $game_player.y, 8)
$game_player.move_up $game_player.move_up
elsif $game_map.passable?($game_player.x,$game_player.y,4) elsif $game_map.passable?($game_player.x, $game_player.y, 4)
$game_player.move_left $game_player.move_left
elsif $game_map.passable?($game_player.x,$game_player.y,6) elsif $game_map.passable?($game_player.x, $game_player.y, 6)
$game_player.move_right $game_player.move_right
elsif $game_map.passable?($game_player.x,$game_player.y,2) elsif $game_map.passable?($game_player.x, $game_player.y, 2)
$game_player.move_down $game_player.move_down
end end
while $game_player.moving? while $game_player.moving?
@@ -603,11 +606,11 @@ def pbSlideOnWater
$PokemonGlobal.sliding = false $PokemonGlobal.sliding = false
end end
def pbTurnTowardEvent(event,otherEvent) def pbTurnTowardEvent(event, otherEvent)
sx = 0 sx = 0
sy = 0 sy = 0
if $MapFactory if $MapFactory
relativePos = $MapFactory.getThisAndOtherEventRelativePos(otherEvent,event) relativePos = $MapFactory.getThisAndOtherEventRelativePos(otherEvent, event)
sx = relativePos[0] sx = relativePos[0]
sy = relativePos[1] sy = relativePos[1]
else else
@@ -641,16 +644,20 @@ def pbMoveTowardPlayer(event)
$PokemonMap.addMovedEvent(event.id) if $PokemonMap $PokemonMap.addMovedEvent(event.id) if $PokemonMap
end end
def pbJumpToward(dist=1,playSound=false,cancelSurf=false) def pbJumpToward(dist = 1, playSound = false, cancelSurf = false)
x = $game_player.x x = $game_player.x
y = $game_player.y y = $game_player.y
case $game_player.direction case $game_player.direction
when 2 then $game_player.jump(0, dist) # down when 2 then
when 4 then $game_player.jump(-dist, 0) # left $game_player.jump(0, dist) # down
when 6 then $game_player.jump(dist, 0) # right when 4 then
when 8 then $game_player.jump(0, -dist) # up $game_player.jump(-dist, 0) # left
when 6 then
$game_player.jump(dist, 0) # right
when 8 then
$game_player.jump(0, -dist) # up
end end
if $game_player.x!=x || $game_player.y!=y if $game_player.x != x || $game_player.y != y
pbSEPlay("Player jump") if playSound pbSEPlay("Player jump") if playSound
$PokemonEncounters.reset_step_count if cancelSurf $PokemonEncounters.reset_step_count if cancelSurf
$PokemonTemp.endSurf = true if cancelSurf $PokemonTemp.endSurf = true if cancelSurf
@@ -664,12 +671,10 @@ def pbJumpToward(dist=1,playSound=false,cancelSurf=false)
return false return false
end end
#=============================================================================== #===============================================================================
# Bridges, cave escape points, and setting the heal point # Bridges, cave escape points, and setting the heal point
#=============================================================================== #===============================================================================
def pbBridgeOn(height=2) def pbBridgeOn(height = 2)
$PokemonGlobal.bridge = height $PokemonGlobal.bridge = height
end end
@@ -695,7 +700,7 @@ def pbSetEscapePoint
yco += 1 yco += 1
dir = 2 dir = 2
end end
$PokemonGlobal.escapePoint = [$game_map.map_id,xco,yco,dir] $PokemonGlobal.escapePoint = [$game_map.map_id, xco, yco, dir]
end end
def pbEraseEscapePoint def pbEraseEscapePoint
@@ -709,8 +714,6 @@ def pbSetPokemonCenter
$PokemonGlobal.pokecenterDirection = $game_player.direction $PokemonGlobal.pokecenterDirection = $game_player.direction
end end
#=============================================================================== #===============================================================================
# Partner trainer # Partner trainer
#=============================================================================== #===============================================================================
@@ -730,77 +733,73 @@ def pbDeregisterPartner
$PokemonGlobal.partner = nil $PokemonGlobal.partner = nil
end end
#=============================================================================== #===============================================================================
# Picking up an item found on the ground # Picking up an item found on the ground
#=============================================================================== #===============================================================================
def pbItemBall(item,quantity=1,item_name="",canRandom=true) def pbItemBall(item, quantity = 1, item_name = "", canRandom = true)
item = GameData::Item.get(item) item = GameData::Item.get(item)
return false if !item || quantity<1 return false if !item || quantity < 1
itemname = (quantity>1) ? item.name_plural : item.name itemname = (quantity > 1) ? item.name_plural : item.name
pocket = item.pocket pocket = item.pocket
move = item.move move = item.move
if $PokemonBag.pbStoreItem(item,quantity) # If item can be picked up if $PokemonBag.pbStoreItem(item, quantity) # If item can be picked up
meName = (item.is_key_item?) ? "Key item get" : "Item get" meName = (item.is_key_item?) ? "Key item get" : "Item get"
if item == :LEFTOVERS if item == :LEFTOVERS
pbMessage(_INTL("\\me[{1}]You found some \\c[1]{2}\\c[0]!\\wtnp[30]",meName,itemname)) pbMessage(_INTL("\\me[{1}]You found some \\c[1]{2}\\c[0]!\\wtnp[30]", meName, itemname))
elsif item.is_machine? # TM or HM elsif item.is_machine? # TM or HM
pbMessage(_INTL("\\me[{1}]You found \\c[1]{2} {3}\\c[0]!\\wtnp[30]",meName,itemname,GameData::Move.get(move).name)) pbMessage(_INTL("\\me[{1}]You found \\c[1]{2} {3}\\c[0]!\\wtnp[30]", meName, itemname, GameData::Move.get(move).name))
elsif quantity>1 elsif quantity > 1
pbMessage(_INTL("\\me[{1}]You found {2} \\c[1]{3}\\c[0]!\\wtnp[30]",meName,quantity,itemname)) pbMessage(_INTL("\\me[{1}]You found {2} \\c[1]{3}\\c[0]!\\wtnp[30]", meName, quantity, itemname))
elsif itemname.starts_with_vowel? elsif itemname.starts_with_vowel?
pbMessage(_INTL("\\me[{1}]You found an \\c[1]{2}\\c[0]!\\wtnp[30]",meName,itemname)) pbMessage(_INTL("\\me[{1}]You found an \\c[1]{2}\\c[0]!\\wtnp[30]", meName, itemname))
else else
pbMessage(_INTL("\\me[{1}]You found a \\c[1]{2}\\c[0]!\\wtnp[30]",meName,itemname)) pbMessage(_INTL("\\me[{1}]You found a \\c[1]{2}\\c[0]!\\wtnp[30]", meName, itemname))
end end
pbMessage(_INTL("You put the {1} away\\nin the <icon=bagPocket{2}>\\c[1]{3} Pocket\\c[0].", pbMessage(_INTL("You put the {1} away\\nin the <icon=bagPocket{2}>\\c[1]{3} Pocket\\c[0].",
itemname,pocket,PokemonBag.pocketNames()[pocket])) itemname, pocket, PokemonBag.pocketNames()[pocket]))
return true return true
end end
# Can't add the item # Can't add the item
if item == :LEFTOVERS if item == :LEFTOVERS
pbMessage(_INTL("You found some \\c[1]{1}\\c[0]!\\wtnp[30]",itemname)) pbMessage(_INTL("You found some \\c[1]{1}\\c[0]!\\wtnp[30]", itemname))
elsif item.is_machine? # TM or HM elsif item.is_machine? # TM or HM
pbMessage(_INTL("You found \\c[1]{1} {2}\\c[0]!\\wtnp[30]",itemname,GameData::Move.get(move).name)) pbMessage(_INTL("You found \\c[1]{1} {2}\\c[0]!\\wtnp[30]", itemname, GameData::Move.get(move).name))
elsif quantity>1 elsif quantity > 1
pbMessage(_INTL("You found {1} \\c[1]{2}\\c[0]!\\wtnp[30]",quantity,itemname)) pbMessage(_INTL("You found {1} \\c[1]{2}\\c[0]!\\wtnp[30]", quantity, itemname))
elsif itemname.starts_with_vowel? elsif itemname.starts_with_vowel?
pbMessage(_INTL("You found an \\c[1]{1}\\c[0]!\\wtnp[30]",itemname)) pbMessage(_INTL("You found an \\c[1]{1}\\c[0]!\\wtnp[30]", itemname))
else else
pbMessage(_INTL("You found a \\c[1]{1}\\c[0]!\\wtnp[30]",itemname)) pbMessage(_INTL("You found a \\c[1]{1}\\c[0]!\\wtnp[30]", itemname))
end end
pbMessage(_INTL("But your Bag is full...")) pbMessage(_INTL("But your Bag is full..."))
return false return false
end end
#=============================================================================== #===============================================================================
# Being given an item # Being given an item
#=============================================================================== #===============================================================================
def pbReceiveItem(item,quantity=1,item_name="",music=nil) def pbReceiveItem(item, quantity = 1, item_name = "", music = nil)
#item_name -> pour donner un autre nom à l'item. Pas encore réimplémenté et surtout là pour éviter que ça plante quand des events essaient de le faire #item_name -> pour donner un autre nom à l'item. Pas encore réimplémenté et surtout là pour éviter que ça plante quand des events essaient de le faire
item = GameData::Item.get(item) item = GameData::Item.get(item)
return false if !item || quantity<1 return false if !item || quantity < 1
itemname = (quantity>1) ? item.name_plural : item.name itemname = (quantity > 1) ? item.name_plural : item.name
pocket = item.pocket pocket = item.pocket
move = item.move move = item.move
meName = (item.is_key_item?) ? "Key item get" : "Item get" meName = (item.is_key_item?) ? "Key item get" : "Item get"
if item == :LEFTOVERS if item == :LEFTOVERS
pbMessage(_INTL("\\me[{1}]You obtained some \\c[1]{2}\\c[0]!\\wtnp[30]",meName,itemname)) pbMessage(_INTL("\\me[{1}]You obtained some \\c[1]{2}\\c[0]!\\wtnp[30]", meName, itemname))
elsif item.is_machine? # TM or HM elsif item.is_machine? # TM or HM
pbMessage(_INTL("\\me[{1}]You obtained \\c[1]{2} {3}\\c[0]!\\wtnp[30]",meName,itemname,GameData::Move.get(move).name)) pbMessage(_INTL("\\me[{1}]You obtained \\c[1]{2} {3}\\c[0]!\\wtnp[30]", meName, itemname, GameData::Move.get(move).name))
elsif quantity>1 elsif quantity > 1
pbMessage(_INTL("\\me[{1}]You obtained {2} \\c[1]{3}\\c[0]!\\wtnp[30]",meName,quantity,itemname)) pbMessage(_INTL("\\me[{1}]You obtained {2} \\c[1]{3}\\c[0]!\\wtnp[30]", meName, quantity, itemname))
elsif itemname.starts_with_vowel? elsif itemname.starts_with_vowel?
pbMessage(_INTL("\\me[{1}]You obtained an \\c[1]{2}\\c[0]!\\wtnp[30]",meName,itemname)) pbMessage(_INTL("\\me[{1}]You obtained an \\c[1]{2}\\c[0]!\\wtnp[30]", meName, itemname))
else else
pbMessage(_INTL("\\me[{1}]You obtained a \\c[1]{2}\\c[0]!\\wtnp[30]",meName,itemname)) pbMessage(_INTL("\\me[{1}]You obtained a \\c[1]{2}\\c[0]!\\wtnp[30]", meName, itemname))
end end
if $PokemonBag.pbStoreItem(item,quantity) # If item can be added if $PokemonBag.pbStoreItem(item, quantity) # If item can be added
pbMessage(_INTL("You put the {1} away\\nin the <icon=bagPocket{2}>\\c[1]{3} Pocket\\c[0].", pbMessage(_INTL("You put the {1} away\\nin the <icon=bagPocket{2}>\\c[1]{3} Pocket\\c[0].",
itemname,pocket,PokemonBag.pocketNames()[pocket])) itemname, pocket, PokemonBag.pocketNames()[pocket]))
return true return true
end end
return false # Can't add the item return false # Can't add the item

File diff suppressed because it is too large Load Diff

View File

@@ -56,3 +56,11 @@ SINGLE_POKEMON_MODE_BODY_SWITCH=792
SINGLE_POKEMON_MODE_RANDOM_SWITCH=793 SINGLE_POKEMON_MODE_RANDOM_SWITCH=793
FISHING_AUTOHOOK_SWITCH = 916 FISHING_AUTOHOOK_SWITCH = 916
ODDKEYSTONE_NB_VARIABLE=252 ODDKEYSTONE_NB_VARIABLE=252
RANDOMIZED_WILD_POKEMON_SWITCH=953
FUSED_WILD_POKEMON_SWITCH=35
FORCE_FUSE_NEXT_POKEMON_SWITCH=37
FORCE_ALL_WILD_FUSIONS_SWITCH=828
USED_AN_INCENSE_SWITCH=798
WILD_FUSION_RATE_VAR=210

View File

@@ -208,7 +208,9 @@ def getEvolution(species, halfToEvolve=nil)
end end
def getFusionSpecies(body, head) def getFusionSpecies(body, head)
id = body * Settings::NB_POKEMON + head body_num = dexNum(body)
head_num = dexNum(head)
id = body_num * Settings::NB_POKEMON + head_num
return GameData::Species.get(id).species return GameData::Species.get(id).species
end end

Binary file not shown.