diff --git a/src/common/kernel/alchemy.c b/src/common/kernel/alchemy.c index 8d82be925..afecadc74 100644 --- a/src/common/kernel/alchemy.c +++ b/src/common/kernel/alchemy.c @@ -128,22 +128,27 @@ do_potion(unit * u, const potion_type * ptype, int amount) if (ptype==oldpotiontype[P_LIFE]) { region * r = u->region; int holz = 0; - + static int tree_type = -1; + static int tree_count = -1; + if (tree_type<0) { + tree_type = get_param_int(global.parameters, "rules.magic.wol_type", 1); + tree_count = get_param_int(global.parameters, "rules.magic.wol_effect", 10); + } /* mallorn is required to make mallorn forests, wood for regular ones */ if (fval(r, RF_MALLORN)) { holz = use_pooled(u, rt_find("mallorn"), - GET_SLACK|GET_RESERVE|GET_POOLED_SLACK, 10*amount); + GET_SLACK|GET_RESERVE|GET_POOLED_SLACK, tree_count*amount); } else { holz = use_pooled(u, rt_find("log"), - GET_SLACK|GET_RESERVE|GET_POOLED_SLACK, 10*amount); + GET_SLACK|GET_RESERVE|GET_POOLED_SLACK, tree_count*amount); } - if (r->land==0) holz=0; - if (holz<10*amount) { - int x = holz/10; - if (holz%10) ++x; + if (r->land==0) holz = 0; + if (holzfaction->msgs, msg_message("growtree_effect", "mage amount", u, holz)); } else if (ptype==oldpotiontype[P_HEILWASSER]) { @@ -205,8 +210,12 @@ static int age_potiondelay(attrib * a) { return AT_AGE_REMOVE; } +/* TODO: + * - this should be a more general item_delay + * - it should not just happen in age(), but be done with eventhandling + */ attrib_type at_potiondelay = { - "eventhandler", + "potiondelay", init_potiondelay, free_potiondelay, age_potiondelay, 0, 0 @@ -223,8 +232,8 @@ make_potiondelay(unit * u, const potion_type* ptype, int amount) return a; } -static int -use_wateroflife_delayed(unit * u, const item_type * itype, int amount, struct order *ord) +int +use_potion_delayed(unit * u, const item_type * itype, int amount, struct order *ord) { const potion_type * ptype = resource2potion(itype->rtype); int result = begin_potion(u, ptype, ord); diff --git a/src/common/kernel/alchemy.h b/src/common/kernel/alchemy.h index 22c3c4623..fcb3f0e96 100644 --- a/src/common/kernel/alchemy.h +++ b/src/common/kernel/alchemy.h @@ -53,6 +53,7 @@ enum { extern void herbsearch(struct region * r, struct unit * u, int max); extern int use_potion(struct unit * u, const struct item_type * itype, int amount, struct order *); +extern int use_potion_delayed(struct unit * u, const struct item_type * itype, int amount, struct order *); extern void init_potions(void); extern int get_effect(const struct unit * u, const struct potion_type * effect); diff --git a/src/common/kernel/battle.c b/src/common/kernel/battle.c index a50827568..483f12196 100644 --- a/src/common/kernel/battle.c +++ b/src/common/kernel/battle.c @@ -683,10 +683,10 @@ weapon_skill(const weapon_type * wtype, const unit * u, boolean attacking) } if (attacking) { skill += u->race->at_bonus; - if (u->ship) skill += u->ship->type->at_bonus; + if (fval(u->region->terrain, SEA_REGION) && u->ship) skill += u->ship->type->at_bonus; } else { skill += u->race->df_bonus; - if (u->ship) skill += u->ship->type->df_bonus; + if (fval(u->region->terrain, SEA_REGION) && u->ship) skill += u->ship->type->df_bonus; } } else { /* changed: if we own a weapon, we have at least a skill of 0 */ @@ -734,16 +734,20 @@ CavalryBonus(const unit * u, troop enemy, int type) /* old rule, Eressea 1.0 compat */ return (type==BONUS_SKILL)?2:0; } else { - /* new rule, chargers in Eressea 1.1 */ - int skl = effskill(u, SK_RIDING); - /* only half against trolls */ - if (enemy.fighter->unit->race==new_race[RC_TROLL]) { - skl = skl/4; - } else { - skl = skl/2; + if (type==BONUS_DAMAGE) { + /* new rule, chargers in Eressea 1.1 */ + int skl = effskill(u, SK_RIDING); + /* only half against trolls */ + if (skl>0) { + int dmg = 1+rng_int() % skl; + if (enemy.fighter->unit->race==new_race[RC_TROLL]) { + dmg = dmg/2; + } + return dmg; + } } - return MIN(skl, 4); } + return 0; } static int @@ -1071,6 +1075,7 @@ terminate(troop dt, troop at, int type, const char *damage, boolean missile) unit *du = df->unit; battle *b = df->side->battle; int heiltrank = 0; + static int rule_armor = -1; /* Schild */ void **si; @@ -1162,11 +1167,19 @@ terminate(troop dt, troop at, int type, const char *damage, boolean missile) } #endif - /* natürliche Rüstung ist halbkumulativ */ - if (ar>0) { - ar += an/2; + if (rule_armor<0) { + rule_armor = get_param_int(global.parameters, "rules.combat.nat_armor", 0); + } + if (rule_armor==0) { + /* natürliche Rüstung ist halbkumulativ */ + if (ar>0) { + ar += an/2; + } else { + ar = an; + } } else { - ar = an; + /* use the higher value, add half the other value */ + ar = (ar>an)?(ar+an/2):(an+ar/2); } ar += am; @@ -1585,8 +1598,10 @@ select_opponent(battle * b, troop at, int mindist, int maxdist) int tactics = get_tactics(dt.fighter->side); /* percentage chance to get this attack */ double tacch = 0.1 * (b->max_tactics - tactics); - ship * sh = at.fighter->unit->ship; - if (sh) tacch *= sh->type->tac_bonus; + if (fval(b->region->terrain, SEA_REGION)) { + ship * sh = at.fighter->unit->ship; + if (sh) tacch *= sh->type->tac_bonus; + } if (!chance(tacch)) { dt.fighter = NULL; } diff --git a/src/common/kernel/item.c b/src/common/kernel/item.c index 17f1f311a..9500636a3 100644 --- a/src/common/kernel/item.c +++ b/src/common/kernel/item.c @@ -1176,6 +1176,7 @@ register_resources(void) register_function((pf_generic)res_changeaura, "changeaura"); register_item_use(use_potion, "usepotion"); + register_item_use(use_potion_delayed, "usepotion_delayed"); register_item_use(use_tacticcrystal, "use_tacticcrystal"); register_item_use(use_birthdayamulet, "use_birthdayamulet"); register_item_use(use_warmthpotion, "usewarmthpotion"); diff --git a/src/common/kernel/move.c b/src/common/kernel/move.c index c82e23f48..747248678 100644 --- a/src/common/kernel/move.c +++ b/src/common/kernel/move.c @@ -705,6 +705,16 @@ set_coast(ship * sh, region * r, region * rnext) } } +static float +damage_drift(void) +{ + static float value = -1.0F; + if (value<0) { + value = get_param_flt(global.parameters, "rules.ship.damage_drift", 0.02F); + } + return value; +} + static void drifting_ships(region * r) { @@ -788,7 +798,7 @@ drifting_ships(region * r) if (sh!=NULL) { fset(sh, SF_DRIFTED); - damage_ship(sh, 0.02); + damage_ship(sh, damage_drift()); if (sh->damage>=sh->size * DAMAGE_SCALE) { remove_ship(&sh->region->ships, sh); } @@ -1702,7 +1712,7 @@ sail(unit * u, order * ord, boolean move_on_land, region_list **routep) sh, current_point, sh->damage>=sh->size * DAMAGE_SCALE)); /* damage the ship. we handle destruction in the end */ - damage_ship(sh, 0.02); + damage_ship(sh, damage_drift()); if (sh->damage>=sh->size * DAMAGE_SCALE) break; next_point = rnext; diff --git a/src/res/e2k9.xml b/src/res/e2k9.xml index 1aa47feca..0184592cc 100644 --- a/src/res/e2k9.xml +++ b/src/res/e2k9.xml @@ -133,7 +133,9 @@ + + @@ -143,6 +145,7 @@ + diff --git a/src/res/e2k9/equipment.xml b/src/res/e2k9/equipment.xml index b51850131..bbd2ac5b7 100644 --- a/src/res/e2k9/equipment.xml +++ b/src/res/e2k9/equipment.xml @@ -3,11 +3,11 @@ - + - + diff --git a/src/res/e2k9/races.xml b/src/res/e2k9/races.xml index df8438519..d2eb182af 100644 --- a/src/res/e2k9/races.xml +++ b/src/res/e2k9/races.xml @@ -98,7 +98,7 @@ - + @@ -143,7 +143,7 @@ - + diff --git a/src/res/e2k9/weapons.xml b/src/res/e2k9/weapons.xml index 1dadff1d7..4c430ff9b 100644 --- a/src/res/e2k9/weapons.xml +++ b/src/res/e2k9/weapons.xml @@ -3,7 +3,7 @@ - + @@ -12,7 +12,7 @@ - + diff --git a/src/res/weapons/crossbow-2.xml b/src/res/weapons/crossbow-2.xml new file mode 100644 index 000000000..947facb6d --- /dev/null +++ b/src/res/weapons/crossbow-2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/src/res/weapons/mallorncrossbow-2.xml b/src/res/weapons/mallorncrossbow-2.xml new file mode 100644 index 000000000..0fd7e8ed5 --- /dev/null +++ b/src/res/weapons/mallorncrossbow-2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/src/res/weapons/rep_crossbow.xml b/src/res/weapons/rep_crossbow.xml index ad11c083b..e3c798062 100644 --- a/src/res/weapons/rep_crossbow.xml +++ b/src/res/weapons/rep_crossbow.xml @@ -7,8 +7,8 @@ - - + +