mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-09 22:24:58 +00:00
Tidied up semicolon use, refactored random dungeon generation code, fixed visual bug in Day Care debug screen
This commit is contained in:
@@ -67,11 +67,16 @@ class TriadCard
|
||||
ret *= (@north + @east + @south + @west)
|
||||
ret /= 10 # Ranges from 2 to 24,000
|
||||
# Quantize prices to the next highest "unit"
|
||||
if ret > 10000; ret = (1 + ret / 1000) * 1000
|
||||
elsif ret > 5000; ret = (1 + ret / 500) * 500
|
||||
elsif ret > 1000; ret = (1 + ret / 100) * 100
|
||||
elsif ret > 500; ret = (1 + ret / 50) * 50
|
||||
else; ret = (1 + ret / 10) * 10
|
||||
if ret > 10000
|
||||
ret = (1 + ret / 1000) * 1000
|
||||
elsif ret > 5000
|
||||
ret = (1 + ret / 500) * 500
|
||||
elsif ret > 1000
|
||||
ret = (1 + ret / 100) * 100
|
||||
elsif ret > 500
|
||||
ret = (1 + ret / 50) * 50
|
||||
else
|
||||
ret = (1 + ret / 10) * 10
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
@@ -42,11 +42,16 @@ class MiningGameTile < BitmapSprite
|
||||
@viewport.z=99999
|
||||
super(32,32,@viewport)
|
||||
r = rand(100)
|
||||
if r<10; @layer = 2 # 10%
|
||||
elsif r<25; @layer = 3 # 15%
|
||||
elsif r<60; @layer = 4 # 35%
|
||||
elsif r<85; @layer = 5 # 25%
|
||||
else; @layer = 6 # 15%
|
||||
if r < 10
|
||||
@layer = 2 # 10%
|
||||
elsif r < 25
|
||||
@layer = 3 # 15%
|
||||
elsif r < 60
|
||||
@layer = 4 # 35%
|
||||
elsif r < 85
|
||||
@layer = 5 # 25%
|
||||
else
|
||||
@layer = 6 # 15%
|
||||
end
|
||||
@image=AnimatedBitmap.new(_INTL("Graphics/Pictures/Mining/tiles"))
|
||||
update
|
||||
@@ -104,10 +109,12 @@ class MiningGameCursor < BitmapSprite
|
||||
y = 32*(@position/MiningGameScene::BOARDWIDTH)
|
||||
if @counter>0
|
||||
@counter -= 1
|
||||
toolx = x; tooly = y
|
||||
toolx = x
|
||||
tooly = y
|
||||
i = 10-(@counter/2).floor
|
||||
if ToolPositions[i][1]==1
|
||||
toolx -= 8; tooly += 8
|
||||
toolx -= 8
|
||||
tooly += 8
|
||||
elsif ToolPositions[i][1]==2
|
||||
toolx += 6
|
||||
end
|
||||
|
||||
@@ -153,7 +153,9 @@ class TilePuzzleScene
|
||||
addBackgroundPlane(@sprites,"bg","Tile Puzzle/bg",@viewport)
|
||||
end
|
||||
@tilebitmap=AnimatedBitmap.new("Graphics/Pictures/Tile Puzzle/tiles#{@board}")
|
||||
@tilebitmap1=nil; @tilebitmap2=nil; @tilebitmap3=nil
|
||||
@tilebitmap1=nil
|
||||
@tilebitmap2=nil
|
||||
@tilebitmap3=nil
|
||||
if pbResolveBitmap("Graphics/Pictures/Tile Puzzle/tiles#{@board}_1")
|
||||
@tilebitmap1=AnimatedBitmap.new("Graphics/Pictures/Tile Puzzle/tiles#{@board}_1")
|
||||
end
|
||||
@@ -184,7 +186,10 @@ class TilePuzzleScene
|
||||
|
||||
def pbShuffleTiles
|
||||
ret=[]
|
||||
for i in 0...@boardwidth*@boardheight; ret.push(i); @angles.push(0); end
|
||||
for i in 0...@boardwidth*@boardheight
|
||||
ret.push(i)
|
||||
@angles.push(0)
|
||||
end
|
||||
if @game==6
|
||||
@tiles=ret
|
||||
5.times do
|
||||
@@ -199,7 +204,8 @@ class TilePuzzleScene
|
||||
else
|
||||
ret.shuffle!
|
||||
if @game==3 # Make sure only solvable Mystic Squares are allowed.
|
||||
num=0; blank=-1
|
||||
num=0
|
||||
blank=-1
|
||||
for i in 0...ret.length-1
|
||||
blank=i if ret[i]==@boardwidth*@boardheight-1
|
||||
for j in i...ret.length
|
||||
@@ -216,11 +222,15 @@ class TilePuzzleScene
|
||||
end
|
||||
if @game==1 || @game==2
|
||||
ret2=[]
|
||||
for i in 0...@boardwidth*@boardheight; ret2.push(-1); end
|
||||
for i in 0...@boardwidth*@boardheight
|
||||
ret2.push(-1)
|
||||
end
|
||||
ret=ret2+ret
|
||||
end
|
||||
if @game==2 || @game==5
|
||||
for i in 0...@angles.length; @angles[i]=rand(4); end
|
||||
for i in 0...@angles.length
|
||||
@angles[i]=rand(4)
|
||||
end
|
||||
end
|
||||
end
|
||||
return ret
|
||||
@@ -399,7 +409,8 @@ class TilePuzzleScene
|
||||
|
||||
def pbShiftLine(dir,cursor,anim=true)
|
||||
# Get tiles involved
|
||||
tiles=[]; dist=0
|
||||
tiles=[]
|
||||
dist=0
|
||||
if dir==2 || dir==8
|
||||
dist=(dir/4).floor-1
|
||||
while (dist>0 && cursor<(@boardwidth-1)*@boardheight) ||
|
||||
@@ -453,7 +464,9 @@ class TilePuzzleScene
|
||||
end
|
||||
end
|
||||
temp=[]
|
||||
for i in tiles; temp.push(@tiles[i]); end
|
||||
for i in tiles
|
||||
temp.push(@tiles[i])
|
||||
end
|
||||
for i in 0...temp.length
|
||||
@tiles[tiles[(i+1)%(temp.length)]]=temp[i]
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user