configurable ship damage

This commit is contained in:
Enno Rehling 2011-03-06 12:11:57 +01:00
parent 8c42643528
commit cb4f7a03c6
5 changed files with 22 additions and 11 deletions

View File

@ -2677,10 +2677,12 @@ sinkships(region * r)
if (!sh->type->construction || sh->size>=sh->type->construction->maxsize) {
if (fval(r->terrain, SEA_REGION) && (!enoughsailors(sh, r) || get_captain(sh)==NULL)) {
/* Schiff nicht seetüchtig */
damage_ship(sh, 0.30);
float dmg = get_param_flt(global.parameters, "rules.ship.damage.nocrewocean", 0.30);
damage_ship(sh, dmg);
}
if (shipowner(sh)==NULL) {
damage_ship(sh, 0.05);
float dmg = get_param_flt(global.parameters, "rules.ship.damage.nocrew", 0.05);
damage_ship(sh, dmg);
}
}
if (sh->damage >= sh->size * DAMAGE_SCALE) {

View File

@ -503,7 +503,8 @@ chaos(region * r)
while (sh) {
ship * nsh = sh->next;
damage_ship(sh, 0.50);
float dmg = get_param_flt(global.parameters, "rules.ship.damage.atlantis", 0.50);
damage_ship(sh, dmg);
if (sh->damage >= sh->size * DAMAGE_SCALE) {
remove_ship(&sh->region->ships, sh);
}
@ -854,7 +855,8 @@ move_iceberg(region *r)
for (sh = r->ships; sh; sh = sh->next) {
/* Meldung an Kapitän */
damage_ship(sh, 0.10);
float dmg = get_param_flt(global.parameters, "rules.ship.damage.intoiceberg", 0.10);
damage_ship(sh, dmg);
fset(sh, SF_SELECT);
}
@ -865,7 +867,8 @@ move_iceberg(region *r)
}
while (rc->ships) {
fset(rc->ships, SF_SELECT);
damage_ship(rc->ships, 0.10);
float dmg = get_param_flt(global.parameters, "rules.ship.damage.withiceberg", 0.10);
damage_ship(rc->ships, dmg);
move_ship(rc->ships, rc, r, NULL);
}
while (rc->units) {
@ -991,7 +994,8 @@ godcurse(void)
ship *sh;
for (sh = r->ships; sh;) {
ship *shn = sh->next;
damage_ship(sh, 0.10);
float dmg = get_param_flt(global.parameters, "rules.ship.damage.godcurse", 0.10);
damage_ship(sh, dmg);
if (sh->damage>=sh->size * DAMAGE_SCALE) {
unit * u = shipowner(sh);
if (u) ADDMSG(&u->faction->msgs,

View File

@ -136,9 +136,11 @@ attack_catapult(const troop * at, const struct weapon_type * wtype, int * casual
d += terminate(dt, *at, AT_STANDARD, wp->type->damage[0], true);
#ifdef CATAPULT_STRUCTURAL_DAMAGE
if (dt.fighter->unit->building && rng_int()%100 < 5) {
damage_building(b, dt.fighter->unit->building, 1);
float dmg = get_param_flt(global.parameters, "rules.building.damage.catapult", 1);
damage_building(b, dt.fighter->unit->building, dmg);
} else if (dt.fighter->unit->ship && rng_int()%100 < 5) {
dt.fighter->unit->ship->damage+=DAMAGE_SCALE;
float dmg = get_param_flt(global.parameters, "rules.ship.damage.catapult", 0.01);
damage_ship(dt.fighter->unit->ship, dmg)
}
#endif
}

View File

@ -2634,6 +2634,7 @@ aftermath(battle * b)
boolean ships_damaged = (boolean)(b->turn+(b->has_tactics_turn?1:0)>2); /* only used for ship damage! */
for (s=b->sides;s!=b->sides+b->nsides;++s) {
s->dead=0;
fighter * df;
for (df = s->fighters; df; df=df->next) {
unit *du = df->unit;
@ -2882,7 +2883,8 @@ aftermath(battle * b)
if (sh && fval(sh, SF_DAMAGED)) {
int n = b->turn - 2;
if (n>0) {
damage_ship(sh, 0.05 * n);
float dmg = get_param_flt(global.parameters, "rules.ship.damage.battleround", 0.05);
damage_ship(sh, dmg * n);
freset(sh, SF_DAMAGED);
}
}

View File

@ -1276,7 +1276,7 @@ make_route(unit * u, order * ord, region_list ** routep)
*
* Berechnet wird das mit BPs. Zu Fuß hat man 4 BPs, zu Pferd 6.
* Normalerweise verliert man 3 BP pro Region, bei Straßen nur 2 BP.
* Außerdem: Wenn Einheit transportiert, nur halbe BP
* Außerdem: Wenn Einheit transportiert, nur halbe BP
*/
static int
movement_speed(unit * u)
@ -1766,7 +1766,8 @@ sail(unit * u, order * ord, boolean move_on_land, region_list **routep)
ADDMSG(&f->msgs, msg_message("sailnolandingstorm", "ship", sh));
} else {
ADDMSG(&f->msgs, msg_message("sailnolanding", "ship region", sh, next_point));
damage_ship(sh, 0.10);
float dmg = get_param_flt(global.parameters, "rules.ship.damage.nolanding", 0.10);
damage_ship(sh, dmg);
/* we handle destruction at the end */
}
break;