This is the mail archive of the xconq7@sources.redhat.com mailing list for the Xconq project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Occupant Protection


>I've rewritten CIL to use combat model 0:
>
>http://castironlife.sourceforge.net/xcil-new.zip
>
>And, though it seems to work mostly like it should,
>I've found that when occupants protect against an
>attack, they all seem to protect.  The result is that
>a single division ends up attacking every division in
>an opposing army.  I've got cell protection and
>occupant protection set up, so maybe I'm overdoing it?
> Any ideas on how to rectify this?

This is how things should work. If you think the total protection of the
army is to high, just reduce the amount of protection per occupant/divison.

Hans

P.S. The occupant protection, stack protection and cell protection code
have quite different roles. See this commented piece of combat code:

    /* Account for protection by occupants. */
    for_all_occupants(other, occ) {
	if (in_play(occ) && completed(occ)) {
	    prot = uu_protection(occ->type, o);
	    if (prot != 100)
	      chance = (chance * prot) / 100;
	}
    }
    /* Account for protection by neighbours. */
    for_all_stack(other->x, other->y, unit2) {
	if (unit2 != other
	    && in_play(unit2)
	    && completed(unit2)
	    && unit2->side == other->side) {
	    prot = uu_stack_protection(unit2->type, o);
	    if (prot != 100)
	      chance = (chance * prot) / 100;
	}
    }
    /* Note that this code differs from that above in that it treats
       all units in the same cell equally, whether occs, suboccs or
       cellmates. This also means that one occ can protect another occ
       in the same transport. Moreover, the protective unit also
       protects itself. These rules simulate real situations such as
       when triple-A protects all nearby units (including itself)
       against bombers, or when a city wall protects all other
       occupants against ground attack. */
    for_all_stack_with_occs(other->x, other->y, unit2) {
	if (is_active(unit2)
	    /* We also extend protection to our buddies! */
	    && trusted_side(unit2->side, other->side)) {
	    /* This is when a unit, such as triple-A, extends unique
	       protection against a specific attacker, such as
	       bombers, to all other units in the cell. */
	    prot = uu_cellwide_protection_against(unit2->type, a);
	    if (prot != 100)
	      chance = (chance * prot) / 100;
	    /* This is when a unit (such as a garrison) specifically
	       protects a second unit, such as a fort (but not other
	       nearby units), against all forms of attack. It thus
	       works the same way as uu_protection and
	       uu_stack_protection. */
	    prot = uu_cellwide_protection_for(unit2->type, o);
	    if (prot != 100)
	      chance = (chance * prot) / 100;
	}
    }



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]