mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2026-07-22 15:47:00 +00:00
Update 6.8
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
module GameData
|
||||
NORMAL_RANK_CONTEST_POKEMON = {
|
||||
"Beauty" => [:SLAKOTH, :BEAUTIFLY, :ELECTRIKE, :DUSTOX, :TAILLOW, :WINGULL, :ZUBAT, :CORPHISH, :LOTAD, :SILCOON, :COTTONNEE, ],
|
||||
"Cute" => [:HOPPIP, :SLAKOTH, :ZIGZAGOON, :LEDYBA, :POLIWAG, :WINGULL, :GULPIN, :ZUBAT, :WHISMUR, :MINUN, :PLUSLE, :EEVEE, :MARILL, :PICHU, :PARAS, ],
|
||||
"Tough" => [:SLAKOTH, :POLIWAG, :DIGLETT, :TOTODILE, :POOCHYENA, :SEEDOT, :DELIBIRD, :GEODUDE, :MAKUHITA, :ARON, :MAGIKARP, :MARILL, :CACNEA],
|
||||
"Smart" => [:BULBASAUR, :BUTTERFREE, :DIGLETT, :SHROOMISH, :SEEDOT , :NINCADA, :ZUBAT, :WHISMUR , :RALTS, :PICHU,:PHANTUMP, :ZORUA,],
|
||||
"Cool" => [:ELECTRIKE, :CASCOON, :DUSTOX, :POOCHYENA, :PIDGEOTTO, :LEDYBA, :TAILLOW, :ARON, :MAKUHITA, :TENTACOOL, :DUSTOX, :PARAS, :SPEAROW],
|
||||
}
|
||||
|
||||
SUPER_RANK_CONTEST_POKEMON = {
|
||||
"Beauty" => [:BLISSEY, :GOLDEEN, :SWABLU, :LINOONE, :DODUO, :SKARMORY, :SEEL, :ROSELIA, :LOTAD, :BALTOY, :NUMEL, :MISDREAVUS, :DROWZEE, :ROSELIA, :DODUO, :LINOONE, :KECLEON, :BARBOACH, :SWABLU, :SPOINK, :NUMEL],
|
||||
"Cute" => [:BLISSEY, :LINOONE, :DODUO, :SEEL, :LOTAD, :SLOWBRO, :SPINDA, :ELEKID, :FARFETCHD, :BARBOACH, :DROWZEE, :ROSELIA, :BARBOACH, :SWABLU, :SPOINK, :SPINDA],
|
||||
"Tough" => [:BLISSEY, :DODUO, :SKARMORY, :SANDSHREW, :TRAPINCH, :SNUBULL, :HITMONCHAN, :BARBOACH, :NUMEL, :DROWZEE, :DODUO, :LINOONE, :KECLEON, :CORPHISH, :TRAPINCH],
|
||||
"Smart" => [:KECLEON, :SWABLU, :LOTAD, :SLOWBRO, :SPINDA, :BALTOY, :MISDREAVUS, :CACNEA, :BARBOACH, :DROWZEE, :CACNEA, :BALTOY, :SPINDA, :LOTAD, :MACHOKE],
|
||||
"Cool" => [:GOLDEEN, :DODUO, :SKARMORY, :SANDSHREW, :HITMONCHAN, :ELEKID, :FARFETCHD, :NUMEL, :CACNEA, :SANDSHREW, :DODUO, :LINOONE, :KECLEON, :MACHOKE, :PIKACHU],
|
||||
}
|
||||
|
||||
HYPER_RANK_CONTEST_POKEMON = {
|
||||
"Beauty" => [:BEAUTIFLY, :PINECO, :SHIFTRY, :ABSOL, :MILTANK, :HOUNDOOM, :LOMBRE, :LUNATONE, :WAILMER, :BEAUTIFLY, :NUZLEAF, :SEAKING, :CAMERUPT, :MACHOKE],
|
||||
"Cute" => [:CUBONE, :MILTANK, :NINJASK, :DUNSPARCE, :SQUIRTLE, :MAGIKARP, :LOMBRE, :KANGASKHAN, :WAILMER, :LOMBRE, :WAILMER, :MAGIKARP, :MACHOKE, :CAMERUPT],
|
||||
"Tough" => [:CUBONE, :HITMONLEE, :MACHOKE, :CASTFORM, :MIGHTYENA, :EXEGGUTOR, :DUNSPARCE, :KANGASKHAN, :LAIRON, :MAGIKARP, :LAIRON, :NINJASK, :SEVIPER, :MACHOP],
|
||||
"Smart" => [:BEAUTIFLY, :PINECO, :NINJASK, :CASTFORM, :MIGHTYENA, :EXEGGUTOR, :SEVIPER, :LUNATONE, :LAIRON, :SEAKING, :LAIRON, :MIGHTYENA, :BEAUTIFLY, :SEVIPER, :LOMBRE, :LUNATONE, :ADDISON],
|
||||
"Cool" => [:SHIFTRY, :ABSOL, :HITMONLEE, :MACHOKE, :CASTFORM, :HOUNDOOM, :KANGASKHAN, :SWELLOW, :NUZLEAF, :SWELLOW, :SEAKING, :MACHOP, :PELIPPER],
|
||||
}
|
||||
|
||||
MASTER_RANK_CONTEST_POKEMON = {
|
||||
"Beauty" => [:ALTARIA, :MILOTIC, :BELLOSSOM, :WOBBUFFET, :ESPEON, :GYARADOS, :JYNX, :ELECTRODE, :DELCATTY, :GOREBYSS, :VILEPLUME, :WOBBUFFET],
|
||||
"Cute" => [:ALTARIA, :BELLOSSOM, :TOGETIC, :CHANSEY, :PICHU, :XATU, :SLAKING, :LUVDISC, :MEOWTH, :SABLEYE, :DELCATTY, :SLOWKING, :PORYGON, :DELCATTY, :SLAKING, :LUVDISC, :PICHU, :ESPEON , :ILLUMISE],
|
||||
"Tough" => [:ALTARIA, :SHARPEDO, :HERACROSS, :WOBBUFFET, :GYARADOS, :XATU, :SLAKING, :LUVDISC, :URSARING, :DRAGONITE, :SLOWKING, :GYARADOS, :SLAKING, :HERACROSS, :SHARPEDO, :DUSCLOPS, :MACHAMP],
|
||||
"Smart" => [:ALTARIA, :BELLOSSOM, :XATU, :WOBBUFFET, :MEOWTH, :SABLEYE, :KIRLIA, :JYNX, :PORYGON, :KIRLIA, :DUSCLOPS, :ILLUMISE, :LUVDISC, :SHARPEDO],
|
||||
"Cool" => [:ALTARIA, :SHARPEDO, :HERACROSS, :WOBBUFFET, :UMBREON, :GYARADOS, :URSARING, :DRAGONITE, :ELECTRODE, :KIRLIA, :LOUDRED, :PORYGON, :GYARADOS, :LOUDRED, :ELECTRODE, :HERACROSS],
|
||||
}
|
||||
end
|
||||
@@ -0,0 +1,266 @@
|
||||
#====================================================================================
|
||||
# Contests General Settings
|
||||
#====================================================================================
|
||||
|
||||
module ContestSettings
|
||||
|
||||
#====================================================================================
|
||||
#================================ General Settings ==================================
|
||||
#====================================================================================
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
# Set this to be the number of Talent Rounds you wish to occur during a contest.
|
||||
# By default it's 5. Generation 3 uses 5, while Generation 4 uses 4.
|
||||
#--------------------------------------------------------------------------------
|
||||
NUMBER_OF_TALENT_ROUNDS = 5
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
# When true, the CONTESTPASS item is required to participate in contests.
|
||||
#--------------------------------------------------------------------------------
|
||||
REQUIRE_CONTEST_PASS_ITEM = true
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
# When true, a Pokemon's Sheen will be considered during the Introduction Round.
|
||||
# If DONT_USE_SHEEN or SIMPLIFIED_BERRY_BLENDING in Pokeblocks >
|
||||
# 000_Pokeblock_Settings is true, this will always be treated as false.
|
||||
#--------------------------------------------------------------------------------
|
||||
USE_SHEEN_FOR_INTRODUCTION_ROUND = false
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
# Set to the Switch ID that will be used to control whether or not contest info
|
||||
# can be viewed in a Pokemon's Summary. Default is 80.
|
||||
#--------------------------------------------------------------------------------
|
||||
CONTEST_INFO_IN_SUMMARY_SWITCH = 1996
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
# When true, an ORAS style applause meter will be used. Otherwise, the classic
|
||||
# applause meter from Generation 3 will be used.
|
||||
#--------------------------------------------------------------------------------
|
||||
USE_ORAS_APPLAUSE_METER = true
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
# When true, if a Pokemon maxes out the Applause meter and they have an available
|
||||
# mega evolution, they mega evolve and gain an extra 2 appeal.
|
||||
#--------------------------------------------------------------------------------
|
||||
SHOW_SPECIAL_TRANSFORMATIONS = false
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
# When true, executing a combo in a contest will double the base appeal a move
|
||||
# does (which happens in Generation 3). Otherwise, it will do +3 (which happens
|
||||
# in Generation 6).
|
||||
#--------------------------------------------------------------------------------
|
||||
COMBOS_DOUBLE_APPEAL = true
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
# Set the BGM file name for the audio that will play when showing a contest's
|
||||
# results. By default, it's "RSE 235 Results Announcement" (when using that BGM,
|
||||
# make sure to credit ENLS’s Pre-Looped Music Library https://reliccastle.com/resources/663/
|
||||
#--------------------------------------------------------------------------------
|
||||
BGM_CONTEST_RESULTS_FILE = "RSE 235 Results Announcement"
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
# Set the BGM file name for the audio that will play when congratulating the
|
||||
# contest winner. By default, it's "RSE 236 Contest Won!" (when using that BGM,
|
||||
# make sure to credit ENLS’s Pre-Looped Music Library https://reliccastle.com/resources/663/
|
||||
#--------------------------------------------------------------------------------
|
||||
BGM_CONTEST_WON_FILE = "RSE 236 Contest Won!"
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
# Define which ribbons (as defined in PBS > ribbons) are awarded for each contest
|
||||
# based on category. Within each category's array, define them in the order of
|
||||
# rank: [Normal, Super, Hyper, Master]
|
||||
#--------------------------------------------------------------------------------
|
||||
CONTEST_RIBBONS = {
|
||||
0 => [:HOENNCOOL,:HOENNCOOLSUPER,:HOENNCOOLHYPER,:HOENNCOOLMASTER], # Cool
|
||||
1 => [:HOENNBEAUTY,:HOENNBEAUTYSUPER,:HOENNBEAUTYHYPER,:HOENNBEAUTYMASTER], # Beauty
|
||||
2 => [:HOENNCUTE,:HOENNCUTESUPER,:HOENNCUTEHYPER,:HOENNCUTEMASTER], # Cute
|
||||
3 => [:HOENNSMART,:HOENNSMARTSUPER,:HOENNSMARTHYPER,:HOENNSMARTMASTER], # Smart
|
||||
4 => [:HOENNTOUGH,:HOENNTOUGHSUPER,:HOENNTOUGHHYPER,:HOENNTOUGHMASTER] # Tough
|
||||
}
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
# Define which items are awarded for each contest based on category if your
|
||||
# winning Pokemon already has the associated ribbon. Within each category's array,
|
||||
# define them in the order of rank: [Normal, Super, Hyper, Master]
|
||||
#--------------------------------------------------------------------------------
|
||||
CONTEST_OTHER_PRIZE = {
|
||||
0 => [:POTION,:SUPERPOTION,:HYPERPOTION,:FULLRESTORE], # Cool
|
||||
1 => [:POTION,:SUPERPOTION,:HYPERPOTION,:FULLRESTORE], # Beauty
|
||||
2 => [:POTION,:SUPERPOTION,:HYPERPOTION,:FULLRESTORE], # Cute
|
||||
3 => [:POTION,:SUPERPOTION,:HYPERPOTION,:FULLRESTORE], # Smart
|
||||
4 => [:POTION,:SUPERPOTION,:HYPERPOTION,:FULLRESTORE] # Tough
|
||||
}
|
||||
|
||||
#====================================================================================
|
||||
#================================ Technical Settings ================================
|
||||
#====================================================================================
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
# When true, instead of using ContestDescription as defined in movesx_contest,
|
||||
# the Contest Description for moves will be written based on its
|
||||
# ContestFunctionCode. These are defined in 010_Move_Functions.
|
||||
#--------------------------------------------------------------------------------
|
||||
GET_MOVE_DESCRIPTIONS_FROM_FUNCTION = false
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
# Default focal points of user and target in animations.
|
||||
#--------------------------------------------------------------------------------
|
||||
# Base X and Y coordinates for the User
|
||||
USER_X_BASE = 466
|
||||
USER_Y_BASE = 176
|
||||
# Offset X and Y coordinates for the User
|
||||
USER_X_OFFSET = 0
|
||||
USER_Y_OFFSET = 0
|
||||
# Equation to calculate X and Y cordinates for the User
|
||||
FOCUSUSER_X = USER_X_BASE + USER_X_OFFSET
|
||||
FOCUSUSER_Y = USER_Y_BASE + USER_Y_OFFSET
|
||||
|
||||
# Base X and Y coordinates for the "target" of moves (invisible)
|
||||
TARGET_X_BASE = 96
|
||||
TARGET_Y_BASE = 96
|
||||
# Offset X and Y coordinates for the "target" of moves (invisible)
|
||||
TARGET_X_OFFSET = 0
|
||||
TARGET_Y_OFFSET = 0
|
||||
# Equation to calculate X and Y cordinates for the "target" of moves (invisible)
|
||||
FOCUSTARGET_X = TARGET_X_BASE + TARGET_X_OFFSET
|
||||
FOCUSTARGET_Y = TARGET_Y_BASE + TARGET_Y_OFFSET
|
||||
|
||||
#====================================================================================
|
||||
#================================ Move Combo Definitions ============================
|
||||
#====================================================================================
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
# This is where contest combos are defined. The move defined on the left will
|
||||
# start a combo, and any move included in its associated array will successfully
|
||||
# execute the combo.
|
||||
#--------------------------------------------------------------------------------
|
||||
COMBOS = {
|
||||
:AGILITY => [:BATONPASS,:ELECTROBALL],
|
||||
:AMNESIA => [:BATONPASS,:STOREDPOWER],
|
||||
:BELLYDRUM => [:REST],
|
||||
:BLOCK => [:EXPLOSION,:MEMENTO,:PERISHSONG,:SELFDESTRUCT],
|
||||
:CALMMIND => [:BATONPASS,:CONFUSION,:DREAMEATER,:FUTURESIGHT,:LIGHTSCREEN,:LUSTERPURGE,:MEDITATE,:MISTBALL,:PSYBEAM,:PSYCHIC,:PSYCHOBOOST,:PSYWAVE,:REFLECT,:STOREDPOWER],
|
||||
:CELEBRATE => [:BESTOW,:FLING,:PRESENT],
|
||||
:CHARGE => [:CHARGEBEAM,:DISCHARGE,:ELECTROBALL,:NUZZLE,:PARABOLICCHARGE,:SHOCKWAVE,:SPARK,:THUNDER,:THUNDERBOLT,:THUNDERPUNCH,:THUNDERSHOCK,:THUNDERWAVE,:VOLTSWITCH,:VOLTTACKLE,:ZAPCANNON],
|
||||
:CHARM => [:FLATTER,:GROWL,:REST,:TAILWHIP],
|
||||
:CONFUSION => [:FUTURESIGHT,:KINESIS,:PSYCHIC,:TELEPORT],
|
||||
:COVET => [:BESTOW,:FLING,:PRESENT],
|
||||
:CURSE => [:DESTINYBOND,:GRUDGE,:MEANLOOK,:SPITE],
|
||||
:DARKVOID => [:DREAMEATER,:HEX,:NIGHTMARE,:WAKEUPSLAP],
|
||||
:DEFENSECURL => [:ICEBALL,:ROLLOUT,:TACKLE],
|
||||
:DIVE => [:SURF],
|
||||
:DOUBLETEAM => [:AGILITY,:QUICKATTACK,:TELEPORT],
|
||||
:DRAGONBREATH => [:DRAGONCLAW,:DRAGONDANCE,:DRAGONRAGE],
|
||||
:DRAGONDANCE => [:DRAGONBREATH,:DRAGONCLAW,:DRAGONRAGE],
|
||||
:DRAGONRAGE => [:DRAGONBREATH,:DRAGONCLAW,:DRAGONDANCE],
|
||||
:EARTHQUAKE => [:ERUPTION,:FISSURE],
|
||||
:ELECTRICTERRAIN=> [:TERRAINPULSE,:RISINGVOLTAGE],
|
||||
:ENCORE => [:COUNTER,:DESTINYBOND,:GRUDGE,:METALBURST,:MIRRORCOAT,:SPITE],
|
||||
:ENDURE => [:ENDEAVOR,:FLAIL,:PAINSPLIT,:REVERSAL],
|
||||
:ENTRAINMENT => [:CIRCLETHROW,:ROAR,:SEISMICTOSS,:SKYDROP,:SMACKDOWN,:STORMTHROW,:VITALTHROW,:WAKEUPSLAP],
|
||||
:FAKEOUT => [:ARMTHRUST,:FEINTATTACK,:KNOCKOFF,:SEISMICTOSS,:VITALTHROW],
|
||||
:FIREPUNCH => [:ICEPUNCH,:THUNDERPUNCH],
|
||||
:FOCUSENERGY => [:ARMTHRUST,:BLAZEKICK,:BRICKBREAK,:CROSSCHOP,:DOUBLEEDGE,:DRILLRUN,:DYNAMICPUNCH,:FOCUSPUNCH,:HEADBUTT,:KARATECHOP,:NIGHTSLASH,:POISONTAIL,:SHADOWCLAW,:SKYUPPERCUT,:STONEEDGE,:TAKEDOWN],
|
||||
:FORCEPALM => [:HEX,:SMELLINGSALTS],
|
||||
:GLARE => [:HEX,:SMELLINGSALTS],
|
||||
:GRASSWHISTLE => [:DREAMEATER,:HEX,:NIGHTMARE,:WAKEUPSLAP],
|
||||
:GRASSYTERRAIN => [:TERRAINPULSE,:GRASSYGLIDE,:FLORALHEALING],
|
||||
:GRAVITY => [:GRAVAPPLE],
|
||||
:GROWTH => [:ABSORB,:BULLETSEED,:FRENZYPLANT,:GIGADRAIN,:LEECHSEED,:MAGICALLEAF,:MEGADRAIN,:PETALDANCE,:RAZORLEAF,:SOLARBEAM,:VINEWHIP],
|
||||
:HAIL => [:AURORABEAM,:BLIZZARD,:GLACIATE,:HAZE,:ICEBALL,:ICEBEAM,:ICICLECRASH,:ICICLESPEAR,:ICYWIND,:POWDERSNOW,:SHEERCOLD,:WEATHERBALL],
|
||||
:HAPPYHOUR => [:BESTOW,:FLING,:PRESENT],
|
||||
:HARDEN => [:DOUBLEEDGE,:PROTECT,:ROLLOUT,:TACKLE,:TAKEDOWN],
|
||||
:HONECLAWS => [:BATONPASS,:STOREDPOWER],
|
||||
:HORNATTACK => [:HORNDRILL,:FURYATTACK],
|
||||
:HYPNOSIS => [:DREAMEATER,:HEX,:NIGHTMARE,:WAKEUPSLAP],
|
||||
:ICEPUNCH => [:FIREPUNCH,:THUNDERPUNCH],
|
||||
:INFERNO => [:HEX],
|
||||
:KINESIS => [:CONFUSION,:FUTURESIGHT,:PSYCHIC,:TELEPORT],
|
||||
:LEER => [:BITE,:FEINTATTACK,:GLARE,:HORNATTACK,:SCARYFACE,:SCRATCH,:STOMP,:TACKLE],
|
||||
:LOCKON => [:SUPERPOWER,:THUNDER,:TRIATTACK,:ZAPCANNON],
|
||||
:LOVELYKISS => [:DREAMEATER,:HEX,:NIGHTMARE,:WAKEUPSLAP],
|
||||
:MEANLOOK => [:DESTINYBOND,:EXPLOSION,:MEMENTO,:PERISHSONG,:SELFDESTRUCT],
|
||||
:METALSOUND => [:METALCLAW],
|
||||
:MINDREADER => [:DYNAMICPUNCH,:HIJUMPKICK,:SHEERCOLD,:SUBMISSION,:SUPERPOWER],
|
||||
:MISTYTERRAIN => [:TERRAINPULSE,:MISTYEXPLOSION],
|
||||
:MUDSPORT => [:MUDSLAP,:WATERGUN,:WATERSPORT],
|
||||
:NASTYPLOT => [:BATONPASS,:STOREDPOWER],
|
||||
:PARABOLICCHARGE=> [:ELECTRIFY],
|
||||
:PECK => [:DRILLPECK,:FURYATTACK],
|
||||
:PLAYNICE => [:CIRCLETHROW,:ROAR,:SEISMICTOSS,:SKYDROP,:SMACKDOWN,:STORMTHROW,:VITALTHROW,:WAKEUPSLAP],
|
||||
:POISONGAS => [:HEX,:VENOMDRENCH,:VENOSHOCK],
|
||||
:POISONPOWDER => [:HEX,:VENOMDRENCH,:VENOSHOCK],
|
||||
:POUND => [:DOUBLESLAP,:FEINTATTACK,:SLAM],
|
||||
:POWDERSNOW => [:BLIZZARD],
|
||||
:PSYCHIC => [:CONFUSION,:TELEPORT,:FUTURESIGHT,:KINESIS],
|
||||
:PSYCHICTERRAIN => [:TERRAINPULSE,:EXPANDINGFORCE],
|
||||
:RAGE => [:LEER,:SCARYFACE,:THRASH],
|
||||
:RAINDANCE => [:BUBBLE,:BUBBLEBEAM,:CLAMP,:CRABHAMMER,:DIVE,:HURRICANE,:HYDROCANNON,:HYDROPUMP,:MUDDYWATER,:OCTAZOOKA,:SOAK,:SURF,:THUNDER,:WATERGUN,
|
||||
:WATERPULSE,:WATERSPORT,:WATERSPOUT,:WATERFALL,:WEATHERBALL,:WHIRLPOOL],
|
||||
:REST => [:SLEEPTALK,:SNORE],
|
||||
:ROCKPOLISH => [:BATONPASS,:ELECTROBALL],
|
||||
:ROCKTHROW => [:ROCKSLIDE,:ROCKTOMB],
|
||||
:ROTOTILLER => [:BULLETSEED,:LEECHSEED,:SEEDBOMB,:WORRYSEED],
|
||||
:SANDATTACK => [:MUDSLAP],
|
||||
:SANDSTORM => [:MUDSHOT,:MUDSLAP,:MUDSPORT,:SANDTOMB,:SANDATTACK,:WEATHERBALL],
|
||||
:SCARYFACE => [:BITE,:CRUNCH,:LEER],
|
||||
:SCRATCH => [:FURYSWIPES,:SLASH],
|
||||
:SHIFTGEAR => [:GEARGRIND],
|
||||
:SING => [:DREAMEATER,:HEX,:NIGHTMARE,:PERISHSONG,:REFRESH,:WAKEUPSLAP],
|
||||
:SLEEPPOWDER => [:DREAMEATER,:HEX,:NIGHTMARE,:WAKEUPSLAP],
|
||||
:SLUDGE => [:SLUDGEBOMB],
|
||||
:SLUDGEBOMB => [:SLUDGE],
|
||||
:SMOG => [:SMOKESCREEN],
|
||||
:SOFTBOILED => [:EGGBOMB],
|
||||
:SPIKES => [:DRAGONTAIL,:ROAR,:WHIRLWIND],
|
||||
:SPORE => [:DREAMEATER,:HEX,:NIGHTMARE,:WAKEUPSLAP],
|
||||
:STEALTHROCK => [:DRAGONTAIL,:ROAR,:WHIRLWIND],
|
||||
:STOCKPILE => [:SPITUP,:SWALLOW],
|
||||
:STRINGSHOT => [:ELECTROWEB,:SPIDERWEB,:STICKYWEB],
|
||||
:SUNNYDAY => [:BLASTBURN,:BLAZEKICK,:EMBER,:ERUPTION,:FIREBLAST,:FIREPUNCH,:FIRESPIN,:FLAMEWHEEL,:FLAMETHROWER,:GROWTH,:HEATWAVE,:MOONLIGHT,
|
||||
:MORNINGSUN,:OVERHEAT,:SACREDFIRE,:SOLARBEAM,:SYNTHESIS,:WEATHERBALL,:WILLOWISP],
|
||||
:SURF => [:DIVE],
|
||||
:SWEETSCENT => [:POISONPOWDER,:SLEEPPOWDER,:STUNSPORE],
|
||||
:SWORDSDANCE => [:CRABHAMMER,:CRUSHCLAW,:CUT,:FALSESWIPE,:FURYCUTTER,:SLASH],
|
||||
:TAUNT => [:COUNTER,:DESTINYBOND,:DETECT,:GRUDGE,:METALBURST,:MIRRORCOAT,:SPITE],
|
||||
:THUNDERPUNCH => [:FIREPUNCH,:ICEPUNCH],
|
||||
:THUNDERWAVE => [:HEX,:SMELLINGSALTS],
|
||||
:TORMENT => [:COUNTER,:DESTINYBOND,:GRUDGE,:METALBURST,:MIRRORCOAT,:SPITE],
|
||||
:TOXIC => [:HEX,:VENOMDRENCH,:VENOSHOCK],
|
||||
:TOXICSPIKES => [:DRAGONTAIL,:HEX,:ROAR,:VENOMDRENCH,:VENOSHOCK,:WHIRLWIND],
|
||||
:VICEGRIP => [:BIND,:GUILLOTINE],
|
||||
:WATERSPORT => [:MUDSPORT,:REFRESH,:WATERGUN],
|
||||
:WILLOWISP => [:HEX],
|
||||
:WISH => [:BESTOW,:FLING,:PRESENT],
|
||||
:YAWN => [:DREAMEATER,:HEX,:NIGHTMARE,:REST,:SLACKOFF,:WAKEUPSLAP],
|
||||
}
|
||||
|
||||
#https://bulbapedia.bulbagarden.net/wiki/Contest_combination#In_the_anime
|
||||
ANIME_COMBOS = { #Not implemented, but possibly in the future
|
||||
"Swift-Ember" => [:EMBER,:SWIFT],
|
||||
"Shadow Ball-Swift" => [:SHADOWBALL,:SWIFT],
|
||||
"Razor Leaf-Silver Wind" => [:RAZORLEAF,:SILVERWIND],
|
||||
"Swift-Psychic" => [:PSYCHIC,:SWIFT],
|
||||
"Focus Ball" => [:FOCUSPUNCH,:SHADOWBALL],
|
||||
"Dragon Razor Wind" => [:DRAGONBREATH,:RAZORWIND],
|
||||
"Water and Fire Whirlwind" => [:BUBBLE,:FIRESPIN],
|
||||
"Mud Bomb-Shock Wave" => [:MUDBOMB,:SHOCKWAVE],
|
||||
"Spinning Poison Sting" => [:POISONSTING,:POISONTAIL],
|
||||
"Shadow Claw-Blizzard" => [:BLIZZARD,:SHADOWCLAW],
|
||||
"Ice Aqua Jet" => [:AQUAJET,:ICEBEAM],
|
||||
"Flame Ice" => [:FLAMEWHEEL,:ICESHARD],
|
||||
"Haze-SonicBoom" => [:HAZE,:SONICBOOM],
|
||||
"Poison Tail-Silver Wind" => [:POISONTAIL,:SILVERWIND],
|
||||
"Quadruple Combination" => [:ICESHARD,:SWIFT,:TAKEDOWN],
|
||||
"Scare Face-Sandstorm" => [:SANDSTORM,:SCARYFACE],
|
||||
"Ice Chandelier" => [:ICEBEAM,:DISCHARGE],
|
||||
"Energy Fusion Ball" => [:ENERGYBALL,:SHOCKWAVE],
|
||||
"Snowflakes" => [:BLIZZARD,:SILVERWIND],
|
||||
"Aerial Ace-Psywave" => [:AERIALACE,:PSYWAVE],
|
||||
"Signal Tail" => [:IRONTAIL,:SIGNALBEAM],
|
||||
"Aura Whirlpool" => [:AURASPHERE,:WHIRLPOOL],
|
||||
"Rocket Formation" => [:PECK,:SKYATTACK],
|
||||
"Electrified Psycho Cut" => [:PSYCHOCUT,:THUNDERBOLT]
|
||||
}
|
||||
|
||||
end
|
||||
@@ -0,0 +1,98 @@
|
||||
#====================================================================================
|
||||
# Contests Map Settings
|
||||
#====================================================================================
|
||||
|
||||
module ContestSettings
|
||||
|
||||
#====================================================================================
|
||||
#============================ Default Lobby Definitions =============================
|
||||
#====================================================================================
|
||||
#--------------------------------------------------------------------------------
|
||||
# In contest lobby maps, this is the Event ID that represents the Front Desk
|
||||
# Event. By default, it's 1.
|
||||
#--------------------------------------------------------------------------------
|
||||
FRONT_DESK_GUIDE_EVENT = 1
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
# In contest lobby maps, this array is a list of Event IDs that represent the
|
||||
# doors of the front desk. These will toggle Self Switch A as to appear opening.
|
||||
# By default, it's [2, 3]
|
||||
#--------------------------------------------------------------------------------
|
||||
FRONT_DESK_DOOR_EVENTS = [2, 3]
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
# Define the default lobby map for contests. By default, it's 33.
|
||||
#--------------------------------------------------------------------------------
|
||||
DEFAULT_LOBBY_MAP_ID = 110
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
# Define the default return coordinates for contests. It's set up in the
|
||||
# following way: [Lobby Map ID, x, y, facing direction]
|
||||
# - Lobby Map ID: Recommend to just set to DEFAULT_LOBBY_MAP_ID
|
||||
# - x : the x coordinate of the Lobby Map you will return to after a contest.
|
||||
# - y : the y coordinate of the Lobby Map you will return to after a contest.
|
||||
# - facing direction: the direction to face after a contest. Directions are:
|
||||
# 2=down,4=left,6=right,8=up
|
||||
# By default, it's [DEFAULT_LOBBY_MAP_ID, 1, 2, 2]
|
||||
#--------------------------------------------------------------------------------
|
||||
DEFAULT_RETURN_COORDINATES = [DEFAULT_LOBBY_MAP_ID, 11, 44, DIRECTION_UP] # [Lobby Map ID, x, y, facing direction] directions: 2=down,4=left,6=right,8=up
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
# Define the return coordinates for each contest based on rank and category.
|
||||
# If you are using only one lobby for all contests, you can leave this as is as
|
||||
# it will use the DEFAULT_RETURN_COORDINATES.
|
||||
# If you will use different buildings for different categories and/or rank,
|
||||
# define coordinates here.
|
||||
# Replace nil with a coordinate array: [Lobby Map ID, x, y, facing direction]
|
||||
# - Lobby Map ID: Map ID for the lobby for this category/rank
|
||||
# - x : the x coordinate of the Lobby Map you will return to after the contest.
|
||||
# - y : the y coordinate of the Lobby Map you will return to after the contest.
|
||||
# - facing direction: the direction to face after the contest. Directions are:
|
||||
# 2=down,4=left,6=right,8=up
|
||||
#--------------------------------------------------------------------------------
|
||||
LOBBY_MAP_COORDINATES = [
|
||||
[nil,nil,nil,nil,nil], # Normal: Cool, Beauty, Cute, Smart, Tough
|
||||
[nil,nil,nil,nil,nil], # Super: Cool, Beauty, Cute, Smart, Tough
|
||||
[nil,nil,nil,nil,nil], # Hyper: Cool, Beauty, Cute, Smart, Tough
|
||||
[nil,nil,nil,nil,nil] # Master: Cool, Beauty, Cute, Smart, Tough
|
||||
]
|
||||
#====================================================================================
|
||||
#============================= Contest Room Definitions =============================
|
||||
#====================================================================================
|
||||
#--------------------------------------------------------------------------------
|
||||
# The following are Event IDs that represent different NPCs in a Contest Room.
|
||||
#--------------------------------------------------------------------------------
|
||||
# TRAINER_NPC_ONE_EVENT = 3 # Default is 1
|
||||
# TRAINER_NPC_TWO_EVENT = 4 # Default is 2
|
||||
# TRAINER_NPC_THREE_EVENT = 5 # Default is 3
|
||||
#JUDGE_EVENT = 4 # Default is 4
|
||||
# MC_EVENT = 5 # Default is 5
|
||||
CROWD_EVENT_START = 6 # All event IDs after this number; # Default is 6
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
# The following is the Animation ID that represents the heart animation that
|
||||
# NPCs will show when judging a Pokemon in the Introduction Round of a contest.
|
||||
#--------------------------------------------------------------------------------
|
||||
HEART_ANIMATION_ID = 35
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
# Define the Map ID and starting coordinates for each contest room based on rank
|
||||
# and category. If you are using only one room for each individual rank, you can
|
||||
# leave this as is as.
|
||||
# If you will use different rooms for different categories of each rank (such as
|
||||
# to make the decor colors match the category), define coordinates here.
|
||||
# Replace nil with a coordinate array: [Map ID, x, y]
|
||||
# - Map ID: Map ID for the room for this category/rank
|
||||
# - x : the x coordinate where you will start the contest. You should usually
|
||||
# keep this as 12
|
||||
# - y : the y coordinate where you will start the contest. You should usually
|
||||
# keep this as 9
|
||||
#--------------------------------------------------------------------------------
|
||||
ROOM_MAP_COORDINATES = [
|
||||
[[110,13,21],nil,nil,nil,nil], # Normal: Cool(default), Beauty, Cute, Smart, Tough
|
||||
[[110,38,21],nil,nil,nil,nil], # Super: Cool(default), Beauty, Cute, Smart, Tough
|
||||
[[110,63,21],nil,nil,nil,nil], # Hyper: Cool(default), Beauty, Cute, Smart, Tough
|
||||
[[110,48,44],nil,nil,nil,nil] # Master: Cool(default), Beauty, Cute, Smart, Tough
|
||||
]
|
||||
|
||||
end
|
||||
+144
@@ -0,0 +1,144 @@
|
||||
#====================================================================================
|
||||
# Contests Trainer Settings
|
||||
#====================================================================================
|
||||
|
||||
module ContestSettings
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
# Default difficulty for all trainers, if not specifically defined.
|
||||
# 91+ => will always use the most optimal move
|
||||
# 76-90 => will always one of the two most optimal moves
|
||||
# 51-75 => never does the least optimal move, higher chance of using better move
|
||||
# 26-50 => never does the least optimal move
|
||||
# -25 => uses random move
|
||||
# Defined in the order of rank: [Normal, Super, Hyper, Master]
|
||||
#--------------------------------------------------------------------------------
|
||||
DEFAULT_TRAINER_DIFFICULTY = [15,30,51,70]
|
||||
|
||||
#====================================================================================
|
||||
#================================= Defined Trainers =================================
|
||||
#====================================================================================
|
||||
#--------------------------------------------------------------------------------
|
||||
# These are the lists of defined trainers (in
|
||||
# 004_Contests_Trainer_Types_Definitions) to include in contests, based on rank.
|
||||
#--------------------------------------------------------------------------------
|
||||
DEFINED_TRAINERS_NORMAL = [
|
||||
:NormalORASMicah, :NormalORASShannon, :NormalORASMateo, :NormalORASJordyn,
|
||||
:NormalORASGianna, :NormalORASDeclan, :NormalORASCarlton, :NormalORASAdeline,
|
||||
:NormalORASAsher, :NormalORASLauren, :NormalORASJeremiah, :NormalORASMolly,
|
||||
:NormalORASMartinus, :NormalORASLiliana, :NormalORASCamden
|
||||
]
|
||||
DEFINED_TRAINERS_SUPER = [
|
||||
:SuperORASKeira, :SuperORASBentley, :SuperORASPlum, :SuperORASZachary,
|
||||
:SuperORASAlyssa, :SuperORASBrody, :SuperORASMila, :SuperORASRohan,
|
||||
:SuperORASAlaina, :SuperORASLevi, :SuperORASGabriella, :SuperORASDominic,
|
||||
:SuperORASKaitlyn, :SuperORASTyler, :SuperORASAdalyn, :SuperORASChaz
|
||||
]
|
||||
DEFINED_TRAINERS_HYPER = [
|
||||
:HyperORASLandon, :HyperORASMckenzie, :HyperORASNelson, :HyperORASRiley,
|
||||
:HyperORASNathan, :HyperORASTwyla, :HyperORASGavin, :HyperORASLily,
|
||||
:HyperORASPrimo, :HyperORASAlejandra, :HyperORASYoshinari, :HyperORASLacy,
|
||||
:HyperORASOwen, :HyperORASAddison, :HyperORASJayce, :HyperORASChaz
|
||||
]
|
||||
DEFINED_TRAINERS_MASTER = [
|
||||
:MasterORASYoko, :MasterORASJeff, :MasterORASElsie, :MasterORASJaylon,
|
||||
:MasterORASLayla, :MasterORASRuslan, :MasterORASLilias, :MasterORASAiden,
|
||||
:MasterORASMadelyn, :MasterORASElijah, :MasterORASHailey, :MasterORASClayton,
|
||||
:MasterORASAudrey, :MasterORASEvan, :MasterORASJulia, :MasterORASChaz
|
||||
]
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
# Chance out of 100 that a trainer is a defined trainer rather than random
|
||||
# default. Random defaults are defined in Contest Trainer Defaults below.
|
||||
#--------------------------------------------------------------------------------
|
||||
DEFINED_TRAINER_CHANCE = 0
|
||||
|
||||
#====================================================================================
|
||||
#============================= Contest Trainer Defaults =============================
|
||||
#====================================================================================
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
# Default Pokemon
|
||||
# If a Trainer is undefinied in contests, uses a Random Pokemon included in
|
||||
# the following arrays, based on category.
|
||||
#--------------------------------------------------------------------------------
|
||||
DEFAULT_PKMN_COOL = [ # Cool
|
||||
[:LEDYBA, :MAKUHITA, :MIGHTYENA, :LOTAD, :POOCHYENA], # First trainer
|
||||
[:ARON, :POOCHYENA, :AGGRON, :ILLUMISE, :TRAPINCH], # Second trainer
|
||||
[:TOTODILE, :WHISMUR, :VOLBEAT, :WAILMER, :CORPHISH] # Third trainer
|
||||
]
|
||||
DEFAULT_PKMN_BEAUTY = [ # Beauty
|
||||
[:MILOTIC, :TYMPOLE, :VENIPEDE, :SCRAGGY, :TIRTOUGA], # First trainer
|
||||
[:SOLOSIS, :JOLTIK, :CHANDELURE, :SERPERIOR, :SAMUROTT], # Second trainer
|
||||
[:STOUTLAND, :MILOTIC, :LUCARIO, :ROSERADE, :INFERNAPE] # Third trainer
|
||||
]
|
||||
DEFAULT_PKMN_CUTE = [ # Cute
|
||||
[:RALTS, :PLUSLE, :MINUN, :ESPEON, :UMBREON], # First trainer
|
||||
[:EEVEE, :VAPOREON, :JOLTEON, :PORYGON, :PONYTA], # Second trainer
|
||||
[:DODUO, :GROWLITHE, :ESPEON, :GARDEVOIR, :LUVDISC] # Third trainer
|
||||
]
|
||||
DEFAULT_PKMN_SMART = [ # Smart
|
||||
[:CHIMCHAR, :AMBIPOM, :PANSAGE, :ZORUA, :RUFFLET], # First trainer
|
||||
[:MANDIBUZZ, :ZOROAK, :CUBONE, :GENGAR, :ZUBAT], # Second trainer
|
||||
[:ZOROAK, :ZORUA, :SNEASEL, :WEAVILE, :ARIADOS] # Third trainer
|
||||
]
|
||||
DEFAULT_PKMN_TOUGH = [ # Tough
|
||||
[:HARIYAMA, :WAILORD, :WHISCASH, :ABSOL, :PACHIRISU], # First trainer
|
||||
[:WAILORD, :BASTIODON, :LUCARIO, :TOXICROAK, :LICKILICKY], # Second trainer
|
||||
[:WAILMER, :WAILORD, :ARCHEN, :EMOLGA, :GALVANTULA] # Third trainer
|
||||
]
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
# Default Pokemon Levels
|
||||
# The level a default Pokemon will be based on rank. This is used to define the
|
||||
# Pokemon's move set.
|
||||
# Defined in the order of rank: [Normal, Super, Hyper, Master]
|
||||
#--------------------------------------------------------------------------------
|
||||
DEFAULT_PKMN_LEVEL = [25, 50, 75, 100]
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
# Default Pokemon Condition Value
|
||||
# The default condition value a Pokemon will have be based on rank.
|
||||
# Defined in the order of rank: [Normal, Super, Hyper, Master]
|
||||
# If DEFAULT_PKMN_STAT_RANDOM is set to true, then value will be bewteen 10 and
|
||||
# the appropriate DEFAULT_PKMN_STAT_VALUE
|
||||
#--------------------------------------------------------------------------------
|
||||
DEFAULT_PKMN_STAT_VALUE = [50, 85, 135, 200]
|
||||
DEFAULT_PKMN_STAT_RANDOM = true
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
# Default Pokemon Sheen Value
|
||||
# The default sheen value a Pokemon will have be based on rank.
|
||||
# Defined in the order of rank: [Normal, Super, Hyper, Master]
|
||||
# If DEFAULT_PKMN_SHEEN_RANDOM is set to true, then value will be bewteen 10 and
|
||||
# the appropriate DEFAULT_PKMN_SHEEN_VALUE
|
||||
#--------------------------------------------------------------------------------
|
||||
DEFAULT_PKMN_SHEEN_VALUE = [50, 85, 135, 200]
|
||||
DEFAULT_PKMN_SHEEN_RANDOM = true
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
# Default Trainers
|
||||
# A list of possible default trainers. For each trainer, a random one will be
|
||||
# selected from the arrays.
|
||||
# Defined in the following way:
|
||||
# [Trainer Name, Graphics\Characters file name, Graphics\Trainers file name]
|
||||
#--------------------------------------------------------------------------------
|
||||
DEFAULT_TRAINERS = [
|
||||
[ #First trainer
|
||||
["Alice","trainer_BEAUTY","BEAUTY"],
|
||||
["Alan","trainer_BIKER","BIKER"],
|
||||
["Genevieve","trainer_LADY","LADY"]
|
||||
],[ #Second trainer
|
||||
["Scott","trainer_TAMER","TAMER"],
|
||||
["Timmy","trainer_CAMPER","CAMPER"],
|
||||
["Jay","trainer_COOLTRAINER_M","COOLTRAINER_M"],
|
||||
["Faye","trainer_COOLTRAINER_F","COOLTRAINER_F"]
|
||||
],[ #Third trainer
|
||||
["Matt","trainer_BLACKBELT","BLACKBELT"],
|
||||
["Kim","trainer_AROMALADY","AROMALADY"],
|
||||
["Teri","trainer_YOUNGSTER","YOUNGSTER"],
|
||||
["Sue","trainer_PICNICKER","PICNICKER"]
|
||||
]
|
||||
]
|
||||
|
||||
end
|
||||
@@ -0,0 +1,627 @@
|
||||
#====================================================================================
|
||||
# DO NOT MAKE EDITS HERE
|
||||
#====================================================================================
|
||||
|
||||
#====================================================================================
|
||||
# PokemonContest
|
||||
#====================================================================================
|
||||
class PokemonContest
|
||||
attr_accessor :rank
|
||||
attr_accessor :category
|
||||
attr_accessor :playerPokemon
|
||||
attr_accessor :hallMapInfo #[Map ID, x, y]
|
||||
attr_accessor :returnMapInfo #[Map ID, x, y, facing direction]
|
||||
attr_accessor :trainerOne
|
||||
attr_accessor :trainerTwo
|
||||
attr_accessor :trainerThree
|
||||
attr_accessor :pokemonOne
|
||||
attr_accessor :pokemonTwo
|
||||
attr_accessor :pokemonThree
|
||||
attr_accessor :winningPosition
|
||||
attr_accessor :winningPokemon
|
||||
attr_accessor :winningTrainer
|
||||
attr_accessor :crowdEnergy
|
||||
attr_accessor :crowdPaused
|
||||
attr_accessor :round
|
||||
attr_accessor :roundOrder
|
||||
attr_accessor :nextTurnFirstOrder
|
||||
attr_accessor :nextTurnLastOrder
|
||||
attr_accessor :scramble
|
||||
attr_accessor :playerWin
|
||||
|
||||
def initialize
|
||||
@rank = -1
|
||||
@category = -1
|
||||
@playerPokemon = nil
|
||||
@hallMapInfo = nil
|
||||
@returnMapInfo = nil
|
||||
@trainerOne = @trainerTwo = @trainerThree = nil
|
||||
@pokemonOne = @pokemonTwo = @pokemonThree = nil
|
||||
@crowdEnergy = 0
|
||||
@crowdPaused = nil
|
||||
@round = 1
|
||||
@roundOrder = []
|
||||
@nextTurnFirstOrder = [nil,nil,nil,nil]
|
||||
@nextTurnLastOrder = [nil,nil,nil,nil]
|
||||
@scramble = false
|
||||
@winningPosition = 0
|
||||
@winningPokemon = nil
|
||||
@winningTrainer = nil
|
||||
@playerWin = false
|
||||
end
|
||||
|
||||
def isCrowdPaused?(pkmn)
|
||||
return false if @crowdPaused.nil?
|
||||
return false if @crowdPaused == pkmn
|
||||
return true
|
||||
end
|
||||
|
||||
def set(rank, category, pokemon, hallMapInfo, returnMapInfo)
|
||||
@rank = rank
|
||||
@category = category
|
||||
@playerPokemon = $Trainer.party[pokemon]
|
||||
@hallMapInfo = hallMapInfo
|
||||
@returnMapInfo = returnMapInfo
|
||||
setupCoordinatorPokemon
|
||||
initialOrder
|
||||
end
|
||||
|
||||
def setupCoordinatorPokemon
|
||||
if $PokemonGlobal.nextContestTrainerOne
|
||||
if $PokemonGlobal.nextContestTrainerOne.is_a?(Array)
|
||||
@trainerOne = $PokemonGlobal.nextContestTrainerOne[@category]
|
||||
else
|
||||
@trainerOne = $PokemonGlobal.nextContestTrainerOne
|
||||
end
|
||||
end
|
||||
$PokemonGlobal.nextContestTrainerOne = nil
|
||||
@trainerOne = getTrainer(0,@trainerOne)
|
||||
@pokemonOne = @trainerOne.pokemon
|
||||
@pokemonOne.setupContestVariables(@trainerOne)
|
||||
if $PokemonGlobal.nextContestTrainerTwo
|
||||
if $PokemonGlobal.nextContestTrainerTwo.is_a?(Array)
|
||||
@trainerTwo = $PokemonGlobal.nextContestTrainerTwo[@category]
|
||||
else
|
||||
@trainerTwo = $PokemonGlobal.nextContestTrainerTwo
|
||||
end
|
||||
end
|
||||
$PokemonGlobal.nextContestTrainerTwo = nil
|
||||
@trainerTwo = getTrainer(1,@trainerTwo)
|
||||
@pokemonTwo = @trainerTwo.pokemon
|
||||
@pokemonTwo.setupContestVariables(@trainerTwo)
|
||||
if $PokemonGlobal.nextContestTrainerThree
|
||||
if $PokemonGlobal.nextContestTrainerThree.is_a?(Array)
|
||||
@trainerThree = $PokemonGlobal.nextContestTrainerThree[@category]
|
||||
else
|
||||
@trainerThree = $PokemonGlobal.nextContestTrainerThree
|
||||
end
|
||||
end
|
||||
$PokemonGlobal.nextContestTrainerThree = nil
|
||||
@trainerThree = getTrainer(2,@trainerThree)
|
||||
@pokemonThree = @trainerThree.pokemon
|
||||
@pokemonThree.setupContestVariables(@trainerThree)
|
||||
@playerPokemon.setupContestVariables
|
||||
end
|
||||
|
||||
def getTrainer(position,trainer)
|
||||
#trainer defined in command
|
||||
if trainer && trainer.contest_category.include?(ContestFunctions.getCategoryNameShort(@category)) &&
|
||||
trainer.contest_rank == ContestFunctions.getRankNameShort(@rank)
|
||||
pkmn = Pokemon.new(trainer.species,ContestSettings::DEFAULT_PKMN_LEVEL[@rank])
|
||||
pkmn.moves = []
|
||||
for move in trainer.moves
|
||||
pkmn.moves.push(Pokemon::Move.new(move))
|
||||
end
|
||||
pkmn.cool = trainer.pokemon_stat_val(0)
|
||||
pkmn.beauty = trainer.pokemon_stat_val(1)
|
||||
pkmn.cute = trainer.pokemon_stat_val(2)
|
||||
pkmn.smart = trainer.pokemon_stat_val(3)
|
||||
pkmn.tough = trainer.pokemon_stat_val(4)
|
||||
pkmn.sheen = trainer.pokemon_sheen_val
|
||||
pkmn.item = trainer.pokemon_item if trainer.pokemon_item
|
||||
pkmn.shiny = trainer.pokemon_shiny if trainer.pokemon_shiny
|
||||
pkmn.form = trainer.pokemon_form if trainer.pokemon_form
|
||||
trainer.pokemon = pkmn
|
||||
return trainer
|
||||
end
|
||||
#grab defined trainer
|
||||
if rand(100) < ContestSettings::DEFINED_TRAINER_CHANCE
|
||||
trainer = nil
|
||||
while !trainer || !trainer.contest_category.include?(ContestFunctions.getCategoryNameShort(@category)) ||
|
||||
@trainerOne == trainer || @trainerTwo == trainer || @trainerThree == trainer
|
||||
case @rank
|
||||
when 0 then defined_trainer = ContestSettings::DEFINED_TRAINERS_NORMAL.sample;
|
||||
when 1 then defined_trainer = ContestSettings::DEFINED_TRAINERS_SUPER.sample;
|
||||
when 2 then defined_trainer = ContestSettings::DEFINED_TRAINERS_HYPER.sample;
|
||||
when 3 then defined_trainer = ContestSettings::DEFINED_TRAINERS_MASTER.sample;
|
||||
end
|
||||
trainer = GameData::ContestTrainer.get(defined_trainer)
|
||||
end
|
||||
pkmn = Pokemon.new(trainer.species,ContestSettings::DEFAULT_PKMN_LEVEL[@rank])
|
||||
pkmn.moves = []
|
||||
for move in trainer.moves
|
||||
pkmn.moves.push(Pokemon::Move.new(move))
|
||||
end
|
||||
pkmn.cool = trainer.pokemon_stat_val(0)
|
||||
pkmn.beauty = trainer.pokemon_stat_val(1)
|
||||
pkmn.cute = trainer.pokemon_stat_val(2)
|
||||
pkmn.smart = trainer.pokemon_stat_val(3)
|
||||
pkmn.tough = trainer.pokemon_stat_val(4)
|
||||
pkmn.sheen = trainer.pokemon_sheen_val
|
||||
pkmn.item = trainer.pokemon_item if trainer.pokemon_item
|
||||
pkmn.shiny = trainer.pokemon_shiny if trainer.pokemon_shiny
|
||||
pkmn.form = trainer.pokemon_form if trainer.pokemon_form
|
||||
trainer.pokemon = pkmn
|
||||
return trainer
|
||||
end
|
||||
#random default trainer
|
||||
trainerInfo = ContestSettings::DEFAULT_TRAINERS[position].sample
|
||||
trainerName = getRandomUnisexName
|
||||
cat_val = (ContestSettings::DEFAULT_PKMN_STAT_RANDOM ? 10 + rand(ContestSettings::DEFAULT_PKMN_STAT_VALUE[@rank]-10) :
|
||||
ContestSettings::DEFAULT_PKMN_STAT_VALUE[@rank])
|
||||
sheen_val = (ContestSettings::DEFAULT_PKMN_SHEEN_RANDOM ? 10 + rand(ContestSettings::DEFAULT_PKMN_SHEEN_VALUE[@rank]-10) :
|
||||
ContestSettings::DEFAULT_PKMN_SHEEN_VALUE[@rank])
|
||||
pkmn= create_contest_trainer_pokemon(@rank, @category)
|
||||
species = pkmn.species
|
||||
pkmn.cool = pkmn.beauty = pkmn.cute = pkmn.smart = pkmn.tough = cat_val
|
||||
pkmn.sheen = sheen_val
|
||||
#Save for when you can define default moves
|
||||
# moves = []
|
||||
# available_moves = GameData::Species.get(species).moves
|
||||
# knowable_moves = []
|
||||
# available_moves.each { |m| knowable_moves.push(m[1]) if m[0] <= ContestSettings::DEFAULT_PKMN_LEVEL[@rank] }
|
||||
# # Remove duplicates (retaining the latest copy of each move)
|
||||
# knowable_moves = knowable_moves.reverse
|
||||
# knowable_moves |= []
|
||||
# knowable_moves = knowable_moves.reverse
|
||||
# first_move_index = knowable_moves.length - 4
|
||||
# first_move_index = 0 if first_move_index < 0
|
||||
# (first_move_index...knowable_moves.length).each do |i|
|
||||
# moves.push(Pokemon::Move.new(knowable_moves[i]))
|
||||
# end
|
||||
trainer = GameData::ContestTrainer.new({
|
||||
:id => ("Trainer"+(position+1).to_s).to_sym,
|
||||
:contest_category => ContestFunctions.getCategoryNameShort(@category),
|
||||
:contest_rank => ContestFunctions.getRankNameShort(@rank),
|
||||
:name => trainerName,
|
||||
:character_sprite => trainerInfo[1],
|
||||
:trainer_sprite => trainerInfo[2],
|
||||
:pokemon_species => species,
|
||||
:pokemon_stat_val => cat_val,
|
||||
:pokemon_sheen_val => sheen_val,
|
||||
:pokemon_moves => pkmn.moves
|
||||
})
|
||||
trainer.pokemon = pkmn
|
||||
return trainer
|
||||
end
|
||||
|
||||
def create_contest_trainer_pokemon(rank, category)
|
||||
case rank
|
||||
when 0
|
||||
hashmap = GameData::NORMAL_RANK_CONTEST_POKEMON
|
||||
level = 15
|
||||
when 1
|
||||
hashmap = GameData::SUPER_RANK_CONTEST_POKEMON
|
||||
level = 25
|
||||
when 2
|
||||
hashmap = GameData::HYPER_RANK_CONTEST_POKEMON
|
||||
level = 50
|
||||
when 3
|
||||
hashmap = GameData::MASTER_RANK_CONTEST_POKEMON
|
||||
level = 75
|
||||
end
|
||||
rank_name = ContestFunctions.getCategoryNameShort(category)
|
||||
pokemon_list = hashmap[rank_name]
|
||||
|
||||
attempts = 0
|
||||
while attempts < 4
|
||||
head_pokemon = pokemon_list.sample
|
||||
body_pokemon = pokemon_list.sample
|
||||
pokemon_species = fusionOf(head_pokemon, body_pokemon)
|
||||
break if customSpriteExists(body_pokemon,head_pokemon)
|
||||
end
|
||||
return Pokemon.new(pokemon_species,level)
|
||||
|
||||
end
|
||||
|
||||
def initialOrder
|
||||
@roundOrder = [@pokemonOne, @pokemonTwo, @pokemonThree, @playerPokemon]
|
||||
case @category
|
||||
when 0 then @roundOrder.sort_by! {|p| p.cool}
|
||||
when 1 then @roundOrder.sort_by! {|p| p.beauty}
|
||||
when 2 then @roundOrder.sort_by! {|p| p.cute}
|
||||
when 3 then @roundOrder.sort_by! {|p| p.smart}
|
||||
when 4 then @roundOrder.sort_by! {|p| p.tough}
|
||||
end
|
||||
@roundOrder.reverse!
|
||||
end
|
||||
|
||||
def setOrder
|
||||
heartOrder = @roundOrder
|
||||
heartOrder.sort_by! { |p| p.c_total_hearts }
|
||||
heartOrder.reverse!
|
||||
newOrder = []
|
||||
#Scramble
|
||||
if @scramble
|
||||
newOrder = heartOrder.shuffle
|
||||
else
|
||||
#Move Up
|
||||
@roundOrder.each { |p| newOrder[@nextTurnFirstOrder.find_index(p)] = p if p.c_moveup && !p.c_movedown }
|
||||
#Heart Order
|
||||
heartOrder.each { |p| newOrder.push(p) if !newOrder.include?(p) && !p.c_movedown}
|
||||
#Move Down (ones left over))
|
||||
@roundOrder.each { |p| newOrder[@nextTurnLastOrder.find_index(p)] = p if !newOrder.include?(p) }
|
||||
end
|
||||
@roundOrder.clear
|
||||
@roundOrder = newOrder
|
||||
end
|
||||
|
||||
def setupFirstRound
|
||||
@roundOrder.each { |p| p.resetContestVariables}
|
||||
@scramble = false
|
||||
@crowdPaused = nil
|
||||
end
|
||||
|
||||
def setupNextRound
|
||||
setOrder
|
||||
@roundOrder.each { |p| p.resetContestVariables}
|
||||
|
||||
@nextTurnFirstOrder = [nil,nil,nil,nil]
|
||||
@nextTurnLastOrder = [nil,nil,nil,nil]
|
||||
@scramble = false
|
||||
@crowdPaused = nil
|
||||
end
|
||||
|
||||
def getDifficulty(pokemon)
|
||||
if pokemon == @pokemonOne
|
||||
return @trainerOne.difficulty
|
||||
elsif pokemon == @pokemonTwo
|
||||
return @trainerTwo.difficulty
|
||||
elsif pokemon == @pokemonThree
|
||||
return @trainerThree.difficulty
|
||||
else
|
||||
return 0
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
#====================================================================================
|
||||
# PokemonGlobalMetadata
|
||||
#====================================================================================
|
||||
class PokemonGlobalMetadata
|
||||
attr_accessor :pokemonContest
|
||||
attr_accessor :nextContestTrainerOne
|
||||
attr_accessor :nextContestTrainerTwo
|
||||
attr_accessor :nextContestTrainerThree
|
||||
attr_accessor :lastContestWinners
|
||||
|
||||
alias contest_global_init initialize unless self.private_method_defined?(:contest_global_init)
|
||||
def initialize
|
||||
contest_global_init
|
||||
@pokemonContest = nil
|
||||
@nextContestTrainerOne = nil
|
||||
@nextContestTrainerTwo = nil
|
||||
@nextContestTrainerThree = nil
|
||||
@lastContestWinners = initContestWinners
|
||||
end
|
||||
|
||||
def nextContestTrainerOne=(value)
|
||||
if value.is_a?(Array)
|
||||
value.each_with_index{ |v,i|
|
||||
value[i] = GameData::ContestTrainer.try_get(v)
|
||||
}
|
||||
@nextContestTrainerOne = value
|
||||
else
|
||||
@nextContestTrainerOne = GameData::ContestTrainer.try_get(value)
|
||||
end
|
||||
end
|
||||
|
||||
def nextContestTrainerTwo=(value)
|
||||
if value.is_a?(Array)
|
||||
value.each_with_index{ |v,i|
|
||||
value[i] = GameData::ContestTrainer.try_get(v)
|
||||
}
|
||||
@nextContestTrainerTwo = value
|
||||
else
|
||||
@nextContestTrainerTwo = GameData::ContestTrainer.try_get(value)
|
||||
end
|
||||
end
|
||||
|
||||
def nextContestTrainerThree=(value)
|
||||
if value.is_a?(Array)
|
||||
value.each_with_index{ |v,i|
|
||||
value[i] = GameData::ContestTrainer.try_get(v)
|
||||
}
|
||||
@nextContestTrainerThree = value
|
||||
else
|
||||
@nextContestTrainerThree = GameData::ContestTrainer.try_get(value)
|
||||
end
|
||||
end
|
||||
|
||||
def initContestWinners
|
||||
return winners = {
|
||||
"Category" => [[nil,nil,nil,nil,nil], #[Normal, Super, Hyper, Master, Overall]
|
||||
[nil,nil,nil,nil,nil],
|
||||
[nil,nil,nil,nil,nil],
|
||||
[nil,nil,nil,nil,nil],
|
||||
[nil,nil,nil,nil,nil]],
|
||||
"Rank" => [nil,nil,nil,nil], #[Normal, Super, Hyper, Master]
|
||||
"Overall" => nil
|
||||
}
|
||||
end
|
||||
|
||||
def getLastContestWinner(rank, category)
|
||||
winner = @lastContestWinners["Overall"]
|
||||
if rank && category
|
||||
winner = @lastContestWinners["Category"][category][rank]
|
||||
elsif category
|
||||
winner = @lastContestWinners["Category"][category][4]
|
||||
elsif rank
|
||||
winner = @lastContestWinners["Rank"][rank]
|
||||
end
|
||||
return winner
|
||||
end
|
||||
end
|
||||
|
||||
def pbCurrentPokemonContest
|
||||
$PokemonGlobal.pokemonContest = PokemonContest.new if !$PokemonGlobal.pokemonContest
|
||||
return $PokemonGlobal.pokemonContest
|
||||
end
|
||||
|
||||
def pbShowLastContestWinner(rank: nil, category: nil)
|
||||
$PokemonGlobal.lastContestWinners = $PokemonGlobal.initContestWinners if !$PokemonGlobal.lastContestWinners
|
||||
rank = ContestFunctions.sanitizeRank(rank) if rank
|
||||
category = ContestFunctions.sanitizeCategory(category) if category
|
||||
winner = $PokemonGlobal.getLastContestWinner(rank, category)
|
||||
if winner
|
||||
trainer = winner[0]
|
||||
pokemon = winner[1]
|
||||
w_rank = ContestFunctions.getRankName(winner[2])
|
||||
w_cat = ContestFunctions.getCategoryName(winner[3])
|
||||
sprite = PokemonSprite.new(Viewport.new(0, 0, Graphics.width, Graphics.height))
|
||||
sprite.setPokemonBitmap(pokemon)
|
||||
sprite.visible = false
|
||||
pokemon.play_cry
|
||||
if sprite.bitmap
|
||||
iconWindow = PictureWindow.new(sprite.bitmap)
|
||||
iconWindow.x = (Graphics.width - iconWindow.width) / 2
|
||||
iconWindow.y = (Graphics.height - 96 - iconWindow.height)/2
|
||||
end
|
||||
pbMessage(_INTL("<ac>{1} {2} Contest Winner:\n{3} & {4}</ac>",w_rank,w_cat,trainer.name,pokemon.name))
|
||||
iconWindow.dispose
|
||||
sprite.dispose
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
def pbGetLastContestWinner(rank: nil, category: nil, namesOnly: false)
|
||||
$PokemonGlobal.lastContestWinners = $PokemonGlobal.initContestWinners if !$PokemonGlobal.lastContestWinners
|
||||
rank = ContestFunctions.sanitizeRank(rank) if rank
|
||||
category = ContestFunctions.sanitizeCategory(category) if category
|
||||
winner = $PokemonGlobal.getLastContestWinner(rank, category)
|
||||
winner = [winner[0].name,winner[1].name,ContestFunctions.getRankNameShort(winner[2]),ContestFunctions.getCategoryNameShort(winner[3])] if namesOnly
|
||||
return winner
|
||||
end
|
||||
|
||||
def pbSetLastContestWinner(category,rank,trainer,pokemon)
|
||||
$PokemonGlobal.lastContestWinners = $PokemonGlobal.initContestWinners if !$PokemonGlobal.lastContestWinners
|
||||
winner = [trainer,pokemon,rank,category]
|
||||
$PokemonGlobal.lastContestWinners["Category"][category][rank] = winner
|
||||
$PokemonGlobal.lastContestWinners["Category"][category][4] = winner #Overall
|
||||
$PokemonGlobal.lastContestWinners["Rank"][rank] = winner
|
||||
$PokemonGlobal.lastContestWinners["Overall"] = winner
|
||||
end
|
||||
|
||||
#====================================================================================
|
||||
# Pokemon
|
||||
#====================================================================================
|
||||
class Pokemon
|
||||
attr_accessor :contestVariables
|
||||
|
||||
def setupContestVariables(trainer = $Trainer) #Beginning of Contest
|
||||
@contestVariables = {
|
||||
"Total Score" => 0,
|
||||
"Intro Score" => 0,
|
||||
"Total Hearts" => 0,
|
||||
"Round Hearts" => 0,
|
||||
"Pending Hearts" => 0,
|
||||
"Spirit" => 0,
|
||||
"Last Move" => nil,
|
||||
"Current Move" => nil,
|
||||
"Move Up" => false,
|
||||
"Move Down" => false,
|
||||
"Miss Turn" => false,
|
||||
"No More Moves" => false,
|
||||
"Double Next" => false,
|
||||
"Good Appeal" => false,
|
||||
"Has Attention" => false,
|
||||
"Calm" => false,
|
||||
"Oblivious" => false,
|
||||
"Easily Startled" => false,
|
||||
"Startled" => false,
|
||||
"Nervous" => false,
|
||||
}
|
||||
end
|
||||
|
||||
def resetContestVariables #New Round
|
||||
@contestVariables["Round Hearts"] = 0
|
||||
@contestVariables["Pending Hearts"] = 0
|
||||
@contestVariables["Move Up"] = false
|
||||
@contestVariables["Move Down"] = false
|
||||
@contestVariables["Good Appeal"] = false
|
||||
@contestVariables["Calm"] = false
|
||||
@contestVariables["Oblivious"] = false
|
||||
@contestVariables["Easily Startled"] = false
|
||||
@contestVariables["Startled"] = false
|
||||
@contestVariables["Nervous"] = false
|
||||
end
|
||||
|
||||
def clearContestVariables #End of Contest
|
||||
@contestVariables = nil
|
||||
end
|
||||
|
||||
def c_total_score; return (@contestVariables ? @contestVariables["Total Score"] : 0); end
|
||||
def c_total_score=(value); @contestVariables["Total Score"] = value; end
|
||||
def c_intro_score; return (@contestVariables ? @contestVariables["Intro Score"] : 0); end
|
||||
def c_intro_score=(value); @contestVariables["Intro Score"] = value; end
|
||||
def c_total_hearts; return (@contestVariables ? @contestVariables["Total Hearts"] : 0); end
|
||||
def c_total_hearts=(value); @contestVariables["Total Hearts"] = value.clamp(0,27); end
|
||||
def c_round_hearts; return (@contestVariables ? @contestVariables["Round Hearts"] : 0); end
|
||||
def c_round_hearts=(value); @contestVariables["Round Hearts"] = value; end
|
||||
def c_pending_hearts; return (@contestVariables ? @contestVariables["Pending Hearts"] : 0); end
|
||||
def c_pending_hearts=(value); @contestVariables["Pending Hearts"] = value; end
|
||||
def c_spirit; return (@contestVariables ? @contestVariables["Spirit"] : 0); end
|
||||
def c_spirit=(value); @contestVariables["Spirit"] = value.clamp(0,3); end
|
||||
def c_lastmove; return (@contestVariables ? @contestVariables["Last Move"] : nil); end
|
||||
def c_lastmove=(value); @contestVariables["Last Move"] = value; end
|
||||
def c_currentmove; return (@contestVariables ? @contestVariables["Current Move"] : nil); end
|
||||
def c_currentmove=(value); @contestVariables["Current Move"] = value; end
|
||||
def c_moveup; return (@contestVariables ? @contestVariables["Move Up"] : false); end
|
||||
def c_moveup=(value); @contestVariables["Move Up"] = value; end
|
||||
def c_movedown; return (@contestVariables ? @contestVariables["Move Down"] : false); end
|
||||
def c_movedown=(value); @contestVariables["Move Down"] = value; end
|
||||
def c_missturn; return (@contestVariables ? @contestVariables["Miss Turn"] : false); end
|
||||
def c_missturn=(value); @contestVariables["Miss Turn"] = value; end
|
||||
def c_nomoremoves; return (@contestVariables ? @contestVariables["No More Moves"] : false); end
|
||||
def c_nomoremoves=(value); @contestVariables["No More Moves"] = value; end
|
||||
def c_doublenext; return (@contestVariables ? @contestVariables["Double Next"] : false); end
|
||||
def c_doublenext=(value); @contestVariables["Double Next"] = value; end
|
||||
def c_goodappeal; return (@contestVariables ? @contestVariables["Good Appeal"] : false); end
|
||||
def c_goodappeal=(value); @contestVariables["Good Appeal"] = value; end
|
||||
def c_hasattention; return (@contestVariables ? @contestVariables["Has Attention"] : false); end
|
||||
def c_hasattention=(value); @contestVariables["Has Attention"] = value; end
|
||||
def c_calm; return (@contestVariables ? @contestVariables["Calm"] : false); end
|
||||
def c_calm=(value); @contestVariables["Calm"] = value; end
|
||||
def c_oblivious; return (@contestVariables ? @contestVariables["Oblivious"] : false); end
|
||||
def c_oblivious=(value); @contestVariables["Oblivious"] = value; end
|
||||
def c_easilystartled; return (@contestVariables ? @contestVariables["Easily Startled"] : false); end
|
||||
def c_easilystartled=(value); @contestVariables["Easily Startled"] = value; end
|
||||
def c_startled; return (@contestVariables ? @contestVariables["Startled"] : false); end
|
||||
def c_startled=(value); @contestVariables["Startled"] = value; end
|
||||
def c_nervous; return (@contestVariables ? @contestVariables["Nervous"] : false); end
|
||||
def c_nervous=(value); @contestVariables["Nervous"] = value; end
|
||||
def c_orderindex; return pbCurrentPokemonContest.roundOrder.find_index(self); end
|
||||
|
||||
def checkContestCombos(move)
|
||||
return false if !@contestVariables["Last Move"]
|
||||
oldmove = @contestVariables["Last Move"].id
|
||||
return false if !ContestSettings::COMBOS[oldmove]
|
||||
return ContestSettings::COMBOS[oldmove].include?(move.id)
|
||||
end
|
||||
end
|
||||
|
||||
#====================================================================================
|
||||
# GameData
|
||||
#====================================================================================
|
||||
module GameData
|
||||
class ContestTrainer
|
||||
attr_reader :id
|
||||
attr_reader :real_name
|
||||
attr_reader :character_sprite
|
||||
attr_reader :trainer_sprite
|
||||
attr_reader :contest_category
|
||||
attr_reader :contest_rank
|
||||
attr_reader :difficulty
|
||||
attr_accessor :pokemon
|
||||
attr_reader :pokemon_species
|
||||
attr_reader :pokemon_nickname
|
||||
attr_reader :pokemon_stat_val
|
||||
attr_reader :pokemon_sheen_val
|
||||
attr_reader :pokemon_moves
|
||||
attr_reader :pokemon_item
|
||||
attr_reader :pokemon_shiny
|
||||
attr_reader :pokemon_form
|
||||
|
||||
DATA = {}
|
||||
|
||||
extend ClassMethodsSymbols
|
||||
include InstanceMethods
|
||||
|
||||
def self.load; end
|
||||
def self.save; end
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@contest_category = hash[:contest_category]
|
||||
@contest_rank = hash[:contest_rank]
|
||||
@difficulty = hash[:difficulty] || ContestSettings::DEFAULT_TRAINER_DIFFICULTY[["Normal","Super","Hyper","Master"].find_index(@contest_rank)]
|
||||
@pokemon_species = hash[:pokemon_species]
|
||||
@pokemon_stat_val = hash[:pokemon_stat_val]
|
||||
@pokemon_sheen_val = hash[:pokemon_sheen_val]
|
||||
@pokemon_moves = hash[:pokemon_moves]
|
||||
@pokemon_item = hash[:pokemon_item] || nil
|
||||
@pokemon_shiny = hash[:pokemon_shiny] || false
|
||||
@pokemon_form = hash[:pokemon_form] || nil
|
||||
@real_name = hash[:name] || "Unnamed"
|
||||
@character_sprite = hash[:character_sprite] || nil
|
||||
@trainer_sprite = hash[:trainer_sprite] || nil
|
||||
@pokemon_nickname = hash[:pokemon_nickname] || GameData::Species.get(@pokemon_species).real_name
|
||||
@pokemon = hash[:pokemon] || nil
|
||||
end
|
||||
|
||||
def name
|
||||
return _INTL(@real_name)
|
||||
end
|
||||
|
||||
def pokemon_name
|
||||
return _INTL(@pokemon_nickname)
|
||||
end
|
||||
|
||||
def species
|
||||
return @pokemon_species
|
||||
end
|
||||
|
||||
def moves
|
||||
return @pokemon_moves
|
||||
end
|
||||
|
||||
def pokemon_stat_val (category=0)
|
||||
if @pokemon_stat_val.is_a?(Array)
|
||||
@pokemon_stat_val[category]
|
||||
else
|
||||
return @pokemon_stat_val
|
||||
end
|
||||
end
|
||||
|
||||
def contest_category
|
||||
return [@contest_category] if !@contest_category.is_a?(Array)
|
||||
return @contest_category
|
||||
end
|
||||
|
||||
def difficulty
|
||||
return @difficulty || 0
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class ContestType
|
||||
attr_reader :id
|
||||
attr_reader :real_name
|
||||
attr_reader :long_name
|
||||
attr_reader :icon_index
|
||||
|
||||
DATA = {}
|
||||
|
||||
extend ClassMethodsSymbols
|
||||
include InstanceMethods
|
||||
|
||||
def self.load; end
|
||||
def self.save; end
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@real_name = hash[:name] || "Unnamed"
|
||||
@long_name = hash[:long_name] || @real_name
|
||||
@icon_index = hash[:icon_index] || 0
|
||||
end
|
||||
|
||||
def name
|
||||
return _INTL(@real_name)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,25 @@
|
||||
#====================================================================================
|
||||
# DO NOT MAKE EDITS HERE
|
||||
#====================================================================================
|
||||
|
||||
#====================================================================================
|
||||
# Bop Module
|
||||
#====================================================================================
|
||||
|
||||
def pbWaitForCharacterMove(event)
|
||||
return unless event
|
||||
while event.move_route_forcing
|
||||
pbWait(1)
|
||||
end
|
||||
end
|
||||
|
||||
class PokemonContestTalent_Scene
|
||||
# Dispose
|
||||
def dispose(sprite=@sprites, id=nil)
|
||||
(id.nil?)? pbDisposeSpriteHash(sprite) : pbDisposeSprite(sprite, id)
|
||||
end
|
||||
# Update (just script)
|
||||
def update
|
||||
pbUpdateSpriteHash(@sprites)
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,161 @@
|
||||
#====================================================================================
|
||||
# DO NOT MAKE EDITS HERE
|
||||
#====================================================================================
|
||||
|
||||
#====================================================================================
|
||||
# Move Data
|
||||
#====================================================================================
|
||||
module GameData
|
||||
class Move
|
||||
attr_accessor :contest_type
|
||||
attr_accessor :contest_hearts
|
||||
attr_accessor :contest_jam
|
||||
attr_accessor :contest_function_code
|
||||
attr_accessor :contest_flags
|
||||
attr_accessor :contest_description
|
||||
|
||||
CONTEST_SCHEMA = {
|
||||
"ContestType" => [:contest_type, "E", :ContestType],
|
||||
"ContestHearts" => [:contest_hearts, "U"],
|
||||
"ContestJam" => [:contest_jam, "U"],
|
||||
"ContestFunctionCode" => [:contest_function_code, "E", :ContestMoveFunction],
|
||||
"ContestFlags" => [:contest_flags, "*s"],
|
||||
"ContestDescription" => [:contest_description, "q"],
|
||||
}
|
||||
|
||||
extend ClassMethodsSymbols
|
||||
include InstanceMethods
|
||||
|
||||
alias contests_move_init initialize
|
||||
def initialize(hash)
|
||||
contests_move_init(hash)
|
||||
# @contest_type = hash[:contest_type] || :NONE
|
||||
# @contest_hearts = hash[:contest_hearts] || 0
|
||||
# @contest_jam = hash[:contest_jam] || 0
|
||||
# @contest_function_code = hash[:contest_function_code] || "None"
|
||||
# @contest_flags = hash[:contest_flags] || []
|
||||
# @contest_flags = [@contest_flags] if !@contest_flags.is_a?(Array)
|
||||
# @contest_description = hash[:contest_description] || "???"
|
||||
@contest_type = hash[:contest_type] || :NONE
|
||||
@contest_hearts = hash[:contest_hearts] || nil
|
||||
@contest_jam = hash[:contest_jam] || nil
|
||||
@contest_function_code = hash[:contest_function_code] || nil
|
||||
@contest_flags = hash[:contest_flags] || []
|
||||
@contest_flags = [@contest_flags] if !@contest_flags.is_a?(Array)
|
||||
@contest_description = hash[:contest_description] || nil
|
||||
end
|
||||
|
||||
# @return [String] the translated description of this move
|
||||
def contest_description(compile = false)
|
||||
return getFunctionContestDescription if !compile && ContestSettings::GET_MOVE_DESCRIPTIONS_FROM_FUNCTION
|
||||
return _INTL("Cannot be used in a contest.") if !compile && !contest_can_be_used?
|
||||
return pbGetMessageFromHash(MessageTypes::MoveContestDescriptions, @contest_description)
|
||||
end
|
||||
|
||||
def has_contest_flag?(flag)
|
||||
return @contest_flags.any? { |f| f.downcase == flag.downcase }
|
||||
end
|
||||
|
||||
def contest_type_position
|
||||
return 5 if !contest_can_be_used?
|
||||
return GameData::ContestType.get(@contest_type).icon_index || 0
|
||||
end
|
||||
|
||||
def startsContestCombo
|
||||
return ContestSettings::COMBOS.include?(self.id)
|
||||
return false
|
||||
end
|
||||
|
||||
def contest_can_be_used?
|
||||
return false if (has_contest_flag?("CannotBeUsed") || @contest_function_code.nil?)
|
||||
return true
|
||||
end
|
||||
|
||||
def is_positive_category?(contestCategory)
|
||||
return contest_type_position == contestCategory
|
||||
end
|
||||
|
||||
def is_neutral_category?(contestCategory)
|
||||
case contestCategory
|
||||
when 0
|
||||
return [4,1].include?(contest_type_position)
|
||||
when 1
|
||||
return [0,2].include?(contest_type_position)
|
||||
when 2
|
||||
return [1,3].include?(contest_type_position)
|
||||
when 3
|
||||
return [2,4].include?(contest_type_position)
|
||||
when 4
|
||||
return [3,0].include?(contest_type_position)
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def is_negative_category?(contestCategory)
|
||||
case contestCategory
|
||||
when 0
|
||||
return [3,2].include?(contest_type_position)
|
||||
when 1
|
||||
return [4,3].include?(contest_type_position)
|
||||
when 2
|
||||
return [0,4].include?(contest_type_position)
|
||||
when 3
|
||||
return [1,0].include?(contest_type_position)
|
||||
when 4
|
||||
return [2,1].include?(contest_type_position)
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
module MessageTypes
|
||||
MoveContestDescriptions = 35
|
||||
end
|
||||
|
||||
class String
|
||||
def to_i_threedigit
|
||||
val = self.to_i
|
||||
val = format('%03d',val)
|
||||
end
|
||||
end
|
||||
|
||||
# #====================================================================================
|
||||
# # Debug 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, :contest_file_menu, {
|
||||
# "name" => _INTL("Contest Move Files..."),
|
||||
# "parent" => :contest_menu,
|
||||
# "description" => _INTL("Controlling the Contest Moves movesx_contest.txt PBS"),
|
||||
# "always_show" => false
|
||||
# })
|
||||
#
|
||||
# MenuHandlers.add(:debug_menu, :create_moves_contest_file, {
|
||||
# "name" => _INTL("Create Movesx_Contest PBS File"),
|
||||
# "parent" => :contest_file_menu,
|
||||
# "description" => _INTL("Create the Movesx_Contest PBS File from the existing Move data. (Best if you have custom moves)"),
|
||||
# "effect" => proc {
|
||||
# cmd = 0
|
||||
# cmds = [
|
||||
# _INTL("Create movesx_contest.txt")
|
||||
# ]
|
||||
# loop do
|
||||
# cmd = pbShowCommands(nil, cmds, -1, cmd)
|
||||
# case cmd
|
||||
# when 0 then Compiler.write_moves_contests
|
||||
# else break
|
||||
# end
|
||||
# pbMessage(_INTL("File written."))
|
||||
# end
|
||||
# }
|
||||
# })
|
||||
@@ -0,0 +1,6 @@
|
||||
#====================================================================================
|
||||
# Compiler
|
||||
#====================================================================================
|
||||
module Compiler
|
||||
|
||||
end
|
||||
@@ -0,0 +1,378 @@
|
||||
#====================================================================================
|
||||
# DO NOT MAKE EDITS HERE
|
||||
#====================================================================================
|
||||
|
||||
#====================================================================================
|
||||
# Main Command
|
||||
#====================================================================================
|
||||
def pbPokemonContest(rank: nil, category: nil, pokemon: nil)
|
||||
receptionistEvent = $game_map.get_events_with_name("Receptionist").first
|
||||
pbPrepPokemonContest(rank, category, pokemon, receptionistEvent)
|
||||
return if !$PokemonGlobal.pokemonContest
|
||||
ContestFunctions.bringPlayerToContestHall(receptionistEvent)
|
||||
pbCurrentPokemonContest.initEvents(rank)
|
||||
pbScrollMap(8, 2, 4)
|
||||
pbScrollMap(4, 3, 4)
|
||||
pbCurrentPokemonContest.pbIntroductionRound
|
||||
pbCurrentPokemonContest.pbTalentRound
|
||||
pbCurrentPokemonContest.pbResults
|
||||
pbEndPokemonContest
|
||||
end
|
||||
|
||||
#====================================================================================
|
||||
# Setup In Lobby
|
||||
#====================================================================================
|
||||
def pbPrepPokemonContest(rank = nil, category = nil, pokemon = nil, receptionist_event = nil)
|
||||
event_id = receptionist_event.id
|
||||
echoln event_id
|
||||
if $Trainer.party.size <=0
|
||||
pbCallBubDown(2,event_id)
|
||||
pbMessage(_INTL("Oh, you don't have any Pokémon!"))
|
||||
pbCallBubDown(2,event_id)
|
||||
pbMessage(_INTL("Please come back when you have a Pokémon."))
|
||||
return
|
||||
end
|
||||
# if ContestSettings::REQUIRE_CONTEST_PASS_ITEM && !hasItem?(:CONTESTPASS)
|
||||
# pbMessage(_INTL("Oh, you don't have a Contest Pass!"))
|
||||
# pbMessage(_INTL("Please come back when you have a Contest Pass."))
|
||||
# return
|
||||
# end
|
||||
rank = ContestFunctions.sanitizeRank(rank)
|
||||
category = ContestFunctions.sanitizeCategory(category)
|
||||
pbCallBubDown(2,event_id)
|
||||
pbMessage(_INTL("Hello!"))
|
||||
pbCallBubDown(2,event_id)
|
||||
pbMessage(_INTL("This is the reception counter for Pokémon Contests."))
|
||||
cmds = [_INTL("Enter"),_INTL("Cancel")]
|
||||
if rank || category
|
||||
rankName = ContestFunctions.getRankName(rank,true)
|
||||
catName = ContestFunctions.getCategoryName(category,true)
|
||||
pbCallBubDown(2,event_id)
|
||||
pbMessage(_INTL("We're currently accepting registrations for \\C[1]{1}{2}\\C[0]Pokémon Contests.",rankName,catName))
|
||||
pbCallBubDown(2,event_id)
|
||||
choice = pbMessage(_INTL("Would you like to enter your Pokémon in a {1}{2}Contest?",rankName,catName),cmds,-1)
|
||||
else
|
||||
pbCallBubDown(2,event_id)
|
||||
choice = pbMessage(_INTL("Would you like to enter your Pokémon in a Contest?"),cmds,-1)
|
||||
end
|
||||
pbCallBubDown(2,event_id)
|
||||
return pbMessage(_INTL("We hope you will participate another time.")) if choice < 0 || choice == 1
|
||||
#Choose Category
|
||||
if !category
|
||||
cmds_c = [_INTL("{1} Contest",pbContestCatName(0)),
|
||||
_INTL("{1} Contest",pbContestCatName(1)),
|
||||
_INTL("{1} Contest", pbContestCatName(2)),
|
||||
_INTL("{1} Contest", pbContestCatName(3)),
|
||||
_INTL("{1} Contest",pbContestCatName(4)),
|
||||
_INTL("Exit")]
|
||||
|
||||
pbCallBubDown(2,event_id)
|
||||
cat = pbMessage(_INTL("Which Contest would you like to enter?"), cmds_c, -1)
|
||||
pbCallBubDown(2,event_id)
|
||||
return pbMessage(_INTL("We hope you will participate another time.")) if cat < 0 || cat == 5
|
||||
category = cat
|
||||
pbSet(VAR_CONTEST_CATEGORY,category)
|
||||
end
|
||||
#Choose Rank
|
||||
if !rank
|
||||
cmds_r = [_INTL("Normal Rank"), _INTL("Super Rank"), _INTL("Hyper Rank"), _INTL("Master Rank"), _INTL("Exit")]
|
||||
pbCallBubDown(2,event_id)
|
||||
rnk = pbMessage(_INTL("Which Rank would you like to enter?"), cmds_r, -1)
|
||||
pbCallBubDown(2,event_id)
|
||||
return pbMessage(_INTL("We hope you will participate another time.")) if rnk < 0 || rnk == 4
|
||||
rank = rnk
|
||||
end
|
||||
#Choose Pokemon
|
||||
loop do
|
||||
if !pokemon
|
||||
pbCallBubDown(2,event_id)
|
||||
pbMessage(_INTL("Which Pokémon would you like to enter?"))
|
||||
if rank == 0
|
||||
pbChoosePokemon(1, 3, proc { |p| !p.egg? && !(p.shadowPokemon? rescue false)})
|
||||
pkmn = pbGet(1)
|
||||
else
|
||||
ribbon = ContestSettings::CONTEST_RIBBONS[category][rank-1]
|
||||
pbChoosePokemon(1, 3, proc { |p| !p.egg? && !(p.shadowPokemon? rescue false) && p.hasRibbon?(ribbon)})
|
||||
pkmn = pbGet(1)
|
||||
end
|
||||
end
|
||||
pokemon = pkmn
|
||||
if pokemon < 0
|
||||
if pbConfirmMessage(_INTL("Cancel participation?"))
|
||||
pbCallBubDown(2,event_id)
|
||||
return pbMessage(_INTL("We hope you will participate another time."))
|
||||
else
|
||||
#pbMessage(_INTL("Which Pokémon would you like to enter?"))
|
||||
pokemon = nil
|
||||
next
|
||||
end
|
||||
end
|
||||
#Pokemon has Ribbon
|
||||
if $Trainer.party[pokemon].hasRibbon?(ContestSettings::CONTEST_RIBBONS[category][rank])
|
||||
pbCallBubDown(2,event_id)
|
||||
pbMessage(_INTL("Oh, that Ribbon..."))
|
||||
pbCallBubDown(2,event_id)
|
||||
pbMessage(_INTL("Your {1} has won this Contest before, hasn't it?", $Trainer.party[pokemon].name))
|
||||
pbCallBubDown(2,event_id)
|
||||
if pbConfirmMessage(_INTL("Would you like to enter it in this Contest anyway?"))
|
||||
|
||||
else
|
||||
#pbMessage(_INTL("Which Pokémon would you like to enter?"))
|
||||
pokemon = nil
|
||||
next
|
||||
end
|
||||
end
|
||||
if pbConfirmMessage(_INTL("Enter {1} in the Contest?",$Trainer.party[pokemon].name))
|
||||
#return pbMessage(_INTL("We hope you will participate another time."))
|
||||
else
|
||||
#pbMessage(_INTL("Which Pokémon would you like to enter?"))
|
||||
pokemon = nil
|
||||
next
|
||||
end
|
||||
break
|
||||
end
|
||||
# if pbConfirmMessage("Cancel participation?")
|
||||
# return pbMessage(_INTL("We hope you will participate another time."))
|
||||
# else
|
||||
# pbMessage(_INTL("Which Pokémon would you like to enter?"))
|
||||
# pokemon = nil
|
||||
# next
|
||||
# end
|
||||
pbCallBubDown(2,event_id)
|
||||
pbMessage(_INTL("Okay, your {1} will be entered in this Contest.", $Trainer.party[pokemon].name))
|
||||
pbCallBubDown(2,event_id)
|
||||
pbMessage(_INTL("{1} is Entry Number 4. The Contest will begin shortly.", $Trainer.party[pokemon].name))
|
||||
pbCurrentPokemonContest.set(rank, category, pokemon, ContestFunctions.getHallMapInfo(rank, category), ContestFunctions.getReturnMapInfo(rank, category))
|
||||
return true
|
||||
end
|
||||
|
||||
#====================================================================================
|
||||
# End the Contest
|
||||
#====================================================================================
|
||||
|
||||
def pbEndPokemonContest
|
||||
ContestFunctions.bringPlayerToLobby
|
||||
$PokemonGlobal.pokemonContest = nil
|
||||
$PokemonGlobal.nextContestTrainerOne = nil
|
||||
$PokemonGlobal.nextContestTrainerTwo = nil
|
||||
$PokemonGlobal.nextContestTrainerThree = nil
|
||||
|
||||
end
|
||||
|
||||
#====================================================================================
|
||||
# Misc Contest Functions
|
||||
#====================================================================================
|
||||
|
||||
module ContestFunctions
|
||||
module_function
|
||||
|
||||
def bringPlayerToContestHall(guideEvent)
|
||||
map = $game_map.map_id
|
||||
doors = $game_map.get_events_with_name("ContestDoor")
|
||||
# Front Desk Guide
|
||||
pbMoveRoute(guideEvent,[PBMoveRoute::Left,
|
||||
PBMoveRoute::Left,PBMoveRoute::TurnDown])
|
||||
pbWaitForCharacterMove(guideEvent)
|
||||
pbWait(5)
|
||||
doors.length.times{ |i| $game_self_switches[[map, doors[i].id, 'A']] = true; $game_map.need_refresh = true} # Front Desk Door
|
||||
pbCallBubDown(2,guideEvent.id)
|
||||
pbMessage(_INTL("Please, follow me."))
|
||||
pbMoveRoute(guideEvent,[PBMoveRoute::Up])
|
||||
pbMoveRoute($game_player,[PBMoveRoute::Left,PBMoveRoute::Left, PBMoveRoute::Up, PBMoveRoute::Up, PBMoveRoute::TurnDown])
|
||||
pbWaitForCharacterMove($game_player)
|
||||
doors.length.times{ |i| $game_self_switches[[map, doors[i].id, 'A']] = false; $game_map.need_refresh = true} # Front Desk Door
|
||||
pbWait(5)
|
||||
pbMoveRoute(guideEvent,[PBMoveRoute::Turn180])
|
||||
pbWaitForCharacterMove(guideEvent)
|
||||
pbMoveRoute(guideEvent,[PBMoveRoute::Right,PBMoveRoute::TurnLeft])
|
||||
pbWait(1)
|
||||
pbMoveRoute($game_player,[PBMoveRoute::Up,PBMoveRoute::TurnRight])
|
||||
pbWaitForCharacterMove($game_player)
|
||||
pbCallBub(2,guideEvent.id)
|
||||
pbMessage(_INTL("Please, go in through here. Good luck!"))
|
||||
pbMoveRoute($game_player,[PBMoveRoute::Up])
|
||||
pbWaitForCharacterMove($game_player)
|
||||
hallInfo = pbCurrentPokemonContest.hallMapInfo
|
||||
self.transfer(*hallInfo,8)
|
||||
$scene.reset_map(true)
|
||||
end
|
||||
|
||||
|
||||
def bringPlayerToLobby
|
||||
returnInfo = pbCurrentPokemonContest.returnMapInfo
|
||||
self.transfer(*returnInfo)
|
||||
|
||||
end
|
||||
|
||||
def set_switch(map, event, switch='A', set=true)
|
||||
$game_self_switches[[map, event, switch]] = set
|
||||
return unless set
|
||||
$game_map.need_refresh = set
|
||||
loop do
|
||||
break if !$game_self_switches[[map, event, switch]]
|
||||
pbWait(1)
|
||||
end
|
||||
end
|
||||
|
||||
def transfer(id, x, y, dir)
|
||||
if $scene.is_a?(Scene_Map)
|
||||
pbFadeOutIn {
|
||||
$game_temp.player_transferring = true
|
||||
$game_temp.transition_processing = true
|
||||
$game_temp.player_new_map_id = id
|
||||
$game_temp.player_new_x = x
|
||||
$game_temp.player_new_y = y
|
||||
$game_temp.player_new_direction = dir
|
||||
pbWait(35)
|
||||
$scene.transfer_player
|
||||
pbWait(5)
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
def getHallMapInfo(rank, category)
|
||||
get = ContestSettings::ROOM_MAP_COORDINATES[rank][category]
|
||||
echoln get
|
||||
get = ContestSettings::ROOM_MAP_COORDINATES[rank][0] if !get
|
||||
echoln get
|
||||
return get
|
||||
end
|
||||
|
||||
def getReturnMapInfo(rank, category)
|
||||
get = ContestSettings::LOBBY_MAP_COORDINATES[rank][category]
|
||||
get = ContestSettings::DEFAULT_RETURN_COORDINATES if !get
|
||||
return get
|
||||
end
|
||||
|
||||
def sanitizeRank(rank)
|
||||
return nil if rank == nil
|
||||
return rank if rank.is_a?(Integer) && [0,1,2,3].include?(rank)
|
||||
rank = rank.to_s if rank.is_a?(Symbol)
|
||||
rank = rank.upcase if rank.is_a?(String)
|
||||
case rank
|
||||
when "NORMAL" then rank = 0
|
||||
when "SUPER" then rank = 1
|
||||
when "HYPER" then rank = 2
|
||||
when "MASTER" then rank = 3
|
||||
else rank = nil; end
|
||||
return rank
|
||||
end
|
||||
|
||||
def sanitizeCategory(category)
|
||||
return nil if category == nil
|
||||
return category if category.is_a?(Integer) && [0,1,2,3,4].include?(category)
|
||||
return GameData::ContestType.get(category).icon_index if category.is_a?(Symbol)
|
||||
category = category.upcase if category.is_a?(String)
|
||||
GameData::ContestType.each { |type|
|
||||
return type.icon_index if [type.name.upcase,type.long_name.upcase].include?(category)
|
||||
}
|
||||
return nil
|
||||
end
|
||||
|
||||
def getRankName(int,spaceAfter=false)
|
||||
return "" if !int
|
||||
arr = ["Normal Rank","Super Rank","Hyper Rank","Master Rank"]
|
||||
return arr[int] + (spaceAfter ? " " : "")
|
||||
end
|
||||
|
||||
def getRankNameShort(int,spaceAfter=false)
|
||||
return "" if !int
|
||||
arr = ["Normal","Super","Hyper","Master"]
|
||||
return arr[int] + (spaceAfter ? " " : "")
|
||||
end
|
||||
|
||||
def getCategoryName(int,spaceAfter=false)
|
||||
return "" if !int
|
||||
arr = []
|
||||
GameData::ContestType.each { |type|
|
||||
arr.push(type.long_name)
|
||||
}
|
||||
return arr[int] + (spaceAfter ? " " : "")
|
||||
end
|
||||
|
||||
def getCategoryNameShort(int,spaceAfter=false)
|
||||
return "" if !int
|
||||
arr = []
|
||||
GameData::ContestType.each { |type|
|
||||
arr.push(type.name)
|
||||
}
|
||||
return arr[int] + (spaceAfter ? " " : "")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def pbContestCatName(int,spaceAfter=false)
|
||||
return ContestFunctions.getCategoryName(int,spaceAfter)
|
||||
end
|
||||
|
||||
def pbContestCatShortName(int,spaceAfter=false)
|
||||
return ContestFunctions.getCategoryNameShort(int,spaceAfter)
|
||||
end
|
||||
|
||||
# class ContestTrainerSprite
|
||||
# def initialize(event, map, _viewport)
|
||||
# @event = event
|
||||
# @id = event.id
|
||||
# @map = map
|
||||
# @disposed = false
|
||||
# @event.character_name = ""
|
||||
# set_event_graphic # Set the event's graphic
|
||||
# end
|
||||
#
|
||||
# def dispose
|
||||
# @event = nil
|
||||
# @map = nil
|
||||
# @disposed = true
|
||||
# end
|
||||
#
|
||||
# def disposed?
|
||||
# @disposed
|
||||
# end
|
||||
#
|
||||
# def set_event_graphic
|
||||
# if @id == @contestTrainers[0].id
|
||||
# @event.character_name = pbCurrentPokemonContest.trainerOne.character_sprite
|
||||
# elsif @id == @contestTrainers[1].id
|
||||
# @event.character_name = pbCurrentPokemonContest.trainerTwo.character_sprite
|
||||
# elsif @id == @contestTrainers[2].id
|
||||
# @event.character_name = pbCurrentPokemonContest.trainerThree.character_sprite
|
||||
# end
|
||||
# end
|
||||
#
|
||||
# def randomize_contest_trainer_appearance(event_id)
|
||||
# sprite = get_spritecharacter_for_event(event_id)
|
||||
# appearance= get_random_appearance
|
||||
#
|
||||
# #todo: Replace the hat & clothes by random hats/clothes of the correct contest category in higher ranks
|
||||
#
|
||||
# sprite.setSpriteToAppearance(appearance)
|
||||
# echoln "set appearance for #{event_id}"
|
||||
# end
|
||||
#
|
||||
# def update
|
||||
# set_event_graphic
|
||||
# end
|
||||
# end
|
||||
|
||||
#
|
||||
# Events.onSpritesetCreate += proc { |_sender,e|
|
||||
# proc { |spriteset, viewport|
|
||||
# map = spriteset.map
|
||||
# map.events.each do |event|
|
||||
# next if !event[1].name[/contesttrainer/i]
|
||||
# echoln "on spritesetcreate"
|
||||
# spriteset.addUserSprite(ContestTrainerSprite.new(event[1], map, viewport))
|
||||
# end
|
||||
# }
|
||||
# }
|
||||
|
||||
|
||||
# EventHandlers.add(:on_new_spriteset_map, :add_contest_trainer_graphics,
|
||||
# proc { |spriteset, viewport|
|
||||
# map = spriteset.map
|
||||
# map.events.each do |event|
|
||||
# next if !event[1].name[/contesttrainer/i]
|
||||
# spriteset.addUserSprite(ContestTrainerSprite.new(event[1], map, viewport))
|
||||
# end
|
||||
# }
|
||||
# )
|
||||
@@ -0,0 +1,853 @@
|
||||
#====================================================================================
|
||||
# DO NOT MAKE EDITS HERE
|
||||
#====================================================================================
|
||||
|
||||
class PokemonContest
|
||||
attr_accessor :contestTrainers
|
||||
attr_accessor :contestTrainerAppearances
|
||||
|
||||
RANK_POSITION_OFFSETS = [[0,0],[25,0],[50,0],[25,22]]
|
||||
|
||||
def initEvents(rank)
|
||||
@mcEvent = $game_map.get_events_with_name("MC_#{rank}")[0]
|
||||
@judgeEvent = $game_map.get_events_with_name("Judge_#{rank}")[0]
|
||||
@contestTrainers = $game_map.get_events_with_name("ContestTrainer_#{rank}")
|
||||
@contestTrainerAppearances = initializeContestTrainerAppearances
|
||||
@crowdNPCs = $game_map.get_events_with_name("Crowd_#{rank}")
|
||||
end
|
||||
|
||||
def initializeContestTrainerAppearances
|
||||
appearances = []
|
||||
update_global_outfit_lists
|
||||
@contestTrainers.each do |event|
|
||||
appearance = get_random_contest_trainer_appearance
|
||||
sprite = get_spritecharacter_for_event(event.id)
|
||||
sprite.setSpriteToAppearance(appearance)
|
||||
appearances.push(appearance)
|
||||
end
|
||||
return appearances
|
||||
end
|
||||
|
||||
CONTEST_CONDITIONS = ["beautiful","cool","cute","clever","tough"]
|
||||
def get_random_contest_trainer_appearance
|
||||
appearance= get_random_appearance(false,20,10,30)
|
||||
appearance.hat = get_random_hat_contest(CONTEST_CONDITIONS[@category])
|
||||
appearance.clothes = get_random_clothes_contest(CONTEST_CONDITIONS[@category])
|
||||
return appearance
|
||||
end
|
||||
|
||||
|
||||
|
||||
#====================================================================================
|
||||
# Introduction Round
|
||||
#====================================================================================
|
||||
def pbIntroductionRound
|
||||
mcEventId = @mcEvent.id
|
||||
map = $game_map.map_id
|
||||
trainerOneEvent = @contestTrainers[0]
|
||||
trainerTwoEvent = @contestTrainers[1]
|
||||
trainerThreeEvent = @contestTrainers[2]
|
||||
viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||
viewport.z = 99999
|
||||
#MC
|
||||
pbMoveRoute(@mcEvent,[PBMoveRoute::Down])
|
||||
pbWaitForCharacterMove(@mcEvent)
|
||||
rankName = ContestFunctions.getRankName(rank,true)
|
||||
catName = ContestFunctions.getCategoryName(category,true)
|
||||
pbScrollMap(DIRECTION_UP, 2, 4)
|
||||
pbCallBub(2,mcEventId)
|
||||
pbMessage(_INTL("Hello! We're just getting started with a {1}{2}Pokémon Contest.",rankName,catName))
|
||||
pbCallBub(2,mcEventId)
|
||||
pbMessage(_INTL("We'll start with the Introduction Round!"))
|
||||
pbCallBub(2,mcEventId)
|
||||
pbMessage(_INTL("The participating Coordinators and their Pokémon are as follows:"))
|
||||
pbMoveRoute(@mcEvent,[
|
||||
PBMoveRoute::Up,PBMoveRoute::TurnDown
|
||||
])
|
||||
pbWaitForCharacterMove(@mcEvent)
|
||||
pbWaitForCharacterMove(@mcEvent)
|
||||
#Introductions
|
||||
pbMoveRoute(trainerOneEvent,[
|
||||
PBMoveRoute::Up,PBMoveRoute::Right,PBMoveRoute::Right,
|
||||
PBMoveRoute::Right,PBMoveRoute::TurnUp
|
||||
])
|
||||
pbWaitForCharacterMove(trainerOneEvent)
|
||||
#First
|
||||
pbWait(15)
|
||||
showPokemonIntro(@trainerOne, @pokemonOne, map, 1, viewport)
|
||||
pbWait(10)
|
||||
pbMoveRoute(trainerOneEvent,[
|
||||
PBMoveRoute::Left,PBMoveRoute::Left,PBMoveRoute::Left,
|
||||
PBMoveRoute::Down,PBMoveRoute::TurnUp
|
||||
])
|
||||
pbWaitForCharacterMove(trainerOneEvent)
|
||||
pbMoveRoute(trainerTwoEvent,[
|
||||
PBMoveRoute::Up,PBMoveRoute::Right,PBMoveRoute::TurnUp
|
||||
])
|
||||
pbWaitForCharacterMove(trainerTwoEvent)
|
||||
pbWait(15)
|
||||
#Second
|
||||
showPokemonIntro(@trainerTwo, @pokemonTwo, map, 2, viewport)
|
||||
pbWait(10)
|
||||
pbMoveRoute(trainerTwoEvent,[
|
||||
PBMoveRoute::Left,PBMoveRoute::Down,PBMoveRoute::TurnUp
|
||||
])
|
||||
pbWaitForCharacterMove(trainerTwoEvent)
|
||||
pbMoveRoute(trainerThreeEvent,[
|
||||
PBMoveRoute::Up,PBMoveRoute::Left,PBMoveRoute::TurnUp
|
||||
])
|
||||
pbWaitForCharacterMove(trainerThreeEvent)
|
||||
pbWait(15)
|
||||
#Third
|
||||
showPokemonIntro(@trainerThree, @pokemonThree, map, 3, viewport)
|
||||
pbWait(10)
|
||||
pbMoveRoute(trainerThreeEvent,[
|
||||
PBMoveRoute::Right,PBMoveRoute::Down,PBMoveRoute::TurnUp
|
||||
])
|
||||
pbWaitForCharacterMove(trainerThreeEvent)
|
||||
pbScrollMap(DIRECTION_DOWN, 2, 4)
|
||||
pbScrollMap(DIRECTION_RIGHT, 3, 4)
|
||||
pbMoveRoute($game_player,[
|
||||
PBMoveRoute::Up,PBMoveRoute::Left,PBMoveRoute::Left,
|
||||
PBMoveRoute::Left,PBMoveRoute::TurnUp
|
||||
])
|
||||
pbWaitForCharacterMove($game_player)
|
||||
pbWait(15)
|
||||
#Player
|
||||
showPokemonIntro($Trainer, @playerPokemon, map, 4, viewport)
|
||||
pbWait(10)
|
||||
pbMoveRoute($game_player,[
|
||||
PBMoveRoute::Right,PBMoveRoute::Right,PBMoveRoute::Right,
|
||||
PBMoveRoute::Down,PBMoveRoute::TurnUp
|
||||
])
|
||||
pbWaitForCharacterMove($game_player)
|
||||
pbScrollMap(DIRECTION_LEFT, 3, 4)
|
||||
pbScrollMap(DIRECTION_UP, 2, 4)
|
||||
#MC
|
||||
pbCallBub(2,mcEventId)
|
||||
pbMessage(_INTL("We've just seen the four Pokémon contestants."))
|
||||
pbCallBub(2,mcEventId)
|
||||
pbMessage(_INTL("The audience will vote on their favorite Pokémon contestants."))
|
||||
pbCallBub(2,mcEventId)
|
||||
pbMessage(_INTL("Without any further ado, let the voting begin!"))
|
||||
pbCallBub(2,mcEventId)
|
||||
pbMessage(_INTL("Voting under way..."))
|
||||
pbWait(40)
|
||||
pbCallBub(2,mcEventId)
|
||||
pbMessage(_INTL("Voting is now complete!"))
|
||||
pbCallBub(2,mcEventId)
|
||||
pbMessage(_INTL("While the votes are being tallied, let's move on to the Talent Round!"))
|
||||
pbCallBub(2,mcEventId)
|
||||
pbMessage(_INTL("May the contestants amaze us with superb appeals of dazzling moves!"))
|
||||
pbCallBub(2,mcEventId)
|
||||
pbMessage(_INTL("Let's see a little enthusiasm! Let's appeal!"))
|
||||
pbMoveRoute(@mcEvent,[PBMoveRoute::Left,PBMoveRoute::Left,PBMoveRoute::TurnDown])
|
||||
pbMoveRoute(@judgeEvent,[PBMoveRoute::Right,PBMoveRoute::Right,PBMoveRoute::TurnDown])
|
||||
pbWaitForCharacterMove(@judgeEvent)
|
||||
pbWait(5)
|
||||
viewport.dispose
|
||||
end
|
||||
|
||||
def showPokemonIntro(trainer, pokemon, map, position, vp)
|
||||
trainerName = trainer.name
|
||||
pokemonName = pokemon.name
|
||||
sprite = PokemonSprite.new(vp)
|
||||
sprite.setPokemonBitmap(pokemon)
|
||||
sprite.visible = false
|
||||
|
||||
appearance = @contestTrainerAppearances[position - 1]
|
||||
if position < 4 #NPC
|
||||
trainer_bitmap = generate_front_trainer_sprite_bitmap_from_appearance(appearance)
|
||||
else #player
|
||||
trainer_bitmap = generate_front_trainer_sprite_bitmap
|
||||
end
|
||||
trainer_bitmap.scale_bitmap(2)
|
||||
|
||||
pokemon.play_cry
|
||||
if sprite.bitmap
|
||||
poke_bmp = sprite.bitmap
|
||||
train_bmp = trainer_bitmap.bitmap
|
||||
padding = 8
|
||||
combined_width = train_bmp.width + padding + poke_bmp.width
|
||||
combined_height = [train_bmp.height, poke_bmp.height].max
|
||||
combined_bitmap = Bitmap.new(combined_width, combined_height)
|
||||
|
||||
#Trainer sprite
|
||||
trainer_x = 200
|
||||
trainer_y = combined_height - train_bmp.height
|
||||
combined_bitmap.blt(trainer_x, trainer_y, train_bmp, train_bmp.rect)
|
||||
|
||||
#Pokemon sprite
|
||||
pokemon_x = (combined_width - poke_bmp.width) / 2 - 24
|
||||
pokemon_y = combined_height - poke_bmp.height
|
||||
combined_bitmap.blt(pokemon_x, pokemon_y, poke_bmp, poke_bmp.rect)
|
||||
|
||||
iconWindow = PictureWindow.new(combined_bitmap)
|
||||
iconWindow.x = (Graphics.width - iconWindow.width) / 2
|
||||
iconWindow.y = (Graphics.height - 96 - iconWindow.height) / 2
|
||||
iconWindow.z = 100
|
||||
|
||||
pbMessage(_INTL("<ac>Entry Number {1}\n{2} & {3}</ac>", position, pokemonName, trainerName))
|
||||
|
||||
iconWindow.dispose
|
||||
combined_bitmap.dispose
|
||||
showCrowdHearts(pokemon, map)
|
||||
else
|
||||
pbMessage(_INTL("{1} & {2}", trainerName, pokemonName))
|
||||
showCrowdHearts(pokemon, map)
|
||||
end
|
||||
sprite.dispose
|
||||
trainer_bitmap.dispose
|
||||
unless pokemon.hat.nil?
|
||||
current_category_name = CONTEST_CONDITIONS[@category]
|
||||
pokemon_hat_categories = get_hat_contest_tags(pokemon.hat)
|
||||
|
||||
if pokemon_hat_categories.include?(current_category_name)
|
||||
pbCallBub(1, @crowdNPCs.sample.id)
|
||||
pbMessage(_INTL("Oh! It's wearing a {1} hat!", current_category_name))
|
||||
|
||||
trainer_hat_categories = get_hat_contest_tags($Trainer.hat)
|
||||
trainer_hat2_categories = get_hat_contest_tags($Trainer.hat2)
|
||||
trainer_clothes_categories = get_clothes_contest_tags($Trainer.clothes)
|
||||
|
||||
hat_match = trainer_hat_categories.include?(current_category_name) ||
|
||||
trainer_hat2_categories.include?(current_category_name)
|
||||
clothes_match = trainer_clothes_categories.include?(current_category_name)
|
||||
|
||||
bonus = 40
|
||||
if hat_match && clothes_match
|
||||
pbCallBub(1, @crowdNPCs.sample.id)
|
||||
pbMessage(_INTL("It matches its Trainer's outfit wonderfully!"))
|
||||
bonus += 80
|
||||
elsif hat_match
|
||||
pbCallBub(1, @crowdNPCs.sample.id)
|
||||
pbMessage(_INTL("It matches its Trainer's!"))
|
||||
bonus += 40
|
||||
elsif clothes_match
|
||||
pbCallBub(1, @crowdNPCs.sample.id)
|
||||
pbMessage(_INTL("It goes well with its Trainer's clothes!"))
|
||||
bonus += 40
|
||||
end
|
||||
|
||||
pokemon.contestVariables["Intro Score"] += bonus
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def showCrowdHearts(pokemon,map)
|
||||
req = [ #Min requirement for each heart values, [8,7,6,5,4,3,2,1]
|
||||
[81,71,61,51,41,31,21,11],
|
||||
[141,126,112,98,84,70,56,42],
|
||||
[201,184,167,150,134,117,100,84],
|
||||
[251,237,223,209,195,181,167,153]
|
||||
][@rank]
|
||||
val = [pokemon.beauty, pokemon.cool, pokemon.cute, pokemon.smart, pokemon.tough][@category]
|
||||
hearts = 0
|
||||
if ContestSettings::USE_SHEEN_FOR_INTRODUCTION_ROUND && !(PokeblockSettings::SIMPLIFIED_BERRY_BLENDING || PokeblockSettings::DONT_USE_SHEEN)
|
||||
val = (val/2).round
|
||||
val += (pokemon.sheen/2).round
|
||||
end
|
||||
val += 20 if pokemon.hasItem?([:REDSCARF,:BLUESCARF,:PINKSCARF,:GREENSCARF,:YELLOWSCARF][@category])
|
||||
|
||||
s = [@crowdNPCs.size, 8].min
|
||||
if val >= req[0]
|
||||
events = @crowdNPCs.sample(s)
|
||||
events.each { |event|
|
||||
$scene.spriteset(map).addUserAnimation(ContestSettings::HEART_ANIMATION_ID, event.x, event.y, false, 2)
|
||||
pbWait(rand(6)+4)
|
||||
}
|
||||
hearts = 8
|
||||
else
|
||||
hearts = 0
|
||||
req.each_with_index { |r, i|
|
||||
if val > r
|
||||
hearts = 8-i
|
||||
break
|
||||
end
|
||||
}
|
||||
events = @crowdNPCs.sample([hearts, @crowdNPCs.size].min)
|
||||
events.each { |event|
|
||||
playAnimation(ContestSettings::HEART_ANIMATION_ID, event.x, event.y)
|
||||
pbWait(rand(6)+4)
|
||||
}
|
||||
end
|
||||
|
||||
pokemonOne.contestVariables["Intro Score"] = hearts*40 if pokemon == pokemonOne
|
||||
pokemonTwo.contestVariables["Intro Score"] = hearts*40 if pokemon == pokemonTwo
|
||||
pokemonThree.contestVariables["Intro Score"] = hearts*40 if pokemon == pokemonThree
|
||||
playerPokemon.contestVariables["Intro Score"] = hearts*40 if pokemon == playerPokemon
|
||||
end
|
||||
|
||||
def pbTalentRound
|
||||
pbFadeOutIn {
|
||||
scene = PokemonContestTalent_Scene.new(self)
|
||||
screen = PokemonContestTalent_Screen.new(scene, self)
|
||||
ret = screen.pbStartScreen
|
||||
}
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
#====================================================================================
|
||||
# Talent Round
|
||||
#====================================================================================
|
||||
|
||||
class PokemonContestTalent_Scene
|
||||
def initialize(contest)
|
||||
@contest = contest
|
||||
@exit = false
|
||||
end
|
||||
|
||||
def pbStartScene
|
||||
# Viewport
|
||||
@viewport = Viewport.new(0,0,Graphics.width,Graphics.height)
|
||||
@viewport.z = 99999
|
||||
@sprites = {}
|
||||
@sprites["background"] = IconSprite.new(0, 0, @viewport)
|
||||
@sprites["background"].setBitmap(sprintf("Graphics/Pictures/Contest/contestbg"))
|
||||
@sprites["message"] = IconSprite.new(0, 0, @viewport)
|
||||
@sprites["message"].setBitmap(sprintf("Graphics/Pictures/Contest/message_box"))
|
||||
@sprites["message"].z = 62
|
||||
@sprites["message"].y = Graphics.height - @sprites["message"].bitmap.height
|
||||
@sprites["pokemonlist"] = IconSprite.new(0, 0, @viewport)
|
||||
@sprites["pokemonlist"].setBitmap(sprintf("Graphics/Pictures/Contest/pokemon_list"))
|
||||
@sprites["pokemonlist"].x = Graphics.width - @sprites["pokemonlist"].bitmap.width
|
||||
@sprites["pokemonlist"].z = 63
|
||||
@sprites["pokemonlist_player"] = IconSprite.new(0, 0, @viewport)
|
||||
@sprites["pokemonlist_player"].setBitmap(sprintf("Graphics/Pictures/Contest/player_panel"))
|
||||
@sprites["pokemonlist_player"].x = Graphics.width - @sprites["pokemonlist_player"].bitmap.width
|
||||
@sprites["pokemonlist_player"].z = 64
|
||||
listWidth = @sprites["pokemonlist_player"].bitmap.width
|
||||
listSecHeight = @sprites["pokemonlist_player"].bitmap.height
|
||||
@sprites["pokemoninfo_player"] = BitmapSprite.new(listWidth, listSecHeight, @viewport)
|
||||
@sprites["pokemoninfo_player"].x = Graphics.width - listWidth
|
||||
@sprites["pokemoninfo_player"].z = 65
|
||||
pbSetSystemFont(@sprites["pokemoninfo_player"].bitmap)
|
||||
@sprites["pokemoninfo_one"] = BitmapSprite.new(listWidth, listSecHeight, @viewport)
|
||||
@sprites["pokemoninfo_one"].x = Graphics.width - listWidth
|
||||
@sprites["pokemoninfo_one"].z = 65
|
||||
pbSetSystemFont(@sprites["pokemoninfo_one"].bitmap)
|
||||
@sprites["pokemoninfo_two"] = BitmapSprite.new(listWidth, listSecHeight, @viewport)
|
||||
@sprites["pokemoninfo_two"].x = Graphics.width - listWidth
|
||||
@sprites["pokemoninfo_two"].z = 65
|
||||
pbSetSystemFont(@sprites["pokemoninfo_two"].bitmap)
|
||||
@sprites["pokemoninfo_three"] = BitmapSprite.new(listWidth, listSecHeight, @viewport)
|
||||
@sprites["pokemoninfo_three"].x = Graphics.width - listWidth
|
||||
@sprites["pokemoninfo_three"].z = 65
|
||||
pbSetSystemFont(@sprites["pokemoninfo_three"].bitmap)
|
||||
@sprites["pokemoninfo_nextorder"] = BitmapSprite.new(listWidth, @sprites["pokemonlist"].bitmap.height, @viewport)
|
||||
@sprites["pokemoninfo_nextorder"].x = Graphics.width - listWidth
|
||||
@sprites["pokemoninfo_nextorder"].z = 65
|
||||
@crowdAnim = AnimatedSprite.create("Graphics/Pictures/Contest/crowd_animated", 2, 4, @viewport)
|
||||
@crowdAnim.visible = false
|
||||
@sprites["applausemeter"] = IconSprite.new(0, 0, @viewport)
|
||||
meterPath = "Graphics/Pictures/Contest/applause_meter"
|
||||
if ContestSettings::USE_ORAS_APPLAUSE_METER
|
||||
meterPath = "Graphics/Pictures/Contest/applause_meter_m_"
|
||||
meterPath += ContestFunctions.getCategoryNameShort(@contest.category).downcase
|
||||
end
|
||||
@sprites["applausemeter"].setBitmap(sprintf(meterPath))
|
||||
@sprites["applausemeter"].x = 0 - @sprites["applausemeter"].bitmap.width
|
||||
@sprites["applausemeter"].y = 4
|
||||
@sprites["applausemeter"].z = 63
|
||||
@sprites["applausemeteroverlay"] = IconSprite.new(0, 0, @viewport)
|
||||
@sprites["applausemeteroverlay"].bitmap = Bitmap.new(@sprites["applausemeter"].bitmap.width, @sprites["applausemeter"].bitmap.height)
|
||||
@sprites["applausemeteroverlay"].x = @sprites["applausemeter"].x
|
||||
@sprites["applausemeteroverlay"].y = @sprites["applausemeter"].y
|
||||
@sprites["applausemeteroverlay"].z = @sprites["applausemeter"].z
|
||||
@sprites["judgeoverlay"] = IconSprite.new(0, 0, @viewport)
|
||||
@sprites["judgeoverlay"].bitmap = Bitmap.new(30, 30)
|
||||
@sprites["judgeoverlay"].x = 228
|
||||
@sprites["judgeoverlay"].y = 20
|
||||
@sprites["judgeoverlay"].z = 65
|
||||
@sprites["curtain"] = IconSprite.new(0, 0, @viewport)
|
||||
@sprites["curtain"].setBitmap(sprintf("Graphics/Pictures/Contest/curtain"))
|
||||
@sprites["curtain"].x = Graphics.width - @sprites["curtain"].bitmap.width
|
||||
@sprites["curtain"].y = 0
|
||||
@sprites["curtain"].z = 99
|
||||
@sprites["opponent"] = IconSprite.new(0, 0, @viewport)
|
||||
@sprites["opponent"].setBitmap(sprintf("Graphics/Pictures/Contest/animation_target"))
|
||||
@sprites["opponent"].ox = @sprites["opponent"].bitmap.width / 2
|
||||
@sprites["opponent"].oy = @sprites["opponent"].bitmap.height / 2
|
||||
@sprites["opponent"].x = @sprites["opponent"].ox
|
||||
@sprites["opponent"].y = @sprites["opponent"].oy
|
||||
@sprites["msgwindow"] = Window_AdvancedTextPokemon.new("")
|
||||
@sprites["msgwindow"].visible = false
|
||||
@sprites["msgwindow"].viewport = @viewport
|
||||
pbDeactivateWindows(@sprites)
|
||||
pbRefresh
|
||||
pbFadeInAndShow(@sprites)
|
||||
end
|
||||
|
||||
def pbScene
|
||||
#Initial setup
|
||||
@contest.setupFirstRound
|
||||
@currentPosition = 0
|
||||
#Loop
|
||||
loop do
|
||||
break if @exit
|
||||
pbStartRound
|
||||
pbChooseMove
|
||||
pbSetAIMoves
|
||||
|
||||
pbHideApplauseMeter
|
||||
4.times { |i|
|
||||
@currentPosition=i+1
|
||||
pbDisplayPokemon(@currentPosition)
|
||||
pbWait(20)
|
||||
pbUseMove(@currentPosition)
|
||||
pbWait(20)
|
||||
pbDismissPokemon(@currentPosition)
|
||||
pbWait(20)
|
||||
}
|
||||
pbEndRound
|
||||
end
|
||||
end
|
||||
|
||||
def pbEndScene
|
||||
pbFadeOutAndHide(@sprites) { pbUpdate }
|
||||
pbDisposeSpriteHash(@sprites)
|
||||
@crowdAnim.dispose
|
||||
@viewport.dispose
|
||||
end
|
||||
|
||||
def pbUpdate
|
||||
pbUpdateSpriteHash(@sprites)
|
||||
end
|
||||
|
||||
def pbRefresh
|
||||
|
||||
end
|
||||
|
||||
def pbShowApplauseMeter
|
||||
while @sprites["applausemeter"].x < 0
|
||||
@sprites["applausemeter"].x += 10
|
||||
@sprites["applausemeter"].x = 0 if @sprites["applausemeter"].x > 0
|
||||
@sprites["applausemeteroverlay"].x = @sprites["applausemeter"].x
|
||||
Graphics.update
|
||||
Input.update
|
||||
pbUpdate
|
||||
end
|
||||
end
|
||||
|
||||
def pbHideApplauseMeter
|
||||
while @sprites["applausemeter"].x > 0 - @sprites["applausemeter"].bitmap.width
|
||||
@sprites["applausemeter"].x -= 10
|
||||
@sprites["applausemeter"].x = 0 - @sprites["applausemeter"].bitmap.width if @sprites["applausemeter"].x < 0 - @sprites["applausemeter"].bitmap.width
|
||||
@sprites["applausemeteroverlay"].x = @sprites["applausemeter"].x
|
||||
Graphics.update
|
||||
Input.update
|
||||
pbUpdate
|
||||
end
|
||||
end
|
||||
|
||||
def updateApplauseMeter
|
||||
@sprites["applausemeteroverlay"].bitmap.clear
|
||||
imgpos = []
|
||||
crowdEnergy = @contest.crowdEnergy
|
||||
if ContestSettings::USE_ORAS_APPLAUSE_METER
|
||||
imgpos << ["Graphics/Pictures/Contest/applause#{crowdEnergy}_m",0,0] if crowdEnergy > 0
|
||||
else
|
||||
imgpos << ["Graphics/Pictures/Contest/applause#{crowdEnergy}",0,0] if crowdEnergy > 0
|
||||
end
|
||||
pbDrawImagePositions(@sprites["applausemeteroverlay"].bitmap,imgpos)
|
||||
end
|
||||
|
||||
def animateCrowd
|
||||
@crowdAnim.visible = true
|
||||
@crowdAnim.play
|
||||
end
|
||||
|
||||
def pbWaitCrowd(numFrames)
|
||||
numFrames.times do
|
||||
Graphics.update
|
||||
Input.update
|
||||
pbUpdateSceneMap
|
||||
updateCrowdAnim
|
||||
end
|
||||
end
|
||||
|
||||
def updateCrowdAnim
|
||||
return if !@crowdAnim.visible
|
||||
@crowdAnim.update
|
||||
end
|
||||
|
||||
def deanimateCrowd
|
||||
@crowdAnim.stop
|
||||
@crowdAnim.visible = false
|
||||
end
|
||||
|
||||
def pbStartRound
|
||||
pbUpdateAllContestantInfo
|
||||
@sprites["pokemonlist_player"].y = 96*@contest.roundOrder.find_index(@contest.playerPokemon)
|
||||
pbWait(20)
|
||||
pbSEPlay("Contest curtain up")
|
||||
while @sprites["curtain"].y > 0 - @sprites["curtain"].bitmap.height
|
||||
@sprites["curtain"].y -= 20
|
||||
@sprites["curtain"].y = 0 - @sprites["curtain"].bitmap.height if @sprites["curtain"].y < 0 - @sprites["curtain"].bitmap.height
|
||||
Graphics.update
|
||||
Input.update
|
||||
pbUpdate
|
||||
end
|
||||
pbWait(5)
|
||||
pbShowApplauseMeter
|
||||
round = pbCurrentPokemonContest.round
|
||||
if round >= ContestSettings::NUMBER_OF_TALENT_ROUNDS
|
||||
pbContestMessage(_INTL("\\c[1]Appeal move no. #{round}. It's the last move!\\n\\c[0]Which move will you use?"))
|
||||
else
|
||||
pbContestMessage(_INTL("\\c[1]Appeal move no. #{round}!\\n\\c[0]Which move will you use?"))
|
||||
end
|
||||
pbWait(20)
|
||||
end
|
||||
|
||||
def pbShowJudgeIcon(icon)
|
||||
if icon == "bored"
|
||||
pbSEPlay("Contest jam")
|
||||
elsif icon == "scramble"
|
||||
pbSEPlay("Contest jam")
|
||||
else
|
||||
pbSEPlay("Exclaim")
|
||||
end
|
||||
bit = @sprites["judgeoverlay"].bitmap
|
||||
imgpos = [["Graphics/Pictures/Contest/judge_#{icon}",0,0]]
|
||||
pbDrawImagePositions(bit,imgpos)
|
||||
pbWait(60)
|
||||
bit.clear
|
||||
pbWait(5)
|
||||
end
|
||||
|
||||
def pbUpdateAllContestantInfo(hideTurn = false)
|
||||
@contest.roundOrder.each { |p|
|
||||
pbUpdateContestantInfo(p,hideTurn)
|
||||
}
|
||||
end
|
||||
|
||||
def pbUpdateContestantInfo(pkmn,hideTurn = false)
|
||||
base = Color.new(72,72,72)
|
||||
shadow = Color.new(160,160,160)
|
||||
if pkmn == @contest.playerPokemon
|
||||
player = @sprites["pokemoninfo_player"].bitmap
|
||||
player.clear
|
||||
pbDrawTextPositions(player, [[pkmn.name,6,8,0,base,shadow]])
|
||||
@sprites["pokemoninfo_player"].y = 96*pkmn.c_orderindex
|
||||
imgpos = []
|
||||
heart = getHeartImage(pkmn.c_round_hearts)
|
||||
imgpos << heart if !heart.empty?
|
||||
spirit = pbCheckSpirit(pkmn)
|
||||
imgpos << spirit if !spirit.empty?
|
||||
status = pbCheckStatus(pkmn)
|
||||
imgpos << status if !status.empty?
|
||||
turn = pbCheckTurnOrder(pkmn)
|
||||
imgpos << turn if !turn.empty? && !hideTurn
|
||||
imgpos << ["Graphics/Pictures/Contest/potential",10,80] if pkmn.c_hasattention
|
||||
pbDrawImagePositions(player,imgpos)
|
||||
elsif pkmn == @contest.pokemonOne
|
||||
one = @sprites["pokemoninfo_one"].bitmap
|
||||
one.clear
|
||||
pbDrawTextPositions(one, [[pkmn.name,6,8,0,base,shadow]])
|
||||
@sprites["pokemoninfo_one"].y = 96*pkmn.c_orderindex
|
||||
imgpos = []
|
||||
heart = getHeartImage(pkmn.c_round_hearts)
|
||||
imgpos << heart if !heart.empty?
|
||||
spirit = pbCheckSpirit(pkmn)
|
||||
imgpos << spirit if !spirit.empty?
|
||||
status = pbCheckStatus(pkmn)
|
||||
imgpos << status if !status.empty?
|
||||
turn = pbCheckTurnOrder(pkmn)
|
||||
imgpos << turn if !turn.empty? && !hideTurn
|
||||
imgpos << ["Graphics/Pictures/Contest/potential",10,80] if pkmn.c_hasattention
|
||||
pbDrawImagePositions(one,imgpos)
|
||||
elsif pkmn == @contest.pokemonTwo
|
||||
two = @sprites["pokemoninfo_two"].bitmap
|
||||
two.clear
|
||||
pbDrawTextPositions(two, [[pkmn.name,6,8,0,base,shadow]])
|
||||
@sprites["pokemoninfo_two"].y = 96*pkmn.c_orderindex
|
||||
imgpos = []
|
||||
heart = getHeartImage(pkmn.c_round_hearts)
|
||||
imgpos << heart if !heart.empty?
|
||||
spirit = pbCheckSpirit(pkmn)
|
||||
imgpos << spirit if !spirit.empty?
|
||||
status = pbCheckStatus(pkmn)
|
||||
imgpos << status if !status.empty?
|
||||
turn = pbCheckTurnOrder(pkmn)
|
||||
imgpos << turn if !turn.empty? && !hideTurn
|
||||
imgpos << ["Graphics/Pictures/Contest/potential",10,80] if pkmn.c_hasattention
|
||||
pbDrawImagePositions(two,imgpos)
|
||||
elsif pkmn == @contest.pokemonThree
|
||||
three = @sprites["pokemoninfo_three"].bitmap
|
||||
three.clear
|
||||
pbDrawTextPositions(three, [[pkmn.name,6,8,0,base,shadow]])
|
||||
@sprites["pokemoninfo_three"].y = 96*pkmn.c_orderindex
|
||||
imgpos = []
|
||||
heart = getHeartImage(pkmn.c_round_hearts)
|
||||
imgpos << heart if !heart.empty?
|
||||
spirit = pbCheckSpirit(pkmn)
|
||||
imgpos << spirit if !spirit.empty?
|
||||
status = pbCheckStatus(pkmn)
|
||||
imgpos << status if !status.empty?
|
||||
turn = pbCheckTurnOrder(pkmn)
|
||||
imgpos << turn if !turn.empty? && !hideTurn
|
||||
imgpos << ["Graphics/Pictures/Contest/potential",10,80] if pkmn.c_hasattention
|
||||
pbDrawImagePositions(three,imgpos)
|
||||
end
|
||||
end
|
||||
|
||||
def pbDrawContestantHeartMeters
|
||||
pbUpdateAllContestantInfo(true)
|
||||
bitmap = Bitmap.new(sprintf("Graphics/Pictures/Contest/heart_scale"))
|
||||
newTotals = []
|
||||
diffs = []
|
||||
xPos = Graphics.width - @sprites["pokemonlist_player"].bitmap.width
|
||||
@contest.roundOrder.each_with_index { |p,i|
|
||||
@sprites["heartmeter_#{i}"] = IconSprite.new(0, 0, @viewport)
|
||||
@sprites["heartmeter_#{i}"].bitmap = bitmap
|
||||
@sprites["heartmeter_#{i}"].x = xPos + 36 + 4*p.c_total_hearts
|
||||
@sprites["heartmeter_#{i}"].y = 80 + 96*i
|
||||
@sprites["heartmeter_#{i}"].z = 70
|
||||
newTotals[i] = (p.c_total_hearts + p.c_round_hearts).clamp(0,27)
|
||||
diffs[i] = newTotals[i] - p.c_total_hearts
|
||||
}
|
||||
pbWait(20)
|
||||
animate = true
|
||||
while animate
|
||||
done = [false, false, false, false]
|
||||
diffs.each_with_index { |a,i|
|
||||
next if done[i]
|
||||
if diffs[i] < 0
|
||||
@sprites["heartmeter_#{i}"].x -= 4
|
||||
diffs[i] += 1
|
||||
elsif diffs[i] > 0
|
||||
@sprites["heartmeter_#{i}"].x += 4
|
||||
diffs[i] -= 1
|
||||
else #0
|
||||
done[i] = true
|
||||
end
|
||||
}
|
||||
Graphics.update
|
||||
Input.update
|
||||
animate = false if done[0] && done[1] && done[2] && done[3]
|
||||
end
|
||||
|
||||
@contest.roundOrder.each { |p,i|
|
||||
p.c_total_hearts = (p.c_total_hearts + p.c_round_hearts).clamp(0,27)
|
||||
}
|
||||
end
|
||||
|
||||
def pbDisposeHeartMeters
|
||||
4.times do |i|
|
||||
@sprites["heartmeter_#{i}"].dispose
|
||||
@sprites.delete("heartmeter_#{i}")
|
||||
end
|
||||
end
|
||||
|
||||
def getHeartImage(value)
|
||||
return ["Graphics/Pictures/Contest/heart#{value}",36,50] if value > 0
|
||||
return ["Graphics/Pictures/Contest/negaheart#{value.abs}",36,50] if value < 0
|
||||
return []
|
||||
end
|
||||
|
||||
def pbCheckSpirit(pkmn)
|
||||
return ["Graphics/Pictures/Contest/stars#{pkmn.c_spirit}",6,34] if pkmn.c_spirit > 0
|
||||
return []
|
||||
end
|
||||
|
||||
def pbCheckStatus(pkmn)
|
||||
imgpos = []
|
||||
if pkmn.c_startled
|
||||
imgpos = ["Graphics/Pictures/Contest/icon_startled",6,50]
|
||||
elsif pkmn.c_nomoremoves || pkmn.c_missturn
|
||||
imgpos = ["Graphics/Pictures/Contest/icon_resting",6,50]
|
||||
elsif pkmn.c_calm || pkmn.c_oblivious
|
||||
imgpos = ["Graphics/Pictures/Contest/icon_oblivious",6,50]
|
||||
elsif pkmn.c_nervous
|
||||
imgpos = ["Graphics/Pictures/Contest/icon_nervous",6,50]
|
||||
end
|
||||
return imgpos
|
||||
end
|
||||
|
||||
def pbCheckTurnOrder(pkmn)
|
||||
return ["Graphics/Pictures/Contest/nextturn_random",46,78] if @contest.scramble
|
||||
imgpos = []
|
||||
if pkmn.c_moveup
|
||||
i = @contest.nextTurnFirstOrder.find_index(pkmn)
|
||||
imgpos = ["Graphics/Pictures/Contest/nextturn#{i+1}",46,78]
|
||||
elsif pkmn.c_movedown
|
||||
i = @contest.nextTurnLastOrder.find_index(pkmn)
|
||||
imgpos = ["Graphics/Pictures/Contest/nextturn#{i+1}",46,78]
|
||||
end
|
||||
return imgpos
|
||||
end
|
||||
|
||||
def pbChooseMove
|
||||
if !@sprites["moves"]
|
||||
@sprites["moves"] = Sprite.new(@viewport)
|
||||
@sprites["moves"].bitmap = Bitmap.new("Graphics/Pictures/Contest/moves")
|
||||
end
|
||||
@sprites["moves"].x = 0
|
||||
@sprites["moves"].y = 184
|
||||
@sprites["moves"].z = 85
|
||||
@buttonBitmap = AnimatedBitmap.new(_INTL("Graphics/Pictures/Contest/cursor_contest"))
|
||||
# Set overlay
|
||||
if !@sprites["overlay"]
|
||||
@sprites["overlay"] = Sprite.new(@viewport)
|
||||
@sprites["overlay"].bitmap = Bitmap.new(Graphics.width,Graphics.height)
|
||||
end
|
||||
@sprites["overlay"].z = 87
|
||||
overlay = @sprites["overlay"].bitmap
|
||||
overlay.clear
|
||||
if !@sprites["overlay1"]
|
||||
@sprites["overlay1"] = Sprite.new(@viewport)
|
||||
@sprites["overlay1"].bitmap = Bitmap.new(Graphics.width,Graphics.height)
|
||||
end
|
||||
@sprites["overlay1"].z = 87
|
||||
overlay1 = @sprites["overlay1"].bitmap
|
||||
overlay1.clear
|
||||
pbSetNarrowFont(overlay)
|
||||
pbSetSystemFont(overlay1)
|
||||
textpos = [[_INTL("Please select a move."), 12, 150, 0, Color.new(256,256,256), Color.new(0,0,0)]]
|
||||
# Draw text
|
||||
@selection = 0
|
||||
# Move
|
||||
@selectedmove = GameData::Move.get(@contest.playerPokemon.moves[@selection].id)
|
||||
pbMoveShowDetails(@selectedmove)
|
||||
@contest.playerPokemon.numMoves.times { |i|
|
||||
if @contest.playerPokemon.moves[i].id
|
||||
move = GameData::Move.get(@contest.playerPokemon.moves[i].id)
|
||||
name = move.name
|
||||
@sprites["button_#{i}"] = Sprite.new(@viewport)
|
||||
@sprites["button_#{i}"].bitmap = @buttonBitmap.bitmap
|
||||
@sprites["button_#{i}"].x = xPos = 6
|
||||
@sprites["button_#{i}"].y = yPos = 192 + 46 * i
|
||||
@sprites["button_#{i}"].z = 86
|
||||
@sprites["button_#{i}"].src_rect.width = @buttonBitmap.width / 2
|
||||
@sprites["button_#{i}"].src_rect.height = @buttonBitmap.height / 6
|
||||
@sprites["button_#{i}"].src_rect.x = (@selection == i) ? @buttonBitmap.width / 2 : 0
|
||||
@sprites["button_#{i}"].src_rect.y = move.contest_type_position * 46
|
||||
colorb = Color.new(80, 80, 88)
|
||||
colorb = Color.new(175, 175, 175) if (@contest.playerPokemon.c_lastmove && name == @contest.playerPokemon.c_lastmove.name)
|
||||
colorb = Color.new(65, 0, 165) if @contest.playerPokemon.checkContestCombos(move)
|
||||
textpos << [name, xPos + @sprites["button_#{i}"].src_rect.width/2, yPos, 2, colorb, Color.new(160, 160, 168)]
|
||||
end
|
||||
}
|
||||
pbDrawTextPositions(overlay, textpos)
|
||||
waitingForInput = true
|
||||
pbWait(20)
|
||||
loop do
|
||||
break if !waitingForInput
|
||||
Graphics.update
|
||||
Input.update
|
||||
pbUpdate
|
||||
if Input.trigger?(Input::DOWN)
|
||||
@selection += 1
|
||||
@selection = 0 if @selection >= @contest.playerPokemon.numMoves
|
||||
# Set information
|
||||
pbMoveShowDetails(GameData::Move.get(@contest.playerPokemon.moves[@selection].id))
|
||||
pbMoveUpdateButtons
|
||||
pbPlayCursorSE
|
||||
elsif Input.trigger?(Input::UP)
|
||||
@selection -= 1
|
||||
@selection = @contest.playerPokemon.numMoves - 1 if @selection < 0
|
||||
# Set information
|
||||
pbMoveShowDetails(GameData::Move.get(@contest.playerPokemon.moves[@selection].id))
|
||||
pbMoveUpdateButtons
|
||||
pbPlayCursorSE
|
||||
elsif Input.trigger?(Input::USE)
|
||||
if GameData::Move.get(@contest.playerPokemon.moves[@selection].id).contest_can_be_used?
|
||||
pbPlayDecisionSE
|
||||
# Set select (move)
|
||||
@contest.playerPokemon.c_currentmove = @contest.playerPokemon.moves[@selection]
|
||||
# Dispose
|
||||
["moves","selecthearts","selectjam","button_0","button_1","button_2","button_3"].each { |sprite| dispose(@sprites, sprite) }
|
||||
["overlay", "overlay1"].each { |i| @sprites["#{i}"].bitmap.clear}
|
||||
@buttonBitmap.dispose
|
||||
waitingForInput = false
|
||||
else
|
||||
pbPlayBuzzerSE
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def pbMoveShowDetails(move)
|
||||
return if !move
|
||||
overlay1 = @sprites["overlay1"].bitmap
|
||||
overlay1.clear
|
||||
textpos1 = []
|
||||
imagepos1 = []
|
||||
description = move.contest_description
|
||||
hearts = !move.contest_can_be_used? ? 0 : move.contest_hearts
|
||||
jam = !move.contest_can_be_used? ? 0 : move.contest_jam
|
||||
type = move.contest_type_position
|
||||
imagepos1 << ["Graphics/Pictures/Contest/contesttype", 206, 204, 0, type * 28, 64, 28]
|
||||
textpos1 << [_INTL("APPEAL"), 422, 180, 1, Color.new(248, 248, 248), Color.new(104, 104, 104)]
|
||||
textpos1 << [_INTL("JAMMING"), 422, 212, 1, Color.new(248, 248, 248), Color.new(104, 104, 104)]
|
||||
if hearts > 0
|
||||
file = "Graphics/Pictures/Contest/move_heart#{hearts}"
|
||||
@sprites["selecthearts"] = IconSprite.new(436, 190, @viewport) if !@sprites["selecthearts"]
|
||||
@sprites["selecthearts"].setBitmap(file)
|
||||
@sprites["selecthearts"].z = 88
|
||||
else
|
||||
@sprites["selecthearts"]&.clearBitmaps
|
||||
end
|
||||
if jam > 0
|
||||
file = "Graphics/Pictures/Contest/move_negaheart#{jam}"
|
||||
@sprites["selectjam"] = IconSprite.new(436, 222, @viewport) if !@sprites["selectjam"]
|
||||
@sprites["selectjam"].setBitmap(file)
|
||||
@sprites["selectjam"].z = 88
|
||||
else
|
||||
@sprites["selectjam"]&.clearBitmaps
|
||||
end
|
||||
pbDrawTextPositions(overlay1, textpos1)
|
||||
pbDrawImagePositions(overlay1, imagepos1)
|
||||
drawTextEx(overlay1, 208, 258, 296, 4, description, Color.new(64, 64, 64), Color.new(176, 176, 176))
|
||||
end
|
||||
|
||||
def pbMoveUpdateButtons
|
||||
@contest.playerPokemon.numMoves.times { |i|
|
||||
@sprites["button_#{i}"].src_rect.x = (@selection == i) ? @buttonBitmap.width / 2 : 0
|
||||
}
|
||||
end
|
||||
|
||||
def pbEndRound
|
||||
#clear next turn order boxes here
|
||||
pbWait(10)
|
||||
pbDrawContestantHeartMeters
|
||||
pbWait(20)
|
||||
pbSEPlay("Contest curtain down")
|
||||
while @sprites["curtain"].y < 0
|
||||
@sprites["curtain"].y += 20
|
||||
@sprites["curtain"].y = 0 if @sprites["curtain"].y > 0
|
||||
Graphics.update
|
||||
Input.update
|
||||
pbUpdate
|
||||
end
|
||||
pbWait(5)
|
||||
pbHideApplauseMeter
|
||||
pbWait(20)
|
||||
pbDisposeHeartMeters
|
||||
pbCurrentPokemonContest.round += 1
|
||||
if pbCurrentPokemonContest.round > ContestSettings::NUMBER_OF_TALENT_ROUNDS
|
||||
pbContestMessage(_INTL("\\c[1]That's it! \\c[0]We're all out of Appeal Time!"))
|
||||
@exit = true
|
||||
return
|
||||
end
|
||||
pbCurrentPokemonContest.setupNextRound
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class PokemonContestTalent_Screen
|
||||
def initialize(scene,contest)
|
||||
@scene = scene
|
||||
@contest = contest
|
||||
end
|
||||
|
||||
def pbStartScreen
|
||||
@scene.pbStartScene
|
||||
@scene.pbScene
|
||||
@scene.pbEndScene
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -0,0 +1,439 @@
|
||||
#====================================================================================
|
||||
# DO NOT MAKE EDITS HERE
|
||||
#====================================================================================
|
||||
|
||||
#====================================================================================
|
||||
# Results
|
||||
#====================================================================================
|
||||
class PokemonContest
|
||||
|
||||
def pbResults
|
||||
pbMoveRoute(@mcEvent,[PBMoveRoute::Right,PBMoveRoute::Right,PBMoveRoute::TurnDown])
|
||||
pbMoveRoute(@judgeEvent,[PBMoveRoute::Left,PBMoveRoute::Left,PBMoveRoute::TurnDown])
|
||||
pbWaitForCharacterMove(@judgeEvent)
|
||||
pbCallBubDown(2,@mcEvent.id)
|
||||
pbMessage(_INTL("That's it for the Talent Round!"))
|
||||
pbCallBubDown(2,@mcEvent.id)
|
||||
pbMessage(_INTL("Thank you all for a most wonderful display of quality appeals!"))
|
||||
pbCallBubDown(2,@mcEvent.id)
|
||||
pbMessage(_INTL("This concludes all judging! Thank you for your fine efforts!"))
|
||||
pbCallBubDown(2,@mcEvent.id)
|
||||
pbMessage(_INTL("Now, all that remains is the pulse-pounding proclamation of the winner."))
|
||||
pbCallBubDown(2,@mcEvent.id)
|
||||
pbMessage(_INTL("The Judge looks ready to make the announcement!"))
|
||||
pbCallBubDown(2,@mcEvent.id)
|
||||
pbMessage(_INTL("We will now declare the winner!"))
|
||||
|
||||
#27 hearts is max counted for Talent
|
||||
#convert 27 to 320...
|
||||
pokemonOne.contestVariables["Total Hearts"] = (320.0*pokemonOne.contestVariables["Total Hearts"]/27).floor
|
||||
pokemonTwo.contestVariables["Total Hearts"] = (320.0*pokemonTwo.contestVariables["Total Hearts"]/27).floor
|
||||
pokemonThree.contestVariables["Total Hearts"] = (320.0*pokemonThree.contestVariables["Total Hearts"]/27).floor
|
||||
playerPokemon.contestVariables["Total Hearts"] = (320.0*playerPokemon.contestVariables["Total Hearts"]/27).floor
|
||||
pbWait(15)
|
||||
pbFadeOutIn {
|
||||
scene = PokemonContestResults_Scene.new(self)
|
||||
screen = PokemonContestResults_Screen.new(scene, self)
|
||||
pbBGMPlay(ContestSettings::BGM_CONTEST_RESULTS_FILE)
|
||||
ret = screen.pbStartScreen
|
||||
}
|
||||
pbBGMPlay(ContestSettings::BGM_CONTEST_WON_FILE)
|
||||
pbWait(15)
|
||||
pbCallBubDown(2,@mcEvent.id)
|
||||
pbMessage(_INTL("{1} & {2}, congratulations!",@winningTrainer.name,@winningPokemon.name))
|
||||
pbCallBubDown(2,@mcEvent.id)
|
||||
pbMessage(_INTL("Please come up and accept your prize!"))
|
||||
if @winningTrainer == @trainerOne
|
||||
event = @contestTrainers[0]
|
||||
pbMoveRoute(event,[PBMoveRoute::Up,PBMoveRoute::Right,
|
||||
PBMoveRoute::Right,PBMoveRoute::Up])
|
||||
pbWaitForCharacterMove(event)
|
||||
elsif @winningTrainer == @trainerTwo
|
||||
event = @contestTrainers[1]
|
||||
pbMoveRoute(event,[PBMoveRoute::Up,PBMoveRoute::Up])
|
||||
pbWaitForCharacterMove(event)
|
||||
elsif @winningTrainer == @trainerThree
|
||||
event = @contestTrainers[2]
|
||||
pbMoveRoute(event,[PBMoveRoute::Up,PBMoveRoute::Left,
|
||||
PBMoveRoute::Left,PBMoveRoute::Up])
|
||||
pbWaitForCharacterMove(event)
|
||||
else
|
||||
pbMoveRoute($game_player,[PBMoveRoute::Up,PBMoveRoute::Left,
|
||||
PBMoveRoute::Left,PBMoveRoute::Left,PBMoveRoute::Left,PBMoveRoute::Up])
|
||||
pbWaitForCharacterMove($game_player)
|
||||
end
|
||||
ribbon = GameData::Ribbon.get(ContestSettings::CONTEST_RIBBONS[@category][@rank])
|
||||
pbCallBubDown(2,@mcEvent.id)
|
||||
pbMessage(_INTL("We confer on you the {1} as your prize!", ribbon.name)) if !@playerWin
|
||||
$Trainer.stats.initializeContestStats unless $Trainer.stats.contest_stats_initialized?
|
||||
if @playerWin
|
||||
if @playerPokemon.hasRibbon?(ribbon)
|
||||
pbCallBubDown(2,@mcEvent.id)
|
||||
pbMessage(_INTL("As {1} already has the \\c[1]{2}\\c[0], we offer a complimentary prize!", @playerPokemon.name, ribbon.name))
|
||||
pbReceiveItem(GameData::Item.get(ContestSettings::CONTEST_OTHER_PRIZE[@category][@rank]))
|
||||
else
|
||||
pbCallBubDown(2,@mcEvent.id)
|
||||
pbMessage(_INTL("We confer on you the {1} as your prize!", ribbon.name))
|
||||
@playerPokemon.giveRibbon(ribbon)
|
||||
pbCallBubDown(2,@mcEvent.id)
|
||||
pbMessage(_INTL("\\me[{1}]{2} received the \\c[1]{3}\\c[0]!\\wtnp[30]", "Item get", @playerPokemon.name, ribbon.name))
|
||||
end
|
||||
$Trainer.stats.pokemon_contests_won_total += 1
|
||||
$Trainer.stats.pokemon_contests_won_category[@category] += 1
|
||||
$Trainer.stats.pokemon_contests_won_rank[@rank] += 1
|
||||
$Trainer.stats.pokemon_contests_won_category_rank[@category][@rank] += 1
|
||||
end
|
||||
pbSetLastContestWinner(@category,@rank,@winningTrainer.clone,@winningPokemon.clone)
|
||||
$Trainer.stats.pokemon_contests_participated_total += 1
|
||||
$Trainer.stats.pokemon_contests_participated_category[@category] += 1
|
||||
$Trainer.stats.pokemon_contests_participated_rank[@rank] += 1
|
||||
$Trainer.stats.pokemon_contests_participated_category_rank[@category][@rank] += 1
|
||||
pbWait(40)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
class PokemonContestResults_Scene
|
||||
def initialize(contest)
|
||||
@contest = contest
|
||||
end
|
||||
|
||||
def pbStartScene
|
||||
@viewport = Viewport.new(0,0,Graphics.width,Graphics.height)
|
||||
@viewport.z = 99999
|
||||
@sprites = {}
|
||||
@sprites["background"] = IconSprite.new(0, 0, @viewport)
|
||||
@sprites["background"].setBitmap(sprintf("Graphics/Pictures/Contest/resultsbg"))
|
||||
@sprites["pokemonOne"] = PokemonIconSprite.new(@contest.pokemonOne, @viewport)
|
||||
@sprites["pokemonOne"].setOffset(PictureOrigin::Center)
|
||||
@sprites["pokemonOne"].x = 56
|
||||
@sprites["pokemonOne"].y = 48
|
||||
@sprites["pokemonTwo"] = PokemonIconSprite.new(@contest.pokemonTwo, @viewport)
|
||||
@sprites["pokemonTwo"].setOffset(PictureOrigin::Center)
|
||||
@sprites["pokemonTwo"].x = 56
|
||||
@sprites["pokemonTwo"].y = 48 + 64
|
||||
@sprites["pokemonThree"] = PokemonIconSprite.new(@contest.pokemonThree, @viewport)
|
||||
@sprites["pokemonThree"].setOffset(PictureOrigin::Center)
|
||||
@sprites["pokemonThree"].x = 56
|
||||
@sprites["pokemonThree"].y = 48 + 64*2
|
||||
@sprites["pokemonPlayer"] = PokemonIconSprite.new(@contest.playerPokemon, @viewport)
|
||||
@sprites["pokemonPlayer"].setOffset(PictureOrigin::Center)
|
||||
@sprites["pokemonPlayer"].x = 56
|
||||
@sprites["pokemonPlayer"].y = 48 + 64*3
|
||||
@sprites["msgwindow"] = Window_AdvancedTextPokemon.new("")
|
||||
@sprites["msgwindow"].visible = false
|
||||
@sprites["msgwindow"].viewport = @viewport
|
||||
pbDeactivateWindows(@sprites)
|
||||
pbRefresh
|
||||
pbFadeInAndShow(@sprites)
|
||||
end
|
||||
|
||||
def pbScene
|
||||
pbDisplay(_INTL("First, the results of the Introduction Round!"))
|
||||
pbShowIntroRoundBars
|
||||
pbDisplay(_INTL("Now, the results of the Talent Round!"))
|
||||
pbShowTalentRoundBars
|
||||
pbDisplay(_INTL("And the winner is..."))
|
||||
pbShowPlaces
|
||||
position = @contest.winningPosition
|
||||
trainerName = @contest.winningTrainer.name
|
||||
pokemonName = @contest.winningPokemon.name
|
||||
pbDisplay(_INTL("Entry Number {1}: {2} & {3}! Congratulations!",position,pokemonName,trainerName))
|
||||
end
|
||||
|
||||
def pbEndScene
|
||||
@sprites["barBitmap"].dispose
|
||||
pbFadeOutAndHide(@sprites) { pbUpdate }
|
||||
pbDisposeSpriteHash(@sprites)
|
||||
@viewport.dispose
|
||||
end
|
||||
|
||||
def pbDisplay(msg, brief = false)
|
||||
UIHelper.pbDisplay(@sprites["msgwindow"], msg, brief) { pbUpdate }
|
||||
end
|
||||
|
||||
def pbUpdate
|
||||
pbUpdateIntroBars
|
||||
pbUpdateTalentBars
|
||||
pbUpdatePlaces
|
||||
pbUpdateSpriteHash(@sprites)
|
||||
end
|
||||
|
||||
def pbRefresh
|
||||
|
||||
end
|
||||
|
||||
def pbShowIntroRoundBars
|
||||
@barx = 96
|
||||
@bary = 58
|
||||
@barMaxWidth = 192 #128 for 3 rounds, future
|
||||
@maxX = []
|
||||
max = 320.0
|
||||
@sprites["barBitmap"] = AnimatedBitmap.new("Graphics/Pictures/Contest/overlay_results")
|
||||
@sprites["pokemonOneScoreIntro"] = Sprite.new(@viewport)
|
||||
@sprites["pokemonOneScoreIntro"].bitmap = @sprites["barBitmap"].bitmap
|
||||
@sprites["pokemonOneScoreIntro"].src_rect.height = @sprites["barBitmap"].height / 3
|
||||
@sprites["pokemonOneScoreIntro"].src_rect.width = 0
|
||||
@sprites["pokemonOneScoreIntro"].x = @barx
|
||||
@sprites["pokemonOneScoreIntro"].y = @bary
|
||||
@maxX[0] = (@barMaxWidth*(@contest.pokemonOne.contestVariables["Intro Score"]/max)).round
|
||||
|
||||
@sprites["pokemonTwoScoreIntro"] = Sprite.new(@viewport)
|
||||
@sprites["pokemonTwoScoreIntro"].bitmap = @sprites["barBitmap"].bitmap
|
||||
@sprites["pokemonTwoScoreIntro"].src_rect.height = @sprites["barBitmap"].height / 3
|
||||
@sprites["pokemonTwoScoreIntro"].src_rect.width = 0
|
||||
@sprites["pokemonTwoScoreIntro"].x = @barx
|
||||
@sprites["pokemonTwoScoreIntro"].y = @bary + 64
|
||||
@maxX[1] = (@barMaxWidth*(@contest.pokemonTwo.contestVariables["Intro Score"]/max)).round
|
||||
|
||||
@sprites["pokemonThreeScoreIntro"] = Sprite.new(@viewport)
|
||||
@sprites["pokemonThreeScoreIntro"].bitmap = @sprites["barBitmap"].bitmap
|
||||
@sprites["pokemonThreeScoreIntro"].src_rect.height = @sprites["barBitmap"].height / 3
|
||||
@sprites["pokemonThreeScoreIntro"].src_rect.width = 0
|
||||
@sprites["pokemonThreeScoreIntro"].x = @barx
|
||||
@sprites["pokemonThreeScoreIntro"].y = @bary + 64*2
|
||||
@maxX[2] = (@barMaxWidth*(@contest.pokemonThree.contestVariables["Intro Score"]/max)).round
|
||||
|
||||
@sprites["pokemonPlayerScoreIntro"] = Sprite.new(@viewport)
|
||||
@sprites["pokemonPlayerScoreIntro"].bitmap = @sprites["barBitmap"].bitmap
|
||||
@sprites["pokemonPlayerScoreIntro"].src_rect.height = @sprites["barBitmap"].height / 3
|
||||
@sprites["pokemonPlayerScoreIntro"].src_rect.width = 0
|
||||
@sprites["pokemonPlayerScoreIntro"].x = @barx
|
||||
@sprites["pokemonPlayerScoreIntro"].y = @bary + 64*3
|
||||
@maxX[3] = (@barMaxWidth*(@contest.playerPokemon.contestVariables["Intro Score"]/max)).round
|
||||
|
||||
@animatingIntros = true
|
||||
pbUpdate
|
||||
end
|
||||
|
||||
def pbShowTalentRoundBars
|
||||
@maxX_t = []
|
||||
max = 320.0
|
||||
@sprites["barBitmap"] = AnimatedBitmap.new("Graphics/Pictures/Contest/overlay_results")
|
||||
@sprites["pokemonOneScoreTalent"] = Sprite.new(@viewport)
|
||||
@sprites["pokemonOneScoreTalent"].bitmap = @sprites["barBitmap"].bitmap
|
||||
@sprites["pokemonOneScoreTalent"].src_rect.height = @sprites["barBitmap"].height / 3
|
||||
@sprites["pokemonOneScoreTalent"].src_rect.width = 0
|
||||
@sprites["pokemonOneScoreTalent"].src_rect.y = 12
|
||||
@sprites["pokemonOneScoreTalent"].x = @barx + @maxX[0]
|
||||
@sprites["pokemonOneScoreTalent"].y = @bary
|
||||
@maxX_t[0] = (@barMaxWidth*(@contest.pokemonOne.contestVariables["Total Hearts"]/max)).round
|
||||
|
||||
@sprites["pokemonTwoScoreTalent"] = Sprite.new(@viewport)
|
||||
@sprites["pokemonTwoScoreTalent"].bitmap = @sprites["barBitmap"].bitmap
|
||||
@sprites["pokemonTwoScoreTalent"].src_rect.height = @sprites["barBitmap"].height / 3
|
||||
@sprites["pokemonTwoScoreTalent"].src_rect.width = 0
|
||||
@sprites["pokemonTwoScoreTalent"].src_rect.y = 12
|
||||
@sprites["pokemonTwoScoreTalent"].x = @barx + @maxX[1]
|
||||
@sprites["pokemonTwoScoreTalent"].y = @bary + 64
|
||||
@maxX_t[1] = (@barMaxWidth*(@contest.pokemonTwo.contestVariables["Total Hearts"]/max)).round
|
||||
|
||||
@sprites["pokemonThreeScoreTalent"] = Sprite.new(@viewport)
|
||||
@sprites["pokemonThreeScoreTalent"].bitmap = @sprites["barBitmap"].bitmap
|
||||
@sprites["pokemonThreeScoreTalent"].src_rect.height = @sprites["barBitmap"].height / 3
|
||||
@sprites["pokemonThreeScoreTalent"].src_rect.width = 0
|
||||
@sprites["pokemonThreeScoreTalent"].src_rect.y = 12
|
||||
@sprites["pokemonThreeScoreTalent"].x = @barx + @maxX[2]
|
||||
@sprites["pokemonThreeScoreTalent"].y = @bary + 64*2
|
||||
@maxX_t[2] = (@barMaxWidth*(@contest.pokemonThree.contestVariables["Total Hearts"]/max)).round
|
||||
|
||||
@sprites["pokemonPlayerScoreTalent"] = Sprite.new(@viewport)
|
||||
@sprites["pokemonPlayerScoreTalent"].bitmap = @sprites["barBitmap"].bitmap
|
||||
@sprites["pokemonPlayerScoreTalent"].src_rect.height = @sprites["barBitmap"].height / 3
|
||||
@sprites["pokemonPlayerScoreTalent"].src_rect.width = 0
|
||||
@sprites["pokemonPlayerScoreTalent"].src_rect.y = 12
|
||||
@sprites["pokemonPlayerScoreTalent"].x = @barx + @maxX[3]
|
||||
@sprites["pokemonPlayerScoreTalent"].y = @bary + 64*3
|
||||
@maxX_t[3] = (@barMaxWidth*(@contest.playerPokemon.contestVariables["Total Hearts"]/max)).round
|
||||
|
||||
@animatingTalents = true
|
||||
pbUpdate
|
||||
end
|
||||
|
||||
def pbUpdateIntroBars #updateHPAnimation
|
||||
return if !@animatingIntros
|
||||
while @animatingIntros
|
||||
#return if @frames % 5 != 0
|
||||
perFrameOne = 4 #[@maxX[0] / Graphics.frame_rate, 1].max
|
||||
perFrameTwo = 4 #[@maxX[1] / Graphics.frame_rate, 1].max
|
||||
perFrameThree = 4 #[@maxX[2] / Graphics.frame_rate, 1].max
|
||||
perFrameFour = 4 #[@maxX[3] / Graphics.frame_rate, 1].max
|
||||
|
||||
@sprites["pokemonOneScoreIntro"].src_rect.width += perFrameOne
|
||||
@sprites["pokemonTwoScoreIntro"].src_rect.width += perFrameTwo
|
||||
@sprites["pokemonThreeScoreIntro"].src_rect.width += perFrameThree
|
||||
@sprites["pokemonPlayerScoreIntro"].src_rect.width += perFrameFour
|
||||
@sprites["pokemonOneScoreIntro"].src_rect.width = @maxX[0] if @sprites["pokemonOneScoreIntro"].src_rect.width > @maxX[0]
|
||||
@sprites["pokemonTwoScoreIntro"].src_rect.width = @maxX[1] if @sprites["pokemonTwoScoreIntro"].src_rect.width > @maxX[1]
|
||||
@sprites["pokemonThreeScoreIntro"].src_rect.width = @maxX[2] if @sprites["pokemonThreeScoreIntro"].src_rect.width > @maxX[2]
|
||||
@sprites["pokemonPlayerScoreIntro"].src_rect.width = @maxX[3] if @sprites["pokemonPlayerScoreIntro"].src_rect.width > @maxX[3]
|
||||
@animatingIntros = false if @sprites["pokemonOneScoreIntro"].src_rect.width >= @maxX[0] &&
|
||||
@sprites["pokemonTwoScoreIntro"].src_rect.width >= @maxX[1] &&
|
||||
@sprites["pokemonThreeScoreIntro"].src_rect.width >= @maxX[2] &&
|
||||
@sprites["pokemonPlayerScoreIntro"].src_rect.width >= @maxX[3]
|
||||
Graphics.update
|
||||
pbUpdateSpriteHash(@sprites)
|
||||
end
|
||||
end
|
||||
|
||||
def pbUpdateTalentBars #updateHPAnimation
|
||||
return if !@animatingTalents
|
||||
while @animatingTalents
|
||||
perFrameOne = 4
|
||||
perFrameTwo = 4
|
||||
perFrameThree = 4
|
||||
perFrameFour = 4
|
||||
|
||||
@sprites["pokemonOneScoreTalent"].src_rect.width += perFrameOne
|
||||
@sprites["pokemonTwoScoreTalent"].src_rect.width += perFrameTwo
|
||||
@sprites["pokemonThreeScoreTalent"].src_rect.width += perFrameThree
|
||||
@sprites["pokemonPlayerScoreTalent"].src_rect.width += perFrameFour
|
||||
@sprites["pokemonTwoScoreTalent"].src_rect.width = @maxX_t[1] if @sprites["pokemonTwoScoreTalent"].src_rect.width > @maxX_t[1]
|
||||
@sprites["pokemonOneScoreTalent"].src_rect.width = @maxX_t[0] if @sprites["pokemonOneScoreTalent"].src_rect.width > @maxX_t[0]
|
||||
@sprites["pokemonThreeScoreTalent"].src_rect.width = @maxX_t[2] if @sprites["pokemonThreeScoreTalent"].src_rect.width > @maxX_t[2]
|
||||
@sprites["pokemonPlayerScoreTalent"].src_rect.width = @maxX_t[3] if @sprites["pokemonPlayerScoreTalent"].src_rect.width > @maxX_t[3]
|
||||
@animatingTalents = false if @sprites["pokemonOneScoreTalent"].src_rect.width >= @maxX_t[0] &&
|
||||
@sprites["pokemonTwoScoreTalent"].src_rect.width >= @maxX_t[1] &&
|
||||
@sprites["pokemonThreeScoreTalent"].src_rect.width >= @maxX_t[2] &&
|
||||
@sprites["pokemonPlayerScoreTalent"].src_rect.width >= @maxX_t[3]
|
||||
Graphics.update
|
||||
pbUpdateSpriteHash(@sprites)
|
||||
end
|
||||
end
|
||||
|
||||
def pbShowPlaces
|
||||
@contest.pokemonOne.contestVariables["Total Score"] = @contest.pokemonOne.c_intro_score + @contest.pokemonOne.c_total_hearts
|
||||
@contest.pokemonTwo.contestVariables["Total Score"] = @contest.pokemonTwo.c_intro_score + @contest.pokemonTwo.c_total_hearts
|
||||
@contest.pokemonThree.contestVariables["Total Score"] = @contest.pokemonThree.c_intro_score + @contest.pokemonThree.c_total_hearts
|
||||
@contest.playerPokemon.contestVariables["Total Score"] = @contest.playerPokemon.c_intro_score + @contest.playerPokemon.c_total_hearts
|
||||
totals = [@contest.pokemonOne.c_total_score,@contest.pokemonTwo.c_total_score,@contest.pokemonThree.c_total_score,@contest.playerPokemon.c_total_score]
|
||||
if totals.clone.uniq.length != totals.length #handling duplicates
|
||||
totals.each_with_index{ |v,i|
|
||||
next if i==3
|
||||
p1 = nil
|
||||
p2 = nil
|
||||
if totals[i+1] && v == totals[i+1]
|
||||
case i
|
||||
when 0 then p1 = @contest.pokemonOne
|
||||
when 1 then p1 = @contest.pokemonTwo
|
||||
when 2 then p1 = @contest.pokemonThree
|
||||
end
|
||||
case i+1
|
||||
when 1 then p2 = @contest.pokemonTwo
|
||||
when 2 then p2 = @contest.pokemonThree
|
||||
when 3 then p2 = @contest.playerPokemon
|
||||
end
|
||||
elsif totals[i+2] && v == totals[i+2]
|
||||
case i
|
||||
when 0 then p1 = @contest.pokemonOne
|
||||
when 1 then p1 = @contest.pokemonTwo
|
||||
end
|
||||
case i+2
|
||||
when 2 then p2 = @contest.pokemonThree
|
||||
when 3 then p2 = @contest.playerPokemon
|
||||
end
|
||||
elsif totals[i+3] && v == totals[i+3]
|
||||
p1 = @contest.pokemonOne
|
||||
p2 = @contest.playerPokemon
|
||||
end
|
||||
next if !p1 || !p2
|
||||
if (p1.c_total_hearts > p2.c_total_hearts) && (p2.c_total_hearts > 0) then p2.contestVariables["Total Hearts"] -= 1;
|
||||
elsif (p1.c_total_hearts < p2.c_total_hearts) && (p1.c_total_hearts > 0) then p1.contestVariables["Total Hearts"] -= 1;
|
||||
elsif (p1.c_intro_score > p2.c_intro_score) && (p2.c_intro_score > 0) then p2.contestVariables["Intro Score"] -= 1;
|
||||
elsif (p1.c_intro_score < p2.c_intro_score) && (p1.c_intro_score > 0) then p1.contestVariables["Intro Score"] -= 1;
|
||||
elsif rand(2) == 0
|
||||
if p1.c_intro_score > 0 then p1.contestVariables["Intro Score"] -= 1;
|
||||
else p1.contestVariables["Intro Score"] += 1; end
|
||||
else
|
||||
if p2.c_intro_score > 0 then p2.contestVariables["Intro Score"] -= 1;
|
||||
else p2.contestVariables["Intro Score"] += 1; end
|
||||
end
|
||||
}
|
||||
@contest.pokemonOne.contestVariables["Total Score"] = @contest.pokemonOne.c_intro_score + @contest.pokemonOne.c_total_hearts
|
||||
@contest.pokemonTwo.contestVariables["Total Score"] = @contest.pokemonTwo.c_intro_score + @contest.pokemonTwo.c_total_hearts
|
||||
@contest.pokemonThree.contestVariables["Total Score"] = @contest.pokemonThree.c_intro_score + @contest.pokemonThree.c_total_hearts
|
||||
@contest.playerPokemon.contestVariables["Total Score"] = @contest.playerPokemon.c_intro_score + @contest.playerPokemon.c_total_hearts
|
||||
totals = [@contest.pokemonOne.c_total_score,@contest.pokemonTwo.c_total_score,@contest.pokemonThree.c_total_score,@contest.playerPokemon.c_total_score]
|
||||
end
|
||||
places = totals.sort.reverse
|
||||
#Winner
|
||||
case totals.find_index(places[0])
|
||||
when 0
|
||||
@contest.winningPosition = 1
|
||||
@contest.winningPokemon = @contest.pokemonOne
|
||||
@contest.winningTrainer = @contest.trainerOne
|
||||
@contest.playerWin = false
|
||||
when 1
|
||||
@contest.winningPosition = 2
|
||||
@contest.winningPokemon = @contest.pokemonTwo
|
||||
@contest.winningTrainer = @contest.trainerTwo
|
||||
@contest.playerWin = false
|
||||
when 2
|
||||
@contest.winningPosition = 3
|
||||
@contest.winningPokemon = @contest.pokemonThree
|
||||
@contest.winningTrainer = @contest.trainerThree
|
||||
@contest.playerWin = false
|
||||
when 3
|
||||
@contest.winningPosition = 4
|
||||
@contest.winningPokemon = @contest.playerPokemon
|
||||
@contest.winningTrainer = $Trainer
|
||||
@contest.playerWin = true
|
||||
end
|
||||
#Place Icons
|
||||
place_x = 448
|
||||
place_y = 14
|
||||
@sprites["first"] = IconSprite.new(0, 0, @viewport)
|
||||
@sprites["first"].setBitmap(sprintf("Graphics/Pictures/Contest/result_first"))
|
||||
@sprites["first"].x = place_x
|
||||
@sprites["first"].y = place_y + 64*(totals.find_index(places[0]))
|
||||
@sprites["first"].visible = false
|
||||
@sprites["second"] = IconSprite.new(0, 0, @viewport)
|
||||
@sprites["second"].setBitmap(sprintf("Graphics/Pictures/Contest/result_second"))
|
||||
@sprites["second"].x = place_x
|
||||
@sprites["second"].y = place_y + 64*(totals.find_index(places[1]))
|
||||
@sprites["second"].visible = false
|
||||
@sprites["third"] = IconSprite.new(0, 0, @viewport)
|
||||
@sprites["third"].setBitmap(sprintf("Graphics/Pictures/Contest/result_third"))
|
||||
@sprites["third"].x = place_x
|
||||
@sprites["third"].y = place_y + 64*(totals.find_index(places[2]))
|
||||
@sprites["third"].visible = false
|
||||
@sprites["fourth"] = IconSprite.new(0, 0, @viewport)
|
||||
@sprites["fourth"].setBitmap(sprintf("Graphics/Pictures/Contest/result_fourth"))
|
||||
@sprites["fourth"].x = place_x
|
||||
@sprites["fourth"].y = place_y + 64*(totals.find_index(places[3]))
|
||||
@sprites["fourth"].visible = false
|
||||
@updatePlaces = true
|
||||
pbUpdate
|
||||
end
|
||||
|
||||
def pbUpdatePlaces
|
||||
return if !@updatePlaces
|
||||
count = 0
|
||||
while @updatePlaces
|
||||
@sprites["fourth"].visible = true
|
||||
@sprites["third"].visible = true if count >=40
|
||||
@sprites["second"].visible = true if count >=80
|
||||
@sprites["first"].visible = true if count >=120
|
||||
@updatePlaces = false if count >= 160
|
||||
Graphics.update
|
||||
pbUpdateSpriteHash(@sprites)
|
||||
count += 1
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class PokemonContestResults_Screen
|
||||
def initialize(scene,contest)
|
||||
@scene = scene
|
||||
@contest = contest
|
||||
end
|
||||
|
||||
def pbStartScreen
|
||||
@scene.pbStartScene
|
||||
@scene.pbScene
|
||||
@scene.pbEndScene
|
||||
return true
|
||||
end
|
||||
end
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,477 @@
|
||||
#====================================================================================
|
||||
# DO NOT MAKE EDITS HERE
|
||||
#====================================================================================
|
||||
|
||||
#====================================================================================
|
||||
# Animations
|
||||
#====================================================================================
|
||||
class PokemonContestTalent_Scene
|
||||
def pbDisplayPokemon(position)
|
||||
# Always dispose and recreate, since round order may have changed
|
||||
if @sprites["trainersprite#{position}"]
|
||||
@sprites["trainersprite#{position}"].dispose
|
||||
@sprites.delete("trainersprite#{position}")
|
||||
end
|
||||
|
||||
pokemon = @contest.roundOrder[position - 1]
|
||||
if pokemon == @contest.pokemonOne
|
||||
original_index = 0
|
||||
elsif pokemon == @contest.pokemonTwo
|
||||
original_index = 1
|
||||
elsif pokemon == @contest.pokemonThree
|
||||
original_index = 2
|
||||
else
|
||||
original_index = nil
|
||||
end
|
||||
|
||||
if original_index
|
||||
appearance = @contest.contestTrainerAppearances[original_index]
|
||||
bitmap = generate_front_trainer_sprite_bitmap_from_appearance(appearance)
|
||||
else
|
||||
bitmap = generate_front_trainer_sprite_bitmap
|
||||
end
|
||||
|
||||
@sprites["trainersprite#{position}"] = IconSprite.new(0, 0, @viewport)
|
||||
@sprites["trainersprite#{position}"].setBitmapDirectly(bitmap)
|
||||
@sprites["trainersprite#{position}"].x = -140
|
||||
@sprites["trainersprite#{position}"].y = 24
|
||||
@sprites["trainersprite#{position}"].mirror = true
|
||||
@sprites["trainersprite#{position}"].z = 50
|
||||
|
||||
@sprites["pokemonsprite#{position}"] = PokemonSprite.new(@viewport)
|
||||
@sprites["pokemonsprite#{position}"].setPokemonBitmap(@contest.roundOrder[position-1], true)
|
||||
@sprites["pokemonsprite#{position}"].setOffset
|
||||
@sprites["pokemonsprite#{position}"].mirror = true
|
||||
@sprites["pokemonsprite#{position}"].z = 50
|
||||
xPos = ContestSettings::FOCUSUSER_X
|
||||
yPos = ContestSettings::FOCUSUSER_Y
|
||||
@sprites["pokemonsprite#{position}"].x = xPos
|
||||
@sprites["pokemonsprite#{position}"].y = yPos
|
||||
10.times {
|
||||
@sprites["pokemonsprite#{position}"].x -= 20
|
||||
@sprites["trainersprite#{position}"].x += 10
|
||||
Graphics.update
|
||||
Input.update
|
||||
pbUpdateSpriteHash(@sprites)
|
||||
}
|
||||
end
|
||||
|
||||
def pbDismissPokemon(position)
|
||||
10.times {
|
||||
@sprites["pokemonsprite#{position}"].x += 20
|
||||
@sprites["trainersprite#{position}"].x -= 10
|
||||
Graphics.update
|
||||
Input.update
|
||||
pbUpdateSpriteHash(@sprites)
|
||||
}
|
||||
@sprites["pokemonsprite#{position}"].dispose
|
||||
@sprites.delete("pokemonsprite#{position}")
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Plays a move/common animation
|
||||
#=============================================================================
|
||||
def pbPlayAnimation(moveID, atself = false, hitNum=0)
|
||||
# animID = find_animation(moveID, 0, hitNum)
|
||||
animID = pbFindMoveAnimation(moveID, 0, hitNum)
|
||||
return if !animID
|
||||
anim = animID[0]
|
||||
animations = pbLoadBattleAnimations
|
||||
return if !animations
|
||||
pbAnimationCore(animations[anim], atself)
|
||||
end
|
||||
|
||||
def pbAnimationCore(animation, atself)
|
||||
return if !animation
|
||||
@briefMessage = false
|
||||
userSprite = @sprites["pokemonsprite#{@currentPosition}"]
|
||||
targetSprite = atself ? userSprite : @sprites["opponent"]
|
||||
# Remember the original positions of Pokémon sprites
|
||||
oldUserX = userSprite.x
|
||||
oldUserY = userSprite.y
|
||||
oldTargetX = atself ? oldUserX : targetSprite.x
|
||||
oldTargetY = atself ? oldUserY : targetSprite.y
|
||||
oldUserOx = userSprite.ox
|
||||
oldUserOy = userSprite.oy
|
||||
oldTargetOx = atself ? oldUserOx : targetSprite.ox
|
||||
oldTargetOy = atself ? oldUserOy : targetSprite.oy
|
||||
# Create the animation player
|
||||
animPlayer = AnimationPlayerXContest.new(animation, userSprite, targetSprite, @viewport, self)
|
||||
#animPlayer = PBAnimationPlayerX.new(animation, user, target, self, oppMove)
|
||||
# Apply a transformation to the animation based on where the user and target
|
||||
# actually are. Get the centres of each sprite.
|
||||
userHeight = (userSprite&.bitmap && !userSprite.bitmap.disposed?) ? userSprite.bitmap.height : 128
|
||||
if targetSprite
|
||||
targetHeight = (targetSprite.bitmap && !targetSprite.bitmap.disposed?) ? targetSprite.bitmap.height : 128
|
||||
else
|
||||
targetHeight = userHeight
|
||||
end
|
||||
animPlayer.setLineTransform(
|
||||
#Battle::Scene::FOCUSUSER_X, Battle::Scene::FOCUSUSER_Y, Battle::Scene::FOCUSTARGET_X, Battle::Scene::FOCUSTARGET_Y,
|
||||
ContestSettings::FOCUSUSER_X, ContestSettings::FOCUSUSER_Y, ContestSettings::FOCUSTARGET_X, ContestSettings::FOCUSTARGET_Y,
|
||||
oldUserX, oldUserY - (userHeight / 2) + 80, oldTargetX, oldTargetY - (targetHeight / 2) + 80
|
||||
)
|
||||
# Play the animation
|
||||
animPlayer.start
|
||||
loop do
|
||||
animPlayer.update
|
||||
Graphics.update
|
||||
Input.update
|
||||
pbUpdateSpriteHash(@sprites)
|
||||
break if animPlayer.animDone?
|
||||
end
|
||||
animPlayer.dispose
|
||||
# Return Pokémon sprites to their original positions
|
||||
if userSprite
|
||||
userSprite.x = oldUserX
|
||||
userSprite.y = oldUserY
|
||||
userSprite.ox = oldUserOx
|
||||
userSprite.oy = oldUserOy
|
||||
end
|
||||
if targetSprite
|
||||
targetSprite.x = oldTargetX
|
||||
targetSprite.y = oldTargetY
|
||||
targetSprite.ox = oldTargetOx
|
||||
targetSprite.oy = oldTargetOy
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#copied directly from Scene_PlayAnimaitons
|
||||
# Returns the animation ID to use for a given move/user. Returns nil if that
|
||||
# move has no animations defined for it.
|
||||
def pbFindMoveAnimDetails(move2anim, moveID, idxUser, hitNum = 0)
|
||||
id_number = GameData::Move.get(moveID).id_number
|
||||
noFlip = false
|
||||
if (idxUser & 1) == 0
|
||||
anim = move2anim[0][id_number]
|
||||
else
|
||||
anim = move2anim[1][id_number]
|
||||
noFlip = true if anim
|
||||
anim = move2anim[0][id_number] if !anim
|
||||
end
|
||||
return [anim + hitNum, noFlip] if anim
|
||||
return nil
|
||||
end
|
||||
|
||||
# Returns the animation ID to use for a given move. If the move has no
|
||||
# animations, tries to use a default move animation depending on the move's
|
||||
# type. If that default move animation doesn't exist, trues to use Tackle's
|
||||
# move animation. Returns nil if it can't find any of these animations to use.
|
||||
def pbFindMoveAnimation(moveID, idxUser, hitNum)
|
||||
begin
|
||||
move2anim = pbLoadMoveToAnim
|
||||
# Find actual animation requested (an opponent using the animation first
|
||||
# looks for an OppMove version then a Move version)
|
||||
anim = pbFindMoveAnimDetails(move2anim, moveID, idxUser, hitNum)
|
||||
return anim if anim
|
||||
# Actual animation not found, get the default animation for the move's type
|
||||
moveData = GameData::Move.get(moveID)
|
||||
target_data = GameData::Target.get(moveData.target)
|
||||
moveType = moveData.type
|
||||
moveKind = moveData.category
|
||||
moveKind += 3 if target_data.num_targets > 1 || target_data.affects_foe_side
|
||||
moveKind += 3 if moveKind == 2 && target_data.num_targets > 0
|
||||
# [one target physical, one target special, user status,
|
||||
# multiple targets physical, multiple targets special, non-user status]
|
||||
typeDefaultAnim = {
|
||||
:NORMAL => [:TACKLE, :SONICBOOM, :DEFENSECURL, :EXPLOSION, :SWIFT, :TAILWHIP],
|
||||
:FIGHTING => [:MACHPUNCH, :AURASPHERE, :DETECT, nil, nil, nil],
|
||||
:FLYING => [:WINGATTACK, :GUST, :ROOST, nil, :AIRCUTTER, :FEATHERDANCE],
|
||||
:POISON => [:POISONSTING, :SLUDGE, :ACIDARMOR, nil, :ACID, :POISONPOWDER],
|
||||
:GROUND => [:SANDTOMB, :MUDSLAP, nil, :EARTHQUAKE, :EARTHPOWER, :MUDSPORT],
|
||||
:ROCK => [:ROCKTHROW, :POWERGEM, :ROCKPOLISH, :ROCKSLIDE, nil, :SANDSTORM],
|
||||
:BUG => [:TWINEEDLE, :BUGBUZZ, :QUIVERDANCE, nil, :STRUGGLEBUG, :STRINGSHOT],
|
||||
:GHOST => [:LICK, :SHADOWBALL, :GRUDGE, nil, nil, :CONFUSERAY],
|
||||
:STEEL => [:IRONHEAD, :MIRRORSHOT, :IRONDEFENSE, nil, nil, :METALSOUND],
|
||||
:FIRE => [:FIREPUNCH, :EMBER, :SUNNYDAY, nil, :INCINERATE, :WILLOWISP],
|
||||
:WATER => [:CRABHAMMER, :WATERGUN, :AQUARING, nil, :SURF, :WATERSPORT],
|
||||
:GRASS => [:VINEWHIP, :MEGADRAIN, :COTTONGUARD, :RAZORLEAF, nil, :SPORE],
|
||||
:ELECTRIC => [:THUNDERPUNCH, :THUNDERSHOCK, :CHARGE, nil, :DISCHARGE, :THUNDERWAVE],
|
||||
:PSYCHIC => [:ZENHEADBUTT, :CONFUSION, :CALMMIND, nil, :SYNCHRONOISE, :MIRACLEEYE],
|
||||
:ICE => [:ICEPUNCH, :ICEBEAM, :MIST, nil, :POWDERSNOW, :HAIL],
|
||||
:DRAGON => [:DRAGONCLAW, :DRAGONRAGE, :DRAGONDANCE, nil, :TWISTER, nil],
|
||||
:DARK => [:PURSUIT, :DARKPULSE, :HONECLAWS, nil, :SNARL, :EMBARGO],
|
||||
:FAIRY => [:TACKLE, :FAIRYWIND, :MOONLIGHT, nil, :SWIFT, :SWEETKISS]
|
||||
}
|
||||
if typeDefaultAnim[moveType]
|
||||
anims = typeDefaultAnim[moveType]
|
||||
if GameData::Move.exists?(anims[moveKind])
|
||||
anim = pbFindMoveAnimDetails(move2anim, anims[moveKind], idxUser)
|
||||
end
|
||||
if !anim && moveKind >= 3 && GameData::Move.exists?(anims[moveKind - 3])
|
||||
anim = pbFindMoveAnimDetails(move2anim, anims[moveKind - 3], idxUser)
|
||||
end
|
||||
if !anim && GameData::Move.exists?(anims[2])
|
||||
anim = pbFindMoveAnimDetails(move2anim, anims[2], idxUser)
|
||||
end
|
||||
end
|
||||
return anim if anim
|
||||
# Default animation for the move's type not found, use Tackle's animation
|
||||
if GameData::Move.exists?(:TACKLE)
|
||||
return pbFindMoveAnimDetails(move2anim, :TACKLE, idxUser)
|
||||
end
|
||||
rescue
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
class AnimationPlayerXContest
|
||||
attr_accessor :looping
|
||||
|
||||
MAX_SPRITES = 60
|
||||
def initialize(animation,usersprite,targetsprite,vp,scene=nil,oppMove=false,inEditor=false)
|
||||
#targetsprite = usersprite if usersprite && !targetsprite #TDW Added
|
||||
@animation = animation
|
||||
@user = nil
|
||||
@usersprite = usersprite
|
||||
@targetsprite = targetsprite
|
||||
@userbitmap = (@usersprite && @usersprite.bitmap) ? @usersprite.bitmap : nil # not to be disposed
|
||||
@targetbitmap = (@targetsprite && @targetsprite.bitmap) ? @targetsprite.bitmap : nil # not to be disposed
|
||||
@scene = scene
|
||||
@viewport = vp
|
||||
@inEditor = inEditor
|
||||
@looping = false
|
||||
@animbitmap = nil # Animation sheet graphic
|
||||
@frame = -1
|
||||
@framesPerTick = [Graphics.frame_rate/20,1].max # 20 ticks per second
|
||||
@srcLine = nil
|
||||
@dstLine = nil
|
||||
@userOrig = getSpriteCenter(@usersprite)
|
||||
@targetOrig = getSpriteCenter(@targetsprite)
|
||||
@oldbg = []
|
||||
@oldfo = []
|
||||
initializeSprites
|
||||
end
|
||||
|
||||
def initializeSprites
|
||||
# Create animation sprites (0=user's sprite, 1=target's sprite)
|
||||
@animsprites = []
|
||||
@animsprites[0] = @usersprite
|
||||
@animsprites[1] = @targetsprite
|
||||
(2...MAX_SPRITES).each do |i|
|
||||
@animsprites[i] = Sprite.new(@viewport)
|
||||
@animsprites[i].bitmap = nil
|
||||
@animsprites[i].visible = false
|
||||
end
|
||||
# Create background colour sprite
|
||||
@bgColor = ColoredPlane.new(Color.new(0, 0, 0), @viewport)
|
||||
@bgColor.z = 5
|
||||
@bgColor.opacity = 0
|
||||
@bgColor.refresh
|
||||
# Create background graphic sprite
|
||||
@bgGraphic = AnimatedPlane.new(@viewport)
|
||||
@bgGraphic.setBitmap(nil)
|
||||
@bgGraphic.z = 5
|
||||
@bgGraphic.opacity = 0
|
||||
@bgGraphic.refresh
|
||||
# Create foreground colour sprite
|
||||
@foColor = ColoredPlane.new(Color.new(0, 0, 0), @viewport)
|
||||
@foColor.z = 85
|
||||
@foColor.opacity = 0
|
||||
@foColor.refresh
|
||||
# Create foreground graphic sprite
|
||||
@foGraphic = AnimatedPlane.new(@viewport)
|
||||
@foGraphic.setBitmap(nil)
|
||||
@foGraphic.z = 85
|
||||
@foGraphic.opacity = 0
|
||||
@foGraphic.refresh
|
||||
end
|
||||
|
||||
def dispose
|
||||
@animbitmap&.dispose
|
||||
(2...MAX_SPRITES).each do |i|
|
||||
@animsprites[i]&.dispose
|
||||
end
|
||||
@bgGraphic.dispose
|
||||
@bgColor.dispose
|
||||
@foGraphic.dispose
|
||||
@foColor.dispose
|
||||
end
|
||||
|
||||
def start
|
||||
@frame = 0
|
||||
end
|
||||
|
||||
def animDone?
|
||||
return @frame<0
|
||||
end
|
||||
|
||||
def setLineTransform(x1,y1,x2,y2,x3,y3,x4,y4)
|
||||
@srcLine = [x1,y1,x2,y2]
|
||||
@dstLine = [x3,y3,x4,y4]
|
||||
end
|
||||
|
||||
def update
|
||||
return if @frame < 0
|
||||
animFrame = @frame / @framesPerTick
|
||||
|
||||
# Loop or end the animation if the animation has reached the end
|
||||
if animFrame >= @animation.length
|
||||
@frame = (@looping) ? 0 : -1
|
||||
if @frame < 0
|
||||
@animbitmap&.dispose
|
||||
@animbitmap = nil
|
||||
return
|
||||
end
|
||||
end
|
||||
# Load the animation's spritesheet and assign it to all the sprites.
|
||||
if !@animbitmap || @animbitmap.disposed?
|
||||
@animbitmap = AnimatedBitmap.new("Graphics/Animations/" + @animation.graphic,
|
||||
@animation.hue).deanimate
|
||||
MAX_SPRITES.times do |i|
|
||||
@animsprites[i].bitmap = @animbitmap if @animsprites[i]
|
||||
end
|
||||
end
|
||||
# Update background and foreground graphics
|
||||
@bgGraphic.update
|
||||
@bgColor.update
|
||||
@foGraphic.update
|
||||
@foColor.update
|
||||
|
||||
# Update all the sprites to depict the animation's next frame
|
||||
if @framesPerTick == 1 || (@frame % @framesPerTick) == 0
|
||||
thisframe = @animation[animFrame]
|
||||
# Make all cel sprites invisible
|
||||
MAX_SPRITES.times do |i|
|
||||
@animsprites[i].visible = false if @animsprites[i]
|
||||
end
|
||||
# Set each cel sprite acoordingly
|
||||
thisframe.length.times do |i|
|
||||
cel = thisframe[i]
|
||||
next if !cel
|
||||
sprite = @animsprites[i]
|
||||
next if !sprite
|
||||
# Set cel sprite's graphic
|
||||
case cel[AnimFrame::PATTERN]
|
||||
when -1
|
||||
sprite.bitmap = @userbitmap
|
||||
when -2
|
||||
sprite.bitmap = @targetbitmap
|
||||
else
|
||||
sprite.bitmap = @animbitmap
|
||||
end
|
||||
cel[AnimFrame::MIRROR] = 1
|
||||
# Apply settings to the cel sprite
|
||||
pbSpriteSetAnimFrame(sprite, cel, @usersprite, @targetsprite)
|
||||
case cel[AnimFrame::FOCUS]
|
||||
# when 1 # Focused on target
|
||||
# sprite.x = cel[AnimFrame::X] - 304
|
||||
# sprite.y = cel[AnimFrame::Y] - 16
|
||||
# when 2 # Focused on user
|
||||
# sprite.x = cel[AnimFrame::X] + 139
|
||||
# sprite.y = cel[AnimFrame::Y] - 48
|
||||
when 1 # Focused on target
|
||||
sprite.x = cel[AnimFrame::X] + @targetOrig[0] - ContestSettings::FOCUSTARGET_X #+ ContestSettings::FOCUSTARGET_X
|
||||
sprite.y = cel[AnimFrame::Y] + @targetOrig[1] - ContestSettings::FOCUSTARGET_Y #+ ContestSettings::FOCUSTARGET_Y
|
||||
when 2 # Focused on user
|
||||
sprite.x = cel[AnimFrame::X] + @userOrig[0] - ContestSettings::FOCUSUSER_X #+ ContestSettings::FOCUSUSER_X
|
||||
sprite.y = cel[AnimFrame::Y] + @userOrig[1] - ContestSettings::FOCUSUSER_Y #+ ContestSettings::FOCUSUSER_Y
|
||||
when 3 # Focused on user and target
|
||||
next if !@srcLine || !@dstLine
|
||||
point = transformPoint(@srcLine[0], @srcLine[1], @srcLine[2], @srcLine[3],
|
||||
@dstLine[0], @dstLine[1], @dstLine[2], @dstLine[3],
|
||||
sprite.x, sprite.y)
|
||||
sprite.x = point[0]
|
||||
sprite.y = point[1]
|
||||
if isReversed(@srcLine[0], @srcLine[2], @dstLine[0], @dstLine[2]) &&
|
||||
cel[AnimFrame::PATTERN] >= 0
|
||||
# Reverse direction
|
||||
sprite.mirror = !sprite.mirror
|
||||
end
|
||||
end
|
||||
sprite.x += 64 if @inEditor
|
||||
sprite.y += 64 if @inEditor
|
||||
|
||||
# For things that move the sprite, make it so it gets mirrored (like for Take Down or Protect)
|
||||
if cel[AnimFrame::FOCUS] == 1 || cel[AnimFrame::FOCUS] == 2
|
||||
origDistance = sprite.x - (cel[AnimFrame::FOCUS] == 1 ? @targetOrig[0] : @userOrig[0])
|
||||
sprite.x -= origDistance*2
|
||||
end
|
||||
|
||||
end
|
||||
# Play timings
|
||||
@animation.playTiming(animFrame, @bgGraphic, @bgColor, @foGraphic, @foColor, @oldbg, @oldfo, @user)
|
||||
end
|
||||
@frame += 1
|
||||
end
|
||||
end
|
||||
|
||||
# def pbSpriteSetAnimFrameContest(sprite, frame, user = nil, target = nil, inEditor = false)
|
||||
# return if !sprite
|
||||
# if !frame
|
||||
# sprite.visible = false
|
||||
# sprite.src_rect = Rect.new(0, 0, 1, 1)
|
||||
# return
|
||||
# end
|
||||
# sprite.blend_type = frame[AnimFrame::BLENDTYPE]
|
||||
# sprite.angle = frame[AnimFrame::ANGLE]
|
||||
# sprite.mirror = (frame[AnimFrame::MIRROR] > 0)
|
||||
# sprite.opacity = frame[AnimFrame::OPACITY]
|
||||
# sprite.visible = true
|
||||
# if !frame[AnimFrame::VISIBLE] == 1 && inEditor
|
||||
# sprite.opacity /= 2
|
||||
# else
|
||||
# sprite.visible = (frame[AnimFrame::VISIBLE] == 1)
|
||||
# end
|
||||
# pattern = frame[AnimFrame::PATTERN]
|
||||
# if pattern >= 0
|
||||
# animwidth = 192
|
||||
# sprite.src_rect.set((pattern % 5) * animwidth, (pattern / 5) * animwidth,
|
||||
# animwidth, animwidth)
|
||||
# else
|
||||
# sprite.src_rect.set(0, 0,
|
||||
# (sprite.bitmap) ? sprite.bitmap.width : 128,
|
||||
# (sprite.bitmap) ? sprite.bitmap.height : 128)
|
||||
# end
|
||||
# sprite.zoom_x = frame[AnimFrame::ZOOMX] / 100.0
|
||||
# sprite.zoom_y = frame[AnimFrame::ZOOMY] / 100.0
|
||||
# sprite.color.set(
|
||||
# frame[AnimFrame::COLORRED],
|
||||
# frame[AnimFrame::COLORGREEN],
|
||||
# frame[AnimFrame::COLORBLUE],
|
||||
# frame[AnimFrame::COLORALPHA]
|
||||
# )
|
||||
# sprite.tone.set(
|
||||
# frame[AnimFrame::TONERED],
|
||||
# frame[AnimFrame::TONEGREEN],
|
||||
# frame[AnimFrame::TONEBLUE],
|
||||
# frame[AnimFrame::TONEGRAY]
|
||||
# )
|
||||
# sprite.ox = sprite.src_rect.width / 2
|
||||
# sprite.oy = sprite.src_rect.height / 2
|
||||
# sprite.x = frame[AnimFrame::X]
|
||||
# sprite.y = frame[AnimFrame::Y]
|
||||
# if sprite != user && sprite != target
|
||||
# case frame[AnimFrame::PRIORITY]
|
||||
# when 0 # Behind everything
|
||||
# sprite.z = 10
|
||||
# when 1 # In front of everything
|
||||
# sprite.z = 80
|
||||
# when 2 # Just behind focus
|
||||
# case frame[AnimFrame::FOCUS]
|
||||
# when 1 # Focused on target
|
||||
# sprite.z = (target) ? target.z - 1 : 20
|
||||
# when 2 # Focused on user
|
||||
# sprite.z = (user) ? user.z - 1 : 20
|
||||
# else # Focused on user and target, or screen
|
||||
# sprite.z = 20
|
||||
# end
|
||||
# when 3 # Just in front of focus
|
||||
# case frame[AnimFrame::FOCUS]
|
||||
# when 1 # Focused on target
|
||||
# sprite.z = (target) ? target.z + 1 : 80
|
||||
# when 2 # Focused on user
|
||||
# sprite.z = (user) ? user.z + 1 : 80
|
||||
# else # Focused on user and target, or screen
|
||||
# sprite.z = 80
|
||||
# end
|
||||
# else
|
||||
# sprite.z = 80
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
@@ -0,0 +1,227 @@
|
||||
#====================================================================================
|
||||
# DO NOT MAKE EDITS HERE
|
||||
#====================================================================================
|
||||
|
||||
#====================================================================================
|
||||
# AI
|
||||
#====================================================================================
|
||||
class PokemonContestTalent_Scene
|
||||
def pbSetAIMoves
|
||||
@contest.roundOrder.each_with_index { |ai,index|
|
||||
next if ai == @contest.playerPokemon
|
||||
next if ai.c_nomoremoves || ai.c_missturn
|
||||
moves = ai.moves
|
||||
if moves.length == 1
|
||||
ai.c_currentmove = moves[0]
|
||||
next
|
||||
end
|
||||
position = index + 1
|
||||
difficulty = @contest.getDifficulty(ai)
|
||||
moveScores = []
|
||||
moves.each { |m|
|
||||
m = GameData::Move.get(m.id)
|
||||
score = 100
|
||||
func = m.getContestFunction
|
||||
scope = func.scope
|
||||
hearts = m.contest_hearts
|
||||
round = pbCurrentPokemonContest.round
|
||||
#Basic
|
||||
if func.id == :Basic then score += (hearts > 3 ? 60 : 30); end
|
||||
#Matches Contest type
|
||||
if m.is_positive_category?(@contest.category)
|
||||
score += 60
|
||||
elsif m.is_negative_category?(@contest.category)
|
||||
score -= 30
|
||||
end
|
||||
#Combo Potential
|
||||
if ai.c_hasattention && ai.checkContestCombos(m) then score += 60; end
|
||||
#Can Be Repeated
|
||||
if func.repeat_use then score += 20;
|
||||
elsif ai.c_lastmove&.id == m.id then score -= 60; end
|
||||
#Random
|
||||
if func.random_appeal then score += 20; end
|
||||
#Better when done early (Gains Oblivious or Calm, Makes Nervous)
|
||||
if func.unnerve || func.avoid_startled_once || func.avoid_startled ||
|
||||
(func.depends_on_order && scope == "Earlier")
|
||||
case position
|
||||
when 1 then score += 60
|
||||
when 2 then score += 40
|
||||
when 4 then score -= 20
|
||||
end
|
||||
end
|
||||
if func.depends_on_other_appeal
|
||||
case position
|
||||
when 1 then score += 20
|
||||
when 2 then score += 10
|
||||
when 4 then score -= 10
|
||||
end
|
||||
end
|
||||
#Best Done First
|
||||
if (func.depends_on_order && scope == "First") && position == 1 then score += 60; end
|
||||
#Best Done Last
|
||||
if (func.depends_on_order && scope == "Last") && position == 4 then score += 60; end
|
||||
#Do Next Move Earlier
|
||||
if func.do_next_earlier then score += (position == 4 ? 30 : 10); end
|
||||
#Do Next Move Later
|
||||
if func.do_next_later then score += (position == 4 ? -20 : 20); end
|
||||
#No More Moves
|
||||
if func.no_more_moves then score += (round == ContestSettings::NUMBER_OF_TALENT_ROUNDS ? 90 : -60); end
|
||||
#Double Next
|
||||
if func.double_next_appeal then score += (round != ContestSettings::NUMBER_OF_TALENT_ROUNDS ? 40 : -60); end
|
||||
#Increase Spirit
|
||||
if func.increase_spirit then score += 30; end
|
||||
#Better when done later (Startles, easily startled)
|
||||
if func.startles || func.easily_startled || (func.depends_on_order && scope == "Later")
|
||||
if func.skip_next_move
|
||||
case position
|
||||
when 4 then score += 30
|
||||
when 3 then score += 20
|
||||
end
|
||||
case round
|
||||
when ContestSettings::NUMBER_OF_TALENT_ROUNDS then score += 60
|
||||
when 1 then score -= 10
|
||||
end
|
||||
else
|
||||
case position
|
||||
when 4 then score += 60
|
||||
when 3 then score += 40
|
||||
when 1 then score -= 20
|
||||
end
|
||||
end
|
||||
end
|
||||
if func.startles && scope == "Attention"
|
||||
(position-1).times { |k| score += 30 if @contest.roundOrder[k-1].c_hasattention }
|
||||
end
|
||||
if func.depends_on_other_type
|
||||
if position > 1 then score += 20; end
|
||||
end
|
||||
#Depends on round
|
||||
if func.depends_on_round
|
||||
if scope == "Later"
|
||||
case round
|
||||
when ContestSettings::NUMBER_OF_TALENT_ROUNDS then score += 60
|
||||
when 3 then score += 40
|
||||
when 2 then score += 20
|
||||
when 1 then score -= 20
|
||||
end
|
||||
elsif scope == "Earlier"
|
||||
case round
|
||||
when 1 then score += 60
|
||||
when 2 then score += 40
|
||||
when 3 then score += 20
|
||||
when ContestSettings::NUMBER_OF_TALENT_ROUNDS then score -= 20
|
||||
end
|
||||
end
|
||||
end
|
||||
#Pause Crowd
|
||||
if func.pause_crowd then score += (@contest.crowdEnergy + position >= 5 ? -20 : 20); end
|
||||
#Maxes Crowd
|
||||
if func.max_crowd then score += 40; end
|
||||
#If Raises Crowd
|
||||
if func.better_if_increases_crowd then score += ( m.is_positive_category?(@contest.category) ? 40 : -10); end
|
||||
#Depends on Crowd
|
||||
if func.depends_on_crowd
|
||||
if scope == "Higher" && @contest.crowdEnergy + position > 2 then score += 20; end
|
||||
if scope == "Lower"
|
||||
case @contest.crowdEnergy + position
|
||||
when 1 then score += 60
|
||||
when 2 then score += 40
|
||||
when 4..5 then score -= 20
|
||||
end
|
||||
end
|
||||
if scope == "Equal"
|
||||
case @contest.crowdEnergy + position
|
||||
when 4..5 then score += 60
|
||||
when 3 then score += 40
|
||||
when 1..2 then score -= 20
|
||||
end
|
||||
end
|
||||
end
|
||||
#Changes Others Spirit
|
||||
if func.decrease_other_spirit
|
||||
if scope == "Before"
|
||||
case position
|
||||
when 4 then score += 20
|
||||
when 3 then score += 10
|
||||
when 1 then score -= 20
|
||||
end
|
||||
(position-1).times { |k| score += 40 if @contest.roundOrder[k].c_spirit > 0 }
|
||||
elsif scope == "After"
|
||||
case position
|
||||
when 1 then score += 20
|
||||
when 2 then score += 10
|
||||
when 4 then score -= 20
|
||||
end
|
||||
(4-position).times { |k| score += 40 if @contest.roundOrder[k+position].c_spirit > 0 }
|
||||
end
|
||||
end
|
||||
#Depends on Spirit
|
||||
if func.depends_on_spirit
|
||||
if scope == "Equal"
|
||||
score += (ai.c_spirit > 0 ? ai.c_spirit * 20 : -30)
|
||||
end
|
||||
end
|
||||
#Scramble
|
||||
if func.scramble_order && round != ContestSettings::NUMBER_OF_TALENT_ROUNDS then score += 30; end
|
||||
moveScores.push(score)
|
||||
}
|
||||
|
||||
best = moveScores.index(moveScores.max)
|
||||
winner = best if difficulty > 90 || (pbStdDev(moveScores) >= 100 && rand(10) != 0)
|
||||
if !winner
|
||||
worst = moveScores.index(moveScores.min)
|
||||
secondWorst = moveScores.index(moveScores.clone.sort[1]) if moveScores.length > 2
|
||||
moveScores[worst] = nil if difficulty > 25
|
||||
moveScores[secondWorst] = nil if secondWorst && difficulty > 75
|
||||
while !winner
|
||||
r = rand(moveScores.length) while !r || moveScores[r].nil?
|
||||
if difficulty <= 25
|
||||
#Always Random
|
||||
winner = r
|
||||
elsif difficulty <= 50
|
||||
#Never Worst + 1 extra roll for better score
|
||||
winner = r
|
||||
newR = rand(moveScores.length) while !newR || moveScores[newR].nil?
|
||||
winner = newR if moveScores[newR] > moveScores[r]
|
||||
elsif difficulty <= 75
|
||||
#Never Worst + 2 extra rolls for better score
|
||||
winner = r
|
||||
2.times {
|
||||
newR = rand(moveScores.length) while !newR || moveScores[newR].nil?
|
||||
winner = newR if moveScores[newR] > moveScores[r]
|
||||
}
|
||||
else
|
||||
#Never Worst or Second Worst + 2 extra rolls for better score
|
||||
winner = r
|
||||
2.times {
|
||||
newR = rand(moveScores.length) while !newR || moveScores[newR].nil?
|
||||
winner = newR if moveScores[newR] > moveScores[r]
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
ai.c_currentmove = moves[winner]
|
||||
}
|
||||
end
|
||||
|
||||
def pbStdDev(choices)
|
||||
sum = 0
|
||||
n = 0
|
||||
choices.each do |c|
|
||||
sum += c
|
||||
n += 1
|
||||
end
|
||||
return 0 if n < 2
|
||||
mean = sum.to_f / n.to_f
|
||||
varianceTimesN = 0
|
||||
choices.each do |c|
|
||||
next if c <= 0
|
||||
deviation = c.to_f - mean
|
||||
varianceTimesN += deviation*deviation
|
||||
end
|
||||
# Using population standard deviation
|
||||
# [(n-1) makes it a sample std dev, would be 0 with only 1 sample]
|
||||
return Math.sqrt(varianceTimesN/n)
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,315 @@
|
||||
#====================================================================================
|
||||
# DO NOT MAKE EDITS HERE
|
||||
#====================================================================================
|
||||
|
||||
#====================================================================================
|
||||
# Messages
|
||||
#====================================================================================
|
||||
|
||||
def pbContestMessage(message, skin=nil, newx=nil, newwidth=nil, &block)
|
||||
ret = 0
|
||||
message = "\\l[3]" + message
|
||||
skin = "Graphics/Pictures/Contest/choice 29" if !skin
|
||||
newwidth = 340 if !newwidth
|
||||
msgwindow = pbCreateMessageWindow(nil,skin)
|
||||
msgwindow.x = newx if newx
|
||||
msgwindow.width = newwidth.nil? ? (Graphics.width - msgwindow.x) : newwidth
|
||||
pbMessageDisplayContest(msgwindow, message, &block)
|
||||
pbDisposeMessageWindow(msgwindow)
|
||||
Input.update
|
||||
return ret
|
||||
end
|
||||
|
||||
def pbMessageDisplayContest(msgwindow,message,letterbyletter=true,commandProc=nil)
|
||||
return if !msgwindow
|
||||
oldletterbyletter=msgwindow.letterbyletter
|
||||
msgwindow.letterbyletter=(letterbyletter) ? true : false
|
||||
ret=nil
|
||||
commands=nil
|
||||
facewindow=nil
|
||||
goldwindow=nil
|
||||
coinwindow=nil
|
||||
battlepointswindow=nil
|
||||
cmdvariable=0
|
||||
cmdIfCancel=0
|
||||
msgwindow.waitcount=0
|
||||
autoresume=false
|
||||
text=message.clone
|
||||
msgback=nil
|
||||
linecount=(Graphics.height>400) ? 3 : 2
|
||||
### Text replacement
|
||||
text.gsub!(/\\sign\[([^\]]*)\]/i) { # \sign[something] gets turned into
|
||||
next "\\op\\cl\\ts[]\\w["+$1+"]" # \op\cl\ts[]\w[something]
|
||||
}
|
||||
text.gsub!(/\\\\/,"\5")
|
||||
text.gsub!(/\\1/,"\1")
|
||||
if $game_actors
|
||||
text.gsub!(/\\n\[([1-8])\]/i) {
|
||||
m = $1.to_i
|
||||
next $game_actors[m].name
|
||||
}
|
||||
end
|
||||
text.gsub!(/\\pn/i,$Trainer.name) if $Trainer
|
||||
text.gsub!(/\\pm/i,_INTL("${1}",$Trainer.money.to_s_formatted)) if $Trainer
|
||||
text.gsub!(/\\n/i,"\n")
|
||||
text.gsub!(/\\\[([0-9a-f]{8,8})\]/i) { "<c2="+$1+">" }
|
||||
text.gsub!(/\\pg/i,"\\b") if $Trainer && $Trainer.male?
|
||||
text.gsub!(/\\pg/i,"\\r") if $Trainer && $Trainer.female?
|
||||
text.gsub!(/\\pog/i,"\\r") if $Trainer && $Trainer.male?
|
||||
text.gsub!(/\\pog/i,"\\b") if $Trainer && $Trainer.female?
|
||||
text.gsub!(/\\pg/i,"")
|
||||
text.gsub!(/\\pog/i,"")
|
||||
text.gsub!(/\\b/i,"<c3=3050C8,D0D0C8>")
|
||||
text.gsub!(/\\r/i,"<c3=E00808,D0D0C8>")
|
||||
text.gsub!(/\\[Ww]\[([^\]]*)\]/) {
|
||||
w = $1.to_s
|
||||
if w==""
|
||||
msgwindow.windowskin = nil
|
||||
else
|
||||
msgwindow.setSkin("Graphics/Windowskins/#{w}",false)
|
||||
end
|
||||
next ""
|
||||
}
|
||||
isDarkSkin = isDarkWindowskin(msgwindow.windowskin)
|
||||
text.gsub!(/\\[Cc]\[([0-9]+)\]/) {
|
||||
m = $1.to_i
|
||||
next getSkinColor(msgwindow.windowskin,m,isDarkSkin)
|
||||
}
|
||||
loop do
|
||||
last_text = text.clone
|
||||
text.gsub!(/\\v\[([0-9]+)\]/i) { $game_variables[$1.to_i] }
|
||||
break if text == last_text
|
||||
end
|
||||
loop do
|
||||
last_text = text.clone
|
||||
text.gsub!(/\\l\[([0-9]+)\]/i) {
|
||||
linecount = [1,$1.to_i].max
|
||||
next ""
|
||||
}
|
||||
break if text == last_text
|
||||
end
|
||||
colortag = ""
|
||||
#if $game_system && $game_system.respond_to?("message_frame") &&
|
||||
# $game_system.message_frame != 0
|
||||
if $game_system && $game_system.message_frame != 0
|
||||
colortag = getSkinColor(msgwindow.windowskin,0,true)
|
||||
else
|
||||
colortag = getSkinColor(msgwindow.windowskin,0,isDarkSkin)
|
||||
end
|
||||
text = colortag+text
|
||||
### Controls
|
||||
textchunks=[]
|
||||
controls=[]
|
||||
while text[/(?:\\(f|ff|ts|cl|me|se|wt|wtnp|ch|q)\[([^\]]*)\]|\\(g|cn|pt|wd|wm|op|cl|wu|\.|\||\!|\^))/i] # New -> q
|
||||
textchunks.push($~.pre_match)
|
||||
if $~[1]
|
||||
controls.push([$~[1].downcase,$~[2],-1])
|
||||
else
|
||||
controls.push([$~[3].downcase,"",-1])
|
||||
end
|
||||
text=$~.post_match
|
||||
end
|
||||
textchunks.push(text)
|
||||
textchunks.each do |chunk|
|
||||
chunk.gsub!(/\005/, "\\")
|
||||
end
|
||||
textlen = 0
|
||||
controls.length.times do |i|
|
||||
control = controls[i][0]
|
||||
case control
|
||||
when "wt", "wtnp", ".", "|"
|
||||
textchunks[i] += "\2"
|
||||
when "!"
|
||||
textchunks[i] += "\1"
|
||||
end
|
||||
textlen += toUnformattedText(textchunks[i]).scan(/./m).length
|
||||
controls[i][2] = textlen
|
||||
end
|
||||
text = textchunks.join
|
||||
signWaitCount = 0
|
||||
signWaitTime = Graphics.frame_rate/2
|
||||
haveSpecialClose = false
|
||||
specialCloseSE = ""
|
||||
startSE = nil
|
||||
controls.length.times do |i|
|
||||
control = controls[i][0]
|
||||
param = controls[i][1]
|
||||
case control
|
||||
when "op"
|
||||
signWaitCount = signWaitTime+1
|
||||
when "cl"
|
||||
text = text.sub(/\001\z/,"") # fix: '$' can match end of line as well
|
||||
haveSpecialClose = true
|
||||
specialCloseSE = param
|
||||
when "f"
|
||||
facewindow.dispose if facewindow
|
||||
facewindow = PictureWindow.new("Graphics/Pictures/#{param}")
|
||||
when "ff"
|
||||
facewindow.dispose if facewindow
|
||||
facewindow = FaceWindowVX.new(param)
|
||||
when "ch"
|
||||
cmds = param.clone
|
||||
cmdvariable = pbCsvPosInt!(cmds)
|
||||
cmdIfCancel = pbCsvField!(cmds).to_i
|
||||
commands = []
|
||||
while cmds.length>0
|
||||
commands.push(pbCsvField!(cmds))
|
||||
end
|
||||
when "wtnp", "^"
|
||||
text = text.sub(/\001\z/,"") # fix: '$' can match end of line as well
|
||||
when "se"
|
||||
if controls[i][2]==0
|
||||
startSE = param
|
||||
controls[i] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
if startSE
|
||||
pbSEPlay(pbStringToAudioFile(startSE))
|
||||
elsif signWaitCount==0 && letterbyletter
|
||||
pbPlayDecisionSE()
|
||||
end
|
||||
########## Position message window ##############
|
||||
pbRepositionMessageWindow(msgwindow,linecount)
|
||||
if facewindow
|
||||
pbPositionNearMsgWindow(facewindow,msgwindow,:left)
|
||||
facewindow.viewport = msgwindow.viewport
|
||||
facewindow.z = msgwindow.z
|
||||
end
|
||||
atTop = (msgwindow.y==0)
|
||||
yval = nil
|
||||
########## Show text #############################
|
||||
msgwindow.text = text
|
||||
Graphics.frame_reset if Graphics.frame_rate>40
|
||||
loop do
|
||||
if signWaitCount>0
|
||||
signWaitCount -= 1
|
||||
if atTop
|
||||
msgwindow.y = -msgwindow.height*signWaitCount/signWaitTime
|
||||
else
|
||||
msgwindow.y = Graphics.height-msgwindow.height*(signWaitTime-signWaitCount)/signWaitTime
|
||||
end
|
||||
end
|
||||
controls.length.times do |i|
|
||||
next if !controls[i]
|
||||
next if controls[i][2]>msgwindow.position || msgwindow.waitcount!=0
|
||||
control = controls[i][0]
|
||||
param = controls[i][1]
|
||||
case control
|
||||
when "f"
|
||||
facewindow.dispose if facewindow
|
||||
facewindow = PictureWindow.new("Graphics/Pictures/#{param}")
|
||||
pbPositionNearMsgWindow(facewindow,msgwindow,:left)
|
||||
facewindow.viewport = msgwindow.viewport
|
||||
facewindow.z = msgwindow.z
|
||||
when "ff"
|
||||
facewindow.dispose if facewindow
|
||||
facewindow = FaceWindowVX.new(param)
|
||||
pbPositionNearMsgWindow(facewindow,msgwindow,:left)
|
||||
facewindow.viewport = msgwindow.viewport
|
||||
facewindow.z = msgwindow.z
|
||||
when "g" # Display gold window
|
||||
goldwindow.dispose if goldwindow
|
||||
goldwindow = pbDisplayGoldWindow(msgwindow)
|
||||
when "cn" # Display coins window
|
||||
coinwindow.dispose if coinwindow
|
||||
coinwindow = pbDisplayCoinsWindow(msgwindow,goldwindow)
|
||||
when "pt" # Display battle points window
|
||||
battlepointswindow.dispose if battlepointswindow
|
||||
battlepointswindow = pbDisplayBattlePointsWindow(msgwindow)
|
||||
# New
|
||||
when "q"
|
||||
yval = param.to_i
|
||||
when "wu"
|
||||
msgwindow.y = 0
|
||||
atTop = true
|
||||
msgback.y = msgwindow.y if msgback
|
||||
pbPositionNearMsgWindow(facewindow,msgwindow,:left)
|
||||
msgwindow.y = -msgwindow.height*signWaitCount/signWaitTime
|
||||
when "wm"
|
||||
atTop = false
|
||||
msgwindow.y = (Graphics.height-msgwindow.height)/2
|
||||
msgback.y = msgwindow.y if msgback
|
||||
pbPositionNearMsgWindow(facewindow,msgwindow,:left)
|
||||
when "wd"
|
||||
atTop = false
|
||||
msgwindow.y = Graphics.height-msgwindow.height
|
||||
msgback.y = msgwindow.y if msgback
|
||||
pbPositionNearMsgWindow(facewindow,msgwindow,:left)
|
||||
msgwindow.y = Graphics.height-msgwindow.height*(signWaitTime-signWaitCount)/signWaitTime
|
||||
when "ts" # Change text speed
|
||||
msgwindow.textspeed = (param=="") ? -999 : param.to_i
|
||||
when "." # Wait 0.25 seconds
|
||||
msgwindow.waitcount += Graphics.frame_rate/4
|
||||
when "|" # Wait 1 second
|
||||
msgwindow.waitcount += Graphics.frame_rate
|
||||
when "wt" # Wait X/20 seconds
|
||||
param = param.sub(/\A\s+/,"").sub(/\s+\z/,"")
|
||||
msgwindow.waitcount += param.to_i*Graphics.frame_rate/20
|
||||
when "wtnp" # Wait X/20 seconds, no pause
|
||||
param = param.sub(/\A\s+/,"").sub(/\s+\z/,"")
|
||||
msgwindow.waitcount = param.to_i*Graphics.frame_rate/20
|
||||
autoresume = true
|
||||
when "^" # Wait, no pause
|
||||
autoresume = true
|
||||
when "se" # Play SE
|
||||
pbSEPlay(pbStringToAudioFile(param))
|
||||
when "me" # Play ME
|
||||
pbMEPlay(pbStringToAudioFile(param))
|
||||
end
|
||||
controls[i] = nil
|
||||
end
|
||||
break if !letterbyletter
|
||||
# New
|
||||
msgwindow.y = yval if yval
|
||||
Graphics.update
|
||||
Input.update
|
||||
facewindow.update if facewindow
|
||||
if autoresume && msgwindow.waitcount==0
|
||||
msgwindow.resume if msgwindow.busy?
|
||||
break if !msgwindow.busy?
|
||||
end
|
||||
if Input.trigger?(Input::USE) || Input.trigger?(Input::BACK)
|
||||
if msgwindow.busy?
|
||||
pbPlayDecisionSE if msgwindow.pausing?
|
||||
msgwindow.resume
|
||||
else
|
||||
break if signWaitCount==0
|
||||
end
|
||||
end
|
||||
pbUpdateSceneMap
|
||||
msgwindow.update
|
||||
yield if block_given?
|
||||
break if (!letterbyletter || commandProc || commands) && !msgwindow.busy?
|
||||
end
|
||||
Input.update # Must call Input.update again to avoid extra triggers
|
||||
msgwindow.letterbyletter=oldletterbyletter
|
||||
if commands
|
||||
$game_variables[cmdvariable]=pbShowCommands(msgwindow,commands,cmdIfCancel)
|
||||
$game_map.need_refresh = true if $game_map
|
||||
end
|
||||
if commandProc
|
||||
ret=commandProc.call(msgwindow)
|
||||
end
|
||||
msgback&.dispose
|
||||
goldwindow&.dispose
|
||||
coinwindow&.dispose
|
||||
battlepointswindow&.dispose
|
||||
facewindow&.dispose
|
||||
if haveSpecialClose
|
||||
pbSEPlay(pbStringToAudioFile(specialCloseSE))
|
||||
atTop = (msgwindow.y==0)
|
||||
(0..signWaitTime).each do |i|
|
||||
if atTop
|
||||
msgwindow.y = -msgwindow.height*i/signWaitTime
|
||||
else
|
||||
msgwindow.y = Graphics.height-msgwindow.height*(signWaitTime-i)/signWaitTime
|
||||
end
|
||||
Graphics.update
|
||||
Input.update
|
||||
pbUpdateSceneMap
|
||||
msgwindow.update
|
||||
end
|
||||
end
|
||||
return ret
|
||||
end
|
||||
@@ -0,0 +1,516 @@
|
||||
#====================================================================================
|
||||
# DO NOT MAKE EDITS HERE
|
||||
#====================================================================================
|
||||
|
||||
#====================================================================================
|
||||
# Summary
|
||||
#====================================================================================
|
||||
|
||||
|
||||
|
||||
|
||||
class PokemonSummary_Scene
|
||||
alias tdw_contests_summary_start_scene pbStartScene
|
||||
def pbStartScene(party, partyindex, inbattle = false, is_player = true)
|
||||
@contestpage = $game_map.map_id == ContestSettings::DEFAULT_LOBBY_MAP_ID
|
||||
echoln @contestpage
|
||||
tdw_contests_summary_start_scene(party, partyindex, inbattle, is_player)
|
||||
end
|
||||
|
||||
alias tdw_contests_summary_page_three drawPageThree
|
||||
def drawPageThree
|
||||
if !@contestpage
|
||||
tdw_contests_summary_page_three
|
||||
else
|
||||
simple = PokeblockSettings::SIMPLIFIED_BERRY_BLENDING
|
||||
bargraph = (PluginManager.installed?("Better Bitmaps") ? PokeblockSettings::STATS_BAR_GRAPH : true)
|
||||
@sprites["background"].setBitmap(sprintf("Graphics/Pictures/Summary/bg_3_contest"))
|
||||
pbCreateConditionBars(simple,bargraph)
|
||||
end
|
||||
end
|
||||
|
||||
alias tdw_contests_summary_page_four drawPageFour
|
||||
def drawPageFour
|
||||
if !@contestpage
|
||||
tdw_contests_summary_page_four
|
||||
else
|
||||
overlay = @sprites["overlay"].bitmap
|
||||
moveBase = Color.new(64, 64, 64)
|
||||
moveShadow = Color.new(176, 176, 176)
|
||||
ppBase = [moveBase, # More than 1/2 of total PP
|
||||
Color.new(248, 192, 0), # 1/2 of total PP or less
|
||||
Color.new(248, 136, 32), # 1/4 of total PP or less
|
||||
Color.new(248, 72, 72)] # Zero PP
|
||||
ppShadow = [moveShadow, # More than 1/2 of total PP
|
||||
Color.new(144, 104, 0), # 1/2 of total PP or less
|
||||
Color.new(144, 72, 24), # 1/4 of total PP or less
|
||||
Color.new(136, 48, 48)] # Zero PP
|
||||
@sprites["pokemon"].visible = true
|
||||
@sprites["pokeicon"].visible = false
|
||||
@sprites["itemicon"].visible = true
|
||||
textpos = []
|
||||
imagepos = []
|
||||
# Write move names, types and PP amounts for each known move
|
||||
xPos = 248
|
||||
yPos = 92
|
||||
yAdj = 0
|
||||
Pokemon::MAX_MOVES.times do |i|
|
||||
move = @pokemon.moves[i]
|
||||
if move
|
||||
type_number = GameData::Move.get(move.id).contest_type_position
|
||||
imagepos.push(["Graphics/Pictures/Contest/contesttype", xPos, yPos + yAdj +8, 0, type_number * 28, 64, 28])
|
||||
textpos.push([move.name, xPos+68, yPos + yAdj, 0, moveBase, moveShadow])
|
||||
if move.total_pp > 0
|
||||
textpos.push([_INTL("PP"), xPos+94, yPos + yAdj + 32, 0, moveBase, moveShadow])
|
||||
ppfraction = 0
|
||||
if move.pp == 0
|
||||
ppfraction = 3
|
||||
elsif move.pp * 4 <= move.total_pp
|
||||
ppfraction = 2
|
||||
elsif move.pp * 2 <= move.total_pp
|
||||
ppfraction = 1
|
||||
end
|
||||
textpos.push([sprintf("%d/%d", move.pp, move.total_pp), xPos+212, yPos + yAdj + 32, 1, ppBase[ppfraction], ppShadow[ppfraction]])
|
||||
end
|
||||
else
|
||||
textpos.push(["-", xPos+68, yPos, 0, moveBase, moveShadow])
|
||||
textpos.push(["--", xPos+194, yPos + yAdj + 32, 1, moveBase, moveShadow])
|
||||
end
|
||||
yPos += 64
|
||||
end
|
||||
# Draw all text and images
|
||||
pbDrawTextPositions(overlay, textpos)
|
||||
pbDrawImagePositions(overlay, imagepos)
|
||||
end
|
||||
end
|
||||
|
||||
def drawPageFourContestSelecting(move_to_learn)
|
||||
overlay = @sprites["overlay"].bitmap
|
||||
overlay.clear
|
||||
|
||||
base = Color.new(248, 248, 248)
|
||||
shadow = Color.new(104, 104, 104)
|
||||
moveBase = Color.new(64, 64, 64)
|
||||
moveShadow = Color.new(176, 176, 176)
|
||||
ppBase = [moveBase, # More than 1/2 of total PP
|
||||
Color.new(248, 192, 0), # 1/2 of total PP or less
|
||||
Color.new(248, 136, 32), # 1/4 of total PP or less
|
||||
Color.new(248, 72, 72)] # Zero PP
|
||||
ppShadow = [moveShadow, # More than 1/2 of total PP
|
||||
Color.new(144, 104, 0), # 1/2 of total PP or less
|
||||
Color.new(144, 72, 24), # 1/4 of total PP or less
|
||||
Color.new(136, 48, 48)] # Zero PP
|
||||
|
||||
# Set background image
|
||||
if move_to_learn
|
||||
@sprites["background"].setBitmap("Graphics/Pictures/Summary/bg_learnmove")
|
||||
else
|
||||
@sprites["background"].setBitmap("Graphics/Pictures/Summary/bg_movedetail")
|
||||
end
|
||||
# Write various bits of text
|
||||
textpos = [
|
||||
[_INTL("MOVES"), 26, 10, 0, base, shadow],
|
||||
[_INTL("APPEAL"), 20, 116, 0, base, shadow],
|
||||
[_INTL("JAMMING"), 20, 148, 0, base, shadow]
|
||||
]
|
||||
imagepos = []
|
||||
# Write move names, types and PP amounts for each known move
|
||||
xPos = 248
|
||||
yPos = 104
|
||||
yAdj = -12
|
||||
yPos -= 76 if move_to_learn
|
||||
limit = (move_to_learn) ? Pokemon::MAX_MOVES + 1 : Pokemon::MAX_MOVES
|
||||
limit.times do |i|
|
||||
move = @pokemon.moves[i]
|
||||
if i == Pokemon::MAX_MOVES
|
||||
move = move_to_learn
|
||||
yPos += 20
|
||||
end
|
||||
if move
|
||||
type_number = GameData::Move.get(move.id).contest_type_position
|
||||
imagepos.push(["Graphics/Pictures/Contest/contesttype", xPos, yPos + yAdj + 8, 0, type_number * 28, 64, 28])
|
||||
textpos.push([move.name, xPos + 68, yPos + yAdj, 0, moveBase, moveShadow])
|
||||
if move.total_pp > 0
|
||||
textpos.push([_INTL("PP"), xPos + 94, yPos + yAdj + 32, 0, moveBase, moveShadow])
|
||||
ppfraction = 0
|
||||
if move.pp == 0
|
||||
ppfraction = 3
|
||||
elsif move.pp * 4 <= move.total_pp
|
||||
ppfraction = 2
|
||||
elsif move.pp * 2 <= move.total_pp
|
||||
ppfraction = 1
|
||||
end
|
||||
textpos.push([sprintf("%d/%d", move.pp, move.total_pp), xPos + 212, yPos + yAdj + 32, 1, ppBase[ppfraction], ppShadow[ppfraction]])
|
||||
end
|
||||
else
|
||||
textpos.push(["-", xPos + 68, yPos + yAdj, 0, moveBase, moveShadow])
|
||||
textpos.push(["--", xPos + 194, yPos + yAdj + 32, 1, moveBase, moveShadow])
|
||||
end
|
||||
yPos += 64
|
||||
end
|
||||
# Draw all text and images
|
||||
pbDrawTextPositions(overlay, textpos)
|
||||
pbDrawImagePositions(overlay, imagepos)
|
||||
# Draw Pokémon's type icon(s)
|
||||
@pokemon.types.each_with_index do |type, i|
|
||||
type_number = GameData::Type.get(type).id_number
|
||||
type_rect = Rect.new(0, type_number * 28, 64, 28)
|
||||
type_x = (@pokemon.types.length == 1) ? 130 : 96 + (70 * i)
|
||||
overlay.blt(type_x, 78, @typebitmap.bitmap, type_rect)
|
||||
end
|
||||
end
|
||||
|
||||
def drawSelectedContestMove(move_to_learn, selected_move)
|
||||
# Draw all of page four, except selected move's details
|
||||
drawPageFourContestSelecting(move_to_learn)
|
||||
move = GameData::Move.get(selected_move.id)
|
||||
# Set various values
|
||||
overlay = @sprites["overlay"].bitmap
|
||||
base = Color.new(64, 64, 64)
|
||||
shadow = Color.new(176, 176, 176)
|
||||
@sprites["pokemon"].visible = false if @sprites["pokemon"]
|
||||
@sprites["pokeicon"].pokemon = @pokemon
|
||||
@sprites["pokeicon"].visible = true
|
||||
@sprites["itemicon"].visible = false if @sprites["itemicon"]
|
||||
hearts = !move.contest_can_be_used? ? 0 : move.contest_hearts
|
||||
jam = !move.contest_can_be_used? ? 0 : move.contest_jam
|
||||
description = move.contest_description
|
||||
textpos = []
|
||||
imagepos = []
|
||||
# Draw all text
|
||||
pbDrawTextPositions(overlay, textpos)
|
||||
# Draw selected move's information
|
||||
imagepos.push(["Graphics/Pictures/Contest/move_heart#{hearts}", 166, 124]) if hearts > 0
|
||||
imagepos.push(["Graphics/Pictures/Contest/move_negaheart#{jam}", 166, 156]) if jam > 0
|
||||
pbDrawImagePositions(overlay, imagepos)
|
||||
# Draw selected move's description
|
||||
drawTextEx(overlay, 4, 224, 230, 5, description, base, shadow)
|
||||
end
|
||||
|
||||
def pbScene
|
||||
@pokemon.play_cry
|
||||
loop do
|
||||
Graphics.update
|
||||
Input.update
|
||||
pbUpdate
|
||||
dorefresh = false
|
||||
if Input.trigger?(Input::ACTION)
|
||||
pbSEStop
|
||||
@pokemon.play_cry
|
||||
elsif Input.trigger?(Input::BACK)
|
||||
pbPlayCloseMenuSE
|
||||
break
|
||||
elsif Input.trigger?(Input::USE)
|
||||
if @page == 4
|
||||
pbPlayDecisionSE
|
||||
pbMoveSelection
|
||||
dorefresh = true
|
||||
elsif @page == 5
|
||||
pbPlayDecisionSE
|
||||
pbRibbonSelection
|
||||
dorefresh = true
|
||||
elsif !@inbattle
|
||||
pbPlayDecisionSE
|
||||
dorefresh = pbOptions
|
||||
end
|
||||
elsif Input.trigger?(Input::SPECIAL)
|
||||
if @page == 3 && $game_switches[ContestSettings::CONTEST_INFO_IN_SUMMARY_SWITCH]
|
||||
@contestpage = !@contestpage
|
||||
pbPlayDecisionSE
|
||||
dorefresh = true
|
||||
end
|
||||
if @page == 4 && $game_switches[ContestSettings::CONTEST_INFO_IN_SUMMARY_SWITCH]
|
||||
@contestpage = !@contestpage
|
||||
pbPlayDecisionSE
|
||||
dorefresh = true
|
||||
end
|
||||
elsif Input.trigger?(Input::UP) && @partyindex > 0
|
||||
oldindex = @partyindex
|
||||
pbGoToPrevious
|
||||
if @partyindex != oldindex
|
||||
pbChangePokemon
|
||||
@ribbonOffset = 0
|
||||
dorefresh = true
|
||||
end
|
||||
elsif Input.trigger?(Input::DOWN) && @partyindex < @party.length - 1
|
||||
oldindex = @partyindex
|
||||
pbGoToNext
|
||||
if @partyindex != oldindex
|
||||
pbChangePokemon
|
||||
@ribbonOffset = 0
|
||||
dorefresh = true
|
||||
end
|
||||
elsif Input.trigger?(Input::LEFT) && !@pokemon.egg?
|
||||
oldpage = @page
|
||||
@page -= 1
|
||||
@page = 1 if @page < 1
|
||||
@page = 5 if @page > 5
|
||||
if @page != oldpage # Move to next page
|
||||
pbSEPlay("GUI summary change page")
|
||||
@ribbonOffset = 0
|
||||
dorefresh = true
|
||||
end
|
||||
elsif Input.trigger?(Input::RIGHT) && !@pokemon.egg?
|
||||
oldpage = @page
|
||||
@page += 1
|
||||
@page = 1 if @page < 1
|
||||
@page = 5 if @page > 5
|
||||
if @page != oldpage # Move to next page
|
||||
pbSEPlay("GUI summary change page")
|
||||
@ribbonOffset = 0
|
||||
dorefresh = true
|
||||
end
|
||||
end
|
||||
if dorefresh
|
||||
disposeContestStats
|
||||
drawPage(@page)
|
||||
end
|
||||
end
|
||||
return @partyindex
|
||||
end
|
||||
|
||||
alias tdw_contests_summary_move_select drawSelectedMove
|
||||
def drawSelectedMove(move_to_learn, selected_move)
|
||||
if !@contestpage
|
||||
tdw_contests_summary_move_select(move_to_learn, selected_move)
|
||||
else
|
||||
drawSelectedContestMove(move_to_learn, selected_move)
|
||||
end
|
||||
end
|
||||
|
||||
def pbMoveSelection
|
||||
@sprites["movesel"].visible = true
|
||||
@sprites["movesel"].index = 0
|
||||
selmove = 0
|
||||
oldselmove = 0
|
||||
switching = false
|
||||
drawSelectedMove(nil, @pokemon.moves[selmove])
|
||||
loop do
|
||||
Graphics.update
|
||||
Input.update
|
||||
pbUpdate
|
||||
if @sprites["movepresel"].index == @sprites["movesel"].index
|
||||
@sprites["movepresel"].z = @sprites["movesel"].z + 1
|
||||
else
|
||||
@sprites["movepresel"].z = @sprites["movesel"].z
|
||||
end
|
||||
if Input.trigger?(Input::BACK)
|
||||
(switching) ? pbPlayCancelSE : pbPlayCloseMenuSE
|
||||
break if !switching
|
||||
@sprites["movepresel"].visible = false
|
||||
switching = false
|
||||
elsif Input.trigger?(Input::USE)
|
||||
pbPlayDecisionSE
|
||||
if selmove == Pokemon::MAX_MOVES
|
||||
break if !switching
|
||||
@sprites["movepresel"].visible = false
|
||||
switching = false
|
||||
elsif !@pokemon.shadowPokemon?
|
||||
if switching
|
||||
tmpmove = @pokemon.moves[oldselmove]
|
||||
@pokemon.moves[oldselmove] = @pokemon.moves[selmove]
|
||||
@pokemon.moves[selmove] = tmpmove
|
||||
@sprites["movepresel"].visible = false
|
||||
switching = false
|
||||
drawSelectedMove(nil, @pokemon.moves[selmove])
|
||||
else
|
||||
@sprites["movepresel"].index = selmove
|
||||
@sprites["movepresel"].visible = true
|
||||
oldselmove = selmove
|
||||
switching = true
|
||||
end
|
||||
end
|
||||
elsif Input.trigger?(Input::UP)
|
||||
selmove -= 1
|
||||
if selmove < Pokemon::MAX_MOVES && selmove >= @pokemon.numMoves
|
||||
selmove = @pokemon.numMoves - 1
|
||||
end
|
||||
selmove = 0 if selmove >= Pokemon::MAX_MOVES
|
||||
selmove = @pokemon.numMoves - 1 if selmove < 0
|
||||
@sprites["movesel"].index = selmove
|
||||
pbPlayCursorSE
|
||||
drawSelectedMove(nil, @pokemon.moves[selmove])
|
||||
elsif Input.trigger?(Input::DOWN)
|
||||
selmove += 1
|
||||
selmove = 0 if selmove < Pokemon::MAX_MOVES && selmove >= @pokemon.numMoves
|
||||
selmove = 0 if selmove >= Pokemon::MAX_MOVES
|
||||
selmove = Pokemon::MAX_MOVES if selmove < 0
|
||||
@sprites["movesel"].index = selmove
|
||||
pbPlayCursorSE
|
||||
drawSelectedMove(nil, @pokemon.moves[selmove])
|
||||
elsif Input.trigger?(Input::SPECIAL)
|
||||
if @page == 3 && $game_switches[ContestSettings::CONTEST_INFO_IN_SUMMARY_SWITCH]
|
||||
@contestpage = !@contestpage
|
||||
pbPlayDecisionSE
|
||||
drawSelectedMove(nil, @pokemon.moves[selmove])
|
||||
end
|
||||
if @page == 4 && $game_switches[ContestSettings::CONTEST_INFO_IN_SUMMARY_SWITCH]
|
||||
@contestpage = !@contestpage
|
||||
pbPlayDecisionSE
|
||||
drawSelectedMove(nil, @pokemon.moves[selmove])
|
||||
end
|
||||
end
|
||||
end
|
||||
@sprites["movesel"].visible = false
|
||||
end
|
||||
|
||||
|
||||
def pbChooseMoveToForget(move_to_learn)
|
||||
new_move = (move_to_learn) ? Pokemon::Move.new(move_to_learn) : nil
|
||||
selmove = 0
|
||||
maxmove = (new_move) ? Pokemon::MAX_MOVES : Pokemon::MAX_MOVES - 1
|
||||
loop do
|
||||
Graphics.update
|
||||
Input.update
|
||||
pbUpdate
|
||||
if Input.trigger?(Input::BACK)
|
||||
selmove = Pokemon::MAX_MOVES
|
||||
pbPlayCloseMenuSE if new_move
|
||||
break
|
||||
elsif Input.trigger?(Input::USE)
|
||||
pbPlayDecisionSE
|
||||
break
|
||||
elsif Input.trigger?(Input::UP)
|
||||
selmove -= 1
|
||||
selmove = maxmove if selmove < 0
|
||||
if selmove < Pokemon::MAX_MOVES && selmove >= @pokemon.numMoves
|
||||
selmove = @pokemon.numMoves - 1
|
||||
end
|
||||
@sprites["movesel"].index = selmove
|
||||
selected_move = (selmove == Pokemon::MAX_MOVES) ? new_move : @pokemon.moves[selmove]
|
||||
drawSelectedMove(new_move, selected_move)
|
||||
elsif Input.trigger?(Input::DOWN)
|
||||
selmove += 1
|
||||
selmove = 0 if selmove > maxmove
|
||||
if selmove < Pokemon::MAX_MOVES && selmove >= @pokemon.numMoves
|
||||
selmove = (new_move) ? maxmove : 0
|
||||
end
|
||||
@sprites["movesel"].index = selmove
|
||||
selected_move = (selmove == Pokemon::MAX_MOVES) ? new_move : @pokemon.moves[selmove]
|
||||
drawSelectedMove(new_move, selected_move)
|
||||
elsif Input.trigger?(Input::SPECIAL)
|
||||
if $game_switches[ContestSettings::CONTEST_INFO_IN_SUMMARY_SWITCH]
|
||||
@contestpage = !@contestpage
|
||||
pbPlayDecisionSE
|
||||
selected_move = (selmove == Pokemon::MAX_MOVES) ? new_move : @pokemon.moves[selmove]
|
||||
drawSelectedMove(new_move, selected_move)
|
||||
end
|
||||
end
|
||||
end
|
||||
return (selmove == Pokemon::MAX_MOVES) ? -1 : selmove
|
||||
end
|
||||
|
||||
def disposeContestStats
|
||||
@sprites["statsgraphbase"]&.dispose
|
||||
@sprites["statsgraph"]&.dispose
|
||||
arr = ["Cool", "Beauty", "Cute", "Smart", "Tough", "Sheen"]
|
||||
6.times { |i|
|
||||
@sprites["#{arr[i]} bar"]&.dispose
|
||||
}
|
||||
end
|
||||
|
||||
def pbCreateConditionBars(simple,bargraph)
|
||||
pkmn = @pokemon
|
||||
arr = ["Cool", "Beauty", "Cute", "Smart", "Tough"]
|
||||
fea = [pkmn.cool, pkmn.beauty, pkmn.cute, pkmn.smart, pkmn.tough]
|
||||
imagepos = []
|
||||
xBase = 236
|
||||
xBaseAdj = 0
|
||||
xBase += xBaseAdj
|
||||
yBase = (simple ? 114 : 104)
|
||||
if bargraph
|
||||
5.times { |i|
|
||||
overlay = @sprites["overlay"].bitmap
|
||||
pbSetSmallFont(overlay)
|
||||
textpos = []
|
||||
barBitmap = AnimatedBitmap.new("Graphics/Pictures/Pokeblock/UI Pokeblock/Bar_#{arr[i]}")
|
||||
@sprites["#{arr[i]} bar"] = Sprite.new(@viewport)
|
||||
@sprites["#{arr[i]} bar"].bitmap = barBitmap.bitmap
|
||||
@sprites["#{arr[i]} bar"].src_rect.width = fea[i]
|
||||
@sprites["#{arr[i]} bar"].x = xBase + 4
|
||||
@sprites["#{arr[i]} bar"].y = yBase + 48 * i
|
||||
@sprites["#{arr[i]} bar"].z = 5
|
||||
string = _INTL(arr[i])
|
||||
string_width = overlay.text_size(string).width
|
||||
textpos.push([string, xBase, yBase - 30 + 48 * i, 0, Color.new(96, 96, 112), Color.new(240, 248, 248)])
|
||||
pbDrawTextPositions(overlay, textpos)
|
||||
pbSetSystemFont(overlay)
|
||||
imagepos.push(["Graphics/Pictures/Pokeblock/UI Pokeblock/Bar_bg", xBase, yBase + 48 * i])
|
||||
imagepos.push(["Graphics/Pictures/Pokeblock/UI Pokeblock/max", xBase + string_width + 4, @sprites["#{arr[i]} bar"].y - 20]) if fea[i] >= 255
|
||||
}
|
||||
else
|
||||
pentagon_outline_color = Color.new(165, 83, 147)
|
||||
pentagon_back_color = Color.white
|
||||
pentagon_stat_color = Color.new(71, 226, 191)
|
||||
graphX = xBase + 130
|
||||
graphY = (simple ? 120 : 104) + 110
|
||||
@sprites["statsgraphbase"] = BitmapSprite.new(Graphics.width, Graphics.height, @viewport)
|
||||
pbDrawStatsPentagonBase(@sprites["statsgraphbase"], graphX, graphY, 77, pentagon_outline_color, pentagon_back_color)
|
||||
@sprites["statsgraph"] = BitmapSprite.new(Graphics.width, Graphics.height, @viewport)
|
||||
@sprites["statsgraph"].opacity = 180
|
||||
pbDrawStatsPentagon(@sprites["statsgraph"], [fea[0], fea[1], fea[2], fea[3], fea[4]], graphX, graphY, 77, pentagon_stat_color)
|
||||
xPos = [334, 436, 398, 270, 232]
|
||||
yPos = [100, 159, 284, 284, 159]
|
||||
5.times { |i|
|
||||
x = xPos[i]
|
||||
x += xBaseAdj
|
||||
y = yPos[i]
|
||||
y += (simple ? 16 : 0)
|
||||
imagepos.push(["Graphics/Pictures/Contest/contesttype", x, y, 0, i * 28, 64, 28])
|
||||
if fea[i] >= 255
|
||||
x = [400, 420, 464, 336, 298][i]
|
||||
x += xBaseAdj
|
||||
y = [118, 176, 302, 302, 176][i]
|
||||
y -= (simple ? 0 : 16)
|
||||
imagepos.push(["Graphics/Pictures/Pokeblock/UI Pokeblock/max", x, y])
|
||||
end
|
||||
}
|
||||
end
|
||||
pbDrawImagePositions(@sprites["overlay"].bitmap, imagepos)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
#====================================================================================
|
||||
# Relearner
|
||||
#====================================================================================
|
||||
|
||||
class MoveRelearner_Scene
|
||||
|
||||
alias tdw_contests_relearner_start_scene pbStartScene
|
||||
def pbStartScene(pokemon, moves)
|
||||
@contestinfo = false
|
||||
tdw_contests_relearner_start_scene(pokemon, moves)
|
||||
end
|
||||
|
||||
|
||||
|
||||
# Processes the scene
|
||||
def pbChooseMove
|
||||
oldcmd = -1
|
||||
pbActivateWindow(@sprites, "commands") {
|
||||
loop do
|
||||
oldcmd = @sprites["commands"].index
|
||||
Graphics.update
|
||||
Input.update
|
||||
pbUpdate
|
||||
if @sprites["commands"].index != oldcmd
|
||||
@sprites["background"].x = 0
|
||||
@sprites["background"].y = 78 + ((@sprites["commands"].index - @sprites["commands"].top_item) * 64)
|
||||
pbDrawMoveList
|
||||
end
|
||||
if Input.trigger?(Input::BACK)
|
||||
return nil
|
||||
elsif Input.trigger?(Input::USE)
|
||||
return @moves[@sprites["commands"].index]
|
||||
elsif Input.trigger?(Input::SPECIAL)
|
||||
if $game_switches[ContestSettings::CONTEST_INFO_IN_SUMMARY_SWITCH]
|
||||
@contestinfo = !@contestinfo
|
||||
pbPlayDecisionSE
|
||||
pbDrawMoveList
|
||||
end
|
||||
end
|
||||
end
|
||||
}
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,67 @@
|
||||
#====================================================================================
|
||||
# Fans
|
||||
#====================================================================================
|
||||
|
||||
#====================================================================================
|
||||
#================================== Fans Settings ===================================
|
||||
#====================================================================================
|
||||
|
||||
module ContestSettings
|
||||
FAN_ITEMS = [
|
||||
[:ASPEARBERRY,:CHERIBERRY,:CHESTOBERRY,:FRESHWATER,:LEPPABERRY,:LUMIOSEGALETTE,:OLDGATEAU,
|
||||
:ORANBERRY,:PECHABERRY,:PERSIMBERRY,:RAGECANDYBAR,:RAWSTBERRY,:SHALOURSABLE,:SWEETHEART], #Normal Rank
|
||||
[:AGUAVBERRY,:BLUKBERRY,:FIGYBERRY,:HONEY,:IAPAPABERRY,:LUMIOSEGALETTE,:MAGOBERRY,:NANABBERRY,
|
||||
:OLDGATEAU,:PINAPBERRY,:RAGECANDYBAR,:RAZZBERRY,:SHALOURSABLE,:SITRUSBERRY,:SODAPOP,
|
||||
:STARDUST,:WEPEARBERRY,:WIKIBERRY], #Super Rank
|
||||
[:BELUEBERRY,:CORNNBERRY,:DURINBERRY,:GREPABERRY,:HEARTSCALE,:HONDEWBERRY,:KELPSYBERRY,
|
||||
:LEMONADE,:LUMIOSEGALETTE,:MAGOSTBERRY,:NOMELBERRY,:OLDGATEAU,:PAMTREBERRY,:POMEGBERRY,
|
||||
:QUALOTBERRY,:RABUTABERRY,:RAGECANDYBAR,:SHALOURSABLE,:SPELONBERRY,:STARPIECE,:TAMATOBERRY,:WATMELBERRY], #Hyper Rank
|
||||
[:BABIRIBERRY,:CHARTIBERRY,:CHILANBERRY,:CHOPLEBERRY,:COBABERRY,:COLBURBERRY,:COMETSHARD,
|
||||
:DESTINYKNOT,:HABANBERRY,:KASIBBERRY,:KEBIABERRY,:LUMIOSEGALETTE,:MOOMOOMILK,:OCCABERRY,
|
||||
:OLDGATEAU,:PASSHOBERRY,:PAYAPABERRY,:RAGECANDYBAR,:RINDOBERRY,:ROSELIBERRY,:SHALOURSABLE,
|
||||
:SHUCABERRY,:TANGABERRY,:WACANBERRY,:YACHEBERRY] #Master Rank
|
||||
]
|
||||
end
|
||||
def pbNumberContestsParticipated(rank: nil, category: nil)
|
||||
$Trainer.stats.initializeContestStats if !$Trainer.stats.pokemon_contests_participated_total
|
||||
rank = ContestFunctions.sanitizeRank(rank) if rank
|
||||
category = ContestFunctions.sanitizeCategory(category) if category
|
||||
if rank && category
|
||||
return $Trainer.stats.pokemon_contests_participated_category_rank[category][rank]
|
||||
elsif rank
|
||||
return $Trainer.stats.pokemon_contests_participated_rank[rank]
|
||||
elsif category
|
||||
return $Trainer.stats.pokemon_contests_participated_category[category]
|
||||
else
|
||||
return $Trainer.stats.pokemon_contests_participated_total
|
||||
end
|
||||
end
|
||||
|
||||
def pbNumContestsPart(r: nil, c: nil)
|
||||
return pbNumberContestsParticipated(rank: r, category: c)
|
||||
end
|
||||
|
||||
def pbNumberContestsWon(rank: nil, category: nil)
|
||||
$Trainer.stats.initializeContestStats if !$Trainer.stats.pokemon_contests_won_total
|
||||
rank = ContestFunctions.sanitizeRank(rank) if rank
|
||||
category = ContestFunctions.sanitizeCategory(category) if category
|
||||
if rank && category
|
||||
return $Trainer.stats.pokemon_contests_won_category_rank[category][rank]
|
||||
elsif rank
|
||||
return $Trainer.stats.pokemon_contests_won_rank[rank]
|
||||
elsif category
|
||||
return $Trainer.stats.pokemon_contests_won_category[category]
|
||||
else
|
||||
return $Trainer.stats.pokemon_contests_won_total
|
||||
end
|
||||
end
|
||||
|
||||
def pbNumContestsWon(r: nil, c: nil)
|
||||
return pbNumberContestsWon(rank: r, category: c)
|
||||
end
|
||||
|
||||
def pbGiveFanItem(rank = 0)
|
||||
rank = ContestFunctions.sanitizeRank(rank)
|
||||
items = ContestSettings::FAN_ITEMS[rank]
|
||||
pbReceiveItem(items[rand(items.length)])
|
||||
end
|
||||
Reference in New Issue
Block a user