"Mit Katapulten kann man Steuern eintreiben"
- added a parameter that checks for siege-weapons.
Issue: 1453
This commit is contained in:
Enno Rehling 2008-07-04 09:19:12 +00:00
parent f1227d9957
commit fb8ec1a69f
10 changed files with 34 additions and 31 deletions

View file

@ -1305,7 +1305,7 @@ can_guard(const unit * guard, const unit * u)
{
if (fval(guard, UFL_ISNEW)) return false;
if (guard->number<=0 || !cansee(guard->faction, guard->region, u, 0)) return false;
if (besieged(guard) || !(fval(guard->race, RCF_UNARMEDGUARD) || armedmen(guard))) return false;
if (besieged(guard) || !(fval(guard->race, RCF_UNARMEDGUARD) || armedmen(guard, true))) return false;
return !alliedunit(guard, u->faction, HELP_GUARD);
}
@ -3056,33 +3056,33 @@ expandtax(region * r, request * taxorders)
void
tax_cmd(unit * u, struct order * ord, request ** taxorders)
{
/* Steuern werden noch vor der Forschung eingetrieben */
/* Steuern werden noch vor der Forschung eingetrieben */
region * r = u->region;
unit *u2;
int n;
request *o;
int max;
unit *u2;
int n;
request *o;
int max;
if (!humanoidrace(u->race) && !is_monsters(u->faction)) {
cmistake(u, ord, 228, MSG_INCOME);
return;
}
if (!humanoidrace(u->race) && !is_monsters(u->faction)) {
cmistake(u, ord, 228, MSG_INCOME);
return;
}
if (fval(u, UFL_WERE)) {
cmistake(u, ord, 228, MSG_INCOME);
return;
}
if (fval(u, UFL_WERE)) {
cmistake(u, ord, 228, MSG_INCOME);
return;
}
if (besieged(u)) {
cmistake(u, ord, 60, MSG_INCOME);
return;
}
n = armedmen(u);
if (besieged(u)) {
cmistake(u, ord, 60, MSG_INCOME);
return;
}
n = armedmen(u, false);
if (!n) {
cmistake(u, ord, 48, MSG_INCOME);
return;
}
if (!n) {
cmistake(u, ord, 48, MSG_INCOME);
return;
}
init_tokens(ord);
skip_token();

View file

@ -2423,7 +2423,7 @@ can_start_guarding(const unit * u)
{
if (u->status>=ST_FLEE) return E_GUARD_FLEEING;
if (fval(u->race, RCF_UNARMEDGUARD)) return E_GUARD_OK;
if (!armedmen(u)) return E_GUARD_UNARMED;
if (!armedmen(u, true)) return E_GUARD_UNARMED;
if (u->faction->age < NewbieImmunity()) return E_GUARD_NEWBIE;
return E_GUARD_OK;
}

View file

@ -379,7 +379,7 @@ make_summary(void)
}
s->spielerpferde += get_item(u, I_HORSE);
s->playermoney += get_money(u);
s->armed_men += armedmen(u);
s->armed_men += armedmen(u, true);
for (itm=u->items;itm;itm=itm->next) {
if (itm->type->rtype->wtype) {
s->waffen += itm->number;

View file

@ -198,7 +198,7 @@ message_faction(battle * b, faction * f, struct message * m)
}
int
armedmen(const unit * u)
armedmen(const unit * u, boolean siege_weapons)
{
item * itm;
int n = 0;
@ -211,7 +211,7 @@ armedmen(const unit * u)
* Personen minimiert */
for (itm=u->items;itm;itm=itm->next) {
const weapon_type * wtype = resource2weapon(itm->type->rtype);
if (wtype==NULL) continue;
if (wtype==NULL || (wtype->flags & WTF_SIEGE)) continue;
if (effskill(u, wtype->skill) >= 1) n += itm->number;
/* if (effskill(u, wtype->skill) >= wtype->minskill) n += itm->number; */
if (n>u->number) break;

View file

@ -233,7 +233,8 @@ siege_cmd(unit * u, order * ord)
d = 0;
}
if ((bewaffnete = armedmen(u)) == 0 && d == 0) {
bewaffnete = armedmen(u, true);
if (d == 0 && bewaffnete == 0) {
/* abbruch, falls unbewaffnet oder unfaehig, katapulte zu benutzen */
cmistake(u, ord, 80, MSG_EVENT);
return;

View file

@ -170,7 +170,7 @@ extern struct faction *factions;
void addstrlist(strlist ** SP, const char *s);
int armedmen(const struct unit * u);
int armedmen(const struct unit * u, boolean siege_weapons);
unsigned int atoip(const char *s);
unsigned int getuint(void);

View file

@ -192,6 +192,7 @@ typedef struct armor_type {
#define WTF_PIERCE 0x04
#define WTF_CUT 0x08
#define WTF_BLUNT 0x10
#define WTF_SIEGE 0x20
#define WTF_ARMORPIERCING 0x40 /* armor has only half value */
typedef struct weapon_type {

View file

@ -870,7 +870,7 @@ is_guardian_r(unit * u2)
if (u2->number == 0) return false;
if ((u2->flags&UFL_GUARD)==0) return false;
if (besieged(u2)) return false;
if (!armedmen(u2) && !fval(u2->race, RCF_UNARMEDGUARD)) return false;
if (!armedmen(u2, true) && !fval(u2->race, RCF_UNARMEDGUARD)) return false;
return true;
}

View file

@ -644,6 +644,7 @@ xml_readweapon(xmlXPathContextPtr xpath, item_type * itype)
if (xml_bvalue(node, "pierce", false)) flags |= WTF_PIERCE;
if (xml_bvalue(node, "cut", false)) flags |= WTF_CUT;
if (xml_bvalue(node, "blunt", false)) flags |= WTF_BLUNT;
if (xml_bvalue(node, "siege", false)) flags |= WTF_SIEGE;
propValue = xmlGetProp(node, BAD_CAST "skill");
assert(propValue!=NULL);

View file

@ -439,7 +439,7 @@
<construction skill="cartmaking" minskill="5" reqsize="1">
<requirement type="log" quantity="10"/>
</construction>
<weapon bash="true" missile="true" skill="catapult" offmod="0" defmod="0" reload="5">
<weapon siege="true" bash="true" missile="true" skill="catapult" offmod="0" defmod="0" reload="5">
<damage type="rider" value="3d10+5"/>
<damage type="footman" value="3d10+5"/>
<modifier type="missile_target" value="4"/>