refactor E3 to use the same raindance/harvest spells as E2.

only indirect effects are different.
This commit is contained in:
Enno Rehling 2017-04-30 20:54:53 +02:00
parent 724a41ac85
commit 976b23be72
6 changed files with 8 additions and 43 deletions

View File

@ -296,6 +296,7 @@
<!-- new gwyrrd -->
<spell name="blessedharvest" rank="5" index="25" ship="true" far="true" variable="true">
<!-- Segen der Erde -->
<function name="cast" value="cast_blessedharvest"/>
<resource name="aura" amount="1" cost="level"/>
</spell>
<spell name="earn_silver#gwyrrd" ship="true" variable="true" rank="5" index="159">
@ -494,6 +495,7 @@
</spell>
<spell name="raindance" rank="5" index="26" ship="true" far="true" variable="true">
<!-- Regentanz -->
<function name="cast" value="cast_blessedharvest"/>
<resource name="aura" amount="1" cost="level"/>
</spell>
<spell name="irongolem" rank="4" index="33" variable="true">

View File

@ -1,4 +1,3 @@
require 'eressea.e3.rules'
require 'eressea.spells'
eressea.log.debug("rules for game E3")

View File

@ -1,35 +0,0 @@
-- the "raindance" spell
function raindance(r, mage, level, force)
if (create_curse(mage, r, "blessedharvest", force, 1+force*2, 100 * force)) then
-- slightly crooked way of reporting an action to everyone in the region
local msg = message.create("raindance_effect")
msg:set_unit("mage", mage)
if (msg:report_action(r, mage, 3)) then
local msg2 = message.create("raindance_effect")
msg2:set_unit("mage", nil)
msg2:report_action(r, mage, 4)
end
end
return level
end
-- the "blessed harvest" spell
function blessedharvest(r, mage, level, force)
if create_curse(mage, r, "blessedharvest", force, 1+force*2, 50 * force) then
-- slightly crooked way of reporting an action to everyone in the region
local msg = message.create("harvest_effect")
msg:set_unit("mage", mage)
if (msg:report_action(r, mage, 3)) then
local msg2 = message.create("harvest_effect")
msg2:set_unit("mage", nil)
msg2:report_action(r, mage, 4)
end
for idx, rn in ipairs(r.adj) do
-- nur landregionen haben moral>=0
if r.morale>=0 then
create_curse(mage, r, "blessedharvest", force, force*2, 50 * force)
end
end
end
return level
end

View File

@ -32,10 +32,9 @@ function test_raindance()
u:add_order("ARBEITEN")
process_orders()
process_orders()
assert_equal(500, r:get_resource("money"))
process_orders()
assert_equal(800, r:get_resource("money"))
process_orders()
assert_equal(900, r:get_resource("money"))
assert_equal(600, r:get_resource("money"))
end
function test_magic()

View File

@ -2658,8 +2658,7 @@ expandwork(region * r, request * work_begin, request * work_end, int maxwork)
const curse_type *blessedharvest_ct = ct_find("blessedharvest");
if (blessedharvest_ct) {
int happy =
(int)curse_geteffect(get_curse(r->attribs, blessedharvest_ct));
happy = MIN(happy, jobs);
(int)(jobs * curse_geteffect(get_curse(r->attribs, blessedharvest_ct)));
earnings += happy;
}
}

View File

@ -1104,8 +1104,9 @@ static int sp_blessedharvest(castorder * co)
if (create_curse(mage, &r->attribs, ct_find("blessedharvest"), co->force,
duration, 1.0, 0)) {
message *seen = msg_message("harvest_effect", "mage", mage);
message *unseen = msg_message("harvest_effect", "mage", NULL);
const char * effect = co->sp->sname[0]=='b' ? "harvest_effect" : "raindance_effect";
message *seen = msg_message(effect, "mage", mage);
message *unseen = msg_message(effect, "mage", NULL);
report_effect(r, mage, seen, unseen);
msg_release(seen);
msg_release(unseen);