remove remainders of the arena.

Auge des Drachens haben noch einige Spieler, darf nicht gelöscht werden.
move item tests to tests/items.lua
This commit is contained in:
Enno Rehling 2017-02-27 18:21:41 +01:00
parent 108501e398
commit 1a0992e37b
15 changed files with 198 additions and 529 deletions

View File

@ -98,6 +98,11 @@
</resource> </resource>
<!-- XE items --> <!-- XE items -->
<resource name="studypotion" appearance="vial">
<!-- gives user one free learning attempt -->
<item weight="0" use="yes" />
</resource>
<resource name="skillpotion" appearance="vial"> <resource name="skillpotion" appearance="vial">
<!-- gives user one free learning attempt --> <!-- gives user one free learning attempt -->
<item weight="0"> <item weight="0">

View File

@ -86,27 +86,9 @@
<item notlost="yes" cursed="true" weight="0"/> <item notlost="yes" cursed="true" weight="0"/>
</resource> </resource>
<resource name="ao_daemon">
<!-- summons igjarjuk -->
<item weight="0" score="6000" notlost="true" cursed="true">
<function name="use" value="useigjarjuk"/>
<function name="give" value="giveigjarjuk"/>
</item>
</resource>
<resource name="griphonwing">
<!-- this lets you leave the arena -->
<item weight="0" score="6000" notlost="true" cursed="true">
<function name="use" value="leave_arena"/>
<function name="give" value="giveigjarjuk"/>
</item>
</resource>
<resource name="eyeofdragon"> <resource name="eyeofdragon">
<!-- the arena gate, for one-time entry --> <!-- the arena gate, for one-time entry -->
<item weight="0" score="0"> <item weight="0" score="0"/>
<function name="use" value="enter_arena"/>
</item>
</resource> </resource>
<resource name="jadee_ring" appearance="ring"> <resource name="jadee_ring" appearance="ring">

View File

@ -116,18 +116,6 @@
<text locale="de">Eine Geburtstagstorte mit 10 Kerzen. Herzlichen Glückwunsch, Eressea!</text> <text locale="de">Eine Geburtstagstorte mit 10 Kerzen. Herzlichen Glückwunsch, Eressea!</text>
<text locale="en">A birthday cake with 10 candles. Happy Birthday, Eressea!</text> <text locale="en">A birthday cake with 10 candles. Happy Birthday, Eressea!</text>
</string> </string>
<string name="griphonwing">
<text locale="de">Dieses Fluggerät aus der Schmiede der Zwerge von Celeband galt wie die
'Ebene der Herausforderung' seit Urzeiten als verschollen, ja man
zweifelte seine Existenz an. Die Sage überliefert, das derjenige, der
sie auf der Spitze des Turmes seiner Gesinnung benutzt, als einziger
die 'Ebene der Herausforderungen' verlassen kann.</text>
</string>
<string name="ao_daemon">
<text locale="de">Glückwunsch, mein Kind. Du bist im Besitz des mächtigsten
Artefaktes Eresseas. Ein Fluch, sagt man, liege auf ihm, denn
niemand hat es bisher lange sein Eigen genannt...</text>
</string>
<string name="cookie"> <string name="cookie">
<text locale="de">Kleines trockenes Dauergebäck, m od. s; - u. -es, - u. -e</text> <text locale="de">Kleines trockenes Dauergebäck, m od. s; - u. -es, - u. -e</text>
</string> </string>
@ -374,29 +362,6 @@
</string> </string>
<!-- art rewards end --> <!-- art rewards end -->
<!-- igjarjuk queste begin -->
<string name="ao_daemon">
<text locale="de">Auge des Dämon</text>
<text locale="en">eye of the demon</text>
<text locale="fr">oeil du démon</text>
</string>
<string name="ao_daemon_p">
<text locale="de">Augen des Dämon</text>
<text locale="en">eyes of the demon</text>
<text locale="fr">oeil du démon</text>
</string>
<string name="griphonwing">
<text locale="de">Schwinge des Greifen</text>
<text locale="en">wing of the gryphon</text>
<text locale="fr">aile du griffon</text>
</string>
<string name="griphonwing_p">
<text locale="de">Schwingen des Greifen</text>
<text locale="en">wings of the gryphon</text>
<text locale="fr">ailes du griffon</text>
</string>
<!-- igjarjuk queste end -->
<string name="rm_adamantium"> <string name="rm_adamantium">
<text locale="de">Adamantium</text> <text locale="de">Adamantium</text>
<text locale="en">adamantium</text> <text locale="en">adamantium</text>

View File

@ -230,171 +230,6 @@ function test_no_uruk()
assert_equal(f1.race, "orc") assert_equal(f1.race, "orc")
end end
function test_meow()
local r = region.create(0, 0, "plain")
local f = faction.create("noreply@eressea.de", "human", "de")
local u = unit.create(f, r, 1)
u:add_item("aoc", 1)
u:clear_orders()
u:add_order("BENUTZEN 1 Katzenamulett")
process_orders()
assert_equal(1, u:get_item("aoc"))
assert_equal(1, r:count_msg_type('meow'))
end
function test_aurapotion50()
eressea.settings.set("magic.regeneration.enable", "0")
local r = region.create(0, 0, "plain")
local f = faction.create("noreply@eressea.de", "human", "de")
local u = unit.create(f, r, 1)
u:add_item("aurapotion50", 1)
u:set_skill('magic', 10);
u.magic = 'gwyrrd'
u.aura = 0
u:clear_orders()
u:add_order("BENUTZEN 1 Auratrank")
process_orders()
assert_equal(0, u:get_item("aurapotion50"))
assert_equal(1, f:count_msg_type('aurapotion50'))
assert_equal(50, u.aura)
end
function test_bagpipe()
local r = region.create(0, 0, "plain")
local f = faction.create("noreply@eressea.de", "human", "de")
local u = unit.create(f, r, 1)
u:add_item("bagpipeoffear", 1)
u:clear_orders()
u:add_order("BENUTZEN 1 Dudelsack")
process_orders()
assert_equal(1, u:get_item("bagpipeoffear"))
assert_equal(1, f:count_msg_type('bagpipeoffear_faction'))
assert_equal(1, r:count_msg_type('bagpipeoffear_region'))
end
function test_speedsail()
local r = region.create(0, 0, "plain")
local f = faction.create("noreply@eressea.de", "human", "de")
local u = unit.create(f, r, 1)
u.ship = ship.create(r, "boat")
u:add_item("speedsail", 2)
u:clear_orders()
u:add_order("BENUTZEN 1 Sonnensegel")
process_orders()
assert_equal(1, u:get_item("speedsail"))
assert_equal(1, f:count_msg_type('use_speedsail'))
end
--[[
function test_studypotion()
local r = region.create(0, 0, "plain")
local f = faction.create("noreply@eressea.de", "human", "de")
local u = unit.create(f, r, 1)
u:add_item("studypotion", 2)
u:clear_orders()
u:add_order("LERNE Unterhaltung")
u:add_order("BENUTZEN 1 Lerntrank")
process_orders()
assert_equal(1, u:get_item("studypotion"))
end
]]--
function test_antimagic()
local r = region.create(0, 0, "plain")
local f = faction.create("noreply@eressea.de", "human", "de")
local u = unit.create(f, r, 1)
u:add_item("antimagic", 2)
u:clear_orders()
u:add_order("BENUTZEN 1 Antimagiekristall")
process_orders()
assert_equal(1, r:count_msg_type('use_antimagiccrystal'))
assert_equal(1, u:get_item("antimagic"))
end
function test_ointment()
local r = region.create(0, 0, "plain")
local f = faction.create("noreply@eressea.de", "human", "de")
local u = unit.create(f, r, 1)
local hp = u.hp
u.hp = 1
u:add_item("ointment", 1)
u:clear_orders()
u:add_order("BENUTZEN 1 Wundsalbe")
process_orders()
assert_equal(0, u:get_item("ointment"))
assert_equal(1, f:count_msg_type('usepotion'))
assert_equal(hp, u.hp)
end
function test_bloodpotion_demon()
local r = region.create(0, 0, "plain")
local f = faction.create("noreply@eressea.de", "demon", "de")
local u = unit.create(f, r, 1)
u:add_item("peasantblood", 1)
u:clear_orders()
u:add_order("BENUTZEN 1 Bauernblut")
process_orders()
assert_equal(0, u:get_item("peasantblood"))
assert_equal(1, f:count_msg_type('usepotion'))
assert_equal("demon", u.race)
end
function test_bloodpotion_other()
local r = region.create(0, 0, "plain")
local f = faction.create("noreply@eressea.de", "human", "de")
local u = unit.create(f, r, 1)
u:add_item("peasantblood", 1)
u:clear_orders()
u:add_order("BENUTZEN 1 Bauernblut")
process_orders()
assert_equal(0, u:get_item("peasantblood"))
assert_equal(1, f:count_msg_type('usepotion'))
assert_equal("smurf", u.race)
end
function test_foolpotion()
local r = region.create(0, 0, "plain")
local f = faction.create("noreply@eressea.de", "human", "de")
local u = unit.create(f, r, 1)
u:add_item("p7", 1)
u:clear_orders()
u:add_order("BENUTZEN 1 Dumpfbackenbrot 4242")
process_orders()
assert_equal(1, u:get_item("p7"))
assert_equal(1, f:count_msg_type('feedback_unit_not_found'))
local u2 = unit.create(f, r, 1)
u:clear_orders()
u:add_order("BENUTZEN 1 Dumpfbackenbrot " .. itoa36(u2.id))
process_orders()
assert_equal(1, u:get_item("p7"))
assert_equal(1, f:count_msg_type('error64'))
u:set_skill("stealth", 1);
process_orders()
assert_equal(0, u:get_item("p7"))
assert_equal(1, f:count_msg_type('givedumb'))
end
function test_snowman()
local r = region.create(0, 0, "glacier")
local f = faction.create("noreply@eressea.de", "human", "de")
local u = unit.create(f, r, 1)
u:add_item("snowman", 1)
u:clear_orders()
u:add_order("BENUTZEN 1 Schneemann")
process_orders()
for u2 in r.units do
if u2.id~=u.id then
assert_equal("snowman", u2.race)
assert_equal(1000, u2.hp)
u = nil
break
end
end
assert_equal(nil, u)
end
function test_block_movement() function test_block_movement()
eressea.settings.set("rules.guard.base_stop_prob", "0.3") eressea.settings.set("rules.guard.base_stop_prob", "0.3")
eressea.settings.set("rules.guard.amulet_stop_prob", "0.0") eressea.settings.set("rules.guard.amulet_stop_prob", "0.0")

