2001-01-27 12:32:32 +01:00
/* vi: set ts=2:
*
2001-04-14 13:39:14 +02:00
*
2003-07-29 11:48:03 +02:00
* Eressea PB ( E ) M host Copyright ( C ) 1998 - 2003
2001-01-27 12:32:32 +01:00
* Christian Schlittchen ( corwin @ amber . kn - bremen . de )
* Katja Zedel ( katze @ felidae . kn - bremen . de )
* Henning Peters ( faroul @ beyond . kn - bremen . de )
* Enno Rehling ( enno @ eressea - pbem . de )
* Ingo Wilken ( Ingo . Wilken @ informatik . uni - oldenburg . de )
*
* This program may not be used , modified or distributed without
* prior permission by the authors of Eressea .
*/
# include <config.h>
# include <eressea.h>
2003-08-03 23:38:17 +02:00
# ifdef ARENA_MODULE
2001-01-27 12:32:32 +01:00
# include "arena.h"
/* modules include */
# include "score.h"
/* attributes include */
# include <attributes/giveitem.h>
/* items include */
# include <items/demonseye.h>
/* kernel includes */
2004-06-21 18:45:27 +02:00
# include <kernel/building.h>
# include <kernel/faction.h>
# include <kernel/item.h>
# include <kernel/magic.h>
# include <kernel/message.h>
# include <kernel/movement.h>
# include <kernel/order.h>
# include <kernel/plane.h>
# include <kernel/pool.h>
# include <kernel/race.h>
# include <kernel/region.h>
# include <kernel/reports.h>
# include <kernel/skill.h>
2005-10-25 14:38:01 +02:00
# include <kernel/terrain.h>
# include <kernel/terrainid.h>
2004-06-21 18:45:27 +02:00
# include <kernel/unit.h>
2001-01-27 12:32:32 +01:00
/* util include */
# include <base36.h>
# include <resolve.h>
# include <functions.h>
# include <event.h>
2001-02-11 21:56:20 +01:00
# include <goodies.h>
2001-01-27 12:32:32 +01:00
/* libc include */
# include <assert.h>
# include <stdlib.h>
# include <string.h>
/* exports: */
plane * arena = NULL ;
/* local vars */
# define CENTRAL_VOLCANO 1
2001-02-11 21:56:20 +01:00
static unsigned int arena_id = 0 ;
2001-01-27 12:32:32 +01:00
static region * arena_center = NULL ;
static region * tower_region [ 6 ] ;
static region * start_region [ 6 ] ;
static int newarena = 0 ;
static region *
arena_region ( int magic ) {
return tower_region [ magic ] ;
}
static building *
arena_tower ( int magic ) {
return arena_region ( magic ) - > buildings ;
}
static int
leave_fail ( unit * u ) {
sprintf ( buf , " Der Versuch, die Greifenschwingen zu benutzen, schlug fehl. %s konnte die Ebene der Herausforderung nicht verlassen. " , unitname ( u ) ) ;
addmessage ( NULL , u - > faction , buf , MSG_MESSAGE , ML_IMPORTANT ) ;
return 1 ;
}
static int
2004-06-21 18:45:27 +02:00
leave_arena ( struct unit * u , const struct item_type * itype , int amount , order * ord )
2001-01-27 12:32:32 +01:00
{
if ( ! u - > building & & leave_fail ( u ) ) return - 1 ;
if ( u - > building ! = arena_tower ( u - > faction - > magiegebiet ) & & leave_fail ( u ) ) return - 1 ;
2002-03-16 18:30:48 +01:00
unused ( amount ) ;
2004-06-21 18:45:27 +02:00
unused ( ord ) ;
2001-01-27 12:32:32 +01:00
unused ( itype ) ;
assert ( ! " not implemented " ) ;
return 0 ;
}
static int
enter_fail ( unit * u ) {
2005-01-19 21:33:13 +01:00
sprintf ( buf , " In %s erklingt die Stimme des Torw<72> chters: 'Nur wer ohne materielle G<> ter und noch lernbegierig ist, der darf die Ebene der Herausforderung betreten. Und vergi<67> nicht mein Trinkgeld.'. %s erhielt keinen Einla<6C> . " , regionname ( u - > region , u - > faction ) , unitname ( u ) ) ;
2001-01-27 12:32:32 +01:00
addmessage ( NULL , u - > faction , buf , MSG_MESSAGE , ML_IMPORTANT ) ;
return 1 ;
}
static int
2004-06-21 18:45:27 +02:00
enter_arena ( unit * u , const item_type * itype , int amount , order * ord )
2001-01-27 12:32:32 +01:00
{
skill_t sk ;
region * r = u - > region ;
unit * u2 ;
int fee = u - > faction - > score / 5 ;
2004-06-21 18:45:27 +02:00
unused ( ord ) ;
2002-03-16 18:30:48 +01:00
unused ( amount ) ;
2001-01-27 12:32:32 +01:00
unused ( itype ) ;
if ( fee > 2000 ) fee = 2000 ;
if ( getplane ( r ) = = arena ) return - 1 ;
if ( u - > number ! = 1 & & enter_fail ( u ) ) return - 1 ;
2005-10-30 16:42:15 +01:00
if ( get_pooled ( u , oldresourcetype [ R_SILVER ] , GET_DEFAULT ) < fee & & enter_fail ( u ) ) return - 1 ;
2001-01-27 12:32:32 +01:00
for ( sk = 0 ; sk ! = MAXSKILLS ; + + sk ) {
2002-02-15 17:13:30 +01:00
if ( get_level ( u , sk ) > 1 & & enter_fail ( u ) ) return - 1 ;
2001-01-27 12:32:32 +01:00
}
for ( u2 = r - > units ; u2 ; u2 = u2 - > next ) if ( u2 - > faction = = u - > faction ) break ;
2005-09-08 21:03:42 +02:00
assert ( ! " not implemented " ) ;
/*
2001-01-27 12:32:32 +01:00
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 ;
}
}
2005-09-08 21:03:42 +02:00
*/
2001-01-27 12:32:32 +01:00
if ( get_money ( u ) > fee ) {
if ( u2 ) change_money ( u2 , get_money ( u ) - fee ) ;
else if ( enter_fail ( u ) ) return - 1 ;
}
2005-01-19 21:33:13 +01:00
sprintf ( buf , " In %s <20> ffnet sich ein Portal. Eine Stimme ert<72> nt, und spricht: 'Willkommen in der Ebene der Herausforderung'. %s durchschreitet das Tor zu einer anderen Welt. " , regionname ( u - > region , u - > faction ) , unitname ( u ) ) ;
2001-01-27 12:32:32 +01:00
addmessage ( NULL , u - > faction , buf , MSG_MESSAGE , ML_IMPORTANT ) ;
2005-10-30 16:42:15 +01:00
use_pooled ( u , itype - > rtype , GET_SLACK | GET_RESERVE , 1 ) ;
use_pooled ( u , oldresourcetype [ R_SILVER ] , GET_DEFAULT , fee ) ;
2005-10-29 14:08:40 +02:00
set_money ( u , 109 ) ;
2003-07-29 11:48:03 +02:00
fset ( u , UFL_PARTEITARNUNG ) ;
2001-01-27 12:32:32 +01:00
move_unit ( u , start_region [ rand ( ) % 6 ] , NULL ) ;
return 0 ;
}
/***
* * Szepter der Tr <EFBFBD> nen , Demo - Item
* * */
static int
2004-06-21 18:45:27 +02:00
use_wand_of_tears ( unit * user , const struct item_type * itype , int amount , order * ord )
2001-01-27 12:32:32 +01:00
{
2002-03-16 18:30:48 +01:00
int i ;
2004-06-21 18:45:27 +02:00
unused ( ord ) ;
2002-03-16 18:30:48 +01:00
for ( i = 0 ; i ! = amount ; + + i ) {
unit * u ;
for ( u = user - > region - > units ; u ; u = u - > next ) {
if ( u - > faction ! = user - > faction ) {
int i ;
for ( i = 0 ; i ! = u - > skill_size ; + + i ) {
if ( rand ( ) % 3 ) reduce_skill ( u , u - > skills + i , 1 ) ;
}
ADDMSG ( & u - > faction - > msgs , msg_message ( " wand_of_tears_effect " ,
" unit " , u ) ) ;
2002-02-15 17:13:30 +01:00
}
2001-01-27 12:32:32 +01:00
}
}
2002-02-15 17:13:30 +01:00
ADDMSG ( & user - > region - > msgs , msg_message ( " wand_of_tears_usage " ,
" unit " , user ) ) ;
2001-01-27 12:32:32 +01:00
return 0 ;
}
/**
* Tempel der Schreie , Demo - Geb <EFBFBD> ude * */
static int
age_hurting ( attrib * a ) {
building * b = ( building * ) a - > data . v ;
unit * u ;
int active = 0 ;
if ( b = = NULL ) return 0 ;
for ( u = b - > region - > units ; u ; u = u - > next ) {
if ( u - > building = = b ) {
if ( u - > faction - > magiegebiet = = M_CHAOS ) {
active + + ;
add_message ( & b - > region - > msgs , new_message ( NULL , " praytoigjarjuk%u:unit " , u ) ) ;
}
}
}
2001-12-10 01:13:39 +01:00
if ( active ) for ( u = b - > region - > units ; u ; u = u - > next ) if ( playerrace ( u - > faction - > race ) ) {
2001-01-27 12:32:32 +01:00
int i ;
if ( u - > faction - > magiegebiet ! = M_CHAOS ) {
for ( i = 0 ; i ! = active ; + + i ) u - > hp = ( u - > hp + 1 ) / 2 ; /* make them suffer, but not die */
add_message ( & b - > region - > msgs , new_message ( NULL , " cryinpain%u:unit " , u ) ) ;
}
}
return 1 ;
}
static void
write_hurting ( const attrib * a , FILE * F ) {
building * b = a - > data . v ;
2004-05-31 14:19:26 +02:00
fprintf ( F , " %d " , b - > no ) ;
2001-01-27 12:32:32 +01:00
}
static int
read_hurting ( attrib * a , FILE * F ) {
int i ;
fscanf ( F , " %d " , & i ) ;
a - > data . v = ( void * ) findbuilding ( i ) ;
if ( a - > data . v = = NULL ) {
- Neue Messages fertig
Messages werden jetzt in einem anderen Meta-Format (message* of
message_type*) gespeichert, das man in beliebige Formate (CR oder NR)
rendern kann. crmessage.c und nrmessage.c sind die render-engines dafür.
Die Messagetypen werden in res/{de,en}/messages.xml gesammelt, ultimativ
kann das aber durchaus eine einzelne Datei sein. Die ist derzeit nicht
wirklich xml (Umlaute drin, keine Definitionsdatei), aber gut lesbar.
- make_message
Diese Funktion ersetzt new_message, und ist etwas einfacher in der Syntax:
make_message("dumb_mistake", "unit region command", u, r, cmd) erzeugt
eine neue Nachricht, die dann einfach mit add_message wie bisher an die
Nachrichtenliste gehängt werden kann.
TODO: Messages könnte man durchaus reference-counten, und in mehrere Listen
einfügen, solang sie a) mehrfachverwendet (Kampf!) und b) vom Betrachter
unabhängig sind. Das spart einigen Speicher.
- CR Version erhöht.
Weil die MESSAGETYPES Blocks anders sind als früher
- OFFENSIVE_DELAY
Verbietet Einheiten, deren Partei eine Reigon niht bewachen, den
Angriff in der Region, wenn sie sich in der Runde zuvor bewegt haben.
Status der letzten Runde wird in neuem Attribut at_moved gespeichert.
- SHORT_ATTACKS
ein define, das angibt ob Kämpfen grundsätzlich keine lange Aktion ist.
- XML Parser
xml.[hc] enthält einen XML-Parser, dem man ein plugin mit callbacks
übergibt, die nach dem Parsen eines tokens aufgerufen werden.
2001-04-12 19:21:57 +02:00
log_error ( ( " temple of pain is broken \n " ) ) ;
2002-04-07 02:44:01 +02:00
return AT_READ_FAIL ;
2001-01-27 12:32:32 +01:00
}
2002-04-07 02:44:01 +02:00
return AT_READ_OK ;
2001-01-27 12:32:32 +01:00
}
static attrib_type at_hurting = {
" hurting " , NULL , NULL , age_hurting , write_hurting , read_hurting
} ;
static void
make_temple ( region * r )
{
const building_type * btype = bt_find ( " temple " ) ;
building * b ;
if ( btype = = NULL )
btype = bt_make ( " temple " , BTF_UNIQUE | BTF_NOBUILD | BTF_INDESTRUCTIBLE , - 1 , 2 , 50 ) ;
else {
b = r - > buildings ;
while ( b ! = NULL & & b - > type ! = btype ) b = b - > next ;
if ( b ! = NULL ) return ; /* gibt schon einen */
}
b = new_building ( btype , r , NULL ) ;
b - > size = btype - > maxsize ;
b - > name = strdup ( " Igjarjuk's Tempel der Schreie " ) ;
b - > display = strdup ( " Ein Schrein aus spitzen Knochen und lodernden Flammen, gewidmet dem Wyrm der Wyrme " ) ;
a_add ( & b - > attribs , a_new ( & at_hurting ) ) - > data . v = b ;
}
/**
* Initialisierung T <EFBFBD> rme */
static void
tower_init ( void )
{
int i , first = newarena ;
2005-10-26 22:12:28 +02:00
item_type * it_demonseye = it_find ( " demonseye " ) ;
item_type * it_griphonwing = it_find ( " griphonwing " ) ;
assert ( it_griphonwing & & it_demonseye ) ;
2001-01-27 12:32:32 +01:00
for ( i = 0 ; i ! = 6 ; + + i ) {
region * r = tower_region [ i ] = findregion ( arena_center - > x + delta_x [ i ] * 3 , arena_center - > y + delta_y [ i ] * 3 ) ;
2004-07-03 10:55:41 +02:00
if ( r ) {
start_region [ i ] = findregion ( arena_center - > x + delta_x [ i ] * 2 , arena_center - > y + delta_y [ i ] * 2 ) ;
2005-10-25 14:38:01 +02:00
if ( rterrain ( r ) ! = T_DESERT ) terraform ( r , T_DESERT ) ;
2004-07-03 10:55:41 +02:00
if ( ! r - > buildings ) {
2002-03-27 22:49:27 +01:00
building * b = new_building ( bt_find ( " castle " ) , r , NULL ) ;
2004-07-03 10:55:41 +02:00
b - > size = 10 ;
if ( i ! = 0 ) {
sprintf ( buf , " Turm des %s " ,
2005-10-23 11:05:11 +02:00
LOC ( default_locale , mkname ( " school " , magietypen [ i ] ) ) ) ;
2004-07-03 10:55:41 +02:00
}
else sprintf ( buf , " Turm der Ahnungslosen " ) ;
set_string ( & b - > name , buf ) ;
}
}
2001-01-27 12:32:32 +01:00
}
if ( first & & ! arena_center - > buildings ) {
2002-03-27 22:49:27 +01:00
building * b = new_building ( bt_find ( " castle " ) , arena_center , NULL ) ;
2001-01-27 12:32:32 +01:00
attrib * a ;
item * items ;
2005-10-26 22:12:28 +02:00
i_add ( & items , i_new ( it_griphonwing , 1 ) ) ;
i_add ( & items , i_new ( it_demonseye , 1 ) ) ;
2001-01-27 12:32:32 +01:00
a = a_add ( & b - > attribs , make_giveitem ( b , items ) ) ;
b - > size = 10 ;
set_string ( & b - > name , " H<EFBFBD> hle des Greifen " ) ;
}
}
static void
guardian_faction ( plane * pl , int id )
{
region * r ;
faction * f = findfaction ( id ) ;
if ( ! f ) {
f = calloc ( 1 , sizeof ( faction ) ) ;
f - > banner = strdup ( " Sie dienen dem gro<72> en Wyrm " ) ;
2002-03-03 13:53:05 +01:00
f - > passw = strdup ( itoa36 ( rand ( ) ) ) ;
f - > override = strdup ( itoa36 ( rand ( ) ) ) ;
2004-08-22 11:54:39 +02:00
set_email ( & f - > email , " igjarjuk@eressea.de " ) ;
2001-01-27 12:32:32 +01:00
f - > name = strdup ( " Igjarjuks Kundschafter " ) ;
2001-12-10 01:13:39 +01:00
f - > race = new_race [ RC_ILLUSION ] ;
2001-01-27 12:32:32 +01:00
f - > age = turn ;
f - > locale = find_locale ( " de " ) ;
f - > options = want ( O_COMPRESS ) | want ( O_REPORT ) | want ( O_COMPUTER ) | want ( O_ADRESSEN ) | want ( O_DEBUG ) ;
f - > no = id ;
addlist ( & factions , f ) ;
2005-01-19 21:33:13 +01:00
fhash ( f ) ;
2001-01-27 12:32:32 +01:00
}
2001-12-10 01:13:39 +01:00
if ( f - > race ! = new_race [ RC_ILLUSION ] ) {
2001-01-27 12:32:32 +01:00
assert ( ! " guardian id vergeben " ) ;
exit ( 0 ) ;
}
f - > lastorders = turn ;
f - > alive = true ;
2005-10-25 14:38:01 +02:00
for ( r = regions ; r ; r = r - > next ) if ( getplane ( r ) = = pl & & rterrain ( r ) ! = T_FIREWALL )
2001-01-27 12:32:32 +01:00
{
unit * u ;
freset ( r , RF_ENCOUNTER ) ;
for ( u = r - > units ; u ; u = u - > next ) {
if ( u - > faction = = f ) break ;
}
if ( u ) continue ;
2001-12-10 01:13:39 +01:00
u = createunit ( r , f , 1 , new_race [ RC_GOBLIN ] ) ;
2001-01-27 12:32:32 +01:00
set_string ( & u - > name , " Igjarjuks Auge " ) ;
set_item ( u , I_RING_OF_INVISIBILITY , 1 ) ;
2005-04-30 19:07:46 +02:00
set_order ( & u - > thisorder , NULL ) ;
# ifdef LASTORDER
set_order ( & u - > lastorder , NULL ) ;
# endif
2003-07-29 11:48:03 +02:00
fset ( u , UFL_PARTEITARNUNG ) ;
2001-01-27 12:32:32 +01:00
set_money ( u , 1000 ) ;
}
}
static void
2005-06-10 00:10:35 +02:00
block_create ( short x1 , short y1 , char terrain )
2001-01-27 12:32:32 +01:00
{
2005-06-10 00:10:35 +02:00
short x , y ;
2001-01-27 12:32:32 +01:00
for ( x = 0 ; x ! = BLOCKSIZE ; + + x ) {
for ( y = 0 ; y ! = BLOCKSIZE ; + + y ) {
region * r = new_region ( x1 + x , y1 + y ) ;
terraform ( r , terrain ) ;
}
}
}
# 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 ) {
sprintf ( buf , " %s springt in die ewigen Feuer des Kraters. " , unitname ( u ) ) ;
if ( u - > items ) {
item * * ip = & u - > items ;
strcat ( buf , " Mit der sterblichen H<> lle des Helden vergl<67> hen " ) ;
while ( * ip ) {
item * i = * ip ;
char zText [ 10 ] ;
2001-05-20 10:41:11 +02:00
sprintf ( zText , " %d %s " , i - > number , locale_string ( default_locale , resourcename ( i - > type - > rtype , i - > number ! = 1 ) ) ) ;
2001-01-27 12:32:32 +01:00
strcat ( buf , zText ) ;
i_remove ( ip , i ) ;
if ( * ip = = i ) ip = & i - > next ;
if ( i - > next ) strcat ( buf , " , " ) ;
}
strcat ( buf , " . " ) ;
}
addmessage ( u - > region , NULL , buf , MSG_MESSAGE , ML_IMPORTANT ) ;
set_number ( u , 0 ) ;
}
if ( * up = = u ) up = & u - > next ;
}
} else
- Neue Messages fertig
Messages werden jetzt in einem anderen Meta-Format (message* of
message_type*) gespeichert, das man in beliebige Formate (CR oder NR)
rendern kann. crmessage.c und nrmessage.c sind die render-engines dafür.
Die Messagetypen werden in res/{de,en}/messages.xml gesammelt, ultimativ
kann das aber durchaus eine einzelne Datei sein. Die ist derzeit nicht
wirklich xml (Umlaute drin, keine Definitionsdatei), aber gut lesbar.
- make_message
Diese Funktion ersetzt new_message, und ist etwas einfacher in der Syntax:
make_message("dumb_mistake", "unit region command", u, r, cmd) erzeugt
eine neue Nachricht, die dann einfach mit add_message wie bisher an die
Nachrichtenliste gehängt werden kann.
TODO: Messages könnte man durchaus reference-counten, und in mehrere Listen
einfügen, solang sie a) mehrfachverwendet (Kampf!) und b) vom Betrachter
unabhängig sind. Das spart einigen Speicher.
- CR Version erhöht.
Weil die MESSAGETYPES Blocks anders sind als früher
- OFFENSIVE_DELAY
Verbietet Einheiten, deren Partei eine Reigon niht bewachen, den
Angriff in der Region, wenn sie sich in der Runde zuvor bewegt haben.
Status der letzten Runde wird in neuem Attribut at_moved gespeichert.
- SHORT_ATTACKS
ein define, das angibt ob Kämpfen grundsätzlich keine lange Aktion ist.
- XML Parser
xml.[hc] enthält einen XML-Parser, dem man ein plugin mit callbacks
übergibt, die nach dem Parsen eines tokens aufgerufen werden.
2001-04-12 19:21:57 +02:00
log_error ( ( " could not perform caldera::handle() \n " ) ) ;
2001-01-27 12:32:32 +01:00
unused ( data ) ;
return 0 ;
}
static void
caldera_write ( const trigger * t , FILE * F )
{
building * b = ( building * ) t - > data . v ;
fprintf ( F , " %s " , itoa36 ( b - > no ) ) ;
}
static int
caldera_read ( trigger * t , FILE * F )
{
char zText [ 128 ] ;
2005-06-10 00:10:35 +02:00
variant var ;
2001-01-27 12:32:32 +01:00
fscanf ( F , " %s " , zText ) ;
2005-06-10 00:10:35 +02:00
var . i = atoi36 ( zText ) ;
t - > data . v = findbuilding ( var . i ) ;
if ( t - > data . v = = NULL ) ur_add ( var , & t - > data . v , resolve_building ) ;
2001-01-27 12:32:32 +01:00
2002-04-07 02:44:01 +02:00
return AT_READ_OK ;
2001-01-27 12:32:32 +01:00
}
struct trigger_type tt_caldera = {
" caldera " ,
NULL ,
NULL ,
caldera_handle ,
caldera_write ,
caldera_read
} ;
static trigger *
trigger_caldera ( building * b )
{
trigger * t = t_new ( & tt_caldera ) ;
t - > data . v = b ;
return t ;
}
static void
init_volcano ( void )
{
building * b ;
region * r = arena_center ;
assert ( arena_center ) ;
2005-10-25 14:38:01 +02:00
if ( rterrain ( r ) ! = T_DESERT ) return ; /* been done before */
2001-01-27 12:32:32 +01:00
terraform ( arena_center , T_VOLCANO_SMOKING ) ;
2002-03-27 22:49:27 +01:00
b = new_building ( bt_find ( " caldera " ) , r , NULL ) ;
2001-01-27 12:32:32 +01:00
b - > size = 1 ;
b - > name = strdup ( " Igjarjuk's Schlund " ) ;
b - > display = strdup ( " Feurige Lava flie<69> t aus dem Krater des gro<72> en Vulkans. Alles wird von ihr verschlungen. " ) ;
add_trigger ( & b - > attribs , " timer " , trigger_caldera ( b ) ) ;
tt_register ( & tt_caldera ) ;
}
# endif
void
create_arena ( void )
{
2005-06-10 00:10:35 +02:00
short x ;
2001-01-27 12:32:32 +01:00
arena_id = hashstring ( " arena " ) ;
arena = getplanebyid ( arena_id ) ;
if ( arena ! = NULL ) return ;
score ( ) ; /* ist wichtig, damit alle Parteien einen score haben, wenn sie durchs Tor wollen. */
guardian_faction ( arena , 999 ) ;
if ( arena ) arena_center = findregion ( plane_center_x ( arena ) , plane_center_y ( arena ) ) ;
if ( ! arena_center ) {
newarena = 1 ;
arena = create_new_plane ( arena_id , " Arena " , - 10000 , - 10000 , 0 , BLOCKSIZE - 1 , PFL_LOWSTEALING | PFL_NORECRUITS | PFL_NOALLIANCES ) ;
block_create ( arena - > minx , arena - > miny , T_OCEAN ) ;
arena_center = findregion ( plane_center_x ( arena ) , plane_center_y ( arena ) ) ;
for ( x = 0 ; x ! = BLOCKSIZE ; + + x ) {
2005-06-10 00:10:35 +02:00
short y ;
2001-01-27 12:32:32 +01:00
for ( y = 0 ; y ! = BLOCKSIZE ; + + y ) {
region * r = findregion ( arena - > minx + x , arena - > miny + y ) ;
freset ( r , RF_ENCOUNTER ) ;
r - > planep = arena ;
switch ( distance ( r , arena_center ) ) {
case 4 :
terraform ( r , T_FIREWALL ) ;
break ;
case 0 :
terraform ( r , T_GLACIER ) ;
break ;
case 1 :
terraform ( r , T_SWAMP ) ;
break ;
case 2 :
terraform ( r , T_MOUNTAIN ) ;
break ;
}
}
}
}
make_temple ( arena_center ) ;
# ifdef CENTRAL_VOLCANO
init_volcano ( ) ;
# else
if ( arena_center - > terrain ! = T_DESERT ) terraform ( arena_center , T_DESERT ) ;
# endif
rsetmoney ( arena_center , 0 ) ;
rsetpeasants ( arena_center , 0 ) ;
tower_init ( ) ;
}
void
2003-07-29 11:48:03 +02:00
register_arena ( void )
2001-01-27 12:32:32 +01:00
{
at_register ( & at_hurting ) ;
register_function ( ( pf_generic ) use_wand_of_tears , " use_wand_of_tears " ) ;
2001-12-10 01:13:39 +01:00
register_function ( ( pf_generic ) enter_arena , " enter_arena " ) ;
register_function ( ( pf_generic ) leave_arena , " leave_arena " ) ;
2001-01-27 12:32:32 +01:00
tt_register ( & tt_caldera ) ;
}
2003-08-03 23:38:17 +02:00
# endif /* def ARENA_MODULE */