free skill option

This commit is contained in:
Detoria 2021-05-06 17:16:28 -03:00 committed by GitHub
parent 42e916df6d
commit b2929d9ab8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 195 additions and 121 deletions

View File

@ -20,7 +20,8 @@ class Highscore
NGio.postScore(score, song); NGio.postScore(score, song);
#end #end
if(!FlxG.save.data.botplay)
{
if (songScores.exists(daSong)) if (songScores.exists(daSong))
{ {
if (songScores.get(daSong) < score) if (songScores.get(daSong) < score)
@ -28,6 +29,7 @@ class Highscore
} }
else else
setScore(daSong, score); setScore(daSong, score);
}else trace('BotPlay detected. Score saving is disabled.');
} }
public static function saveWeekScore(week:Int = 1, score:Int = 0, ?diff:Int = 0):Void public static function saveWeekScore(week:Int = 1, score:Int = 0, ?diff:Int = 0):Void
@ -37,7 +39,8 @@ class Highscore
NGio.postScore(score, "Week " + week); NGio.postScore(score, "Week " + week);
#end #end
if(!FlxG.save.data.botplay)
{
var daWeek:String = formatSong('week' + week, diff); var daWeek:String = formatSong('week' + week, diff);
if (songScores.exists(daWeek)) if (songScores.exists(daWeek))
@ -47,6 +50,7 @@ class Highscore
} }
else else
setScore(daWeek, score); setScore(daWeek, score);
}else trace('BotPlay detected. Score saving is disabled.');
} }
/** /**

View File

@ -66,6 +66,9 @@ class KadeEngineData
if (FlxG.save.data.flashing == null) if (FlxG.save.data.flashing == null)
FlxG.save.data.flashing = true; FlxG.save.data.flashing = true;
if (FlxG.save.data.botplay == null)
FlxG.save.data.botplay = false;
Conductor.recalculateTimings(); Conductor.recalculateTimings();
Main.watermarks = FlxG.save.data.watermark; Main.watermarks = FlxG.save.data.watermark;

View File

@ -553,6 +553,22 @@ class OffsetMenu extends Option
return "Time your offset"; return "Time your offset";
} }
} }
class BotPlay extends Option
{
public function new(desc:String)
{
super();
description = desc;
}
public override function press():Bool
{
FlxG.save.data.botplay = !FlxG.save.data.botplay;
trace('BotPlay : ' + FlxG.save.data.botplay);
display = updateDisplay();
return true;
}
private override function updateDisplay():String
return "BotPlay " + (FlxG.save.data.botplay ? "on" : "off");
}

View File

@ -58,8 +58,8 @@ class OptionsMenu extends MusicBeatState
new FPSOption("Toggle the FPS Counter"), new FPSOption("Toggle the FPS Counter"),
new ReplayOption("View replays"), new ReplayOption("View replays"),
#end #end
new WatermarkOption("Turn off all watermarks from the engine.") new WatermarkOption("Turn off all watermarks from the engine."),
new BotPlay("Showcase your charts and mods with autoplay.")
]) ])
]; ];
@ -239,7 +239,7 @@ class OptionsMenu extends MusicBeatState
if (isCat) if (isCat)
currentDescription = currentSelectedCat.getOptions()[curSelected].getDescription(); currentDescription = currentSelectedCat.getOptions()[curSelected].getDescription();
else else
currentDescription = "Please select a catagory"; currentDescription = "Please select a category";
versionShit.text = "Offset (Left, Right, Shift for slow): " + HelperFunctions.truncateFloat(FlxG.save.data.offset,2) + " - Description - " + currentDescription; versionShit.text = "Offset (Left, Right, Shift for slow): " + HelperFunctions.truncateFloat(FlxG.save.data.offset,2) + " - Description - " + currentDescription;
// selector.y = (70 * curSelected) + 30; // selector.y = (70 * curSelected) + 30;

View File

@ -201,6 +201,8 @@ class PlayState extends MusicBeatState
private var allowedToHeadbang:Bool = false; private var allowedToHeadbang:Bool = false;
// Per song additive offset // Per song additive offset
public static var songOffset:Float = 0; public static var songOffset:Float = 0;
// BotPlay text
private var botPlayState:FlxText;
private var executeModchart = false; private var executeModchart = false;
@ -299,7 +301,7 @@ class PlayState extends MusicBeatState
Conductor.mapBPMChanges(SONG); Conductor.mapBPMChanges(SONG);
Conductor.changeBPM(SONG.bpm); Conductor.changeBPM(SONG.bpm);
trace('INFORMATION ABOUT WHAT U PLAYIN WIT:\nFRAMES: ' + Conductor.safeFrames + '\nZONE: ' + Conductor.safeZoneOffset + '\nTS: ' + Conductor.timeScale); trace('INFORMATION ABOUT WHAT U PLAYIN WIT:\nFRAMES: ' + Conductor.safeFrames + '\nZONE: ' + Conductor.safeZoneOffset + '\nTS: ' + Conductor.timeScale + '\nBotPlay : ' + FlxG.save.data.botplay);
switch (SONG.song.toLowerCase()) switch (SONG.song.toLowerCase())
{ {
@ -921,6 +923,7 @@ class PlayState extends MusicBeatState
scoreTxt.scrollFactor.set(); scoreTxt.scrollFactor.set();
if (offsetTesting) if (offsetTesting)
scoreTxt.x += 300; scoreTxt.x += 300;
if(FlxG.save.data.botplay) scoreTxt.x = FlxG.width / 2 - 20;
add(scoreTxt); add(scoreTxt);
replayTxt = new FlxText(healthBarBG.x + healthBarBG.width / 2 - 75, healthBarBG.y + (FlxG.save.data.downscroll ? 100 : -100), 0, "REPLAY", 20); replayTxt = new FlxText(healthBarBG.x + healthBarBG.width / 2 - 75, healthBarBG.y + (FlxG.save.data.downscroll ? 100 : -100), 0, "REPLAY", 20);
@ -930,6 +933,12 @@ class PlayState extends MusicBeatState
{ {
add(replayTxt); add(replayTxt);
} }
// Literally copy-paste of the above, fu
botPlayState = new FlxText(healthBarBG.x + healthBarBG.width / 2 - 75, healthBarBG.y + (FlxG.save.data.downscroll ? 100 : -100), 0, "BOTPLAY", 20);
botPlayState.setFormat(Paths.font("vcr.ttf"), 42, FlxColor.WHITE, RIGHT, FlxTextBorderStyle.OUTLINE,FlxColor.BLACK);
botPlayState.scrollFactor.set();
if(FlxG.save.data.botplay) add(botPlayState);
iconP1 = new HealthIcon(SONG.player1, true); iconP1 = new HealthIcon(SONG.player1, true);
iconP1.y = healthBar.y - (iconP1.height / 2); iconP1.y = healthBar.y - (iconP1.height / 2);
@ -2141,6 +2150,9 @@ class PlayState extends MusicBeatState
else else
daNote.y += daNote.height / 2; daNote.y += daNote.height / 2;
// If not in botplay, only clip sustain notes when properly hit, botplay gets to clip it everytime
if(!FlxG.save.data.botplay)
{
if((!daNote.mustPress || daNote.wasGoodHit || daNote.prevNote.wasGoodHit && !daNote.canBeHit) && daNote.y - daNote.offset.y * daNote.scale.y + daNote.height >= (strumLine.y + Note.swagWidth / 2)) if((!daNote.mustPress || daNote.wasGoodHit || daNote.prevNote.wasGoodHit && !daNote.canBeHit) && daNote.y - daNote.offset.y * daNote.scale.y + daNote.height >= (strumLine.y + Note.swagWidth / 2))
{ {
// Clip to strumline // Clip to strumline
@ -2148,6 +2160,13 @@ class PlayState extends MusicBeatState
swagRect.height = (strumLineNotes.members[Math.floor(Math.abs(daNote.noteData))].y + Note.swagWidth / 2 - daNote.y) / daNote.scale.y; swagRect.height = (strumLineNotes.members[Math.floor(Math.abs(daNote.noteData))].y + Note.swagWidth / 2 - daNote.y) / daNote.scale.y;
swagRect.y = daNote.frameHeight - swagRect.height; swagRect.y = daNote.frameHeight - swagRect.height;
daNote.clipRect = swagRect;
}
}else {
var swagRect = new FlxRect(0, 0, daNote.frameWidth * 2, daNote.frameHeight * 2);
swagRect.height = (strumLineNotes.members[Math.floor(Math.abs(daNote.noteData))].y + Note.swagWidth / 2 - daNote.y) / daNote.scale.y;
swagRect.y = daNote.frameHeight - swagRect.height;
daNote.clipRect = swagRect; daNote.clipRect = swagRect;
} }
} }
@ -2161,6 +2180,8 @@ class PlayState extends MusicBeatState
{ {
daNote.y -= daNote.height / 2; daNote.y -= daNote.height / 2;
if(!FlxG.save.data.botplay)
{
if((!daNote.mustPress || daNote.wasGoodHit || daNote.prevNote.wasGoodHit && !daNote.canBeHit) && daNote.y + daNote.offset.y * daNote.scale.y <= (strumLine.y + Note.swagWidth / 2)) if((!daNote.mustPress || daNote.wasGoodHit || daNote.prevNote.wasGoodHit && !daNote.canBeHit) && daNote.y + daNote.offset.y * daNote.scale.y <= (strumLine.y + Note.swagWidth / 2))
{ {
// Clip to strumline // Clip to strumline
@ -2168,6 +2189,13 @@ class PlayState extends MusicBeatState
swagRect.y = (strumLineNotes.members[Math.floor(Math.abs(daNote.noteData))].y + Note.swagWidth / 2 - daNote.y) / daNote.scale.y; swagRect.y = (strumLineNotes.members[Math.floor(Math.abs(daNote.noteData))].y + Note.swagWidth / 2 - daNote.y) / daNote.scale.y;
swagRect.height -= swagRect.y; swagRect.height -= swagRect.y;
daNote.clipRect = swagRect;
}
}else {
var swagRect = new FlxRect(0, 0, daNote.width / daNote.scale.x, daNote.height / daNote.scale.y);
swagRect.y = (strumLineNotes.members[Math.floor(Math.abs(daNote.noteData))].y + Note.swagWidth / 2 - daNote.y) / daNote.scale.y;
swagRect.height -= swagRect.y;
daNote.clipRect = swagRect; daNote.clipRect = swagRect;
} }
} }
@ -2498,8 +2526,8 @@ class PlayState extends MusicBeatState
rating.velocity.y -= FlxG.random.int(140, 175); rating.velocity.y -= FlxG.random.int(140, 175);
rating.velocity.x -= FlxG.random.int(0, 10); rating.velocity.x -= FlxG.random.int(0, 10);
var msTiming = HelperFunctions.truncateFloat(noteDiff, 3); var msTiming = HelperFunctions.truncateFloat(noteDiff, 3);
if(FlxG.save.data.botplay) msTiming = 0;
if (currentTimingShown != null) if (currentTimingShown != null)
remove(currentTimingShown); remove(currentTimingShown);
@ -2545,9 +2573,7 @@ class PlayState extends MusicBeatState
if (currentTimingShown.alpha != 1) if (currentTimingShown.alpha != 1)
currentTimingShown.alpha = 1; currentTimingShown.alpha = 1;
add(currentTimingShown); if(!FlxG.save.data.botplay) add(currentTimingShown);
var comboSpr:FlxSprite = new FlxSprite().loadGraphic(Paths.image(pixelShitPart1 + 'combo' + pixelShitPart2)); var comboSpr:FlxSprite = new FlxSprite().loadGraphic(Paths.image(pixelShitPart1 + 'combo' + pixelShitPart2));
comboSpr.screenCenter(); comboSpr.screenCenter();
@ -2564,7 +2590,7 @@ class PlayState extends MusicBeatState
comboSpr.velocity.x += FlxG.random.int(1, 10); comboSpr.velocity.x += FlxG.random.int(1, 10);
currentTimingShown.velocity.x += comboSpr.velocity.x; currentTimingShown.velocity.x += comboSpr.velocity.x;
add(rating); if(!FlxG.save.data.botplay) add(rating);
if (!curStage.startsWith('school')) if (!curStage.startsWith('school'))
{ {
@ -2701,6 +2727,13 @@ class PlayState extends MusicBeatState
controls.RIGHT_R controls.RIGHT_R
]; ];
// Prevent player input if botplay is on
if(FlxG.save.data.botplay)
{
holdArray = [false, false, false, false];
pressArray = [false, false, false, false];
releaseArray = [false, false, false, false];
}
// HOLDS, check for sustain notes // HOLDS, check for sustain notes
if (holdArray.contains(true) && /*!boyfriend.stunned && */ generatedMusic) if (holdArray.contains(true) && /*!boyfriend.stunned && */ generatedMusic)
{ {
@ -2798,7 +2831,7 @@ class PlayState extends MusicBeatState
noteMiss(shit, null); noteMiss(shit, null);
} }
if (dontCheck && possibleNotes.length > 0 && FlxG.save.data.ghost) if(dontCheck && possibleNotes.length > 0 && FlxG.save.data.ghost && !FlxG.save.data.botplay)
{ {
if (mashViolations > 4) if (mashViolations > 4)
{ {
@ -2812,13 +2845,25 @@ class PlayState extends MusicBeatState
} }
notes.forEachAlive(function(daNote:Note)
{
if(FlxG.save.data.downscroll && daNote.y > strumLine.y ||
!FlxG.save.data.downscroll && daNote.y < strumLine.y)
{
// Force good note hit regardless if it's too late to hit it or not as a fail safe
if(FlxG.save.data.botplay && daNote.canBeHit && daNote.mustPress ||
FlxG.save.data.botplay && daNote.tooLate && daNote.mustPress)
{
goodNoteHit(daNote);
boyfriend.holdTimer = daNote.sustainLength;
}
}
});
if (boyfriend.holdTimer > Conductor.stepCrochet * 4 * 0.001 && !holdArray.contains(true)) if (boyfriend.holdTimer > Conductor.stepCrochet * 4 * 0.001 && !holdArray.contains(true))
{ {
if (boyfriend.animation.curAnim.name.startsWith('sing') && !boyfriend.animation.curAnim.name.endsWith('miss')) if (boyfriend.animation.curAnim.name.startsWith('sing') && !boyfriend.animation.curAnim.name.endsWith('miss'))
{
boyfriend.playAnim('idle'); boyfriend.playAnim('idle');
} }
}
playerStrums.forEach(function(spr:FlxSprite) playerStrums.forEach(function(spr:FlxSprite)
{ {

View File

@ -5,6 +5,8 @@ class Ratings
public static function GenerateLetterRank(accuracy:Float) // generate a letter ranking public static function GenerateLetterRank(accuracy:Float) // generate a letter ranking
{ {
var ranking:String = "N/A"; var ranking:String = "N/A";
if(FlxG.save.data.botplay)
ranking = "BotPlay";
if (PlayState.misses == 0 && PlayState.bads == 0 && PlayState.shits == 0 && PlayState.goods == 0) // Marvelous (SICK) Full Combo if (PlayState.misses == 0 && PlayState.bads == 0 && PlayState.shits == 0 && PlayState.goods == 0) // Marvelous (SICK) Full Combo
ranking = "(MFC)"; ranking = "(MFC)";
@ -84,6 +86,8 @@ class Ratings
if (accuracy == 0) if (accuracy == 0)
ranking = "N/A"; ranking = "N/A";
else if(FlxG.save.data.botplay)
ranking = "BotPlay";
return ranking; return ranking;
} }
@ -119,16 +123,18 @@ class Ratings
return "shit"; return "shit";
else if (noteDiff < -166 * customTimeScale) // so god damn late its a miss else if (noteDiff < -166 * customTimeScale) // so god damn late its a miss
return "miss"; return "miss";
else if (FlxG.save.data.botplay)
return "sick";
return "sick"; return "sick";
} }
public static function CalculateRanking(score:Int,scoreDef:Int,nps:Int,accuracy:Float):String public static function CalculateRanking(score:Int,scoreDef:Int,nps:Int,accuracy:Float):String
{ {
return return
(FlxG.save.data.npsDisplay ? "NPS: " + nps + " | " : "") + // NPS Toggle (FlxG.save.data.npsDisplay ? "NPS: " + nps + (!FlxG.save.data.botplay ? " | " : "") : "") + (!FlxG.save.data.botplay ? // NPS Toggle
"Score:" + (Conductor.safeFrames != 10 ? score + " (" + scoreDef + ")" : "" + score) + // Score "Score:" + (Conductor.safeFrames != 10 ? score + " (" + scoreDef + ")" : "" + score) + // Score
" | Combo Breaks:" + PlayState.misses + // Misses/Combo Breaks " | Combo Breaks:" + PlayState.misses + // Misses/Combo Breaks
" | Accuracy:" + HelperFunctions.truncateFloat(accuracy, 2) + // Accuracy " | Accuracy:" + (FlxG.save.data.botplay ? "N/A" : HelperFunctions.truncateFloat(accuracy, 2) + " %") + // Accuracy
"% | " + GenerateLetterRank(accuracy); // Letter Rank " | " + GenerateLetterRank(accuracy) : ""); // Letter Rank
} }
} }