regentanz: 50*stufe ueber stufe*woche, T2.

segen: 25*stufe ueber stufe*woche, T3
wasserelementar: common
This commit is contained in:
Enno Rehling 2009-07-21 21:39:43 +00:00
parent 98867c2e2c
commit d0bedc9ef0
9 changed files with 111 additions and 19 deletions

View file

@ -56,6 +56,8 @@
#include <kernel/terrainid.h>
#include <kernel/unit.h>
#include <spells/regioncurse.h>
/* util includes */
#include <util/attrib.h>
#include <util/base36.h>
@ -3025,6 +3027,7 @@ expandwork(region * r, request * work_begin, request * work_end, int maxwork)
/* fishes: maximale Arbeiter */
int jobs = maxwork;
int p_wage = wage(r, NULL, NULL);
int money = rmoney(r);
request *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);
}
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
@ -3240,10 +3255,9 @@ produce(struct region *r)
request *taxorders, *sellorders, *stealorders, *buyorders;
unit *u;
int todo;
static int rule_taxation = -1;
static int rule_autowork = -1;
boolean limited = true;
request * nextworker = workers;
boolean limited = true;
request * nextworker = workers;
/* das sind alles befehle, die 30 tage brauchen, und die in thisorder
* stehen! von allen 30-tage befehlen wird einfach der letzte verwendet
@ -3255,15 +3269,14 @@ produce(struct region *r)
*
* lehren vor lernen. */
if (rule_taxation<0) {
rule_taxation = get_param_int(global.parameters, "rules.economy.taxation", 0);
if (rule_autowork<0) {
rule_autowork = get_param_int(global.parameters, "work.auto", 0);
}
assert(rmoney(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 */
peasant_taxes(r);
}

View file

@ -53,6 +53,8 @@
#include "terrain.h"
#include "unit.h"
#include <spells/regioncurse.h>
/* util includes */
#include <util/attrib.h>
#include <util/base36.h>
@ -2639,6 +2641,13 @@ boolean is_tax_building(const building * b)
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
default_wage(const region *r, const faction * f, const race * rc)
{
@ -2681,7 +2690,10 @@ default_wage(const region *r, const faction * f, const race * rc)
} else {
wage = wagetable[esize][2];
}
wage += curse_geteffect(get_curse(r->attribs, blessedharvest_ct));
if (rule_blessed_harvest()==HARVEST_WORK) {
/* E1 rules */
wage += curse_geteffect(get_curse(r->attribs, blessedharvest_ct));
}
}
/* Artsculpture: Income +5 */

View file

@ -248,6 +248,11 @@ struct building *largestbuilding(const struct region * r, boolean (*eval)(const
boolean is_castle(const struct building * b);
boolean is_tax_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_migrants (const struct faction * f);
extern int count_maxmigrants(const struct faction * f);

View file

@ -196,11 +196,22 @@ static struct curse_type ct_maelstrom = {
CURSETYP_NORM, CURSE_ISNEW, (M_DURATION | M_VIGOUR),
cinfo_simple
};
static struct curse_type ct_blessedharvest = {
"blessedharvest",
CURSETYP_NORM, 0, ( M_DURATION | M_VIGOUR ),
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 = {
"drought",
CURSETYP_NORM, 0, ( M_DURATION | M_VIGOUR ),

View file

@ -22,6 +22,10 @@ struct locale;
extern void register_regioncurse(void);
#define HARVEST_WORK 0x00
#define HARVEST_TAXES 0x01
int rule_blessed_harvest(void);
#ifdef __cplusplus
}
#endif

View file

@ -1069,7 +1069,7 @@ sp_mallorn(castorder *co)
}
/* ------------------------------------------------------------- */
/* Name: Segen der Erde
/* Name: Segen der Erde / Regentanz
* Stufe: 1
* Kategorie: Region, positiv
* Gebiet: Gwyrrd
@ -1087,14 +1087,34 @@ sp_blessedharvest(castorder *co)
unit *mage = co->magician.u;
int cast_level = co->level;
double power = co->force;
int duration = (int)power+1;
variant effect;
int rule = rule_blessed_harvest();
/* Attribut auf Region.
* Existiert schon ein curse, so wird dieser verstärkt
* (Max(Dauer), Max(Stärke))*/
effect.i = 1;
create_curse(mage, &r->attribs, ct_find("blessedharvest"), power, duration, effect, 0);
if (rule==HARVEST_WORK) {
int duration = (int)power+1;
effect.i = 1;
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 * unseen = msg_message("harvest_effect", "mage", NULL);

View file

@ -155,6 +155,7 @@
<param name="rules.magic.wol_effect" value="5"/>
<param name="rules.magic.factionlist" value="1"/>
<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.elfpower" value="1"/> <!-- elves get ring-of-power bonus in a forest -->
<param name="rules.magic.playerschools" value="gwyrrd illaun draig cerddor"/>

View file

@ -276,7 +276,7 @@
<!-- end cerddor -->
<!-- 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 -->
<resource name="aura" amount="1" cost="level"/>
</spell>
@ -301,7 +301,7 @@
<!-- Hagel -->
<resource name="aura" amount="1" cost="level"/>
</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 -->
<resource name="aura" amount="1" cost="level"/>
</spell>
@ -502,7 +502,7 @@
<resource name="aura" amount="30" cost="fixed"/>
<resource name="peasant" amount="50" cost="fixed"/>
</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 -->
<resource name="aura" amount="1" cost="level"/>
</spell>

View file

@ -7,6 +7,34 @@ local function test_rename()
assert(u:get_item("ao_healing")==1)
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()
free_game()
local r = region.create(0, 0, "plain")
@ -621,9 +649,7 @@ tests = {
["market"] = test_market
}
mytests = {
["owners"] = test_owners,
["mallorn"] = test_mallorn,
["recruit2"] = test_recruit2
-- ["blessed"] = test_blessed -- foiled by peasantgrowth
}
fail = 0
for k, v in pairs(mytests) do