Skip to content

Commit

Permalink
0.12.0 challenges
Browse files Browse the repository at this point in the history
  • Loading branch information
kurayamiblackheart committed Feb 22, 2024
1 parent 3f220e9 commit e74693a
Show file tree
Hide file tree
Showing 7 changed files with 198 additions and 27 deletions.
2 changes: 1 addition & 1 deletion Data/Scripts/001_Settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module Settings
# The version of your game. It has to adhere to the MAJOR.MINOR.PATCH format.
GAME_VERSION = '6.0.0'
IF_VERSION = "6.0.4"
GAME_VERSION_NUMBER = "0.11.30"
GAME_VERSION_NUMBER = "0.12.0"

POKERADAR_LIGHT_ANIMATION_RED_ID = 17
POKERADAR_LIGHT_ANIMATION_GREEN_ID = 18
Expand Down
5 changes: 5 additions & 0 deletions Data/Scripts/011_Battle/001_Battler/001_PokeBattle_Battler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,11 @@ def pbOwnedByPlayer?
return @battle.pbOwnedByPlayer?(@index)
end

# Returns whether self is owned by the player.
def pbOwnedByPlayerSerious?
return @battle.pbOwnedByPlayerSerious?(@index)
end

# Returns 0 if self is on the player's side, or 1 if self is on the opposing
# side.
def idxOwnSide
Expand Down
75 changes: 50 additions & 25 deletions Data/Scripts/011_Battle/001_Battler/007_Battler_UseMove.rb
Original file line number Diff line number Diff line change
Expand Up @@ -183,39 +183,64 @@ def pbUseMove(choice, specialUsage = false)
end
end
end
# Labels the move being used as "move"
move = choice[2]
return if !move # if move was not chosen somehow
# Try to use the move (inc. disobedience)
@lastMoveFailed = false
if !pbTryUseMove(choice, move, specialUsage, skipAccuracyCheck)
@lastMoveUsed = nil
@lastMoveUsedType = nil
if !specialUsage
@lastRegularMoveUsed = nil
@lastRegularMoveTarget = -1
normallogic = true
isletdown = false
if $PokemonSystem.ch_letdown && $PokemonSystem.ch_letdown != 0 && !specialUsage
skipletdown = false
if $PokemonSystem.ch_letdownplayer && $PokemonSystem.ch_letdownplayer == 1 && !pbOwnedByPlayerSerious?
skipletdown = true
end
if !skipletdown
letdownrng = rand(1..100)
letdownprob = [0, 1, 5, 10, 25, 50, 50]#Just in case
if letdownprob[$PokemonSystem.ch_letdown] >= letdownrng
isletdown = true
normallogic = false
move = PokeBattle_Move.from_pokemon_move(@battle, Pokemon::Move.new(:SPLASH))
end
end
@battle.pbGainExp # In case self is KO'd due to confusion
pbCancelMoves
pbEndTurn(choice)
return
end
move = choice[2] # In case disobedience changed the move to be used
return if !move # if move was not chosen somehow
# Subtract PP
if !specialUsage
if !pbReducePP(move)
@battle.pbDisplay(_INTL("{1} used {2}!", pbThis, move.name))
@battle.pbDisplay(_INTL("But there was no PP left for the move!"))
if $PokemonSystem.ch_metronome && !usingMultiTurnAttack? && !specialUsage && !isletdown
if $PokemonSystem.ch_metronome == 1 || ($PokemonSystem.ch_metronome == 2 && pbOwnedByPlayerSerious?)
move = PokeBattle_Move.from_pokemon_move(@battle, Pokemon::Move.new(:METRONOME))
normallogic = false
end
end
if normallogic
# Labels the move being used as "move"
move = choice[2]
return if !move # if move was not chosen somehow
# Try to use the move (inc. disobedience)
@lastMoveFailed = false
if !pbTryUseMove(choice, move, specialUsage, skipAccuracyCheck)
@lastMoveUsed = nil
@lastMoveUsedType = nil
@lastRegularMoveUsed = nil
@lastRegularMoveTarget = -1
@lastMoveFailed = true
if !specialUsage
@lastRegularMoveUsed = nil
@lastRegularMoveTarget = -1
end
@battle.pbGainExp # In case self is KO'd due to confusion
pbCancelMoves
pbEndTurn(choice)
return
end
move = choice[2] # In case disobedience changed the move to be used
return if !move # if move was not chosen somehow
# Subtract PP
if !specialUsage
if !pbReducePP(move)
@battle.pbDisplay(_INTL("{1} used {2}!", pbThis, move.name))
@battle.pbDisplay(_INTL("But there was no PP left for the move!"))
@lastMoveUsed = nil
@lastMoveUsedType = nil
@lastRegularMoveUsed = nil
@lastRegularMoveTarget = -1
@lastMoveFailed = true
pbCancelMoves
pbEndTurn(choice)
return
end
end
end
# Stance Change
if self.ability == :STANCECHANGE
Expand Down
5 changes: 5 additions & 0 deletions Data/Scripts/011_Battle/003_Battle/002_PokeBattle_Battle.rb
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,11 @@ def pbOwnedByPlayer?(idxBattler)
return pbGetOwnerIndexFromBattlerIndex(idxBattler)==0
end

