show zero ac

show zero ac
This commit is contained in:
Nut
2023-11-02 20:59:37 +01:00
committed by GitHub
2 changed files with 10 additions and 7 deletions

View File

@@ -579,6 +579,13 @@ public final class CombatController implements VisualEffectCompletedCallback {
private static final int n = 50;
private static final int F = 40;
private static final float two_divided_by_PI = (float) (2f / Math.PI);
/**
* @implNote
* formula: 50 * (1 + (2 / pi) * atan((attackChance - blockChance - n) / F))
* <br/>
* n = {@value n}; F = {@value F}
* @return [0..100] . 100 == always hit.
*/
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 .

View File

@@ -61,13 +61,9 @@ public final class TraitsInfoView {
tv.setText(Integer.toString(attackCost));
row = (TableRow) group.findViewById(R.id.traitsinfo_attack_chance_row);
if (attackChance == 0) {
row.setVisibility(View.GONE);
} else {
row.setVisibility(View.VISIBLE);
tv = (TextView) group.findViewById(R.id.traitsinfo_attack_chance);
tv.setText(Integer.toString(attackChance));
}
tv = (TextView) group.findViewById(R.id.traitsinfo_attack_chance);
tv.setText(Integer.toString(attackChance));
row = (TableRow) group.findViewById(R.id.traitsinfo_attack_damage_row);
if (damagePotential != null && damagePotential.max != 0) {