~Site
Accueil
Forum
Admin

~Base de scripts
Scripts de base
Scripts Menu
Scripts Combat
Scripts Systθme
Scripts Modifiιs

Scripts de Base
Game_Temp
Game_System
Game_Switches
Game_Variables
Game_SelfSwitches
Game_Screen
Game_Picture
Game_Battler 1
Game_Battler 2
Game_Battler 3
Game_BattleAction
Game_Actor
Game_Enemy
Game_Actors
Game_Party
Game_Troop
Game_Map
Game_CommonEvent
Game_Character 1
Game_Character 2
Game_Character 3
Game_Event
Game_Player
Sprite_Character
Sprite_Battler
Sprite_Picture
Sprite_Timer
Spriteset_Map
Spriteset_Battle
Window_Base
Window_Selectable
Window_Command
Window_Help
Window_Gold
Window_PlayTime
Window_Steps
Window_MenuStatus
Window_Item
Window_Skill
Window_SkillStatus
Window_Target
Window_EquipLeft
Window_EquipRight
Window_EquipItem
Window_Status
Window_SaveFile
Window_ShopCommand
Window_ShopBuy
Window_ShopSell
Window_ShopNumber
Window_ShopStatus
Window_NameEdit
Window_NameInput
Window_InputNumber
Window_Message
Window_PartyCommand
Window_BattleStatus
Window_BattleResult
Window_DebugLeft
Window_DebugRight
Window_Dataset
Arrow_Base
Arrow_Enemy
Arrow_Actor
Interpreter 1
Interpreter 2
Interpreter 3
Interpreter 4
Interpreter 5
Interpreter 6
Interpreter 7
Scene_Title
Scene_Map
Scene_Menu
Scene_Item
Scene_Skill
Scene_Equip
Scene_Status
Scene_File
Scene_Save
Scene_Load
Scene_End
Scene_Battle 1
Scene_Battle 2
Scene_Battle 3
Scene_Battle 4
Scene_Shop
Scene_Name
Scene_Gameover
Scene_Debug
Main


Scene_Battle 1 ::: postι le 2006-02-16 @ 10:26:00
Auteur: Yukihiro matsumoto

#============================================
# ‘ Scene_Battle (•ͺŠ„’θ‹` 1)
#----------------------------------------------
# @ƒoƒgƒ‹‰ζ–ʂ̏ˆ—‚πs‚€ƒNƒ‰ƒX‚Ε‚·B
#============================================