View File

@ -8,6 +8,7 @@ require 'tests.e2.destroy'
require 'tests.e2.guard' require 'tests.e2.guard'
require 'tests.e2.spells' require 'tests.e2.spells'
require 'tests.e2.stealth' require 'tests.e2.stealth'
require 'tests.items'
require 'tests.orders' require 'tests.orders'
require 'tests.common' require 'tests.common'
require 'tests.report' require 'tests.report'

186
scripts/tests/items.lua Normal file
View File

@ -0,0 +1,186 @@
require "lunit"
module("tests.items", package.seeall, lunit.testcase )
function setup()
eressea.free_game()
eressea.settings.set("nmr.timeout", "0")
eressea.settings.set("rules.food.flags", "4")
eressea.settings.set("rules.ship.storms", "0")
eressea.settings.set("rules.encounters", "0")
end
function test_meow()
local r = region.create(0, 0, "plain")
local f = faction.create("noreply@eressea.de", "human", "de")
local u = unit.create(f, r, 1)
u:add_item("aoc", 1)
u:clear_orders()
u:add_order("BENUTZEN 1 Katzenamulett")
process_orders()
assert_equal(1, u:get_item("aoc"))
assert_equal(1, r:count_msg_type('meow'))
end
function test_aurapotion50()
eressea.settings.set("magic.regeneration.enable", "0")
local r = region.create(0, 0, "plain")
local f = faction.create("noreply@eressea.de", "human", "de")
local u = unit.create(f, r, 1)
u:add_item("aurapotion50", 1)
u:set_skill('magic', 10);
u.magic = 'gwyrrd'
u.aura = 0
u:clear_orders()
u:add_order("BENUTZEN 1 Auratrank")
process_orders()
assert_equal(0, u:get_item("aurapotion50"))
assert_equal(1, f:count_msg_type('aurapotion50'))
assert_equal(50, u.aura)
end
function test_bagpipe()
local r = region.create(0, 0, "plain")
local f = faction.create("noreply@eressea.de", "human", "de")
local u = unit.create(f, r, 1)
u:add_item("bagpipeoffear", 1)
u:clear_orders()
u:add_order("BENUTZEN 1 Dudelsack")
process_orders()
assert_equal(1, u:get_item("bagpipeoffear"))
assert_equal(1, f:count_msg_type('bagpipeoffear_faction'))
assert_equal(1, r:count_msg_type('bagpipeoffear_region'))
end
function test_speedsail()
local r = region.create(0, 0, "plain")
local f = faction.create("noreply@eressea.de", "human", "de")
local u = unit.create(f, r, 1)
u.ship = ship.create(r, "boat")
u:add_item("speedsail", 2)
u:clear_orders()
u:add_order("BENUTZEN 1 Sonnensegel")
process_orders()
assert_equal(1, u:get_item("speedsail"))
assert_equal(1, f:count_msg_type('use_speedsail'))
end
function test_skillpotion()
local r = region.create(0, 0, "plain")
local f = faction.create("noreply@eressea.de", "human", "de")
local u = unit.create(f, r, 1)
u:add_item("skillpotion", 2)
u:clear_orders()
u:add_order("BENUTZEN 1 Talenttrunk")
process_orders()
assert_equal(1, u:get_item("skillpotion"))
assert_equal(1, f:count_msg_type('skillpotion_use'))
end
function test_studypotion()
local r = region.create(0, 0, "plain")
local f = faction.create("noreply@eressea.de", "human", "de")
local u = unit.create(f, r, 1)
u:add_item("studypotion", 2)
u:clear_orders()
u:add_order("LERNE Unterhaltung")
u:add_order("BENUTZEN 1 Lerntrank")
process_orders()
assert_equal(1, u:get_item("studypotion"))
end
function test_antimagic()
local r = region.create(0, 0, "plain")
local f = faction.create("noreply@eressea.de", "human", "de")
local u = unit.create(f, r, 1)
u:add_item("antimagic", 2)
u:clear_orders()
u:add_order("BENUTZEN 1 Antimagiekristall")
process_orders()
assert_equal(1, r:count_msg_type('use_antimagiccrystal'))
assert_equal(1, u:get_item("antimagic"))
end
function test_ointment()
local r = region.create(0, 0, "plain")
local f = faction.create("noreply@eressea.de", "human", "de")
local u = unit.create(f, r, 1)
local hp = u.hp
u.hp = 1
u:add_item("ointment", 1)
u:clear_orders()
u:add_order("BENUTZEN 1 Wundsalbe")
process_orders()
assert_equal(0, u:get_item("ointment"))
assert_equal(1, f:count_msg_type('usepotion'))
assert_equal(hp, u.hp)
end
function test_bloodpotion_demon()
local r = region.create(0, 0, "plain")
local f = faction.create("noreply@eressea.de", "demon", "de")
local u = unit.create(f, r, 1)
u:add_item("peasantblood", 1)
u:clear_orders()
u:add_order("BENUTZEN 1 Bauernblut")
process_orders()
assert_equal(0, u:get_item("peasantblood"))
assert_equal(1, f:count_msg_type('usepotion'))
assert_equal("demon", u.race)
end
function test_bloodpotion_other()
local r = region.create(0, 0, "plain")
local f = faction.create("noreply@eressea.de", "human", "de")
local u = unit.create(f, r, 1)
u:add_item("peasantblood", 1)
u:clear_orders()
u:add_order("BENUTZEN 1 Bauernblut")
process_orders()
assert_equal(0, u:get_item("peasantblood"))
assert_equal(1, f:count_msg_type('usepotion'))
assert_equal("smurf", u.race)
end
function test_foolpotion()
local r = region.create(0, 0, "plain")
local f = faction.create("noreply@eressea.de", "human", "de")
local u = unit.create(f, r, 1)
u:add_item("p7", 1)
u:clear_orders()
u:add_order("BENUTZEN 1 Dumpfbackenbrot 4242")
process_orders()
assert_equal(1, u:get_item("p7"))
assert_equal(1, f:count_msg_type('feedback_unit_not_found'))
local u2 = unit.create(f, r, 1)
u:clear_orders()
u:add_order("BENUTZEN 1 Dumpfbackenbrot " .. itoa36(u2.id))
process_orders()
assert_equal(1, u:get_item("p7"))
assert_equal(1, f:count_msg_type('error64'))
u:set_skill("stealth", 1);
process_orders()
assert_equal(0, u:get_item("p7"))
assert_equal(1, f:count_msg_type('givedumb'))
end
function test_snowman()
local r = region.create(0, 0, "glacier")
local f = faction.create("noreply@eressea.de", "human", "de")
local u = unit.create(f, r, 1)
u:add_item("snowman", 1)
u:clear_orders()
u:add_order("BENUTZEN 1 Schneemann")
process_orders()
for u2 in r.units do
if u2.id~=u.id then
assert_equal("snowman", u2.race)
assert_equal(1000, u2.hp)
u = nil
break
end
end
assert_equal(nil, u)
end

