# Temps à attendre pour nouveau fruit
TPS_NEW = [24, 0, 0]
# {"TYPE" => [id]}
NOIGUME = {
#"BAIE CERIZ" => [ 1, [12, 0, 0], 5, 3],
"BLANCHE" => [ 1 ],
"BLEU" => [2],
"JAUNE" => [3],
"NOIRE" => [4],
"ROSE" => [5],
"ROUGE" => [6],
"VERT" => [7],
}
class Noigrume
attr_accessor :type
attr_accessor :id_type
attr_accessor :id_noigrume
attr_accessor :date
attr_accessor :temps
attr_accessor :dt_st_sv
attr_accessor :pret
def initialize(type)
clock = Time.now
@type = type
@id_type = NOIGRUME[@type][0]
@id_noigrume = $id_noigrume
$id_noigrume = 0
@pret = 1
@date = [$game_variables[99],clock.hour,clock.min,clock.sec]
@temps = TPS_NEW
tps = @temps[0] * 3600
tps += @temps[1] * 60
tps += @temps[2]
tps = tps.to_i
@dt_st_sv = [
@date[0] + tps / 86400,
@date[1] + (tps % 86400) / 3600,
@date[2] + (tps % 3600) / 60,
@date[3] + tps % 60
]
end
def maj
clock = Time.new
date = [$game_variables[99],clock.hour,clock.min,clock.sec]
for i in 0..3
if date[i] > @dt_st_sv[i]
retour = true
break
elsif date[i] == @dt_st_sv[i]
next
else
retour = false
break
end
end
if retour
if @stade <= 3
@temps = BAIE[type][1]
for i in
0...@temps.size @temps[i] *= TPS_STADES[@stade] / 100.0
end
tps = @temps[0] * 3600
tps += @temps[1] * 60
tps += @temps[2]
tps = tps.to_i
date = [$game_variables[99],clock.hour,clock.min,clock.sec]
@dt_st_sv = [
date[0] + tps / 86400,
date[1] + (tps % 86400) / 3600,
date[2] + (tps % 3600) / 60,
date[3] + tps % 60
]
end
end
end
end
class Game_Map
alias noigrume_refresh refresh
def refresh
if @map_id > 0
noigrume_refresh
if not(@events.empty?) and $game_variables[5000].type == Hash and $game_variables[5000]["noigrume"] != nil and $game_variables[5000]["noigrume"][@map_id] != nil
for i in @events.keys
if $game_variables[5000]["noigrume"][@map_id][i] != nil
maj_noigrume
@events[i].character_name = "noigrumiers.png"
@events[i].direction = 2 * stade
end
end
end
end
end
def maj_noigrume
for i in
1..@events.size if $game_variables[5000]["noigrume"][@map_id][i] != nil
$game_variables[5000]["noigrume"][@map_id][i].maj
end
end
end
end
class Interpreter
#Numéro carte,numéro événement,type noigrume
def init_noigrume(map = $game_map.map_id, no_arbre = @event_id, noigrume = "BLANCHE")
$noigrume_id = Item.id(noigrume)
$game_variables[5000]["noigrume"][map] = []
$game_variables[5000]["noigrume"][map][event] = Noigrume.new(noigrume)
end
end