- vampirism

- stamina -> nat. armor
This commit is contained in:
Enno Rehling 2009-06-05 22:54:50 +00:00
parent b0195fa4e6
commit e939b5fdc9
5 changed files with 47 additions and 2 deletions

View file

@ -1022,6 +1022,41 @@ rel_dam(int dam, int hp)
return "eine kleine Wunde";
}
static void vampirism(troop at, int damage)
{
static int vampire = -1;
if (vampire<0) vampire = get_param_int(global.parameters, "rules.combat.demon_vampire", 0);
if (vampire>0) {
int gain = damage/vampire;
int chance = damage - vampire * gain;
if (chance>0 && (rng_int() % vampire < chance)) ++gain;
if (gain>0) {
int maxhp = unit_max_hp(at.fighter->unit);
at.fighter->person[at.index].hp = MIN(gain+at.fighter->person[at.index].hp, maxhp);
}
}
}
static int
natural_armor(unit * du)
{
static int * bonus = 0;
int an = du->race->armor;
if (bonus==0) {
bonus = calloc(sizeof(int), num_races);
}
if (bonus[du->race->index]==0) {
bonus[du->race->index] = get_param_int(du->race->parameters, "armor.stamina", -1);
if (bonus[du->race->index]==0) bonus[du->race->index] = -1;
}
if (bonus[du->race->index]>0) {
int sk = effskill(du, SK_STAMINA);
sk /= bonus[du->race->index];
an += sk;
}
return an;
}
boolean
terminate(troop dt, troop at, int type, const char *damage, boolean missile)
{
@ -1097,7 +1132,7 @@ terminate(troop dt, troop at, int type, const char *damage, boolean missile)
}
/* natürliche Rüstung */
an = du->race->armor;
an = natural_armor(du);
/* magische Rüstung durch Artefakte oder Sprüche */
/* Momentan nur Trollgürtel und Werwolf-Eigenschaft */
@ -1243,6 +1278,9 @@ terminate(troop dt, troop at, int type, const char *damage, boolean missile)
assert(dt.index<du->number);
df->person[dt.index].hp -= rda;
if (au->race==new_race[RC_DAEMON]) {
vampirism(at, rda);
}
if (df->person[dt.index].hp > 0) { /* Hat überlebt */
if (bdebug) {

View file

@ -64,6 +64,7 @@
/** external variables **/
race * races;
int num_races = 0;
race_list *
get_familiarraces(void)
@ -131,6 +132,7 @@ rc_new(const char * zName)
race *
rc_add(race * rc)
{
rc->index = num_races++;
rc->next = races;
return races = rc;
}

View file

@ -52,6 +52,8 @@ typedef struct att {
struct param;
extern int num_races;
typedef struct race {
struct param * parameters;
const char *_name[4]; /* neu: name[4]völker */
@ -59,6 +61,7 @@ typedef struct race {
float maxaura; /* Faktor auf Maximale Aura */
float regaura; /* Faktor auf Regeneration */
float recruit_multi; /* Faktor für Bauernverbrauch */
int index;
int recruitcost;
int maintenance;
int splitsize;

View file

@ -129,6 +129,7 @@
<param name="rules.check_overload" value="0"/>
<param name="rules.alliances" 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"/>
<param name="rules.combat.loot" value="3"/> <!-- only self + monsters -->
<param name="rules.cavalry.skill" value="4"/>

View file

@ -84,7 +84,7 @@
<skill name="building" modifier="1"/>
<skill name="cartmaking" modifier="2"/>
<skill name="catapult" modifier="-1"/>
<skill name="crossbow" modifier="1"/>
<skill name="crossbow" modifier="2"/>
<skill name="herbalism" modifier="2"/>
<skill name="melee" modifier="-1"/>
<skill name="mining" modifier="1"/>
@ -151,6 +151,7 @@
<race name="troll" magres="0.100000" maxaura="1.0" regaura="1.0" recruitcost="100" 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 -->
<skill name="armorer" modifier="2"/>
<skill name="bow" modifier="-2"/>
<skill name="building" modifier="2"/>