forked from github/server
CID 26256: (NULL_RETURNS)
This commit is contained in:
parent
833a1e70be
commit
0a67d53264
1 changed files with 10 additions and 8 deletions
18
src/battle.c
18
src/battle.c
|
@ -971,15 +971,17 @@ void drain_exp(struct unit *u, int n)
|
||||||
}
|
}
|
||||||
if (sk != NOSKILL) {
|
if (sk != NOSKILL) {
|
||||||
skill *sv = unit_skill(u, sk);
|
skill *sv = unit_skill(u, sk);
|
||||||
while (n > 0) {
|
if (sv) {
|
||||||
if (n >= 30 * u->number) {
|
while (n > 0) {
|
||||||
reduce_skill(u, sv, 1);
|
if (n >= 30 * u->number) {
|
||||||
n -= 30;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (rng_int() % (30 * u->number) < n)
|
|
||||||
reduce_skill(u, sv, 1);
|
reduce_skill(u, sv, 1);
|
||||||
n = 0;
|
n -= 30;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (rng_int() % (30 * u->number) < n)
|
||||||
|
reduce_skill(u, sv, 1);
|
||||||
|
n = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue