Skip to content
This repository has been archived by the owner on Nov 9, 2024. It is now read-only.

Commit

Permalink
botplay bois
Browse files Browse the repository at this point in the history
  • Loading branch information
RadiantCorium committed Jun 1, 2022
1 parent b758892 commit c2baf27
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 14 deletions.
55 changes: 41 additions & 14 deletions source/states/gameplay/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ class PlayState extends MusicBeatState
var detailsPausedText:String = "";
#end

var botplay:Bool = Option.recieveValue("GAMEPLAY_botplay") == 1;

override public function create()
{
if (FlxG.sound.music != null)
Expand Down Expand Up @@ -1434,10 +1436,11 @@ class PlayState extends MusicBeatState

super.update(elapsed);

scoreTxt.text = 'Score: ${songScore} - '+
scoreTxt.text = !botplay ? 'Score: ${songScore} - '+
'Combo: ${combo} - '+
'Misses: ${misses} - ' +
'Hit %: ${(sicks + goods + bads + shits + misses == 0) ? 0 : (sicks + goods + bads + shits) / (sicks + goods + bads + shits + misses) * 100}%';
'Hit %: ${(sicks + goods + bads + shits + misses == 0) ? 0 : (sicks + goods + bads + shits) / (sicks + goods + bads + shits + misses) * 100}%'
: 'BOTPLAY ENABLED';

if (FlxG.keys.justPressed.ENTER && startedCountdown && canPause)
{
Expand Down Expand Up @@ -2048,7 +2051,31 @@ class PlayState extends MusicBeatState
var downPressed = false;
var leftPressed = false;

if (upP)
if (botplay)
{
notes.forEachAlive(function(note:Note)
{
if (note.mustPress && FlxG.overlap(playerStrums, note) && note.y <= strumY)
{
boyfriend.holdTimer = 0;
// if all conditions are met, then we hit the note.

// find timing.
var timing = note.y - strumY;
trace('BP TIMING ' + timing);

goodNoteHit(note);

popUpScore(timing);

new FlxTimer().start(0.2, (_) -> {
playerStrums.members[note.noteData].animation.play("static");
});
}
});
}

if (upP && !botplay)
{
boyfriend.holdTimer = 0;
if (!FlxG.overlap(notes, playerStrums) && Option.recieveValue("GAMEPLAY_ghostTapping") == 1)
Expand All @@ -2061,7 +2088,7 @@ class PlayState extends MusicBeatState
{
if (note.noteData == 2 && note.mustPress && FlxG.overlap(playerStrums, note) && !note.isSustainNote && !upPressed)
{
if (Option.recieveValue("GAMEPLAY_difficultJacks") == 0)
if (Option.recieveValue("GAMEPLAY_difficultJacks") == 1)
upPressed = true;
// if all conditions are met, then we hit the note.

Expand All @@ -2076,7 +2103,7 @@ class PlayState extends MusicBeatState
});
}

if (downP)
if (downP && !botplay)
{
boyfriend.holdTimer = 0;
if (!FlxG.overlap(notes, playerStrums) && Option.recieveValue("GAMEPLAY_ghostTapping") == 1)
Expand All @@ -2089,7 +2116,7 @@ class PlayState extends MusicBeatState
{
if (note.noteData == 1 && note.mustPress && FlxG.overlap(playerStrums, note) && !note.isSustainNote && !downPressed)
{
if (Option.recieveValue("GAMEPLAY_difficultJacks") == 0)
if (Option.recieveValue("GAMEPLAY_difficultJacks") == 1)
downPressed = true;
// if all conditions are met, then we hit the note.

Expand All @@ -2104,7 +2131,7 @@ class PlayState extends MusicBeatState
});
}

if (leftP)
if (leftP && !botplay)
{
boyfriend.holdTimer = 0;
if (!FlxG.overlap(notes, playerStrums) && Option.recieveValue("GAMEPLAY_ghostTapping") == 1)
Expand All @@ -2117,7 +2144,7 @@ class PlayState extends MusicBeatState
{
if (note.noteData == 0 && note.mustPress && FlxG.overlap(playerStrums, note) && !note.isSustainNote && !leftPressed)
{
if (Option.recieveValue("GAMEPLAY_difficultJacks") == 0)
if (Option.recieveValue("GAMEPLAY_difficultJacks") == 1)
leftPressed = true;
// if all conditions are met, then we hit the note.

Expand All @@ -2132,7 +2159,7 @@ class PlayState extends MusicBeatState
});
}

if (rightP)
if (rightP && !botplay)
{
boyfriend.holdTimer = 0;
if (!FlxG.overlap(notes, playerStrums) && Option.recieveValue("GAMEPLAY_ghostTapping") == 1)
Expand All @@ -2145,7 +2172,7 @@ class PlayState extends MusicBeatState
{
if (note.noteData == 3 && note.mustPress && FlxG.overlap(playerStrums, note) && !note.isSustainNote && !rightPressed)
{
if (Option.recieveValue("GAMEPLAY_difficultJacks") == 0)
if (Option.recieveValue("GAMEPLAY_difficultJacks") == 1)
rightPressed = true;
// if all conditions are met, then we hit the note.

Expand All @@ -2160,7 +2187,7 @@ class PlayState extends MusicBeatState
});
}

if (up)
if (up && !botplay)
{
notes.forEachAlive(function(note:Note)
{
Expand All @@ -2179,7 +2206,7 @@ class PlayState extends MusicBeatState
});
}

if (left)
if (left && !botplay)
{
notes.forEachAlive(function(note:Note)
{
Expand All @@ -2198,7 +2225,7 @@ class PlayState extends MusicBeatState
});
}

if (right)
if (right && !botplay)
{
notes.forEachAlive(function(note:Note)
{
Expand All @@ -2217,7 +2244,7 @@ class PlayState extends MusicBeatState
});
}

if (down)
if (down && !botplay)
{
notes.forEachAlive(function(note:Note)
{
Expand Down
1 change: 1 addition & 0 deletions source/states/menu/OptionsMenu.hx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class OptionsMenu extends MusicBeatState
new CycleOption("Show Score Text %v", "Whether to show the score text or not", ["On", "Off"], "GAMEPLAY_showScoreTxt"),
//! broken! new CycleOption("Difficult Jacks %v", "With this option turned off, you only need to press once to trigger both notes.", ["On", "Off"], "GAMEPLAY_difficultJacks"),
new CycleOption("Ghost Tapping %v", "When enabled, you will not get a miss for pressing a key without a note.", ["On", "Off"], "GAMEPLAY_ghostTapping"),
new CycleOption("Botplay %v", "Whether the game plays itself or not", ["Off", "On"], "GAMEPLAY_botplay")
]),
new OptionGroup("Misc", [
new FunctionOption("Reset Option", "Resets all options to their default values.", clearOptions)
Expand Down

0 comments on commit c2baf27

Please sign in to comment.