URL:
  <http://gna.org/bugs/?16460>

                 Summary: Win chance calculation doesn't take fortress into
account
                 Project: Freeciv
            Submitted by: smesserli
            Submitted on: Monday 08/16/2010 at 23:03
                Category: None
                Severity: 3 - Normal
                Priority: 5 - Normal
                  Status: None
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
                 Release: 2.2.2
         Discussion Lock: Any
        Operating System: GNU/Linux
         Planned Release: 

    _______________________________________________________

Details:

Hi,

It looks like the "win chance" displayed as a percentage when middle-mouse
clicking on an ennemy unit doesn't take fortress bases into account.

I used the editor to put identical ennemy units on identical terrains, once
with a fortress and once without one. The win chance percentage shown by the
client remained the same in both cases, despite the active ruleset having a
100% defense bonus for a fortress.

Looking at the code, I traced the win chance calculation down to
unit_win_chance (common/combat.c), then get_total_defense_power
(common/combat.c), defense_multiplication (common/combat.c) and finally
tile_bases_defense_bonus (common/tile.c).

It looks like the code is in here:

  base_type_iterate(pbase) {
    if (tile_has_base(ptile, pbase)
        && is_native_base_to_uclass(pbase, utype_class(punittype))) {
      bonus += pbase->defense_bonus;
    }
  } base_type_iterate_end;

But for some unknown (to me) reason, the fortress defense bonus isn't
actually being taken into account.

I can however confirm that the fortress really decreases the attacker win
chance (after doing a few statistical combat tests), even if it's not
displayed correctly.

Cheers,
- St├ęphane





    _______________________________________________________

Reply to this item at:

  <http://gna.org/bugs/?16460>

_______________________________________________
  Message sent via/by Gna!
  http://gna.org/


_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to