bugfixes 1.5, speed up, variableShop

This commit is contained in:
infinitefusion
2021-09-19 14:02:12 -04:00
parent dd0c64f2b7
commit b51c2afcae
20 changed files with 210 additions and 6 deletions

View File

@@ -434,6 +434,38 @@ def pbDisplayGoldWindow(msgwindow)
return goldwindow
end
def pbDisplayBattleFactoryPointsWindow(msgwindow)
pointsString = $game_variables[BATTLE_FACTORY_TOKENS].to_s
pointswindow=Window_AdvancedTextPokemon.new(_INTL("Tokens:\n<ar>{1}</ar>", pointsString))
pointswindow.setSkin("Graphics/Windowskins/goldskin")
pointswindow.resizeToFit(pointswindow.text,Graphics.width)
pointswindow.width=160 if pointswindow.width<=160
if msgwindow.y==0
pointswindow.y=Graphics.height-pointswindow.height
else
pointswindow.y=0
end
pointswindow.viewport=msgwindow.viewport
pointswindow.z=msgwindow.z
return pointswindow
end
def pbDisplayHeartScalesWindow(msgwindow)
pointsString = $PokemonBag.pbQuantity(:HEARTSCALE).to_s
pointswindow=Window_AdvancedTextPokemon.new(_INTL("Heart Scales:\n<ar>{1}</ar>", pointsString))
pointswindow.setSkin("Graphics/Windowskins/goldskin")
pointswindow.resizeToFit(pointswindow.text,Graphics.width)
pointswindow.width=160 if pointswindow.width<=160
if msgwindow.y==0
pointswindow.y=Graphics.height-pointswindow.height
else
pointswindow.y=0
end
pointswindow.viewport=msgwindow.viewport
pointswindow.z=msgwindow.z
return pointswindow
end
def pbDisplayCoinsWindow(msgwindow,goldwindow)
coinString=($Trainer) ? $Trainer.coins.to_s_formatted : "0"
coinwindow=Window_AdvancedTextPokemon.new(_INTL("Coins:\n<ar>{1}</ar>",coinString))
@@ -592,7 +624,7 @@ def pbMessageDisplay(msgwindow,message,letterbyletter=true,commandProc=nil)
### Controls
textchunks=[]
controls=[]
while text[/(?:\\(f|ff|ts|cl|me|se|wt|wtnp|ch)\[([^\]]*)\]|\\(g|cn|pt|wd|wm|op|cl|wu|\.|\||\!|\^))/i]
while text[/(?:\\(f|ff|ts|cl|me|se|wt|wtnp|ch)\[([^\]]*)\]|\\(g|cn|pt|ft|hs|wd|wm|op|cl|wu|\.|\||\!|\^))/i]
textchunks.push($~.pre_match)
if $~[1]
controls.push([$~[1].downcase,$~[2],-1])
@@ -701,6 +733,12 @@ def pbMessageDisplay(msgwindow,message,letterbyletter=true,commandProc=nil)
when "g" # Display gold window
goldwindow.dispose if goldwindow
goldwindow = pbDisplayGoldWindow(msgwindow)
when "ft" # Display battle factory tokens
goldwindow.dispose if goldwindow
goldwindow = pbDisplayBattleFactoryPointsWindow(msgwindow)
when "hs" # Display battle factory tokens
goldwindow.dispose if goldwindow
goldwindow = pbDisplayHeartScalesWindow(msgwindow)
when "cn" # Display coins window
coinwindow.dispose if coinwindow
coinwindow = pbDisplayCoinsWindow(msgwindow,goldwindow)

View File

@@ -706,6 +706,13 @@ class Pokemon
return false
end
def has_egg_move?
return false if egg? || shadowPokemon?
baby = pbGetBabySpecies(self.species)
moves = pbGetSpeciesEggMoves(baby)
return true if moves.size >= 1
end
#=============================================================================
# Ribbons
#=============================================================================

