Code: |
module POKEMON_S class Puissance def puissance if $pokemon_party.actors[0].dfe > $pokemon_party.actors[0].atk @dfe = $pokemon_party.actors[0].dfe - (($pokemon_party.actors[0].atk/2) + ($pokemon_party.actors[0].ats/2)) else @dfe = $pokemon_party.actors[0].dfe end @puissance = ($pokemon_party.actors[0].atk * $pokemon_party.actors[0].ats)/(@dfe * $pokemon_party.actors[0].dfs) $game_variable[400] = @puissance end end end |
Code: |
file = File.open("logPuissance.txt", "w") file.write("#{$pokemon_party.actors[0].inspect}\n-----------------------------------------------------\n#{$pokemon_party.actors[0].atk.inspect}\n-----------------------------------------------------\n#{$pokemon_party.actors[0].dfe.inspect}") file.close |
Misa-Xage a écrit: |
Il va contenir cette fraction : (attaque du premier pokemon + attaque spécial du premier pokemon) / (defence du premier pokemon + defense spécial du premier pokemon) |
Code: |
module POKEMON_S class Puissance def puissance file = File.open("logPuissance.txt", "w") file.write("#{$pokemon_party.actors[0].inspect}\n-----------------------------------------------------\n#{$pokemon_party.actors[0].atk.inspect}\n-----------------------------------------------------\n#{$pokemon_party.actors[0].dfe.inspect}") file.close if $pokemon_party.actors[0].dfe > $pokemon_party.actors[0].atk @dfe = $pokemon_party.actors[0].dfe - (($pokemon_party.actors[0].atk/2) + ($pokemon_party.actors[0].ats/2)) else @dfe = $pokemon_party.actors[0].dfe end @puissance = ($pokemon_party.actors[0].atk * $pokemon_party.actors[0].ats)/(@dfe * $pokemon_party.actors[0].dfs) $game_variable[400] = @puissance end end end |
Yuri-岼 a écrit: |
a=POKEMON_S::Puissance.new p a.puissance |
Code: |
def test 6 end p test |
Code: |
def test2 for i in 0...10 6 end end p test2 |
Code: |
def verif_voltorbe a=nil for i in 0...6 if a=$pokemon_party.actors[i] if a.id==100 return a end end end false #Indique qu'il n'y a pas de voltorbe end |
Code: |
module POKEMON_S class Puissance def initialize(id_pokemon) @id_pokemon = id_pokemon end def puissance case @id_pokemon when $pokemon_party.actors[0].id @index = 0 when $pokemon_party.actors[1].id @index = 1 when $pokemon_party.actors[2].id @index = 2 when $pokemon_party.actors[3].id @index = 3 when $pokemon_party.actors[4].id @index = 4 when $pokemon_party.actors[5].id @index = 5 end #Pour pas que ça rend toujours 0 if $pokemon_party.actors[@index].dfe > $pokemon_party.actors[@index].atk @dfe = $pokemon_party.actors[@index].dfe - (($pokemon_party.actors[@index].atk/2) + ($pokemon_party.actors[0].ats/2)) else @dfe = $pokemon_party.actors[@index].dfe end #Pareil if $pokemon_party.actors[@index].dfs > $pokemon_party.actors[@index].ats @dfs = $pokemon_party.actors[@index].dfs - (($pokemon_party.actors[@index].atk/2) + ($pokemon_party.actors[0].ats/2)) else @dfs = $pokemon_party.actors[@index].dfs end #Pour pas que ça bug si le résultat est plus petit que 0 if ($pokemon_party.actors[@index].atk * $pokemon_party.actors[@index].ats)/(@dfe * @dfs) <= 0 @puissance = 0 else @puissance = ($pokemon_party.actors[@index].atk * $pokemon_party.actors[@index].ats)/(@dfe * @dfs) end end end end |