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="4" damage="1d6"/>
|
||||||
<attack type="1" damage="1d5"/>
|
<attack type="1" damage="1d5"/>
|
||||||
</race>
|
</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"/>
|
<ai splitsize="1"/>
|
||||||
<attack type="4" damage="2d40"/>
|
<attack type="4" damage="2d40"/>
|
||||||
<attack type="4" damage="2d40"/>
|
<attack type="4" damage="2d40"/>
|
||||||
|
|
46
src/battle.c
46
src/battle.c
|
@ -1037,31 +1037,33 @@ static int rc_specialdamage(const unit *au, const unit *du, const struct weapon_
|
||||||
{
|
{
|
||||||
const race *ar = u_race(au);
|
const race *ar = u_race(au);
|
||||||
int m, modifier = 0;
|
int m, modifier = 0;
|
||||||
|
if (wtype != NULL) {
|
||||||
switch (old_race(ar)) {
|
if (fval(u_race(du), RCF_DRAGON)) {
|
||||||
case RC_HALFLING:
|
static int cache;
|
||||||
if (wtype != NULL && dragonrace(u_race(du))) {
|
static race *rc_halfling;
|
||||||
modifier += 5;
|
if (rc_changed(&cache)) {
|
||||||
|
rc_halfling = get_race(RC_HALFLING);
|
||||||
|
}
|
||||||
|
if (ar == rc_halfling) {
|
||||||
|
modifier += 5;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
if (wtype->modifiers != NULL) {
|
||||||
default:
|
for (m = 0; wtype->modifiers[m].value; ++m) {
|
||||||
break;
|
/* weapon damage for this weapon, possibly by race */
|
||||||
}
|
if (wtype->modifiers[m].flags & WMF_DAMAGE) {
|
||||||
if (wtype != NULL && wtype->modifiers != NULL) {
|
race_list *rlist = wtype->modifiers[m].races;
|
||||||
for (m = 0; wtype->modifiers[m].value; ++m) {
|
if (rlist != NULL) {
|
||||||
/* weapon damage for this weapon, possibly by race */
|
while (rlist) {
|
||||||
if (wtype->modifiers[m].flags & WMF_DAMAGE) {
|
if (rlist->data == ar)
|
||||||
race_list *rlist = wtype->modifiers[m].races;
|
break;
|
||||||
if (rlist != NULL) {
|
rlist = rlist->next;
|
||||||
while (rlist) {
|
}
|
||||||
if (rlist->data == ar)
|
if (rlist == NULL)
|
||||||
break;
|
continue;
|
||||||
rlist = rlist->next;
|
|
||||||
}
|
}
|
||||||
if (rlist == NULL)
|
modifier += wtype->modifiers[m].value;
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
modifier += wtype->modifiers[m].value;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,16 +114,20 @@ static void recruit_init(void)
|
||||||
|
|
||||||
int income(const unit * u)
|
int income(const unit * u)
|
||||||
{
|
{
|
||||||
switch (old_race(u_race(u))) {
|
// TODO: make this a property, like race.income, no hard-coding of values
|
||||||
case RC_FIREDRAGON:
|
if (fval(u_race(u), RCF_DRAGON)) {
|
||||||
return 150 * u->number;
|
switch (old_race(u_race(u))) {
|
||||||
case RC_DRAGON:
|
case RC_FIREDRAGON:
|
||||||
return 1000 * u->number;
|
return 150 * u->number;
|
||||||
case RC_WYRM:
|
case RC_DRAGON:
|
||||||
return 5000 * u->number;
|
return 1000 * u->number;
|
||||||
default:
|
case RC_WYRM:
|
||||||
return 20 * u->number;
|
return 5000 * u->number;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return 20 * u->number;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void scramble(void *data, unsigned int n, size_t width)
|
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);
|
init_order(ord);
|
||||||
n = getint();
|
n = getint();
|
||||||
if (n<=0) {
|
if (n <= 0) {
|
||||||
syntax_error(u, ord);
|
syntax_error(u, ord);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -796,7 +800,7 @@ static int maintain(building * b)
|
||||||
|
|
||||||
cost -=
|
cost -=
|
||||||
use_pooled(u, m->rtype, GET_SLACK | GET_RESERVE | GET_POOLED_SLACK,
|
use_pooled(u, m->rtype, GET_SLACK | GET_RESERVE | GET_POOLED_SLACK,
|
||||||
cost);
|
cost);
|
||||||
assert(cost == 0);
|
assert(cost == 0);
|
||||||
}
|
}
|
||||||
if (work) {
|
if (work) {
|
||||||
|
@ -815,7 +819,7 @@ void maintain_buildings(region * r)
|
||||||
while (*bp) {
|
while (*bp) {
|
||||||
building *b = *bp;
|
building *b = *bp;
|
||||||
int flags = BLD_MAINTAINED;
|
int flags = BLD_MAINTAINED;
|
||||||
|
|
||||||
if (!curse_active(get_curse(b->attribs, nocost_ct))) {
|
if (!curse_active(get_curse(b->attribs, nocost_ct))) {
|
||||||
flags = maintain(b);
|
flags = maintain(b);
|
||||||
}
|
}
|
||||||
|
@ -929,12 +933,12 @@ static void manufacture(unit * u, const item_type * itype, int want)
|
||||||
case EBUILDINGREQ:
|
case EBUILDINGREQ:
|
||||||
ADDMSG(&u->faction->msgs,
|
ADDMSG(&u->faction->msgs,
|
||||||
msg_feedback(u, u->thisorder, "building_needed", "building",
|
msg_feedback(u, u->thisorder, "building_needed", "building",
|
||||||
itype->construction->btype->_name));
|
itype->construction->btype->_name));
|
||||||
return;
|
return;
|
||||||
case ELOWSKILL:
|
case ELOWSKILL:
|
||||||
ADDMSG(&u->faction->msgs,
|
ADDMSG(&u->faction->msgs,
|
||||||
msg_feedback(u, u->thisorder, "manufacture_skills",
|
msg_feedback(u, u->thisorder, "manufacture_skills",
|
||||||
"skill minskill product", sk, minskill, itype->rtype, 1));
|
"skill minskill product", sk, minskill, itype->rtype, 1));
|
||||||
return;
|
return;
|
||||||
case ENOMATERIALS:
|
case ENOMATERIALS:
|
||||||
ADDMSG(&u->faction->msgs, msg_materials_required(u, u->thisorder,
|
ADDMSG(&u->faction->msgs, msg_materials_required(u, u->thisorder,
|
||||||
|
@ -1077,8 +1081,8 @@ static void allocate_resource(unit * u, const resource_type * rtype, int want)
|
||||||
skill_t sk = itype->construction->skill;
|
skill_t sk = itype->construction->skill;
|
||||||
add_message(&u->faction->msgs,
|
add_message(&u->faction->msgs,
|
||||||
msg_feedback(u, u->thisorder, "manufacture_skills",
|
msg_feedback(u, u->thisorder, "manufacture_skills",
|
||||||
"skill minskill product", sk, itype->construction->minskill,
|
"skill minskill product", sk, itype->construction->minskill,
|
||||||
itype->rtype));
|
itype->rtype));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -1276,7 +1280,7 @@ attrib_allocation(const resource_type * rtype, region * r, allocation * alist)
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef void(*allocate_function) (const resource_type *, struct region *,
|
typedef void(*allocate_function) (const resource_type *, struct region *,
|
||||||
struct allocation *);
|
struct allocation *);
|
||||||
|
|
||||||
static allocate_function get_allocator(const struct resource_type *rtype)
|
static allocate_function get_allocator(const struct resource_type *rtype)
|
||||||
{
|
{
|
||||||
|
@ -1345,7 +1349,7 @@ static void create_potion(unit * u, const potion_type * ptype, int want)
|
||||||
case EBUILDINGREQ:
|
case EBUILDINGREQ:
|
||||||
ADDMSG(&u->faction->msgs,
|
ADDMSG(&u->faction->msgs,
|
||||||
msg_feedback(u, u->thisorder, "building_needed", "building",
|
msg_feedback(u, u->thisorder, "building_needed", "building",
|
||||||
ptype->itype->construction->btype->_name));
|
ptype->itype->construction->btype->_name));
|
||||||
break;
|
break;
|
||||||
case ECOMPLETE:
|
case ECOMPLETE:
|
||||||
assert(0);
|
assert(0);
|
||||||
|
@ -1687,7 +1691,7 @@ static void buy(unit * u, request ** buyorders, struct order *ord)
|
||||||
kwd = init_order(ord);
|
kwd = init_order(ord);
|
||||||
assert(kwd == K_BUY);
|
assert(kwd == K_BUY);
|
||||||
n = getint();
|
n = getint();
|
||||||
if (n<=0) {
|
if (n <= 0) {
|
||||||
cmistake(u, ord, 26, MSG_COMMERCE);
|
cmistake(u, ord, 26, MSG_COMMERCE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -2082,7 +2086,7 @@ static bool sell(unit * u, request ** sellorders, struct order *ord)
|
||||||
* produktion, wo für jedes produkt einzeln eine obere limite
|
* produktion, wo für jedes produkt einzeln eine obere limite
|
||||||
* existiert, so dass man arrays von orders machen kann. */
|
* existiert, so dass man arrays von orders machen kann. */
|
||||||
|
|
||||||
/* Ein Händler kann nur 10 Güter pro Talentpunkt handeln. */
|
/* Ein Händler kann nur 10 Güter pro Talentpunkt handeln. */
|
||||||
k = u->number * 10 * effskill(u, SK_TRADE, 0);
|
k = u->number * 10 * effskill(u, SK_TRADE, 0);
|
||||||
|
|
||||||
/* hat der Händler bereits gehandelt, muss die Menge der bereits
|
/* hat der Händler bereits gehandelt, muss die Menge der bereits
|
||||||
|
@ -2188,7 +2192,7 @@ static void plant(unit * u, int raw)
|
||||||
if (skill < 6) {
|
if (skill < 6) {
|
||||||
ADDMSG(&u->faction->msgs,
|
ADDMSG(&u->faction->msgs,
|
||||||
msg_feedback(u, u->thisorder, "plant_skills",
|
msg_feedback(u, u->thisorder, "plant_skills",
|
||||||
"skill minskill product", SK_HERBALISM, 6, itype->rtype, 1));
|
"skill minskill product", SK_HERBALISM, 6, itype->rtype, 1));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* Wasser des Lebens prüfen */
|
/* Wasser des Lebens prüfen */
|
||||||
|
@ -2202,7 +2206,7 @@ static void plant(unit * u, int raw)
|
||||||
if (n == 0) {
|
if (n == 0) {
|
||||||
ADDMSG(&u->faction->msgs,
|
ADDMSG(&u->faction->msgs,
|
||||||
msg_feedback(u, u->thisorder, "resource_missing", "missing",
|
msg_feedback(u, u->thisorder, "resource_missing", "missing",
|
||||||
itype->rtype));
|
itype->rtype));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2218,7 +2222,7 @@ static void plant(unit * u, int raw)
|
||||||
/* Alles ok. Abziehen. */
|
/* Alles ok. Abziehen. */
|
||||||
use_pooled(u, rt_water, GET_DEFAULT, 1);
|
use_pooled(u, rt_water, GET_DEFAULT, 1);
|
||||||
use_pooled(u, itype->rtype, GET_DEFAULT, n);
|
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",
|
ADDMSG(&u->faction->msgs, msg_message("plant", "unit region amount herb",
|
||||||
u, r, planted, itype->rtype));
|
u, r, planted, itype->rtype));
|
||||||
}
|
}
|
||||||
|
@ -2241,13 +2245,13 @@ static void planttrees(unit * u, int raw)
|
||||||
if (skill < 6) {
|
if (skill < 6) {
|
||||||
ADDMSG(&u->faction->msgs,
|
ADDMSG(&u->faction->msgs,
|
||||||
msg_feedback(u, u->thisorder, "plant_skills",
|
msg_feedback(u, u->thisorder, "plant_skills",
|
||||||
"skill minskill product", SK_HERBALISM, 6, rtype, 1));
|
"skill minskill product", SK_HERBALISM, 6, rtype, 1));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (fval(r, RF_MALLORN) && skill < 7) {
|
if (fval(r, RF_MALLORN) && skill < 7) {
|
||||||
ADDMSG(&u->faction->msgs,
|
ADDMSG(&u->faction->msgs,
|
||||||
msg_feedback(u, u->thisorder, "plant_skills",
|
msg_feedback(u, u->thisorder, "plant_skills",
|
||||||
"skill minskill product", SK_HERBALISM, 7, rtype, 1));
|
"skill minskill product", SK_HERBALISM, 7, rtype, 1));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2284,7 +2288,7 @@ static void breedtrees(unit * u, int raw)
|
||||||
int current_season;
|
int current_season;
|
||||||
region *r = u->region;
|
region *r = u->region;
|
||||||
gamedate date;
|
gamedate date;
|
||||||
|
|
||||||
get_gamedate(turn, &date);
|
get_gamedate(turn, &date);
|
||||||
current_season = date.season;
|
current_season = date.season;
|
||||||
|
|
||||||
|
@ -2536,7 +2540,7 @@ static void steal_cmd(unit * u, struct order *ord, request ** stealorders)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
id = read_unitid(u->faction, r);
|
id = read_unitid(u->faction, r);
|
||||||
if (id>0) {
|
if (id > 0) {
|
||||||
u2 = findunitr(r, id);
|
u2 = findunitr(r, id);
|
||||||
}
|
}
|
||||||
if (u2 && u2->region == u->region) {
|
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)
|
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 =
|
unsigned int flags =
|
||||||
GUARD_CREWS | GUARD_LANDING | GUARD_TRAVELTHRU | GUARD_TAX;
|
GUARD_CREWS | GUARD_LANDING | GUARD_TRAVELTHRU | GUARD_TAX;
|
||||||
|
// TODO: configuration, not define
|
||||||
#if GUARD_DISABLES_PRODUCTION == 1
|
#if GUARD_DISABLES_PRODUCTION == 1
|
||||||
flags |= GUARD_PRODUCE;
|
flags |= GUARD_PRODUCE;
|
||||||
#endif
|
#endif
|
||||||
#if GUARD_DISABLES_RECRUIT == 1
|
#if GUARD_DISABLES_RECRUIT == 1
|
||||||
flags |= GUARD_RECRUIT;
|
flags |= GUARD_RECRUIT;
|
||||||
#endif
|
#endif
|
||||||
switch (old_race(u_race(u))) {
|
if (rc_changed(&rc_cache)) {
|
||||||
case RC_ELF:
|
rc_elf = get_race(RC_ELF);
|
||||||
if (u->faction->race != u_race(u))
|
rc_ent = get_race(RC_TREEMAN);
|
||||||
break;
|
rc_ironkeeper = get_race(RC_IRONKEEPER);
|
||||||
/* else fallthrough */
|
}
|
||||||
case RC_TREEMAN:
|
if (rc == rc_elf) {
|
||||||
|
if (u->faction->race == u_race(u)) {
|
||||||
|
flags |= GUARD_TREES;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (rc == rc_ent) {
|
||||||
flags |= GUARD_TREES;
|
flags |= GUARD_TREES;
|
||||||
break;
|
}
|
||||||
case RC_IRONKEEPER:
|
else if (rc == rc_ironkeeper) {
|
||||||
flags = GUARD_MINING;
|
flags = GUARD_MINING;
|
||||||
break;
|
|
||||||
default:
|
|
||||||
/* TODO: This should be configuration variables, all of it */
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return flags;
|
return flags;
|
||||||
}
|
}
|
||||||
|
|
|
@ -244,7 +244,7 @@ extern "C" {
|
||||||
#define omniscient(f) ((f)->race==get_race(RC_ILLUSION) || (f)->race==get_race(RC_TEMPLATE))
|
#define omniscient(f) ((f)->race==get_race(RC_ILLUSION) || (f)->race==get_race(RC_TEMPLATE))
|
||||||
|
|
||||||
#define playerrace(rc) (!fval((rc), RCF_NPC))
|
#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 humanoidrace(rc) (fval((rc), RCF_UNDEAD) || (rc)==get_race(RC_DRACOID) || playerrace(rc))
|
||||||
#define illusionaryrace(rc) (fval(rc, RCF_ILLUSIONARY))
|
#define illusionaryrace(rc) (fval(rc, RCF_ILLUSIONARY))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue