forked from github/server
Merge branch 'CTD1-loot'
This commit is contained in:
commit
eba75c52f3
|
@ -30,6 +30,7 @@
|
||||||
"maketemp": ["MACHE TEMP", "MACHETEMP"],
|
"maketemp": ["MACHE TEMP", "MACHETEMP"],
|
||||||
"move" : "NACH",
|
"move" : "NACH",
|
||||||
"password" : "PASSWORD",
|
"password" : "PASSWORD",
|
||||||
|
"loot" : ["PLÜNDERE", "PLÜNDERN"],
|
||||||
"recruit": ["REKRUTIERE", "REKRUTIEREN"],
|
"recruit": ["REKRUTIERE", "REKRUTIEREN"],
|
||||||
"reserve": ["RESERVIERE", "RESERVIEREN"],
|
"reserve": ["RESERVIERE", "RESERVIEREN"],
|
||||||
"route": "ROUTE",
|
"route": "ROUTE",
|
||||||
|
|
|
@ -1571,6 +1571,9 @@
|
||||||
<string name="grow">
|
<string name="grow">
|
||||||
<text locale="en">GROW</text>
|
<text locale="en">GROW</text>
|
||||||
</string>
|
</string>
|
||||||
|
<string name="loot">
|
||||||
|
<text locale="en">loot</text>
|
||||||
|
</string>
|
||||||
</namespace>
|
</namespace>
|
||||||
|
|
||||||
<!-- NR generieren -->
|
<!-- NR generieren -->
|
||||||
|
|
|
@ -2754,7 +2754,7 @@
|
||||||
<arg name="wanted" type="int"/>
|
<arg name="wanted" type="int"/>
|
||||||
<arg name="mode" type="int"/>
|
<arg name="mode" type="int"/>
|
||||||
</type>
|
</type>
|
||||||
<text locale="de">"$unit($unit) verdient$if($eq($mode,4)," am Handel","") in $region($region) $int($amount)$if($eq($wanted,$amount),""," statt $int($wanted)") Silber$if($eq($mode,1)," durch Unterhaltung",$if($eq($mode,2)," durch Steuern",$if($eq($mode,3)," durch Handel",$if($eq($mode,5)," durch Diebstahl",$if($eq($mode,6)," durch Zauberei","")))))."</text>
|
<text locale="de">"$unit($unit) verdient$if($eq($mode,4)," am Handel","") in $region($region) $int($amount)$if($eq($wanted,$amount),""," statt $int($wanted)") Silber$if($eq($mode,1)," durch Unterhaltung",$if($eq($mode,2)," durch Steuern",$if($eq($mode,3)," durch Handel",$if($eq($mode,5)," durch Diebstahl",$if($eq($mode,6)," durch Zauberei",$if($eq($mode,7)," durch Pluendern","")))))."</text>
|
||||||
<text locale="fr">"$unit($unit) earns $int($amount)$if($eq($wanted,$amount),""," of $int($wanted)") in $region($region)."</text>
|
<text locale="fr">"$unit($unit) earns $int($amount)$if($eq($wanted,$amount),""," of $int($wanted)") in $region($region)."</text>
|
||||||
<text locale="en">"$unit($unit) earns $int($amount)$if($eq($wanted,$amount),""," of $int($wanted)") in $region($region)."</text>
|
<text locale="en">"$unit($unit) earns $int($amount)$if($eq($wanted,$amount),""," of $int($wanted)") in $region($region)."</text>
|
||||||
</message>
|
</message>
|
||||||
|
|
112
src/economy.c
112
src/economy.c
|
@ -3192,6 +3192,43 @@ static int do_work(unit * u, order * ord, request * o)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void expandloot(region * r, request * lootorders)
|
||||||
|
{
|
||||||
|
unit *u;
|
||||||
|
int i;
|
||||||
|
int looted = 0;
|
||||||
|
int startmoney = rmoney(r);
|
||||||
|
|
||||||
|
expandorders(r, lootorders);
|
||||||
|
if (!norders)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (i = 0; i != norders && rmoney(r) > TAXFRACTION * 2; i++) {
|
||||||
|
change_money(oa[i].unit, TAXFRACTION);
|
||||||
|
oa[i].unit->n += TAXFRACTION;
|
||||||
|
/*Looting destroys double the money*/
|
||||||
|
rsetmoney(r, rmoney(r) - TAXFRACTION * 2);
|
||||||
|
looted = looted + TAXFRACTION * 2;
|
||||||
|
}
|
||||||
|
free(oa);
|
||||||
|
|
||||||
|
/* Lowering morale by 1 depending on the looted money (+20%) */
|
||||||
|
if (rng_int() % 100 < ((looted / startmoney) + 0.2)) {
|
||||||
|
int m = region_get_morale(r);
|
||||||
|
if (m) {
|
||||||
|
/*Nur Moral -1, turns is not changed, so the first time nothing happens if the morale is good*/
|
||||||
|
region_set_morale(r, m-1, -1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (u = r->units; u; u = u->next) {
|
||||||
|
if (u->n >= 0) {
|
||||||
|
add_income(u, IC_LOOT, u->wants, u->n);
|
||||||
|
fset(u, UFL_LONGACTION | UFL_NOTMOVING);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void expandtax(region * r, request * taxorders)
|
static void expandtax(region * r, request * taxorders)
|
||||||
{
|
{
|
||||||
unit *u;
|
unit *u;
|
||||||
|
@ -3279,6 +3316,71 @@ void tax_cmd(unit * u, struct order *ord, request ** taxorders)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void loot_cmd(unit * u, struct order *ord, request ** lootorders)
|
||||||
|
{
|
||||||
|
region *r = u->region;
|
||||||
|
unit *u2;
|
||||||
|
int n;
|
||||||
|
int max;
|
||||||
|
request *o;
|
||||||
|
keyword_t kwd;
|
||||||
|
|
||||||
|
kwd = init_order(ord);
|
||||||
|
assert(kwd == K_LOOT);
|
||||||
|
|
||||||
|
if (get_param_int(global.parameters, "rules.enable_loot", 0) == 0 && !is_monsters(u->faction)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!humanoidrace(u_race(u)) && !is_monsters(u->faction)) {
|
||||||
|
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, false);
|
||||||
|
|
||||||
|
if (!n) {
|
||||||
|
cmistake(u, ord, 48, MSG_INCOME);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
u2 = is_guarded(r, u, GUARD_TAX);
|
||||||
|
if (u2) {
|
||||||
|
ADDMSG(&u->faction->msgs,
|
||||||
|
msg_feedback(u, ord, "region_guarded", "guard", u2));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
max = getuint();
|
||||||
|
|
||||||
|
if (max == 0)
|
||||||
|
max = INT_MAX;
|
||||||
|
if (!playerrace(u_race(u))) {
|
||||||
|
u->wants = _min(income(u), max);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
/* For player start with 20 Silver +10 every 5 level of close combat skill*/
|
||||||
|
int skbonus = (_max(eff_skill(u, SK_MELEE, r), eff_skill(u, SK_SPEAR, r)) * 2 / 10) + 2;
|
||||||
|
u->wants = _min(n * skbonus * 10, max);
|
||||||
|
}
|
||||||
|
|
||||||
|
o = (request *)calloc(1, sizeof(request));
|
||||||
|
o->qty = u->wants / TAXFRACTION;
|
||||||
|
o->unit = u;
|
||||||
|
addlist(lootorders, o);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
#define MAX_WORKERS 2048
|
#define MAX_WORKERS 2048
|
||||||
void auto_work(region * r)
|
void auto_work(region * r)
|
||||||
{
|
{
|
||||||
|
@ -3342,7 +3444,7 @@ static void peasant_taxes(region * r)
|
||||||
void produce(struct region *r)
|
void produce(struct region *r)
|
||||||
{
|
{
|
||||||
request workers[MAX_WORKERS];
|
request workers[MAX_WORKERS];
|
||||||
request *taxorders, *sellorders, *stealorders, *buyorders;
|
request *taxorders, *lootorders, *sellorders, *stealorders, *buyorders;
|
||||||
unit *u;
|
unit *u;
|
||||||
int todo;
|
int todo;
|
||||||
static int rule_autowork = -1;
|
static int rule_autowork = -1;
|
||||||
|
@ -3378,6 +3480,7 @@ void produce(struct region *r)
|
||||||
nextentertainer = &entertainers[0];
|
nextentertainer = &entertainers[0];
|
||||||
entertaining = 0;
|
entertaining = 0;
|
||||||
taxorders = 0;
|
taxorders = 0;
|
||||||
|
lootorders = 0;
|
||||||
stealorders = 0;
|
stealorders = 0;
|
||||||
|
|
||||||
for (u = r->units; u; u = u->next) {
|
for (u = r->units; u; u = u->next) {
|
||||||
|
@ -3446,6 +3549,10 @@ void produce(struct region *r)
|
||||||
tax_cmd(u, u->thisorder, &taxorders);
|
tax_cmd(u, u->thisorder, &taxorders);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case K_LOOT:
|
||||||
|
loot_cmd(u, u->thisorder, &lootorders);
|
||||||
|
break;
|
||||||
|
|
||||||
case K_STEAL:
|
case K_STEAL:
|
||||||
steal_cmd(u, u->thisorder, &stealorders);
|
steal_cmd(u, u->thisorder, &stealorders);
|
||||||
break;
|
break;
|
||||||
|
@ -3481,6 +3588,9 @@ void produce(struct region *r)
|
||||||
if (taxorders)
|
if (taxorders)
|
||||||
expandtax(r, taxorders);
|
expandtax(r, taxorders);
|
||||||
|
|
||||||
|
if (lootorders)
|
||||||
|
expandloot(r, lootorders);
|
||||||
|
|
||||||
/* An erster Stelle Kaufen (expandbuying), die Bauern so Geld bekommen, um
|
/* An erster Stelle Kaufen (expandbuying), die Bauern so Geld bekommen, um
|
||||||
* nachher zu beim Verkaufen (expandselling) den Spielern abkaufen zu
|
* nachher zu beim Verkaufen (expandselling) den Spielern abkaufen zu
|
||||||
* können. */
|
* können. */
|
||||||
|
|
|
@ -46,11 +46,9 @@ extern "C" {
|
||||||
void produce(struct region *r);
|
void produce(struct region *r);
|
||||||
void auto_work(struct region *r);
|
void auto_work(struct region *r);
|
||||||
|
|
||||||
enum { IC_WORK, IC_ENTERTAIN, IC_TAX, IC_TRADE, IC_TRADETAX, IC_STEAL,
|
enum { IC_WORK, IC_ENTERTAIN, IC_TAX, IC_TRADE, IC_TRADETAX, IC_STEAL, IC_MAGIC, IC_LOOT };
|
||||||
IC_MAGIC };
|
|
||||||
void maintain_buildings(struct region *r, bool crash);
|
void maintain_buildings(struct region *r, bool crash);
|
||||||
extern void add_spende(struct faction *f1, struct faction *f2, int betrag,
|
extern void add_spende(struct faction *f1, struct faction *f2, int betrag, struct region *r);
|
||||||
struct region *r);
|
|
||||||
extern int make_cmd(struct unit *u, struct order *ord);
|
extern int make_cmd(struct unit *u, struct order *ord);
|
||||||
extern void split_allocations(struct region *r);
|
extern void split_allocations(struct region *r);
|
||||||
extern int recruit_archetypes(void);
|
extern int recruit_archetypes(void);
|
||||||
|
|
|
@ -416,6 +416,7 @@ bool is_repeated(const order * ord)
|
||||||
case K_PIRACY:
|
case K_PIRACY:
|
||||||
case K_PLANT:
|
case K_PLANT:
|
||||||
case K_MAKE:
|
case K_MAKE:
|
||||||
|
case K_LOOT:
|
||||||
result = 1;
|
result = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -456,6 +457,7 @@ bool is_exclusive(const order * ord)
|
||||||
case K_PIRACY:
|
case K_PIRACY:
|
||||||
case K_PLANT:
|
case K_PLANT:
|
||||||
case K_MAKE:
|
case K_MAKE:
|
||||||
|
case K_LOOT:
|
||||||
result = 1;
|
result = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -499,6 +501,7 @@ bool is_long(const order * ord)
|
||||||
case K_PIRACY:
|
case K_PIRACY:
|
||||||
case K_PLANT:
|
case K_PLANT:
|
||||||
case K_MAKE:
|
case K_MAKE:
|
||||||
|
case K_LOOT:
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -143,5 +143,6 @@ const char *keywords[MAXKEYWORDS] = {
|
||||||
"claim",
|
"claim",
|
||||||
"promote",
|
"promote",
|
||||||
"pay",
|
"pay",
|
||||||
|
"loot",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -69,6 +69,7 @@ typedef enum {
|
||||||
K_CLAIM,
|
K_CLAIM,
|
||||||
K_PROMOTION,
|
K_PROMOTION,
|
||||||
K_PAY,
|
K_PAY,
|
||||||
|
K_LOOT,
|
||||||
MAXKEYWORDS,
|
MAXKEYWORDS,
|
||||||
NOKEYWORD = -1
|
NOKEYWORD = -1
|
||||||
} keyword_t;
|
} keyword_t;
|
||||||
|
|
Loading…
Reference in New Issue