View File

@ -112,6 +112,7 @@ void register_attributes(void)
at_register(&at_germs); at_register(&at_germs);
at_deprecate("hurting", a_readint); /* an old arena attribute */
at_deprecate("xontormiaexpress", a_readint); /* required for old datafiles */ at_deprecate("xontormiaexpress", a_readint); /* required for old datafiles */
at_deprecate("orcification", a_readint); /* required for old datafiles */ at_deprecate("orcification", a_readint); /* required for old datafiles */
at_deprecate("lua", read_ext); /* required for old datafiles */ at_deprecate("lua", read_ext); /* required for old datafiles */

View File

@ -8,9 +8,6 @@
#if MUSEUM_MODULE #if MUSEUM_MODULE
#include <modules/museum.h> #include <modules/museum.h>
#endif #endif
#if ARENA_MODULE
#include <modules/arena.h>
#endif
#include <triggers/triggers.h> #include <triggers/triggers.h>
#include <util/language.h> #include <util/language.h>
#include <util/functions.h> #include <util/functions.h>
@ -77,9 +74,6 @@ void game_init(void)
register_itemfunctions(); register_itemfunctions();
#if MUSEUM_MODULE #if MUSEUM_MODULE
register_museum(); register_museum();
#endif
#if ARENA_MODULE
register_arena();
#endif #endif
wormholes_register(); wormholes_register();

