Added effects of Mimicry/Room Service/Catching Charm, tweaked Sinistea's form chances, fixed bug in Fling about TRs.

This commit is contained in:
Maruno17
2021-08-14 19:07:57 +01:00
parent 153aa69bb8
commit 2112cdba37
15 changed files with 120 additions and 37 deletions

View File

@@ -127,6 +127,14 @@ class PokeBattle_Battler
@effects[PBEffects::Roost] = false
end
def pbResetTypes
@type1 = @pokemon.type1
@type2 = @pokemon.type2
@effects[PBEffects::Type3] = nil
@effects[PBEffects::BurnUp] = false
@effects[PBEffects::Roost] = false
end
#=============================================================================
# Forms
#=============================================================================

View File

@@ -61,6 +61,17 @@ class PokeBattle_Battler
return ret # Whether self has switched out
end
def pbAbilityOnTerrainChange(ability_changed = false)
return if !abilityActive?
BattleHandlers.triggerAbilityOnTerrainChange(self.ability, self, @battle, ability_changed)
end
# Used for Rattled's Gen 8 effect. Called when Intimidate is triggered.
def pbAbilitiesOnIntimidated
return if !abilityActive?
BattleHandlers.triggerAbilityOnIntimidated(self.ability, self, @battle)
end
# Called when a Pokémon (self) enters battle, at the end of each move used,
# and at the end of each round.
def pbContinualAbilityChecks(onSwitchIn=false)
@@ -91,12 +102,6 @@ class PokeBattle_Battler
end
end
# Used for Rattled's Gen 8 effect. Called when Intimidate is triggered.
def pbAbilitiesOnIntimidated
return if !abilityActive?
BattleHandlers.triggerAbilityOnIntimidated(self.ability, self, @battle)
end
#=============================================================================
# Ability curing
#=============================================================================
@@ -123,6 +128,8 @@ class PokeBattle_Battler
@effects[PBEffects::SlowStart] = 0 if self.ability != :SLOWSTART
# Revert form if Flower Gift/Forecast was lost
pbCheckFormOnWeatherChange(true)
# Abilities that trigger when the terrain changes
pbAbilityOnTerrainChange(true)
# Check for end of primordial weather
@battle.pbEndPrimordialWeather
end

View File

@@ -366,7 +366,7 @@ class PokeBattle_Battler
@battle.pbShowAbilitySplash(user)
user.pbChangeTypes(move.calcType)
typeName = GameData::Type.get(move.calcType).name
@battle.pbDisplay(_INTL("{1} transformed into the {2} type!",user.pbThis,typeName))
@battle.pbDisplay(_INTL("{1}'s type changed to {2}!",user.pbThis,typeName))
@battle.pbHideAbilitySplash(user)
# NOTE: The GF games say that if Curse is used by a non-Ghost-type
# Pokémon which becomes Ghost-type because of Protean, it should

View File

@@ -144,6 +144,16 @@ class PokeBattle_Battler
# after the move's animation, but the item is only consumed now.
user.pbConsumeItem
end
# Room Service
if move.function == "11F" && @battle.field.effects[PBEffects::TrickRoom] > 0 # Trick Room
@battle.battlers.each do |b|
next if !b.hasActiveItem?(:ROOMSERVICE)
next if !b.pbCanLowerStatStage?(:SPEED, b)
@battle.pbCommonAnimation("UseItem", b)
b.pbLowerStatStage(:SPEED, 1, b)
b.pbConsumeItem
end
end
# Pokémon switching caused by Roar, Whirlwind, Circle Throw, Dragon Tail
switchedBattlers = []
move.pbSwitchOutTargetsEffect(user,targets,numHits,switchedBattlers)

View File

@@ -90,6 +90,7 @@ module BattleHandlers
AbilityOnSwitchOut = AbilityHandlerHash.new
AbilityChangeOnBattlerFainting = AbilityHandlerHash.new
AbilityOnBattlerFainting = AbilityHandlerHash.new # Soul-Heart
AbilityOnTerrainChange = AbilityHandlerHash.new # Mimicry
AbilityOnIntimidated = AbilityHandlerHash.new # Rattled (Gen 8)
# Running from battle
RunFromBattleAbility = AbilityHandlerHash.new # Run Away
@@ -464,6 +465,10 @@ module BattleHandlers
AbilityOnBattlerFainting.trigger(ability,battler,fainted,battle)
end
def self.triggerAbilityOnTerrainChange(ability, battler, battle, ability_changed)
AbilityOnTerrainChange.trigger(ability, battler, battle, ability_changed)
end
def self.triggerAbilityOnIntimidated(ability,battler,battle)
AbilityOnIntimidated.trigger(ability,battler,battle)
end

View File

