forked from github/server
bugfix: Drachen "scare" attribut
muss mit MOD, nicht AND angewendet werden. rng_int() & 400 ist eine bekloppte Rechnung.
This commit is contained in:
parent
bd836b76e1
commit
f2ed2c892a
|
@ -48,6 +48,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include <storage.h>
|
#include <storage.h>
|
||||||
|
|
||||||
/* attrib includes */
|
/* attrib includes */
|
||||||
|
#include <attributes/attributes.h>
|
||||||
#include <attributes/raceprefix.h>
|
#include <attributes/raceprefix.h>
|
||||||
|
|
||||||
/* libc includes */
|
/* libc includes */
|
||||||
|
@ -290,10 +291,17 @@ double rc_maxaura(const race *rc) {
|
||||||
return rc->maxaura / 100.0;
|
return rc->maxaura / 100.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int rc_armor_bonus(const race *rc) {
|
int rc_armor_bonus(const race *rc)
|
||||||
|
{
|
||||||
return get_param_int(rc->parameters, "armor.stamina", 0);
|
return get_param_int(rc->parameters, "armor.stamina", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int rc_scare(const struct race *rc)
|
||||||
|
{
|
||||||
|
attrib *a = a_find(rc->attribs, &at_scare);
|
||||||
|
return a ? a->data.i : 0;
|
||||||
|
}
|
||||||
|
|
||||||
int rc_migrants_formula(const race *rc)
|
int rc_migrants_formula(const race *rc)
|
||||||
{
|
{
|
||||||
return (rc->flags&RCF_MIGRANTS) ? MIGRANTS_LOG10 : MIGRANTS_NONE;
|
return (rc->flags&RCF_MIGRANTS) ? MIGRANTS_LOG10 : MIGRANTS_NONE;
|
||||||
|
|
|
@ -189,6 +189,7 @@ extern "C" {
|
||||||
double rc_magres(const struct race *rc);
|
double rc_magres(const struct race *rc);
|
||||||
double rc_maxaura(const struct race *rc);
|
double rc_maxaura(const struct race *rc);
|
||||||
int rc_armor_bonus(const struct race *rc);
|
int rc_armor_bonus(const struct race *rc);
|
||||||
|
int rc_scare(const struct race *rc);
|
||||||
|
|
||||||
#define MIGRANTS_NONE 0
|
#define MIGRANTS_NONE 0
|
||||||
#define MIGRANTS_LOG10 1
|
#define MIGRANTS_LOG10 1
|
||||||
|
|
|
@ -31,7 +31,6 @@
|
||||||
#include "study.h"
|
#include "study.h"
|
||||||
|
|
||||||
/* attributes includes */
|
/* attributes includes */
|
||||||
#include <attributes/attributes.h>
|
|
||||||
#include <attributes/targetregion.h>
|
#include <attributes/targetregion.h>
|
||||||
#include <attributes/hate.h>
|
#include <attributes/hate.h>
|
||||||
|
|
||||||
|
@ -1013,11 +1012,11 @@ static void eaten_by_monster(unit * u)
|
||||||
int horse = -1;
|
int horse = -1;
|
||||||
const resource_type *rhorse = get_resourcetype(R_HORSE);
|
const resource_type *rhorse = get_resourcetype(R_HORSE);
|
||||||
const race *rc = u_race(u);
|
const race *rc = u_race(u);
|
||||||
attrib *a;
|
int scare;
|
||||||
|
|
||||||
a = a_find(rc->attribs, &at_scare);
|
scare = rc_scare(rc);
|
||||||
if (a) {
|
if (scare>0) {
|
||||||
n = rng_int() & a->data.i * u->number;
|
n = rng_int() % scare * u->number;
|
||||||
} else {
|
} else {
|
||||||
n = rng_int() % (u->number / 20 + 1);
|
n = rng_int() % (u->number / 20 + 1);
|
||||||
horse = 0;
|
horse = 0;
|
||||||
|
@ -1093,10 +1092,11 @@ static void scared_by_monster(unit * u)
|
||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
const race *rc = u_race(u);
|
const race *rc = u_race(u);
|
||||||
attrib *a;
|
int scare;
|
||||||
a = a_find(rc->attribs, &at_scare);
|
|
||||||
if (a) {
|
scare = rc_scare(rc);
|
||||||
n = rng_int() & a->data.i * u->number;
|
if (scare>0) {
|
||||||
|
n = rng_int() % scare * u->number;
|
||||||
} else {
|
} else {
|
||||||
n = rng_int() % (u->number / 4 + 1);
|
n = rng_int() % (u->number / 4 + 1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue