minicraft-plus-revived
minicraft-plus-revived copied to clipboard
God Potion
I Think it would be a good idea to have a "God Potion" for the end game. It might look like this:
God(Color.get(0, 5, 100, 0), 6000){
public boolean toggleEffect(Player player, boolean addEffect) {
player.moveSpeed += (double)( addEffect ? 1 : (player.moveSpeed > 1 ? -1 : 0) ); //SPEED
//return true;
//HEAL
if (addEffect) player.heal(5);
//return true;
//ESCAPE
if (addEffect) {
int playerDepth = player.getLevel().depth;
if (playerDepth == 0) {
// player is in overworld
Game.notifications.add("You can't escape from here!");
return false;
}
int depthDiff = playerDepth > 0 ? -1 : 1;
World.scheduleLevelChange(depthDiff, () -> {
Level plevel = World.levels[World.lvlIdx(playerDepth + depthDiff)];
if (plevel != null && !plevel.getTile(player.x >> 4, player.y >> 4).mayPass(plevel, player.x >> 4, player.y >> 4, player))
player.findStartPos(plevel, false);
});
}
return true;
}`