@@ -1860,7 +1860,7 @@ class PokeBattle_Move_05E < PokeBattle_Move
newType = @newTypes[@battle.pbRandom(@newTypes.length)]
user.pbChangeTypes(newType)
typeName = GameData::Type.get(newType).name
@battle.pbDisplay(_INTL("{1} transformed into the {2} type!",user.pbThis,typeName))
@battle.pbDisplay(_INTL("{1}'s type changed to {2}!",user.pbThis,typeName))
end
end
@@ -1904,7 +1904,7 @@ class PokeBattle_Move_05F < PokeBattle_Move
newType = @newTypes[@battle.pbRandom(@newTypes.length)]
user.pbChangeTypes(newType)
typeName = GameData::Type.get(newType).name
@battle.pbDisplay(_INTL("{1} transformed into the {2} type!", user.pbThis, typeName))
@battle.pbDisplay(_INTL("{1}'s type changed to {2}!", user.pbThis, typeName))
end
end
@@ -1982,7 +1982,7 @@ class PokeBattle_Move_060 < PokeBattle_Move
def pbEffectGeneral(user)
user.pbChangeTypes(@newType)
typeName = GameData::Type.get(@newType).name
@battle.pbDisplay(_INTL("{1} transformed into the {2} type!",user.pbThis,typeName))
@battle.pbDisplay(_INTL("{1}'s type changed to {2}!",user.pbThis,typeName))
end
end
@@ -2006,7 +2006,7 @@ class PokeBattle_Move_061 < PokeBattle_Move
def pbEffectAgainstTarget(user,target)
target.pbChangeTypes(:WATER)
typeName = GameData::Type.get(:WATER).name
@battle.pbDisplay(_INTL("{1} transformed into the {2} type!",target.pbThis,typeName))
@battle.pbDisplay(_INTL("{1}'s type changed to {2}!",target.pbThis,typeName))
end
end

View File

@@ -3644,8 +3644,9 @@ class PokeBattle_Move_0F7 < PokeBattle_Move
def pbNumHits(user,targets); return 1; end
def pbBaseDamage(baseDmg,user,target)
return 10 if user.item && user.item.is_berry?
return 80 if user.item && user.item.is_mega_stone?
return 0 if !user.item
return 10 if user.item.is_berry?
return 80 if user.item.is_mega_stone?
if user.item.is_TR?
ret = GameData::Move.get(user.item.move).base_damage
ret = 10 if ret < 10

View File

@@ -255,7 +255,7 @@ class PokeBattle_Move_17F < PokeBattle_Move
def pbEffectAgainstTarget(user, target)
target.pbChangeTypes(:PSYCHIC)
typeName = GameData::Type.get(:PSYCHIC).name
@battle.pbDisplay(_INTL("{1} transformed into the {2} type!", target.pbThis, typeName))
@battle.pbDisplay(_INTL("{1}'s type changed to {2}!", target.pbThis, typeName))
end
end

View File

@@ -193,14 +193,16 @@ module PokeBattle_BattleCommon
y = ( 65536 / ((255.0/x)**0.1875) ).floor
# Critical capture check
if Settings::ENABLE_CRITICAL_CAPTURES
c = 0
dex_modifier = 0
numOwned = $Trainer.pokedex.owned_count
if numOwned>600; c = x*5/12
elsif numOwned>450; c = x*4/12
elsif numOwned>300; c = x*3/12
elsif numOwned>150; c = x*2/12
elsif numOwned>30; c = x/12
if numOwned>600; dex_modifier = 5
elsif numOwned>450; dex_modifier = 4
elsif numOwned>300; dex_modifier = 3
elsif numOwned>150; dex_modifier = 2
elsif numOwned>30; dex_modifier = 1
end
dex_modifier *= 2 if $PokemonBag.pbHasItem?(:CATCHINGCHARM)
c = x * dex_modifier / 12
# Calculate the number of shakes
if c>0 && pbRandom(256)<c
@criticalCapture = true

View File

@@ -735,7 +735,8 @@ class PokeBattle_Battle
when :Psychic
pbDisplay(_INTL("The battlefield got weird!"))
end
# Check for terrain seeds that boost stats in a terrain
# Check for abilities/items that trigger upon the terrain changing
eachBattler { |b| b.pbAbilityOnTerrainChange }
eachBattler { |b| b.pbItemTerrainStatBoostCheck }
end

View File

@@ -119,8 +119,13 @@ class PokeBattle_Battle
pbDisplay(_INTL("The weirdness disappeared from the battlefield!"))
end
@field.terrain = :None
eachBattler { |b| b.pbAbilityOnTerrainChange }
# Start up the default terrain
pbStartTerrain(nil, @field.defaultTerrain, false) if @field.defaultTerrain != :None
if @field.defaultTerrain != :None
pbStartTerrain(nil, @field.defaultTerrain, false)
eachBattler { |b| b.pbAbilityOnTerrainChange }
eachBattler { |b| b.pbItemTerrainStatBoostCheck }
end
return if @field.terrain == :None
end
# Terrain continues

