Added Setting for item sell prices, added stat for primal reversions, fixed weird movement when jumping across a map connection

This commit is contained in:
Maruno17
2024-01-18 22:20:46 +00:00
parent 8c5911e4a4
commit c5d7d1447b
8 changed files with 25 additions and 7 deletions

View File

@@ -255,6 +255,9 @@ module Settings
# from a Mart at once (true), or 1 Premier Ball for buying 10+ regular Poké
# Balls (false).
MORE_BONUS_PREMIER_BALLS = (MECHANICS_GENERATION >= 8)
# The default sell price of an item to a Poké Mart is its buy price divided by
# this number.
ITEM_SELL_PRICE_DIVISOR = (MECHANICS_GENERATION >= 9) ? 4 : 2
#-----------------------------------------------------------------------------
# Bag

View File

@@ -418,3 +418,15 @@ SaveData.register_conversion(:v21_add_bump_stat) do
end
end
end
#===============================================================================
SaveData.register_conversion(:v22_add_primal_reversion_stat) do
essentials_version 22
display_title "Adding a primal reversion stat"
to_value :stats do |stats|
stats.instance_eval do
@primal_reversion_count = 0 if !@primal_reversion_count
end
end
end

View File

@@ -442,9 +442,9 @@ class Interpreter
$game_temp.mart_prices[item] = [-1, -1] if !$game_temp.mart_prices[item]
$game_temp.mart_prices[item][0] = buy_price if buy_price > 0
if sell_price >= 0 # 0=can't sell
$game_temp.mart_prices[item][1] = sell_price * 2
$game_temp.mart_prices[item][1] = sell_price
elsif buy_price > 0
$game_temp.mart_prices[item][1] = buy_price
$game_temp.mart_prices[item][1] = buy_price / Settings::ITEM_SELL_PRICE_DIVISOR
end
end

View File

@@ -93,7 +93,7 @@ class PokemonMapFactory
# Detects whether the player has moved onto a connected map, and if so, causes
# their transfer to that map.
def setCurrentMap
return if $game_player.moving?
return if $game_player.moving? || $game_player.jumping?
return if $game_map.valid?($game_player.x, $game_player.y)
newmap = getNewMap($game_player.x, $game_player.y)
return if !newmap

View File

@@ -38,7 +38,7 @@ class GameStats
attr_accessor :total_exp_gained
attr_accessor :battle_money_gained, :battle_money_lost
attr_accessor :blacked_out_count
attr_accessor :mega_evolution_count
attr_accessor :mega_evolution_count, :primal_reversion_count
attr_accessor :failed_poke_ball_count
# Currency
attr_accessor :money_spent_at_marts
@@ -118,6 +118,7 @@ class GameStats
@battle_money_lost = 0
@blacked_out_count = 0
@mega_evolution_count = 0
@primal_reversion_count = 0
@failed_poke_ball_count = 0
# Currency
@money_spent_at_marts = 0

View File

@@ -59,7 +59,7 @@ module GameData
["PortionNamePlural", ItemNameProperty, _INTL("Name of 2 or more portions of this item as displayed by the game.")],
["Pocket", PocketProperty, _INTL("Pocket in the Bag where this item is stored.")],
["Price", LimitProperty.new(Settings::MAX_MONEY), _INTL("Purchase price of this item.")],
["SellPrice", LimitProperty2.new(Settings::MAX_MONEY), _INTL("Sell price of this item. If blank, is half the purchase price.")],
["SellPrice", LimitProperty2.new(Settings::MAX_MONEY), _INTL("Sell price of this item. If blank, is usually half the purchase price.")],
["BPPrice", LimitProperty.new(Settings::MAX_BATTLE_POINTS), _INTL("Purchase price of this item in Battle Points (BP).")],
["FieldUse", EnumProperty.new(field_use_array), _INTL("How this item can be used outside of battle.")],
["BattleUse", EnumProperty.new(battle_use_array), _INTL("How this item can be used within a battle.")],
@@ -124,7 +124,7 @@ module GameData
@real_portion_name_plural = hash[:real_portion_name_plural]
@pocket = hash[:pocket] || 1
@price = hash[:price] || 0
@sell_price = hash[:sell_price] || (@price / 2)
@sell_price = hash[:sell_price] || (@price / Settings::ITEM_SELL_PRICE_DIVISOR)
@bp_price = hash[:bp_price] || 1
@field_use = hash[:field_use] || 0
@battle_use = hash[:battle_use] || 0
@@ -255,7 +255,7 @@ module GameData
ret = __orig__get_property_for_PBS(key)
case key
when "SellPrice"
ret = nil if ret == @price / 2
ret = nil if ret == @price / Settings::ITEM_SELL_PRICE_DIVISOR
when "BPPrice"
ret = nil if ret == 1
when "FieldUse", "BattleUse"

View File

@@ -181,6 +181,7 @@ class Battle
battler = @battlers[idxBattler]
return if !battler || !battler.pokemon || battler.fainted?
return if !battler.hasPrimal? || battler.primal?
$stats.primal_reversion_count += 1 if battler.pbOwnedByPlayer?
if battler.isSpecies?(:KYOGRE)
pbCommonAnimation("PrimalKyogre", battler)
elsif battler.isSpecies?(:GROUDON)

View File

@@ -215,6 +215,7 @@ def pbHatch(pokemon)
pokemon.name = nil
pokemon.owner = Pokemon::Owner.new_from_trainer($player)
pokemon.happiness = 120
pokemon.steps_to_hatch = 0
pokemon.timeEggHatched = Time.now.to_i
pokemon.obtain_method = 1 # hatched from egg
pokemon.hatched_map = $game_map.map_id