Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local AD3 = 0x0200047A -- Next Encounter
- local AD4 = 0x020023A8 -- Battle RN
- local AD5 = 0x03001CB4 -- General RN
- local gcount = 0
- local bcounter = 0
- local store = memory.readdword(0x03001CB4)
- local bstore = memory.readdword(0x020023A8)
- local brncount=0
- local fleestore = 0
- local fleepercent = 0
- --eel = memory.readbyte(0x0203089E) -- venus res
- --eme = memory.readbyte(0x020308A2)
- --ema = memory.readbyte(0x020308A6)
- --eju = memory.readbyte(0x020308A8)
- -- Vulnerability Key
- --12 = Drop Def 25%
- --13 = Drop def 12%
- --16 = res drop 40
- --17 = res drop 20
- --20 = delusion
- --23 = stun
- --24 = sleep
- --27 = death
- --31 = HP steal
- --32 = PP steal
- --60 = 50% dmg to health
- --69 = 10% dmg to PP
- while true do
- gui.text(160,00,"BRN: ".. (memory.readdword(AD4)))
- gui.text(160,10,"GRN: ".. (memory.readdword(AD5)))
- -- RNG Functions
- function RNA (R) -- RN Advance Function
- g = R
- m1 = 0x4e6d
- m2 = 0x41c6
- g1 = g*m1
- g2 = g*m2
- g2 = bit.band(g2,0xFFFF)
- g = g1 + g2*0x10000
- g = bit.band(g,0xFFFFFFFF)
- c=0x3039
- g = g+c
- g = bit.band(g,0xFFFFFFFF)
- return g
- end
- function RNB (R) -- RN Advance and reduce for use in RNG calculations
- g = R
- m1 = 0x4e6d
- m2 = 0x41c6
- g1 = g*m1
- g2 = g*m2
- g2 = bit.band(g2,0xFFFF)
- g = g1 + g2*0x10000
- c=0x3039
- g = g+c
- g = bit.band(g,0xFFFFFFFF)
- g = bit.lshift(g,8)
- g = bit.rshift(g,16)
- return g
- end
- --gui.text(140,20,"X: " .. (memory.readdword(0x02030ec4))/1000000)
- --gui.text(140,30,"Y: " .. (memory.readdword(0x02030ecc))/1000000)
- --g = memory.readdword(AD5)
- --print(bit.tohex(g))
- -- begin enemy HP/encounter loops
- -- HP/encounter display
- if memory.readbyte(0x020309a0) >= 1 then
- gui.text(0,20,"Enemy 1 HP: " .. (memory.readword(0x020308B0)))
- else
- gui.text(0,20,"Encounter: ".. (memory.readword(AD3)))
- gui.text(0,30,"Isaac PP: ".. (memory.readbyte(0x0200053A)))
- gui.text(0,40,"PP Regen: ".. (math.floor((memory.readbyte(0x020301B5))/0xF)))
- end
- if memory.readbyte(0x02030AEC) >= 1 then
- gui.text(0,30,"Enemy 2 HP: " .. (memory.readword(0x020309FC)))
- end
- if memory.readbyte(0x02030C38) >= 1 then
- gui.text(0,40,"Enemy 3 HP: " .. (memory.readword(0x02030B48)))
- end
- if memory.readbyte(0x02030D84) >= 1 then
- gui.text(0,50,"Enemy 4 HP: " .. (memory.readword(0x02030c94)))
- end
- -- begin RNG counters
- GRN = memory.readdword(AD5)
- BRN = memory.readdword(AD4)
- if GRN == 1710661176 then
- store = 1710661176
- gcount=0
- end
- gcountbase = 0
- while store ~= GRN and gcountbase <= 10000 do
- --print(store)
- store = RNA(store)
- if store <= 0 then
- store = 0xFFFFFFFF+store+1
- gcount = gcount +1
- gcountbase = gcountbase +1
- else
- gcount = gcount +1
- gcountbase = gcountbase +1
- end
- end
- if store == GRN then
- gcountbase = 0
- else
- store = GRN
- gcountbase = 0
- gcount = 0
- end
- bcountbase = 0
- while bstore ~= BRN and bcountbase <= 1000 do
- bstore = RNA(bstore)
- if bstore <= 0 then
- bstore = 0xFFFFFFFF+bstore+1
- brncount = brncount+1
- bcountbase = bcountbase+1
- else
- brncount = brncount+1
- bcountbase = bcountbase+1
- end
- end
- if bstore == BRN then
- bcountbase = 0
- else
- bstore = BRN
- bcountbase = 0
- brncount = 0
- end
- if BRN == 0 then -- reset BRN counter on loadstate
- bstore = BRN
- bcount = 0
- end
- -- Gui display
- gui.text(0,10,"GRN count: " .. gcount)
- gui.text(0,00,"BRN count: " .. bcounter)
- -- Begin Flee/Assassinate Scripts
- local el1 = memory.readbyte(0x02030887) -- Enemy 1 Level
- local el2 = memory.readbyte(0x020309d3) -- etc
- local el3 = memory.readbyte(0x02030B1F)
- local el4 = memory.readbyte(0x02030c6b)
- local party = memory.readbyte(0x02000040) -- Party member number
- local isl= memory.readbyte(0x0200050F) -- Isaac level
- local gal= memory.readbyte(0x0200065b) -- etc
- local ivl= memory.readbyte(0x020007a7)
- local mil= memory.readbyte(0x020008F3)
- if (memory.readbyte(0x020309a0)) >= 1 then
- if el4 ~= 0 then
- ela = (el1+el2+el3+el4)/4
- elseif el3 ~=0 then
- ela = (el1+el2+el3)/3
- elseif el2 ~=0 then
- ela = (el1+el2)/2
- else
- ela = el1
- end
- if party == 15 then
- ml = (isl+gal+ivl+mil)/4
- elseif party == 7 then
- ml = (isl+gal+ivl)/3
- else
- ml = (isl+gal)/2
- end
- LevelAve = ml-ela
- function RNA (R) -- RN Advance Function
- g = R
- m1 = 0x4e6d
- m2 = 0x41c6
- g1 = g*m1
- g2 = g*m2
- g2 = bit.band(g2,0xFFFF)
- g = g1 + g2*0x10000
- g = bit.band(g,0xFFFFFFFF)
- c=0x3039
- g = g+c
- g = bit.band(g,0xFFFFFFFF)
- return g
- end
- function RNB (R) -- RN Advance and reduce for use in RNG calculations
- g = R
- m1 = 0x4e6d
- m2 = 0x41c6
- g1 = g*m1
- g2 = g*m2
- g2 = bit.band(g2,0xFFFF)
- g = g1 + g2*0x10000
- c=0x3039
- g = g+c
- g = bit.band(g,0xFFFFFFFF)
- g = bit.lshift(g,8)
- g = bit.rshift(g,16)
- return g
- end
- fleeFail = memory.readbyte(0x02030092)
- function flee(S) -- Flee Success Calculation
- g = S
- g = RNB(g)*10000
- fl = 5000 + (2000*fleeFail) + (LevelAve * 500)
- g = bit.rshift(g, 16)
- if fl >= g then
- return true
- else
- return false
- end
- end
- RN= memory.readdword(0x03001CB4)
- count = 0
- while flee(RN) == false do -- Attack Cancel to Flee Calculation
- count = count + 1
- if count == 100 then break end
- RN= RNA(RN)
- end
- gui.text(160,30,"ACs to Run: " .. count)
- -- % Chance to Run
- fleecount = 0
- if fleestore ~= memory.readdword(AD5) then
- fleeRN = memory.readdword(AD5)
- for i=1,1000 do
- if flee(fleeRN) == true then
- fleecount= fleecount +1
- end
- fleeRN=RNA(fleeRN)
- end
- fleepercent = fleecount/10
- fleestore = memory.readdword(AD5)
- fev = fleepercent/100
- EV = (fev*1+ math.floor(fev+.20,1)*(1-fev)*2+ math.floor(fev+.40,1)*(1-math.floor(fev+.20,1))*(1-fev)*3+ math.floor(fev+.60,1)*(1-math.floor(fev+.40,1))*(1-math.floor(fev+.20,1))*(1-fev)*4+ math.floor(fev+.80,1)*(1-math.floor(fev+.60,1))*(1-math.floor(fev+.40,1))*(1-math.floor(fev+.20,1))*(1-fev)*5+ (1-math.floor(fev+.80,1))*(1-math.floor(fev+.60,1))*(1-math.floor(fev+.40,1))*(1-math.floor(fev+.20,1))*(1-fev)*6)
- gui.text(100,20,"Run EV: ".. EV)
- gui.text(160,20,"Run%: " .. fleepercent)
- else
- gui.text(100,20,"Run EV: ".. EV )
- gui.text(160,20,"Run%: " .. fleepercent)
- end
- function vuln (S)
- e1Ind = S
- vuln1 = memory.readbyte(0x08080EC8 + ((e1Ind - 8) * 0x54) + 0x48)
- vuln2 = memory.readbyte(0x08080EC8 + ((e1Ind - 8) * 0x54) + 0x49)
- vuln3 = memory.readbyte(0x08080EC8 + ((e1Ind - 8) * 0x54) + 0x4A)
- return vuln1, vuln2, vuln3
- end
- function enemy (S,Elm) -- Enemy Elemental Data Table
- elemInd = memory.readbyte(0x08080EC8 + ((S - 8) * 0x54) + 0x34)
- enemyelmlevel = memory.readbyte(0x08088E38 + (elemInd * 0x18) + 4+Elm)
- return enemyelmlevel
- end
- function bchance (E) -- base chance for status
- if E == 16 or E == 17 then
- c = 75
- elseif E == 23 then
- c = 40
- elseif E == 24 then
- c = 45
- elseif E == 27 then
- c = 20
- end
- return c
- end
- function effectproc (S,E,Elm,U) -- Random number, What effect is this, Elmemental Affinity 0 = Venus, 1 = Mercury, 2= Mars, 3 = Jupiter, Who is using this 0 = Isaac, 1 = Garet, 2 = Ivan, 3 = Mia
- uelm = memory.readbyte(0x0200061C+U*0x14C+Elm) -- Elemental Power of User
- eluc = memory.readbyte(0x020308BA) -- Enemy Luck
- eind = memory.readbyte(0x020309a0) -- Enemy Index
- eelm = enemy(eind,Elm) -- Enemy Elemental Levels
- vul1, vul2, vul3 = vuln(eind) -- Enemy Vulnerability
- if vul1 == E or vul2 == E or vul3 == E then -- Vulnerability key at top
- v=25
- else
- v=00
- end
- if memory.readbyte(0x080844EC + (U * 0xB4) + 0x92 + Elm) == 54 then
- elmaff = 5
- else
- elmaff = 0
- end
- proc = (((uelm + elmaff - eelm)-(math.floor(eluc/2)))*3+bchance(E)+v)
- g = RNB(S)*100
- g = bit.rshift(g,16)
- if proc >= g then
- return true
- else
- return false
- end
- end
- function unleash (S)
- g = S
- g = RNB(g)*100
- g = bit.rshift(g,16)
- if 35 >= g then
- return true
- else
- return false
- end
- end
- if memory.readbyte(0x0200010F) == 0x8A then -- Check quest progression, if past kraken only return A Blade information.
- BRN = memory.readdword(0x020023A8)
- bcount=0
- while effectproc(RNA(BRN),27,0,0) == false or unleash(BRN) == false do -- A Blade calculation
- bcount = bcount+1
- if bcount == 100 then break end
- BRN=RNA(BRN)
- end
- gui.text(160,40,"Ablade Kill: " .. bcount)
- end
- if memory.readbyte(0x02000168) >= 0x06 then -- Check quest progression, if Hammet freed then return Cyclone Slash information
- BRN = memory.readdword(0x020023A8)
- bcount=0
- while effectproc(RNA(BRN),16,2,3) == false or unleash(BRN) == false do -- Cyclone calculation
- bcount = bcount+1
- if bcount == 100 then break end
- BRN=RNA(BRN)
- end
- gui.text(160,50,"Cyclone Slash: " .. bcount)
- end
- if party == 15 and memory.readbyte(0x02000155) < 0x14 then -- Check question progression, if have Mia and before getting off boat then return WWand information
- BRN = memory.readdword(0x020023A8)
- bcount=0
- while effectproc(RNA(BRN),23,3,3) == false or unleash(BRN) == false do -- WWand calculation
- bcount = bcount+1
- if bcount == 100 then break end
- BRN=RNA(BRN)
- end
- gui.text(160,40,"WWand Stun: " .. bcount)
- end
- if memory.readbyte(0x0200050F) >= 9 and memory.readbyte(0x02000155) < 0x14 then -- Isaac level >= 9 and before getting off boat
- BRN = memory.readdword(0x020023A8)
- bcount=0
- while effectproc(BRN,16,3,0) == false do -- Weaken calculation
- bcount = bcount+1
- if bcount == 100 then break end
- BRN=RNA(BRN)
- end
- gui.text(160,60,"Weaken: " .. bcount)
- end
- if memory.readbyte(0x02000048)>=0x70 and memory.readbyte(0x02000155) < 0x14 then -- If you have mist, return mist information
- BRN = memory.readdword(0x020023A8)
- bcount=0
- while effectproc(RNA(BRN),24,1,3) == false do --or unleash(BRN) == false do -- mist calculation
- bcount = bcount+1
- if bcount == 100 then break end
- BRN=RNA(BRN)
- end
- gui.text(160,50,"Mist: " .. bcount)
- end
- end
- vba.frameadvance();
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement