forked from github/server
regentanz: 50*stufe ueber stufe*woche, T2.
segen: 25*stufe ueber stufe*woche, T3 wasserelementar: common
This commit is contained in:
parent
98867c2e2c
commit
d0bedc9ef0
9 changed files with 111 additions and 19 deletions
|
@ -56,6 +56,8 @@
|
||||||
#include <kernel/terrainid.h>
|
#include <kernel/terrainid.h>
|
||||||
#include <kernel/unit.h>
|
#include <kernel/unit.h>
|
||||||
|
|
||||||
|
#include <spells/regioncurse.h>
|
||||||
|
|
||||||
/* util includes */
|
/* util includes */
|
||||||
#include <util/attrib.h>
|
#include <util/attrib.h>
|
||||||
#include <util/base36.h>
|
#include <util/base36.h>
|
||||||
|
@ -3025,6 +3027,7 @@ expandwork(region * r, request * work_begin, request * work_end, int maxwork)
|
||||||
/* fishes: maximale Arbeiter */
|
/* fishes: maximale Arbeiter */
|
||||||
int jobs = maxwork;
|
int jobs = maxwork;
|
||||||
int p_wage = wage(r, NULL, NULL);
|
int p_wage = wage(r, NULL, NULL);
|
||||||
|
int money = rmoney(r);
|
||||||
request *o;
|
request *o;
|
||||||
|
|
||||||
for (o = work_begin; o != work_end; ++o) {
|
for (o = work_begin; o != work_end; ++o) {
|
||||||
|
@ -3056,7 +3059,19 @@ expandwork(region * r, request * work_begin, request * work_end, int maxwork)
|
||||||
jobs = rpeasants(r);
|
jobs = rpeasants(r);
|
||||||
}
|
}
|
||||||
earnings = jobs * p_wage;
|
earnings = jobs * p_wage;
|
||||||
rsetmoney(r, rmoney(r) + earnings);
|
if (rule_blessed_harvest()==HARVEST_TAXES) {
|
||||||
|
/* E3 rules */
|
||||||
|
static const curse_type * blessedharvest_ct;
|
||||||
|
if (!blessedharvest_ct) {
|
||||||
|
blessedharvest_ct = ct_find("blessedharvest");
|
||||||
|
}
|
||||||
|
if (blessedharvest_ct) {
|
||||||
|
int happy = curse_geteffect(get_curse(r->attribs, blessedharvest_ct));
|
||||||
|
happy = MIN(happy, jobs);
|
||||||
|
earnings += happy;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
rsetmoney(r, money + earnings);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -3240,7 +3255,6 @@ produce(struct region *r)
|
||||||
request *taxorders, *sellorders, *stealorders, *buyorders;
|
request *taxorders, *sellorders, *stealorders, *buyorders;
|
||||||
unit *u;
|
unit *u;
|
||||||
int todo;
|
int todo;
|
||||||
static int rule_taxation = -1;
|
|
||||||
static int rule_autowork = -1;
|
static int rule_autowork = -1;
|
||||||
boolean limited = true;
|
boolean limited = true;
|
||||||
request * nextworker = workers;
|
request * nextworker = workers;
|
||||||
|
@ -3255,15 +3269,14 @@ produce(struct region *r)
|
||||||
*
|
*
|
||||||
* lehren vor lernen. */
|
* lehren vor lernen. */
|
||||||
|
|
||||||
if (rule_taxation<0) {
|
if (rule_autowork<0) {
|
||||||
rule_taxation = get_param_int(global.parameters, "rules.economy.taxation", 0);
|
|
||||||
rule_autowork = get_param_int(global.parameters, "work.auto", 0);
|
rule_autowork = get_param_int(global.parameters, "work.auto", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(rmoney(r) >= 0);
|
assert(rmoney(r) >= 0);
|
||||||
assert(rpeasants(r) >= 0);
|
assert(rpeasants(r) >= 0);
|
||||||
|
|
||||||
if (r->land && rule_taxation==1) {
|
if (r->land && rule_auto_taxation()) {
|
||||||
/* new taxation rules, region owners make money based on morale and building */
|
/* new taxation rules, region owners make money based on morale and building */
|
||||||
peasant_taxes(r);
|
peasant_taxes(r);
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,6 +53,8 @@
|
||||||
#include "terrain.h"
|
#include "terrain.h"
|
||||||
#include "unit.h"
|
#include "unit.h"
|
||||||
|
|
||||||
|
#include <spells/regioncurse.h>
|
||||||
|
|
||||||
/* util includes */
|
/* util includes */
|
||||||
#include <util/attrib.h>
|
#include <util/attrib.h>
|
||||||
#include <util/base36.h>
|
#include <util/base36.h>
|
||||||
|
@ -2639,6 +2641,13 @@ boolean is_tax_building(const building * b)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int rule_auto_taxation(void)
|
||||||
|
{
|
||||||
|
static int rule_taxation = -1;
|
||||||
|
rule_taxation = get_param_int(global.parameters, "rules.economy.taxation", TAX_ORDER);
|
||||||
|
return rule_taxation;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
default_wage(const region *r, const faction * f, const race * rc)
|
default_wage(const region *r, const faction * f, const race * rc)
|
||||||
{
|
{
|
||||||
|
@ -2681,8 +2690,11 @@ default_wage(const region *r, const faction * f, const race * rc)
|
||||||
} else {
|
} else {
|
||||||
wage = wagetable[esize][2];
|
wage = wagetable[esize][2];
|
||||||
}
|
}
|
||||||
|
if (rule_blessed_harvest()==HARVEST_WORK) {
|
||||||
|
/* E1 rules */
|
||||||
wage += curse_geteffect(get_curse(r->attribs, blessedharvest_ct));
|
wage += curse_geteffect(get_curse(r->attribs, blessedharvest_ct));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Artsculpture: Income +5 */
|
/* Artsculpture: Income +5 */
|
||||||
for(b=r->buildings; b; b=b->next) {
|
for(b=r->buildings; b; b=b->next) {
|
||||||
|
|
|
@ -248,6 +248,11 @@ struct building *largestbuilding(const struct region * r, boolean (*eval)(const
|
||||||
boolean is_castle(const struct building * b);
|
boolean is_castle(const struct building * b);
|
||||||
boolean is_tax_building(const struct building * b);
|
boolean is_tax_building(const struct building * b);
|
||||||
boolean is_owner_building(const struct building * b);
|
boolean is_owner_building(const struct building * b);
|
||||||
|
|
||||||
|
#define TAX_ORDER 0x00
|
||||||
|
#define TAX_OWNER 0x01
|
||||||
|
int rule_auto_taxation(void);
|
||||||
|
|
||||||
extern int count_all(const struct faction * f);
|
extern int count_all(const struct faction * f);
|
||||||
extern int count_migrants (const struct faction * f);
|
extern int count_migrants (const struct faction * f);
|
||||||
extern int count_maxmigrants(const struct faction * f);
|
extern int count_maxmigrants(const struct faction * f);
|
||||||
|
|
|
@ -196,11 +196,22 @@ static struct curse_type ct_maelstrom = {
|
||||||
CURSETYP_NORM, CURSE_ISNEW, (M_DURATION | M_VIGOUR),
|
CURSETYP_NORM, CURSE_ISNEW, (M_DURATION | M_VIGOUR),
|
||||||
cinfo_simple
|
cinfo_simple
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct curse_type ct_blessedharvest = {
|
static struct curse_type ct_blessedharvest = {
|
||||||
"blessedharvest",
|
"blessedharvest",
|
||||||
CURSETYP_NORM, 0, ( M_DURATION | M_VIGOUR ),
|
CURSETYP_NORM, 0, ( M_DURATION | M_VIGOUR ),
|
||||||
cinfo_simple
|
cinfo_simple
|
||||||
};
|
};
|
||||||
|
|
||||||
|
int rule_blessed_harvest(void)
|
||||||
|
{
|
||||||
|
static int rule = -1;
|
||||||
|
if (rule<0) {
|
||||||
|
rule = get_param_int(global.parameters, "rules.magic.blessed_harvest", HARVEST_WORK);
|
||||||
|
}
|
||||||
|
return rule;
|
||||||
|
}
|
||||||
|
|
||||||
static struct curse_type ct_drought = {
|
static struct curse_type ct_drought = {
|
||||||
"drought",
|
"drought",
|
||||||
CURSETYP_NORM, 0, ( M_DURATION | M_VIGOUR ),
|
CURSETYP_NORM, 0, ( M_DURATION | M_VIGOUR ),
|
||||||
|
|
|
@ -22,6 +22,10 @@ struct locale;
|
||||||
|
|
||||||
extern void register_regioncurse(void);
|
extern void register_regioncurse(void);
|
||||||
|
|
||||||
|
#define HARVEST_WORK 0x00
|
||||||
|
#define HARVEST_TAXES 0x01
|
||||||
|
int rule_blessed_harvest(void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1069,7 +1069,7 @@ sp_mallorn(castorder *co)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------- */
|
/* ------------------------------------------------------------- */
|
||||||
/* Name: Segen der Erde
|
/* Name: Segen der Erde / Regentanz
|
||||||
* Stufe: 1
|
* Stufe: 1
|
||||||
* Kategorie: Region, positiv
|
* Kategorie: Region, positiv
|
||||||
* Gebiet: Gwyrrd
|
* Gebiet: Gwyrrd
|
||||||
|
@ -1087,14 +1087,34 @@ sp_blessedharvest(castorder *co)
|
||||||
unit *mage = co->magician.u;
|
unit *mage = co->magician.u;
|
||||||
int cast_level = co->level;
|
int cast_level = co->level;
|
||||||
double power = co->force;
|
double power = co->force;
|
||||||
int duration = (int)power+1;
|
|
||||||
variant effect;
|
variant effect;
|
||||||
|
int rule = rule_blessed_harvest();
|
||||||
/* Attribut auf Region.
|
/* Attribut auf Region.
|
||||||
* Existiert schon ein curse, so wird dieser verstärkt
|
* Existiert schon ein curse, so wird dieser verstärkt
|
||||||
* (Max(Dauer), Max(Stärke))*/
|
* (Max(Dauer), Max(Stärke))*/
|
||||||
|
if (rule==HARVEST_WORK) {
|
||||||
|
int duration = (int)power+1;
|
||||||
effect.i = 1;
|
effect.i = 1;
|
||||||
create_curse(mage, &r->attribs, ct_find("blessedharvest"), power, duration, effect, 0);
|
create_curse(mage, &r->attribs, ct_find("blessedharvest"), power, duration, effect, 0);
|
||||||
|
} else if (rule==HARVEST_TAXES) {
|
||||||
|
int duration = (int)(power*2);
|
||||||
|
if (co->sp->id!=SPL_BLESSEDHARVEST) {
|
||||||
|
effect.i = (int)(100 * power);
|
||||||
|
create_curse(mage, &r->attribs, ct_find("blessedharvest"), power, duration, effect, 0);
|
||||||
|
} else {
|
||||||
|
int d;
|
||||||
|
region * rn[MAXDIRECTIONS];
|
||||||
|
get_neighbours(r, rn);
|
||||||
|
effect.i = (int)(50 * power);
|
||||||
|
for (d=0;d!=MAXDIRECTIONS;++d) {
|
||||||
|
region * rx = rn[d];
|
||||||
|
if (rx && rx->land) {
|
||||||
|
create_curse(mage, &rx->attribs, ct_find("blessedharvest"), power, duration, effect, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
create_curse(mage, &r->attribs, ct_find("blessedharvest"), power, duration, effect, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
{
|
{
|
||||||
message * seen = msg_message("harvest_effect", "mage", mage);
|
message * seen = msg_message("harvest_effect", "mage", mage);
|
||||||
message * unseen = msg_message("harvest_effect", "mage", NULL);
|
message * unseen = msg_message("harvest_effect", "mage", NULL);
|
||||||
|
|
|
@ -155,6 +155,7 @@
|
||||||
<param name="rules.magic.wol_effect" value="5"/>
|
<param name="rules.magic.wol_effect" value="5"/>
|
||||||
<param name="rules.magic.factionlist" value="1"/>
|
<param name="rules.magic.factionlist" value="1"/>
|
||||||
<param name="rules.magic.wol_type" value="2"/>
|
<param name="rules.magic.wol_type" value="2"/>
|
||||||
|
<param name="rules.magic.blessed_harvest" value="1"/>
|
||||||
<param name="rules.magic.common" value="tybied"/> <!-- tybied spells can be cast by anyone -->
|
<param name="rules.magic.common" value="tybied"/> <!-- tybied spells can be cast by anyone -->
|
||||||
<param name="rules.magic.elfpower" value="1"/> <!-- elves get ring-of-power bonus in a forest -->
|
<param name="rules.magic.elfpower" value="1"/> <!-- elves get ring-of-power bonus in a forest -->
|
||||||
<param name="rules.magic.playerschools" value="gwyrrd illaun draig cerddor"/>
|
<param name="rules.magic.playerschools" value="gwyrrd illaun draig cerddor"/>
|
||||||
|
|
|
@ -276,7 +276,7 @@
|
||||||
<!-- end cerddor -->
|
<!-- end cerddor -->
|
||||||
|
|
||||||
<!-- new gwyrrd -->
|
<!-- new gwyrrd -->
|
||||||
<spell name="blessedharvest" type="gray" rank="5" level="1" index="25" ship="true" far="true" variable="true">
|
<spell name="blessedharvest" type="gwyrrd" rank="5" level="3" index="25" ship="true" far="true" variable="true">
|
||||||
<!-- Segen der Erde -->
|
<!-- Segen der Erde -->
|
||||||
<resource name="aura" amount="1" cost="level"/>
|
<resource name="aura" amount="1" cost="level"/>
|
||||||
</spell>
|
</spell>
|
||||||
|
@ -301,7 +301,7 @@
|
||||||
<!-- Hagel -->
|
<!-- Hagel -->
|
||||||
<resource name="aura" amount="1" cost="level"/>
|
<resource name="aura" amount="1" cost="level"/>
|
||||||
</spell>
|
</spell>
|
||||||
<spell name="goodwinds" type="gwyrrd" rank="5" level="4" index="56" parameters="s" ship="true" variable="true">
|
<spell name="goodwinds" type="common" rank="5" level="4" index="56" parameters="s" ship="true" variable="true">
|
||||||
<!-- Beschwörung eines Wasserelementares -->
|
<!-- Beschwörung eines Wasserelementares -->
|
||||||
<resource name="aura" amount="1" cost="level"/>
|
<resource name="aura" amount="1" cost="level"/>
|
||||||
</spell>
|
</spell>
|
||||||
|
@ -502,7 +502,7 @@
|
||||||
<resource name="aura" amount="30" cost="fixed"/>
|
<resource name="aura" amount="30" cost="fixed"/>
|
||||||
<resource name="peasant" amount="50" cost="fixed"/>
|
<resource name="peasant" amount="50" cost="fixed"/>
|
||||||
</spell>
|
</spell>
|
||||||
<spell name="raindance" type="common" rank="5" level="3" index="26" ship="true" far="true" variable="true">
|
<spell name="raindance" type="common" rank="5" level="2" index="26" ship="true" far="true" variable="true">
|
||||||
<!-- Regentanz -->
|
<!-- Regentanz -->
|
||||||
<resource name="aura" amount="1" cost="level"/>
|
<resource name="aura" amount="1" cost="level"/>
|
||||||
</spell>
|
</spell>
|
||||||
|
|
|
@ -7,6 +7,34 @@ local function test_rename()
|
||||||
assert(u:get_item("ao_healing")==1)
|
assert(u:get_item("ao_healing")==1)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function test_blessed()
|
||||||
|
free_game()
|
||||||
|
local r = region.create(0, 0, "plain")
|
||||||
|
local f = faction.create("enno@eressea.de", "human", "de")
|
||||||
|
local u = unit.create(f, r)
|
||||||
|
r:set_resource("peasant", 100)
|
||||||
|
r:set_resource("money", 0)
|
||||||
|
u:add_item("money", 1000)
|
||||||
|
u.magic = "gwyrrd"
|
||||||
|
u.race = "elf"
|
||||||
|
u:set_skill("magic", 20)
|
||||||
|
u.aura = 200
|
||||||
|
u:add_spell("raindance")
|
||||||
|
u:add_spell("blessedharvest")
|
||||||
|
u:clear_orders()
|
||||||
|
u:add_order("ZAUBERE STUFE 3 Regentanz")
|
||||||
|
print(r:get_resource("money"))
|
||||||
|
|
||||||
|
process_orders()
|
||||||
|
print(r:get_resource("money"))
|
||||||
|
u:clear_orders()
|
||||||
|
u:add_order("ARBEITEN")
|
||||||
|
for i=1,3 do
|
||||||
|
process_orders()
|
||||||
|
print(r:get_resource("money"))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local function test_pure()
|
local function test_pure()
|
||||||
free_game()
|
free_game()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
|
@ -621,9 +649,7 @@ tests = {
|
||||||
["market"] = test_market
|
["market"] = test_market
|
||||||
}
|
}
|
||||||
mytests = {
|
mytests = {
|
||||||
["owners"] = test_owners,
|
-- ["blessed"] = test_blessed -- foiled by peasantgrowth
|
||||||
["mallorn"] = test_mallorn,
|
|
||||||
["recruit2"] = test_recruit2
|
|
||||||
}
|
}
|
||||||
fail = 0
|
fail = 0
|
||||||
for k, v in pairs(mytests) do
|
for k, v in pairs(mytests) do
|
||||||
|
|
Loading…
Reference in a new issue