def pbOwnedByPlayerSerious?(idxBattler)
return false if opposes?(idxBattler)
return pbGetOwnerIndexFromBattlerIndex(idxBattler)==0
end

# Returns the number of Pokémon positions controlled by the given trainerIndex
# on the given side of battle.
def pbNumPositions(side,idxTrainer)
Expand Down
20 changes: 20 additions & 0 deletions Data/Scripts/011_Battle/003_Battle/012_Battle_Phase_EndOfRound.rb
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,26 @@ def pbEndOfRoundPhase
priority = pbPriority(true) # in order of fastest -> slowest speeds only
# Weather
pbEORWeather(priority)
# BerserkerIncrease
if $PokemonSystem.ch_berserker && $PokemonSystem.ch_berserker != 0
@positions.each_with_index do |pos,idxPos|
next if !pos || @battlers[idxPos].pbOwnedByPlayerSerious?
requiredturns = [1, 3, 2, 1, 1]
if requiredturns[$PokemonSystem.ch_berserker] > 1
next if @battlers[idxPos].turnCount % requiredturns[$PokemonSystem.ch_berserker] != 0
end
berserkup = [:ATTACK,1,:DEFENSE,1,:SPECIAL_ATTACK,1,:SPECIAL_DEFENSE,1,:SPEED,1]
next if !@battlers[idxPos].pbCanRaiseStatStage?(berserkup[0],@battlers[idxPos],self,true)
pbDisplay(_INTL("All stats from {1} increased! [BERSERKER MODE]",@battlers[idxPos].pbThis))
showAnim = true
for i in 0...berserkup.length/2
next if !@battlers[idxPos].pbCanRaiseStatStage?(berserkup[i*2],@battlers[idxPos],self)
if @battlers[idxPos].pbRaiseStatStage(berserkup[i*2],berserkup[i*2+1],@battlers[idxPos],showAnim)
showAnim = false
end
end
end
end
# Future Sight/Doom Desire
@positions.each_with_index do |pos,idxPos|
next if !pos || pos.effects[PBEffects::FutureSightCounter]==0
Expand Down
116 changes: 116 additions & 0 deletions Data/Scripts/016_UI/015_UI_Options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@ class PokemonSystem
attr_accessor :icebuff
#End of By Blue Wuppo

attr_accessor :ch_metronome
attr_accessor :ch_letdownplayer
attr_accessor :ch_letdown
attr_accessor :ch_berserker

attr_accessor :dexspriteselect

def initialize
Expand Down Expand Up @@ -189,6 +194,13 @@ def initialize
@eventmoves = 0
@nopngexport = 0
@nopngimport = 0

# Challenges
@ch_metronome = 0
@ch_letdownplayer = 0
@ch_letdown = 0
@ch_berserker = 0