class Scene_Battle
#------------------------------------------
# œ ƒƒCƒ“ˆ—
#------------------------------------------
def main
# ν“¬—p‚ΜŠeŽνˆκŽžƒf[ƒ^‚π‰Šϊ‰»
$game_temp.in_battle = true
$game_temp.battle_turn = 0
$game_temp.battle_event_flags.clear
$game_temp.battle_abort = false
$game_temp.battle_main_phase = false
$game_temp.battleback_name = $game_map.battleback_name
$game_temp.forcing_battler = nil
# ƒoƒgƒ‹ƒCƒxƒ“ƒg—pƒCƒ“ƒ^ƒvƒŠƒ^‚π‰Šϊ‰»
$game_system.battle_interpreter.setup(nil, 0)
# ƒgƒ‹[ƒv‚π€”υ
@troop_id = $game_temp.battle_troop_id
$game_troop.setup(@troop_id)
# ƒAƒNƒ^[ƒRƒ}ƒ“ƒhƒEƒBƒ“ƒhƒE‚πμ¬
s1 = $data_system.words.attack
s2 = $data_system.words.skill
s3 = $data_system.words.guard
s4 = $data_system.words.item
@actor_command_window = Window_Command.new(160, [s1, s2, s3, s4])
@actor_command_window.y = 160
@actor_command_window.back_opacity = 160
@actor_command_window.active = false
@actor_command_window.visible = false
# ‚»‚Μ‘Ό‚ΜƒEƒBƒ“ƒhƒE‚πμ¬
@party_command_window = Window_PartyCommand.new
@help_window = Window_Help.new
@help_window.back_opacity = 160
@help_window.visible = false
@status_window = Window_BattleStatus.new
@message_window = Window_Message.new
# ƒXƒvƒ‰ƒCƒgƒZƒbƒg‚πμ¬
@spriteset = Spriteset_Battle.new
# ƒEƒFƒCƒgƒJƒEƒ“ƒg‚π‰Šϊ‰»
@wait_count = 0
# ƒgƒ‰ƒ“ƒWƒVƒ‡ƒ“Žΐs
if $data_system.battle_transition == ""
Graphics.transition(20)
else
Graphics.transition(40, "Graphics/Transitions/" +
$data_system.battle_transition)
end
# ƒvƒŒƒoƒgƒ‹ƒtƒF[ƒYŠJŽn
start_phase1
# ƒƒCƒ“ƒ‹[ƒv
loop do
# ƒQ[ƒ€‰ζ–Κ‚πXV
Graphics.update
# “ό—͏ξ•ρ‚πXV
Input.update
# ƒtƒŒ[ƒ€XV
update
# ‰ζ–Κ‚ͺΨ‚θ‘Φ‚ν‚Α‚½‚烋[ƒv‚π’†’f
if $scene != self
break
end
end
# ƒ}ƒbƒv‚πƒŠƒtƒŒƒbƒVƒ…
$game_map.refresh
# ƒgƒ‰ƒ“ƒWƒVƒ‡ƒ“€”υ
Graphics.freeze
# ƒEƒBƒ“ƒhƒE‚π‰π•ϊ
@actor_command_window.dispose
@party_command_window.dispose
@help_window.dispose
@status_window.dispose
@message_window.dispose
if @skill_window != nil
@skill_window.dispose
end
if @item_window != nil
@item_window.dispose
end
if @result_window != nil
@result_window.dispose
end
# ƒXƒvƒ‰ƒCƒgƒZƒbƒg‚π‰π•ϊ
@spriteset.dispose
# ƒ^ƒCƒgƒ‹‰ζ–ʂɐ؂θ‘Φ‚¦’†‚̏ꍇ
if $scene.is_a?(Scene_Title)
# ‰ζ–Κ‚πƒtƒF[ƒhƒAƒEƒg
Graphics.transition
Graphics.freeze
end
# ν“¬ƒeƒXƒg‚©‚ηƒQ[ƒ€ƒI[ƒo[‰ζ–ΚˆΘŠO‚ɐ؂θ‘Φ‚¦’†‚̏ꍇ
if $BTEST and not $scene.is_a?(Scene_Gameover)
$scene = nil
end
end
#------------------------------------------
# œ Ÿ”s”»’θ
#------------------------------------------
def judge
# ‘S–Ε”»’θ‚ͺ^A‚ά‚½‚Νƒp[ƒeƒBl”‚ͺ 0 l‚̏ꍇ
if $game_party.all_dead? or $game_party.actors.size == 0
# ”s–k‰Β”‚̏ꍇ
if $game_temp.battle_can_lose
# ƒoƒgƒ‹ŠJŽn‘O‚Μ BGM ‚Ι–ί‚·
$game_system.bgm_play($game_temp.map_bgm)
# ƒoƒgƒ‹I—Ή
battle_end(2)
# true ‚π•Τ‚·
return true
end
# ƒQ[ƒ€ƒI[ƒo[ƒtƒ‰ƒO‚πƒZƒbƒg
$game_temp.gameover = true
# true ‚π•Τ‚·
return true
end
# ƒGƒlƒ~[‚ͺ 1 ‘Μ‚Ε‚ΰ‘Άέ‚·‚κ‚Ξ false ‚π•Τ‚·
for enemy in $game_troop.enemies
if enemy.exist?
return false
end
end
# ƒAƒtƒ^[ƒoƒgƒ‹ƒtƒF[ƒYŠJŽn (Ÿ—˜)
start_phase5
# true ‚π•Τ‚·
return true
end
#------------------------------------------
# œ ƒoƒgƒ‹I—Ή
# result : Œ‹‰Κ (0:Ÿ—˜ 1:”s–k 2:“¦‘–)
#------------------------------------------
def battle_end(result)
# ν“¬’†ƒtƒ‰ƒO‚πƒNƒŠƒA
$game_temp.in_battle = false
# ƒp[ƒeƒB‘Sˆυ‚ΜƒAƒNƒVƒ‡ƒ“‚πƒNƒŠƒA
$game_party.clear_actions
# ƒoƒgƒ‹—pƒXƒe[ƒg‚π‰πœ
for actor in $game_party.actors
actor.remove_states_battle
end
# ƒGƒlƒ~[‚πƒNƒŠƒA
$game_troop.enemies.clear
# ƒoƒgƒ‹ ƒR[ƒ‹ƒoƒbƒN‚πŒΔ‚Τ
if $game_temp.battle_proc != nil
$game_temp.battle_proc.call(result)
$game_temp.battle_proc = nil
end
# ƒ}ƒbƒv‰ζ–ʂɐ؂θ‘Φ‚¦
$scene = Scene_Map.new
end
#------------------------------------------
# œ ƒoƒgƒ‹ƒCƒxƒ“ƒg‚ΜƒZƒbƒgƒAƒbƒv
#------------------------------------------
def setup_battle_event
# ƒoƒgƒ‹ƒCƒxƒ“ƒgŽΐs’†‚̏ꍇ
if $game_system.battle_interpreter.running?
return
end
# ƒoƒgƒ‹ƒCƒxƒ“ƒg‚Μ‘Sƒy[ƒW‚πŒŸυ
for index in 0...$data_troops[@troop_id].pages.size
# ƒCƒxƒ“ƒgƒy[ƒW‚πŽζ“Ύ
page = $data_troops[@troop_id].pages[index]
# ƒCƒxƒ“ƒgπŒ‚π c ‚ΕŽQΖ‰Β”‚Ι
c = page.condition
# ‰½‚ΰπŒ‚ͺŽw’θ‚³‚κ‚Δ‚’‚Θ‚’κ‡‚ΝŽŸ‚Μƒy[ƒW‚Φ
unless c.turn_valid or c.enemy_valid or
c.actor_valid or c.switch_valid
next
end
# ŽΐsΟ‚݂̏ꍇ‚ΝŽŸ‚Μƒy[ƒW‚Φ
if $game_temp.battle_event_flags[index]
next
end
# ƒ^[ƒ“ πŒŠm”F
if c.turn_valid
n = $game_temp.battle_turn
a = c.turn_a
b = c.turn_b
if (b == 0 and n != a) or
(b > 0 and (n < 1 or n < a or n % b != a % b))
next
end
end
# ƒGƒlƒ~[ πŒŠm”F
if c.enemy_valid
enemy = $game_troop.enemies[c.enemy_index]
if enemy == nil or enemy.hp * 100.0 / enemy.maxhp > c.enemy_hp
next
end
end
# ƒAƒNƒ^[ πŒŠm”F
if c.actor_valid
actor = $game_actors[c.actor_id]
if actor == nil or actor.hp * 100.0 / actor.maxhp > c.actor_hp
next
end
end
# ƒXƒCƒbƒ` πŒŠm”F
if c.switch_valid
if $game_switches[c.switch_id] == false
next
end
end
# ƒCƒxƒ“ƒg‚πƒZƒbƒgƒAƒbƒv
$game_system.battle_interpreter.setup(page.list, 0)
# ‚±‚Μƒy[ƒW‚ΜƒXƒpƒ“‚ͺ [ƒoƒgƒ‹] ‚© [ƒ^[ƒ“] ‚̏ꍇ
if page.span <= 1
# ŽΐsΟ‚έƒtƒ‰ƒO‚πƒZƒbƒg
$game_temp.battle_event_flags[index] = true
end
return
end
end
#------------------------------------------
# œ ƒtƒŒ[ƒ€XV
#------------------------------------------
def update
# ƒoƒgƒ‹ƒCƒxƒ“ƒgŽΐs’†‚̏ꍇ
if $game_system.battle_interpreter.running?
# ƒCƒ“ƒ^ƒvƒŠƒ^‚πXV
$game_system.battle_interpreter.update
# ƒAƒNƒVƒ‡ƒ“‚π‹­§‚³‚κ‚Δ‚’‚ιƒoƒgƒ‰[‚ͺ‘Άέ‚΅‚Θ‚’κ‡
if $game_temp.forcing_battler == nil
# ƒoƒgƒ‹ƒCƒxƒ“ƒg‚ΜŽΐs‚ͺI‚ν‚Α‚½κ‡
unless $game_system.battle_interpreter.running?
# ν“¬Œp‘±‚̏ꍇAƒoƒgƒ‹ƒCƒxƒ“ƒg‚ΜƒZƒbƒgƒAƒbƒv‚πΔŽΐs
unless judge
setup_battle_event
end
end
# ƒAƒtƒ^[ƒoƒgƒ‹ƒtƒF[ƒY‚Ε‚Θ‚―‚κ‚Ξ
if @phase != 5
# ƒXƒe[ƒ^ƒXƒEƒBƒ“ƒhƒE‚πƒŠƒtƒŒƒbƒVƒ…
@status_window.refresh
end
end
end
# ƒVƒXƒeƒ€ (ƒ^ƒCƒ}[)A‰ζ–Κ‚πXV
$game_system.update
$game_screen.update
# ƒ^ƒCƒ}[‚ͺ 0 ‚Ι‚Θ‚Α‚½κ‡
if $game_system.timer_working and $game_system.timer == 0
# ƒoƒgƒ‹’†’f
$game_temp.battle_abort = true
end
# ƒEƒBƒ“ƒhƒE‚πXV
@help_window.update
@party_command_window.update
@actor_command_window.update
@status_window.update
@message_window.update
# ƒXƒvƒ‰ƒCƒgƒZƒbƒg‚πXV
@spriteset.update
# ƒgƒ‰ƒ“ƒWƒVƒ‡ƒ“ˆ—’†‚̏ꍇ
if $game_temp.transition_processing
# ƒgƒ‰ƒ“ƒWƒVƒ‡ƒ“ˆ—’†ƒtƒ‰ƒO‚πƒNƒŠƒA
$game_temp.transition_processing = false
# ƒgƒ‰ƒ“ƒWƒVƒ‡ƒ“Žΐs
if $game_temp.transition_name == ""
Graphics.transition(20)
else
Graphics.transition(40, "Graphics/Transitions/" +
$game_temp.transition_name)
end
end
# ƒƒbƒZ[ƒWƒEƒBƒ“ƒhƒE•ަ’†‚̏ꍇ
if $game_temp.message_window_showing
return
end
# ƒGƒtƒFƒNƒg•ަ’†‚̏ꍇ
if @spriteset.effect?
return
end
# ƒQ[ƒ€ƒI[ƒo[‚̏ꍇ
if $game_temp.gameover
# ƒQ[ƒ€ƒI[ƒo[‰ζ–ʂɐ؂θ‘Φ‚¦
$scene = Scene_Gameover.new
return
end
# ƒ^ƒCƒgƒ‹‰ζ–Κ‚Ι–ί‚·κ‡
if $game_temp.to_title
# ƒ^ƒCƒgƒ‹‰ζ–ʂɐ؂θ‘Φ‚¦
$scene = Scene_Title.new
return
end
# ƒoƒgƒ‹’†’f‚̏ꍇ
if $game_temp.battle_abort
# ƒoƒgƒ‹ŠJŽn‘O‚Μ BGM ‚Ι–ί‚·
$game_system.bgm_play($game_temp.map_bgm)
# ƒoƒgƒ‹I—Ή
battle_end(1)
return
end
# ƒEƒFƒCƒg’†‚̏ꍇ
if @wait_count > 0
# ƒEƒFƒCƒgƒJƒEƒ“ƒg‚πŒΈ‚η‚·
@wait_count -= 1
return
end
# ƒAƒNƒVƒ‡ƒ“‚π‹­§‚³‚κ‚Δ‚’‚ιƒoƒgƒ‰[‚ͺ‘Άέ‚Ή‚ΈA
# ‚©‚Βƒoƒgƒ‹ƒCƒxƒ“ƒg‚ͺŽΐs’†‚̏ꍇ
if $game_temp.forcing_battler == nil and
$game_system.battle_interpreter.running?
return
end
# ƒtƒF[ƒY‚Ι‚ζ‚Α‚Δ•ͺŠς
case @phase
when 1 # ƒvƒŒƒoƒgƒ‹ƒtƒF[ƒY
update_phase1
when 2 # ƒp[ƒeƒBƒRƒ}ƒ“ƒhƒtƒF[ƒY
update_phase2
when 3 # ƒAƒNƒ^[ƒRƒ}ƒ“ƒhƒtƒF[ƒY
update_phase3
when 4 # ƒƒCƒ“ƒtƒF[ƒY
update_phase4
when 5 # ƒAƒtƒ^[ƒoƒgƒ‹ƒtƒF[ƒY
update_phase5
end
end
end
Design By RaZ © Watery Build 2005