Esempio n. 1
0
  public static void update(ViewGroup group, Actor actor) {
    TableLayout actorinfo_stats_table =
        (TableLayout) group.findViewById(R.id.actorinfo_stats_table);

    updateTraitsTable(
        actorinfo_stats_table,
        actor.getMoveCost(),
        actor.getAttackCost(),
        actor.getAttackChance(),
        actor.getDamagePotential(),
        actor.getCriticalSkill(),
        actor.getCriticalMultiplier(),
        actor.getBlockChance(),
        actor.getDamageResistance(),
        actor.isImmuneToCriticalHits());

    TextView actorinfo_currentconditions_title =
        (TextView) group.findViewById(R.id.actorinfo_currentconditions_title);
    ActorConditionList actorinfo_currentconditions =
        (ActorConditionList) group.findViewById(R.id.actorinfo_currentconditions);
    if (actor.conditions.isEmpty()) {
      actorinfo_currentconditions_title.setVisibility(View.GONE);
      actorinfo_currentconditions.setVisibility(View.GONE);
    } else {
      actorinfo_currentconditions_title.setVisibility(View.VISIBLE);
      actorinfo_currentconditions.setVisibility(View.VISIBLE);
      actorinfo_currentconditions.update(actor.conditions);
    }
  }
 private static int getAttackHitChance(final Actor attacker, final Actor target) {
   final int c = attacker.getAttackChance() - target.getBlockChance();
   // (2/pi)*atan(..) will vary from -1 to +1 .
   return (int) (50 * (1 + two_divided_by_PI * (float) Math.atan((float) (c - n) / F)));
 }