Skip to content

Commit

Permalink
Merge pull request #8 from None1637/Add4Mods
Browse files Browse the repository at this point in the history
Add new Mods: SD/PF/SC/rEZ
  • Loading branch information
EdrowsLuo authored May 18, 2020
2 parents d670c97 + 39c689c commit 0ca56ce
Show file tree
Hide file tree
Showing 14 changed files with 280 additions and 25 deletions.
Binary file added assets/gfx/selection-mod-perfect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/gfx/selection-mod-reallyeasy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/gfx/selection-mod-smallcircle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/gfx/selection-mod-suddendeath.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@

<string name="test_ed_storyboard">View storyboard (experiment)</string>

<string name="mod_precise_is_unrank_now">MOD_PRECISE is unrank now</string>

<!-- <string name="mod_precise_is_unrank_now">MOD_PRECISE is unrank now</string>-->
<string name="mods_sdpfprscrez_is_unrank_now">MOD:SD/PF/PR/SC/REZ is unrank now</string>

<!-- new data after 1.6.7(beta1) -->
<string name="beta_checking_upgrade">Checking Upgrade...</string>
Expand Down
18 changes: 18 additions & 0 deletions src/ru/nsu/ccfit/zuev/osu/game/GameHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ public class GameHelper {
private static boolean nightCore = false;
private static boolean halfTime = false;
private static boolean autopilotMod = false;
private static boolean suddenDeath = false;
private static boolean perfect = false;
private static boolean useReplay;
private static boolean isKiai = false;
private static boolean auto = false;
Expand Down Expand Up @@ -390,6 +392,22 @@ public static void setDoubleTime(final boolean doubleTime) {
GameHelper.doubleTime = doubleTime;
}

public static boolean isSuddenDeath() {
return suddenDeath;
}

public static void setSuddenDeath(final boolean suddenDeath) {
GameHelper.suddenDeath = suddenDeath;
}

public static boolean isPerfect() {
return perfect;
}

public static void setPerfect(final boolean perfect) {
GameHelper.perfect = perfect;
}

public static boolean isUseReplay() {
return useReplay;
}
Expand Down
129 changes: 124 additions & 5 deletions src/ru/nsu/ccfit/zuev/osu/game/GameScene.java
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ public class GameScene implements IUpdateHandler, GameObjectListener,
private ComboBurst comboBurst;
private VideoSprite mVideo = null;
private Sprite[] ScoreBoardSprite;
private int failcount = 0;

private StoryboardSprite storyboardSprite;

Expand Down Expand Up @@ -414,6 +415,20 @@ private boolean loadGame(final TrackInfo track, final String rFile) {
GameHelper.setTimeMultiplier(1f);
}

if (ModMenu.getInstance().getMod().contains(GameMod.MOD_REALLYEASY)) {
scale += 0.125f;
drain *= 0.5f;
overallDifficulty *= 0.5f;
approachRate = (float) ((ModMenu.getInstance().getMod().contains(GameMod.MOD_DOUBLETIME) || ModMenu.getInstance().getMod().contains(GameMod.MOD_NIGHTCORE))?
(GameHelper.ar2ms(rawApproachRate - 1f) / 1000f):(GameHelper.ar2ms(rawApproachRate - 0.5f) / 1000f));
}

if (ModMenu.getInstance().getMod().contains(GameMod.MOD_SMALLCIRCLE)) {
scale -= (float) ((Config.getRES_HEIGHT() / 480.0f) * (4 * 4.48)
* 2 / GameObjectSize.BASE_OBJECT_SIZE);
}
//

GameHelper.setRelaxMod(ModMenu.getInstance().getMod().contains(GameMod.MOD_RELAX));
GameHelper.setAutopilotMod(ModMenu.getInstance().getMod().contains(GameMod.MOD_AUTOPILOT));
GameHelper.setAuto(ModMenu.getInstance().getMod().contains(GameMod.MOD_AUTO));
Expand Down Expand Up @@ -550,11 +565,16 @@ private boolean loadGame(final TrackInfo track, final String rFile) {
replay.countMarks(overallDifficulty);
} else if (!OnlineManager.getInstance().isStayOnline() && !Config.isSaveReplays()) {
replay = null;
} else if (ModMenu.getInstance().getMod().contains(GameMod.MOD_AUTO) ||
} else if (ModMenu.getInstance().getMod().contains(GameMod.MOD_AUTO)) {
replay = null;
}
/*
else if (ModMenu.getInstance().getMod().contains(GameMod.MOD_AUTO) ||
ModMenu.getInstance().getMod().contains(GameMod.MOD_RELAX) ||
ModMenu.getInstance().getMod().contains(GameMod.MOD_AUTOPILOT)) {
replay = null;
}
*/
//TODO fix replays ^^
// replay = null;

Expand Down Expand Up @@ -621,7 +641,7 @@ public void startGame(final TrackInfo track, final String replayFile) {
mgScene.setBackgroundEnabled(false);
fgScene.setBackgroundEnabled(false);
isFirst = true;

failcount = 0;
final LoadingScreen screen = new LoadingScreen();
engine.setScene(screen.getScene());

Expand All @@ -644,6 +664,7 @@ public void onComplete() {
}
}
});
ResourceManager.getInstance().getSound("failsound").stop();
}