@custom_bst = 0
@custom_bst_sliders = { :HP => 65, :ATTACK => 35, :DEFENSE => 35,
:SPECIAL_ATTACK => 65, :SPECIAL_DEFENSE => 65, :SPEED => 35 }
Expand Down Expand Up @@ -307,6 +319,10 @@ def load_file_data(saved)
@drowsy = saved.drowsy if saved.drowsy
@bugbuff = saved.bugbuff if saved.bugbuff
@icebuff = saved.icebuff if saved.icebuff
@ch_metronome = saved.ch_metronome if saved.ch_metronome
@ch_letdownplayer = saved.ch_letdownplayer if saved.ch_letdownplayer
@ch_letdown = saved.ch_letdown if saved.ch_letdown
@ch_berserker = saved.ch_berserker if saved.ch_berserker
#End of By Blue Wuppo
end
end
Expand Down Expand Up @@ -1078,6 +1094,12 @@ def pbGetOptions(inloadscreen = false)
openKuray5()
}, "Self-battling & import features"
)
options << ButtonOption.new(_INTL("Challenges"),
proc {
@kuray_menu = true
openKuray6()
}, "Challenges"
)
options << ButtonOption.new(_INTL("Others"),
proc {
@kuray_menu = true
Expand Down Expand Up @@ -1166,6 +1188,15 @@ def openKuray5()
}
@kuray_menu = false
end
def openKuray6()
return if !@kuray_menu
pbFadeOutIn {
scene = KurayOptSc_6.new
screen = PokemonOptionScreen.new(scene)
screen.pbStartScreen
}
@kuray_menu = false
end
end


Expand Down Expand Up @@ -1632,6 +1663,91 @@ def pbGetOptions(inloadscreen = false)
end
end

#===============================================================================
# CHALLENGES
#===============================================================================
class KurayOptSc_6 < PokemonOption_Scene
def initialize
@changedColor = false
end

def pbStartScene(inloadscreen = false)
super
@sprites["option"].nameBaseColor = Color.new(35, 35, 200)
@sprites["option"].nameShadowColor = Color.new(20, 20, 115)
@changedColor = true
for i in 0...@PokemonOptions.length
@sprites["option"][i] = (@PokemonOptions[i].get || 0)
end
@sprites["title"]=Window_UnformattedTextPokemon.newWithSize(
_INTL("Challenges settings"),0,0,Graphics.width,64,@viewport)
@sprites["textbox"].text=_INTL("Customize modded features")


pbFadeInAndShow(@sprites) { pbUpdate }
end

def pbFadeInAndShow(sprites, visiblesprites = nil)
return if !@changedColor
super
end

def pbGetOptions(inloadscreen = false)
options = []

if $scene && $scene.is_a?(Scene_Map)
options.concat(pbGetInGameOptions())
else
options << ButtonOption.new(_INTL("### EMPTY ###"),
proc {}
)
end
return options
end

def pbGetInGameOptions()
options = []
options << ButtonOption.new(_INTL("### PER-SAVE FILE ###"),
proc {}
)

options << EnumOption.new(_INTL("Metronome Madness"), [_INTL("Off"), _INTL("Normal"), _INTL("Hard")],
proc { $PokemonSystem.ch_metronome },
proc { |value| $PokemonSystem.ch_metronome = value },
["Metronome disabled.",
"All Pokemons are forced to use Metronome. [Normal]",
"Only your Pokemons are forced to use Metronome. [Hard]"]
)
options << EnumOption.new(_INTL("Letdown"), [_INTL("Off"), _INTL("1%"), _INTL("5%"), _INTL("10%"), _INTL("25%"), _INTL("50%")],
proc { $PokemonSystem.ch_letdown },
proc { |value| $PokemonSystem.ch_letdown = value },
["Letdown disabled.",
"1% chance that Pokemons use Splash instead.",
"5% chance that Pokemons use Splash instead.",
"10% chance that Pokemons use Splash instead.",
"25% chance that Pokemons use Splash instead.",
"50% chance that Pokemons use Splash instead."]
)
options << EnumOption.new(_INTL("Letdown Player Only"), [_INTL("Off"), _INTL("On")],
proc { $PokemonSystem.ch_letdownplayer },
proc { |value| $PokemonSystem.ch_letdownplayer = value },
["Letdown doesn't only affect the player.",
"Letdown only affects the player."]
)
options << EnumOption.new(_INTL("Berserker"), [_INTL("Off"), _INTL("Easy"), _INTL("Normal"), _INTL("Hard"), _INTL("Chaos")],
proc { $PokemonSystem.ch_berserker },
proc { |value| $PokemonSystem.ch_berserker = value },
["Berserker disabled.",
"Opponent stats raise by 1 every 3 turns. [Easy]",
"Opponent stats raise by 1 every 2 turns. [Normal]",
"Opponent stats raise by 1 every turn. [Hard]",
"Opponent stats raise by 2 every turn. [Hardcore]"]
)

return options
end
end

#===============================================================================
# OTHERS
#===============================================================================
Expand Down
2 changes: 1 addition & 1 deletion Data/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.11.30
0.12.0

0 comments on commit e74693a

Please sign in to comment.