mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2026-07-22 07:37:00 +00:00
Update 6.8
This commit is contained in:
@@ -0,0 +1,131 @@
|
||||
#====================================================================================
|
||||
# Settings
|
||||
#====================================================================================
|
||||
module PokeblockSettings
|
||||
#--------------------------------------------------------------------------------
|
||||
# Set this to be the pocket number your game uses for Berries. By default it's 5.
|
||||
#--------------------------------------------------------------------------------
|
||||
BERRY_POCKET_OF_BAG = 5
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
# When true, a more simplified Berry Blending mode from Generation 6 (ORAS) will
|
||||
# be used. When false, the original Generation 3 (RSE) mode will be used.
|
||||
#
|
||||
# Generation 3 mode:
|
||||
# - Sheen/Feel will restrict how many Pokeblocks a Pokemon can eat
|
||||
# - Wider variety of Pokeblock flavors and colors (like Olive, Black, etc.)
|
||||
# - Blend with several NPCs to get stronger Pokemon
|
||||
# - Berry Blender will be a minigame
|
||||
#
|
||||
# Generation 6 mode:
|
||||
# - Sheen/Feel not a restriction, instead the Pokemon can max out each contest stat.
|
||||
# - Only 5 single Pokeblock colors, plus Rainbow, and their + versions.
|
||||
# - Blending is simplified: no NPCs needed and is not a minigame.
|
||||
#
|
||||
# More info:
|
||||
# https://bulbapedia.bulbagarden.net/wiki/Berry_Blender#Pok.C3.A9mon_Ruby.2C_Sapphire.2C_and_Emerald
|
||||
# https://bulbapedia.bulbagarden.net/wiki/Pok%C3%A9block
|
||||
#--------------------------------------------------------------------------------
|
||||
SIMPLIFIED_BERRY_BLENDING = true
|
||||
|
||||
#====================================================================================
|
||||
#======================= Generation 3 Mode Specific Settings ========================
|
||||
#====================================================================================
|
||||
#--------------------------------------------------------------------------------
|
||||
# When true, Sheen will not be used, even in Generation 3 mode.
|
||||
#--------------------------------------------------------------------------------
|
||||
DONT_USE_SHEEN = true
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
# When true, contest stats in the Conditions sceen will use a bar graph. Instead
|
||||
# of a pentagon.
|
||||
# The pentagon graph uses Marin's Better Bitmaps plugin, so it is required if true.
|
||||
# https://reliccastle.com/resources/169/
|
||||
#--------------------------------------------------------------------------------
|
||||
STATS_BAR_GRAPH = true
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
# When true, NPCs will use any random berry when Berry Blending. When false, they
|
||||
# will use only predefined berries to help maximize the Pokeblock result.
|
||||
# More info: https://bulbapedia.bulbagarden.net/wiki/Pok%C3%A9block#Blending_with_non-playable_characters
|
||||
#--------------------------------------------------------------------------------
|
||||
NPC_USE_RANDOM_BERRIES = false
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
# If you don't define a list of NPC names when calling pbBerryBlender, then they
|
||||
# fall back to using a randomly chosen name defined in this array.
|
||||
#--------------------------------------------------------------------------------
|
||||
NPC_DEFAULT_NAMES = [
|
||||
# Person 1 is yourself
|
||||
["Alice","Alex","Andrew"], # Person 2 name options
|
||||
["Barry","Beatrice","Bob"], # Person 3 name options
|
||||
["Carl","Chris","Caroline"], # Person 4 name options
|
||||
["Devin","Drew","Diane"] # Berry Master name options
|
||||
]
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
# If NPC_USE_RANDOM_BERRIES is true, Berry Master NPCs will only use a berry
|
||||
# randomly chosen from this array.
|
||||
#--------------------------------------------------------------------------------
|
||||
BERRY_MASTER_BERRIES = [
|
||||
:LIECHIBERRY,:GANLONBERRY,:SALACBERRY,:PETAYABERRY,:APICOTBERRY,
|
||||
:LANSATBERRY,:STARFBERRY,:ENIGMABERRY,:MICLEBERRY,:CUSTAPBERRY,
|
||||
:JABOCABERRY,:ROWAPBERRY,:ROSELIBERRY,:KEEBERRY,:MARANGABERRY
|
||||
]
|
||||
|
||||
#====================================================================================
|
||||
#====================== Generation 6 Mode Specific Settings =========================
|
||||
#====================================================================================
|
||||
#--------------------------------------------------------------------------------
|
||||
# Berries used when blending Pokeblocks in Generation 6 mode will each have a
|
||||
# chance of making all the Pokeblocks a + version. Values for each berry are
|
||||
# defined here.
|
||||
#--------------------------------------------------------------------------------
|
||||
SIMPLE_POKEBLOCK_PLUS_PROBABILITY = {
|
||||
"Very Low" => [ # Each berry adds 1/100 chance the Pokeblocks being a +
|
||||
:CHERIBERRY,:FIGYBERRY,:LEPPABERRY,:RAZZBERRY,:BLUKBERRY,:CHESTOBERRY,:ORANBERRY,
|
||||
:WIKIBERRY,:MAGOBERRY,:NANABBERRY,:PECHABERRY,:PERSIMBERRY,:AGUAVBERRY,:RAWSTBERRY,
|
||||
:WEPEARBERRY,:ASPEARBERRY,:IAPAPABERRY,:PINAPBERRY
|
||||
],
|
||||
"Low" => [ # Each berry adds 5/100 chance
|
||||
:POMEGBERRY,:TAMATOBERRY,:BELUEBERRY,:CORNNBERRY,:KELPSYBERRY,:PAMTREBERRY,:MAGOSTBERRY,
|
||||
:QUALOTBERRY,:SPELONBERRY,:DURINBERRY,:HONDEWBERRY,:LUMBERRY,:RABUTABERRY,:WATMELBERRY,
|
||||
:GREPABERRY,:NOMELBERRY,:SITRUSBERRY
|
||||
],
|
||||
"Medium" => [ # Each berry adds 15/100 chance
|
||||
:CHOPLEBERRY,:HABANBERRY,:OCCABERRY,:PAYAPABERRY,:ROSELIBERRY,:COBABERRY,:PASSHOBERRY,
|
||||
:YACHEBERRY,:COLBURBERRY,:KASIBBERRY,:BABIRIBERRY,:KEBIABERRY,:RINDOBERRY,:TANGABERRY,
|
||||
:CHARTIBERRY,:CHILANBERRY,:SHUCABERRY,:WACANBERRY
|
||||
],
|
||||
"Medium High" => [ # Each berry adds 25/100 chance
|
||||
:APICOTBERRY,:GANLONBERRY,:KEEBERRY,:PETAYABERRY,:SALACBERRY,:LIECHIBERRY,:MARANGABERRY
|
||||
],
|
||||
"High" => [ # Each berry adds 40/100 chance
|
||||
:CUSTAPBERRY,:ROWAPBERRY,:MICLEBERRY,:ENIGMABERRY,:JABOCABERRY
|
||||
],
|
||||
"Guaranteed" => [ # Each berry guarantees the Pokeblocks being a +
|
||||
:LANSATBERRY,:STARFBERRY
|
||||
]
|
||||
}
|
||||
#--------------------------------------------------------------------------------
|
||||
# A Pokemon's Nature has an impact on how effective Pokeblocks are based on
|
||||
# taste preference. These preferences are defined below.
|
||||
#--------------------------------------------------------------------------------
|
||||
NATURE_FLAVOR_PREFERENCES = {
|
||||
"Likes" => [
|
||||
[:LONELY,:BRAVE,:ADAMANT,:NAUGHTY], #Likes Spicy
|
||||
[:MODEST,:MILD,:QUIET,:RASH], #Likes Dry
|
||||
[:TIMID,:HASTY,:JOLLY,:NAIVE], #Likes Sweet
|
||||
[:CALM,:GENTLE,:SASSY,:CAREFUL], #Likes Bitter
|
||||
[:BOLD,:RELAXED,:IMPISH,:LAX] #Likes Sour
|
||||
],
|
||||
"Dislikes" => [
|
||||
[:BOLD,:TIMID,:MODEST,:CALM], #Dislikes Spicy
|
||||
[:ADAMANT,:IMPISH,:JOLLY,:CAREFUL], #Dislikes Dry
|
||||
[:BRAVE,:RELAXED,:QUIET,:SASSY], #Dislikes Sweet
|
||||
[:NAUGHTY,:LAX,:NAIVE,:RASH], #Dislikes Bitter
|
||||
[:LONELY,:HASTY,:MILD,:GENTLE] #Dislikes Sour
|
||||
]
|
||||
}
|
||||
|
||||
end
|
||||
@@ -0,0 +1,52 @@
|
||||
module BopModule
|
||||
#------------#
|
||||
# Set bitmap #
|
||||
#------------#
|
||||
# Image
|
||||
# def create_sprite(spritename,filename,vp,dir="")
|
||||
# @sprites["#{spritename}"] = Sprite.new(vp)
|
||||
# folder = "Berry Blender"
|
||||
# file = dir ? "Graphics/Pictures/#{folder}/#{dir}/#{filename}" : "Graphics/Pictures/#{folder}/#{filename}"
|
||||
# @sprites["#{spritename}"].bitmap = Bitmap.new(file)
|
||||
# end
|
||||
# def set_sprite(spritename,filename,dir="")
|
||||
# folder = "Berry Blender"
|
||||
# file = dir ? "Graphics/Pictures/#{folder}/#{dir}/#{filename}" : "Graphics/Pictures/#{folder}/#{filename}"
|
||||
# @sprites["#{spritename}"].bitmap = Bitmap.new(file)
|
||||
# end
|
||||
# Set ox, oy
|
||||
def set_oxoy_sprite(spritename,ox,oy)
|
||||
@sprites["#{spritename}"].ox = ox
|
||||
@sprites["#{spritename}"].oy = oy
|
||||
end
|
||||
# Set x, y
|
||||
def set_xy_sprite(spritename,x,y)
|
||||
@sprites["#{spritename}"].x = x
|
||||
@sprites["#{spritename}"].y = y
|
||||
end
|
||||
# Set zoom
|
||||
def set_zoom_sprite(spritename,zoom_x,zoom_y)
|
||||
@sprites["#{spritename}"].zoom_x = zoom_x
|
||||
@sprites["#{spritename}"].zoom_y = zoom_y
|
||||
end
|
||||
# Set visible
|
||||
def set_visible_sprite(spritename,vsb=false)
|
||||
@sprites["#{spritename}"].visible = vsb
|
||||
end
|
||||
# Set angle
|
||||
def set_angle_sprite(spritename,angle)
|
||||
@sprites["#{spritename}"].angle = angle
|
||||
end
|
||||
# Set src
|
||||
# width, height
|
||||
def set_src_wh_sprite(spritename,w,h)
|
||||
@sprites["#{spritename}"].src_rect.width = w
|
||||
@sprites["#{spritename}"].src_rect.height = h
|
||||
end
|
||||
# x, y
|
||||
def set_src_xy_sprite(spritename,x,y)
|
||||
@sprites["#{spritename}"].src_rect.x = x
|
||||
@sprites["#{spritename}"].src_rect.y = y
|
||||
end
|
||||
|
||||
end
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,4 @@
|
||||
#===============================================================================
|
||||
# No longer used; Set in Berry Core and Dex instead
|
||||
#===============================================================================
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
class Pokeblock
|
||||
attr_accessor :color
|
||||
attr_accessor :flavor
|
||||
attr_accessor :level
|
||||
attr_accessor :smoothness
|
||||
attr_accessor :plus
|
||||
|
||||
def initialize(color,flavor,smoothness,plus=false)
|
||||
@color = color # PokeblockColor
|
||||
@flavor = flavor # Array [x,x,x,x,x]
|
||||
@level = @flavor.max # Integer
|
||||
@smoothness = smoothness # Integer
|
||||
@plus = plus || false # Boolean
|
||||
end
|
||||
|
||||
def color_name; return GameData::PokeblockColor.get(@color).name; end
|
||||
def name; return color_name + " Pokéblock" + (@plus ? " +" : ""); end
|
||||
def feel; return @smoothness; end
|
||||
|
||||
end
|
||||
|
||||
class Player
|
||||
attr_accessor :pokeblocks
|
||||
|
||||
alias berry_blender_player_ini initialize unless private_method_defined?(:berry_blender_player_ini)
|
||||
def initialize(name, trainer_type)
|
||||
berry_blender_player_ini(name, trainer_type)
|
||||
@pokeblocks = []
|
||||
end
|
||||
|
||||
def hasPokeblocks?
|
||||
@pokeblocks = [] if !@pokeblocks
|
||||
return @pokeblocks.length > 0
|
||||
end
|
||||
|
||||
def gainPokeblock(pokeblock)
|
||||
@pokeblocks = [] if !@pokeblocks
|
||||
@pokeblocks.push(pokeblock)
|
||||
sortPokeblocks
|
||||
end
|
||||
|
||||
def sortPokeblocks
|
||||
arr = @pokeblocks
|
||||
colors = GameData::PokeblockColor.keys
|
||||
#arr.sort! { |a, b| GameData::Item.keys.index(a[0]) <=> GameData::Item.keys.index(b[0]) }
|
||||
#arr.sort_by! { |x| colors.index x.color }
|
||||
arr.sort_by! { |x| [GameData::PokeblockColor.get(x.color).sort_number,x.level,(x.plus ? 1 : 0)] }
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class Pokemon
|
||||
|
||||
def totalContestStats
|
||||
return @cool+@beauty+@cute+@smart+@tough
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,118 @@
|
||||
module GameData
|
||||
class PokeblockColor
|
||||
attr_reader :id
|
||||
attr_reader :sort_number
|
||||
attr_reader :real_name
|
||||
|
||||
DATA = {}
|
||||
|
||||
extend ClassMethodsSymbols
|
||||
include InstanceMethods
|
||||
|
||||
def self.load; end
|
||||
def self.save; end
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@sort_number = hash[:sort_number]
|
||||
@real_name = hash[:name] || "Unnamed"
|
||||
end
|
||||
|
||||
# @return [String] the translated name of this body color
|
||||
def name
|
||||
return _INTL(@real_name)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
|
||||
GameData::PokeblockColor.register({
|
||||
:id => :Red,
|
||||
:sort_number => 1,
|
||||
:name => _INTL("Red")
|
||||
})
|
||||
|
||||
GameData::PokeblockColor.register({
|
||||
:id => :Blue,
|
||||
:sort_number => 2,
|
||||
:name => _INTL("Blue")
|
||||
})
|
||||
|
||||
GameData::PokeblockColor.register({
|
||||
:id => :Pink,
|
||||
:sort_number => 3,
|
||||
:name => _INTL("Pink")
|
||||
})
|
||||
|
||||
GameData::PokeblockColor.register({
|
||||
:id => :Green,
|
||||
:sort_number => 4,
|
||||
:name => _INTL("Green")
|
||||
})
|
||||
|
||||
GameData::PokeblockColor.register({
|
||||
:id => :Yellow,
|
||||
:sort_number => 5,
|
||||
:name => _INTL("Yellow")
|
||||
})
|
||||
|
||||
GameData::PokeblockColor.register({
|
||||
:id => :Purple,
|
||||
:sort_number => 6,
|
||||
:name => _INTL("Purple")
|
||||
})
|
||||
|
||||
GameData::PokeblockColor.register({
|
||||
:id => :Indigo,
|
||||
:sort_number => 7,
|
||||
:name => _INTL("Indigo")
|
||||
})
|
||||
|
||||
GameData::PokeblockColor.register({
|
||||
:id => :Brown,
|
||||
:sort_number => 8,
|
||||
:name => _INTL("Brown")
|
||||
})
|
||||
|
||||
GameData::PokeblockColor.register({
|
||||
:id => :LiteBlue,
|
||||
:sort_number => 9,
|
||||
:name => _INTL("LiteBlue")
|
||||
})
|
||||
|
||||
GameData::PokeblockColor.register({
|
||||
:id => :Olive,
|
||||
:sort_number => 10,
|
||||
:name => _INTL("Olive")
|
||||
})
|
||||
|
||||
GameData::PokeblockColor.register({
|
||||
:id => :Gold,
|
||||
:sort_number => 11,
|
||||
:name => _INTL("Gold")
|
||||
})
|
||||
|
||||
GameData::PokeblockColor.register({
|
||||
:id => :Gray,
|
||||
:sort_number => 12,
|
||||
:name => _INTL("Gray")
|
||||
})
|
||||
|
||||
GameData::PokeblockColor.register({
|
||||
:id => :White,
|
||||
:sort_number => 13,
|
||||
:name => _INTL("White")
|
||||
})
|
||||
|
||||
GameData::PokeblockColor.register({
|
||||
:id => :Black,
|
||||
:sort_number => 99,
|
||||
:name => _INTL("Black")
|
||||
})
|
||||
|
||||
GameData::PokeblockColor.register({
|
||||
:id => :Rainbow,
|
||||
:sort_number => 15,
|
||||
:name => _INTL("Rainbow")
|
||||
})
|
||||
@@ -0,0 +1,224 @@
|
||||
#===============================================================================
|
||||
# Item Handlers
|
||||
#===============================================================================
|
||||
|
||||
ItemHandlers::UseInField.add(:POKEBLOCKCASE, proc { |item|
|
||||
next pbPokeblockCase
|
||||
})
|
||||
|
||||
ItemHandlers::UseInField.add(:POKEBLOCKKIT, proc { |item|
|
||||
next pbPokeblockKit
|
||||
})
|
||||
|
||||
ItemHandlers::UseInField.add(:POKEBLOCKCONDITION, proc { |item|
|
||||
next pbPokeblockCondition
|
||||
})
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Misc Commands
|
||||
#===============================================================================
|
||||
|
||||
class PokemonBag
|
||||
def hasAnyBerry?
|
||||
GameData::Item.each { |i|
|
||||
return true if GameData::Item.get(i.id).is_berry? && $PokemonBag.pbQuantity(i.id)>0
|
||||
}
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Pokeblock Commands
|
||||
#===============================================================================
|
||||
|
||||
def pbCreatePokeblock(color,flavor,plus=false,feel=0)
|
||||
pokeblock = Pokeblock.new(color,flavor,feel,plus)
|
||||
return pokeblock
|
||||
end
|
||||
|
||||
def pbGainPokeblock(pokeblock)
|
||||
$Trainer.gainPokeblock(pokeblock)
|
||||
end
|
||||
|
||||
def pbRemovePokeblock(block,qty=1)
|
||||
pokeblocks = $Trainer.pokeblocks
|
||||
return true if qty == 0
|
||||
ret = false
|
||||
pokeblocks.each_with_index do |block_slot, i|
|
||||
next if !block_slot || block_slot != block
|
||||
pokeblocks[i] = nil
|
||||
ret = true
|
||||
break
|
||||
end
|
||||
pokeblocks.compact!
|
||||
return ret
|
||||
end
|
||||
|
||||
def pbGiveSimplePokeblock(color = nil,qty = 1,plus = nil) #Really for Debugging only
|
||||
qty.times { |i|
|
||||
clr = (color != nil ? color : ["Red","Blue","Pink","Green","Yellow","Rainbow"].sample)
|
||||
p = plus != nil ? plus : (rand(3)==0 ? true : false)
|
||||
val = (p ? 15 : 5)
|
||||
pkblk = nil
|
||||
case clr
|
||||
when "Red" || :Red
|
||||
pkblk = Pokeblock.new(:Red,[val,0,0,0,0],15,p)
|
||||
when "Blue" || :Blue
|
||||
pkblk = Pokeblock.new(:Blue,[0,val,0,0,0],15,p)
|
||||
when "Pink" || :Pink
|
||||
pkblk = Pokeblock.new(:Pink,[0,0,val,0,0],15,p)
|
||||
when "Green" || :Green
|
||||
pkblk = Pokeblock.new(:Green,[0,0,0,val,0],15,p)
|
||||
when "Yellow" || :Yellow
|
||||
pkblk = Pokeblock.new(:Yellow,[0,0,0,0,val],15,p)
|
||||
when "Rainbow" || :Rainbow
|
||||
pkblk = Pokeblock.new(:Rainbow,[val,val,val,val,val],40,p)
|
||||
end
|
||||
pbGainPokeblock(pkblk)
|
||||
}
|
||||
end
|
||||
|
||||
def pbFeedPokeblock(pokeblock,oldScene=nil)
|
||||
if $Trainer.pokemon_count == 0
|
||||
pbMessage(_INTL("There is no Pokémon."))
|
||||
return 0
|
||||
end
|
||||
ret = false
|
||||
ret = pbPokeblockCondition(pokeblock,oldScene)
|
||||
return ret
|
||||
end
|
||||
|
||||
def pbPokeblockCase
|
||||
if !$Trainer.hasPokeblocks?
|
||||
pbMessage(_INTL("You don't have any Pokéblocks!"))
|
||||
return false
|
||||
end
|
||||
pbFadeOutIn {
|
||||
scene = PokeblockCase_Scene.new
|
||||
screen = PokeblockCase_Screen.new(scene)
|
||||
ret = screen.pbStartScreen
|
||||
}
|
||||
end
|
||||
|
||||
def pbPokeblockCondition(pokeblock=nil,oldScene=nil)
|
||||
ret = 0
|
||||
pbFadeOutIn {
|
||||
scene = PokeblockCondition_Scene.new(pokeblock,$Trainer.able_party)
|
||||
screen = PokeblockCondition_Screen.new(scene,$Trainer.able_party)
|
||||
ret = screen.pbStartScreen(pokeblock)
|
||||
oldScene&.pbRefresh
|
||||
}
|
||||
return ret
|
||||
end
|
||||
|
||||
def pbPokeblockKit
|
||||
pbFadeOutIn {
|
||||
scene = PokeblockKit_Scene.new
|
||||
screen = PokeblockKit_Screen.new(scene)
|
||||
ret = screen.pbStartScreen
|
||||
}
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# BerryPoffin Module
|
||||
#===============================================================================
|
||||
|
||||
module BerryPoffin
|
||||
module_function
|
||||
|
||||
def pbPickBerryForBlender
|
||||
berry = nil
|
||||
pbFadeOutIn {
|
||||
scene = PokemonBag_Scene.new
|
||||
screen = PokemonBagScreen.new(scene, $PokemonBag)
|
||||
berry = screen.pbChooseItemScreen(proc { |item| GameData::Item.get(item).is_berry? })
|
||||
}
|
||||
return nil if !berry
|
||||
berry = GameData::Item.get(berry).id
|
||||
$PokemonBag.pbDeleteItem(berry, 1)
|
||||
return berry
|
||||
end
|
||||
|
||||
def pbPickBerryForBlenderSimple
|
||||
berries = nil
|
||||
pbFadeOutIn {
|
||||
scene = MultiBerrySelection_Scene.new
|
||||
screen = MultiBerrySelectionScreen.new(scene, $PokemonBag)
|
||||
berries = screen.pbStartScreen(proc { |item| GameData::Item.get(item).pocket == PokeblockSettings::BERRY_POCKET_OF_BAG &&
|
||||
GameData::Item.get(item).is_berry? })
|
||||
|
||||
}
|
||||
return nil if !berries || berries.empty?
|
||||
berries.each { |b| b=GameData::Item.get(b).id; $PokemonBag.pbDeleteItem(b, 1) }
|
||||
return berries
|
||||
end
|
||||
|
||||
def averageSmoothness(berries)
|
||||
if !berries.is_a?(Array)
|
||||
return GameData::BerryData.get(berries).smoothness
|
||||
end
|
||||
sum = 0
|
||||
berries.each{ |i|
|
||||
sum += GameData::BerryData.get(i).smoothness
|
||||
}
|
||||
average = sum/berries.size - berries.size
|
||||
average = 99 if average>=99
|
||||
return average
|
||||
end
|
||||
|
||||
def nature(nature, flavorArray)
|
||||
like = dislike = nil
|
||||
PokeblockSettings::NATURE_FLAVOR_PREFERENCES["Likes"].each_with_index { |value,index|
|
||||
break like = index if value.include?(nature)
|
||||
}
|
||||
PokeblockSettings::NATURE_FLAVOR_PREFERENCES["Dislikes"].each_with_index { |value,index|
|
||||
break dislike = index if value.include?(nature)
|
||||
}
|
||||
flavorArray[like] *= 1.1 if like
|
||||
flavorArray[dislike] *= 0.9 if dislike
|
||||
return flavorArray.map { |i| i.round }
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Debug Menu Options
|
||||
#===============================================================================
|
||||
#
|
||||
# MenuHandlers.add(:debug_menu, :contest_menu, {
|
||||
# "name" => _INTL("Pokeblock/Contest Options..."),
|
||||
# "parent" => :main,
|
||||
# "description" => _INTL("Control Pokeblocks, Contest Options, etc."),
|
||||
# "always_show" => false
|
||||
# })
|
||||
#
|
||||
# MenuHandlers.add(:debug_menu, :pokeblock_Menu, {
|
||||
# "name" => _INTL("Pokeblocks..."),
|
||||
# "parent" => :contest_menu,
|
||||
# "description" => _INTL("Manipulate Pokeblocks"),
|
||||
# "always_show" => false
|
||||
# })
|
||||
#
|
||||
# MenuHandlers.add(:debug_menu, :give_pokeblock, {
|
||||
# "name" => _INTL("Give Pokeblocks"),
|
||||
# "parent" => :pokeblock_Menu,
|
||||
# "description" => _INTL("Give the player simple Pokeblocks"),
|
||||
# "effect" => proc {
|
||||
# cmd = 0
|
||||
# cmds = [_INTL("Rainbow"),_INTL("Red"),_INTL("Blue"),_INTL("Pink"),_INTL("Green"),_INTL("Yellow"),_INTL("Random")]
|
||||
# loop do
|
||||
# color = pbShowCommands(nil, cmds, -1, cmd)
|
||||
# break if color < 0
|
||||
# color = color == 6 ? nil : cmds[color]
|
||||
# plus = pbConfirmMessage("Make +?")
|
||||
# params = ChooseNumberParams.new
|
||||
# params.setRange(1, 99)
|
||||
# params.setInitialValue(1)
|
||||
# params.setCancelValue(1)
|
||||
# qty = pbMessageChooseNumber("Give how many?",params)
|
||||
# pbGiveSimplePokeblock(color,qty,plus)
|
||||
# pbMessage(_INTL("Pokeblocks given"))
|
||||
# end
|
||||
# }
|
||||
# })
|
||||
@@ -0,0 +1,81 @@
|
||||
class Sprite
|
||||
# x: The X position of the center
|
||||
# y: The Y position of the center
|
||||
# width: The width of the pentagon (width / 2 = radius)
|
||||
# height: The height of the pentagon
|
||||
# color: The outline and fill color of the pentagon
|
||||
# y_offset: Defaults to (height / 4.0). The lower this is, the higher up (and
|
||||
# lower down) the corners of the pentagon will be
|
||||
# fill: Whether or not to fill the pentagon with the chosen color
|
||||
def draw_pentagon(x, y, width, height, color, y_offset = nil, fill = false, outline_color = nil)
|
||||
self.bitmap.draw_pentagon(x, y, width, height, color, y_offset, fill, outline_color)
|
||||
end
|
||||
|
||||
# This simply calls "draw_shape_with_values" but with predefined points
|
||||
# for pentagons.
|
||||
def draw_pentagon_with_values(x, y, width, height, color, max_value, values,
|
||||
y_offset = nil, fill = false, outline = true)
|
||||
self.bitmap.draw_pentagon_with_values(x, y, width, height, color, max_value,
|
||||
values, y_offset, fill, outline)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class Bitmap
|
||||
# x: The X position of the center
|
||||
# y: The Y position of the center
|
||||
# width: The width of the pentagon (width / 2 = radius)
|
||||
# height: The height of the pentagon
|
||||
# color: The outline and fill color of the pentagon
|
||||
# y_offset: Defaults to (height / 4.0). The lower this is, the higher up (and
|
||||
# lower down) the corners of the pentagon will be
|
||||
# fill: Whether or not to fill the pentagon with the chosen color
|
||||
def draw_pentagon(x, y, width, height, color, y_offset = nil, fill = false, outline_color = nil)
|
||||
yp = y_offset || (height / 4.0).floor
|
||||
r = (height / 2.0).round
|
||||
points = []
|
||||
points[0] = Point.new(x, y - (height / 2.0).round) #top, then counterClockwise
|
||||
points[4] = Point.new(x+(r*Math.cos(Math.radians(90+1*72))).round,y-(r*Math.sin(Math.radians(90+1*72))).round)
|
||||
points[3] = Point.new(x+(r*Math.cos(Math.radians(90+2*72))).round,y-(r*Math.sin(Math.radians(90+2*72))).round)
|
||||
points[2] = Point.new(x+(r*Math.cos(Math.radians(90+3*72))).round,y-(r*Math.sin(Math.radians(90+3*72))).round)
|
||||
points[1] = Point.new(x+(r*Math.cos(Math.radians(90+4*72))).round,y-(r*Math.sin(Math.radians(90+4*72))).round)
|
||||
ret = draw_shape(color, points.concat([points[0]]), fill)
|
||||
points.each { |p| draw_line(p,Point.new(x,y),outline_color)} if outline_color
|
||||
return ret
|
||||
end
|
||||
|
||||
# This simply calls "draw_shape_with_values" but with predefined points
|
||||
# for pentagons.
|
||||
def draw_pentagon_with_values(x, y, width, height, color, max_value, values,
|
||||
y_offset = nil, fill = false, outline = true)
|
||||
yp = y_offset || (height / 4.0).floor
|
||||
r = (height / 2.0).round
|
||||
points = []
|
||||
points[0] = Point.new(x, y - (height / 2.0).round) #top, then counterClockwise
|
||||
points[4] = Point.new(x+(r*Math.cos(Math.radians(90+1*72))).round,y-(r*Math.sin(Math.radians(90+1*72))).round)
|
||||
points[3] = Point.new(x+(r*Math.cos(Math.radians(90+2*72))).round,y-(r*Math.sin(Math.radians(90+2*72))).round)
|
||||
points[2] = Point.new(x+(r*Math.cos(Math.radians(90+3*72))).round,y-(r*Math.sin(Math.radians(90+3*72))).round)
|
||||
points[1] = Point.new(x+(r*Math.cos(Math.radians(90+4*72))).round,y-(r*Math.sin(Math.radians(90+4*72))).round)
|
||||
return draw_shape_with_values(color, x, y, points, max_value, values, fill, outline)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
module Math
|
||||
module_function
|
||||
def radians(degrees)
|
||||
return degrees * Math::PI/180
|
||||
end
|
||||
end
|
||||
|
||||
def pbDrawStatsPentagonBase(sprite,centerX,centerY,radius,outlineColor,bgdColor)
|
||||
sprite.draw_pentagon(centerX,centerY,radius*2,radius*2,outlineColor,nil,true)
|
||||
sprite.draw_pentagon(centerX,centerY,radius*2-12,radius*2-12,bgdColor,nil,true,outlineColor)
|
||||
# sprite.draw_pentagon_with_values(centerX,centerY,radius*2-12,radius*2-12,chartColor,255,stats,nil,true,false)
|
||||
end
|
||||
|
||||
def pbDrawStatsPentagon(sprite,stats,centerX,centerY,radius,chartColor)
|
||||
# sprite.draw_pentagon(centerX,centerY,radius*2,radius*2,outlineColor,nil,true)
|
||||
# sprite.draw_pentagon(centerX,centerY,radius*2-12,radius*2-12,bgdColor,nil,true,outlineColor)
|
||||
sprite.draw_pentagon_with_values(centerX,centerY,radius*2-12,radius*2-12,chartColor,255,stats,nil,true,false)
|
||||
end
|
||||
Reference in New Issue
Block a user