[RPG-MAKER.FR] Oniromancie: tout l'univers de RPG Maker en français - Scripts - Simplification des formules de combat

Oniromancie: Scripts - Simplification des formules de combat


Découvrir
RPG Maker

RM 95
RM 2000/2003
RM XP
RM VX/VX Ace

Apprendre
RPG Maker

Guides
Tutoriels
Astuces
Making-of


Comment ça marche?

Aëdemphia
Par Sylvanor

Fighting Robots Quest
Par Boulon

Geex
Par roys

Inexistence
Par Falco

La Légende d'Ibabou
Par Zaitan

Nylu
Par NanakyTim

Sarcia
Par Kaëlar

Super Mario RPG - Lost Souls
Par Omegabowser

News: Game design: ouvrir son jeu aux (...) / News: Des jeux et des screens / News: Alex 2019 : tests et nominations (...) / Jeux: Wendy Whedon / Sorties: Wendy Whedon /

Chat  

Bienvenue
visiteur !




publicité RPG Maker!

Statistiques

Liste des
membres


Contact

Mentions légales

124 connectés actuellement

10211286 visiteurs
depuis l'ouverture

99 visiteurs
aujourd'hui

Groupe Facebook

Barre de séparation

Partenaires






TOP
GAMEMAKING


Les 5 plus
visités

Akademiya RPG Maker

Alex d'Or

Blog of Chaos17

BloGecko

ConsoleFun

Au hasard

Indiexpo

Le Studio du Chat Vert

Le Temple de Valor

Les deux derniers

Zarok

Akademiya RPG Maker

Nos autres partenaires

Devenir
partenaire


Barre de séparation

Un site du réseau
War Paradise

Annuaires référenceurs




Simplification des formules de combat
Script pour RPG Maker VX
Ecrit par Monos



Portion de code:





#========================================

# ** Game_Battler
#------------------------------------------------------------------------------
# This class deals with battlers. It's used as a superclass of the Game_Actor
# and Game_Enemy classes.
#Recalcule des Formules de combat par Monos.
#Coups simple: Les points de dégats sont: Attaque - Defense.
#Objet/Compétence: Base domage de l'objet/compétence pour les points dégats.
#Ensuite suivant les paramètres des pourcentages: Force-Defense pour les sort physique
#Intelligence - Intelligence pour les sorts "magique"
#=============================================