View File

@@ -1719,8 +1719,8 @@ BattleHandlers::TargetAbilityAfterMoveUse.add(:COLORCHANGE,
typeName = GameData::Type.get(move.calcType).name
battle.pbShowAbilitySplash(target)
target.pbChangeTypes(move.calcType)
battle.pbDisplay(_INTL("{1}'s {2} made it the {3} type!",target.pbThis,
target.abilityName,typeName))
battle.pbDisplay(_INTL("{1}'s type changed to {2} because of its {3}!",
target.pbThis, typeName, target.abilityName))
battle.pbHideAbilitySplash(target)
}
)
@@ -2475,6 +2475,43 @@ BattleHandlers::AbilityOnBattlerFainting.add(:SOULHEART,
}
)
#===============================================================================
# AbilityOnTerrainChange handlers
#===============================================================================
BattleHandlers::AbilityOnTerrainChange.add(:MIMICRY,
proc { |ability, battler, battle, ability_changed|
if battle.field.terrain == :None
# Revert to original typing
battle.pbShowAbilitySplash(battler)
battler.pbResetTypes
battle.pbDisplay(_INTL("{1} changed back to its regular type!", battler.pbThis))
battle.pbHideAbilitySplash(battler)
else
# Change to new typing
terrain_hash = {
:Electric => :ELECTRIC,
:Grassy => :GRASS,
:Misty => :FAIRY,
:Psychic => :PSYCHIC
}
new_type = terrain_hash[battle.field.terrain]
new_type_name = nil
if new_type
type_data = GameData::Type.try_get(new_type)
new_type = nil if !type_data
new_type_name = type_data.name if type_data
end
if new_type
battle.pbShowAbilitySplash(battler)
battler.pbChangeTypes(new_type)
battle.pbDisplay(_INTL("{1}'s type changed to {2}!", battler.pbThis, new_type_name))
battle.pbHideAbilitySplash(battler)
end
end
}
)
#===============================================================================
# AbilityOnIntimidated handlers
#===============================================================================

View File

@@ -330,6 +330,14 @@ BattleHandlers::DamageCalcUserAbility.add(:GORILLATACTICS,
}
)
BattleHandlers::AbilityOnSwitchIn.add(:MIMICRY,
proc { |ability, battler, battle|
next if battle.field.terrain == :None
BattleHandlers.triggerAbilityOnTerrainChange(ability, battler, battle, false)
}
)
=begin
#===============================================================================
@@ -343,9 +351,4 @@ Suppresses all other abilities. Once this ability stops applying, triggers all
abilities that activate when gained (if this happens because bearer switches
out, abilities trigger before the replacement switches in).
Mimicry
The bearer's type changes depending on the terrain. Triggers upon entering
battle and when terrain changes (and not when bearer's type is changed, e.g.
with Soak).
=end

View File

@@ -324,11 +324,22 @@ BattleHandlers::UserItemAfterMoveUse.add(:THROATSPRAY,
battle.pbAllFainted?(user.idxOpposingSide)
next if !move.soundMove? || numHits == 0
next if !user.pbCanRaiseStatStage?(:SPECIAL_ATTACK, user)
battle.pbCommonAnimation("UseItem", user)
user.pbRaiseStatStage(:SPECIAL_ATTACK, 1, user)
user.pbConsumeItem
}
)
BattleHandlers::ItemOnSwitchIn.add(:ROOMSERVICE,
proc { |item, battler, battle|
next if battle.field.effects[PBEffects::TrickRoom] == 0
next if !battler.pbCanLowerStatStage?(:SPEED, battler)
battle.pbCommonAnimation("UseItem", battler)
battler.pbLowerStatStage(:SPEED, 1, battler)
battler.pbConsumeItem
}
)
=begin
@@ -344,16 +355,9 @@ If holder's move fails its accuracy check, consume item and holder gets +2
Speed. Doesn't trigger if move was an OHKO move, or Triple Kick that hit at
least once.
Room Service
If Trick Room is used, or if holder switches in while Trick Room applies,
consume item and holder gets -1 Speed.
Pokémon Box Link
Key item, unusable. Enables pressing a button while in the party screen to open
the "Organise Boxes" mode of Pokémon storage. This is disabled at certain times,
perhaps when a Game Switch is on.
Catching Charm
Increases the chance of a critical catch. By how much?
=end

View File

@@ -603,7 +603,7 @@ MultipleForms.copy(:TOXEL, :TOXTRICITY)
MultipleForms.register(:SINISTEA, {
"getFormOnCreation" => proc { |pkmn|
next 1 if rand(100) == 0
next 1 if rand(100) < 50
next 0
}
})