- new rule for WoL

- no damage for drifting ships
- finish delayed potions
- new natural armor rule
- better crossbows
This commit is contained in:
Enno Rehling 2009-06-26 03:42:39 +00:00
parent 6a6df68b5d
commit bb2397e141
12 changed files with 102 additions and 37 deletions

View File

@ -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 (holz<tree_count*amount) {
int x = holz/tree_count;
if (holz%tree_count) ++x;
if (x<amount) amount = x;
}
rsettrees(r, 1, rtrees(r, 1) + holz);
rsettrees(r, tree_type, rtrees(r, tree_type) + holz);
ADDMSG(&u->faction->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);

View File

@ -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);

View File

@ -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;
}

View File

@ -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");

View File

@ -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;

View File

@ -133,7 +133,9 @@
<param name="rules.check_overload" value="0"/>
<param name="rules.combat.goblinbonus" value="3"/>
<param name="rules.ship.capacity" value="1"/> <!-- -->
<param name="rules.ship.damage_drift" value="0.00"/> <!-- percent damage from drifting-->
<param name="rules.alliances" value="1"/>
<param name="rules.combat.nat_armor" value="1"/>
<param name="rules.combat.herospeed" value="3"/>
<param name="rules.combat.demon_vampire" value="5"/> <!-- regen 1 hp per X points of damage done -->
<param name="rules.combat.skill_bonus" value="0"/>
@ -143,6 +145,7 @@
<param name="rules.cavalry.mode" value="1"/>
<param name="rules.magic.multipotion" value="1"/>
<param name="rules.magic.wol_effect" value="5"/>
<param name="rules.magic.wol_type" value="2"/>
<param name="rules.magic.common" value="tybied"/> <!-- tybied spells can be cast by anyone -->
<param name="rules.magic.elfpower" value="1"/> <!-- elves get ring-of-power bonus in a forest -->
<param name="rules.magic.playerschools" value="gwyrrd illaun draig cerddor"/>

View File

@ -3,11 +3,11 @@
<!-- equipment given to new units -->
<set name="new_demon_unit">
<skill name="stamina" level="6"/>
<!--skill name="stamina" level="6"/-->
</set>
<set name="new_troll_unit">
<skill name="stamina" level="2"/>
<!--skill name="stamina" level="2"/-->
</set>
<set name="seaserpent_spoils">

View File

@ -98,7 +98,7 @@
<!-- begin secondary races -->
<race name="demon" magres="0.150000" maxaura="1.0" regaura="1.1" recruitcost="360" maintenance="10" weight="1000" capacity="540" speed="1.0" hp="20" ac="2" damage="1d5" unarmedattack="-2" unarmeddefense="-2" playerrace="yes" walk="yes" shapeshift="yes" giveitem="yes" giveperson="yes" giveunit="yes" getitem="yes" recruitethereal="yes" equipment="yes">
<race name="demon" magres="0.150000" maxaura="1.0" regaura="1.1" recruitcost="360" maintenance="10" weight="1000" capacity="540" speed="1.0" hp="30" ac="2" damage="1d5" unarmedattack="-2" unarmeddefense="-2" playerrace="yes" walk="yes" shapeshift="yes" giveitem="yes" giveperson="yes" giveunit="yes" getitem="yes" recruitethereal="yes" equipment="yes">
<ai splitsize="10000" moverandom="yes" learn="yes"/>
<function name="itemdrop" value="defaultdrops"/>
<skill name="cartmaking" modifier="-2"/>
@ -143,7 +143,7 @@
<race name="troll" magres="0.100000" maxaura="1.0" regaura="1.0" recruitcost="260" maintenance="10" weight="2000" capacity="1080" speed="1.0" hp="20" ac="1" damage="1d5+3" unarmedattack="-2" unarmeddefense="-2" playerrace="yes" walk="yes" giveitem="yes" giveperson="yes" giveunit="yes" getitem="yes" equipment="yes">
<ai splitsize="10000" moverandom="yes" learn="yes"/>
<function name="itemdrop" value="defaultdrops"/>
<param name="armor.stamina" value="3"/> <!-- +1 natural armor per X levels stamina -->
<param name="armor.stamina" value="4"/> <!-- +1 natural armor per X levels stamina -->
<skill name="armorer" modifier="2"/>
<skill name="bow" modifier="-2"/>
<skill name="building" modifier="2"/>

View File

@ -3,7 +3,7 @@
<xi:include href="../weapons/axe.xml"/>
<xi:include href="../weapons/bow.xml"/>
<xi:include href="../weapons/catapult.xml"/>
<xi:include href="../weapons/crossbow.xml"/>
<xi:include href="../weapons/crossbow-2.xml"/>
<xi:include href="../weapons/rep_crossbow.xml"/>
<xi:include href="../weapons/firesword.xml"/>
<xi:include href="../weapons/greatbow-2.xml"/>
@ -12,7 +12,7 @@
<xi:include href="../weapons/laensword-2.xml"/>
<xi:include href="../weapons/lance.xml"/>
<xi:include href="../weapons/mallornbow.xml"/>
<xi:include href="../weapons/mallorncrossbow.xml"/>
<xi:include href="../weapons/mallorncrossbow-2.xml"/>
<xi:include href="../weapons/mallornlance.xml"/>
<xi:include href="../weapons/mallornspear.xml"/>
<xi:include href="../weapons/runesword.xml"/>

View File

@ -0,0 +1,13 @@
<?xml version="1.0"?>
<resource name="crossbow">
<item weight="100">
<construction skill="weaponsmithing" minskill="3" reqsize="1">
<requirement type="log" quantity="1"/>
</construction>
<weapon armorpiercing="true" pierce="true" missile="true" skill="crossbow" offmod="0" defmod="0" reload="2">
<damage type="rider" value="3d4+5"/>
<damage type="footman" value="3d4+5"/>
<modifier type="missile_target" value="2"/>
</weapon>
</item>
</resource>

View File

@ -0,0 +1,13 @@
<?xml version="1.0"?>
<resource name="mallorncrossbow">
<item weight="100">
<construction skill="weaponsmithing" minskill="5" reqsize="1">
<requirement type="mallorn" quantity="1"/>
</construction>
<weapon armorpiercing="true" pierce="true" missile="true" skill="crossbow" offmod="0" defmod="0" reload="2" magres="0.15">
<damage type="rider" value="3d4+6"/>
<damage type="footman" value="3d4+6"/>
<modifier type="missile_target" value="2"/>
</weapon>
</item>
</resource>

View File

@ -7,8 +7,8 @@
<requirement type="log" quantity="1"/>
</construction>
<weapon armorpiercing="true" pierce="true" missile="true" skill="crossbow" offmod="0" defmod="0" reload="1">
<damage type="rider" value="4d3+3"/>
<damage type="footman" value="4d3+3"/>
<damage type="rider" value="3d4+5"/>
<damage type="footman" value="3d4+5"/>
<modifier type="missile_target" value="2"/>
</weapon>
</item>