class Game_Battler
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :battler_name # battle graphic filename
attr_reader :battler_hue # battle graphic hue
attr_reader :hp # HP
attr_reader :mp # MP
attr_reader :action # battle action
attr_accessor :hidden # hidden flag
attr_accessor :immortal # immortal flag
attr_accessor :animation_id # animation ID
attr_accessor :animation_mirror # animation flip horizontal flag
attr_accessor :white_flash # white flash flag
attr_accessor :blink # blink flag
attr_accessor :collapse # collapse flag
attr_reader :skipped # action results: skipped flag
attr_reader :missed # action results: missed flag
attr_reader :evaded # action results: evaded flag
attr_reader :critical # action results: critical flag
attr_reader :absorbed # action results: absorbed flag
attr_reader :hp_damage # action results: HP damage
attr_reader :mp_damage # action results: MP damage
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
@battler_name = ""
@battler_hue = 0
@hp = 0
@mp = 0
@action = Game_BattleAction.new(self)
@states = [] # States (ID array)
@state_turns = {} # Remaining turns for states (Hash)
@hidden = false
@immortal = false
clear_extra_values
clear_sprite_effects
clear_action_results
end
#--------------------------------------------------------------------------
# * Clear Values Added to Parameter
#--------------------------------------------------------------------------
def clear_extra_values
@maxhp_plus = 0
@maxmp_plus = 0
@atk_plus = 0
@def_plus = 0
@spi_plus = 0
@agi_plus = 0
end
#--------------------------------------------------------------------------
# * Clear Variable Used for Sprite Communication
#--------------------------------------------------------------------------
def clear_sprite_effects
@animation_id = 0
@animation_mirror = false
@white_flash = false
@blink = false
@collapse = false
end
#--------------------------------------------------------------------------
# * Clear Variable for Storing Action Results
#--------------------------------------------------------------------------
def clear_action_results
@skipped = false
@missed = false
@evaded = false
@critical = false
@absorbed = false
@hp_damage = 0
@mp_damage = 0
@added_states = [] # Added states (ID array)
@removed_states = [] # Removed states (ID array)
@remained_states = [] # Unchanged states (ID array)
end
#--------------------------------------------------------------------------
# * Get Current States as an Object Array
#--------------------------------------------------------------------------
def states
result = []
for i in @states
result.push($data_states)
end
return result
end
#--------------------------------------------------------------------------
# * Get the states that were added due to the previous action
#--------------------------------------------------------------------------
def added_states
result = []
for i in @added_states
result.push($data_states)
end
return result
end
#--------------------------------------------------------------------------
# * Get the states that were removed due to the previous action
#--------------------------------------------------------------------------
def removed_states
result = []
for i in @removed_states
result.push($data_states)
end
return result
end
#--------------------------------------------------------------------------
# * Get the states that remained the same after the previous action
# Used, for example, when someone tries to put to sleep a character
# who is already sleeping.
#--------------------------------------------------------------------------
def remained_states
result = []
for i in @remained_states
result.push($data_states)
end
return result
end
#--------------------------------------------------------------------------
# * Determine whether or not there was some effect on states by the
# previous action
#--------------------------------------------------------------------------
def states_active?
return true unless @added_states.empty?
return true unless @removed_states.empty?
return true unless @remained_states.empty?
return false
end
#--------------------------------------------------------------------------
# * Get Maximum HP Limit
#--------------------------------------------------------------------------
def maxhp_limit
return 999999
end
#--------------------------------------------------------------------------
# * Get Maximum HP
#--------------------------------------------------------------------------
def maxhp
return [[base_maxhp + @maxhp_plus, 1].max, maxhp_limit].min
end
#--------------------------------------------------------------------------
# * Get Maximum MP
#--------------------------------------------------------------------------
def maxmp
return [[base_maxmp + @maxmp_plus, 0].max, 9999].min
end
#--------------------------------------------------------------------------
# * Get Attack
#--------------------------------------------------------------------------
def atk
n = [[base_atk + @atk_plus, 1].max, 999].min
for state in states do n *= state.atk_rate / 100.0 end
n = [[Integer(n), 1].max, 999].min
return n
end
#--------------------------------------------------------------------------
# * Get Defense
#--------------------------------------------------------------------------
def def
n = [[base_def + @def_plus, 1].max, 999].min
for state in states do n *= state.def_rate / 100.0 end
n = [[Integer(n), 1].max, 999].min
return n
end
#--------------------------------------------------------------------------
# * Get Spirit
#--------------------------------------------------------------------------
def spi
n = [[base_spi + @spi_plus, 1].max, 999].min
for state in states do n *= state.spi_rate / 100.0 end
n = [[Integer(n), 1].max, 999].min
return n
end
#--------------------------------------------------------------------------
# * Get Agility
#--------------------------------------------------------------------------
def agi
n = [[base_agi + @agi_plus, 1].max, 999].min
for state in states do n *= state.agi_rate / 100.0 end
n = [[Integer(n), 1].max, 999].min
return n
end
#--------------------------------------------------------------------------
# * Get [Super Guard] Option
#--------------------------------------------------------------------------
def super_guard
return false
end
#--------------------------------------------------------------------------
# * Get [Fast Attack] weapon option
#--------------------------------------------------------------------------
def fast_attack
return false
end
#--------------------------------------------------------------------------
# * Get [Dual Attack] weapon option
#--------------------------------------------------------------------------
def dual_attack
return false
end
#--------------------------------------------------------------------------
# * Get [Prevent Critical] armor option
#--------------------------------------------------------------------------
def prevent_critical
return false
end
#--------------------------------------------------------------------------
# * Get [Half MP Cost] armor option
#--------------------------------------------------------------------------
def half_mp_cost
return false
end
#--------------------------------------------------------------------------
# * Set Maximum HP
# new_maxhp : new maximum HP
#--------------------------------------------------------------------------
def maxhp=(new_maxhp)
@maxhp_plus += new_maxhp - self.maxhp
@maxhp_plus = [[@maxhp_plus, -9999].max, 9999].min
@hp = [@hp, self.maxhp].min
end
#--------------------------------------------------------------------------
# * Set Maximum MP
# new_maxmp : new maximum MP
#--------------------------------------------------------------------------
def maxmp=(new_maxmp)
@maxmp_plus += new_maxmp - self.maxmp
@maxmp_plus = [[@maxmp_plus, -9999].max, 9999].min
@mp = [@mp, self.maxmp].min
end
#--------------------------------------------------------------------------
# * Set Attack
# new_atk : new attack
#--------------------------------------------------------------------------
def atk=(new_atk)
@atk_plus += new_atk - self.atk
@atk_plus = [[@atk_plus, -999].max, 999].min
end
#--------------------------------------------------------------------------
# * Set Defense
# new_def : new defense
#--------------------------------------------------------------------------
def def=(new_def)
@def_plus += new_def - self.def
@def_plus = [[@def_plus, -999].max, 999].min
end
#--------------------------------------------------------------------------
# * Set Spirit
# new_spi : new spirit
#--------------------------------------------------------------------------
def spi=(new_spi)
@spi_plus += new_spi - self.spi
@spi_plus = [[@spi_plus, -999].max, 999].min
end
#--------------------------------------------------------------------------
# * Set Agility
# new_agi : new agility
#--------------------------------------------------------------------------
def agi=(new_agi)
@agi_plus += new_agi - self.agi
@agi_plus = [[@agi_plus, -999].max, 999].min
end
#--------------------------------------------------------------------------
# * Change HP
# hp : new HP
#--------------------------------------------------------------------------
def hp=(hp)
@hp = [[hp, maxhp].min, 0].max
if @hp == 0 and not state?(1) and not @immortal
add_state(1) # Add incapacitated (state #1)
@added_states.push(1)
elsif @hp > 0 and state?(1)
remove_state(1) # Remove incapacitated (state #1)
@removed_states.push(1)
end
end
#--------------------------------------------------------------------------
# * Change MP
# mp : new MP
#--------------------------------------------------------------------------
def mp=(mp)
@mp = [[mp, maxmp].min, 0].max
end
#--------------------------------------------------------------------------
# * Recover All
#--------------------------------------------------------------------------
def recover_all
@hp = maxhp
@mp = maxmp
for i in @states.clone do remove_state(i) end
end
#--------------------------------------------------------------------------
# * Determine Incapacitation
#--------------------------------------------------------------------------
def dead?
return (not @hidden and @hp == 0 and not @immortal)
end
#--------------------------------------------------------------------------
# * Determine Existence
#--------------------------------------------------------------------------
def exist?
return (not @hidden and not dead?)
end
#--------------------------------------------------------------------------
# * Determine if Command is Inputable
#--------------------------------------------------------------------------
def inputable?
return (not @hidden and restriction <= 1)
end
#--------------------------------------------------------------------------
# * Determine if Action is Possible
#--------------------------------------------------------------------------
def movable?
return (not @hidden and restriction < 4)
end
#--------------------------------------------------------------------------
# * Determine if Attack is Parriable
#--------------------------------------------------------------------------
def parriable?
return (not @hidden and restriction < 5)
end
#--------------------------------------------------------------------------
# * Determine if Character is Silenced
#--------------------------------------------------------------------------
def silent?
return (not @hidden and restriction == 1)
end
#--------------------------------------------------------------------------
# * Determine if Character is in Berserker State
#--------------------------------------------------------------------------
def berserker?
return (not @hidden and restriction == 2)
end
#--------------------------------------------------------------------------
# * Determine if Character is Confused
#--------------------------------------------------------------------------
def confusion?
return (not @hidden and restriction == 3)
end
#--------------------------------------------------------------------------
# * Determine if Guarding
#--------------------------------------------------------------------------
def guarding?
return @action.guard?
end
#--------------------------------------------------------------------------
# * Get Element Change Value
# element_id : element ID
#--------------------------------------------------------------------------
def element_rate(element_id)
return 100
end
#--------------------------------------------------------------------------
# * Get Added State Success Rate
#--------------------------------------------------------------------------
def state_probability(state_id)
return 0
end
#--------------------------------------------------------------------------
# * Determine if State is Resisted
# state_id : state ID
#--------------------------------------------------------------------------
def state_resist?(state_id)
return false
end
#--------------------------------------------------------------------------
# * Get Normal Attack Element
#--------------------------------------------------------------------------
def element_set
return []
end
#--------------------------------------------------------------------------
# * Get Normal Attack State Change (+)
#--------------------------------------------------------------------------
def plus_state_set
return []
end
#--------------------------------------------------------------------------
# * Get Normal Attack State Change (-)
#--------------------------------------------------------------------------
def minus_state_set
return []
end
#--------------------------------------------------------------------------
# * Check State
# state_id : state ID
# Return true if the applicable state is added.
#--------------------------------------------------------------------------
def state?(state_id)
return @states.include?(state_id)
end
#--------------------------------------------------------------------------
# * Determine if a State is Full or Not
# state_id : state ID
# Return true if the number of turns the state is to be sustained
# equals the minimum number of turns after which the state will
# naturally be removed.
#--------------------------------------------------------------------------
def state_full?(state_id)
return false unless state?(state_id)
return @state_turns[state_id] == $data_states[state_id].hold_turn
end
#--------------------------------------------------------------------------
# * Determine if a State Should be Ignored
# state_id : state ID
# Returns true when the following conditions are fulfilled.
# * If State A which is to be added, is included in State B's
# [States to Cancel] list.
# * If State B is not included in the [States to Cancel] list for
# the new State A.
# These conditions would apply when, for example, trying to poison a
# character that is already incapacitated. It does not apply in cases
# such as applying ATK up while ATK down is already in effect.
#--------------------------------------------------------------------------
def state_ignore?(state_id)
for state in states
if state.state_set.include?(state_id) and
not $data_states[state_id].state_set.include?(state.id)
return true
end
end
return false
end
#--------------------------------------------------------------------------
# * Determine if it is a state that should be offset
# state_id : state ID
# Returns true when the following conditions are fulfilled.
# * The [Offset by Opp.] option is enabled for the new state.
# * The [States to Cancel] list of the new state to be added
# contains at least one of the current states.
# This would apply when, for example, ATK up is applied while ATK down
# is already in effect.
#--------------------------------------------------------------------------
def state_offset?(state_id)
return false unless $data_states[state_id].offset_by_opposite
for i in @states
return true if $data_states[state_id].state_set.include?(i)
end
return false
end
#--------------------------------------------------------------------------
# * Sorting States
# Sort the content of the @states array, with higher priority states
# coming first.
#--------------------------------------------------------------------------
def sort_states
@states.sort! do |a, b|
state_a = $data_states[a]
state_b = $data_states
if state_a.priority != state_b.priority
state_b.priority <=> state_a.priority
else
a <=> b
end
end
end
#--------------------------------------------------------------------------
# * Add State
# state_id : state ID
#--------------------------------------------------------------------------
def add_state(state_id)
state = $data_states[state_id] # Get state data
return if state == nil # Is data invalid?
return if state_ignore?(state_id) # Is it a state should be ignored?
unless state?(state_id) # Is this state not added?
unless state_offset?(state_id) # Is it a state should be offset?
@states.push(state_id) # Add the ID to the @states array
end
if state_id == 1 # If it is incapacitated (state 1)
@hp = 0 # Change HP to 0
end
unless inputable? # If the character cannot act
@action.clear # Clear battle actions
end
for i in state.state_set # Take the [States to Cancel]
remove_state(i) # And actually remove them
@removed_states.delete(i) # It will not be displayed
end
sort_states # Sort states with priority
end
@state_turns[state_id] = state.hold_turn # Set the number of turns
end
#--------------------------------------------------------------------------
# * Remove State
# state_id : state ID
#--------------------------------------------------------------------------
def remove_state(state_id)
return unless state?(state_id) # Is this state not added?
if state_id == 1 and @hp == 0 # If it is incapacitated (state 1)
@hp = 1 # Change HP to 1
end
@states.delete(state_id) # Remove the ID from the @states
@state_turns.delete(state_id) # Remove from the @state_turns
end
#--------------------------------------------------------------------------
# * Get Restriction
# Get the largest restriction from the currently added states.
#--------------------------------------------------------------------------
def restriction
restriction_max = 0
for state in states
if state.restriction >= restriction_max
restriction_max = state.restriction
end
end
return restriction_max
end
#--------------------------------------------------------------------------
# * Determine [Slip Damage] States
#--------------------------------------------------------------------------
def slip_damage?
for state in states
return true if state.slip_damage
end
return false
end
#--------------------------------------------------------------------------
# * Determine if the state is [Reduced hit ratio]
#--------------------------------------------------------------------------
def reduce_hit_ratio?
for state in states
return true if state.reduce_hit_ratio
end
return false
end
#--------------------------------------------------------------------------
# * Get Most Important State Continuation Message
#--------------------------------------------------------------------------
def most_important_state_text
for state in states
return state.message3 unless state.message3.empty?
end
return ""
end
#--------------------------------------------------------------------------
# * Remove Battle States (called when battle ends)
#--------------------------------------------------------------------------
def remove_states_battle
for state in states
remove_state(state.id) if state.battle_only
end
end
#--------------------------------------------------------------------------
# * Natural Removal of States (called up each turn)
#--------------------------------------------------------------------------
def remove_states_auto
clear_action_results
for i in @state_turns.keys.clone
if @state_turns > 0
@state_turns -= 1
elsif rand(100) < $data_states.auto_release_prob
remove_state(i)
@removed_states.push(i)
end
end
end
#--------------------------------------------------------------------------
# * State Removal due to Damage (called each time damage is caused)
#--------------------------------------------------------------------------
def remove_states_shock
for state in states
if state.release_by_damage
remove_state(state.id)
@removed_states.push(state.id)
end
end
end
#--------------------------------------------------------------------------
# * Calculation of MP Consumed for Skills
# skill : skill
#--------------------------------------------------------------------------
def calc_mp_cost(skill)
if half_mp_cost
return skill.mp_cost / 2
else
return skill.mp_cost
end
end
#--------------------------------------------------------------------------
# * Determine Usable Skills
# skill : skill
#--------------------------------------------------------------------------
def skill_can_use?(skill)
return false unless skill.is_a?(RPG::Skill)
return false unless movable?
return false if silent? and skill.spi_f > 0
return false if calc_mp_cost(skill) > mp
if $game_temp.in_battle
return skill.battle_ok?
else
return skill.menu_ok?
end
end
#--------------------------------------------------------------------------
# * Calculation of Final Hit Ratio
# user : Attacker, or user of skill or item
# obj : Skill or item (for normal attacks, this is nil)
#--------------------------------------------------------------------------
def calc_hit(user, obj = nil)
if obj == nil # for a normal attack
hit = user.hit # get hit ratio
physical = true
elsif obj.is_a?(RPG::Skill) # for a skill
hit = obj.hit # get success rate
physical = obj.physical_attack
else # for an item
hit = 100 # the hit ratio is made 100%
physical = obj.physical_attack
end
if physical # for a physical attack
hit /= 4 if user.reduce_hit_ratio? # when the user is blinded
end
return hit
end
#--------------------------------------------------------------------------
# * Calculate Final Evasion Rate
# user : Attacker, or user of skill or item
# obj : Skill or item (for normal attacks, this is nil)
#--------------------------------------------------------------------------
def calc_eva(user, obj = nil)
eva = self.eva
unless obj == nil # if it is a skill or an item
eva = 0 unless obj.physical_attack # 0% if not a physical attack
end
unless parriable? # If not parriable
eva = 0 # 0%
end
return eva
end
#--------------------------------------------------------------------------
# * Calculation of Damage From Normal Attack
# attacker : Attacker
# The results are substituted for @hp_damage
#--------------------------------------------------------------------------
def make_attack_damage_value(attacker)
damage = attacker.atk - self.def # base calculation
damage = 0 if damage < 0 # if negative, make 0
damage *= elements_max_rate(attacker.element_set) # elemental adjustment
damage /= 100
if damage == 0 # if damage is 0,
damage = rand(2) # half of the time, 1 dmg
elsif damage > 0 # a positive number?
@critical = (rand(100) < attacker.cri) # critical hit?
@critical = false if prevent_critical # criticals prevented?
damage *= 2 if @critical # critical adjustment
end
damage = apply_variance(damage, 20) # variance
damage = apply_guard(damage) # guard adjustment
@hp_damage = damage # damage HP
end
#--------------------------------------------------------------------------
# * Calculation of Damage Caused by Skills or Items
# user : User of skill or item
# obj : Skill or item (for normal attacks, this is nil)
# The results are substituted for @hp_damage or @mp_damage.
#--------------------------------------------------------------------------
def make_obj_damage_value(user, obj)
damage = obj.base_damage # get base damage
if damage > 0 # a positive number?
damage += user.atk * obj.atk_f / 100 # Attack F of the user
damage += user.spi * obj.spi_f / 100 # Spirit F of the user
unless obj.ignore_defense # Except for ignore defense
damage -= self.def * obj.atk_f / 100 # Attack F of the target
damage -= self.spi * obj.spi_f / 100 # Spirit F of the target
end
damage = 0 if damage < 0 # If negative, make 0
elsif damage < 0 # a negative number?
damage -= user.atk * obj.atk_f / 100 # Attack F of the user
damage -= user.spi * obj.spi_f / 100 # Spirit F of the user
end
damage *= elements_max_rate(obj.element_set) # elemental adjustment
damage /= 100
damage = apply_variance(damage, obj.variance) # variance
damage = apply_guard(damage) # guard adjustment
if obj.damage_to_mp
@mp_damage = damage # damage MP
else
@hp_damage = damage # damage HP
end
end
#--------------------------------------------------------------------------
# * Calculation of Absorb Effect
# user : User of skill or item
# obj : Skill or item (for normal attacks, this is nil)
# @hp_damage and @mp_damage must be calculated before this is called.
#--------------------------------------------------------------------------
def make_obj_absorb_effect(user, obj)
if obj.absorb_damage # if absorbing damage
@hp_damage = [self.hp, @hp_damage].min # HP damage range adjustment
@mp_damage = [self.mp, @mp_damage].min # MP damage range adjustment
if @hp_damage > 0 or @mp_damage > 0 # a positive number?
@absorbed = true # turn the absorb flag ON
end
end
end
#--------------------------------------------------------------------------
# * Calculating HP Recovery Amount From an Item
#--------------------------------------------------------------------------
def calc_hp_recovery(user, item)
result = maxhp * item.hp_recovery_rate / 100 + item.hp_recovery
result *= 2 if user.pharmacology # Pharmacology doubles the effect
return result
end
#--------------------------------------------------------------------------
# * Calculating MP Recovery Amount From an Item
#--------------------------------------------------------------------------
def calc_mp_recovery(user, item)
result = maxmp * item.mp_recovery_rate / 100 + item.mp_recovery
result *= 2 if user.pharmacology # Pharmacology doubles the effect
return result
end
#--------------------------------------------------------------------------
# * Get Maximum Elemental Adjustment Amount
# element_set : Elemental alignment
# Returns the most effective adjustment of all elemental alignments.
#--------------------------------------------------------------------------
def elements_max_rate(element_set)
return 100 if element_set.empty? # If there is no element
rate_list = []
for i in element_set
rate_list.push(element_rate(i))
end
return rate_list.max
end
#--------------------------------------------------------------------------
# * Applying Variance
# damage : Damage
# variance : Degree of variance
#--------------------------------------------------------------------------
def apply_variance(damage, variance)
if damage != 0 # If damage is not 0
amp = [damage.abs * variance / 100, 0].max # Calculate range
damage += rand(amp+1) + rand(amp+1) - amp # Execute variance
end
return damage
end
#--------------------------------------------------------------------------
# * Applying Guard Adjustment
# damage : Damage
#--------------------------------------------------------------------------
def apply_guard(damage)
if damage > 0 and guarding? # Determine if guarding
damage /= super_guard ? 4 : 2 # Reduce damage
end
return damage
end
#--------------------------------------------------------------------------
# * Damage Reflection
# user : User of skill or item
# @hp_damage, @mp_damage, or @absorbed must be calculated before this
# method is called.
#--------------------------------------------------------------------------
def execute_damage(user)
if @hp_damage > 0 # Damage is a positive number
remove_states_shock # Remove state due to attack
end
self.hp -= @hp_damage
self.mp -= @mp_damage
if @absorbed # If absorbing
user.hp += @hp_damage
user.mp += @mp_damage
end
end
#--------------------------------------------------------------------------
# * Apply State Changes
# obj : Skill, item, or attacker
#--------------------------------------------------------------------------
def apply_state_changes(obj)
plus = obj.plus_state_set # get state change (+)
minus = obj.minus_state_set # get state change (-)
for i in plus # state change (+)
next if state_resist?(i) # is it resisted?
next if dead? # are they incapacitated?
next if i == 1 and @immortal # are they immortal?
if state?(i) # is it already applied?
@remained_states.push(i) # record unchanged states
next
end
if rand(100) < state_probability(i) # determine probability
add_state(i) # add state
@added_states.push(i) # record added states
end
end
for i in minus # state change (-)
next unless state?(i) # is the state not applied?
remove_state(i) # remove state
@removed_states.push(i) # record removed states
end
for i in @added_states & @removed_states # if there are any states in
@added_states.delete(i) # both added and removed
@removed_states.delete(i) # sections, delete them both
end
end
#--------------------------------------------------------------------------
# * Determine Whether to Apply a Normal Attack
# attacker : Attacker
#--------------------------------------------------------------------------
def attack_effective?(attacker)
if dead?
return false
end
return true
end
#--------------------------------------------------------------------------
# * Apply Normal Attack Effects
# attacker : Attacker
#--------------------------------------------------------------------------
def attack_effect(attacker)
clear_action_results
unless attack_effective?(attacker)
@skipped = true
return
end
if rand(100) >= calc_hit(attacker) # determine hit ratio
@missed = true
return
end
if rand(100) < calc_eva(attacker) # determine evasion rate
@evaded = true
return
end
make_attack_damage_value(attacker) # damage calculation
execute_damage(attacker) # damage reflection
if @hp_damage == 0 # physical no damage?
return
end
apply_state_changes(attacker) # state change
end
#--------------------------------------------------------------------------
# * Determine if a Skill can be Applied
# user : Skill user
# skill : Skill
#--------------------------------------------------------------------------
def skill_effective?(user, skill)
if skill.for_dead_friend? != dead?
return false
end
if not $game_temp.in_battle and skill.for_friend?
return skill_test(user, skill)
end
return true
end
#--------------------------------------------------------------------------
# * Skill Application Test
# user : Skill user
# skill : Skill
# Used to determine, for example, if a character is already fully healed
# and so cannot recover anymore.
#--------------------------------------------------------------------------
def skill_test(user, skill)
tester = self.clone
tester.make_obj_damage_value(user, skill)
tester.apply_state_changes(skill)
if tester.hp_damage < 0
return true if tester.hp < tester.maxhp
end
if tester.mp_damage < 0
return true if tester.mp < tester.maxmp
end
return true unless tester.added_states.empty?
return true unless tester.removed_states.empty?
return false
end
#--------------------------------------------------------------------------
# * Apply Skill Effects
# user : Skill user
# skill : skill
#--------------------------------------------------------------------------
def skill_effect(user, skill)
clear_action_results
unless skill_effective?(user, skill)
@skipped = true
return
end
if rand(100) >= calc_hit(user, skill) # determine hit ratio
@missed = true
return
end
if rand(100) < calc_eva(user, skill) # determine evasion rate
@evaded = true
return
end
make_obj_damage_value(user, skill) # calculate damage
make_obj_absorb_effect(user, skill) # calculate absorption effect
execute_damage(user) # damage reflection
if skill.physical_attack and @hp_damage == 0 # physical no damage?
return
end
apply_state_changes(skill) # state change
end
#--------------------------------------------------------------------------
# * Determine if an Item can be Used
# user : Item user
# item : item
#--------------------------------------------------------------------------
def item_effective?(user, item)
if item.for_dead_friend? != dead?
return false
end
if not $game_temp.in_battle and item.for_friend?
return item_test(user, item)
end
return true
end
#--------------------------------------------------------------------------
# * Item Application Test
# user : Item user
# item : item
# Used to determine, for example, if a character is already fully healed
# and so cannot recover anymore.
#--------------------------------------------------------------------------
def item_test(user, item)
tester = self.clone
tester.make_obj_damage_value(user, item)
tester.apply_state_changes(item)
if tester.hp_damage < 0 or tester.calc_hp_recovery(user, item) > 0
return true if tester.hp < tester.maxhp
end
if tester.mp_damage < 0 or tester.calc_mp_recovery(user, item) > 0
return true if tester.mp < tester.maxmp
end
return true unless tester.added_states.empty?
return true unless tester.removed_states.empty?
return true if item.parameter_type > 0
return false
end
#--------------------------------------------------------------------------
# * Apply Item Effects
# user : Item user
# item : item
#--------------------------------------------------------------------------
def item_effect(user, item)
clear_action_results
unless item_effective?(user, item)
@skipped = true
return
end
if rand(100) >= calc_hit(user, item) # determine hit ratio
@missed = true
return
end
if rand(100) < calc_eva(user, item) # determine evasion rate
@evaded = true
return
end
hp_recovery = calc_hp_recovery(user, item) # calc HP recovery amount
mp_recovery = calc_mp_recovery(user, item) # calc MP recovery amount
make_obj_damage_value(user, item) # damage calculation
@hp_damage -= hp_recovery # subtract HP recovery amount
@mp_damage -= mp_recovery # subtract MP recovery amount
make_obj_absorb_effect(user, item) # calculate absorption effect
execute_damage(user) # damage reflection
item_growth_effect(user, item) # apply growth effect
if item.physical_attack and @hp_damage == 0 # physical no damage?
return
end
apply_state_changes(item) # state change
end
#--------------------------------------------------------------------------
# * Item Growth Effect Application
# user : Item user
# item : item
#--------------------------------------------------------------------------
def item_growth_effect(user, item)
if item.parameter_type > 0 and item.parameter_points != 0
case item.parameter_type
when 1 # Maximum HP
@maxhp_plus += item.parameter_points
when 2 # Maximum MP
@maxmp_plus += item.parameter_points
when 3 # Attack
@atk_plus += item.parameter_points
when 4 # Defense
@def_plus += item.parameter_points
when 5 # Spirit
@spi_plus += item.parameter_points
when 6 # Agility
@agi_plus += item.parameter_points
end
end
end
#--------------------------------------------------------------------------
# * Application of Slip Damage Effects
#--------------------------------------------------------------------------
def slip_damage_effect
if slip_damage? and @hp > 0
@hp_damage = apply_variance(maxhp / 10, 10)
@hp_damage = @hp - 1 if @hp_damage >= @hp
self.hp -= @hp_damage
end
end
end


Bonjour, voici un script qui modifie et rend plus simple le calcule des Domages sur Rpg Maker VX
Remplacer le script Game_Battler par celui la.
Et lancer le jeu pour que les effets puisse se mette à jour pour combats testé dans la base de donnée.

Voici les modifications apporté: (En gros j'ai retiré tous les mutilicateurs * 4 et / 2)

Attaque normal
Les points dégats = Force - défense.

Magie/skill
Les domages de base ne change pas.
Ce qui change c'est les formules utilisé quand on utilise les % en Influence Physique
et Magique.

Influcence Physique
Attaque de base de l'attaquant * chiffre dans l'influence Physique /100
- Defense de base du defensseur * chiffre dans l'influence physique /100

Le résulat est ajouté au domage de base de la compétence/objet


Influcence Magique
Intelligence de l'attaquant * chiffre dans l'influence magique /100
- intelligence du défenseur * chiffre dans l'influence physique /100

Le résulat est ajouté au domage de base de la compétence/objet.

Coups critique
Les coups critiques multiplies par deux les domages. (A la base c'est * 3 )


Note de la fin
Voila le reste ne change pas.
Vous allez pouvoir contrôler un peu plus les dégats sans avoir de gros eccarts.



letrasheur1313 - posté le 14/03/2009 à 19:28:52. (26 messages postés)

Merci pour ce script.
Dans VX c'est trop la galère de régler les stats.
:biere

Prout man sera de retour un de ses jours !!


ADIDI - posté le 15/03/2009 à 10:43:21. (184 messages postés)

pas mal ce script ! j'aime bien je suppose qu'il n'y a pas de problème a l'intégrai a un a-rpg ? ( je vais tester de toutes manières ^^ ) merci MONOS ^^

je commence une aventure et je la finiré jamais


Monos - posté le 15/03/2009 à 20:17:40. (56891 messages postés) - misteroniro

Vive le making libre

Citation:

j'aime bien je suppose qu'il n'y a pas de problème a l'intégrai a un a-rpg ?



En théorie Non. Il y auras pas de pépin.

Citation:

merci MONOS ^^


de rien. A la base c'est fait pour le jeu que vous aimez pas graphiquement et j'ai partagé le script.

Pixner|Offgame | Le comptoire des clikeurs


yakzawik - posté le 15/03/2009 à 23:03:06. (1131 messages postés) - heberge

Je veux pas être chiant, mais qu'est ce qui changé réellement dedans ?

Si je mets ce script dans mon projet, il sera modifié quant aux dégâts infligés par rapport à avant où j'avais le script de base ?


Monos - posté le 16/03/2009 à 00:56:03. (56891 messages postés) - misteroniro

Vive le making libre

Ga yak faut pas m'imiter quand tu écris.^^

Bon je crois avoir pigé, tu remplaces le scipt Game Battler par celui la.

En gros dans les formule de combat que tu as dans les tutos Vx et dans l'aide VX c'est Attaque * 4 - Défense * 2
(Pour les pouvoir / objet c'est un peu plus complexe mais c'est toujours *4 pour l'attaquant et *2 pour le défenseur )

J'ai juste viré dans les formules les * 4 et * 2
Et j'ai changé les coup critique qui était dommage * 3 par dommage *2.

Du coup la différence de débats est plus rapproché.

Quelque Testeur de ma démo sur les graphes de FF1 se plaignait que la différence de frappe entre deux persos était énorme.
Et avec les formules de base, j'arrivais pas à ajuster tous ça correctement.

Pixner|Offgame | Le comptoire des clikeurs


tamtammort - posté le 16/03/2009 à 13:21:33. (376 messages postés)

Citation:

Bonjour, voici un script qui modifie et rend plus simple le calcule des Domages sur Rpg Maker VX
Remplacer le script Game_Battler par celui la.
Et lancer le jeu pour que les effets puisse se mette à jour pour combats testé dans la base de donnée.

Voici les modifications apporté: (En gros j'ai retiré tous les mutilicateurs * 4 et / 2)

Attaque normal
Les points dégats = Force - défense.


Ok, si je comprends bien, ça veut dire que les dégâts infligés au monstre = la différence entre la def du monstre et la for du héros ? Pour moi, cela est très simplement faisable en event...


Monos - posté le 16/03/2009 à 13:29:03. (56891 messages postés) - misteroniro

Vive le making libre

Citation:

Pour moi, cela est très simplement faisable en event...



Je suis pas un Full Script, j'aime les événements mais la sur ce coups si pour VX (et XP) ca serait débile de repasser par des événements pour les combats pour changer les formules de combat qu'en deux trois seconde dans les scripts c'est largement plus rapide.

Ensuite il y a pas que les dégats normaux mais aussi les objets magique et autres et Basta.

(Ps vous pouvez vous aussi changer les formules sur le coup faut pas s'appeler Zeus pour savoir faire ça. )

La utiliser les événements c'est ce faire chier pour rien pour VX et XP.

Pixner|Offgame | Le comptoire des clikeurs


tamtammort - posté le 17/03/2009 à 12:50:24. (376 messages postés)

> Monos
Je ne te critique pas, mais je donne juste mon avis pour les passionnés d'event qui désirent s'entraîner à utiliser les variables.

Citation:

Ensuite il y a pas que les dégats normaux mais aussi les objets magique et autres et Basta.


Oui, j'ai oublié de le préciser dans mon premier message.


mangafan92 - posté le 14/11/2010 à 13:35:01. (9 messages postés)

Ptite question, est ce compatible avec un script de combat en temps réel?
Merci d'avance!

Si tu donnes un poisson que tu à volé à un homme, il mangera un jour, si tu lui apprend à voler, il mangera toute sa vie...


MatteW - posté le 16/02/2011 à 13:19:58. (22 messages postés)

je pense que c'est compatible avec tous les autres scripts, sinon ce serait précisé. Mais après tout je n'y connais pas grand chose en script.


nargilos - posté le 08/06/2011 à 08:52:49. (4 messages postés)

Bonjour, je débute dans le making et j'ai un souci avec ce script : lorsqu un ennemi est vaincu un message d'erreur s'affiche concernant la ligne 1027, si vous pouviez m'expliquer comment y remédier ça m'arrangerai :)


Vincelamenace - posté le 01/10/2011 à 10:18:24. (1 messages postés)

pareil pour moi !


Tata Monos - posté le 01/10/2011 à 12:58:26. (56891 messages postés) - misteroniro

Vive le making libre

N'utilisez pas ce script changez directement les formules dans le script Game_Battler.

Les formules se trouvent à la ligne 637 jusque 687.

Il y a des x4 des x2
voir des x2 et x 1 suivant les lignes.

Adaptez comme bon vous semble tous ça. Cela n'est pas compliqué.

Damage = les PV qui vont être perdu.
attacker.atk = Force de l’attaquant.
self.de = Défense

ect

Pixner|Offgame | Le comptoire des clikeurs


Nix - posté le 30/06/2012 à 14:56:38. (2 messages postés)

Super Script, merci Monos !

Suite à de nombreux abus, le post en invités a été désactivé. Veuillez vous inscrire si vous souhaitez participer à la conversation.

Haut de page

Merci de ne pas reproduire le contenu de ce site sans autorisation.
Contacter l'équipe - Mentions légales

Plan du site:

Communauté: Accueil | News | Forum | Flash-news | Sorties | Chat | Commentaires | Galerie | Blogs | Articles perso | Screen de la semaine | Palmarès | Livre d'or | Recherche | Interviews | OST | L'Annuaire | Divers
Apprendre: Le Wiki | Tutoriels | Guides | Gaming-Live | Tests | Making-of
Télécharger: Programmes | Scripts | Packs de ressources | Midis | Eléments séparés | Sprites
Jeux: Index jeux séparés | Top Classiques | Top Originaux | Les autres | Collection Oniro | RPG Maker 95 | RPG Maker 2000 | RPG Maker 2003 | RPG Maker XP | RPG Maker VX | RPG Maker VX Ace | RPG Maker MV | Autres | Jeux complets | Proposer
Hébergés: Aëdemphia | Fighting Robots Quest | Geex | Inexistence | La Légende d'Ibabou | Nylu | Sarcia | Super Mario RPG - Lost Souls
Ressources RPG Maker 2000/2003: Chipsets | Charsets | Panoramas | Backdrops | Facesets | Battle anims | Battle charsets | Monstres | Systems | Templates
Ressources RPG Maker XP: Tilesets | Autotiles | Characters | Battlers | Window skins | Icônes | Transitions | Fogs | Templates
Ressources RPG Maker VX: Tilesets | Charsets | Facesets | Systèmes
Ressources RPG Maker MV: Tilesets | Characters | Faces | Systèmes | Title | Battlebacks | Animations | SV/Ennemis