View File

@@ -172,6 +172,10 @@ end
#
#===============================================================================
class PokemonMart_Scene
def initialize(currency_name="Money")
@currency_name = currency_name
end
def update
pbUpdateSpriteHash(@sprites)
@subscene.pbUpdate if @subscene
@@ -187,7 +191,7 @@ class PokemonMart_Scene
(itemwindow.item) ? @adapter.getDescription(itemwindow.item) : _INTL("Quit shopping.")
itemwindow.refresh
end
@sprites["moneywindow"].text = _INTL("Money:\r\n<r>{1}", @adapter.getMoneyString)
@sprites["moneywindow"].text = _INTL("{2}:\r\n<r>{1}", @adapter.getMoneyString,@currency_name)
end
def pbStartBuyOrSellScene(buying, stock, adapter)
@@ -520,10 +524,10 @@ end
#
#===============================================================================
class PokemonMartScreen
def initialize(scene,stock)
def initialize(scene,stock,adapter=PokemonMartAdapter.new)
@scene=scene
@stock=stock
@adapter=PokemonMartAdapter.new
@adapter=adapter
end
def pbConfirm(msg)

View File

@@ -7,6 +7,7 @@ BEAT_THE_LEAGUE = 12
#Variables
DEFAULT_BATTLE_TYPE = 242
BATTLE_FACTORY_TOKENS = 243
#Settings

View File

@@ -0,0 +1,4 @@
def pbGetTerrainTag()
return $game_player.pbTerrainTag().id
end

View File

@@ -0,0 +1,32 @@
def pbRelearnEggMoveScreen(pkmn)
retval = true
pbFadeOutIn {
scene = MoveRelearner_Scene.new
screen = MoveRelearnerScreen.new(scene)
retval = screen.pbStartScreenEgg(pkmn)
}
return retval
end
class MoveRelearnerScreen
def pbStartScreenEgg(pkmn)
baby = pbGetBabySpecies(pkmn.species)
moves = pbGetSpeciesEggMoves(baby)
@scene.pbStartScene(pkmn, moves)
loop do
move = @scene.pbChooseMove
if move
if @scene.pbConfirm(_INTL("Teach {1}?", GameData::Move.get(move).name))
if pbLearnMove(pkmn, move)
@scene.pbEndScene
return true
end
end
elsif @scene.pbConfirm(_INTL("Give up trying to teach a new move to {1}?", pkmn.name))
@scene.pbEndScene
return false
end
end
end
end

View File

@@ -0,0 +1,53 @@
class VariableCurrencyMartAdapter < PokemonMartAdapter
def initialize(currency)
@currency_variable = currency
end
def getMoney
return pbGet(@currency_variable).to_i
end
def getMoneyString
return pbGet(@currency_variable).to_s
end
def setMoney(value)
pbSet(@currency_variable,value)
end
end
def pbVariablePokemonMart(stock,currencyVariable,currency_name="Points",speech=nil,cantsell=true)
for i in 0...stock.length
stock[i] = GameData::Item.get(stock[i]).id
stock[i] = nil if GameData::Item.get(stock[i]).is_important? && $PokemonBag.pbHasItem?(stock[i])
end
stock.compact!
commands = []
cmdBuy = -1
cmdSell = -1
cmdQuit = -1
commands[cmdBuy = commands.length] = _INTL("Buy")
commands[cmdSell = commands.length] = _INTL("Sell") if !cantsell
commands[cmdQuit = commands.length] = _INTL("Quit")
cmd = pbMessage(
speech ? speech : _INTL("Welcome! How may I serve you?"),
commands,cmdQuit+1)
loop do
if cmdBuy>=0 && cmd==cmdBuy
adapter = VariableCurrencyMartAdapter.new(currencyVariable)
scene = PokemonMart_Scene.new(currency_name)
screen = PokemonMartScreen.new(scene,stock,adapter)
screen.pbBuyScreen
elsif cmdSell>=0 && cmd==cmdSell #NOT IMPLEMENTED
scene = PokemonMart_Scene.new(currency_name)
screen = PokemonMartScreen.new(scene,stock,adapter)
screen.pbSellScreen
else
pbMessage(_INTL("Please come again!"))
break
end
cmd = pbMessage(_INTL("Is there anything else I can help you with?"),
commands,cmdQuit+1)
end
$game_temp.clear_mart_prices
end

