mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-07 21:24:59 +00:00
Added effects of Mimicry/Room Service/Catching Charm, tweaked Sinistea's form chances, fixed bug in Fling about TRs.
This commit is contained in:
@@ -127,6 +127,14 @@ class PokeBattle_Battler
|
|||||||
@effects[PBEffects::Roost] = false
|
@effects[PBEffects::Roost] = false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def pbResetTypes
|
||||||
|
@type1 = @pokemon.type1
|
||||||
|
@type2 = @pokemon.type2
|
||||||
|
@effects[PBEffects::Type3] = nil
|
||||||
|
@effects[PBEffects::BurnUp] = false
|
||||||
|
@effects[PBEffects::Roost] = false
|
||||||
|
end
|
||||||
|
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
# Forms
|
# Forms
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
|
|||||||
@@ -61,6 +61,17 @@ class PokeBattle_Battler
|
|||||||
return ret # Whether self has switched out
|
return ret # Whether self has switched out
|
||||||
end
|
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,
|
# Called when a Pokémon (self) enters battle, at the end of each move used,
|
||||||
# and at the end of each round.
|
# and at the end of each round.
|
||||||
def pbContinualAbilityChecks(onSwitchIn=false)
|
def pbContinualAbilityChecks(onSwitchIn=false)
|
||||||
@@ -91,12 +102,6 @@ class PokeBattle_Battler
|
|||||||
end
|
end
|
||||||
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
|
# Ability curing
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
@@ -123,6 +128,8 @@ class PokeBattle_Battler
|
|||||||
@effects[PBEffects::SlowStart] = 0 if self.ability != :SLOWSTART
|
@effects[PBEffects::SlowStart] = 0 if self.ability != :SLOWSTART
|
||||||
# Revert form if Flower Gift/Forecast was lost
|
# Revert form if Flower Gift/Forecast was lost
|
||||||
pbCheckFormOnWeatherChange(true)
|
pbCheckFormOnWeatherChange(true)
|
||||||
|
# Abilities that trigger when the terrain changes
|
||||||
|
pbAbilityOnTerrainChange(true)
|
||||||
# Check for end of primordial weather
|
# Check for end of primordial weather
|
||||||
@battle.pbEndPrimordialWeather
|
@battle.pbEndPrimordialWeather
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -366,7 +366,7 @@ class PokeBattle_Battler
|
|||||||
@battle.pbShowAbilitySplash(user)
|
@battle.pbShowAbilitySplash(user)
|
||||||
user.pbChangeTypes(move.calcType)
|
user.pbChangeTypes(move.calcType)
|
||||||
typeName = GameData::Type.get(move.calcType).name
|
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)
|
@battle.pbHideAbilitySplash(user)
|
||||||
# NOTE: The GF games say that if Curse is used by a non-Ghost-type
|
# 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
|
# Pokémon which becomes Ghost-type because of Protean, it should
|
||||||
|
|||||||
@@ -144,6 +144,16 @@ class PokeBattle_Battler
|
|||||||
# after the move's animation, but the item is only consumed now.
|
# after the move's animation, but the item is only consumed now.
|
||||||
user.pbConsumeItem
|
user.pbConsumeItem
|
||||||
end
|
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
|
# Pokémon switching caused by Roar, Whirlwind, Circle Throw, Dragon Tail
|
||||||
switchedBattlers = []
|
switchedBattlers = []
|
||||||
move.pbSwitchOutTargetsEffect(user,targets,numHits,switchedBattlers)
|
move.pbSwitchOutTargetsEffect(user,targets,numHits,switchedBattlers)
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ module BattleHandlers
|
|||||||
AbilityOnSwitchOut = AbilityHandlerHash.new
|
AbilityOnSwitchOut = AbilityHandlerHash.new
|
||||||
AbilityChangeOnBattlerFainting = AbilityHandlerHash.new
|
AbilityChangeOnBattlerFainting = AbilityHandlerHash.new
|
||||||
AbilityOnBattlerFainting = AbilityHandlerHash.new # Soul-Heart
|
AbilityOnBattlerFainting = AbilityHandlerHash.new # Soul-Heart
|
||||||
|
AbilityOnTerrainChange = AbilityHandlerHash.new # Mimicry
|
||||||
AbilityOnIntimidated = AbilityHandlerHash.new # Rattled (Gen 8)
|
AbilityOnIntimidated = AbilityHandlerHash.new # Rattled (Gen 8)
|
||||||
# Running from battle
|
# Running from battle
|
||||||
RunFromBattleAbility = AbilityHandlerHash.new # Run Away
|
RunFromBattleAbility = AbilityHandlerHash.new # Run Away
|
||||||
@@ -464,6 +465,10 @@ module BattleHandlers
|
|||||||
AbilityOnBattlerFainting.trigger(ability,battler,fainted,battle)
|
AbilityOnBattlerFainting.trigger(ability,battler,fainted,battle)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.triggerAbilityOnTerrainChange(ability, battler, battle, ability_changed)
|
||||||
|
AbilityOnTerrainChange.trigger(ability, battler, battle, ability_changed)
|
||||||
|
end
|
||||||
|
|
||||||
def self.triggerAbilityOnIntimidated(ability,battler,battle)
|
def self.triggerAbilityOnIntimidated(ability,battler,battle)
|
||||||
AbilityOnIntimidated.trigger(ability,battler,battle)
|
AbilityOnIntimidated.trigger(ability,battler,battle)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1860,7 +1860,7 @@ class PokeBattle_Move_05E < PokeBattle_Move
|
|||||||
newType = @newTypes[@battle.pbRandom(@newTypes.length)]
|
newType = @newTypes[@battle.pbRandom(@newTypes.length)]
|
||||||
user.pbChangeTypes(newType)
|
user.pbChangeTypes(newType)
|
||||||
typeName = GameData::Type.get(newType).name
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1904,7 +1904,7 @@ class PokeBattle_Move_05F < PokeBattle_Move
|
|||||||
newType = @newTypes[@battle.pbRandom(@newTypes.length)]
|
newType = @newTypes[@battle.pbRandom(@newTypes.length)]
|
||||||
user.pbChangeTypes(newType)
|
user.pbChangeTypes(newType)
|
||||||
typeName = GameData::Type.get(newType).name
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1982,7 +1982,7 @@ class PokeBattle_Move_060 < PokeBattle_Move
|
|||||||
def pbEffectGeneral(user)
|
def pbEffectGeneral(user)
|
||||||
user.pbChangeTypes(@newType)
|
user.pbChangeTypes(@newType)
|
||||||
typeName = GameData::Type.get(@newType).name
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -2006,7 +2006,7 @@ class PokeBattle_Move_061 < PokeBattle_Move
|
|||||||
def pbEffectAgainstTarget(user,target)
|
def pbEffectAgainstTarget(user,target)
|
||||||
target.pbChangeTypes(:WATER)
|
target.pbChangeTypes(:WATER)
|
||||||
typeName = GameData::Type.get(:WATER).name
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -3644,8 +3644,9 @@ class PokeBattle_Move_0F7 < PokeBattle_Move
|
|||||||
def pbNumHits(user,targets); return 1; end
|
def pbNumHits(user,targets); return 1; end
|
||||||
|
|
||||||
def pbBaseDamage(baseDmg,user,target)
|
def pbBaseDamage(baseDmg,user,target)
|
||||||
return 10 if user.item && user.item.is_berry?
|
return 0 if !user.item
|
||||||
return 80 if user.item && user.item.is_mega_stone?
|
return 10 if user.item.is_berry?
|
||||||
|
return 80 if user.item.is_mega_stone?
|
||||||
if user.item.is_TR?
|
if user.item.is_TR?
|
||||||
ret = GameData::Move.get(user.item.move).base_damage
|
ret = GameData::Move.get(user.item.move).base_damage
|
||||||
ret = 10 if ret < 10
|
ret = 10 if ret < 10
|
||||||
|
|||||||
@@ -255,7 +255,7 @@ class PokeBattle_Move_17F < PokeBattle_Move
|
|||||||
def pbEffectAgainstTarget(user, target)
|
def pbEffectAgainstTarget(user, target)
|
||||||
target.pbChangeTypes(:PSYCHIC)
|
target.pbChangeTypes(:PSYCHIC)
|
||||||
typeName = GameData::Type.get(:PSYCHIC).name
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -193,14 +193,16 @@ module PokeBattle_BattleCommon
|
|||||||
y = ( 65536 / ((255.0/x)**0.1875) ).floor
|
y = ( 65536 / ((255.0/x)**0.1875) ).floor
|
||||||
# Critical capture check
|
# Critical capture check
|
||||||
if Settings::ENABLE_CRITICAL_CAPTURES
|
if Settings::ENABLE_CRITICAL_CAPTURES
|
||||||
c = 0
|
dex_modifier = 0
|
||||||
numOwned = $Trainer.pokedex.owned_count
|
numOwned = $Trainer.pokedex.owned_count
|
||||||
if numOwned>600; c = x*5/12
|
if numOwned>600; dex_modifier = 5
|
||||||
elsif numOwned>450; c = x*4/12
|
elsif numOwned>450; dex_modifier = 4
|
||||||
elsif numOwned>300; c = x*3/12
|
elsif numOwned>300; dex_modifier = 3
|
||||||
elsif numOwned>150; c = x*2/12
|
elsif numOwned>150; dex_modifier = 2
|
||||||
elsif numOwned>30; c = x/12
|
elsif numOwned>30; dex_modifier = 1
|
||||||
end
|
end
|
||||||
|
dex_modifier *= 2 if $PokemonBag.pbHasItem?(:CATCHINGCHARM)
|
||||||
|
c = x * dex_modifier / 12
|
||||||
# Calculate the number of shakes
|
# Calculate the number of shakes
|
||||||
if c>0 && pbRandom(256)<c
|
if c>0 && pbRandom(256)<c
|
||||||
@criticalCapture = true
|
@criticalCapture = true
|
||||||
|
|||||||
@@ -735,7 +735,8 @@ class PokeBattle_Battle
|
|||||||
when :Psychic
|
when :Psychic
|
||||||
pbDisplay(_INTL("The battlefield got weird!"))
|
pbDisplay(_INTL("The battlefield got weird!"))
|
||||||
end
|
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 }
|
eachBattler { |b| b.pbItemTerrainStatBoostCheck }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -119,8 +119,13 @@ class PokeBattle_Battle
|
|||||||
pbDisplay(_INTL("The weirdness disappeared from the battlefield!"))
|
pbDisplay(_INTL("The weirdness disappeared from the battlefield!"))
|
||||||
end
|
end
|
||||||
@field.terrain = :None
|
@field.terrain = :None
|
||||||
|
eachBattler { |b| b.pbAbilityOnTerrainChange }
|
||||||
# Start up the default terrain
|
# 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
|
return if @field.terrain == :None
|
||||||
end
|
end
|
||||||
# Terrain continues
|
# Terrain continues
|
||||||
|
|||||||
@@ -1719,8 +1719,8 @@ BattleHandlers::TargetAbilityAfterMoveUse.add(:COLORCHANGE,
|
|||||||
typeName = GameData::Type.get(move.calcType).name
|
typeName = GameData::Type.get(move.calcType).name
|
||||||
battle.pbShowAbilitySplash(target)
|
battle.pbShowAbilitySplash(target)
|
||||||
target.pbChangeTypes(move.calcType)
|
target.pbChangeTypes(move.calcType)
|
||||||
battle.pbDisplay(_INTL("{1}'s {2} made it the {3} type!",target.pbThis,
|
battle.pbDisplay(_INTL("{1}'s type changed to {2} because of its {3}!",
|
||||||
target.abilityName,typeName))
|
target.pbThis, typeName, target.abilityName))
|
||||||
battle.pbHideAbilitySplash(target)
|
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
|
# AbilityOnIntimidated handlers
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
|
|||||||
@@ -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
|
=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
|
abilities that activate when gained (if this happens because bearer switches
|
||||||
out, abilities trigger before the replacement switches in).
|
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
|
=end
|
||||||
|
|||||||
@@ -324,11 +324,22 @@ BattleHandlers::UserItemAfterMoveUse.add(:THROATSPRAY,
|
|||||||
battle.pbAllFainted?(user.idxOpposingSide)
|
battle.pbAllFainted?(user.idxOpposingSide)
|
||||||
next if !move.soundMove? || numHits == 0
|
next if !move.soundMove? || numHits == 0
|
||||||
next if !user.pbCanRaiseStatStage?(:SPECIAL_ATTACK, user)
|
next if !user.pbCanRaiseStatStage?(:SPECIAL_ATTACK, user)
|
||||||
|
battle.pbCommonAnimation("UseItem", user)
|
||||||
user.pbRaiseStatStage(:SPECIAL_ATTACK, 1, user)
|
user.pbRaiseStatStage(:SPECIAL_ATTACK, 1, user)
|
||||||
user.pbConsumeItem
|
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
|
=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
|
Speed. Doesn't trigger if move was an OHKO move, or Triple Kick that hit at
|
||||||
least once.
|
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
|
Pokémon Box Link
|
||||||
Key item, unusable. Enables pressing a button while in the party screen to open
|
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,
|
the "Organise Boxes" mode of Pokémon storage. This is disabled at certain times,
|
||||||
perhaps when a Game Switch is on.
|
perhaps when a Game Switch is on.
|
||||||
|
|
||||||
Catching Charm
|
|
||||||
Increases the chance of a critical catch. By how much?
|
|
||||||
|
|
||||||
=end
|
=end
|
||||||
|
|||||||
@@ -603,7 +603,7 @@ MultipleForms.copy(:TOXEL, :TOXTRICITY)
|
|||||||
|
|
||||||
MultipleForms.register(:SINISTEA, {
|
MultipleForms.register(:SINISTEA, {
|
||||||
"getFormOnCreation" => proc { |pkmn|
|
"getFormOnCreation" => proc { |pkmn|
|
||||||
next 1 if rand(100) == 0
|
next 1 if rand(100) < 50
|
||||||
next 0
|
next 0
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user