diff --git a/Data/Scripts/001_Settings.rb b/Data/Scripts/001_Settings.rb index 5184b5777..a798ae79e 100644 --- a/Data/Scripts/001_Settings.rb +++ b/Data/Scripts/001_Settings.rb @@ -514,6 +514,10 @@ module Settings # start the game (in Debug mode). You will not need to hold Ctrl/Shift to # compile anything. PROMPT_TO_COMPILE = false + # Whether the game will skip the intro splash screens and title screen, and go + # straight to the Continue/New Game screen. Only applies to playing in Debug + # mode. + SKIP_TITLE_SCREEN = true # Whether the game will skip the Continue/New Game screen and go straight into # a saved game (if there is one) or start a new game (if there isn't). Only # applies to playing in Debug mode. diff --git a/Data/Scripts/010_Data/002_PBS data/003_Type.rb b/Data/Scripts/010_Data/002_PBS data/003_Type.rb index 8688f6376..9eaa1cd52 100644 --- a/Data/Scripts/010_Data/002_PBS data/003_Type.rb +++ b/Data/Scripts/010_Data/002_PBS data/003_Type.rb @@ -27,6 +27,8 @@ module GameData "Flags" => [:flags, "*s"] } + ICON_SIZE = [64, 28] + extend ClassMethodsSymbols include InstanceMethods diff --git a/Data/Scripts/010_Data/002_PBS data/005_Move.rb b/Data/Scripts/010_Data/002_PBS data/005_Move.rb index 47949c4ca..c20ecbfa6 100644 --- a/Data/Scripts/010_Data/002_PBS data/005_Move.rb +++ b/Data/Scripts/010_Data/002_PBS data/005_Move.rb @@ -109,31 +109,16 @@ module GameData when "TypeDependsOnUserIVs" return pbHiddenPower(pkmn)[0] when "TypeAndPowerDependOnUserBerry" - type_array = { - :NORMAL => [:CHILANBERRY], - :FIRE => [:CHERIBERRY, :BLUKBERRY, :WATMELBERRY, :OCCABERRY], - :WATER => [:CHESTOBERRY, :NANABBERRY, :DURINBERRY, :PASSHOBERRY], - :ELECTRIC => [:PECHABERRY, :WEPEARBERRY, :BELUEBERRY, :WACANBERRY], - :GRASS => [:RAWSTBERRY, :PINAPBERRY, :RINDOBERRY, :LIECHIBERRY], - :ICE => [:ASPEARBERRY, :POMEGBERRY, :YACHEBERRY, :GANLONBERRY], - :FIGHTING => [:LEPPABERRY, :KELPSYBERRY, :CHOPLEBERRY, :SALACBERRY], - :POISON => [:ORANBERRY, :QUALOTBERRY, :KEBIABERRY, :PETAYABERRY], - :GROUND => [:PERSIMBERRY, :HONDEWBERRY, :SHUCABERRY, :APICOTBERRY], - :FLYING => [:LUMBERRY, :GREPABERRY, :COBABERRY, :LANSATBERRY], - :PSYCHIC => [:SITRUSBERRY, :TAMATOBERRY, :PAYAPABERRY, :STARFBERRY], - :BUG => [:FIGYBERRY, :CORNNBERRY, :TANGABERRY, :ENIGMABERRY], - :ROCK => [:WIKIBERRY, :MAGOSTBERRY, :CHARTIBERRY, :MICLEBERRY], - :GHOST => [:MAGOBERRY, :RABUTABERRY, :KASIBBERRY, :CUSTAPBERRY], - :DRAGON => [:AGUAVBERRY, :NOMELBERRY, :HABANBERRY, :JABOCABERRY], - :DARK => [:IAPAPABERRY, :SPELONBERRY, :COLBURBERRY, :ROWAPBERRY, :MARANGABERRY], - :STEEL => [:RAZZBERRY, :PAMTREBERRY, :BABIRIBERRY], - :FAIRY => [:ROSELIBERRY, :KEEBERRY] - } - if pkmn.hasItem? - type_array.each do |type, items| - return type if items.include?(pkmn.item_id) && GameData::Type.exists?(type) + item_data = pkmn.item + if item_data + item_data.flags.each do |flag| + next if !flag[/^NaturalGift_(\w+)_(?:\d+)$/i] + typ = $~[1].to_sym + ret = typ if GameData::Type.exists?(typ) + break end end + return :NORMAL when "TypeDependsOnUserPlate" item_types = { :FISTPLATE => :FIGHTING, @@ -209,169 +194,22 @@ module GameData when "TypeDependsOnUserIVs" return pbHiddenPower(pkmn)[1] when "TypeAndPowerDependOnUserBerry" - damage_array = { - 60 => [:CHERIBERRY, :CHESTOBERRY, :PECHABERRY, :RAWSTBERRY, :ASPEARBERRY, - :LEPPABERRY, :ORANBERRY, :PERSIMBERRY, :LUMBERRY, :SITRUSBERRY, - :FIGYBERRY, :WIKIBERRY, :MAGOBERRY, :AGUAVBERRY, :IAPAPABERRY, - :RAZZBERRY, :OCCABERRY, :PASSHOBERRY, :WACANBERRY, :RINDOBERRY, - :YACHEBERRY, :CHOPLEBERRY, :KEBIABERRY, :SHUCABERRY, :COBABERRY, - :PAYAPABERRY, :TANGABERRY, :CHARTIBERRY, :KASIBBERRY, :HABANBERRY, - :COLBURBERRY, :BABIRIBERRY, :CHILANBERRY, :ROSELIBERRY], - 70 => [:BLUKBERRY, :NANABBERRY, :WEPEARBERRY, :PINAPBERRY, :POMEGBERRY, - :KELPSYBERRY, :QUALOTBERRY, :HONDEWBERRY, :GREPABERRY, :TAMATOBERRY, - :CORNNBERRY, :MAGOSTBERRY, :RABUTABERRY, :NOMELBERRY, :SPELONBERRY, - :PAMTREBERRY], - 80 => [:WATMELBERRY, :DURINBERRY, :BELUEBERRY, :LIECHIBERRY, :GANLONBERRY, - :SALACBERRY, :PETAYABERRY, :APICOTBERRY, :LANSATBERRY, :STARFBERRY, - :ENIGMABERRY, :MICLEBERRY, :CUSTAPBERRY, :JABOCABERRY, :ROWAPBERRY, - :KEEBERRY, :MARANGABERRY] - } - if pkmn.hasItem? - damage_array.each do |dmg, items| - next if !items.include?(pkmn.item_id) - ret = dmg - ret += 20 if Settings::MECHANICS_GENERATION >= 6 - return ret + item_data = pkmn.item + if item_data + item_data.flags.each do |flag| + return [$~[1].to_i, 10].max if flag[/^NaturalGift_(?:\w+)_(\d+)$/i] end end + return 1 when "ThrowUserItemAtTarget" - fling_powers = { - 130 => [:IRONBALL - ], - 100 => [:HARDSTONE,:RAREBONE, - # Fossils - :ARMORFOSSIL,:CLAWFOSSIL,:COVERFOSSIL,:DOMEFOSSIL,:HELIXFOSSIL, - :JAWFOSSIL,:OLDAMBER,:PLUMEFOSSIL,:ROOTFOSSIL,:SAILFOSSIL, - :SKULLFOSSIL - ], - 90 => [:DEEPSEATOOTH,:GRIPCLAW,:THICKCLUB, - # Plates - :DRACOPLATE,:DREADPLATE,:EARTHPLATE,:FISTPLATE,:FLAMEPLATE, - :ICICLEPLATE,:INSECTPLATE,:IRONPLATE,:MEADOWPLATE,:MINDPLATE, - :PIXIEPLATE,:SKYPLATE,:SPLASHPLATE,:SPOOKYPLATE,:STONEPLATE, - :TOXICPLATE,:ZAPPLATE - ], - 80 => [:ASSAULTVEST,:CHIPPEDPOT,:CRACKEDPOT,:DAWNSTONE,:DUSKSTONE, - :ELECTIRIZER,:HEAVYDUTYBOOTS,:MAGMARIZER,:ODDKEYSTONE,:OVALSTONE, - :PROTECTOR,:QUICKCLAW,:RAZORCLAW,:SACHET,:SAFETYGOGGLES, - :SHINYSTONE,:STICKYBARB,:WEAKNESSPOLICY,:WHIPPEDDREAM - ], - 70 => [:DRAGONFANG,:POISONBARB, - # EV-training items (Macho Brace is 60) - :POWERANKLET,:POWERBAND,:POWERBELT,:POWERBRACER,:POWERLENS, - :POWERWEIGHT, - # Drives - :BURNDRIVE,:CHILLDRIVE,:DOUSEDRIVE,:SHOCKDRIVE - ], - 60 => [:ADAMANTORB,:DAMPROCK,:GRISEOUSORB,:HEATROCK,:LEEK,:LUSTROUSORB, - :MACHOBRACE,:ROCKYHELMET,:STICK,:TERRAINEXTENDER - ], - 50 => [:DUBIOUSDISC,:SHARPBEAK, - # Memories - :BUGMEMORY,:DARKMEMORY,:DRAGONMEMORY,:ELECTRICMEMORY,:FAIRYMEMORY, - :FIGHTINGMEMORY,:FIREMEMORY,:FLYINGMEMORY,:GHOSTMEMORY, - :GRASSMEMORY,:GROUNDMEMORY,:ICEMEMORY,:POISONMEMORY, - :PSYCHICMEMORY,:ROCKMEMORY,:STEELMEMORY,:WATERMEMORY - ], - 40 => [:EVIOLITE,:ICYROCK,:LUCKYPUNCH - ], - 30 => [:ABSORBBULB,:ADRENALINEORB,:AMULETCOIN,:BINDINGBAND,:BLACKBELT, - :BLACKGLASSES,:BLACKSLUDGE,:BOTTLECAP,:CELLBATTERY,:CHARCOAL, - :CLEANSETAG,:DEEPSEASCALE,:DRAGONSCALE,:EJECTBUTTON,:ESCAPEROPE, - :EXPSHARE,:FLAMEORB,:FLOATSTONE,:FLUFFYTAIL,:GOLDBOTTLECAP, - :HEARTSCALE,:HONEY,:KINGSROCK,:LIFEORB,:LIGHTBALL,:LIGHTCLAY, - :LUCKYEGG,:LUMINOUSMOSS,:MAGNET,:METALCOAT,:METRONOME, - :MIRACLESEED,:MYSTICWATER,:NEVERMELTICE,:PASSORB,:POKEDOLL, - :POKETOY,:PRISMSCALE,:PROTECTIVEPADS,:RAZORFANG,:SACREDASH, - :SCOPELENS,:SHELLBELL,:SHOALSALT,:SHOALSHELL,:SMOKEBALL,:SNOWBALL, - :SOULDEW,:SPELLTAG,:TOXICORB,:TWISTEDSPOON,:UPGRADE, - # Healing items - :ANTIDOTE,:AWAKENING,:BERRYJUICE,:BIGMALASADA,:BLUEFLUTE, - :BURNHEAL,:CASTELIACONE,:ELIXIR,:ENERGYPOWDER,:ENERGYROOT,:ETHER, - :FRESHWATER,:FULLHEAL,:FULLRESTORE,:HEALPOWDER,:HYPERPOTION, - :ICEHEAL,:LAVACOOKIE,:LEMONADE,:LUMIOSEGALETTE,:MAXELIXIR, - :MAXETHER,:MAXHONEY,:MAXPOTION,:MAXREVIVE,:MOOMOOMILK,:OLDGATEAU, - :PARALYZEHEAL,:PARLYZHEAL,:PEWTERCRUNCHIES,:POTION,:RAGECANDYBAR, - :REDFLUTE,:REVIVALHERB,:REVIVE,:SHALOURSABLE,:SODAPOP, - :SUPERPOTION,:SWEETHEART,:YELLOWFLUTE, - # Battle items - :XACCURACY,:XACCURACY2,:XACCURACY3,:XACCURACY6, - :XATTACK,:XATTACK2,:XATTACK3,:XATTACK6, - :XDEFEND,:XDEFEND2,:XDEFEND3,:XDEFEND6, - :XDEFENSE,:XDEFENSE2,:XDEFENSE3,:XDEFENSE6, - :XSPATK,:XSPATK2,:XSPATK3,:XSPATK6, - :XSPECIAL,:XSPECIAL2,:XSPECIAL3,:XSPECIAL6, - :XSPDEF,:XSPDEF2,:XSPDEF3,:XSPDEF6, - :XSPEED,:XSPEED2,:XSPEED3,:XSPEED6, - :DIREHIT,:DIREHIT2,:DIREHIT3, - :ABILITYURGE,:GUARDSPEC,:ITEMDROP,:ITEMURGE,:RESETURGE, - :MAXMUSHROOMS, - # Vitamins - :CALCIUM,:CARBOS,:HPUP,:IRON,:PPUP,:PPMAX,:PROTEIN,:ZINC, - :RARECANDY, - # Most evolution stones (see also 80) - :EVERSTONE,:FIRESTONE,:ICESTONE,:LEAFSTONE,:MOONSTONE,:SUNSTONE, - :THUNDERSTONE,:WATERSTONE,:SWEETAPPLE,:TARTAPPLE, :GALARICACUFF, - :GALARICAWREATH, - # Repels - :MAXREPEL,:REPEL,:SUPERREPEL, - # Mulches - :AMAZEMULCH,:BOOSTMULCH,:DAMPMULCH,:GOOEYMULCH,:GROWTHMULCH, - :RICHMULCH,:STABLEMULCH,:SURPRISEMULCH, - # Shards - :BLUESHARD,:GREENSHARD,:REDSHARD,:YELLOWSHARD, - # Valuables - :BALMMUSHROOM,:BIGMUSHROOM,:BIGNUGGET,:BIGPEARL,:COMETSHARD, - :NUGGET,:PEARL,:PEARLSTRING,:RELICBAND,:RELICCOPPER,:RELICCROWN, - :RELICGOLD,:RELICSILVER,:RELICSTATUE,:RELICVASE,:STARDUST, - :STARPIECE,:STRANGESOUVENIR,:TINYMUSHROOM, - # Exp Candies - :EXPCANDYXS, :EXPCANDYS, :EXPCANDYM, :EXPCANDYL, :EXPCANDYXL - ], - 20 => [# Feathers - :CLEVERFEATHER,:GENIUSFEATHER,:HEALTHFEATHER,:MUSCLEFEATHER, - :PRETTYFEATHER,:RESISTFEATHER,:SWIFTFEATHER, - :CLEVERWING,:GENIUSWING,:HEALTHWING,:MUSCLEWING,:PRETTYWING, - :RESISTWING,:SWIFTWING - ], - 10 => [:AIRBALLOON,:BIGROOT,:BRIGHTPOWDER,:CHOICEBAND,:CHOICESCARF, - :CHOICESPECS,:DESTINYKNOT,:DISCOUNTCOUPON,:EXPERTBELT,:FOCUSBAND, - :FOCUSSASH,:LAGGINGTAIL,:LEFTOVERS,:MENTALHERB,:METALPOWDER, - :MUSCLEBAND,:POWERHERB,:QUICKPOWDER,:REAPERCLOTH,:REDCARD, - :RINGTARGET,:SHEDSHELL,:SILKSCARF,:SILVERPOWDER,:SMOOTHROCK, - :SOFTSAND,:SOOTHEBELL,:WHITEHERB,:WIDELENS,:WISEGLASSES,:ZOOMLENS, - # Terrain seeds - :ELECTRICSEED,:GRASSYSEED,:MISTYSEED,:PSYCHICSEED, - # Nectar - :PINKNECTAR,:PURPLENECTAR,:REDNECTAR,:YELLOWNECTAR, - # Incenses - :FULLINCENSE,:LAXINCENSE,:LUCKINCENSE,:ODDINCENSE,:PUREINCENSE, - :ROCKINCENSE,:ROSEINCENSE,:SEAINCENSE,:WAVEINCENSE, - # Scarves - :BLUESCARF,:GREENSCARF,:PINKSCARF,:REDSCARF,:YELLOWSCARF, - # Mints - :LONELYMINT, :ADAMANTMINT, :NAUGHTYMINT, :BRAVEMINT, :BOLDMINT, - :IMPISHMINT, :LAXMINT, :RELAXEDMINT, :MODESTMINT, :MILDMINT, - :RASHMINT, :QUIETMINT, :CALMMINT, :GENTLEMINT, :CAREFULMINT, - :SASSYMINT, :TIMIDMINT, :HASTYMINT, :JOLLYMINT, :NAIVEMINT, - :SERIOUSMINT, - # Sweets - :STRAWBERRYSWEET, :LOVESWEET, :BERRYSWEET, :CLOVERSWEET, - :FLOWERSWEET, :STARSWEET, :RIBBONSWEET - ] - } - return 0 if !pkmn.item - return 10 if pkmn.item.is_berry? - return 80 if pkmn.item.is_mega_stone? - if pkmn.item.is_TR? - ret = GameData::Move.get(pkmn.item.move).power - ret = 10 if ret < 10 - return ret + item_data = pkmn.item + if item_data + item_data.flags.each do |flag| + return [$~[1].to_i, 10].max if flag[/^Fling_(\d+)$/i] + end + return 10 end - fling_powers.each do |power,items| - return power if items.include?(pkmn.item_id) - end - return 10 + return 0 when "PowerHigherWithUserHP" return [150 * pkmn.hp / pkmn.totalhp, 1].max when "PowerLowerWithUserHP" diff --git a/Data/Scripts/011_Battle/002_Battler/004_Battler_Statuses.rb b/Data/Scripts/011_Battle/002_Battler/004_Battler_Statuses.rb index cc9735d47..2646fbeb4 100644 --- a/Data/Scripts/011_Battle/002_Battler/004_Battler_Statuses.rb +++ b/Data/Scripts/011_Battle/002_Battler/004_Battler_Statuses.rb @@ -309,8 +309,8 @@ class Battle::Battler return true end - def pbSleep(msg = nil) - pbInflictStatus(:SLEEP, pbSleepDuration, msg) + def pbSleep(user = nil, msg = nil) + pbInflictStatus(:SLEEP, pbSleepDuration, msg, user) end def pbSleepSelf(msg = nil, duration = -1) @@ -391,8 +391,8 @@ class Battle::Battler return pbCanInflictStatus?(:FROZEN, user, showMessages, move) end - def pbFreeze(msg = nil) - pbInflictStatus(:FROZEN, 0, msg) + def pbFreeze(user = nil, msg = nil) + pbInflictStatus(:FROZEN, 0, msg, user) end #============================================================================= diff --git a/Data/Scripts/011_Battle/002_Battler/006_Battler_AbilityAndItem.rb b/Data/Scripts/011_Battle/002_Battler/006_Battler_AbilityAndItem.rb index 3e5005b54..60bd5fb7c 100644 --- a/Data/Scripts/011_Battle/002_Battler/006_Battler_AbilityAndItem.rb +++ b/Data/Scripts/011_Battle/002_Battler/006_Battler_AbilityAndItem.rb @@ -449,6 +449,7 @@ class Battle::Battler end def pbMoveTypeWeakeningBerry(berry_type, move_type, mults) + return false if !canConsumeBerry? return if move_type != berry_type return if !Effectiveness.super_effective?(@damageState.typeMod) && move_type != :NORMAL mults[:final_damage_multiplier] /= 2 diff --git a/Data/Scripts/011_Battle/003_Move/003_Move_UsageCalculations.rb b/Data/Scripts/011_Battle/003_Move/003_Move_UsageCalculations.rb index 0148e2efe..51678467b 100644 --- a/Data/Scripts/011_Battle/003_Move/003_Move_UsageCalculations.rb +++ b/Data/Scripts/011_Battle/003_Move/003_Move_UsageCalculations.rb @@ -181,17 +181,17 @@ class Battle::Move c = 0 # Ability effects that alter critical hit rate if c >= 0 && user.abilityActive? - c = Battle::AbilityEffects.triggerCriticalCalcFromUser(user.ability, user, target, c) + c = Battle::AbilityEffects.triggerCriticalCalcFromUser(user.ability, user, target, self, c) end if c >= 0 && target.abilityActive? && !target.beingMoldBroken? - c = Battle::AbilityEffects.triggerCriticalCalcFromTarget(target.ability, user, target, c) + c = Battle::AbilityEffects.triggerCriticalCalcFromTarget(target.ability, user, target, self, c) end # Item effects that alter critical hit rate if c >= 0 && user.itemActive? - c = Battle::ItemEffects.triggerCriticalCalcFromUser(user.item, user, target, c) + c = Battle::ItemEffects.triggerCriticalCalcFromUser(user.item, user, target, self, c) end if c >= 0 && target.itemActive? - c = Battle::ItemEffects.triggerCriticalCalcFromTarget(target.item, user, target, c) + c = Battle::ItemEffects.triggerCriticalCalcFromTarget(target.item, user, target, self, c) end return false if c < 0 # Move-specific "always/never a critical hit" effects diff --git a/Data/Scripts/011_Battle/003_Move/007_MoveEffects_BattlerOther.rb b/Data/Scripts/011_Battle/003_Move/007_MoveEffects_BattlerOther.rb index 3503c9e81..f663fa865 100644 --- a/Data/Scripts/011_Battle/003_Move/007_MoveEffects_BattlerOther.rb +++ b/Data/Scripts/011_Battle/003_Move/007_MoveEffects_BattlerOther.rb @@ -11,12 +11,12 @@ class Battle::Move::SleepTarget < Battle::Move def pbEffectAgainstTarget(user, target) return if damagingMove? - target.pbSleep + target.pbSleep(user) end def pbAdditionalEffect(user, target) return if target.damageState.substitute - target.pbSleep if target.pbCanSleep?(user, false, self) + target.pbSleep(user) if target.pbCanSleep?(user, false, self) end end @@ -331,12 +331,12 @@ class Battle::Move::FreezeTarget < Battle::Move def pbEffectAgainstTarget(user, target) return if damagingMove? - target.pbFreeze + target.pbFreeze(user) end def pbAdditionalEffect(user, target) return if target.damageState.substitute - target.pbFreeze if target.pbCanFreeze?(user, false, self) + target.pbFreeze(user) if target.pbCanFreeze?(user, false, self) end end @@ -371,7 +371,7 @@ class Battle::Move::FreezeFlinchTarget < Battle::Move chance = pbAdditionalEffectChance(user, target, 10) return if chance == 0 if target.pbCanFreeze?(user, false, self) && @battle.pbRandom(100) < chance - target.pbFreeze + target.pbFreeze(user) end target.pbFlinch(user) if @battle.pbRandom(100) < chance end @@ -385,7 +385,7 @@ class Battle::Move::ParalyzeBurnOrFreezeTarget < Battle::Move return if target.damageState.substitute case @battle.pbRandom(3) when 0 then target.pbBurn(user) if target.pbCanBurn?(user, false, self) - when 1 then target.pbFreeze if target.pbCanFreeze?(user, false, self) + when 1 then target.pbFreeze(user) if target.pbCanFreeze?(user, false, self) when 2 then target.pbParalyze(user) if target.pbCanParalyze?(user, false, self) end end @@ -400,7 +400,7 @@ class Battle::Move::PoisonParalyzeOrSleepTarget < Battle::Move case @battle.pbRandom(3) when 0 then target.pbPoison(user) if target.pbCanPoison?(user, false, self) when 1 then target.pbParalyze(user) if target.pbCanParalyze?(user, false, self) - when 2 then target.pbSleep if target.pbCanSleep?(user, false, self) + when 2 then target.pbSleep(user) if target.pbCanSleep?(user, false, self) end end end @@ -429,7 +429,7 @@ class Battle::Move::GiveUserStatusToTarget < Battle::Move msg = "" case user.status when :SLEEP - target.pbSleep + target.pbSleep(user) msg = _INTL("{1} woke up.", user.pbThis) when :POISON target.pbPoison(user, nil, user.statusCount != 0) @@ -441,7 +441,7 @@ class Battle::Move::GiveUserStatusToTarget < Battle::Move target.pbParalyze(user) msg = _INTL("{1} was cured of paralysis.", user.pbThis) when :FROZEN - target.pbFreeze + target.pbFreeze(user) msg = _INTL("{1} was thawed out.", user.pbThis) end if msg != "" diff --git a/Data/Scripts/011_Battle/003_Move/012_MoveEffects_ChangeMoveEffect.rb b/Data/Scripts/011_Battle/003_Move/012_MoveEffects_ChangeMoveEffect.rb index e12550a4f..0da29932c 100644 --- a/Data/Scripts/011_Battle/003_Move/012_MoveEffects_ChangeMoveEffect.rb +++ b/Data/Scripts/011_Battle/003_Move/012_MoveEffects_ChangeMoveEffect.rb @@ -278,13 +278,13 @@ class Battle::Move::EffectDependsOnEnvironment < Battle::Move return if @battle.pbRandom(100) >= chance case @secretPower when 2 - target.pbSleep if target.pbCanSleep?(user, false, self) + target.pbSleep(user) if target.pbCanSleep?(user, false, self) when 10 target.pbBurn(user) if target.pbCanBurn?(user, false, self) when 0, 1 target.pbParalyze(user) if target.pbCanParalyze?(user, false, self) when 9 - target.pbFreeze if target.pbCanFreeze?(user, false, self) + target.pbFreeze(user) if target.pbCanFreeze?(user, false, self) when 5 if target.pbCanLowerStatStage?(:ATTACK, user, self) target.pbLowerStatStage(:ATTACK, 1, user) diff --git a/Data/Scripts/011_Battle/004_Scene/003_Scene_ChooseCommands.rb b/Data/Scripts/011_Battle/004_Scene/003_Scene_ChooseCommands.rb index 3b61c5afa..5586759fe 100644 --- a/Data/Scripts/011_Battle/004_Scene/003_Scene_ChooseCommands.rb +++ b/Data/Scripts/011_Battle/004_Scene/003_Scene_ChooseCommands.rb @@ -242,11 +242,19 @@ class Battle::Scene case useType when 1 # Use on Pokémon if @battle.pbTeamLengthFromBattlerIndex(idxBattler) == 1 - break if yield item.id, useType, @battle.battlers[idxBattler].pokemonIndex, -1, itemScene + if yield item.id, useType, @battle.battlers[idxBattler].pokemonIndex, -1, itemScene + break + else + next + end end when 3 # Use on battler if @battle.pbPlayerBattlerCount == 1 - break if yield item.id, useType, @battle.battlers[idxBattler].pokemonIndex, -1, itemScene + if yield item.id, useType, @battle.battlers[idxBattler].pokemonIndex, -1, itemScene + break + else + next + end end end # Fade out and hide Bag screen diff --git a/Data/Scripts/011_Battle/004_Scene/005_Battle_Scene_Menus.rb b/Data/Scripts/011_Battle/004_Scene/005_Battle_Scene_Menus.rb index 674935ef3..cc2c53cb3 100644 --- a/Data/Scripts/011_Battle/004_Scene/005_Battle_Scene_Menus.rb +++ b/Data/Scripts/011_Battle/004_Scene/005_Battle_Scene_Menus.rb @@ -208,7 +208,7 @@ class Battle::Scene::FightMenu < Battle::Scene::MenuBase # pbShowWindow to make the graphic appear while the command menu is being # displayed. USE_GRAPHICS = true - TYPE_ICON_HEIGHT = 28 + TYPE_ICON_HEIGHT = GameData::Type::ICON_SIZE[1] # Text colours of PP of selected move PP_COLORS = [ Color.new(248, 72, 72), Color.new(136, 48, 48), # Red, zero PP diff --git a/Data/Scripts/011_Battle/005_AI/011_AIMove.rb b/Data/Scripts/011_Battle/005_AI/011_AIMove.rb index f06e52da6..06dd8d061 100644 --- a/Data/Scripts/011_Battle/005_AI/011_AIMove.rb +++ b/Data/Scripts/011_Battle/005_AI/011_AIMove.rb @@ -503,23 +503,23 @@ class Battle::AI::AIMove # Ability effects that alter critical hit rate if user.ability_active? crit_stage = Battle::AbilityEffects.triggerCriticalCalcFromUser(user_battler.ability, - user_battler, target_battler, crit_stage) + user_battler, target_battler, @move, crit_stage) return -1 if crit_stage < 0 end if target.ability_active? && !target.being_mold_broken? crit_stage = Battle::AbilityEffects.triggerCriticalCalcFromTarget(target_battler.ability, - user_battler, target_battler, crit_stage) + user_battler, target_battler, @move, crit_stage) return -1 if crit_stage < 0 end # Item effects that alter critical hit rate if user.item_active? crit_stage = Battle::ItemEffects.triggerCriticalCalcFromUser(user_battler.item, - user_battler, target_battler, crit_stage) + user_battler, target_battler, @move, crit_stage) return -1 if crit_stage < 0 end if target.item_active? crit_stage = Battle::ItemEffects.triggerCriticalCalcFromTarget(user_battler.item, - user_battler, target_battler, crit_stage) + user_battler, target_battler, @move, crit_stage) return -1 if crit_stage < 0 end # Other effects diff --git a/Data/Scripts/011_Battle/006_AI MoveEffects/004_AI_MoveEffects_MoveAttributes.rb b/Data/Scripts/011_Battle/006_AI MoveEffects/004_AI_MoveEffects_MoveAttributes.rb index bffca44bb..346333acc 100644 --- a/Data/Scripts/011_Battle/006_AI MoveEffects/004_AI_MoveEffects_MoveAttributes.rb +++ b/Data/Scripts/011_Battle/006_AI MoveEffects/004_AI_MoveEffects_MoveAttributes.rb @@ -448,11 +448,11 @@ Battle::AI::Handlers::MoveEffectScore.add("EnsureNextCriticalHit", crit_stage = -1 if user.battler.pbOwnSide.effects[PBEffects::LuckyChant] > 0 if crit_stage >= 0 && user.ability_active? && ![:MERCILESS].include?(user.ability_id) crit_stage = Battle::AbilityEffects.triggerCriticalCalcFromUser(user.battler.ability, - user.battler, user.battler, crit_stage) + user.battler, user.battler, move.move, crit_stage) end if crit_stage >= 0 && user.item_active? crit_stage = Battle::ItemEffects.triggerCriticalCalcFromUser(user.battler.item, - user.battler, user.battler, crit_stage) + user.battler, user.battler, move.move, crit_stage) end if crit_stage >= 0 && crit_stage < 50 crit_stage += user.effects[PBEffects::FocusEnergy] @@ -487,12 +487,12 @@ Battle::AI::Handlers::MoveEffectScore.add("StartPreventCriticalHitsAgainstUserSi crit_stage = 0 if b.ability_active? crit_stage = Battle::AbilityEffects.triggerCriticalCalcFromTarget(b.battler.ability, - b.battler, b.battler, crit_stage) + b.battler, b.battler, move.move, crit_stage) next if crit_stage < 0 end if b.item_active? crit_stage = Battle::ItemEffects.triggerCriticalCalcFromTarget(b.battler.item, - b.battler, b.battler, crit_stage) + b.battler, b.battler, move.move, crit_stage) next if crit_stage < 0 end user_side_immune = false @@ -505,12 +505,12 @@ Battle::AI::Handlers::MoveEffectScore.add("StartPreventCriticalHitsAgainstUserSi crit_stage = 0 if crit_stage >= 0 && b.ability_active? crit_stage = Battle::AbilityEffects.triggerCriticalCalcFromUser(b.battler.ability, - b.battler, user.battler, crit_stage) + b.battler, user.battler, move.move, crit_stage) next if crit_stage < 0 end if crit_stage >= 0 && b.item_active? crit_stage = Battle::ItemEffects.triggerCriticalCalcFromUser(b.battler.item, - b.battler, user.battler, crit_stage) + b.battler, user.battler, move.move, crit_stage) next if crit_stage < 0 end if crit_stage >= 0 && crit_stage < 50 diff --git a/Data/Scripts/011_Battle/007_Other battle code/008_Battle_AbilityEffects.rb b/Data/Scripts/011_Battle/007_Other battle code/008_Battle_AbilityEffects.rb index 9d2c122e9..c0ce2f6c8 100644 --- a/Data/Scripts/011_Battle/007_Other battle code/008_Battle_AbilityEffects.rb +++ b/Data/Scripts/011_Battle/007_Other battle code/008_Battle_AbilityEffects.rb @@ -205,12 +205,12 @@ module Battle::AbilityEffects DamageCalcFromTargetAlly.trigger(ability, user, target, move, mults, power, type) end - def self.triggerCriticalCalcFromUser(ability, user, target, crit_stage) - return trigger(CriticalCalcFromUser, ability, user, target, crit_stage, ret: crit_stage) + def self.triggerCriticalCalcFromUser(ability, user, target, move, crit_stage) + return trigger(CriticalCalcFromUser, ability, user, target, move, crit_stage, ret: crit_stage) end - def self.triggerCriticalCalcFromTarget(ability, user, target, crit_stage) - return trigger(CriticalCalcFromTarget, ability, user, target, crit_stage, ret: crit_stage) + def self.triggerCriticalCalcFromTarget(ability, user, target, move, crit_stage) + return trigger(CriticalCalcFromTarget, ability, user, target, move, crit_stage, ret: crit_stage) end #============================================================================= @@ -1693,13 +1693,13 @@ Battle::AbilityEffects::DamageCalcFromTargetAlly.add(:FRIENDGUARD, #=============================================================================== Battle::AbilityEffects::CriticalCalcFromUser.add(:MERCILESS, - proc { |ability, user, target, c| + proc { |ability, user, target, move, c| next 99 if target.poisoned? } ) Battle::AbilityEffects::CriticalCalcFromUser.add(:SUPERLUCK, - proc { |ability, user, target, c| + proc { |ability, user, target, move, c| next c + 1 } ) @@ -1709,7 +1709,7 @@ Battle::AbilityEffects::CriticalCalcFromUser.add(:SUPERLUCK, #=============================================================================== Battle::AbilityEffects::CriticalCalcFromTarget.add(:BATTLEARMOR, - proc { |ability, user, target, c| + proc { |ability, user, target, move, c| next -1 } ) @@ -1847,7 +1847,7 @@ Battle::AbilityEffects::OnBeingHit.add(:EFFECTSPORE, msg = _INTL("{1}'s {2} made {3} fall asleep!", target.pbThis, target.abilityName, user.pbThis(true)) end - user.pbSleep(msg) + user.pbSleep(target, msg) end when 1 if user.pbCanPoison?(target, Battle::Scene::USE_ABILITY_SPLASH) diff --git a/Data/Scripts/011_Battle/007_Other battle code/009_Battle_ItemEffects.rb b/Data/Scripts/011_Battle/007_Other battle code/009_Battle_ItemEffects.rb index 544bbafa8..1f985057d 100644 --- a/Data/Scripts/011_Battle/007_Other battle code/009_Battle_ItemEffects.rb +++ b/Data/Scripts/011_Battle/007_Other battle code/009_Battle_ItemEffects.rb @@ -125,12 +125,12 @@ module Battle::ItemEffects DamageCalcFromTarget.trigger(item, user, target, move, mults, power, type) end - def self.triggerCriticalCalcFromUser(item, user, target, crit_stage) - return trigger(CriticalCalcFromUser, item, user, target, crit_stage, ret: crit_stage) + def self.triggerCriticalCalcFromUser(item, user, target, move, crit_stage) + return trigger(CriticalCalcFromUser, item, user, target, move, crit_stage, ret: crit_stage) end - def self.triggerCriticalCalcFromTarget(item, user, target, crit_stage) - return trigger(CriticalCalcFromTarget, item, user, target, crit_stage, ret: crit_stage) + def self.triggerCriticalCalcFromTarget(item, user, target, move, crit_stage) + return trigger(CriticalCalcFromTarget, item, user, target, move, crit_stage, ret: crit_stage) end #============================================================================= @@ -1280,13 +1280,13 @@ Battle::ItemEffects::DamageCalcFromTarget.add(:YACHEBERRY, #=============================================================================== Battle::ItemEffects::CriticalCalcFromUser.add(:LUCKYPUNCH, - proc { |item, user, target, c| + proc { |item, user, target, move, c| next c + 2 if user.isSpecies?(:CHANSEY) } ) Battle::ItemEffects::CriticalCalcFromUser.add(:RAZORCLAW, - proc { |item, user, target, c| + proc { |item, user, target, move, c| next c + 1 } ) @@ -1294,7 +1294,7 @@ Battle::ItemEffects::CriticalCalcFromUser.add(:RAZORCLAW, Battle::ItemEffects::CriticalCalcFromUser.copy(:RAZORCLAW, :SCOPELENS) Battle::ItemEffects::CriticalCalcFromUser.add(:LEEK, - proc { |item, user, target, c| + proc { |item, user, target, move, c| next c + 2 if user.isSpecies?(:FARFETCHD) || user.isSpecies?(:SIRFETCHD) } ) diff --git a/Data/Scripts/016_UI/006_UI_Summary.rb b/Data/Scripts/016_UI/006_UI_Summary.rb index 8a7dff8b8..360369db4 100644 --- a/Data/Scripts/016_UI/006_UI_Summary.rb +++ b/Data/Scripts/016_UI/006_UI_Summary.rb @@ -465,8 +465,8 @@ class PokemonSummary_Scene # Draw Pokémon type(s) @pokemon.types.each_with_index do |type, i| type_number = GameData::Type.get(type).icon_position - type_rect = Rect.new(0, type_number * 28, 64, 28) - type_x = (@pokemon.types.length == 1) ? 402 : 370 + (66 * i) + type_rect = Rect.new(0, type_number * GameData::Type::ICON_SIZE[1], *GameData::Type::ICON_SIZE) + type_x = (@pokemon.types.length == 1) ? 402 : 370 + ((GameData::Type::ICON_SIZE[0] + 2) * i) overlay.blt(type_x, 146, @typebitmap.bitmap, type_rect) end # Draw Exp bar @@ -712,7 +712,7 @@ class PokemonSummary_Scene move = @pokemon.moves[i] if move type_number = GameData::Type.get(move.display_type(@pokemon)).icon_position - imagepos.push([_INTL("Graphics/UI/types"), 248, yPos - 4, 0, type_number * 28, 64, 28]) + imagepos.push([_INTL("Graphics/UI/types"), 248, yPos - 4, 0, type_number * GameData::Type::ICON_SIZE[1], *GameData::Type::ICON_SIZE]) textpos.push([move.name, 316, yPos, :left, moveBase, moveShadow]) if move.total_pp > 0 textpos.push([_INTL("PP"), 342, yPos + 32, :left, moveBase, moveShadow]) @@ -778,7 +778,7 @@ class PokemonSummary_Scene end if move type_number = GameData::Type.get(move.display_type(@pokemon)).icon_position - imagepos.push([_INTL("Graphics/UI/types"), 248, yPos - 4, 0, type_number * 28, 64, 28]) + imagepos.push([_INTL("Graphics/UI/types"), 248, yPos - 4, 0, type_number * GameData::Type::ICON_SIZE[1], *GameData::Type::ICON_SIZE]) textpos.push([move.name, 316, yPos, :left, moveBase, moveShadow]) if move.total_pp > 0 textpos.push([_INTL("PP"), 342, yPos + 32, :left, moveBase, moveShadow]) @@ -805,8 +805,8 @@ class PokemonSummary_Scene # Draw Pokémon's type icon(s) @pokemon.types.each_with_index do |type, i| type_number = GameData::Type.get(type).icon_position - type_rect = Rect.new(0, type_number * 28, 64, 28) - type_x = (@pokemon.types.length == 1) ? 130 : 96 + (70 * i) + type_rect = Rect.new(0, type_number * GameData::Type::ICON_SIZE[1], *GameData::Type::ICON_SIZE) + type_x = (@pokemon.types.length == 1) ? 130 : 96 + ((GameData::Type::ICON_SIZE[0] + 6) * i) overlay.blt(type_x, 78, @typebitmap.bitmap, type_rect) end end diff --git a/Data/Scripts/016_UI/012_UI_TrainerCard.rb b/Data/Scripts/016_UI/012_UI_TrainerCard.rb index 4d0777177..c92b73b9b 100644 --- a/Data/Scripts/016_UI/012_UI_TrainerCard.rb +++ b/Data/Scripts/016_UI/012_UI_TrainerCard.rb @@ -27,6 +27,10 @@ class PokemonTrainerCard_Scene pbSetSystemFont(@sprites["overlay"].bitmap) @sprites["trainer"] = IconSprite.new(336, 112, @viewport) @sprites["trainer"].setBitmap(GameData::TrainerType.player_front_sprite_filename($player.trainer_type)) + if !@sprites["trainer"].bitmap + raise _INTL("No trainer front sprite exists for the player character, expected a file at {1}.", + "Graphics/Trainers/" + $player.trainer_type.to_s + ".png") + end @sprites["trainer"].x -= (@sprites["trainer"].bitmap.width - 128) / 2 @sprites["trainer"].y -= (@sprites["trainer"].bitmap.height - 128) @sprites["trainer"].z = 2 diff --git a/Data/Scripts/016_UI/017_UI_PokemonStorage.rb b/Data/Scripts/016_UI/017_UI_PokemonStorage.rb index 5c4ac4766..e9afa7715 100644 --- a/Data/Scripts/016_UI/017_UI_PokemonStorage.rb +++ b/Data/Scripts/016_UI/017_UI_PokemonStorage.rb @@ -1467,10 +1467,11 @@ class PokemonStorageScene typebitmap = AnimatedBitmap.new(_INTL("Graphics/UI/types")) pokemon.types.each_with_index do |type, i| type_number = GameData::Type.get(type).icon_position - type_rect = Rect.new(0, type_number * 28, 64, 28) - type_x = (pokemon.types.length == 1) ? 52 : 18 + (70 * i) + type_rect = Rect.new(0, type_number * GameData::Type::ICON_SIZE[1], *GameData::Type::ICON_SIZE) + type_x = (pokemon.types.length == 1) ? 52 : 18 + ((GameData::Type::ICON_SIZE[0] + 6) * i) overlay.blt(type_x, 272, typebitmap.bitmap, type_rect) end + typebitmap.dispose drawMarkings(overlay, 70, 240, 128, 20, pokemon.markings) pbDrawImagePositions(overlay, imagepos) end diff --git a/Data/Scripts/016_UI/022_UI_MoveRelearner.rb b/Data/Scripts/016_UI/022_UI_MoveRelearner.rb index 407545d2f..8e70f5f56 100644 --- a/Data/Scripts/016_UI/022_UI_MoveRelearner.rb +++ b/Data/Scripts/016_UI/022_UI_MoveRelearner.rb @@ -54,8 +54,8 @@ class MoveRelearner_Scene overlay.clear @pokemon.types.each_with_index do |type, i| type_number = GameData::Type.get(type).icon_position - type_rect = Rect.new(0, type_number * 28, 64, 28) - type_x = (@pokemon.types.length == 1) ? 400 : 366 + (70 * i) + type_rect = Rect.new(0, type_number * GameData::Type::ICON_SIZE[1], *GameData::Type::ICON_SIZE) + type_x = (@pokemon.types.length == 1) ? 400 : 366 + ((GameData::Type::ICON_SIZE[0] + 6) * i) overlay.blt(type_x, 70, @typebitmap.bitmap, type_rect) end textpos = [ @@ -68,7 +68,7 @@ class MoveRelearner_Scene if moveobject moveData = GameData::Move.get(moveobject) type_number = GameData::Type.get(moveData.display_type(@pokemon)).icon_position - imagepos.push([_INTL("Graphics/UI/types"), 12, yPos - 4, 0, type_number * 28, 64, 28]) + imagepos.push([_INTL("Graphics/UI/types"), 12, yPos - 4, 0, type_number * GameData::Type::ICON_SIZE[1], *GameData::Type::ICON_SIZE]) textpos.push([moveData.name, 80, yPos, :left, Color.new(248, 248, 248), Color.black]) textpos.push([_INTL("PP"), 112, yPos + 32, :left, Color.new(64, 64, 64), Color.new(176, 176, 176)]) if moveData.total_pp > 0 diff --git a/Data/Scripts/017_Minigames/002_Minigame_TripleTriad.rb b/Data/Scripts/017_Minigames/002_Minigame_TripleTriad.rb index 8f94568f7..236bb79d8 100644 --- a/Data/Scripts/017_Minigames/002_Minigame_TripleTriad.rb +++ b/Data/Scripts/017_Minigames/002_Minigame_TripleTriad.rb @@ -94,7 +94,7 @@ class TriadCard if type typebitmap = AnimatedBitmap.new(_INTL("Graphics/UI/types")) type_number = GameData::Type.get(type).icon_position - typerect = Rect.new(0, type_number * 28, 64, 28) + typerect = Rect.new(0, type_number * GameData::Type::ICON_SIZE[1], *GameData::Type::ICON_SIZE) bitmap.blt(8, 50, typebitmap.bitmap, typerect, 192) typebitmap.dispose end @@ -116,7 +116,7 @@ class TriadCard bitmap.blt(0, 0, cardbitmap.bitmap, Rect.new(0, 0, cardbitmap.width, cardbitmap.height)) # Draw type icon type_number = GameData::Type.get(@type).icon_position - typerect = Rect.new(0, type_number * 28, 64, 28) + typerect = Rect.new(0, type_number * GameData::Type::ICON_SIZE[1], *GameData::Type::ICON_SIZE) bitmap.blt(8, 50, typebitmap.bitmap, typerect, 192) # Draw Pokémon icon bitmap.blt(8, 24, iconbitmap.bitmap, Rect.new(0, 0, 64, 64)) diff --git a/Data/Scripts/999_Main/999_Main.rb b/Data/Scripts/999_Main/999_Main.rb index 1dc013c24..eaf2bf933 100644 --- a/Data/Scripts/999_Main/999_Main.rb +++ b/Data/Scripts/999_Main/999_Main.rb @@ -9,7 +9,7 @@ class Scene_DebugIntro end def pbCallTitle - return Scene_DebugIntro.new if $DEBUG + return Scene_DebugIntro.new if $DEBUG && Settings::SKIP_TITLE_SCREEN return Scene_Intro.new end