mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-06 06:01:46 +00:00
Adds Premium wondertrades
This commit is contained in:
@@ -421,8 +421,31 @@ def pbDisplayGoldWindow(msgwindow)
|
||||
end
|
||||
|
||||
def pbDisplayBattleFactoryPointsWindow(msgwindow)
|
||||
pointsString = $game_variables[BATTLE_FACTORY_TOKENS].to_s
|
||||
pointswindow = Window_AdvancedTextPokemon.new(_INTL("Tokens:\n<ar>{1}</ar>", pointsString))
|
||||
pbDisplayVariableWindow(msgwindow,"Tokens",BATTLE_FACTORY_TOKENS)
|
||||
end
|
||||
|
||||
|
||||
def pbDisplayVariableWindow(msgwindow,name,variable_id)
|
||||
pointsString = $game_variables[variable_id].to_s
|
||||
pointswindow = Window_AdvancedTextPokemon.new(_INTL("{1}:\n<ar>{2}</ar>",name, 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 pbDisplayTwoVariableWindow(msgwindow,name1,variable1_id,name2, variable2_id)
|
||||
pointsString1 = $game_variables[variable1_id].to_s
|
||||
pointsString2 = $game_variables[variable2_id].to_s
|
||||
|
||||
pointswindow = Window_AdvancedTextPokemon.new(_INTL("{1}:<ar>{2}</ar>\n{3}:<ar>{4}</ar>",name1, pointsString1,name2,pointsString2))
|
||||
pointswindow.setSkin("Graphics/Windowskins/goldskin")
|
||||
pointswindow.resizeToFit(pointswindow.text, Graphics.width)
|
||||
pointswindow.width = 160 if pointswindow.width <= 160
|
||||
@@ -722,7 +745,7 @@ def pbMessageDisplay(msgwindow, message, letterbyletter = true, commandProc = ni
|
||||
when "ft" # Display battle factory tokens
|
||||
goldwindow.dispose if goldwindow
|
||||
goldwindow = pbDisplayBattleFactoryPointsWindow(msgwindow)
|
||||
when "hs" # Display battle factory tokens
|
||||
when "hs" # Display heartscakes
|
||||
goldwindow.dispose if goldwindow
|
||||
goldwindow = pbDisplayHeartScalesWindow(msgwindow)
|
||||
when "cn" # Display coins window
|
||||
|
||||
@@ -29,6 +29,10 @@ BATTLE_FACTORY_TOKENS = 243
|
||||
NB_GYM_REMATCHES = 162
|
||||
CUSTOM_SPRITES_ENABLED= 196
|
||||
COMMAND_WINDOW_INDEX=249
|
||||
|
||||
STANDARD_WONDERTRADE_LEFT=248
|
||||
PREMIUM_WONDERTRADE_LEFT=111
|
||||
|
||||
#Settings
|
||||
# This is for settings that are used in scripts since it's a chore to change them everywhere to include the module name
|
||||
NUM_BADGES = Settings::NB_BADGES
|
||||
|
||||
@@ -174,6 +174,13 @@ def listLegendaryPokemonIds()
|
||||
return [144, 145, 146, 150, 151, 245, 243, 244, 245, 249, 250, 251, 315, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 378, 379, 380, 381]
|
||||
end
|
||||
|
||||
def pokemonIsPartLegendary(species)
|
||||
head = getBasePokemonID(species, false)
|
||||
body = getBasePokemonID(species, true)
|
||||
return listLegendaryPokemonIds().include?(head) || listLegendaryPokemonIds().include?(body)
|
||||
end
|
||||
|
||||
|
||||
def generateRandomFusionFromPokemon(dexNum, onlyCustomSprites = false, allowLegendaries=true)
|
||||
speciesList = onlyCustomSprites ? getCustomSpeciesListForPokemon(dexNum,allowLegendaries) : getAllPokemonWithBase(dexNum)
|
||||
return speciesList.sample
|
||||
|
||||
@@ -308,19 +308,28 @@ def obtainPokemonSpritePath(id, includeCustoms = true)
|
||||
end
|
||||
|
||||
def obtainPokemonSpritePath(bodyId, headId, include_customs = true)
|
||||
hasCustom = false
|
||||
picturePath = _INTL("Graphics/Battlers/{1}/{1}.{2}.png", headId, bodyId)
|
||||
|
||||
if include_customs
|
||||
pathCustom = _INTL("Graphics/CustomBattlers/{1}.{2}.png", headId, bodyId)
|
||||
pathCustom = getCustomSpritePath(bodyId,headId)
|
||||
if (pbResolveBitmap(pathCustom))
|
||||
picturePath = pathCustom
|
||||
hasCustom = true
|
||||
end
|
||||
end
|
||||
return picturePath
|
||||
end
|
||||
|
||||
def getCustomSpritePath(body,head)
|
||||
return _INTL("Graphics/CustomBattlers/{1}.{2}.png", head, body)
|
||||
end
|
||||
|
||||
def customSpriteExists(species)
|
||||
head = getBasePokemonID(species, false)
|
||||
body = getBasePokemonID(species, true)
|
||||
pathCustom = getCustomSpritePath(body,head)
|
||||
return pbResolveBitmap(pathCustom) != nil
|
||||
end
|
||||
|
||||
def getArceusPlateType(heldItem)
|
||||
return :NORMAL if heldItem == nil
|
||||
case heldItem
|
||||
@@ -415,6 +424,8 @@ def Kernel.getItemNamesAsString(list)
|
||||
return strList
|
||||
end
|
||||
|
||||
|
||||
|
||||
def Kernel.getPlateType(item)
|
||||
return :FIGHTING if item == PBItems::FISTPLATE
|
||||
return :FLYING if item == PBItems::SKYPLATE
|
||||
|
||||
@@ -1003,7 +1003,7 @@ RandPokeNick = [
|
||||
"maymay"
|
||||
]
|
||||
|
||||
def pbWonderTrade(lvl, except = [], except2 = [], rare = true)
|
||||
def pbWonderTrade(lvl, except = [], except2 = [], premiumWonderTrade = true)
|
||||
# for i in 0...except.length # Gets ID of pokemon in exception array
|
||||
# except[i]=getID(PBSpecies,except[i]) if !except[i].is_a?(Integer)
|
||||
# end
|
||||
@@ -1013,6 +1013,7 @@ def pbWonderTrade(lvl, except = [], except2 = [], rare = true)
|
||||
# ignoreExcept = rand(100) == 0 #tiny chance to include legendaries
|
||||
#
|
||||
# except+=[]
|
||||
rare = premiumWonderTrade
|
||||
chosen = pbChoosePokemon(1, 2, # Choose eligable pokemon
|
||||
proc {
|
||||
|poke| !poke.egg? && !(poke.isShadow?) && # No Eggs, No Shadow Pokemon
|
||||
@@ -1041,8 +1042,18 @@ def pbWonderTrade(lvl, except = [], except2 = [], rare = true)
|
||||
# Redo the loop if the species is an exception.
|
||||
species = 0 if checkifBlacklisted(species, except2) && !ignoreExcept #except2.include?(species)
|
||||
#Redo loop if above BST
|
||||
species = 0 if bst > chosenBST + $game_variables[120] + bonus
|
||||
|
||||
bstLimit = chosenBST + bonus# + $game_variables[120]
|
||||
if !premiumWonderTrade
|
||||
bstLimit-=50
|
||||
end
|
||||
species = 0 if bst > bstLimit
|
||||
if species > 0 && premiumWonderTrade
|
||||
species = 0 if !customSpriteExists(species)
|
||||
end
|
||||
if species > 0
|
||||
skipLegendaryCheck = premiumWonderTrade && rand(100) < luck
|
||||
species = 0 if pokemonIsPartLegendary(species) && !$game_switches[BEAT_THE_LEAGUE] && !skipLegendaryCheck
|
||||
end
|
||||
#Redo loop if below BST - 200
|
||||
species = 0 if bst < (chosenBST - 200)
|
||||
|
||||
@@ -1063,7 +1074,11 @@ def pbWonderTrade(lvl, except = [], except2 = [], rare = true)
|
||||
pname = RandPokeNick[rand(RandPokeNick.size)] # Randomizes Pokemon Nicknames
|
||||
|
||||
#num of Wondertrade - 1
|
||||
$game_variables[111] = $game_variables[111] - 1
|
||||
if premiumWonderTrade
|
||||
$game_variables[PREMIUM_WONDERTRADE_LEFT] -= 1
|
||||
else
|
||||
$game_variables[STANDARD_WONDERTRADE_LEFT] -= 1
|
||||
end
|
||||
|
||||
newpoke = pbStartTrade(pbGet(1), species, pname, tname, 0, true) # Starts the trade
|
||||
#lower level by 1 to prevent abuse
|
||||
|
||||
Reference in New Issue
Block a user