Added SKIP_TITLE_SCREEN Setting, added const for type icon size, fixed some battle bugs and inconsistencies

This commit is contained in:
Maruno17
2024-06-25 15:55:10 +01:00
parent ff2d8e5f55
commit 195c34a7c8
20 changed files with 101 additions and 243 deletions

View File

@@ -514,6 +514,10 @@ module Settings
# start the game (in Debug mode). You will not need to hold Ctrl/Shift to # start the game (in Debug mode). You will not need to hold Ctrl/Shift to
# compile anything. # compile anything.
PROMPT_TO_COMPILE = false 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 # 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 # a saved game (if there is one) or start a new game (if there isn't). Only
# applies to playing in Debug mode. # applies to playing in Debug mode.

View File

@@ -27,6 +27,8 @@ module GameData
"Flags" => [:flags, "*s"] "Flags" => [:flags, "*s"]
} }
ICON_SIZE = [64, 28]
extend ClassMethodsSymbols extend ClassMethodsSymbols
include InstanceMethods include InstanceMethods

View File

@@ -109,31 +109,16 @@ module GameData
when "TypeDependsOnUserIVs" when "TypeDependsOnUserIVs"
return pbHiddenPower(pkmn)[0] return pbHiddenPower(pkmn)[0]
when "TypeAndPowerDependOnUserBerry" when "TypeAndPowerDependOnUserBerry"
type_array = { item_data = pkmn.item
:NORMAL => [:CHILANBERRY], if item_data
:FIRE => [:CHERIBERRY, :BLUKBERRY, :WATMELBERRY, :OCCABERRY], item_data.flags.each do |flag|
:WATER => [:CHESTOBERRY, :NANABBERRY, :DURINBERRY, :PASSHOBERRY], next if !flag[/^NaturalGift_(\w+)_(?:\d+)$/i]
:ELECTRIC => [:PECHABERRY, :WEPEARBERRY, :BELUEBERRY, :WACANBERRY], typ = $~[1].to_sym
:GRASS => [:RAWSTBERRY, :PINAPBERRY, :RINDOBERRY, :LIECHIBERRY], ret = typ if GameData::Type.exists?(typ)
:ICE => [:ASPEARBERRY, :POMEGBERRY, :YACHEBERRY, :GANLONBERRY], break
: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)
end end
end end
return :NORMAL
when "TypeDependsOnUserPlate" when "TypeDependsOnUserPlate"
item_types = { item_types = {
:FISTPLATE => :FIGHTING, :FISTPLATE => :FIGHTING,
@@ -209,169 +194,22 @@ module GameData
when "TypeDependsOnUserIVs" when "TypeDependsOnUserIVs"
return pbHiddenPower(pkmn)[1] return pbHiddenPower(pkmn)[1]
when "TypeAndPowerDependOnUserBerry" when "TypeAndPowerDependOnUserBerry"
damage_array = { item_data = pkmn.item
60 => [:CHERIBERRY, :CHESTOBERRY, :PECHABERRY, :RAWSTBERRY, :ASPEARBERRY, if item_data
:LEPPABERRY, :ORANBERRY, :PERSIMBERRY, :LUMBERRY, :SITRUSBERRY, item_data.flags.each do |flag|
:FIGYBERRY, :WIKIBERRY, :MAGOBERRY, :AGUAVBERRY, :IAPAPABERRY, return [$~[1].to_i, 10].max if flag[/^NaturalGift_(?:\w+)_(\d+)$/i]
: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
end end
end end
return 1
when "ThrowUserItemAtTarget" when "ThrowUserItemAtTarget"
fling_powers = { item_data = pkmn.item
130 => [:IRONBALL if item_data
], item_data.flags.each do |flag|
100 => [:HARDSTONE,:RAREBONE, return [$~[1].to_i, 10].max if flag[/^Fling_(\d+)$/i]
# 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
end
fling_powers.each do |power,items|
return power if items.include?(pkmn.item_id)
end end
return 10 return 10
end
return 0
when "PowerHigherWithUserHP" when "PowerHigherWithUserHP"
return [150 * pkmn.hp / pkmn.totalhp, 1].max return [150 * pkmn.hp / pkmn.totalhp, 1].max
when "PowerLowerWithUserHP" when "PowerLowerWithUserHP"

View File

@@ -309,8 +309,8 @@ class Battle::Battler
return true return true
end end
def pbSleep(msg = nil) def pbSleep(user = nil, msg = nil)
pbInflictStatus(:SLEEP, pbSleepDuration, msg) pbInflictStatus(:SLEEP, pbSleepDuration, msg, user)
end end
def pbSleepSelf(msg = nil, duration = -1) def pbSleepSelf(msg = nil, duration = -1)
@@ -391,8 +391,8 @@ class Battle::Battler
return pbCanInflictStatus?(:FROZEN, user, showMessages, move) return pbCanInflictStatus?(:FROZEN, user, showMessages, move)
end end
def pbFreeze(msg = nil) def pbFreeze(user = nil, msg = nil)
pbInflictStatus(:FROZEN, 0, msg) pbInflictStatus(:FROZEN, 0, msg, user)
end end
#============================================================================= #=============================================================================

View File

@@ -449,6 +449,7 @@ class Battle::Battler
end end
def pbMoveTypeWeakeningBerry(berry_type, move_type, mults) def pbMoveTypeWeakeningBerry(berry_type, move_type, mults)
return false if !canConsumeBerry?
return if move_type != berry_type return if move_type != berry_type
return if !Effectiveness.super_effective?(@damageState.typeMod) && move_type != :NORMAL return if !Effectiveness.super_effective?(@damageState.typeMod) && move_type != :NORMAL
mults[:final_damage_multiplier] /= 2 mults[:final_damage_multiplier] /= 2

View File

@@ -181,17 +181,17 @@ class Battle::Move
c = 0 c = 0
# Ability effects that alter critical hit rate # Ability effects that alter critical hit rate
if c >= 0 && user.abilityActive? 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 end
if c >= 0 && target.abilityActive? && !target.beingMoldBroken? 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 end
# Item effects that alter critical hit rate # Item effects that alter critical hit rate
if c >= 0 && user.itemActive? 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 end
if c >= 0 && target.itemActive? 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 end
return false if c < 0 return false if c < 0
# Move-specific "always/never a critical hit" effects # Move-specific "always/never a critical hit" effects

View File

@@ -11,12 +11,12 @@ class Battle::Move::SleepTarget < Battle::Move
def pbEffectAgainstTarget(user, target) def pbEffectAgainstTarget(user, target)
return if damagingMove? return if damagingMove?
target.pbSleep target.pbSleep(user)
end end
def pbAdditionalEffect(user, target) def pbAdditionalEffect(user, target)
return if target.damageState.substitute return if target.damageState.substitute
target.pbSleep if target.pbCanSleep?(user, false, self) target.pbSleep(user) if target.pbCanSleep?(user, false, self)
end end
end end
@@ -331,12 +331,12 @@ class Battle::Move::FreezeTarget < Battle::Move
def pbEffectAgainstTarget(user, target) def pbEffectAgainstTarget(user, target)
return if damagingMove? return if damagingMove?
target.pbFreeze target.pbFreeze(user)
end end
def pbAdditionalEffect(user, target) def pbAdditionalEffect(user, target)
return if target.damageState.substitute return if target.damageState.substitute
target.pbFreeze if target.pbCanFreeze?(user, false, self) target.pbFreeze(user) if target.pbCanFreeze?(user, false, self)
end end
end end
@@ -371,7 +371,7 @@ class Battle::Move::FreezeFlinchTarget < Battle::Move
chance = pbAdditionalEffectChance(user, target, 10) chance = pbAdditionalEffectChance(user, target, 10)
return if chance == 0 return if chance == 0
if target.pbCanFreeze?(user, false, self) && @battle.pbRandom(100) < chance if target.pbCanFreeze?(user, false, self) && @battle.pbRandom(100) < chance
target.pbFreeze target.pbFreeze(user)
end end
target.pbFlinch(user) if @battle.pbRandom(100) < chance target.pbFlinch(user) if @battle.pbRandom(100) < chance
end end
@@ -385,7 +385,7 @@ class Battle::Move::ParalyzeBurnOrFreezeTarget < Battle::Move
return if target.damageState.substitute return if target.damageState.substitute
case @battle.pbRandom(3) case @battle.pbRandom(3)
when 0 then target.pbBurn(user) if target.pbCanBurn?(user, false, self) 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) when 2 then target.pbParalyze(user) if target.pbCanParalyze?(user, false, self)
end end
end end
@@ -400,7 +400,7 @@ class Battle::Move::PoisonParalyzeOrSleepTarget < Battle::Move
case @battle.pbRandom(3) case @battle.pbRandom(3)
when 0 then target.pbPoison(user) if target.pbCanPoison?(user, false, self) 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 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 end
end end
@@ -429,7 +429,7 @@ class Battle::Move::GiveUserStatusToTarget < Battle::Move
msg = "" msg = ""
case user.status case user.status
when :SLEEP when :SLEEP
target.pbSleep target.pbSleep(user)
msg = _INTL("{1} woke up.", user.pbThis) msg = _INTL("{1} woke up.", user.pbThis)
when :POISON when :POISON
target.pbPoison(user, nil, user.statusCount != 0) target.pbPoison(user, nil, user.statusCount != 0)
@@ -441,7 +441,7 @@ class Battle::Move::GiveUserStatusToTarget < Battle::Move
target.pbParalyze(user) target.pbParalyze(user)
msg = _INTL("{1} was cured of paralysis.", user.pbThis) msg = _INTL("{1} was cured of paralysis.", user.pbThis)
when :FROZEN when :FROZEN
target.pbFreeze target.pbFreeze(user)
msg = _INTL("{1} was thawed out.", user.pbThis) msg = _INTL("{1} was thawed out.", user.pbThis)
end end
if msg != "" if msg != ""

View File

@@ -278,13 +278,13 @@ class Battle::Move::EffectDependsOnEnvironment < Battle::Move
return if @battle.pbRandom(100) >= chance return if @battle.pbRandom(100) >= chance
case @secretPower case @secretPower
when 2 when 2
target.pbSleep if target.pbCanSleep?(user, false, self) target.pbSleep(user) if target.pbCanSleep?(user, false, self)
when 10 when 10
target.pbBurn(user) if target.pbCanBurn?(user, false, self) target.pbBurn(user) if target.pbCanBurn?(user, false, self)
when 0, 1 when 0, 1
target.pbParalyze(user) if target.pbCanParalyze?(user, false, self) target.pbParalyze(user) if target.pbCanParalyze?(user, false, self)
when 9 when 9
target.pbFreeze if target.pbCanFreeze?(user, false, self) target.pbFreeze(user) if target.pbCanFreeze?(user, false, self)
when 5 when 5
if target.pbCanLowerStatStage?(:ATTACK, user, self) if target.pbCanLowerStatStage?(:ATTACK, user, self)
target.pbLowerStatStage(:ATTACK, 1, user) target.pbLowerStatStage(:ATTACK, 1, user)

View File

@@ -242,11 +242,19 @@ class Battle::Scene
case useType case useType
when 1 # Use on Pokémon when 1 # Use on Pokémon
if @battle.pbTeamLengthFromBattlerIndex(idxBattler) == 1 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 end
when 3 # Use on battler when 3 # Use on battler
if @battle.pbPlayerBattlerCount == 1 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
end end
# Fade out and hide Bag screen # Fade out and hide Bag screen

View File

@@ -208,7 +208,7 @@ class Battle::Scene::FightMenu < Battle::Scene::MenuBase
# pbShowWindow to make the graphic appear while the command menu is being # pbShowWindow to make the graphic appear while the command menu is being
# displayed. # displayed.
USE_GRAPHICS = true USE_GRAPHICS = true
TYPE_ICON_HEIGHT = 28 TYPE_ICON_HEIGHT = GameData::Type::ICON_SIZE[1]
# Text colours of PP of selected move # Text colours of PP of selected move
PP_COLORS = [ PP_COLORS = [
Color.new(248, 72, 72), Color.new(136, 48, 48), # Red, zero PP Color.new(248, 72, 72), Color.new(136, 48, 48), # Red, zero PP

View File

@@ -503,23 +503,23 @@ class Battle::AI::AIMove
# Ability effects that alter critical hit rate # Ability effects that alter critical hit rate
if user.ability_active? if user.ability_active?
crit_stage = Battle::AbilityEffects.triggerCriticalCalcFromUser(user_battler.ability, 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 return -1 if crit_stage < 0
end end
if target.ability_active? && !target.being_mold_broken? if target.ability_active? && !target.being_mold_broken?
crit_stage = Battle::AbilityEffects.triggerCriticalCalcFromTarget(target_battler.ability, 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 return -1 if crit_stage < 0
end end
# Item effects that alter critical hit rate # Item effects that alter critical hit rate
if user.item_active? if user.item_active?
crit_stage = Battle::ItemEffects.triggerCriticalCalcFromUser(user_battler.item, 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 return -1 if crit_stage < 0
end end
if target.item_active? if target.item_active?
crit_stage = Battle::ItemEffects.triggerCriticalCalcFromTarget(user_battler.item, 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 return -1 if crit_stage < 0
end end
# Other effects # Other effects

View File

@@ -448,11 +448,11 @@ Battle::AI::Handlers::MoveEffectScore.add("EnsureNextCriticalHit",
crit_stage = -1 if user.battler.pbOwnSide.effects[PBEffects::LuckyChant] > 0 crit_stage = -1 if user.battler.pbOwnSide.effects[PBEffects::LuckyChant] > 0
if crit_stage >= 0 && user.ability_active? && ![:MERCILESS].include?(user.ability_id) if crit_stage >= 0 && user.ability_active? && ![:MERCILESS].include?(user.ability_id)
crit_stage = Battle::AbilityEffects.triggerCriticalCalcFromUser(user.battler.ability, crit_stage = Battle::AbilityEffects.triggerCriticalCalcFromUser(user.battler.ability,
user.battler, user.battler, crit_stage) user.battler, user.battler, move.move, crit_stage)
end end
if crit_stage >= 0 && user.item_active? if crit_stage >= 0 && user.item_active?
crit_stage = Battle::ItemEffects.triggerCriticalCalcFromUser(user.battler.item, crit_stage = Battle::ItemEffects.triggerCriticalCalcFromUser(user.battler.item,
user.battler, user.battler, crit_stage) user.battler, user.battler, move.move, crit_stage)
end end
if crit_stage >= 0 && crit_stage < 50 if crit_stage >= 0 && crit_stage < 50
crit_stage += user.effects[PBEffects::FocusEnergy] crit_stage += user.effects[PBEffects::FocusEnergy]
@@ -487,12 +487,12 @@ Battle::AI::Handlers::MoveEffectScore.add("StartPreventCriticalHitsAgainstUserSi
crit_stage = 0 crit_stage = 0
if b.ability_active? if b.ability_active?
crit_stage = Battle::AbilityEffects.triggerCriticalCalcFromTarget(b.battler.ability, 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 next if crit_stage < 0
end end
if b.item_active? if b.item_active?
crit_stage = Battle::ItemEffects.triggerCriticalCalcFromTarget(b.battler.item, 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 next if crit_stage < 0
end end
user_side_immune = false user_side_immune = false
@@ -505,12 +505,12 @@ Battle::AI::Handlers::MoveEffectScore.add("StartPreventCriticalHitsAgainstUserSi
crit_stage = 0 crit_stage = 0
if crit_stage >= 0 && b.ability_active? if crit_stage >= 0 && b.ability_active?
crit_stage = Battle::AbilityEffects.triggerCriticalCalcFromUser(b.battler.ability, 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 next if crit_stage < 0
end end
if crit_stage >= 0 && b.item_active? if crit_stage >= 0 && b.item_active?
crit_stage = Battle::ItemEffects.triggerCriticalCalcFromUser(b.battler.item, 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 next if crit_stage < 0
end end
if crit_stage >= 0 && crit_stage < 50 if crit_stage >= 0 && crit_stage < 50

View File

@@ -205,12 +205,12 @@ module Battle::AbilityEffects
DamageCalcFromTargetAlly.trigger(ability, user, target, move, mults, power, type) DamageCalcFromTargetAlly.trigger(ability, user, target, move, mults, power, type)
end end
def self.triggerCriticalCalcFromUser(ability, user, target, crit_stage) def self.triggerCriticalCalcFromUser(ability, user, target, move, crit_stage)
return trigger(CriticalCalcFromUser, ability, user, target, crit_stage, ret: crit_stage) return trigger(CriticalCalcFromUser, ability, user, target, move, crit_stage, ret: crit_stage)
end end
def self.triggerCriticalCalcFromTarget(ability, user, target, crit_stage) def self.triggerCriticalCalcFromTarget(ability, user, target, move, crit_stage)
return trigger(CriticalCalcFromTarget, ability, user, target, crit_stage, ret: crit_stage) return trigger(CriticalCalcFromTarget, ability, user, target, move, crit_stage, ret: crit_stage)
end end
#============================================================================= #=============================================================================
@@ -1693,13 +1693,13 @@ Battle::AbilityEffects::DamageCalcFromTargetAlly.add(:FRIENDGUARD,
#=============================================================================== #===============================================================================
Battle::AbilityEffects::CriticalCalcFromUser.add(:MERCILESS, Battle::AbilityEffects::CriticalCalcFromUser.add(:MERCILESS,
proc { |ability, user, target, c| proc { |ability, user, target, move, c|
next 99 if target.poisoned? next 99 if target.poisoned?
} }
) )
Battle::AbilityEffects::CriticalCalcFromUser.add(:SUPERLUCK, Battle::AbilityEffects::CriticalCalcFromUser.add(:SUPERLUCK,
proc { |ability, user, target, c| proc { |ability, user, target, move, c|
next c + 1 next c + 1
} }
) )
@@ -1709,7 +1709,7 @@ Battle::AbilityEffects::CriticalCalcFromUser.add(:SUPERLUCK,
#=============================================================================== #===============================================================================
Battle::AbilityEffects::CriticalCalcFromTarget.add(:BATTLEARMOR, Battle::AbilityEffects::CriticalCalcFromTarget.add(:BATTLEARMOR,
proc { |ability, user, target, c| proc { |ability, user, target, move, c|
next -1 next -1
} }
) )
@@ -1847,7 +1847,7 @@ Battle::AbilityEffects::OnBeingHit.add(:EFFECTSPORE,
msg = _INTL("{1}'s {2} made {3} fall asleep!", target.pbThis, msg = _INTL("{1}'s {2} made {3} fall asleep!", target.pbThis,
target.abilityName, user.pbThis(true)) target.abilityName, user.pbThis(true))
end end
user.pbSleep(msg) user.pbSleep(target, msg)
end end
when 1 when 1
if user.pbCanPoison?(target, Battle::Scene::USE_ABILITY_SPLASH) if user.pbCanPoison?(target, Battle::Scene::USE_ABILITY_SPLASH)

View File

@@ -125,12 +125,12 @@ module Battle::ItemEffects
DamageCalcFromTarget.trigger(item, user, target, move, mults, power, type) DamageCalcFromTarget.trigger(item, user, target, move, mults, power, type)
end end
def self.triggerCriticalCalcFromUser(item, user, target, crit_stage) def self.triggerCriticalCalcFromUser(item, user, target, move, crit_stage)
return trigger(CriticalCalcFromUser, item, user, target, crit_stage, ret: crit_stage) return trigger(CriticalCalcFromUser, item, user, target, move, crit_stage, ret: crit_stage)
end end
def self.triggerCriticalCalcFromTarget(item, user, target, crit_stage) def self.triggerCriticalCalcFromTarget(item, user, target, move, crit_stage)
return trigger(CriticalCalcFromTarget, item, user, target, crit_stage, ret: crit_stage) return trigger(CriticalCalcFromTarget, item, user, target, move, crit_stage, ret: crit_stage)
end end
#============================================================================= #=============================================================================
@@ -1280,13 +1280,13 @@ Battle::ItemEffects::DamageCalcFromTarget.add(:YACHEBERRY,
#=============================================================================== #===============================================================================
Battle::ItemEffects::CriticalCalcFromUser.add(:LUCKYPUNCH, Battle::ItemEffects::CriticalCalcFromUser.add(:LUCKYPUNCH,
proc { |item, user, target, c| proc { |item, user, target, move, c|
next c + 2 if user.isSpecies?(:CHANSEY) next c + 2 if user.isSpecies?(:CHANSEY)
} }
) )
Battle::ItemEffects::CriticalCalcFromUser.add(:RAZORCLAW, Battle::ItemEffects::CriticalCalcFromUser.add(:RAZORCLAW,
proc { |item, user, target, c| proc { |item, user, target, move, c|
next c + 1 next c + 1
} }
) )
@@ -1294,7 +1294,7 @@ Battle::ItemEffects::CriticalCalcFromUser.add(:RAZORCLAW,
Battle::ItemEffects::CriticalCalcFromUser.copy(:RAZORCLAW, :SCOPELENS) Battle::ItemEffects::CriticalCalcFromUser.copy(:RAZORCLAW, :SCOPELENS)
Battle::ItemEffects::CriticalCalcFromUser.add(:LEEK, 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) next c + 2 if user.isSpecies?(:FARFETCHD) || user.isSpecies?(:SIRFETCHD)
} }
) )

View File

@@ -465,8 +465,8 @@ class PokemonSummary_Scene
# Draw Pokémon type(s) # Draw Pokémon type(s)
@pokemon.types.each_with_index do |type, i| @pokemon.types.each_with_index do |type, i|
type_number = GameData::Type.get(type).icon_position type_number = GameData::Type.get(type).icon_position
type_rect = Rect.new(0, type_number * 28, 64, 28) type_rect = Rect.new(0, type_number * GameData::Type::ICON_SIZE[1], *GameData::Type::ICON_SIZE)
type_x = (@pokemon.types.length == 1) ? 402 : 370 + (66 * i) type_x = (@pokemon.types.length == 1) ? 402 : 370 + ((GameData::Type::ICON_SIZE[0] + 2) * i)
overlay.blt(type_x, 146, @typebitmap.bitmap, type_rect) overlay.blt(type_x, 146, @typebitmap.bitmap, type_rect)
end end
# Draw Exp bar # Draw Exp bar
@@ -712,7 +712,7 @@ class PokemonSummary_Scene
move = @pokemon.moves[i] move = @pokemon.moves[i]
if move if move
type_number = GameData::Type.get(move.display_type(@pokemon)).icon_position 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]) textpos.push([move.name, 316, yPos, :left, moveBase, moveShadow])
if move.total_pp > 0 if move.total_pp > 0
textpos.push([_INTL("PP"), 342, yPos + 32, :left, moveBase, moveShadow]) textpos.push([_INTL("PP"), 342, yPos + 32, :left, moveBase, moveShadow])
@@ -778,7 +778,7 @@ class PokemonSummary_Scene
end end
if move if move
type_number = GameData::Type.get(move.display_type(@pokemon)).icon_position 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]) textpos.push([move.name, 316, yPos, :left, moveBase, moveShadow])
if move.total_pp > 0 if move.total_pp > 0
textpos.push([_INTL("PP"), 342, yPos + 32, :left, moveBase, moveShadow]) textpos.push([_INTL("PP"), 342, yPos + 32, :left, moveBase, moveShadow])
@@ -805,8 +805,8 @@ class PokemonSummary_Scene
# Draw Pokémon's type icon(s) # Draw Pokémon's type icon(s)
@pokemon.types.each_with_index do |type, i| @pokemon.types.each_with_index do |type, i|
type_number = GameData::Type.get(type).icon_position type_number = GameData::Type.get(type).icon_position
type_rect = Rect.new(0, type_number * 28, 64, 28) type_rect = Rect.new(0, type_number * GameData::Type::ICON_SIZE[1], *GameData::Type::ICON_SIZE)
type_x = (@pokemon.types.length == 1) ? 130 : 96 + (70 * i) type_x = (@pokemon.types.length == 1) ? 130 : 96 + ((GameData::Type::ICON_SIZE[0] + 6) * i)
overlay.blt(type_x, 78, @typebitmap.bitmap, type_rect) overlay.blt(type_x, 78, @typebitmap.bitmap, type_rect)
end end
end end

View File

@@ -27,6 +27,10 @@ class PokemonTrainerCard_Scene
pbSetSystemFont(@sprites["overlay"].bitmap) pbSetSystemFont(@sprites["overlay"].bitmap)
@sprites["trainer"] = IconSprite.new(336, 112, @viewport) @sprites["trainer"] = IconSprite.new(336, 112, @viewport)
@sprites["trainer"].setBitmap(GameData::TrainerType.player_front_sprite_filename($player.trainer_type)) @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"].x -= (@sprites["trainer"].bitmap.width - 128) / 2
@sprites["trainer"].y -= (@sprites["trainer"].bitmap.height - 128) @sprites["trainer"].y -= (@sprites["trainer"].bitmap.height - 128)
@sprites["trainer"].z = 2 @sprites["trainer"].z = 2

View File

@@ -1467,10 +1467,11 @@ class PokemonStorageScene
typebitmap = AnimatedBitmap.new(_INTL("Graphics/UI/types")) typebitmap = AnimatedBitmap.new(_INTL("Graphics/UI/types"))
pokemon.types.each_with_index do |type, i| pokemon.types.each_with_index do |type, i|
type_number = GameData::Type.get(type).icon_position type_number = GameData::Type.get(type).icon_position
type_rect = Rect.new(0, type_number * 28, 64, 28) type_rect = Rect.new(0, type_number * GameData::Type::ICON_SIZE[1], *GameData::Type::ICON_SIZE)
type_x = (pokemon.types.length == 1) ? 52 : 18 + (70 * i) type_x = (pokemon.types.length == 1) ? 52 : 18 + ((GameData::Type::ICON_SIZE[0] + 6) * i)
overlay.blt(type_x, 272, typebitmap.bitmap, type_rect) overlay.blt(type_x, 272, typebitmap.bitmap, type_rect)
end end
typebitmap.dispose
drawMarkings(overlay, 70, 240, 128, 20, pokemon.markings) drawMarkings(overlay, 70, 240, 128, 20, pokemon.markings)
pbDrawImagePositions(overlay, imagepos) pbDrawImagePositions(overlay, imagepos)
end end

View File

@@ -54,8 +54,8 @@ class MoveRelearner_Scene
overlay.clear overlay.clear
@pokemon.types.each_with_index do |type, i| @pokemon.types.each_with_index do |type, i|
type_number = GameData::Type.get(type).icon_position type_number = GameData::Type.get(type).icon_position
type_rect = Rect.new(0, type_number * 28, 64, 28) type_rect = Rect.new(0, type_number * GameData::Type::ICON_SIZE[1], *GameData::Type::ICON_SIZE)
type_x = (@pokemon.types.length == 1) ? 400 : 366 + (70 * i) type_x = (@pokemon.types.length == 1) ? 400 : 366 + ((GameData::Type::ICON_SIZE[0] + 6) * i)
overlay.blt(type_x, 70, @typebitmap.bitmap, type_rect) overlay.blt(type_x, 70, @typebitmap.bitmap, type_rect)
end end
textpos = [ textpos = [
@@ -68,7 +68,7 @@ class MoveRelearner_Scene
if moveobject if moveobject
moveData = GameData::Move.get(moveobject) moveData = GameData::Move.get(moveobject)
type_number = GameData::Type.get(moveData.display_type(@pokemon)).icon_position 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([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)]) textpos.push([_INTL("PP"), 112, yPos + 32, :left, Color.new(64, 64, 64), Color.new(176, 176, 176)])
if moveData.total_pp > 0 if moveData.total_pp > 0

View File

@@ -94,7 +94,7 @@ class TriadCard
if type if type
typebitmap = AnimatedBitmap.new(_INTL("Graphics/UI/types")) typebitmap = AnimatedBitmap.new(_INTL("Graphics/UI/types"))
type_number = GameData::Type.get(type).icon_position 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) bitmap.blt(8, 50, typebitmap.bitmap, typerect, 192)
typebitmap.dispose typebitmap.dispose
end end
@@ -116,7 +116,7 @@ class TriadCard
bitmap.blt(0, 0, cardbitmap.bitmap, Rect.new(0, 0, cardbitmap.width, cardbitmap.height)) bitmap.blt(0, 0, cardbitmap.bitmap, Rect.new(0, 0, cardbitmap.width, cardbitmap.height))
# Draw type icon # Draw type icon
type_number = GameData::Type.get(@type).icon_position 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) bitmap.blt(8, 50, typebitmap.bitmap, typerect, 192)
# Draw Pokémon icon # Draw Pokémon icon
bitmap.blt(8, 24, iconbitmap.bitmap, Rect.new(0, 0, 64, 64)) bitmap.blt(8, 24, iconbitmap.bitmap, Rect.new(0, 0, 64, 64))

View File

@@ -9,7 +9,7 @@ class Scene_DebugIntro
end end
def pbCallTitle def pbCallTitle
return Scene_DebugIntro.new if $DEBUG return Scene_DebugIntro.new if $DEBUG && Settings::SKIP_TITLE_SCREEN
return Scene_Intro.new return Scene_Intro.new
end end