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:
@@ -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