mirror of
https://github.com/SashLilac/cambridge.git
synced 2025-05-13 20:21:25 -05:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c4ba80b60d | ||
|
|
2ba957f65a | ||
|
|
321de8564c | ||
|
|
96ac054cf6 | ||
|
|
b7fc51f4bd | ||
|
|
04ccd628be |
@@ -6,6 +6,7 @@ Coding conventions
|
||||
* The sole exception is in a multiline `if` statement; the initial `if` should have four spaces before it to align it with an `elseif` on the next line. For example:
|
||||
|
||||
```lua
|
||||
---- 4 spaces
|
||||
if self.level < 900 then return 12
|
||||
elseif self.level < 1200 then return 8
|
||||
else return 6 end
|
||||
@@ -15,8 +16,10 @@ Coding conventions
|
||||
|
||||
```lua
|
||||
if self.piece:isDropBlocked(self.grid) then
|
||||
-- for bottomed out pieces, decrease the drop bonus if they stall on dropping it
|
||||
self.drop_bonus = math.min(self.drop_bonus - 1, 0) -- by 1 point per frame
|
||||
-- this is a comment that appears in a block of its own, separate from any code
|
||||
-- consecutive multiline comments must have the same indentation level and
|
||||
-- not appear next on the same line as actual code
|
||||
self.drop_bonus = math.min(self.drop_bonus - 1, 0) -- comments at the end of a line must stay on that line
|
||||
else
|
||||
if piece_dy >= 1 then -- basically
|
||||
self.drop_bonus = self.drop_bonus + piece_dy * 20 -- this sort of
|
||||
@@ -27,6 +30,17 @@ Coding conventions
|
||||
|
||||
* Use `snake_case` for variables, `camelCase` for functions.
|
||||
|
||||
```lua
|
||||
function MyGameMode:on_activate_bleep_bloop()
|
||||
-- no, bad, use "onActivateBleepBloop"
|
||||
local bleepBloopFrames = 240
|
||||
-- this is also bad, use "bleep_bloop_frames"
|
||||
local bleep_bloop_bonus = self.lock_delay * 150
|
||||
self.bleepBloopSubscore = self.bleepBloopSubscore + bleep_bloop_bonus
|
||||
-- member variables are also variables, this should be "bleep_bloop_subscore"
|
||||
end
|
||||
```
|
||||
|
||||
|
||||
Contributor's License Agreement
|
||||
-------------------------------
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
The code in Cambridge is licensed under the MIT license.
|
||||
|
||||
Copyright (c) 2018-2019 Joe Zeng
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@@ -18,12 +16,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
-------------------------
|
||||
|
||||
Some code and assets in this repository are contributed by members of the
|
||||
community, as well as borrowed from other places, either with licensing
|
||||
or as placeholders until suitable material can be found that is properly
|
||||
licensed. Their original sources, and copyright notices if applicable, are
|
||||
listed in the file SOURCES.
|
||||
SOFTWARE.
|
||||
56
README.md
Normal file
56
README.md
Normal file
@@ -0,0 +1,56 @@
|
||||
Cambridge
|
||||
=========
|
||||
|
||||
Welcome to Cambridge, the next open-source falling-block game engine!
|
||||
|
||||
|
||||
Installation instructions
|
||||
-------------------------
|
||||
|
||||
Pre-built releases are available on the releases page.
|
||||
|
||||
### Windows
|
||||
|
||||
Unzip the exe file and run it directly. All assets are currently bundled inside the executable.
|
||||
|
||||
### macOS
|
||||
|
||||
For the time being, the file `cambridge.love` only works on the command line. Install `love` with [https://brew.sh/](Homebrew), and run:
|
||||
|
||||
$ love cambridge.love
|
||||
|
||||
### Linux
|
||||
|
||||
Same as macOS, except install `love` with your favourite package manager.
|
||||
|
||||
|
||||
Running from source
|
||||
-------------------
|
||||
|
||||
If you want the bleeding-edge release, you can also clone the code straight from this repository.
|
||||
|
||||
### macOS, Linux
|
||||
|
||||
If you haven't already, install `love` with your favourite package manager (Homebrew on macOS, your system's default on Linux). **Make sure you're using LÖVE 11, because it won't work with earlier versions!**
|
||||
|
||||
Clone the repository in git:
|
||||
|
||||
git clone https://github.com/joezeng/cambridge
|
||||
|
||||
Then, navigate to the root directory that you just cloned, and type:
|
||||
|
||||
love .
|
||||
|
||||
It should run automatically!
|
||||
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
The Cambridge project is licensed under the MIT license (included in LICENSE.md).
|
||||
|
||||
Some code and assets in this repository are contributed by members of the
|
||||
community, as well as borrowed from other places, either with licensing
|
||||
or as placeholders until suitable material can be found that is properly
|
||||
licensed. Their original sources, and copyright notices if applicable, are
|
||||
listed in the file SOURCES.
|
||||
@@ -22,9 +22,29 @@ SURVIVAL
|
||||
|
||||
Modes that concentrate on how long you can survive an increasingly fast and difficult game.
|
||||
|
||||
* **SURVIVAL 2020**: It only gets worse. Beware of bone blocks!
|
||||
* **SURVIVAL 2020**: It only gets worse from Marathon 2020. Beware of the total delay!
|
||||
|
||||
From other games:
|
||||
* **SURVIVAL A1**: 20G mode from Tetris the Grand Master.
|
||||
* **SURVIVAL A2**: T.A. Death.
|
||||
* **SURVIVAL A3**: Ti Shirase.
|
||||
|
||||
|
||||
PHANTOM MANIA
|
||||
-------------
|
||||
|
||||
Modes where pieces turn invisible as soon as you lock them. One of Cambridge's signature features.
|
||||
|
||||
* **Phantom Mania**: The classic invisible mode from Nullpomino. Can you handle 999 levels of "the M roll"?
|
||||
|
||||
* **Phantom Mania 2**: Phantom Mania but way faster! Can you face a mode where even the garbage and the next preview turn invisible?
|
||||
|
||||
|
||||
OTHER MODES
|
||||
-----------
|
||||
|
||||
* **Strategy**: How well can you plan ahead your movements? Can you handle only having a short time to place each piece?
|
||||
|
||||
* **TetrisGram™ Pacer Test**: is a multi-stage piece-placing ability test that progressively gets more difficult as it continues.
|
||||
|
||||
* **Interval Training**: 30 seconds per section. 20G. 15 frames of lock delay. How long can you last?
|
||||
@@ -1,207 +0,0 @@
|
||||
Marathon 2020
|
||||
=============
|
||||
|
||||
To celebrate the coming of the year 2020, I've created a new "extended Tetris the Grand Master" mode where the level counter goes up twice as far as normal, all the way up to 2020.
|
||||
|
||||
|
||||
Gameplay
|
||||
--------
|
||||
|
||||
The goal of this game is to reach the end at level 2020.
|
||||
|
||||
Every piece placed increases the level by 1, and every line cleared also increases the level by 1, with bonuses for large numbers of lines:
|
||||
|
||||
| Lines cleared | Levels advanced |
|
||||
|---------------|-----------------|
|
||||
| 1 | 1 |
|
||||
| 2 | 2 |
|
||||
| 3 | 4 |
|
||||
| 4 | 6 |
|
||||
|
||||
When the current level reaches one less than the level at the bottom of the display (usually a multiple of 100), the level will not advance until a line is cleared.
|
||||
|
||||
|
||||
Levels
|
||||
------
|
||||
|
||||
Each section is 100 levels long, except for the last section, whose levels go from 1900 all the way to 2020.
|
||||
|
||||
However, it is possible to be stopped early on if you do not play fast enough.
|
||||
|
||||
|
||||
### Torikans
|
||||
|
||||
There are certain checkpoints at which your current time will be checked and you will be stopped if your time is over a set objective time.
|
||||
|
||||
| Level | Time limit |
|
||||
|-------|------------|
|
||||
| 500 | 6:00.00 |
|
||||
| 900 | 8:30.00 |
|
||||
| 1000 | 8:45.00 |
|
||||
| 1500 | 11:30.00 |
|
||||
| 1900 | 13:15.00 |
|
||||
|
||||
At levels 500, 1000, and 1500, you will be stopped immediately if your time is not under the objective.
|
||||
|
||||
At levels 900 and 1900, the next section will be capped at 999 or 1999 respectively, and you will get a short credit roll when the section is over.
|
||||
|
||||
|
||||
Speed
|
||||
-----
|
||||
|
||||
Marathon 2020 gets faster in two different, independent ways, the gravity curve and the delay curve.
|
||||
|
||||
The gravity curve is always the same at a particular level, while the delay curve can vary based on your previous section time.
|
||||
|
||||
### Gravity Curve
|
||||
|
||||
The gravity curve is the same as it is in the original TGM and TAP.
|
||||
|
||||
### Delay Curve
|
||||
|
||||
The delay curve is shown as in the following table. Line ARE is always equal to ARE.
|
||||
|
||||
If your time in a particular section from 0 to 70 is smaller than the "cool" requirement at that level, your delay curve will be bumped up an extra level at the end of the section.
|
||||
|
||||
The delay curve always advances at least 1 level past level 500, and if you get a section cool when the level is past 500, it will advance 2 levels instead.
|
||||
|
||||
| Level | ARE | Lock | DAS | Line | Cool |
|
||||
|-------|------|------|------|------|------|
|
||||
|0|27|30|15|40|45.00|
|
||||
|100|24|30|12|25|41.50|
|
||||
|200|21|30|12|25|38.50|
|
||||
|300|18|30|9|20|35.00|
|
||||
|400|16|30|9|15|32.50|
|
||||
|500|14|30|8|12|29.20|
|
||||
|600|12|26|8|12|27.20|
|
||||
|700|10|22|8|8|24.80|
|
||||
|800|8|19|7|8|22.80|
|
||||
|900|6|17|7|6|20.60|
|
||||
|1000|6|15|6|6|19.60|
|
||||
|1100|6|15|6|4|19.40|
|
||||
|1200|6|15|6|4|19.40|
|
||||
|1300|5|15|5|4|18.40|
|
||||
|1400|5|15|5|2|18.20|
|
||||
|1500|4|15|4|2|16.20|
|
||||
|1600|4|13|4|2|16.20|
|
||||
|1700|4|11|4|2|16.20|
|
||||
|1800|4|10|4|2|16.20|
|
||||
|1900|4|9|4|2|16.20|
|
||||
|2000|4|8|3|2|15.20|
|
||||
|
||||
In order to get a section cool, your 0-70 section time must be below the cutoff *and* no more than 2 seconds slower than your previous 0-70 time.
|
||||
|
||||
|
||||
Grading
|
||||
-------
|
||||
|
||||
|
||||
|
||||
|
||||
### Basic grades
|
||||
|
||||
Internally, the grade counter is a number that can range from 0 to 30.
|
||||
|
||||
At the beginning of the game, it starts at 0. To increase it, you must bring an internal grade point counter past a certain threshold.
|
||||
|
||||
The threshold is set at 50 points for the first grade, then 100 more points for the next grade, then 150 points for the grade after that, and so on. You reach the maximum level of 30 at a total of 23,250 points.
|
||||
|
||||
A table of the thresholds in grade points required to reach each level is provided below:
|
||||
|
||||
Grade|Threshold
|
||||
-|-
|
||||
0|0
|
||||
1|50
|
||||
2|150
|
||||
3|300
|
||||
4|500
|
||||
5|750
|
||||
6|1050
|
||||
7|1400
|
||||
8|1800
|
||||
9|2250
|
||||
10|2750
|
||||
11|3300
|
||||
12|3900
|
||||
13|4550
|
||||
14|5250
|
||||
15|6000
|
||||
16|6800
|
||||
17|7650
|
||||
18|8550
|
||||
19|9500
|
||||
20|10500
|
||||
21|11550
|
||||
22|12650
|
||||
23|13800
|
||||
24|15000
|
||||
25|16250
|
||||
26|17550
|
||||
27|18900
|
||||
28|20300
|
||||
29|21750
|
||||
**30**|**23250**
|
||||
|
||||
Points are given according to a different scale, the point level. The point level is calculated by taking your current actual level, and adding (100 * the delay level) to it.
|
||||
|
||||
The points given for clearing certain amounts of lines is given as follows:
|
||||
|
||||
Level| x1 | x2 | x3 | x4
|
||||
-|-|-|-|-
|
||||
0|10|20|30|40
|
||||
100|10|20|30|40
|
||||
200|10|20|30|48
|
||||
300|10|20|30|60
|
||||
400|10|20|36|72
|
||||
500|10|21|42|84
|
||||
600|10|24|48|96
|
||||
700|10|27|54|108
|
||||
800|10|30|60|120
|
||||
900|11|33|66|140
|
||||
1000|12|36|72|160
|
||||
1100|13|39|81|180
|
||||
1200|14|42|90|200
|
||||
1300|15|45|99|220
|
||||
1400|16|48|108|240
|
||||
1500|17|52|117|260
|
||||
1600|18|56|126|280
|
||||
1700|19|60|135|300
|
||||
1800|20|64|144|320
|
||||
1900|21|68|153|340
|
||||
2000|22|72|162|360
|
||||
2100|23|76|171|380
|
||||
2200|24|80|180|400
|
||||
2300|25|84|189|420
|
||||
2400|26|88|198|440
|
||||
2500|27|92|207|460
|
||||
2600|28|96|216|480
|
||||
2700|29|100|225|500
|
||||
2800|30|104|234|520
|
||||
2900|31|108|243|540
|
||||
3000|32|112|252|560
|
||||
3100|33|116|261|580
|
||||
3200|34|120|270|600
|
||||
3300|35|124|279|620
|
||||
3400|36|128|288|640
|
||||
3500|37|132|297|660
|
||||
3600|38|136|306|680
|
||||
3700|39|140|315|700
|
||||
3800|40|144|324|720
|
||||
3900|41|148|333|740
|
||||
|
||||
Past level 1000, a 4-line clear will always give (30 * current grade), regardless of point level.
|
||||
|
||||
The remaining 20 grades come from section cools. Every section cool you get boosts your score by one grade. There are no regrets.
|
||||
|
||||
Points are also taken away with the time it takes to lock down a piece. The delay counter starts at 0, and increases by (current grade + 2) every frame. When the counter reaches or exceeds 240, it resets to 0, and 1 grade point is taken away.
|
||||
|
||||
Grades are based on the maximum grade points achieved. Once a grade has been attained, it cannot be lost even if grade points drop below the threshold for that grade.
|
||||
|
||||
|
||||
|
||||
Stats
|
||||
-----
|
||||
|
||||
* Fewest number of lines/pieces to reach 2020: 1263 pieces / 505 lines [all Tetrises]
|
||||
|
||||
* Most number of lines/pieces to reach 2020: 1448 pieces / 572 lines [all singles / doubles, full board]
|
||||
@@ -1,104 +0,0 @@
|
||||
Phantom Mania 2
|
||||
===============
|
||||
|
||||
The Phantom Mania mode in Nullpomino is based on T.A. Death (Speed Mania), but where everything is invisible. The obvious sequel to such a mode is Phantom Mania 2, which is based on Shirase (Speed Mania 2), but again where everything is invisible.
|
||||
|
||||
|
||||
|
||||
Gameplay
|
||||
--------
|
||||
|
||||
The goal of this game is to reach the end at level 1300, and then score as many grades as possible in the ending credit roll.
|
||||
|
||||
Each piece disappears as soon as it is placed down. Only the active piece is visible at any given time.
|
||||
|
||||
Every piece placed increases the level by 1, and every line cleared also increases the level by 1, with bonuses for large numbers of lines:
|
||||
|
||||
| Lines cleared | Levels advanced |
|
||||
|---------------|-----------------|
|
||||
| 1 | 1 |
|
||||
| 2 | 2 |
|
||||
| 3 | 4 |
|
||||
| 4 | 6 |
|
||||
|
||||
When the current level reaches one less than the level at the bottom of the display (usually a multiple of 100), the level will not advance until a line is cleared.
|
||||
|
||||
|
||||
Levels
|
||||
------
|
||||
|
||||
Each section is 100 levels long. At certain levels, the speed may get faster, or the difficulty may increase some other way.
|
||||
|
||||
| Level | What happens |
|
||||
|-------|------------|
|
||||
| 500 | Rows of garbage start to advance on the board. The bottom row is copied, appearing for a brief flash before disappearing again. |
|
||||
| 1000 | The garbage stops, but the hold queue turns invisible. |
|
||||
| 1100 | The first next preview turns invisible. |
|
||||
| 1200 | The second next preview turns invisible. |
|
||||
|
||||
Unlike in Shirase mode, the speed of the game does not get faster past level 1000.
|
||||
|
||||
### Torikans
|
||||
|
||||
There are certain checkpoints at which your current time will be checked and you will be stopped if your time is over a set objective time.
|
||||
|
||||
| Level | Time limit |
|
||||
|-------|------------|
|
||||
| 300 | 2:02.00 |
|
||||
| 500 | 3:03.00 |
|
||||
| 800 | 4:45.00 |
|
||||
| 1000 | 5:38.00 |
|
||||
|
||||
At each torikan, you will get a 54-second invisible roll which is worth grade points.
|
||||
|
||||
Only the 1300 roll is in Big Mode.
|
||||
|
||||
|
||||
Grading
|
||||
-------
|
||||
|
||||
Your grade starts at 1, and goes on from S1 to S9, and then M1 upwards indefinitely.
|
||||
|
||||
Your grade advances each section based on your section time. If you achieve a section COOL, you get 2 grade points. If you instead incur a section REGRET, you get no grade points. The normal section time (in between COOL and REGRET) is worth one grade point.
|
||||
|
||||
| Level | Section COOL | Section REGRET |
|
||||
|-------|--------------|----------------|
|
||||
| 0-4 | 36.00 | 48.00 |
|
||||
| 5-9 | 30.00 | 39.00 |
|
||||
| 10-12 | 27.00 | 35.00 |
|
||||
|
||||
|
||||
Then, the invisible roll is also worth grade points.
|
||||
|
||||
| Lines cleared | Grade points |
|
||||
|---------------|--------------|
|
||||
| 1 | 0.02 |
|
||||
| 2 | 0.06 |
|
||||
| 3 | 0.15 |
|
||||
| 4 | 0.40 |
|
||||
| Clear | 1.00 |
|
||||
|
||||
|
||||
The number of grade points you earn correspond to your grade as follows:
|
||||
|
||||
| Points | Grade |
|
||||
|--------|--------|
|
||||
| 0 | 1 |
|
||||
| 1 | S1 |
|
||||
| 2 | S2 |
|
||||
| 3 | S3 |
|
||||
| 4 | S4 |
|
||||
| 5 | S5 |
|
||||
| 6 | S6 |
|
||||
| 7 | S7 |
|
||||
| 8 | S8 |
|
||||
| 9 | S9 |
|
||||
| 10 | m1 |
|
||||
| 11 | m2 |
|
||||
| 12 | m3 |
|
||||
| 13 | m4 |
|
||||
| 14 | m5 |
|
||||
|
||||
And so on. For *x* > 9 grade points, your grade is m(*x*-9).
|
||||
|
||||
If you achieve a section COOL on each section, your rank will be m17 entering the credit roll.
|
||||
@@ -1,32 +0,0 @@
|
||||
Phantom Mania comparison
|
||||
========================
|
||||
|
||||
## Features
|
||||
|
||||
| | PM | PM2 |
|
||||
|------------|-----|------|
|
||||
| Max level | 999 | 1300 |
|
||||
| Piece preview | 1 | 3 |
|
||||
| Hold | No | Yes |
|
||||
| Graded roll | No | Yes |
|
||||
|
||||
## Torikans
|
||||
|
||||
| Level | PM | PM2 |
|
||||
|------------|-------|-------|
|
||||
| 300 | 2'28" | 2'02" |
|
||||
| 500 | 3'38" | 3'03" |
|
||||
| 800 | 5'23" | 4'40" |
|
||||
| 1000 | --- | 5'38" |
|
||||
|
||||
## Speed Curve
|
||||
|
||||
| Level | PM | PM2 |
|
||||
|------------|-------|-------|
|
||||
| 0 | 16/30 | 10/18 |
|
||||
| 100 | 12/26 | 10/18 |
|
||||
| 200 | 6/22 | 10/17 |
|
||||
| 300 | 6/18 | 4/15 |
|
||||
| 400 | 5/15 | 4/15 |
|
||||
| 500 | 4/15 | 4/13 |
|
||||
| 600+ | 4/15 | 4/12 |
|
||||
@@ -145,18 +145,18 @@ function GameMode:update(inputs, ruleset)
|
||||
|
||||
if self.piece.locked == true then
|
||||
self.grid:applyPiece(self.piece)
|
||||
self:onPieceLock(self.piece)
|
||||
self.piece = nil
|
||||
if self.enable_hold then
|
||||
self.held = false
|
||||
end
|
||||
|
||||
self.grid:markClearedRows()
|
||||
|
||||
local cleared_row_count = self.grid:getClearedRowCount()
|
||||
|
||||
self:onPieceLock(self.piece, cleared_row_count)
|
||||
self:updateScore(self.level, self.drop_bonus, cleared_row_count)
|
||||
|
||||
self.piece = nil
|
||||
if self.enable_hold then
|
||||
self.held = false
|
||||
end
|
||||
|
||||
if cleared_row_count > 0 then
|
||||
self.lcd = self:getLineClearDelay()
|
||||
self.are = self:getLineARE()
|
||||
@@ -191,7 +191,7 @@ end
|
||||
|
||||
-- event functions
|
||||
function GameMode:whilePieceActive() end
|
||||
function GameMode:onPieceLock(piece) end
|
||||
function GameMode:onPieceLock(piece, cleared_row_count) end
|
||||
function GameMode:onLineClear(cleared_row_count) end
|
||||
function GameMode:onPieceEnter() end
|
||||
function GameMode:onHold() end
|
||||
|
||||
@@ -164,7 +164,7 @@ function PacerTest:drawScoringInfo()
|
||||
end
|
||||
|
||||
function PacerTest:getBackground()
|
||||
return math.min(self.level - 1, 20)
|
||||
return math.min(self.level - 1, 19)
|
||||
end
|
||||
|
||||
return PacerTest
|
||||
|
||||
@@ -11,9 +11,6 @@ PhantomManiaGame.name = "Phantom Mania"
|
||||
PhantomManiaGame.hash = "PhantomMania"
|
||||
PhantomManiaGame.tagline = "The blocks disappear as soon as they're locked! Can you remember where everything is?"
|
||||
|
||||
|
||||
|
||||
|
||||
function PhantomManiaGame:new()
|
||||
PhantomManiaGame.super:new()
|
||||
|
||||
@@ -102,7 +99,7 @@ end
|
||||
function PhantomManiaGame:onLineClear(cleared_row_count)
|
||||
if not self.clear then
|
||||
local new_level = self.level + cleared_row_count
|
||||
if self:hitTorikan(self.level, new_level) then
|
||||
if new_level >= 999 or self:hitTorikan(self.level, new_level) then
|
||||
if new_level >= 999 then
|
||||
self.level = 999
|
||||
end
|
||||
|
||||
@@ -92,7 +92,7 @@ function PhantomMania2Game:hitTorikan(old_level, new_level)
|
||||
self.level = 500
|
||||
return true
|
||||
end
|
||||
if old_level < 800 and new_level >= 800 and self.frames > sp(4,40) then
|
||||
if old_level < 800 and new_level >= 800 and self.frames > sp(4,45) then
|
||||
self.level = 800
|
||||
return true
|
||||
end
|
||||
@@ -155,8 +155,8 @@ function PhantomMania2Game:onLineClear(cleared_row_count)
|
||||
end
|
||||
end
|
||||
|
||||
function PhantomMania2Game:onPieceLock()
|
||||
self:advanceBottomRow(1)
|
||||
function PhantomMania2Game:onPieceLock(piece, cleared_row_count)
|
||||
if cleared_row_count == 0 then self:advanceBottomRow(1) end
|
||||
end
|
||||
|
||||
function PhantomMania2Game:onHold()
|
||||
|
||||
@@ -1,200 +1,16 @@
|
||||
require 'funcs'
|
||||
local PhantomManiaGame = require 'tetris.modes.phantom_mania'
|
||||
|
||||
local GameMode = require 'tetris.modes.gamemode'
|
||||
local Piece = require 'tetris.components.piece'
|
||||
local PhantomManiaNGame = PhantomManiaGame:extend()
|
||||
|
||||
local History6RollsRandomizer = require 'tetris.randomizers.history_6rolls'
|
||||
PhantomManiaNGame.name = "Phantom Mania N"
|
||||
PhantomManiaNGame.hash = "PhantomManiaN"
|
||||
PhantomManiaNGame.tagline = "The old mode from Nullpomino, for Ti-ARS and SRS support."
|
||||
|
||||
local PhantomManiaGame = GameMode:extend()
|
||||
function PhantomManiaNGame:new()
|
||||
PhantomManiaNGame.super:new()
|
||||
|
||||
PhantomManiaGame.name = "Phantom Mania N"
|
||||
PhantomManiaGame.hash = "PhantomManiaN"
|
||||
PhantomManiaGame.tagline = "The old mode from Nullpomino."
|
||||
|
||||
|
||||
|
||||
|
||||
function PhantomManiaGame:new()
|
||||
PhantomManiaGame.super:new()
|
||||
|
||||
self.lock_drop = true
|
||||
self.next_queue_length = 3
|
||||
self.enable_hold = true
|
||||
|
||||
self.roll_frames = 0
|
||||
self.combo = 1
|
||||
self.randomizer = History6RollsRandomizer()
|
||||
end
|
||||
|
||||
function PhantomManiaGame:getARE()
|
||||
if self.level < 100 then return 18
|
||||
elseif self.level < 200 then return 14
|
||||
elseif self.level < 400 then return 8
|
||||
elseif self.level < 500 then return 7
|
||||
else return 6 end
|
||||
end
|
||||
|
||||
function PhantomManiaGame:getLineARE()
|
||||
if self.level < 100 then return 18
|
||||
elseif self.level < 400 then return 8
|
||||
elseif self.level < 500 then return 7
|
||||
else return 6 end
|
||||
end
|
||||
|
||||
function PhantomManiaGame:getDasLimit()
|
||||
if self.level < 200 then return 11
|
||||
elseif self.level < 300 then return 10
|
||||
elseif self.level < 400 then return 9
|
||||
else return 7 end
|
||||
end
|
||||
|
||||
function PhantomManiaGame:getLineClearDelay()
|
||||
return self:getLineARE()
|
||||
end
|
||||
|
||||
function PhantomManiaGame:getLockDelay()
|
||||
if self.level < 100 then return 30
|
||||
elseif self.level < 200 then return 26
|
||||
elseif self.level < 300 then return 22
|
||||
elseif self.level < 400 then return 18
|
||||
else return 15 end
|
||||
end
|
||||
|
||||
function PhantomManiaGame:getGravity()
|
||||
return 20
|
||||
end
|
||||
|
||||
function PhantomManiaGame:hitTorikan(old_level, new_level)
|
||||
if old_level < 300 and new_level >= 300 and self.frames > sp(2,28) then
|
||||
self.level = 300
|
||||
return true
|
||||
end
|
||||
if old_level < 500 and new_level >= 500 and self.frames > sp(3,38) then
|
||||
self.level = 500
|
||||
return true
|
||||
end
|
||||
if old_level < 800 and new_level >= 800 and self.frames > sp(5,23) then
|
||||
self.level = 800
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function PhantomManiaGame:advanceOneFrame()
|
||||
if self.clear then
|
||||
self.roll_frames = self.roll_frames + 1
|
||||
if self.roll_frames < 0 then
|
||||
return false
|
||||
elseif self.roll_frames > 1982 then
|
||||
self.completed = true
|
||||
end
|
||||
elseif self.ready_frames == 0 then
|
||||
self.frames = self.frames + 1
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function PhantomManiaGame:onPieceEnter()
|
||||
if (self.level % 100 ~= 99 and self.level ~= 998) and not self.clear and self.frames ~= 0 then
|
||||
self.level = self.level + 1
|
||||
end
|
||||
end
|
||||
|
||||
function PhantomManiaGame:onLineClear(cleared_row_count)
|
||||
if not self.clear then
|
||||
local new_level = self.level + cleared_row_count
|
||||
if self:hitTorikan(self.level, new_level) then
|
||||
if new_level >= 999 then
|
||||
self.level = 999
|
||||
end
|
||||
self.clear = true
|
||||
else
|
||||
self.level = new_level
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function PhantomManiaGame:updateScore(level, drop_bonus, cleared_lines)
|
||||
if cleared_lines > 0 then
|
||||
self.score = self.score + (
|
||||
(math.ceil((level + cleared_lines) / 4) + drop_bonus) *
|
||||
cleared_lines * (cleared_lines * 2 - 1) * (self.combo * 2 - 1)
|
||||
)
|
||||
self.lines = self.lines + cleared_lines
|
||||
self.combo = self.combo + cleared_lines - 1
|
||||
else
|
||||
self.drop_bonus = 0
|
||||
self.combo = 1
|
||||
end
|
||||
end
|
||||
|
||||
PhantomManiaGame.rollOpacityFunction = function(age)
|
||||
if age > 4 then return 0
|
||||
else return 1 - age / 4 end
|
||||
end
|
||||
|
||||
function PhantomManiaGame:drawGrid()
|
||||
if not (self.game_over or self.clear) then
|
||||
self.grid:drawInvisible(self.rollOpacityFunction)
|
||||
else
|
||||
self.grid:draw()
|
||||
end
|
||||
end
|
||||
|
||||
local function getLetterGrade(level, clear)
|
||||
if level < 300 or level == 300 and clear then
|
||||
return ""
|
||||
elseif level < 500 or level == 500 and clear then
|
||||
return "M"
|
||||
elseif level < 700 then
|
||||
return "MK"
|
||||
elseif level < 800 or level == 800 and clear then
|
||||
return "MV"
|
||||
elseif level < 900 then
|
||||
return "MO"
|
||||
elseif level < 999 then
|
||||
return "MM"
|
||||
elseif level == 999 then
|
||||
return "GM"
|
||||
end
|
||||
end
|
||||
|
||||
function PhantomManiaGame:drawScoringInfo()
|
||||
PhantomManiaGame.super.drawScoringInfo(self)
|
||||
|
||||
local text_x = config["side_next"] and 320 or 240
|
||||
|
||||
love.graphics.setFont(font_3x5_2)
|
||||
love.graphics.printf("GRADE", text_x, 120, 40, "left")
|
||||
love.graphics.printf("SCORE", text_x, 200, 40, "left")
|
||||
love.graphics.printf("LEVEL", text_x, 320, 40, "left")
|
||||
|
||||
love.graphics.setFont(font_3x5_3)
|
||||
love.graphics.printf(getLetterGrade(self.level, self.clear), text_x, 140, 90, "left")
|
||||
love.graphics.printf(self.score, text_x, 220, 90, "left")
|
||||
love.graphics.printf(self.level, text_x, 340, 40, "right")
|
||||
if self.clear then
|
||||
love.graphics.printf(self.level, text_x, 370, 40, "right")
|
||||
else
|
||||
love.graphics.printf(self:getSectionEndLevel(), text_x, 370, 40, "right")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function PhantomManiaGame:getSectionEndLevel()
|
||||
if self.level >= 900 then return 999
|
||||
else return math.floor(self.level / 100 + 1) * 100 end
|
||||
end
|
||||
|
||||
function PhantomManiaGame:getBackground()
|
||||
return math.floor(self.level / 100)
|
||||
end
|
||||
|
||||
function PhantomManiaGame:getHighscoreData()
|
||||
return {
|
||||
level = self.level,
|
||||
frames = self.frames,
|
||||
}
|
||||
end
|
||||
|
||||
return PhantomManiaGame
|
||||
return PhantomManiaNGame
|
||||
|
||||
@@ -141,8 +141,8 @@ function SurvivalA3Game:onLineClear(cleared_row_count)
|
||||
end
|
||||
end
|
||||
|
||||
function SurvivalA3Game:onPieceLock()
|
||||
self:advanceBottomRow(1)
|
||||
function SurvivalA3Game:onPieceLock(piece, cleared_row_count)
|
||||
if cleared_row_count == 0 then self:advanceBottomRow(1) end
|
||||
end
|
||||
|
||||
function SurvivalA3Game:updateScore(level, drop_bonus, cleared_lines)
|
||||
|
||||
18
tetris/randomizers/always.lua
Normal file
18
tetris/randomizers/always.lua
Normal file
@@ -0,0 +1,18 @@
|
||||
local Randomizer = require 'tetris.randomizers.randomizer'
|
||||
|
||||
local AlwaysRandomizer = Randomizer:extend()
|
||||
|
||||
function AlwaysRandomizer:new(piece)
|
||||
self.piece = piece
|
||||
self:initialize()
|
||||
self.next_queue = {}
|
||||
for i = 1, 30 do
|
||||
table.insert(self.next_queue, self:generatePiece())
|
||||
end
|
||||
end
|
||||
|
||||
function AlwaysRandomizer:generatePiece()
|
||||
return self.piece
|
||||
end
|
||||
|
||||
return AlwaysRandomizer
|
||||
@@ -1,9 +0,0 @@
|
||||
local Randomizer = require 'tetris.randomizers.randomizer'
|
||||
|
||||
local AlwaysORandomizer = Randomizer:extend()
|
||||
|
||||
function AlwaysORandomizer:generatePiece()
|
||||
return "O"
|
||||
end
|
||||
|
||||
return AlwaysORandomizer
|
||||
Reference in New Issue
Block a user