La puissance change selon le niveau [XP]
Page 1 sur 1
La puissance change selon le niveau [XP]
Voici un script qui permet que la puissance des monstres sur une map changent selon votre nombre,votre puissance et vostre niveau.
Remplacer donc le script Game_Enemy par:
Script:
#==============================================================================
# ■ Game_Enemy
#------------------------------------------------------------------------------
# scrïpt créé par SunMat, les monstres s'adaptent aux données du héro
# #==============================================================================
class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# fonction d'initialisation
#--------------------------------------------------------------------------
def initialize(troop_id, member_index)
super()
@troop_id = troop_id
@member_index = member_index
troop = $data_troops[@troop_id]
@enemy_id = troop.members[@member_index].enemy_id
enemy = $data_enemies[@enemy_id]
@battler_name = enemy.battler_name
@battler_hue = enemy.battler_hue
@hp = maxhp
@sp = maxsp
@hidden = troop.members[@member_index].hidden
@immortal = troop.members[@member_index].immortal
end
#--------------------------------------------------------------------------
# ID
#--------------------------------------------------------------------------
def id
return @enemy_id
end
#--------------------------------------------------------------------------
# Index
#--------------------------------------------------------------------------
def index
return @member_index
end
#--------------------------------------------------------------------------
# Nom du monstre
#--------------------------------------------------------------------------
def name
return $data_enemies[@enemy_id].name
end
#--------------------------------------------------------------------------
# Max Hp = somme des maxHp des héros dans l'équipe
# multiplié par le pourcentage défini
#--------------------------------------------------------------------------
def base_maxhp
hp = $game_actors[1].maxhp
if $game_actors[2].hp != 0
hp += $game_actors[2].maxhp
end
if $game_actors[3].hp != 0
hp += $game_actors[3].maxhp
end
if $game_actors[4].hp != 0
hp += $game_actors[4].maxhp
end
hp *= $data_enemies[@enemy_id].maxhp
hp /= 100
return hp
end
#--------------------------------------------------------------------------
# Max Sp définis dans l'absolue
#--------------------------------------------------------------------------
def base_maxsp
return $data_enemies[@enemy_id].maxsp
end
#--------------------------------------------------------------------------
# Force en fonction du pourcentage de la somme de la force de l'équipe
#--------------------------------------------------------------------------
def base_str
a = 1
frc = $game_actors[1].str
if $game_actors[2].hp != 0
frc += $game_actors[2].str
a +=1
end
if $game_actors[3].hp != 0
frc += $game_actors[3].str
a += 1
end
if $game_actors[4].hp != 0
frc += $game_actors[4].str
a += 1
end
frc *= $data_enemies[@enemy_id].str
frc /= (100*a)
return frc
end
#--------------------------------------------------------------------------
# dextérité définie dans l'absolue
#--------------------------------------------------------------------------
def base_dex
return $data_enemies[@enemy_id].dex
end
#--------------------------------------------------------------------------
# agilité définie dans l'absolue
#--------------------------------------------------------------------------
def base_agi
return $data_enemies[@enemy_id].agi
end
#--------------------------------------------------------------------------
# intelligence définie dans l'absolue
#--------------------------------------------------------------------------
def base_int
return $data_enemies[@enemy_id].int
end
#--------------------------------------------------------------------------
# attaque définie en fonction de l'attaque de l'équipe et du pourcentage
#--------------------------------------------------------------------------
def base_atk
at = $game_actors[1].atk
a = 1
if $game_actors[2].hp != 0
at += $game_actors[2].atk
a += 1
end
if $game_actors[3].hp != 0
at += $game_actors[3].atk
a += 1
end
if $game_actors[4].hp != 0
a += 1
at += $game_actors[4].atk
end
at *= $data_enemies[@enemy_id].atk
at /= (100*a )
return at
end
#--------------------------------------------------------------------------
# défence définie en fonction du pourcentage moyen de la défence de l'équipe
#--------------------------------------------------------------------------
def base_pdef
df = $game_actors[1].pdef
a = 1
if $game_actors[2].hp != 0
df += $game_actors[2].pdef
a += 1
end
if $game_actors[3].hp != 0
df += $game_actors[3].pdef
a += 1
end
if $game_actors[4].hp != 0
df += $game_actors[4].pdef
a += 1
end
df *= $data_enemies[@enemy_id].pdef
df /= (100*a)
return df
end
#--------------------------------------------------------------------------
# défence magique en fonction de la défence de l'équipe
#--------------------------------------------------------------------------
def base_mdef
mdf = $game_actors[1].mdef
a = 1
if $game_actors[2].hp != 0
mdf += $game_actors[2].mdef
a += 1
end
if $game_actors[3].hp != 0
mdf += $game_actors[3].mdef
a += 1
end
if $game_actors[4].hp != 0
mdf += $game_actors[4].mdef
a += 1
end
mdf *= $data_enemies[@enemy_id].mdef
mdf /= (100*a)
return mdf
end
#--------------------------------------------------------------------------
# evasion non changée
#--------------------------------------------------------------------------
def base_eva
return $data_enemies[@enemy_id].eva
end
#--------------------------------------------------------------------------
#animation non changée
#--------------------------------------------------------------------------
def animation1_id
return $data_enemies[@enemy_id].animation1_id
end
#--------------------------------------------------------------------------
# animation non changée
#--------------------------------------------------------------------------
def animation2_id
return $data_enemies[@enemy_id].animation2_id
end
#--------------------------------------------------------------------------
# element_rate non changé
#--------------------------------------------------------------------------
def element_rate(element_id)
# 属性有効度に対応する数値を取得
table = [0,200,150,100,50,0,-100]
result = table[$data_enemies[@enemy_id].element_ranks[element_id]]
# ステートでこの属性が防御されている場合は半減
for i in @states
if $data_states.guard_element_set.include?(element_id)
result /= 2
end
end
# メソッド終了
return result
end
#--------------------------------------------------------------------------
# state_rank non changé
#--------------------------------------------------------------------------
def state_ranks
return $data_enemies[@enemy_id].state_ranks
end
#--------------------------------------------------------------------------
#state_guard non changé
#--------------------------------------------------------------------------
def state_guard?(state_id)
return false
end
#--------------------------------------------------------------------------
# element_set non changé
#--------------------------------------------------------------------------
def element_set
return []
end
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
def plus_state_set
return []
end
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
def minus_state_set
return []
end
#--------------------------------------------------------------------------
# action non changé
#--------------------------------------------------------------------------
def actions
return $data_enemies[@enemy_id].actions
end
#--------------------------------------------------------------------------
# expérience donnée par une formule modifiable au gré du Maker
# ici la formule est le produit de l'exp du monstre par le niveau du joueur 1
#--------------------------------------------------------------------------
def exp
expe = $game_actors[1].level * $data_enemies[@enemy_id].exp
return expe
end
#--------------------------------------------------------------------------
# ● ゴールドの取得
#--------------------------------------------------------------------------
def gold
return $data_enemies[@enemy_id].gold
end
#--------------------------------------------------------------------------
# ● アイテム ID の取得
#--------------------------------------------------------------------------
def item_id
return $data_enemies[@enemy_id].item_id
end
#--------------------------------------------------------------------------
# ● 武器 ID の取得
#--------------------------------------------------------------------------
def weapon_id
return $data_enemies[@enemy_id].weapon_id
end
#--------------------------------------------------------------------------
# ● 防具 ID の取得
#--------------------------------------------------------------------------
def armor_id
return $data_enemies[@enemy_id].armor_id
end
#--------------------------------------------------------------------------
# ● トレジャー出現率の取得
#--------------------------------------------------------------------------
def treasure_prob
return $data_enemies[@enemy_id].treasure_prob
end
#--------------------------------------------------------------------------
# ● バトル画面 X 座標の取得
#--------------------------------------------------------------------------
def screen_x
return $data_troops[@troop_id].members[@member_index].x
end
#--------------------------------------------------------------------------
# ● バトル画面 Y 座標の取得
#--------------------------------------------------------------------------
def screen_y
return $data_troops[@troop_id].members[@member_index].y
end
#--------------------------------------------------------------------------
# ● バトル画面 Z 座標の取得
#--------------------------------------------------------------------------
def screen_z
return screen_y
end
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
def escape
# ヒドゥンフラグをセット
@hidden = true
# カレントアクションをクリア
self.current_action.clear
end
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
def transform(enemy_id)
# エネミー ID を変更
@enemy_id = enemy_id
# バトラー グラフィックを変更
@battler_name = $data_enemies[@enemy_id].battler_name
@battler_hue = $data_enemies[@enemy_id].battler_hue
# アクション再作成
make_action
end
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
#scrïpt amélioré par RPG Advocate
def make_action
self.current_action.clear
unless self.movable?
return
end
available_actions = []
rating_max = 0
for action in self.actions
n = $game_temp.battle_turn
a = action.condition_turn_a
b = action.condition_turn_b
if (b == 0 and n != a) or
(b > 0 and (n < 1 or n < a or n % b != a % b))
next
end
if self.hp * 100.0 / self.maxhp > action.condition_hp
next
end
if $game_party.max_level < action.condition_level
next
end
switch_id = action.condition_switch_id
if switch_id > 0 and $game_switches[switch_id] == false
next
end
if exclude_pointless_actions(action)
next
end
available_actions.push(action)
if action.rating > rating_max
rating_max = action.rating
end
end
ratings_total = 0
for action in available_actions
ratings_total += action.rating
end
if ratings_total > 0
choose_action = []
for action in available_actions
for j in 1..action.rating
choose_action.push(action)
end
end
enemy_action = choose_action[rand(choose_action.size - 1)]
self.current_action.kind = enemy_action.kind
self.current_action.basic = enemy_action.basic
self.current_action.skill_id = enemy_action.skill_id
self.current_action.decide_random_target_for_enemy
end
end
# --------------------------------
def exclude_pointless_actions(action)
if action.kind == 0
return false
end
if action.kind == 1
s = action.skill_id
if self.sp < $data_skills[s].sp_cost
return true
end
if $data_skills[s].common_event_id > 0
return false
end
if $data_skills[s].scope == 0 || $data_skills[s].scope == 1 ||
$data_skills[s].scope == 2
return false
end
if $data_skills[s].scope == 3 || $data_skills[s].scope == 4
if $game_troop != nil
fullhpflag = true
statusflag = true
for i in $game_troop.enemies
if i.hp < i.maxhp && i.exist?
fullhpflag = false
end
for j in $data_skills[s].plus_state_set
if not i.state?(j) && i.exist?
statusflag = false
end
end
for j in $data_skills[s].minus_state_set
if i.state?(j) && i.exist?
statusflag = false
end
end
end
end
if $data_skills[s].power == 0 && statusflag
return true
end
if $data_skills[s].power < 0 && statusflag && fullhpflag
return true
end
end
if $data_skills[s].scope == 5 || $data_skills[s].scope == 6
nonedeadflag = true
if $game_troop != nil
for i in $game_troop.enemies
if i.dead? and not i.hidden
nonedeadflag = false
end
end
end
if nonedeadflag
return true
end
end
if $data_skills[s].scope == 7
if $game_troop != nil
fullhpflag = true
statusflag = true
if self.hp < self.maxhp
fullhpflag = false
end
for j in $data_skills[s].plus_state_set
if not self.state?(j)
statusflag = false
end
end
for j in $data_skills[s].minus_state_set
if self.state?(j)
statusflag = false
end
end
end
if $data_skills[s].power == 0 && statusflag
return true
end
if $data_skills[s].power < 0 && statusflag && fullhpflag
return true
end
end
end
return false
end
end
[i]Nouveautés:
Les caractéristiques qui changent seront donc PV max,la frce,l'attaque,la défense physique et la defense magique.
Remplacer donc le script Game_Enemy par:
Script:
#==============================================================================
# ■ Game_Enemy
#------------------------------------------------------------------------------
# scrïpt créé par SunMat, les monstres s'adaptent aux données du héro
# #==============================================================================
class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# fonction d'initialisation
#--------------------------------------------------------------------------
def initialize(troop_id, member_index)
super()
@troop_id = troop_id
@member_index = member_index
troop = $data_troops[@troop_id]
@enemy_id = troop.members[@member_index].enemy_id
enemy = $data_enemies[@enemy_id]
@battler_name = enemy.battler_name
@battler_hue = enemy.battler_hue
@hp = maxhp
@sp = maxsp
@hidden = troop.members[@member_index].hidden
@immortal = troop.members[@member_index].immortal
end
#--------------------------------------------------------------------------
# ID
#--------------------------------------------------------------------------
def id
return @enemy_id
end
#--------------------------------------------------------------------------
# Index
#--------------------------------------------------------------------------
def index
return @member_index
end
#--------------------------------------------------------------------------
# Nom du monstre
#--------------------------------------------------------------------------
def name
return $data_enemies[@enemy_id].name
end
#--------------------------------------------------------------------------
# Max Hp = somme des maxHp des héros dans l'équipe
# multiplié par le pourcentage défini
#--------------------------------------------------------------------------
def base_maxhp
hp = $game_actors[1].maxhp
if $game_actors[2].hp != 0
hp += $game_actors[2].maxhp
end
if $game_actors[3].hp != 0
hp += $game_actors[3].maxhp
end
if $game_actors[4].hp != 0
hp += $game_actors[4].maxhp
end
hp *= $data_enemies[@enemy_id].maxhp
hp /= 100
return hp
end
#--------------------------------------------------------------------------
# Max Sp définis dans l'absolue
#--------------------------------------------------------------------------
def base_maxsp
return $data_enemies[@enemy_id].maxsp
end
#--------------------------------------------------------------------------
# Force en fonction du pourcentage de la somme de la force de l'équipe
#--------------------------------------------------------------------------
def base_str
a = 1
frc = $game_actors[1].str
if $game_actors[2].hp != 0
frc += $game_actors[2].str
a +=1
end
if $game_actors[3].hp != 0
frc += $game_actors[3].str
a += 1
end
if $game_actors[4].hp != 0
frc += $game_actors[4].str
a += 1
end
frc *= $data_enemies[@enemy_id].str
frc /= (100*a)
return frc
end
#--------------------------------------------------------------------------
# dextérité définie dans l'absolue
#--------------------------------------------------------------------------
def base_dex
return $data_enemies[@enemy_id].dex
end
#--------------------------------------------------------------------------
# agilité définie dans l'absolue
#--------------------------------------------------------------------------
def base_agi
return $data_enemies[@enemy_id].agi
end
#--------------------------------------------------------------------------
# intelligence définie dans l'absolue
#--------------------------------------------------------------------------
def base_int
return $data_enemies[@enemy_id].int
end
#--------------------------------------------------------------------------
# attaque définie en fonction de l'attaque de l'équipe et du pourcentage
#--------------------------------------------------------------------------
def base_atk
at = $game_actors[1].atk
a = 1
if $game_actors[2].hp != 0
at += $game_actors[2].atk
a += 1
end
if $game_actors[3].hp != 0
at += $game_actors[3].atk
a += 1
end
if $game_actors[4].hp != 0
a += 1
at += $game_actors[4].atk
end
at *= $data_enemies[@enemy_id].atk
at /= (100*a )
return at
end
#--------------------------------------------------------------------------
# défence définie en fonction du pourcentage moyen de la défence de l'équipe
#--------------------------------------------------------------------------
def base_pdef
df = $game_actors[1].pdef
a = 1
if $game_actors[2].hp != 0
df += $game_actors[2].pdef
a += 1
end
if $game_actors[3].hp != 0
df += $game_actors[3].pdef
a += 1
end
if $game_actors[4].hp != 0
df += $game_actors[4].pdef
a += 1
end
df *= $data_enemies[@enemy_id].pdef
df /= (100*a)
return df
end
#--------------------------------------------------------------------------
# défence magique en fonction de la défence de l'équipe
#--------------------------------------------------------------------------
def base_mdef
mdf = $game_actors[1].mdef
a = 1
if $game_actors[2].hp != 0
mdf += $game_actors[2].mdef
a += 1
end
if $game_actors[3].hp != 0
mdf += $game_actors[3].mdef
a += 1
end
if $game_actors[4].hp != 0
mdf += $game_actors[4].mdef
a += 1
end
mdf *= $data_enemies[@enemy_id].mdef
mdf /= (100*a)
return mdf
end
#--------------------------------------------------------------------------
# evasion non changée
#--------------------------------------------------------------------------
def base_eva
return $data_enemies[@enemy_id].eva
end
#--------------------------------------------------------------------------
#animation non changée
#--------------------------------------------------------------------------
def animation1_id
return $data_enemies[@enemy_id].animation1_id
end
#--------------------------------------------------------------------------
# animation non changée
#--------------------------------------------------------------------------
def animation2_id
return $data_enemies[@enemy_id].animation2_id
end
#--------------------------------------------------------------------------
# element_rate non changé
#--------------------------------------------------------------------------
def element_rate(element_id)
# 属性有効度に対応する数値を取得
table = [0,200,150,100,50,0,-100]
result = table[$data_enemies[@enemy_id].element_ranks[element_id]]
# ステートでこの属性が防御されている場合は半減
for i in @states
if $data_states.guard_element_set.include?(element_id)
result /= 2
end
end
# メソッド終了
return result
end
#--------------------------------------------------------------------------
# state_rank non changé
#--------------------------------------------------------------------------
def state_ranks
return $data_enemies[@enemy_id].state_ranks
end
#--------------------------------------------------------------------------
#state_guard non changé
#--------------------------------------------------------------------------
def state_guard?(state_id)
return false
end
#--------------------------------------------------------------------------
# element_set non changé
#--------------------------------------------------------------------------
def element_set
return []
end
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
def plus_state_set
return []
end
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
def minus_state_set
return []
end
#--------------------------------------------------------------------------
# action non changé
#--------------------------------------------------------------------------
def actions
return $data_enemies[@enemy_id].actions
end
#--------------------------------------------------------------------------
# expérience donnée par une formule modifiable au gré du Maker
# ici la formule est le produit de l'exp du monstre par le niveau du joueur 1
#--------------------------------------------------------------------------
def exp
expe = $game_actors[1].level * $data_enemies[@enemy_id].exp
return expe
end
#--------------------------------------------------------------------------
# ● ゴールドの取得
#--------------------------------------------------------------------------
def gold
return $data_enemies[@enemy_id].gold
end
#--------------------------------------------------------------------------
# ● アイテム ID の取得
#--------------------------------------------------------------------------
def item_id
return $data_enemies[@enemy_id].item_id
end
#--------------------------------------------------------------------------
# ● 武器 ID の取得
#--------------------------------------------------------------------------
def weapon_id
return $data_enemies[@enemy_id].weapon_id
end
#--------------------------------------------------------------------------
# ● 防具 ID の取得
#--------------------------------------------------------------------------
def armor_id
return $data_enemies[@enemy_id].armor_id
end
#--------------------------------------------------------------------------
# ● トレジャー出現率の取得
#--------------------------------------------------------------------------
def treasure_prob
return $data_enemies[@enemy_id].treasure_prob
end
#--------------------------------------------------------------------------
# ● バトル画面 X 座標の取得
#--------------------------------------------------------------------------
def screen_x
return $data_troops[@troop_id].members[@member_index].x
end
#--------------------------------------------------------------------------
# ● バトル画面 Y 座標の取得
#--------------------------------------------------------------------------
def screen_y
return $data_troops[@troop_id].members[@member_index].y
end
#--------------------------------------------------------------------------
# ● バトル画面 Z 座標の取得
#--------------------------------------------------------------------------
def screen_z
return screen_y
end
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
def escape
# ヒドゥンフラグをセット
@hidden = true
# カレントアクションをクリア
self.current_action.clear
end
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
def transform(enemy_id)
# エネミー ID を変更
@enemy_id = enemy_id
# バトラー グラフィックを変更
@battler_name = $data_enemies[@enemy_id].battler_name
@battler_hue = $data_enemies[@enemy_id].battler_hue
# アクション再作成
make_action
end
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
#scrïpt amélioré par RPG Advocate
def make_action
self.current_action.clear
unless self.movable?
return
end
available_actions = []
rating_max = 0
for action in self.actions
n = $game_temp.battle_turn
a = action.condition_turn_a
b = action.condition_turn_b
if (b == 0 and n != a) or
(b > 0 and (n < 1 or n < a or n % b != a % b))
next
end
if self.hp * 100.0 / self.maxhp > action.condition_hp
next
end
if $game_party.max_level < action.condition_level
next
end
switch_id = action.condition_switch_id
if switch_id > 0 and $game_switches[switch_id] == false
next
end
if exclude_pointless_actions(action)
next
end
available_actions.push(action)
if action.rating > rating_max
rating_max = action.rating
end
end
ratings_total = 0
for action in available_actions
ratings_total += action.rating
end
if ratings_total > 0
choose_action = []
for action in available_actions
for j in 1..action.rating
choose_action.push(action)
end
end
enemy_action = choose_action[rand(choose_action.size - 1)]
self.current_action.kind = enemy_action.kind
self.current_action.basic = enemy_action.basic
self.current_action.skill_id = enemy_action.skill_id
self.current_action.decide_random_target_for_enemy
end
end
# --------------------------------
def exclude_pointless_actions(action)
if action.kind == 0
return false
end
if action.kind == 1
s = action.skill_id
if self.sp < $data_skills[s].sp_cost
return true
end
if $data_skills[s].common_event_id > 0
return false
end
if $data_skills[s].scope == 0 || $data_skills[s].scope == 1 ||
$data_skills[s].scope == 2
return false
end
if $data_skills[s].scope == 3 || $data_skills[s].scope == 4
if $game_troop != nil
fullhpflag = true
statusflag = true
for i in $game_troop.enemies
if i.hp < i.maxhp && i.exist?
fullhpflag = false
end
for j in $data_skills[s].plus_state_set
if not i.state?(j) && i.exist?
statusflag = false
end
end
for j in $data_skills[s].minus_state_set
if i.state?(j) && i.exist?
statusflag = false
end
end
end
end
if $data_skills[s].power == 0 && statusflag
return true
end
if $data_skills[s].power < 0 && statusflag && fullhpflag
return true
end
end
if $data_skills[s].scope == 5 || $data_skills[s].scope == 6
nonedeadflag = true
if $game_troop != nil
for i in $game_troop.enemies
if i.dead? and not i.hidden
nonedeadflag = false
end
end
end
if nonedeadflag
return true
end
end
if $data_skills[s].scope == 7
if $game_troop != nil
fullhpflag = true
statusflag = true
if self.hp < self.maxhp
fullhpflag = false
end
for j in $data_skills[s].plus_state_set
if not self.state?(j)
statusflag = false
end
end
for j in $data_skills[s].minus_state_set
if self.state?(j)
statusflag = false
end
end
end
if $data_skills[s].power == 0 && statusflag
return true
end
if $data_skills[s].power < 0 && statusflag && fullhpflag
return true
end
end
end
return false
end
end
[i]Nouveautés:
Les caractéristiques qui changent seront donc PV max,la frce,l'attaque,la défense physique et la defense magique.
Page 1 sur 1
Permission de ce forum:
Vous ne pouvez pas répondre aux sujets dans ce forum