private void prepareScene() {
Expand Down Expand Up @@ -707,6 +728,8 @@ protected void onLogFPS() {
GameHelper.setHidden(stat.getMod().contains(GameMod.MOD_HIDDEN));
GameHelper.setRelaxMod(stat.getMod().contains(GameMod.MOD_RELAX));
GameHelper.setAutopilotMod(stat.getMod().contains(GameMod.MOD_AUTOPILOT));
GameHelper.setSuddenDeath(stat.getMod().contains(GameMod.MOD_SUDDENDEATH));
GameHelper.setPerfect(stat.getMod().contains(GameMod.MOD_PERFECT));
difficultyHelper = stat.getMod().contains(GameMod.MOD_PRECISE) ?
DifficultyHelper.HighDifficulty : DifficultyHelper.StdDifficulty;
GameHelper.setDifficultyHelper(difficultyHelper);
Expand Down Expand Up @@ -1020,7 +1043,74 @@ protected void onLogFPS() {
effectOffset += 25;
timeOffset += 0.25f;
}

if (stat.getMod().contains(GameMod.MOD_SUDDENDEATH)) {
final GameEffect effect = GameObjectPool.getInstance().getEffect(
"selection-mod-suddendeath");
effect.init(
mgScene,
new PointF(Utils.toRes(Config.getRES_WIDTH() - effectOffset), Utils
.toRes(130)),
scale,
new SequenceEntityModifier(ModifierFactory
.newScaleModifier(0.25f, 1.2f, 1), ModifierFactory
.newDelayModifier(2 - timeOffset),
new ParallelEntityModifier(ModifierFactory
.newFadeOutModifier(0.5f), ModifierFactory
.newScaleModifier(0.5f, 1, 1.5f))));
effectOffset += 25;
timeOffset += 0.25f;
}
else if (stat.getMod().contains(GameMod.MOD_PERFECT)) {
final GameEffect effect = GameObjectPool.getInstance().getEffect(
"selection-mod-perfect");
effect.init(
mgScene,
new PointF(Utils.toRes(Config.getRES_WIDTH() - effectOffset), Utils
.toRes(130)),
scale,
new SequenceEntityModifier(ModifierFactory
.newScaleModifier(0.25f, 1.2f, 1), ModifierFactory
.newDelayModifier(2 - timeOffset),
new ParallelEntityModifier(ModifierFactory
.newFadeOutModifier(0.5f), ModifierFactory
.newScaleModifier(0.5f, 1, 1.5f))));
effectOffset += 25;
timeOffset += 0.25f;
}
if (stat.getMod().contains(GameMod.MOD_SMALLCIRCLE)) {
final GameEffect effect = GameObjectPool.getInstance().getEffect(
"selection-mod-smallcircle");
effect.init(
mgScene,
new PointF(Utils.toRes(Config.getRES_WIDTH() - effectOffset), Utils
.toRes(130)),
scale,
new SequenceEntityModifier(ModifierFactory
.newScaleModifier(0.25f, 1.2f, 1), ModifierFactory
.newDelayModifier(2 - timeOffset),
new ParallelEntityModifier(ModifierFactory
.newFadeOutModifier(0.5f), ModifierFactory
.newScaleModifier(0.5f, 1, 1.5f))));
effectOffset += 25;
timeOffset += 0.25f;
}
if (stat.getMod().contains(GameMod.MOD_REALLYEASY)) {
final GameEffect effect = GameObjectPool.getInstance().getEffect(
"selection-mod-reallyeasy");
effect.init(
mgScene,
new PointF(Utils.toRes(Config.getRES_WIDTH() - effectOffset), Utils
.toRes(130)),
scale,
new SequenceEntityModifier(ModifierFactory
.newScaleModifier(0.25f, 1.2f, 1), ModifierFactory
.newDelayModifier(2 - timeOffset),
new ParallelEntityModifier(ModifierFactory
.newFadeOutModifier(0.5f), ModifierFactory
.newScaleModifier(0.5f, 1, 1.5f))));
effectOffset += 25;
timeOffset += 0.25f;
}
kiai = false;
kiaiRect = new Rectangle(0, 0, Config.getRES_WIDTH(),
Config.getRES_HEIGHT());
Expand Down Expand Up @@ -1236,7 +1326,13 @@ public void onUpdate(final float pSecondsElapsed) {
&& stat.getMod().contains(GameMod.MOD_RELAX) == false
&& stat.getMod().contains(GameMod.MOD_AUTOPILOT) == false
&& stat.getMod().contains(GameMod.MOD_AUTO) == false) {
gameover();
if(stat.getMod().contains(GameMod.MOD_EASY) && failcount < 3){
failcount++;
stat.changeHp(1f);
}
else{
gameover();
}
return;
}
}
Expand Down Expand Up @@ -1699,7 +1795,11 @@ private String registerHit(final int objectId, final int score, final boolean en
comboWasMissed = true;
stat.registerHit(0, false, false);
if (writeReplay) replay.addObjectScore(objectId, Replay.RESULT_0);

if(GameHelper.isPerfect()){
gameover();
restartGame();
}
if(GameHelper.isSuddenDeath())stat.changeHp(-1.0f);
return "hit0";
}

Expand All @@ -1709,6 +1809,10 @@ private String registerHit(final int objectId, final int score, final boolean en
if (writeReplay) replay.addObjectScore(objectId, Replay.RESULT_50);
scoreName = "hit50";
comboWas100 = true;
if(GameHelper.isPerfect()){
gameover();
restartGame();
}
} else if (score == 100) {
comboWas100 = true;
if (writeReplay) replay.addObjectScore(objectId, Replay.RESULT_100);
Expand All @@ -1719,6 +1823,10 @@ private String registerHit(final int objectId, final int score, final boolean en
stat.registerHit(100, false, false);
scoreName = "hit100";
}
if(GameHelper.isPerfect()){
gameover();
restartGame();
}
} else if (score == 300) {
if (writeReplay) replay.addObjectScore(objectId, Replay.RESULT_300);
if (endCombo && comboWasMissed == false) {
Expand Down Expand Up @@ -2140,6 +2248,17 @@ public void removePassiveObject(final GameObject object) {
private void createHitEffect(final PointF pos, final String name, RGBColor color) {
final GameEffect effect = GameObjectPool.getInstance().getEffect(name);
if (name.equals("hit0")) {
if(GameHelper.isSuddenDeath()){
effect.init(
mgScene,
pos,
scale * 3,
new SequenceEntityModifier(ModifierFactory
.newFadeInModifier(0.15f), ModifierFactory
.newDelayModifier(0.35f), ModifierFactory
.newFadeOutModifier(0.25f)));
return;
}
effect.init(
mgScene,
pos,
Expand Down
8 changes: 6 additions & 2 deletions src/ru/nsu/ccfit/zuev/osu/game/mods/GameMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@ public enum GameMod {
MOD_DOUBLETIME("dt"),
MOD_NIGHTCORE("nc"),
MOD_HALFTIME("ht"),
MOD_PRECISE("pr");

MOD_SUDDENDEATH("sd"),
MOD_PERFECT("pf"),
MOD_PRECISE("pr"),
MOD_SMALLCIRCLE("sc"),
MOD_REALLYEASY("re");

public final String shortName;

GameMod(String shortName) {
Expand Down
27 changes: 23 additions & 4 deletions src/ru/nsu/ccfit/zuev/osu/menu/ModMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,18 +108,22 @@ public void init() {
addButton(offset + offsetGrowth * 0, Config.getRES_HEIGHT() / 2 - button.getHeight() * 3, "selection-mod-easy", GameMod.MOD_EASY);
addButton(offset + offsetGrowth * 1, Config.getRES_HEIGHT() / 2 - button.getHeight() * 3, "selection-mod-nofail", GameMod.MOD_NOFAIL);
addButton(offset + offsetGrowth * 2, Config.getRES_HEIGHT() / 2 - button.getHeight() * 3, "selection-mod-halftime", GameMod.MOD_HALFTIME);
addButton(offset + offsetGrowth * 3, Config.getRES_HEIGHT() / 2 - button.getHeight() * 3, "selection-mod-reallyeasy", GameMod.MOD_REALLYEASY);

//line 2
addButton(offset + offsetGrowth * 0, Config.getRES_HEIGHT() / 2 - button.getHeight() / 2, "selection-mod-hardrock", GameMod.MOD_HARDROCK);
addButton(offset + offsetGrowth * 1, Config.getRES_HEIGHT() / 2 - button.getHeight() / 2, "selection-mod-doubletime", GameMod.MOD_DOUBLETIME);
addButton(offset + offsetGrowth * 2, Config.getRES_HEIGHT() / 2 - button.getHeight() / 2, "selection-mod-nightcore", GameMod.MOD_NIGHTCORE);
addButton(offset + offsetGrowth * 3, Config.getRES_HEIGHT() / 2 - button.getHeight() / 2, "selection-mod-hidden", GameMod.MOD_HIDDEN);
addButton(offset + offsetGrowth * 4, Config.getRES_HEIGHT() / 2 - button.getHeight() / 2, "selection-mod-smallcircle", GameMod.MOD_SMALLCIRCLE);

//line 3
addButton(offset + offsetGrowth * 0, Config.getRES_HEIGHT() / 2 + button.getHeight() * 2, "selection-mod-relax", GameMod.MOD_RELAX);
addButton(offset + offsetGrowth * 1, Config.getRES_HEIGHT() / 2 + button.getHeight() * 2, "selection-mod-relax2", GameMod.MOD_AUTOPILOT);
addButton(offset + offsetGrowth * 2, Config.getRES_HEIGHT() / 2 + button.getHeight() * 2, "selection-mod-autoplay", GameMod.MOD_AUTO);
addButton(offset + offsetGrowth * 3, Config.getRES_HEIGHT() / 2 + button.getHeight() * 2, "selection-mod-precise", GameMod.MOD_PRECISE);
addButton(offset + offsetGrowth * 2, Config.getRES_HEIGHT() / 2 + button.getHeight() * 2, "selection-mod-suddendeath", GameMod.MOD_SUDDENDEATH);
addButton(offset + offsetGrowth * 3, Config.getRES_HEIGHT() / 2 + button.getHeight() * 2, "selection-mod-perfect", GameMod.MOD_PERFECT);
addButton(offset + offsetGrowth * 4, Config.getRES_HEIGHT() / 2 + button.getHeight() * 2, "selection-mod-autoplay", GameMod.MOD_AUTO);
addButton(offset + offsetGrowth * 5, Config.getRES_HEIGHT() / 2 + button.getHeight() * 2, "selection-mod-precise", GameMod.MOD_PRECISE);


final TextButton resetText = new TextButton(ResourceManager
Expand Down Expand Up @@ -194,10 +198,10 @@ private void changeMultiplierText() {
mult *= 0;
}
if (mod.contains(GameMod.MOD_RELAX)) {
mult *= 0;
mult *= 0.001f;
}
if (mod.contains(GameMod.MOD_AUTOPILOT)) {
mult *= 0;
mult *= 0.001f;
}
if (mod.contains(GameMod.MOD_EASY)) {
mult *= 0.5f;
Expand All @@ -220,6 +224,9 @@ private void changeMultiplierText() {
if (mod.contains(GameMod.MOD_HALFTIME)) {
mult *= 0.3f;
}
if (mod.contains(GameMod.MOD_REALLYEASY)) {
mult *= 0.4f;
}

multiplierText.setText(StringTable.format(R.string.menu_mod_multiplier,
mult));
Expand Down Expand Up @@ -274,6 +281,18 @@ public boolean switchMod(GameMod flag) {
mod.remove(GameMod.MOD_DOUBLETIME);
mod.remove(GameMod.MOD_NIGHTCORE);
modsRemoved = true;
} else if (flag.equals(GameMod.MOD_SUDDENDEATH)) {
mod.remove(GameMod.MOD_NOFAIL);
mod.remove(GameMod.MOD_PERFECT);
modsRemoved = true;
} else if (flag.equals(GameMod.MOD_PERFECT)) {
mod.remove(GameMod.MOD_NOFAIL);
mod.remove(GameMod.MOD_SUDDENDEATH);
modsRemoved = true;
} else if (flag.equals(GameMod.MOD_NOFAIL)) {
mod.remove(GameMod.MOD_PERFECT);
mod.remove(GameMod.MOD_SUDDENDEATH);
modsRemoved = true;
}
if (modsRemoved) {
for (GameMod gmod : modButtons.keySet()) {
Expand Down
14 changes: 13 additions & 1 deletion src/ru/nsu/ccfit/zuev/osu/menu/ScoreBoard.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public static String ConvertModString(String s) {
result += "Auto,";
break;
case 'x':
result += "RE,";
result += "Relax,";
break;
case 'p':
result += "AP,";
Expand Down Expand Up @@ -132,6 +132,18 @@ public static String ConvertModString(String s) {
case 's':
result += "PR,";
break;
case 'l':
result += "REZ,";
break;
case 'm':
result += "SC,";
break;
case 'u':
result += "SD,";
break;
case 'f':
result += "PF,";
break;
}
}
if (result.length() == 0) {
Expand Down
Loading

0 comments on commit 0ca56ce

Please sign in to comment.