View File

@ -26,9 +26,6 @@
#if MUSEUM_MODULE #if MUSEUM_MODULE
#include <modules/museum.h> #include <modules/museum.h>
#endif #endif
#if ARENA_MODULE
#include <modules/arena.h>
#endif
#include <modules/autoseed.h> #include <modules/autoseed.h>
#include <kernel/building.h> #include <kernel/building.h>

View File

@ -70,9 +70,9 @@ struct order *ord)
if (amount > MAXGAIN) { if (amount > MAXGAIN) {
amount = MAXGAIN; amount = MAXGAIN;
} }
teach->value += amount * 30; teach->value += amount * STUDYDAYS;
if (teach->value > MAXGAIN * 30) { if (teach->value > MAXGAIN * STUDYDAYS) {
teach->value = MAXGAIN * 30; teach->value = MAXGAIN * STUDYDAYS;
} }
i_change(&u->items, itype, -amount); i_change(&u->items, itype, -amount);
return 0; return 0;
@ -80,7 +80,6 @@ struct order *ord)
} }
return EUNUSABLE; return EUNUSABLE;
} }
/* END studypotion */ /* END studypotion */
/* BEGIN speedsail */ /* BEGIN speedsail */
@ -344,9 +343,9 @@ struct order *ord)
void register_itemfunctions(void) void register_itemfunctions(void)
{ {
register_demonseye(); register_demonseye();
register_item_use(use_studypotion, "use_studypotion");
/* have tests: */ /* have tests: */
register_item_use(use_studypotion, "use_studypotion");
register_item_use(use_antimagiccrystal, "use_antimagic"); register_item_use(use_antimagiccrystal, "use_antimagic");
register_item_use(use_speedsail, "use_speedsail"); register_item_use(use_speedsail, "use_speedsail");
register_item_use(use_bagpipeoffear, "use_bagpipeoffear"); register_item_use(use_bagpipeoffear, "use_bagpipeoffear");

View File

@ -1,6 +1,5 @@
PROJECT(modules C) PROJECT(modules C)
SET(_FILES SET(_FILES
arena.c
autoseed.c autoseed.c
gmcmd.c gmcmd.c
museum.c museum.c

View File

@ -1,255 +0,0 @@
/*
Copyright (c) 1998-2015, Enno Rehling <enno@eressea.de>
Katja Zedel <katze@felidae.kn-bremen.de
Christian Schlittchen <corwin@amber.kn-bremen.de>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
**/
#include <platform.h>
#include <kernel/config.h>
#if ARENA_MODULE
#include "arena.h"
/* modules include */
#include "score.h"
/* items include */
#include <items/demonseye.h>
/* kernel includes */
#include <kernel/building.h>
#include <kernel/faction.h>
#include <kernel/item.h>
#include <kernel/messages.h>
#include <kernel/order.h>
#include <kernel/plane.h>
#include <kernel/pool.h>
#include <kernel/race.h>
#include <kernel/region.h>
#include <kernel/terrain.h>
#include <kernel/terrainid.h>
#include <kernel/unit.h>
#include <move.h>
/* util include */
#include <util/attrib.h>
#include <util/base36.h>
#include <util/event.h>
#include <util/gamedata.h>
#include <util/functions.h>
#include <util/strings.h>
#include <util/lists.h>
#include <util/log.h>
#include <util/resolve.h>
#include <util/rng.h>
#include <storage.h>
/* libc include */
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
/* exports: */
plane *arena = NULL;
/* local vars */
#define CENTRAL_VOLCANO 1
static region *tower_region[6];
static region *start_region[6];
static region *arena_region(int school)
{
return tower_region[school];
}
static building *arena_tower(int school)
{
return arena_region(school)->buildings;
}
static int leave_fail(unit * u)
{
ADDMSG(&u->faction->msgs, msg_message("arena_leave_fail", "unit", u));
return 1;
}
static int
leave_arena(struct unit *u, const struct item_type *itype, int amount,
order * ord)
{
if (!u->building && leave_fail(u)) {
return -1;
}
if (u->building != arena_tower(u->faction->magiegebiet) && leave_fail(u)) {
return -1;
}
UNUSED_ARG(amount);
UNUSED_ARG(ord);
UNUSED_ARG(itype);
assert(!"not implemented");
return 0;
}
static int enter_fail(unit * u)
{
ADDMSG(&u->faction->msgs, msg_message("arena_enter_fail", "region unit",
u->region, u));
return 1;
}
static int
enter_arena(unit * u, const item_type * itype, int amount, order * ord)
{
skill_t sk;
region *r = u->region;
unit *u2;
int fee = 2000;
UNUSED_ARG(ord);
UNUSED_ARG(amount);
UNUSED_ARG(itype);
if (u->faction->score > fee * 5) {
score_t score = u->faction->score / 5;
if (score < INT_MAX) {
fee = (int)score;
}
else {
fee = INT_MAX;
}
}
if (getplane(r) == arena)
return -1;
if (u->number != 1 && enter_fail(u))
return -1;
if (get_pooled(u, get_resourcetype(R_SILVER), GET_DEFAULT, fee) < fee
&& enter_fail(u))
return -1;
for (sk = 0; sk != MAXSKILLS; ++sk) {
if (get_level(u, sk) > 1 && enter_fail(u))
return -1;
}
for (u2 = r->units; u2; u2 = u2->next)
if (u2->faction == u->faction)
break;
assert(!"not implemented");
/*
for (res=0;res!=MAXRESOURCES;++res) if (res!=R_SILVER && res!=R_ARENA_GATE && (is_item(res) || is_herb(res) || is_potion(res))) {
int x = get_resource(u, res);
if (x) {
if (u2) {
change_resource(u2, res, x);
change_resource(u, res, -x);
}
else if (enter_fail(u)) return -1;
}
}
*/
if (get_money(u) > fee) {
if (u2)
change_money(u2, get_money(u) - fee);
else if (enter_fail(u))
return -1;
}
ADDMSG(&u->faction->msgs, msg_message("arena_enter_fail", "region unit",
u->region, u));
use_pooled(u, itype->rtype, GET_SLACK | GET_RESERVE, 1);
use_pooled(u, get_resourcetype(R_SILVER), GET_DEFAULT, fee);
set_money(u, 109);
fset(u, UFL_ANON_FACTION);
move_unit(u, start_region[rng_int() % 6], NULL);
return 0;
}
#ifdef CENTRAL_VOLCANO
static int caldera_handle(trigger * t, void *data)
{
/* call an event handler on caldera.
* data.v -> ( variant event, int timer )
*/
building *b = (building *)t->data.v;
if (b != NULL) {
unit **up = &b->region->units;
while (*up) {
unit *u = *up;
if (u->building == b) {
message *msg;
if (u->items) {
item **ip = &u->items;
msg = msg_message("caldera_handle_1", "unit items", u, u->items);
while (*ip) {
item *i = *ip;
i_remove(ip, i);
if (*ip == i)
ip = &i->next;
}
}
else {
msg = msg_message("caldera_handle_0", "unit", u);
}
add_message(&u->region->msgs, msg);
set_number(u, 0);
}
if (*up == u)
up = &u->next;
}
}
else {
log_error("could not perform caldera::handle()\n");
}
UNUSED_ARG(data);
return 0;
}
static void caldera_write(const trigger * t, struct storage *store)
{
building *b = (building *)t->data.v;
write_building_reference(b, store);
}
static int caldera_read(trigger * t, struct gamedata *data)
{
int rb =
read_reference(&t->data.v, data, read_building_reference,
resolve_building);
if (rb == 0 && !t->data.v) {
return AT_READ_FAIL;
}
return AT_READ_OK;
}
struct trigger_type tt_caldera = {
"caldera",
NULL,
NULL,
caldera_handle,
caldera_write,
caldera_read
};
#endif
void register_arena(void)
{
at_deprecate("hurting", a_readint);
register_function((pf_generic)enter_arena, "enter_arena");
register_function((pf_generic)leave_arena, "leave_arena");
tt_register(&tt_caldera);
}
#endif /* def ARENA_MODULE */

View File

@ -1,39 +0,0 @@
/*
Copyright (c) 1998-2015, Enno Rehling <enno@eressea.de>
Katja Zedel <katze@felidae.kn-bremen.de
Christian Schlittchen <corwin@amber.kn-bremen.de>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
**/
#ifndef ARENA_H
#define ARENA_H
#ifdef __cplusplus
extern "C" {
#endif
#if ARENA_MODULE == 0
#error "must define ARENA_MODULE to use this module"
#endif
/* exports: */
extern struct plane *arena;
extern void register_arena(void);
#ifdef ARENA_CREATION
extern void create_arena(void);
#endif
#ifdef __cplusplus
}
#endif
#endif

View File

@ -31,7 +31,6 @@
* or both. We don't want separate binaries for different games * or both. We don't want separate binaries for different games
*/ */
#define MUSEUM_MODULE 1 #define MUSEUM_MODULE 1
#define ARENA_MODULE 1
#undef REGIONOWNERS /* (WIP) region-owner uses HELP_TRAVEL to control entry to region */ #undef REGIONOWNERS /* (WIP) region-owner uses HELP_TRAVEL to control entry to region */