diff --git a/Data/Scripts/003_Game classes/005_Game_Character.rb b/Data/Scripts/003_Game classes/005_Game_Character.rb index 84899b870..a940d2cd3 100644 --- a/Data/Scripts/003_Game classes/005_Game_Character.rb +++ b/Data/Scripts/003_Game classes/005_Game_Character.rb @@ -98,7 +98,12 @@ class Game_Character end def jump_speed_real - return (2 ** (3 + 1)) * 0.8 * 40.0 / Graphics.frame_rate # Walking speed + self.jump_speed_real = (2 ** (3 + 1)) * 0.8 if !@jump_speed_real # 3 is walking speed + return @jump_speed_real + end + + def jump_speed_real=(val) + @jump_speed_real = val * 40.0 / Graphics.frame_rate end def move_frequency=(val) @@ -654,6 +659,7 @@ class Game_Character if real_distance > 0 # Jumping to somewhere else @jump_count = 0 else # Jumping on the spot + @jump_speed_real = nil # Reset jump speed @jump_count = Game_Map::REAL_RES_X / jump_speed_real # Number of frames to jump one tile end @stop_count = 0 diff --git a/Data/Scripts/012_Battle/001_Battler/006_Battler_AbilityAndItem.rb b/Data/Scripts/012_Battle/001_Battler/006_Battler_AbilityAndItem.rb index a15f3d0c7..b8e2a1396 100644 --- a/Data/Scripts/012_Battle/001_Battler/006_Battler_AbilityAndItem.rb +++ b/Data/Scripts/012_Battle/001_Battler/006_Battler_AbilityAndItem.rb @@ -124,8 +124,13 @@ class PokeBattle_Battler #============================================================================= # Held item consuming/removing #============================================================================= - def pbCanConsumeBerry?(_item, check_gluttony = true) + def canConsumeBerry? return false if @battle.pbCheckOpposingAbility(:UNNERVE, @index) + return true + end + + def canConsumePinchBerry?(_item, check_gluttony = true) + return false if !canConsumeBerry? return true if @hp <= @totalhp / 4 return true if @hp <= @totalhp / 2 && (!check_gluttony || hasActiveAbility?(:GLUTTONY)) return false diff --git a/Data/Scripts/012_Battle/002_Move/006_Move_Effects_080-0FF.rb b/Data/Scripts/012_Battle/002_Move/006_Move_Effects_080-0FF.rb index 73fd8002a..e58ae3dcd 100644 --- a/Data/Scripts/012_Battle/002_Move/006_Move_Effects_080-0FF.rb +++ b/Data/Scripts/012_Battle/002_Move/006_Move_Effects_080-0FF.rb @@ -1202,9 +1202,14 @@ class PokeBattle_Move_0AF < PokeBattle_Move end end + def pbChangeUsageCounters(user,specialUsage) + super + @copied_move = @battle.lastMoveUsed + end + def pbMoveFailed?(user,targets) - if !@battle.lastMoveUsed || - @moveBlacklist.include?(GameData::Move.get(@battle.lastMoveUsed).function_code) + if !@copied_move || + @moveBlacklist.include?(GameData::Move.get(@copied_move).function_code) @battle.pbDisplay(_INTL("But it failed!")) return true end @@ -1212,7 +1217,7 @@ class PokeBattle_Move_0AF < PokeBattle_Move end def pbEffectGeneral(user) - user.pbUseMoveSimple(@battle.lastMoveUsed) + user.pbUseMoveSimple(@copied_move) end end @@ -3528,9 +3533,7 @@ class PokeBattle_Move_0F7 < PokeBattle_Move @willFail = false @willFail = true if !user.item || !user.itemActive? || user.unlosableItem?(user.item) return if @willFail - if user.item.is_berry? && @battle.pbCheckOpposingAbility(:UNNERVE,user.index) - @willFail = true - end + @willFail = true if user.item.is_berry? && !user.canConsumeBerry? return if @willFail return if user.item.is_mega_stone? flingableItem = false diff --git a/Data/Scripts/012_Battle/003_Battle/006_Battle_Action_Switching.rb b/Data/Scripts/012_Battle/003_Battle/006_Battle_Action_Switching.rb index 76b744c3a..e335bbd45 100644 --- a/Data/Scripts/012_Battle/003_Battle/006_Battle_Action_Switching.rb +++ b/Data/Scripts/012_Battle/003_Battle/006_Battle_Action_Switching.rb @@ -238,7 +238,7 @@ class PokeBattle_Battle elsif battler.hp<=battler.totalhp/2 pbDisplayBrief(_INTL("OK, {1}! Come back!",battler.name)) elsif battler.turnCount>=5 - pbDisplayBrief(_INTL("{1}, that’s enough! Come back!",battler.name)) + pbDisplayBrief(_INTL("{1}, that's enough! Come back!",battler.name)) elsif battler.turnCount>=2 pbDisplayBrief(_INTL("{1}, come back!",battler.name)) else diff --git a/Data/Scripts/012_Battle/006_BattleHandlers.rb b/Data/Scripts/012_Battle/006_BattleHandlers.rb index 821c4b997..76371ff45 100644 --- a/Data/Scripts/012_Battle/006_BattleHandlers.rb +++ b/Data/Scripts/012_Battle/006_BattleHandlers.rb @@ -491,7 +491,7 @@ FINAL_DMG_MULT = 3 def pbBattleConfusionBerry(battler,battle,item,forced,flavor,confuseMsg) return false if !forced && !battler.canHeal? - return false if !forced && !battler.pbCanConsumeBerry?(item, (MECHANICS_GENERATION >= 7)) + return false if !forced && !battler.canConsumePinchBerry?(item, (MECHANICS_GENERATION >= 7)) itemName = GameData::Item.get(item).name battle.pbCommonAnimation("EatBerry",battler) if !forced fraction_to_heal = 8 # Gens 6 and lower @@ -517,7 +517,7 @@ def pbBattleConfusionBerry(battler,battle,item,forced,flavor,confuseMsg) end def pbBattleStatIncreasingBerry(battler,battle,item,forced,stat,increment=1) - return false if !forced && !battler.pbCanConsumeBerry?(item) + return false if !forced && !battler.canConsumePinchBerry?(item) return false if !battler.pbCanRaiseStatStage?(stat,battler) itemName = GameData::Item.get(item).name if forced diff --git a/Data/Scripts/012_Battle/008_BattleHandlers_Items.rb b/Data/Scripts/012_Battle/008_BattleHandlers_Items.rb index 95a2cdbf7..c399b9788 100644 --- a/Data/Scripts/012_Battle/008_BattleHandlers_Items.rb +++ b/Data/Scripts/012_Battle/008_BattleHandlers_Items.rb @@ -97,7 +97,7 @@ BattleHandlers::HPHealItem.add(:IAPAPABERRY, BattleHandlers::HPHealItem.add(:LANSATBERRY, proc { |item,battler,battle,forced| - next false if !forced && !battler.pbCanConsumeBerry?(item) + next false if !forced && !battler.canConsumePinchBerry?(item) next false if battler.effects[PBEffects::FocusEnergy]>=2 battle.pbCommonAnimation("EatBerry",battler) if !forced battler.effects[PBEffects::FocusEnergy] = 2 @@ -126,7 +126,7 @@ BattleHandlers::HPHealItem.add(:MAGOBERRY, BattleHandlers::HPHealItem.add(:MICLEBERRY, proc { |item,battler,battle,forced| - next false if !forced && !battler.pbCanConsumeBerry?(item) + next false if !forced && !battler.canConsumePinchBerry?(item) next false if !battler.effects[PBEffects::MicleBerry] battle.pbCommonAnimation("EatBerry",battler) if !forced battler.effects[PBEffects::MicleBerry] = true @@ -145,7 +145,7 @@ BattleHandlers::HPHealItem.add(:MICLEBERRY, BattleHandlers::HPHealItem.add(:ORANBERRY, proc { |item,battler,battle,forced| next false if !battler.canHeal? - next false if !forced && battle.pbCheckOpposingAbility(:UNNERVE,battler.index) + next false if !forced && !battler.canConsumeBerry? next false if !forced && battler.hp>battler.totalhp/2 battle.pbCommonAnimation("EatBerry",battler) if !forced battler.pbRecoverHP(10) @@ -175,7 +175,7 @@ BattleHandlers::HPHealItem.add(:SALACBERRY, BattleHandlers::HPHealItem.add(:SITRUSBERRY, proc { |item,battler,battle,forced| next false if !battler.canHeal? - next false if !forced && battle.pbCheckOpposingAbility(:UNNERVE,battler.index) + next false if !forced && !battler.canConsumeBerry? next false if !forced && battler.hp>battler.totalhp/2 battle.pbCommonAnimation("EatBerry",battler) if !forced battler.pbRecoverHP(battler.totalhp/4) @@ -213,7 +213,7 @@ BattleHandlers::HPHealItem.add(:WIKIBERRY, BattleHandlers::StatusCureItem.add(:ASPEARBERRY, proc { |item,battler,battle,forced| - next false if !forced && battle.pbCheckOpposingAbility(:UNNERVE,battler.index) + next false if !forced && !battler.canConsumeBerry? next false if battler.status!=PBStatuses::FROZEN itemName = GameData::Item.get(item).name PBDebug.log("[Item triggered] #{battler.pbThis}'s #{itemName}") if forced @@ -226,7 +226,7 @@ BattleHandlers::StatusCureItem.add(:ASPEARBERRY, BattleHandlers::StatusCureItem.add(:CHERIBERRY, proc { |item,battler,battle,forced| - next false if !forced && battle.pbCheckOpposingAbility(:UNNERVE,battler.index) + next false if !forced && !battler.canConsumeBerry? next false if battler.status!=PBStatuses::PARALYSIS itemName = GameData::Item.get(item).name PBDebug.log("[Item triggered] #{battler.pbThis}'s #{itemName}") if forced @@ -239,7 +239,7 @@ BattleHandlers::StatusCureItem.add(:CHERIBERRY, BattleHandlers::StatusCureItem.add(:CHESTOBERRY, proc { |item,battler,battle,forced| - next false if !forced && battle.pbCheckOpposingAbility(:UNNERVE,battler.index) + next false if !forced && !battler.canConsumeBerry? next false if battler.status!=PBStatuses::SLEEP itemName = GameData::Item.get(item).name PBDebug.log("[Item triggered] #{battler.pbThis}'s #{itemName}") if forced @@ -252,7 +252,7 @@ BattleHandlers::StatusCureItem.add(:CHESTOBERRY, BattleHandlers::StatusCureItem.add(:LUMBERRY, proc { |item,battler,battle,forced| - next false if !forced && battle.pbCheckOpposingAbility(:UNNERVE,battler.index) + next false if !forced && !battler.canConsumeBerry? next false if battler.status==PBStatuses::NONE && battler.effects[PBEffects::Confusion]==0 itemName = GameData::Item.get(item).name @@ -322,7 +322,7 @@ BattleHandlers::StatusCureItem.add(:MENTALHERB, BattleHandlers::StatusCureItem.add(:PECHABERRY, proc { |item,battler,battle,forced| - next false if !forced && battle.pbCheckOpposingAbility(:UNNERVE,battler.index) + next false if !forced && !battler.canConsumeBerry? next false if battler.status!=PBStatuses::POISON itemName = GameData::Item.get(item).name PBDebug.log("[Item triggered] #{battler.pbThis}'s #{itemName}") if forced @@ -335,7 +335,7 @@ BattleHandlers::StatusCureItem.add(:PECHABERRY, BattleHandlers::StatusCureItem.add(:PERSIMBERRY, proc { |item,battler,battle,forced| - next false if !forced && battle.pbCheckOpposingAbility(:UNNERVE,battler.index) + next false if !forced && !battler.canConsumeBerry? next false if battler.effects[PBEffects::Confusion]==0 itemName = GameData::Item.get(item).name PBDebug.log("[Item triggered] #{battler.pbThis}'s #{itemName}") if forced @@ -353,7 +353,7 @@ BattleHandlers::StatusCureItem.add(:PERSIMBERRY, BattleHandlers::StatusCureItem.add(:RAWSTBERRY, proc { |item,battler,battle,forced| - next false if !forced && battle.pbCheckOpposingAbility(:UNNERVE,battler.index) + next false if !forced && !battler.canConsumeBerry? next false if battler.status!=PBStatuses::BURN itemName = GameData::Item.get(item).name PBDebug.log("[Item triggered] #{battler.pbThis}'s #{itemName}") if forced @@ -370,7 +370,7 @@ BattleHandlers::StatusCureItem.add(:RAWSTBERRY, BattleHandlers::PriorityBracketChangeItem.add(:CUSTAPBERRY, proc { |item,battler,subPri,battle| - next if !battler.pbCanConsumeBerry?(item) + next if !battler.canConsumePinchBerry?(item) next 1 if subPri<1 } ) @@ -1034,7 +1034,7 @@ BattleHandlers::TargetItemOnHit.add(:ENIGMABERRY, BattleHandlers::TargetItemOnHit.add(:JABOCABERRY, proc { |item,user,target,move,battle| - next if battle.pbCheckOpposingAbility(:UNNERVE,target.index) + next if !target.canConsumeBerry? next if !move.physicalMove? next if !user.takesIndirectDamage? battle.pbCommonAnimation("EatBerry",target) @@ -1096,7 +1096,7 @@ BattleHandlers::TargetItemOnHit.add(:ROCKYHELMET, BattleHandlers::TargetItemOnHit.add(:ROWAPBERRY, proc { |item,user,target,move,battle| - next if battle.pbCheckOpposingAbility(:UNNERVE,target.index) + next if !target.canConsumeBerry? next if !move.specialMove? next if !user.takesIndirectDamage? battle.pbCommonAnimation("EatBerry",target) @@ -1164,7 +1164,7 @@ BattleHandlers::TargetItemOnHit.add(:WEAKNESSPOLICY, BattleHandlers::TargetItemOnHitPositiveBerry.add(:ENIGMABERRY, proc { |item,battler,battle,forced| next false if !battler.canHeal? - next false if !forced && battle.pbCheckOpposingAbility(:UNNERVE,battler.index) + next false if !forced && !battler.canConsumeBerry? itemName = GameData::Item.get(item).name PBDebug.log("[Item triggered] #{battler.pbThis}'s #{itemName}") if forced battle.pbCommonAnimation("EatBerry",battler) if !forced @@ -1181,7 +1181,7 @@ BattleHandlers::TargetItemOnHitPositiveBerry.add(:ENIGMABERRY, BattleHandlers::TargetItemOnHitPositiveBerry.add(:KEEBERRY, proc { |item,battler,battle,forced| - next false if !forced && battle.pbCheckOpposingAbility(:UNNERVE,battler.index) + next false if !forced && !battler.canConsumeBerry? next false if !battler.pbCanRaiseStatStage?(PBStats::DEFENSE,battler) itemName = GameData::Item.get(item).name if !forced @@ -1195,7 +1195,7 @@ BattleHandlers::TargetItemOnHitPositiveBerry.add(:KEEBERRY, BattleHandlers::TargetItemOnHitPositiveBerry.add(:MARANGABERRY, proc { |item,battler,battle,forced| - next false if !forced && battle.pbCheckOpposingAbility(:UNNERVE,battler.index) + next false if !forced && !battler.canConsumeBerry? next false if !battler.pbCanRaiseStatStage?(PBStats::SPDEF,battler) itemName = GameData::Item.get(item).name if !forced @@ -1282,7 +1282,7 @@ BattleHandlers::UserItemAfterMoveUse.add(:SHELLBELL, BattleHandlers::EndOfMoveItem.add(:LEPPABERRY, proc { |item,battler,battle,forced| - next false if !forced && battle.pbCheckOpposingAbility(:UNNERVE,battler.index) + next false if !forced && !battler.canConsumeBerry? found = [] battler.pokemon.moves.each_with_index do |m,i| next if m.total_pp<=0 || m.pp==m.total_pp diff --git a/Data/Scripts/013_Overworld/014_PField_DependentEvents.rb b/Data/Scripts/013_Overworld/014_PField_DependentEvents.rb index 4079034a9..6d809980d 100644 --- a/Data/Scripts/013_Overworld/014_PField_DependentEvents.rb +++ b/Data/Scripts/013_Overworld/014_PField_DependentEvents.rb @@ -97,7 +97,7 @@ def moveFancy(follower,direction) end # Same map only -def jumpFancy(follower,direction) +def jumpFancy(follower,direction,leader) deltaX=(direction == 6 ? 2 : (direction == 4 ? -2 : 0)) deltaY=(direction == 2 ? 2 : (direction == 8 ? -2 : 0)) halfDeltaX=(direction == 6 ? 1 : (direction == 4 ? -1 : 0)) @@ -109,6 +109,11 @@ def jumpFancy(follower,direction) moveFancy(follower,direction) elsif ending if pbTestPass(follower,follower.x,follower.y,0) + if leader.jumping? + follower.jump_speed_real = leader.jump_speed_real * Graphics.frame_rate / 40.0 + else + follower.jump_speed_real = leader.move_speed_real * Graphics.frame_rate / 20.0 + end follower.jump(deltaX,deltaY) else moveThrough(follower,direction) @@ -117,7 +122,7 @@ def jumpFancy(follower,direction) end end -def pbFancyMoveTo(follower,newX,newY) +def pbFancyMoveTo(follower,newX,newY,leader) if follower.x-newX==-1 && follower.y==newY moveFancy(follower,6) elsif follower.x-newX==1 && follower.y==newY @@ -127,13 +132,13 @@ def pbFancyMoveTo(follower,newX,newY) elsif follower.y-newY==1 && follower.x==newX moveFancy(follower,8) elsif follower.x-newX==-2 && follower.y==newY - jumpFancy(follower,6) + jumpFancy(follower,6,leader) elsif follower.x-newX==2 && follower.y==newY - jumpFancy(follower,4) + jumpFancy(follower,4,leader) elsif follower.y-newY==-2 && follower.x==newX - jumpFancy(follower,2) + jumpFancy(follower,2,leader) elsif follower.y-newY==2 && follower.x==newX - jumpFancy(follower,8) + jumpFancy(follower,8,leader) elsif follower.x!=newX || follower.y!=newY follower.moveto(newX,newY) end @@ -209,8 +214,8 @@ class DependentEvents end end facings=[facingDirection] # Get facing from behind - facings.push([0,0,4,0,8,0,2,0,6][d]) # Get right facing - facings.push([0,0,6,0,2,0,8,0,4][d]) # Get left facing +# facings.push([0,0,4,0,8,0,2,0,6][d]) # Get right facing +# facings.push([0,0,6,0,2,0,8,0,4][d]) # Get left facing if !leaderIsTrueLeader facings.push(d) # Get forward facing end @@ -265,7 +270,7 @@ class DependentEvents if instant follower.moveto(newX,newY) else - pbFancyMoveTo(follower,newX,newY) + pbFancyMoveTo(follower,newX,newY,leader) end elsif (follower.x-newX==-2 && follower.y==newY) || (follower.x-newX==2 && follower.y==newY) || @@ -274,17 +279,16 @@ class DependentEvents if instant follower.moveto(newX,newY) else - pbFancyMoveTo(follower,newX,newY) + pbFancyMoveTo(follower,newX,newY,leader) end elsif follower.x!=posX || follower.y!=posY if instant follower.moveto(newX,newY) else - pbFancyMoveTo(follower,posX,posY) - pbFancyMoveTo(follower,newX,newY) + pbFancyMoveTo(follower,posX,posY,leader) + pbFancyMoveTo(follower,newX,newY,leader) end end - pbTurnTowardEvent(follower,leader) else if !mapTile # Make current position into leader's position @@ -293,7 +297,6 @@ class DependentEvents if follower.map.map_id==mapTile[0] # Follower is on same map as leader follower.moveto(leader.x,leader.y) - pbTurnTowardEvent(follower,leader) else # Follower will move to different map events=$PokemonGlobal.dependentEvents @@ -305,7 +308,6 @@ class DependentEvents newEventData[3]=mapTile[1] newEventData[4]=mapTile[2] if mapTile[0]==leader.map.map_id - pbTurnTowardEvent(follower,leader) end end end