Added Settings::DISABLE_IVS_AND_EVS, added text replacements for gender symbols

This commit is contained in:
Maruno17
2023-07-17 19:28:05 +01:00
parent f576db7c0b
commit 6053363715
4 changed files with 21 additions and 14 deletions

View File

@@ -40,6 +40,10 @@ module Settings
SUPER_SHINY = (MECHANICS_GENERATION >= 8)
# The odds of a wild Pokémon/bred egg having Pokérus (out of 65536).
POKERUS_CHANCE = 3
# Whether IVs and EVs are treated as 0 when calculating a Pokémon's stats.
# IVs and EVs still exist, and are used by Hidden Power and some cosmetic
# things as normal.
DISABLE_IVS_AND_EVS = false
#=============================================================================

View File

@@ -74,7 +74,7 @@ end
#===============================================================================
FORMATREGEXP = /<(\/?)(c|c2|c3|o|fn|br|fs|i|b|r|pg|pog|u|s|icon|img|ac|ar|al|outln|outln2)(\s*\=\s*([^>]*))?>/i
def fmtescape(text)
def fmtEscape(text)
if text[/[&<>]/]
text2 = text.gsub(/&/, "&amp;")
text2.gsub!(/</, "&lt;")
@@ -84,13 +84,20 @@ def fmtescape(text)
return text
end
# Modifies text; does not return a modified copy of it.
def fmtReplaceEscapes(text)
text.gsub!(/&lt;/, "<")
text.gsub!(/&gt;/, ">")
text.gsub!(/&apos;/, "'")
text.gsub!(/&quot;/, "\"")
text.gsub!(/&amp;/, "&")
text.gsub!(/&m;/, "")
text.gsub!(/&f;/, "")
end
def toUnformattedText(text)
text2 = text.gsub(FORMATREGEXP, "")
text2.gsub!(/&lt;/, "<")
text2.gsub!(/&gt;/, ">")
text2.gsub!(/&apos;/, "'")
text2.gsub!(/&quot;/, "\"")
text2.gsub!(/&amp;/, "&")
fmtReplaceEscapes(text2)
return text2
end
@@ -376,13 +383,7 @@ def getFormattedText(bitmap, xDst, yDst, widthDst, heightDst, text, lineheight =
# realtextStart = oldtext[0, oldtext.length - realtext.length]
# end
textchunks.push(text)
textchunks.each do |chunk|
chunk.gsub!(/&lt;/, "<")
chunk.gsub!(/&gt;/, ">")
chunk.gsub!(/&apos;/, "'")
chunk.gsub!(/&quot;/, "\"")
chunk.gsub!(/&amp;/, "&")
end
textchunks.each { |chunk| fmtReplaceEscapes(chunk) }
textlen = 0
controls.each_with_index do |control, i|
textlen += textchunks[i].scan(/./m).length

View File

@@ -1085,11 +1085,13 @@ class Pokemon
# @return [Integer] the maximum HP of this Pokémon
def calcHP(base, level, iv, ev)
return 1 if base == 1 # For Shedinja
iv = ev = 0 if Settings::DISABLE_IVS_AND_EVS
return (((base * 2) + iv + (ev / 4)) * level / 100).floor + level + 10
end
# @return [Integer] the specified stat of this Pokémon (not used for total HP)
def calcStat(base, level, iv, ev, nat)
iv = ev = 0 if Settings::DISABLE_IVS_AND_EVS
return (((((base * 2) + iv + (ev / 4)) * level / 100).floor + 5) * nat / 100).floor
end

View File

@@ -46,7 +46,7 @@ class DuelWindow < Window_AdvancedTextPokemon
name_tag = shadowc3tag(PLAYER_TEXT_BASE, PLAYER_TEXT_SHADOW)
end
hp_tag = shadowc3tag(HP_TEXT_BASE, HP_TEXT_SHADOW)
self.text = name_tag + fmtescape(@name) + "\n" + hp_tag + _INTL("HP: {1}", @hp)
self.text = name_tag + fmtEscape(@name) + "\n" + hp_tag + _INTL("HP: {1}", @hp)
end
end