forked from github/server
eliminate old_race. make the catdragon act like a dragon.
This commit is contained in:
parent
043ff40d02
commit
a7fbe4901b
|
@ -717,7 +717,7 @@
|
|||
<attack type="4" damage="1d6"/>
|
||||
<attack type="1" damage="1d5"/>
|
||||
</race>
|
||||
<race name="catdragon" magres="0.900000" maxaura="1.000000" regaura="1.000000" recruitcost="500000" weight="20000" capacity="10000" speed="1.000000" hp="20" damage="2d40" unarmedattack="0" unarmeddefense="0" defensemodifier="50" fly="yes" walk="yes" teach="no" shapeshift="yes" giveperson="yes" getitem="yes">
|
||||
<race name="catdragon" magres="0.900000" maxaura="1.000000" regaura="1.000000" recruitcost="500000" weight="20000" capacity="10000" speed="1.000000" hp="20" damage="2d40" unarmedattack="0" unarmeddefense="0" defensemodifier="50" fly="yes" walk="yes" teach="no" shapeshift="yes" giveperson="yes" getitem="yes" dragon="yes">
|
||||
<ai splitsize="1"/>
|
||||
<attack type="4" damage="2d40"/>
|
||||
<attack type="4" damage="2d40"/>
|
||||
|
|
18
src/battle.c
18
src/battle.c
|
@ -1037,17 +1037,18 @@ static int rc_specialdamage(const unit *au, const unit *du, const struct weapon_
|
|||
{
|
||||
const race *ar = u_race(au);
|
||||
int m, modifier = 0;
|
||||
|
||||
switch (old_race(ar)) {
|
||||
case RC_HALFLING:
|
||||
if (wtype != NULL && dragonrace(u_race(du))) {
|
||||
if (wtype != NULL) {
|
||||
if (fval(u_race(du), RCF_DRAGON)) {
|
||||
static int cache;
|
||||
static race *rc_halfling;
|
||||
if (rc_changed(&cache)) {
|
||||
rc_halfling = get_race(RC_HALFLING);
|
||||
}
|
||||
if (ar == rc_halfling) {
|
||||
modifier += 5;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (wtype != NULL && wtype->modifiers != NULL) {
|
||||
if (wtype->modifiers != NULL) {
|
||||
for (m = 0; wtype->modifiers[m].value; ++m) {
|
||||
/* weapon damage for this weapon, possibly by race */
|
||||
if (wtype->modifiers[m].flags & WMF_DAMAGE) {
|
||||
|
@ -1065,6 +1066,7 @@ static int rc_specialdamage(const unit *au, const unit *du, const struct weapon_
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return modifier;
|
||||
}
|
||||
|
||||
|
|
|
@ -114,6 +114,8 @@ static void recruit_init(void)
|
|||
|
||||
int income(const unit * u)
|
||||
{
|
||||
// TODO: make this a property, like race.income, no hard-coding of values
|
||||
if (fval(u_race(u), RCF_DRAGON)) {
|
||||
switch (old_race(u_race(u))) {
|
||||
case RC_FIREDRAGON:
|
||||
return 150 * u->number;
|
||||
|
@ -122,8 +124,10 @@ int income(const unit * u)
|
|||
case RC_WYRM:
|
||||
return 5000 * u->number;
|
||||
default:
|
||||
return 20 * u->number;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 20 * u->number;
|
||||
}
|
||||
|
||||
static void scramble(void *data, unsigned int n, size_t width)
|
||||
|
@ -478,7 +482,7 @@ static void recruit(unit * u, struct order *ord, request ** recruitorders)
|
|||
|
||||
init_order(ord);
|
||||
n = getint();
|
||||
if (n<=0) {
|
||||
if (n <= 0) {
|
||||
syntax_error(u, ord);
|
||||
return;
|
||||
}
|
||||
|
@ -1276,7 +1280,7 @@ attrib_allocation(const resource_type * rtype, region * r, allocation * alist)
|
|||
}
|
||||
|
||||
typedef void(*allocate_function) (const resource_type *, struct region *,
|
||||
struct allocation *);
|
||||
struct allocation *);
|
||||
|
||||
static allocate_function get_allocator(const struct resource_type *rtype)
|
||||
{
|
||||
|
@ -1687,7 +1691,7 @@ static void buy(unit * u, request ** buyorders, struct order *ord)
|
|||
kwd = init_order(ord);
|
||||
assert(kwd == K_BUY);
|
||||
n = getint();
|
||||
if (n<=0) {
|
||||
if (n <= 0) {
|
||||
cmistake(u, ord, 26, MSG_COMMERCE);
|
||||
return;
|
||||
}
|
||||
|
@ -2218,7 +2222,7 @@ static void plant(unit * u, int raw)
|
|||
/* Alles ok. Abziehen. */
|
||||
use_pooled(u, rt_water, GET_DEFAULT, 1);
|
||||
use_pooled(u, itype->rtype, GET_DEFAULT, n);
|
||||
rsetherbs(r, (short) (rherbs(r) + planted));
|
||||
rsetherbs(r, (short)(rherbs(r) + planted));
|
||||
ADDMSG(&u->faction->msgs, msg_message("plant", "unit region amount herb",
|
||||
u, r, planted, itype->rtype));
|
||||
}
|
||||
|
@ -2536,7 +2540,7 @@ static void steal_cmd(unit * u, struct order *ord, request ** stealorders)
|
|||
return;
|
||||
}
|
||||
id = read_unitid(u->faction, r);
|
||||
if (id>0) {
|
||||
if (id > 0) {
|
||||
u2 = findunitr(r, id);
|
||||
}
|
||||
if (u2 && u2->region == u->region) {
|
||||
|
|
30
src/guard.c
30
src/guard.c
|
@ -67,28 +67,34 @@ void update_guards(void)
|
|||
|
||||
unsigned int guard_flags(const unit * u)
|
||||
{
|
||||
// TODO: this should be a property of the race, like race.guard_flags
|
||||
static int rc_cache;
|
||||
static race *rc_elf, *rc_ent, *rc_ironkeeper;
|
||||
const race *rc = u_race(u);
|
||||
unsigned int flags =
|
||||
GUARD_CREWS | GUARD_LANDING | GUARD_TRAVELTHRU | GUARD_TAX;
|
||||
// TODO: configuration, not define
|
||||
#if GUARD_DISABLES_PRODUCTION == 1
|
||||
flags |= GUARD_PRODUCE;
|
||||
#endif
|
||||
#if GUARD_DISABLES_RECRUIT == 1
|
||||
flags |= GUARD_RECRUIT;
|
||||
#endif
|
||||
switch (old_race(u_race(u))) {
|
||||
case RC_ELF:
|
||||
if (u->faction->race != u_race(u))
|
||||
break;
|
||||
/* else fallthrough */
|
||||
case RC_TREEMAN:
|
||||
if (rc_changed(&rc_cache)) {
|
||||
rc_elf = get_race(RC_ELF);
|
||||
rc_ent = get_race(RC_TREEMAN);
|
||||
rc_ironkeeper = get_race(RC_IRONKEEPER);
|
||||
}
|
||||
if (rc == rc_elf) {
|
||||
if (u->faction->race == u_race(u)) {
|
||||
flags |= GUARD_TREES;
|
||||
break;
|
||||
case RC_IRONKEEPER:
|
||||
}
|
||||
}
|
||||
else if (rc == rc_ent) {
|
||||
flags |= GUARD_TREES;
|
||||
}
|
||||
else if (rc == rc_ironkeeper) {
|
||||
flags = GUARD_MINING;
|
||||
break;
|
||||
default:
|
||||
/* TODO: This should be configuration variables, all of it */
|
||||
break;
|
||||
}
|
||||
return flags;
|
||||
}
|
||||
|
|
|
@ -244,7 +244,7 @@ extern "C" {
|
|||
#define omniscient(f) ((f)->race==get_race(RC_ILLUSION) || (f)->race==get_race(RC_TEMPLATE))
|
||||
|
||||
#define playerrace(rc) (!fval((rc), RCF_NPC))
|
||||
#define dragonrace(rc) ((rc) == get_race(RC_FIREDRAGON) || (rc) == get_race(RC_DRAGON) || (rc) == get_race(RC_WYRM) || (rc) == get_race(RC_BIRTHDAYDRAGON))
|
||||
#define dragonrace(rc) (fval(rc, RCF_DRAGON))
|
||||
#define humanoidrace(rc) (fval((rc), RCF_UNDEAD) || (rc)==get_race(RC_DRACOID) || playerrace(rc))
|
||||
#define illusionaryrace(rc) (fval(rc, RCF_ILLUSIONARY))
|
||||
|
||||
|
|
Loading…
Reference in New Issue