~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


Game_Battler 3 ::: posté le 2006-02-16 @ 08:31:00
Auteur: Yukihiro matsumoto

#============================================
# ¡ Game_Battler (•ªŠ„’è‹` 3)
#--------------------------------------------
# @ƒoƒgƒ‰[‚ðˆµ‚¤ƒNƒ‰ƒX‚Å‚·B‚±‚̃Nƒ‰ƒX‚Í Game_Actor ƒNƒ‰ƒX‚Æ Game_Enemy ƒNƒ‰
# ƒX‚̃X[ƒp[ƒNƒ‰ƒX‚Æ‚µ‚ÄŽg—p‚³‚ê‚Ü‚·B
#============================================

class Game_Battler
#------------------------------------------
# œ ƒXƒLƒ‹‚ÌŽg—p‰Â””»’è
# skill_id : ƒXƒLƒ‹ ID
#------------------------------------------
def skill_can_use?(skill_id)
# SP ‚ª‘«‚è‚È‚¢ê‡‚ÍŽg—p•s‰Â
if $data_skills[skill_id].sp_cost > self.sp
return false
end
# 퓬•s”‚Ìꇂ͎g—p•s‰Â
if dead?
return false
end
# ’¾–Ùó‘Ô‚Ìê‡A•¨—ƒXƒLƒ‹ˆÈŠO‚ÍŽg—p•s‰Â
if $data_skills[skill_id].atk_f == 0 and self.restriction == 1
return false
end
# Žg—p‰Â”Žž‚ðŽæ“¾
occasion = $data_skills[skill_id].occasion
# 퓬’†‚Ìê‡
if $game_temp.in_battle
# [펞] ‚Ü‚½‚Í [ƒoƒgƒ‹‚Ì‚Ý] ‚È‚çŽg—p‰Â
return (occasion == 0 or occasion == 1)
# 퓬’†‚Å‚Í‚È‚¢ê‡
else
# [펞] ‚Ü‚½‚Í [ƒƒjƒ…[‚Ì‚Ý] ‚È‚çŽg—p‰Â
return (occasion == 0 or occasion == 2)
end
end
#------------------------------------------
# œ ’ÊíUŒ‚‚ÌŒø‰Ê“K—p
# attacker : UŒ‚ŽÒ (ƒoƒgƒ‰[)
#------------------------------------------
def attack_effect(attacker)
# ƒNƒŠƒeƒBƒJƒ‹ƒtƒ‰ƒO‚ðƒNƒŠƒA
self.critical = false
# ‘æˆê–½’†”»’è
hit_result = (rand(100) < attacker.hit)
# –½’†‚Ìê‡
if hit_result == true
# Šî–{ƒ_ƒ[ƒW‚ðŒvŽZ
atk = [attacker.atk - self.pdef / 2, 0].max
self.damage = atk * (20 + attacker.str) / 20
# ‘®«C³
self.damage *= elements_correct(attacker.element_set)
self.damage /= 100
# ƒ_ƒ[ƒW‚Ì•„†‚ª³‚Ìê‡
if self.damage > 0
# ƒNƒŠƒeƒBƒJƒ‹C³
if rand(100) < 4 * attacker.dex / self.agi
self.damage *= 2
self.critical = true
end
# –hŒäC³
if self.guarding?
self.damage /= 2
end
end
# •ªŽU
if self.damage.abs > 0
amp = [self.damage.abs * 15 / 100, 1].max
self.damage += rand(amp+1) + rand(amp+1) - amp
end
# ‘æ“ñ–½’†”»’è
eva = 8 * self.agi / attacker.dex + self.eva
hit = self.damage < 0 ? 100 : 100 - eva
hit = self.cant_evade? ? 100 : hit
hit_result = (rand(100) < hit)
end
# –½’†‚Ìê‡
if hit_result == true
# ƒXƒe[ƒgÕŒ‚‰ðœ
remove_states_shock
# HP ‚©‚çƒ_ƒ[ƒW‚ðŒ¸ŽZ
self.hp -= self.damage
# ƒXƒe[ƒg•Ï‰»
@state_changed = false
states_plus(attacker.plus_state_set)
states_minus(attacker.minus_state_set)
# ƒ~ƒX‚Ìê‡
else
# ƒ_ƒ[ƒW‚É "Miss" ‚ðÝ’è
self.damage = "Miss"
# ƒNƒŠƒeƒBƒJƒ‹ƒtƒ‰ƒO‚ðƒNƒŠƒA
self.critical = false
end
# ƒƒƒbƒhI—¹
return true
end
#------------------------------------------
# œ ƒXƒLƒ‹‚ÌŒø‰Ê“K—p
# user : ƒXƒLƒ‹‚ÌŽg—pŽÒ (ƒoƒgƒ‰[)
# skill : ƒXƒLƒ‹
#------------------------------------------
def skill_effect(user, skill)
# ƒNƒŠƒeƒBƒJƒ‹ƒtƒ‰ƒO‚ðƒNƒŠƒA
self.critical = false
# ƒXƒLƒ‹‚ÌŒø‰Ê”͈͂ª HP 1 ˆÈã‚Ì–¡•û‚ÅAŽ©•ª‚Ì HP ‚ª 0A
# ‚Ü‚½‚̓XƒLƒ‹‚ÌŒø‰Ê”͈͂ª HP 0 ‚Ì–¡•û‚ÅAŽ©•ª‚Ì HP ‚ª 1 ˆÈã‚Ìê‡
if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or
((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)
# ƒƒƒbƒhI—¹
return false
end
# —LŒøƒtƒ‰ƒO‚ðƒNƒŠƒA
effective = false
# ƒRƒ‚ƒ“ƒCƒxƒ“ƒg ID ‚ª—LŒø‚Ìꇂ͗LŒøƒtƒ‰ƒO‚ðƒZƒbƒg
effective |= skill.common_event_id > 0
# ‘æˆê–½’†”»’è
hit = skill.hit
if skill.atk_f > 0
hit *= user.hit / 100
end
hit_result = (rand(100) < hit)
# •sŠmŽÀ‚ȃXƒLƒ‹‚Ìꇂ͗LŒøƒtƒ‰ƒO‚ðƒZƒbƒg
effective |= hit < 100
# –½’†‚Ìê‡
if hit_result == true
# ˆÐ—Í‚ðŒvŽZ
power = skill.power + user.atk * skill.atk_f / 100
if power > 0
power -= self.pdef * skill.pdef_f / 200
power -= self.mdef * skill.mdef_f / 200
power = [power, 0].max
end
# ”{—¦‚ðŒvŽZ
rate = 20
rate += (user.str * skill.str_f / 100)
rate += (user.dex * skill.dex_f / 100)
rate += (user.agi * skill.agi_f / 100)
rate += (user.int * skill.int_f / 100)
# Šî–{ƒ_ƒ[ƒW‚ðŒvŽZ
self.damage = power * rate / 20
# ‘®«C³
self.damage *= elements_correct(skill.element_set)
self.damage /= 100
# ƒ_ƒ[ƒW‚Ì•„†‚ª³‚Ìê‡
if self.damage > 0
# –hŒäC³
if self.guarding?
self.damage /= 2
end
end
# •ªŽU
if skill.variance > 0 and self.damage.abs > 0
amp = [self.damage.abs * skill.variance / 100, 1].max
self.damage += rand(amp+1) + rand(amp+1) - amp
end
# ‘æ“ñ–½’†”»’è
eva = 8 * self.agi / user.dex + self.eva
hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100
hit = self.cant_evade? ? 100 : hit
hit_result = (rand(100) < hit)
# •sŠmŽÀ‚ȃXƒLƒ‹‚Ìꇂ͗LŒøƒtƒ‰ƒO‚ðƒZƒbƒg
effective |= hit < 100
end
# –½’†‚Ìê‡
if hit_result == true
# ˆÐ—Í 0 ˆÈŠO‚Ì•¨—UŒ‚‚Ìê‡
if skill.power != 0 and skill.atk_f > 0
# ƒXƒe[ƒgÕŒ‚‰ðœ
remove_states_shock
# —LŒøƒtƒ‰ƒO‚ðƒZƒbƒg
effective = true
end
# HP ‚©‚çƒ_ƒ[ƒW‚ðŒ¸ŽZ
last_hp = self.hp
self.hp -= self.damage
effective |= self.hp != last_hp
# ƒXƒe[ƒg•Ï‰»
@state_changed = false
effective |= states_plus(skill.plus_state_set)
effective |= states_minus(skill.minus_state_set)
# ˆÐ—Í‚ª 0 ‚Ìê‡
if skill.power == 0
# ƒ_ƒ[ƒW‚ɋ󕶎š—ñ‚ðÝ’è
self.damage = ""
# ƒXƒe[ƒg‚ɕω»‚ª‚È‚¢ê‡
unless @state_changed
# ƒ_ƒ[ƒW‚É "Miss" ‚ðÝ’è
self.damage = "Miss"
end
end
# ƒ~ƒX‚Ìê‡
else
# ƒ_ƒ[ƒW‚É "Miss" ‚ðÝ’è
self.damage = "Miss"
end
# 퓬’†‚Å‚È‚¢ê‡
unless $game_temp.in_battle
# ƒ_ƒ[ƒW‚É nil ‚ðÝ’è
self.damage = nil
end
# ƒƒƒbƒhI—¹
return effective
end
#------------------------------------------
# œ ƒAƒCƒeƒ€‚ÌŒø‰Ê“K—p
# item : ƒAƒCƒeƒ€
#------------------------------------------
def item_effect(item)
# ƒNƒŠƒeƒBƒJƒ‹ƒtƒ‰ƒO‚ðƒNƒŠƒA
self.critical = false
# ƒAƒCƒeƒ€‚ÌŒø‰Ê”͈͂ª HP 1 ˆÈã‚Ì–¡•û‚ÅAŽ©•ª‚Ì HP ‚ª 0A
# ‚Ü‚½‚̓AƒCƒeƒ€‚ÌŒø‰Ê”͈͂ª HP 0 ‚Ì–¡•û‚ÅAŽ©•ª‚Ì HP ‚ª 1 ˆÈã‚Ìê‡
if ((item.scope == 3 or item.scope == 4) and self.hp == 0) or
((item.scope == 5 or item.scope == 6) and self.hp >= 1)
# ƒƒƒbƒhI—¹
return false
end
# —LŒøƒtƒ‰ƒO‚ðƒNƒŠƒA
effective = false
# ƒRƒ‚ƒ“ƒCƒxƒ“ƒg ID ‚ª—LŒø‚Ìꇂ͗LŒøƒtƒ‰ƒO‚ðƒZƒbƒg
effective |= item.common_event_id > 0
# –½’†”»’è
hit_result = (rand(100) < item.hit)
# •sŠmŽÀ‚ȃXƒLƒ‹‚Ìꇂ͗LŒøƒtƒ‰ƒO‚ðƒZƒbƒg
effective |= item.hit < 100
# –½’†‚Ìê‡
if hit_result == true
# ‰ñ•œ—Ê‚ðŒvŽZ
recover_hp = maxhp * item.recover_hp_rate / 100 + item.recover_hp
recover_sp = maxsp * item.recover_sp_rate / 100 + item.recover_sp
if recover_hp < 0
recover_hp += self.pdef * item.pdef_f / 20
recover_hp += self.mdef * item.mdef_f / 20
recover_hp = [recover_hp, 0].min
end
# ‘®«C³
recover_hp *= elements_correct(item.element_set)
recover_hp /= 100
recover_sp *= elements_correct(item.element_set)
recover_sp /= 100
# •ªŽU
if item.variance > 0 and recover_hp.abs > 0
amp = [recover_hp.abs * item.variance / 100, 1].max
recover_hp += rand(amp+1) + rand(amp+1) - amp
end
if item.variance > 0 and recover_sp.abs > 0
amp = [recover_sp.abs * item.variance / 100, 1].max
recover_sp += rand(amp+1) + rand(amp+1) - amp
end
# ‰ñ•œ—Ê‚Ì•„†‚ª•‰‚Ìê‡
if recover_hp < 0
# –hŒäC³
if self.guarding?
recover_hp /= 2
end
end
# HP ‰ñ•œ—Ê‚Ì•„†‚𔽓]‚µAƒ_ƒ[ƒW‚Ì’l‚ÉÝ’è
self.damage = -recover_hp
# HP ‚¨‚æ‚Ñ SP ‚ð‰ñ•œ
last_hp = self.hp
last_sp = self.sp
self.hp += recover_hp
self.sp += recover_sp
effective |= self.hp != last_hp
effective |= self.sp != last_sp
# ƒXƒe[ƒg•Ï‰»
@state_changed = false
effective |= states_plus(item.plus_state_set)
effective |= states_minus(item.minus_state_set)
# ƒpƒ‰ƒ[ƒ^㸒l‚ª—LŒø‚Ìê‡
if item.parameter_type > 0 and item.parameter_points != 0
# ƒpƒ‰ƒ[ƒ^‚Å•ªŠò
case item.parameter_type
when 1 # MaxHP
@maxhp_plus += item.parameter_points
when 2 # MaxSP
@maxsp_plus += item.parameter_points
when 3 # ˜r—Í
@str_plus += item.parameter_points
when 4 # Ší—p‚³
@dex_plus += item.parameter_points
when 5 # ‘f‘‚³
@agi_plus += item.parameter_points
when 6 # –‚—Í
@int_plus += item.parameter_points
end
# —LŒøƒtƒ‰ƒO‚ðƒZƒbƒg
effective = true
end
# HP ‰ñ•œ—¦‚Ɖñ•œ—Ê‚ª 0 ‚Ìê‡
if item.recover_hp_rate == 0 and item.recover_hp == 0
# ƒ_ƒ[ƒW‚ɋ󕶎š—ñ‚ðÝ’è
self.damage = ""
# SP ‰ñ•œ—¦‚Ɖñ•œ—Ê‚ª 0Aƒpƒ‰ƒ[ƒ^㸒l‚ª–³Œø‚Ìê‡
if item.recover_sp_rate == 0 and item.recover_sp == 0 and
(item.parameter_type == 0 or item.parameter_points == 0)
# ƒXƒe[ƒg‚ɕω»‚ª‚È‚¢ê‡
unless @state_changed
# ƒ_ƒ[ƒW‚É "Miss" ‚ðÝ’è
self.damage = "Miss"
end
end
end
# ƒ~ƒX‚Ìê‡
else
# ƒ_ƒ[ƒW‚É "Miss" ‚ðÝ’è
self.damage = "Miss"
end
# 퓬’†‚Å‚È‚¢ê‡
unless $game_temp.in_battle
# ƒ_ƒ[ƒW‚É nil ‚ðÝ’è
self.damage = nil
end
# ƒƒƒbƒhI—¹
return effective
end
#------------------------------------------
# œ ƒXƒŠƒbƒvƒ_ƒ[ƒW‚ÌŒø‰Ê“K—p
#------------------------------------------
def slip_damage_effect
# ƒ_ƒ[ƒW‚ðÝ’è
self.damage = self.maxhp / 10
# •ªŽU
if self.damage.abs > 0
amp = [self.damage.abs * 15 / 100, 1].max
self.damage += rand(amp+1) + rand(amp+1) - amp
end
# HP ‚©‚çƒ_ƒ[ƒW‚ðŒ¸ŽZ
self.hp -= self.damage
# ƒƒƒbƒhI—¹
return true
end
#------------------------------------------
# œ ‘®«C³‚ÌŒvŽZ
# element_set : ‘®«
#------------------------------------------
def elements_correct(element_set)
# –³‘®«‚Ìê‡
if element_set == []
# 100 ‚ð•Ô‚·
return 100
end
# —^‚¦‚ç‚ꂽ‘®«‚Ì’†‚ÅÅ‚àŽã‚¢‚à‚Ì‚ð•Ô‚·
# ¦ƒƒƒbƒh element_rate ‚ÍA‚±‚̃Nƒ‰ƒX‚©‚çŒp³‚³‚ê‚é Game_Actor
# ‚¨‚æ‚Ñ Game_Enemy ƒNƒ‰ƒX‚Å’è‹`‚³‚ê‚é
weakest = -100
for i in element_set
weakest = [weakest, self.element_rate(i)].max
end
return weakest
end
end
Design By RaZ © Watery Build 2005