View File

@@ -26,6 +26,7 @@ class PokemonTemp
attr_accessor :speechbubble_arrow
attr_accessor :speechbubble_outofrange
attr_accessor :speechbubble_talking
attr_accessor :speechbubble_alwaysDown
end
module MessageConfig
@@ -85,7 +86,7 @@ def pbRepositionMessageWindow(msgwindow, linecount=2)
msgwindow.setSkin("Graphics/windowskins/frlgtextskin")
msgwindow.height = 102
msgwindow.width = Graphics.width
if $game_player.direction==8
if $game_player.direction==8 && !$PokemonTemp.speechbubble_alwaysDown
$PokemonTemp.speechbubble_vp = Viewport.new(0, 0, Graphics.width, 280)
msgwindow.y = 6
else
@@ -119,7 +120,7 @@ end
def pbCreateMessageWindow(viewport=nil,skin=nil)
arrow = nil
if $PokemonTemp.speechbubble_bubble==2 && $game_map.events[$PokemonTemp.speechbubble_talking] != nil # Message window set to floating bubble.
if $game_player.direction==8 # Player facing up, message window top.
if $game_player.direction==8 && !$PokemonTemp.speechbubble_alwaysDown# Player facing up, message window top.
$PokemonTemp.speechbubble_vp = Viewport.new(0, 104, Graphics.width, 280)
$PokemonTemp.speechbubble_vp.z = 999999
arrow = Sprite.new($PokemonTemp.speechbubble_vp)
@@ -192,4 +193,6 @@ end
def pbCallBub(status=0,value=0,always_down=false)
$PokemonTemp.speechbubble_talking=get_character(value).id
$PokemonTemp.speechbubble_bubble=status
$PokemonTemp.speechbubble_alwaysDown=always_down
end

View File

@@ -0,0 +1,62 @@
#==============================================================================#
# Better Fast-forward Mode #
# v1.0 #
# #
# by Marin #
#==============================================================================#
# Usage #
# #
# SPEEDUP_STAGES are the speed stages the game will pick from. If you click F, #
# it'll choose the next number in that array. It goes back to the first number #
# afterward. #
# #
# $GameSpeed is the current index in the speed up array. #
# Should you want to change that manually, you can do, say, $GameSpeed = 0 #
# #
# If you don't want the user to be able to speed up at certain points, you can #
# use "pbDisallowSpeedup" and "pbAllowSpeedup". #
#==============================================================================#
# Please give credit when using this. #
#==============================================================================#
PluginManager.register({
:name => "Better Fast-forward Mode",
:version => "1.1",
:credits => "Marin",
:link => "https://reliccastle.com/resources/151/"
})
# When the user clicks F, it'll pick the next number in this array.
SPEEDUP_STAGES = [1,2,3]
def pbAllowSpeedup
$CanToggle = true
end
def pbDisallowSpeedup
$CanToggle = false
end
# Default game speed.
$GameSpeed = 0
$frame = 0
$CanToggle = true
module Graphics
class << Graphics
alias fast_forward_update update
end
def self.update
if $CanToggle && Input.trigger?(Input::AUX1)
$GameSpeed += 1
$GameSpeed = 0 if $GameSpeed >= SPEEDUP_STAGES.size
end
$frame += 1
return unless $frame % SPEEDUP_STAGES[$GameSpeed] == 0
fast_forward_update
$frame = 0
end
end