Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

极简回溯mod #152

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion conf.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ VERSION={
build=344,
code=1506,
short="V0.15.6",
string="Alpha V0.15.6",
string="Alpha Fork V0.15.6",
room="V1.0",
name="强化装甲 Reinforced Armor",
}
Expand Down
6 changes: 6 additions & 0 deletions parts/globalTables.lua
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,12 @@ MODOPT={--Mod options
func=function(P,O)P.gameEnv.bone=O=='on'end,
unranked=true,
},
{no=22,id="FR",name="finesseRewind",
key=",",x=1040,y=470,color='Y',
list={'easy','strict'},
func=function(P,O)P.gameEnv.fineRewind=O end,
unranked=true,
},
}
for i=1,#MODOPT do
local M=MODOPT[i]
Expand Down
2 changes: 2 additions & 0 deletions parts/language/lang_en.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ return{
pauseCount="Pauses",
finesse_ap="All Perfect",
finesse_fc="Full Combo",
rewind="Finesse Rewind",

page="Page:",

Expand Down Expand Up @@ -133,6 +134,7 @@ return{
customSeq="Randomizer\nOverrides the randomizer for the block sequence.",
pushSpeed="Garbage Speed\nOverride the rising speed of garbage lines (blocks/frame).",
boneBlock="[ ]\nPlay with [ ] blocks.",
finesseRewind="Finesse Rewind\nFinesse fault resets time.\n(This mod is unstable in multiplayer/AI combat/backfire mode.)"
},
pauseStat={
"Time:",
Expand Down
2 changes: 2 additions & 0 deletions parts/language/lang_zh.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ return{
pauseCount="暂停统计",
finesse_ap="All Perfect",
finesse_fc="Full Combo",
rewind="极简回溯",

page="页面:",

Expand Down Expand Up @@ -133,6 +134,7 @@ return{
customSeq="指定序列:\n强制使用某种序列",
pushSpeed="涨行速度:\n改变垃圾行升起的速度(单位:格/帧)",
boneBlock="骨块:\n使用骨块进行游戏",
finesseRewind="极简回溯:\n非极简操作将会回溯到出块时刻\n(多人/AI/自攻自受模式中不稳定)"
},
pauseStat={
"时间:",
Expand Down
53 changes: 53 additions & 0 deletions parts/player/player.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,45 @@ local PLAYERS,PLY_ALIVE,GAME=PLAYERS,PLY_ALIVE,GAME
local kickList=require"parts.kickList"
local ply_draw=require"parts.player.draw"
local ply_update=require"parts.player.update"
--------------------<Utility>-----------------------
-- from my crude observations, these stuff in the blacklist shouldn't be touched upon.
local blacklist = {
freeze = true,
keyPressing = true,
lastRecv = true,
atker = true,
atking = true
}

function DeepCopy (orig, i)
i = i or 0
if i > 20 then return end -- safety belt
local orig_type = type(orig)
local copy
if orig_type == 'table' then
copy = {}
for orig_key, orig_value in next, orig, nil do
if not blacklist[orig_key] then
if orig_key == 'moving' or orig_key == 'downing' then
copy[orig_key] = 0
end
copy[DeepCopy(orig_key, i+1)] = DeepCopy(orig_value, i+1)
end
end
setmetatable(copy, DeepCopy(getmetatable(orig)))
else
copy = orig
end
return copy
end

function Assign (orig, dest)
for orig_key, orig_value in next, orig, nil do
dest[orig_key] = orig_value
end
setmetatable(dest, getmetatable(orig))
end
-----------------------</Utility>-----------------------

--------------------------<FX>--------------------------
function Player:showText(text,dx,dy,font,style,spd,stop)
Expand Down Expand Up @@ -809,6 +848,9 @@ function Player:popNext(ifhold)--Pop nextQueue to hand
else
self:hold()
end
if self.gameEnv.fineRewind then
self.freeze = DeepCopy(self)
end
end

function Player:cancel(N)--Cancel Garbage
Expand Down Expand Up @@ -1144,12 +1186,23 @@ do--Player.drop(self)--Place piece
SFX.play('lock',nil,self:getCenterX()*.15)
end
end
-- Zawarudo
if ENV.fineRewind=='strict' and self.freeze then
Assign(DeepCopy(self.freeze), self)
self:showText(text.rewind, 0, 0, 35, "appear", 0.6)
return
end
elseif self.sound then
SFX.play('lock',nil,self:getCenterX()*.15)
end

if finePts<=1 then
self.finesseCombo=0
if ENV.fineRewind=='easy' and self.freeze then
Assign(DeepCopy(self.freeze), self)
self:showText(text.rewind, 0, 0, 35, "appear", 0.6)
return
end
else
self.finesseCombo=self.finesseCombo+1
if self.finesseCombo>2 then
Expand Down