public static void validateAllBagsBought(Item bag) {

    Badge badge = null;
    if (bag instanceof SeedPouch && !PixelDungeon.freeSeedPouch()) {
      badge = Badge.BAG_BOUGHT_SEED_POUCH;
    } else if (bag instanceof ScrollHolder && !PixelDungeon.freeScrollHolder()) {
      badge = Badge.BAG_BOUGHT_SCROLL_HOLDER;
    } else if (bag instanceof WandHolster && !PixelDungeon.freeWandHolster()) {
      badge = Badge.BAG_BOUGHT_WAND_HOLSTER;
    } else if (bag instanceof PotionBag && !PixelDungeon.freePotionBag()) {
      badge = Badge.BAG_BOUGHT_POTION_BAG;
    }

    if (badge != null) {

      local.add(badge);

      if (!local.contains(Badge.ALL_BAGS_BOUGHT)
          && local.contains(Badge.BAG_BOUGHT_SCROLL_HOLDER)
          && local.contains(Badge.BAG_BOUGHT_SEED_POUCH)
          && local.contains(Badge.BAG_BOUGHT_WAND_HOLSTER)
          && local.contains(Badge.BAG_BOUGHT_POTION_BAG)) {

        badge = Badge.ALL_BAGS_BOUGHT;
        local.add(badge);
        displayBadge(badge);
      }
    }
  }
  public static void validateAllWandsIdentified() {
    if (Dungeon.hero != null
        && Dungeon.hero.isAlive()
        && !local.contains(Badge.ALL_WANDS_IDENTIFIED)
        && Wand.allKnown()
        && !PixelDungeon.autoIdentify()) {

      Badge badge = Badge.ALL_WANDS_IDENTIFIED;
      local.add(badge);
      displayBadge(badge);

      validateAllItemsIdentified();
    }
  }
Example #3
0
  public static void init() {

    challenges = PixelDungeon.challenges();

    Actor.clear();

    PathFinder.setMapSize(Level.WIDTH, Level.HEIGHT);

    Scroll.initLabels();
    Potion.initColors();
    Wand.initWoods();
    Ring.initGems();

    Statistics.reset();
    Journal.reset();

    depth = 0;
    gold = 0;

    potionOfStrength = 0;
    scrollsOfUpgrade = 0;
    arcaneStyli = 0;
    dewVial = true;
    transmutation = Random.IntRange(6, 14);

    chapters = new HashSet<Integer>();

    Ghost.Quest.reset();
    WandMaker.Quest.reset();
    Blacksmith.Quest.reset();
    Imp.Quest.reset();

    Room.shuffleTypes();

    hero = new Hero();
    hero.live();

    Badges.reset();

    StartScene.curClass.initHero(hero);
  }
 @Override
 protected void onBackPressed() {
   PixelDungeon.switchNoFade(TitleScene.class);
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    sharedpreferences = getSharedPreferences(MyPREFERENCES, Context.MODE_PRIVATE);
    SharedPreferences.Editor editor = sharedpreferences.edit();
    int countShowAds = sharedpreferences.getInt("countShowAds", 0);

    // String placeModFilesHere = "placeModFilesHere";

    PixelDungeon.moddingMode(false);
    ModdingMode.mode(PixelDungeon.moddingMode());
    /*
    if(!FileSystem.getExternalStorageFile(placeModFilesHere).exists()) {
    	try {
    		FileSystem.getExternalStorageFile(placeModFilesHere).createNewFile();
    	} catch (IOException e) {
    		GLog.i(e.getMessage());
    		e.printStackTrace();
    	}
    }
    */
    PixelDungeon.instance().initIap();

    if (PixelDungeon.uiLanguage().equals("ko")) {
      PixelDungeon.classicFont(false);
    }

    ModdingMode.setClassicTextRenderingMode(PixelDungeon.classicFont());

    useLocale(uiLanguage());

    updateImmersiveMode();

    DisplayMetrics metrics = new DisplayMetrics();
    instance().getWindowManager().getDefaultDisplay().getMetrics(metrics);
    boolean landscape = metrics.widthPixels > metrics.heightPixels;

    if (Preferences.INSTANCE.getBoolean(Preferences.KEY_LANDSCAPE, false) != landscape) {
      landscape(!landscape);
    }

    Music.INSTANCE.enable(music());
    Sample.INSTANCE.enable(soundFx());
    secondQuickslot();

    if (PixelDungeon.version() != Game.versionCode) {
      switchScene(WelcomeScene.class);
    }

    if (countShowAds >= 2) {
      final ConnectivityManager conMgr =
          (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
      final NetworkInfo activeNetwork = conMgr.getActiveNetworkInfo();
      if (activeNetwork != null && activeNetwork.isConnected()) {
        Intent intent = new Intent(this, Ads.class);
        startActivity(intent);
      }
      editor.putInt("countShowAds", 0);
    } else {
      if (countShowAds == 0) {
        editor.putInt("countShowAds", 1);
      } else {
        editor.putInt("countShowAds", countShowAds + 1);
      }
    }
    editor.commit();
  }