-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchargementfirst.lua
More file actions
181 lines (178 loc) · 4.81 KB
/
chargementfirst.lua
File metadata and controls
181 lines (178 loc) · 4.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
local variationtune=false
function vartune(diam)
local valeurfinale
if diam~=nil then
valeurfinale=savegame.monney
else
valeurfinale=-argent/3
end
if valeurfinale>-1 and valeurfinale<1 then
valeurfinale=0
end
--print("from "..tune.text.." to ".. valeurfinale)
local valeurbegin
if diam then
valeurbegin=tonumber(lefrictext.text)
else
valeurbegin=tonumber(tune.text)
end
local begin
local letexttext
if variationtune then
Runtime:removeEventListener( "enterFrame", variationtunelist )
end
local varsec=1
local diffric=mathabs(valeurfinale-valeurbegin)
if diffric<20 then
varsec=0.6
elseif diffric<50 then
varsec=1.2
elseif diffric<150 then
varsec=3.2
elseif diffric<300 then
varsec=5.9
elseif diffric<500 then
varsec=12
elseif diffric<1000 then
varsec=123
elseif diffric<10000 then
varsec=511
else
varsec=12345
end
if diam then
varsec=varsec*0.5
end
print("varsec "..varsec)
local signe=1
if valeurfinale-valeurbegin<0 then
signe=-1
end
print("signe "..signe)
variationtune=true
function variationtunelist( event )
if begin==nil then
begin=event.time
end
valeurbegin=valeurbegin+varsec*signe
-- print("valeurbegin "..valeurbegin)
letexttext=mathfloor(valeurbegin)
if (letexttext>=valeurfinale and signe==1) or (letexttext<=valeurfinale and signe==-1) then
if diam then
if lefrictext~=nil then
lefrictext.text=valeurfinale
end
else
tune.text=valeurfinale
end
variationtune=false
Runtime:removeEventListener( "enterFrame", variationtunelist )
else
if letexttext>-1 and letexttext<1 then
letexttext=0
end
if diam then
if lefrictext~=nil then
lefrictext.text=letexttext
end
else
tune.text=letexttext
end
end
--print("tune.text "..tune.text)
end
Runtime:addEventListener( "enterFrame", variationtunelist )
end
function retournenumgene(racech,niveaugene)
print("racech "..racech.." niveaugene "..niveaugene)
local numgene=173
--local numsave=350
if racech==0 then--general
if niveaugene==1 then
numgene=170
elseif niveaugene==2 then
numgene=171
elseif niveaugene==3 then
numgene=172
elseif niveaugene>=4 then
numgene=179
end
elseif racech==1 then
if niveaugene==1 then
numgene=173
elseif niveaugene==2 then
numgene=175
elseif niveaugene==3 then
numgene=174
elseif niveaugene>=4 then
numgene=179
end
elseif racech==2 then
if niveaugene==1 then
numgene=176
elseif niveaugene==2 then
numgene=177
elseif niveaugene==3 then
numgene=178
elseif niveaugene>=4 then
numgene=179
end
end
print("numgene "..numgene)
return numgene
end
function attviegene(numdev,numimage,infosurlevelup)
local viegene
local attaquegene
local levelgene
local vieplus
local attaqueplus
local xpmanquant
local xpactuel
local xpppourlevelup
local charge
print("le general à "..savegamedev[numdev].." d'experience")
savegamedev[numdev]=tonumber(savegamedev[numdev])
local testcpt=1
while testcpt<#savegameall.generalxp do
if savegamedev[numdev]<=savegameall.generalxp[testcpt] then
levelgene=testcpt
testcpt=#savegameall.generalxp+1
end
testcpt=testcpt+1
end
if levelgene==nil then
levelgene=1
end
print("vie avant: "..image[numimage].vie.." attaque "..image[numimage].attaque.."lvl gene"..levelgene)
if image[numimage].charge==0 then
attaquegene=mathfloor(image[numimage].attaque*(1-0.1+levelgene*0.1))
else
attaquegene=mathfloor(image[numimage].attaque*(1-0.1+levelgene*0.05))
charge=mathfloor(image[numimage].charge*(1-0.1+levelgene*0.05))
end
--attaquegene=mathfloor(image[numimage].attaque*(1-0.1+levelgene*0.1))
viegene=mathfloor(image[numimage].vie*(1-0.1+levelgene*0.1))
if infosurlevelup then
if image[numimage].charge==0 then
attaqueplus=mathfloor(image[numimage].attaque*(1-0.1+(levelgene+1)*0.1))-attaquegene
else
attaqueplus=mathfloor(image[numimage].attaque*(1-0.1+(levelgene+1)*0.05))-attaquegene
end
--attaqueplus=mathfloor(image[numimage].attaque*(1-0.1+(levelgene+1)*0.1))-attaquegene
print("attaquegene"..attaquegene.."attplustt"..mathfloor(image[numimage].attaque*(1-0.1+(levelgene+1)*0.1)).." attp "..attaqueplus)
vieplus=mathfloor(image[numimage].vie*(1-0.1+(levelgene+1)*0.1))-viegene
xpmanquant=mathfloor(savegameall.generalxp[levelgene]*0.2)-mathfloor(savegamedev[numdev]*0.2)
local xplevelavant=0
if levelgene>1 then
xplevelavant=mathfloor(savegameall.generalxp[levelgene-1]*0.2)
end
xpactuel=mathfloor(savegamedev[numdev]*0.2)-xplevelavant
xpppourlevelup=mathfloor(savegameall.generalxp[levelgene]*0.2)-xplevelavant -- -mathfloor(savegamedev[numgene-1]*0.01)
end
return attaquegene,viegene,levelgene,vieplus,attaqueplus,xpmanquant,xpactuel,xpppourlevelup,charge
end
local t = {}--chargement de donnée pour les gentils et une partie pour les mechants+ une parties des images
t.chargementfirst = function ()
end
return(t)