public void onEvent(AllowedViewersModifiedEvent event) {
   secret.replaceAllowedViewers(event.getViewers());
   final LinkFragment fragment = new LinkFragment();
   Bundle arguments = new Bundle();
   arguments.putParcelable(LinkFragment.LINK_FRAGMENT_SECRET_ARGUMENT, secret);
   fragment.setArguments(arguments);
   getSupportFragmentManager()
       .beginTransaction()
       .setCustomAnimations(
           android.R.anim.slide_in_left,
           android.R.anim.slide_out_right,
           android.R.anim.slide_in_left,
           android.R.anim.slide_out_right)
       .replace(R.id.sharelock_compose_container, fragment)
       .addToBackStack("Link Step")
       .commit();
   bus.post(new RequestLinkEvent(secret));
 }
Beispiel #2
0
  // can't do anything in monster action phase
  // but allow for hunger effects
  public static void action(Thing h, int t) {
    // hunger
    int hunger = h.getStat(RPG.ST_HUNGER);
    int hungerThreshold = h.getStat("HungerThreshold");
    hunger = RPG.min(hungerThreshold * 3, hunger + (t * 6) / (6 + h.getStat(Skill.SURVIVAL)));
    h.set(RPG.ST_HUNGER, hunger);

    // bad things
    int hl = hunger / hungerThreshold;
    switch (hl) {
      case 0:
      case 1:
        // OK
        break;
      case 2:
        for (int i = RPG.po(t, 10000); i > 0; i--) {
          Game.message("You feel weak with hunger!");
          String stat = RPG.pick(hungerDecayStats);
          int sv = h.getBaseStat(stat);
          if (!h.getFlag("IsImmortal")) h.set(stat, RPG.max(sv - 1, 1));
        }
        break;
      case 3:
        // dying of hunger
        int loss = RPG.po(t / 1000.0);
        if (loss > 0) Game.message("You are dying of hunger!!");
        if (!h.getFlag("IsImmortal")) h.incStat("HPSMAX", -loss);
        if (!h.getFlag("IsImmortal")) h.incStat("HPS", -loss * 2);
        break;
    }

    // SPECIAL ABILITIES
    // thief searches
    for (int i = RPG.po(t * h.getStat(Skill.ALERTNESS) * h.getStat(RPG.ST_CR), 10000); i > 0; i--) {
      Secret.search();
    }
  }