forked from github/server
Peniblere skillchecks.
Bugfix für die Dämonen. Retro-Fix für die Auswertung fehlt noch, kommt morgen. Bugfix 0-hp Personen in Vulkaneruptionen.
This commit is contained in:
parent
40cc9a2d9a
commit
0faa820456
|
@ -2168,7 +2168,7 @@ display_item(faction *f, unit *u, const item_type * itype)
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char t[NAMESIZE + 1];
|
char t[NAMESIZE + 1];
|
||||||
char filename[MAX_PATH];
|
char filename[MAX_PATH];
|
||||||
const char *name, *info;
|
const char *name;
|
||||||
|
|
||||||
if (u && *i_find(&u->items, itype) == NULL) return false;
|
if (u && *i_find(&u->items, itype) == NULL) return false;
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -728,7 +728,6 @@ volcano_outbreak(region *r)
|
||||||
attrib *a;
|
attrib *a;
|
||||||
region *rn;
|
region *rn;
|
||||||
unit *u, **up;
|
unit *u, **up;
|
||||||
int dead;
|
|
||||||
faction *f;
|
faction *f;
|
||||||
|
|
||||||
for (u=r->units; u; u=u->next) {
|
for (u=r->units; u; u=u->next) {
|
||||||
|
@ -759,7 +758,7 @@ volcano_outbreak(region *r)
|
||||||
|
|
||||||
for (up=&r->units; *up;) {
|
for (up=&r->units; *up;) {
|
||||||
unit * u = *up;
|
unit * u = *up;
|
||||||
dead = damage_unit(u, "4d10", true, false);
|
int dead = damage_unit(u, "4d10", true, false);
|
||||||
if (dead) {
|
if (dead) {
|
||||||
ADDMSG(&u->faction->msgs, new_message(u->faction,
|
ADDMSG(&u->faction->msgs, new_message(u->faction,
|
||||||
"volcano_dead%u:unit%r:region%i:dead", u, r, dead));
|
"volcano_dead%u:unit%r:region%i:dead", u, r, dead));
|
||||||
|
@ -802,7 +801,7 @@ volcano_outbreak(region *r)
|
||||||
/* Personen bekommen 3W10 Punkte Schaden. */
|
/* Personen bekommen 3W10 Punkte Schaden. */
|
||||||
for (up=&rn->units; *up;) {
|
for (up=&rn->units; *up;) {
|
||||||
unit * u = *up;
|
unit * u = *up;
|
||||||
dead = damage_unit(u, "3d10", true, false);
|
int dead = damage_unit(u, "3d10", true, false);
|
||||||
if (dead) {
|
if (dead) {
|
||||||
ADDMSG(&u->faction->msgs, new_message(u->faction,
|
ADDMSG(&u->faction->msgs, new_message(u->faction,
|
||||||
"volcano_dead%u:unit%r:region%i:dead", u, rn, dead));
|
"volcano_dead%u:unit%r:region%i:dead", u, rn, dead));
|
||||||
|
@ -1136,11 +1135,7 @@ randomevents(void)
|
||||||
* Es ist auch deshalb fast egal, weil es ja im Grunde nicht dem Dämon,
|
* Es ist auch deshalb fast egal, weil es ja im Grunde nicht dem Dämon,
|
||||||
* sondern der Region zu gute kommt - und da ist der anwender schnuppe
|
* sondern der Region zu gute kommt - und da ist der anwender schnuppe
|
||||||
*/
|
*/
|
||||||
#if SKILLPOINTS
|
|
||||||
skill_t sk;
|
|
||||||
#else
|
|
||||||
skill * sv;
|
skill * sv;
|
||||||
#endif
|
|
||||||
int dc;
|
int dc;
|
||||||
if (!bfind) {
|
if (!bfind) {
|
||||||
unit * ud = u;
|
unit * ud = u;
|
||||||
|
@ -1178,8 +1173,8 @@ randomevents(void)
|
||||||
dc = max(0, dc);
|
dc = max(0, dc);
|
||||||
sv = u->skills;
|
sv = u->skills;
|
||||||
while (sv!=u->skills+u->skill_size) {
|
while (sv!=u->skills+u->skill_size) {
|
||||||
if (rand() % 100 < 25) {
|
if (sv->level>0 && rand() % 100 < 25) {
|
||||||
int weeks = 0+rand()%3;
|
int weeks = 1+rand()%3;
|
||||||
if (rand() % 100 < 40) reduce_skill(u, sv, weeks);
|
if (rand() % 100 < 40) reduce_skill(u, sv, weeks);
|
||||||
else while (weeks--) learn_skill(u, sv->id, 1.0);
|
else while (weeks--) learn_skill(u, sv->id, 1.0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -307,6 +307,7 @@ sk_set(skill * sv, int level)
|
||||||
void
|
void
|
||||||
sk_set(skill * sv, int level)
|
sk_set(skill * sv, int level)
|
||||||
{
|
{
|
||||||
|
assert(level!=0);
|
||||||
sv->weeks = (unsigned char)skill_weeks(level);
|
sv->weeks = (unsigned char)skill_weeks(level);
|
||||||
sv->level = (unsigned char)level;
|
sv->level = (unsigned char)level;
|
||||||
}
|
}
|
||||||
|
|
|
@ -507,17 +507,21 @@ get_level(const unit * u, skill_t id)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
set_level(unit * u, skill_t id, int value)
|
set_level(unit * u, skill_t sk, int value)
|
||||||
{
|
{
|
||||||
skill * sv = u->skills;
|
skill * sv = u->skills;
|
||||||
|
if (value==0) {
|
||||||
|
remove_skill(u, sk);
|
||||||
|
return;
|
||||||
|
}
|
||||||
while (sv != u->skills + u->skill_size) {
|
while (sv != u->skills + u->skill_size) {
|
||||||
if (sv->id == id) {
|
if (sv->id == sk) {
|
||||||
sk_set(sv, value);
|
sk_set(sv, value);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
++sv;
|
++sv;
|
||||||
}
|
}
|
||||||
sk_set(add_skill(u, id), value);
|
sk_set(add_skill(u, sk), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static attrib_type at_leftship = {
|
static attrib_type at_leftship = {
|
||||||
|
@ -698,7 +702,8 @@ transfermen(unit * u, unit * u2, int n)
|
||||||
sn->weeks = (unsigned char)weeks;
|
sn->weeks = (unsigned char)weeks;
|
||||||
assert(sn->weeks>0 && sn->weeks<=sn->level*2+1);
|
assert(sn->weeks>0 && sn->weeks<=sn->level*2+1);
|
||||||
} else if (sn) {
|
} else if (sn) {
|
||||||
sk_set(sn, 0);
|
remove_skill(u2, sk);
|
||||||
|
sn = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
a = a_find(u->attribs, &at_effect);
|
a = a_find(u->attribs, &at_effect);
|
||||||
|
@ -840,6 +845,22 @@ learn_skill(unit * u, skill_t sk, double chance)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
remove_skill(unit *u, skill_t sk)
|
||||||
|
{
|
||||||
|
skill * sv = u->skills;
|
||||||
|
for (sv = u->skills; sv != u->skills + u->skill_size; ++sv) {
|
||||||
|
if (sv->id==sk) {
|
||||||
|
skill * sl = u->skills + u->skill_size - 1;
|
||||||
|
if (sl!=sv) {
|
||||||
|
*sv = *sl;
|
||||||
|
}
|
||||||
|
--u->skill_size;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
skill *
|
skill *
|
||||||
add_skill(unit * u, skill_t id)
|
add_skill(unit * u, skill_t id)
|
||||||
{
|
{
|
||||||
|
|
|
@ -111,6 +111,7 @@ extern const struct unit u_unknown;
|
||||||
extern struct unit * udestroy;
|
extern struct unit * udestroy;
|
||||||
|
|
||||||
extern struct skill * add_skill(struct unit * u, skill_t id);
|
extern struct skill * add_skill(struct unit * u, skill_t id);
|
||||||
|
extern void remove_skill(struct unit *u, skill_t sk);
|
||||||
extern struct skill * get_skill(const struct unit * u, skill_t id);
|
extern struct skill * get_skill(const struct unit * u, skill_t id);
|
||||||
extern boolean has_skill(const unit* u, skill_t sk);
|
extern boolean has_skill(const unit* u, skill_t sk);
|
||||||
|
|
||||||
|
|
|
@ -1203,6 +1203,9 @@ stats(void)
|
||||||
for (u=r->units;u;u=u->next) {
|
for (u=r->units;u;u=u->next) {
|
||||||
|
|
||||||
for (itm=u->items;itm;itm=itm->next) {
|
for (itm=u->items;itm;itm=itm->next) {
|
||||||
|
if (itm->number>10000000) {
|
||||||
|
itm->number=1;
|
||||||
|
}
|
||||||
i_change(&items, itm->type, itm->number);
|
i_change(&items, itm->type, itm->number);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue