mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-09 14:14:59 +00:00
AI and other Gen 8 Effects (#123)
* Added Rattled being triggered by Intimidate in Gen 8 * Added Rapid Spin speed boost effect * Added basic AI for Gen 8 * Tweaked Leppa berry's effect * Added Ability Patch's exemption for Zygarde * Added Curse's Gen 8 targeting change * Added Teleport's Gen 8 effect * Added check for Choice items in Instruct and Dancer * Added Quash's Gen 8 change to the order that multiple Quashed Pokémon move in Co-authored-by: Maruno17 <serialcolour@hotmail.com>
This commit is contained in:
@@ -2983,20 +2983,43 @@ end
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# User flees from battle. Fails in trainer battles. (Teleport)
|
||||
# User flees from battle (but in Gen 8+, only when user is a wild Pokémon).
|
||||
# In Gen 8+, user switches out (except if user is a wild Pokémon). (Teleport)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_0EA < PokeBattle_Move
|
||||
def pbMoveFailed?(user,targets)
|
||||
if !@battle.pbCanRun?(user.index)
|
||||
if Settings::MECHANICS_GENERATION < 8 || (@battle.wildBattle? && user.opposes?)
|
||||
if !@battle.pbCanRun?(user.index)
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
elsif !@battle.pbCanChooseNonActive?(user.index)
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbEndOfMoveUsageEffect(user,targets,numHits,switchedBattlers)
|
||||
return if Settings::MECHANICS_GENERATION < 8 || (@battle.wildBattle? && user.opposes?)
|
||||
@battle.pbDisplay(_INTL("{1} went back to {2}!",user.pbThis,
|
||||
@battle.pbGetOwnerName(user.index)))
|
||||
@battle.pbPursuit(user.index)
|
||||
return if user.fainted?
|
||||
newPkmn = @battle.pbGetReplacementPokemonIndex(user.index) # Owner chooses
|
||||
return if newPkmn<0
|
||||
@battle.pbRecallAndReplace(user.index,newPkmn)
|
||||
@battle.pbClearChoice(user.index) # Replacement Pokémon does nothing this round
|
||||
@battle.moldBreaker = false
|
||||
switchedBattlers.push(user.index)
|
||||
user.pbEffectsOnSwitchIn(true)
|
||||
end
|
||||
|
||||
def pbEffectGeneral(user)
|
||||
@battle.pbDisplay(_INTL("{1} fled from battle!",user.pbThis))
|
||||
@battle.decision = 3 # Escaped
|
||||
if Settings::MECHANICS_GENERATION < 8 || (@battle.wildBattle? && user.opposes?)
|
||||
@battle.pbDisplay(_INTL("{1} fled from battle!",user.pbThis))
|
||||
@battle.decision = 3 # Escaped
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -269,7 +269,10 @@ class PokeBattle_Move_10D < PokeBattle_Move
|
||||
def ignoresSubstitute?(user); return true; end
|
||||
|
||||
def pbTarget(user)
|
||||
return GameData::Target.get(:NearFoe) if user.pbHasType?(:GHOST)
|
||||
if user.pbHasType?(:GHOST)
|
||||
ghost_target = (Settings::MECHANICS_GENERATION >= 8) ? :RandomNearFoe : :NearFoe
|
||||
return GameData::Target.get(ghost_target)
|
||||
end
|
||||
return super
|
||||
end
|
||||
|
||||
@@ -375,9 +378,14 @@ end
|
||||
|
||||
#===============================================================================
|
||||
# Removes trapping moves, entry hazards and Leech Seed on user/user's side.
|
||||
# (Rapid Spin)
|
||||
# Raises user's Speed by 1 stage (Gen 8+). (Rapid Spin)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_110 < PokeBattle_Move
|
||||
class PokeBattle_Move_110 < PokeBattle_StatUpMove
|
||||
def initialize(battle,move)
|
||||
super
|
||||
@statUp = [:SPEED, 1]
|
||||
end
|
||||
|
||||
def pbEffectAfterAllHits(user,target)
|
||||
return if user.fainted? || target.damageState.unaffected
|
||||
if user.effects[PBEffects::Trapping]>0
|
||||
@@ -409,6 +417,10 @@ class PokeBattle_Move_110 < PokeBattle_Move
|
||||
@battle.pbDisplay(_INTL("{1} blew away sticky webs!",user.pbThis))
|
||||
end
|
||||
end
|
||||
|
||||
def pbAdditionalEffect(user,target)
|
||||
super if Settings::MECHANICS_GENERATION >= 8
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user