From 4ebdb695081141fb0bf41e8f41c7da10b4dbf504 Mon Sep 17 00:00:00 2001 From: Christian Schlittchen Date: Wed, 27 Nov 2002 18:28:51 +0000 Subject: [PATCH] =?UTF-8?q?-=20Attribut=20at=5Faggressive=20f=C3=BCr=20die?= =?UTF-8?q?=20vinya-NPCs.=20-=20User-Makefiles=20jetzt=20mit=20Hostnamen.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Makefile.include | 2 +- src/common/attributes/aggressive.c | 41 +++++++++++++++++++++++++ src/common/attributes/aggressive.h | 17 +++++++++++ src/common/attributes/attributes.c | 2 ++ src/common/gamecode/monster.c | 20 +++++++++--- src/corwin@amber.mk | 49 ++++++++++++++++++++++++++++++ src/corwin@liarana.mk | 49 ++++++++++++++++++++++++++++++ 7 files changed, 174 insertions(+), 6 deletions(-) create mode 100644 src/common/attributes/aggressive.c create mode 100644 src/common/attributes/aggressive.h create mode 100644 src/corwin@amber.mk create mode 100644 src/corwin@liarana.mk diff --git a/src/Makefile.include b/src/Makefile.include index b17583a43..c0a4a1347 100644 --- a/src/Makefile.include +++ b/src/Makefile.include @@ -42,7 +42,7 @@ MSG_SUBDIR = "--> Making $@ in $$subdir" ## user-defined makefiles ## -MKFILES = $(wildcard $(ERESSEA_SRC)/$(USER).mk $(ERESSEA_SRC)/$(OSTYPE).mk $(ERESSEA_SRC)/$(HOSTTYPE).mk $(ERESSEA_SRC)/$(ARCH).mk) +MKFILES = $(wildcard $(ERESSEA_SRC)/$(USER)@$(HOST).mk $(ERESSEA_SRC)/$(OSTYPE).mk $(ERESSEA_SRC)/$(HOSTTYPE).mk $(ERESSEA_SRC)/$(ARCH).mk) ifeq ($(MKFILES), ) else include $(MKFILES) diff --git a/src/common/attributes/aggressive.c b/src/common/attributes/aggressive.c new file mode 100644 index 000000000..cbcf69ec0 --- /dev/null +++ b/src/common/attributes/aggressive.c @@ -0,0 +1,41 @@ +/* vi: set ts=2: + * + * + * Eressea PB(E)M host Copyright (C) 1998-2000 + * 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 +#include "aggressive.h" + +#include + +attrib_type at_aggressive = { + "aggressive", + NULL, + NULL, + NULL, + NULL, + NULL, +}; + +attrib * +make_aggressive(int chance) +{ + attrib * a = a_new(&at_aggressive); + a->data.i = chance; + return a; +} + +void +init_aggressive(void) +{ + at_register(&at_aggressive); +} diff --git a/src/common/attributes/aggressive.h b/src/common/attributes/aggressive.h new file mode 100644 index 000000000..b0d55a6bb --- /dev/null +++ b/src/common/attributes/aggressive.h @@ -0,0 +1,17 @@ +/* vi: set ts=2: + * + * + * Eressea PB(E)M host Copyright (C) 1998-2000 + * 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. + */ + +extern struct attrib_type at_aggressive; +extern struct attrib * make_aggressive(int chance); +extern void init_aggressive(void); diff --git a/src/common/attributes/attributes.c b/src/common/attributes/attributes.c index 6b6067c8a..fff89c846 100644 --- a/src/common/attributes/attributes.c +++ b/src/common/attributes/attributes.c @@ -38,6 +38,7 @@ # include "option.h" #endif #include "moved.h" +#include "aggressive.h" /* util includes */ #include @@ -72,4 +73,5 @@ init_attributes(void) #ifdef USE_UGROUPS init_ugroup(); #endif + init_aggressive(); } diff --git a/src/common/gamecode/monster.c b/src/common/gamecode/monster.c index f4314660a..666ec4a88 100644 --- a/src/common/gamecode/monster.c +++ b/src/common/gamecode/monster.c @@ -59,6 +59,7 @@ /* attributes includes */ #include #include +#include /* spezialmonster */ #include @@ -605,7 +606,7 @@ random_attack_by_monster(const region * r, unit * u) if (target && target != u && humanoidrace(target->race) - && !illusionaryrace(target->race) + && !illusionaryrace(target->race) && target->number <= max) { if (monster_attack(u, target)) { @@ -990,11 +991,20 @@ plan_monsters(void) move_monster(r, u); } else { boolean done = false; - if((u->race->flags & RCF_ATTACKRANDOM) - && rand()%100race->flags & RCF_ATTACKRANDOM) && is_moving == false) { - done = random_attack_by_monster(r, u); + int chance; + attrib *a = a_find(u->attribs, &at_aggressive); + + if(a) { + chance = a->data.i; + } else { + chance = MONSTERATTACK; + } + + if(rand()%100 < chance) { + done = random_attack_by_monster(r, u); + } } if (!done) { if(u->race == new_race[RC_SEASERPENT]) { diff --git a/src/corwin@amber.mk b/src/corwin@amber.mk new file mode 100644 index 000000000..91d9a78e4 --- /dev/null +++ b/src/corwin@amber.mk @@ -0,0 +1,49 @@ + +ifndef ERESSEA + export ERESSEA=$(PWD) +endif + +# Hier definieren, damit nicht '@gcc' +CC = gcc-3.2 -D_GNU_SOURCE -ansi -pedantic +DEPEND = @gcc-3.2 -MM -MG -r +# CC = gcc -D_GNU_SOURCE +AR = ar +CTAGS = ctags-exuberant +LD = gcc-3.2 +INSTALL = cp +CFLAGS += -march=athlon -minline-all-stringops + +# Ps = 0 -> Normal (default) +# Ps = 1 -> Bold +# Ps = 4 -> Underlined +# Ps = 5 -> Blink (appears as Bold) +# Ps = 7 -> Inverse +# Ps = 8 -> Invisible (hidden) +# Ps = 2 2 -> Normal (neither bold nor faint) +# Ps = 2 4 -> Not underlined +# Ps = 2 5 -> Steady (not blinking) +# Ps = 2 7 -> Positive (not inverse) +# Ps = 2 8 -> Visible (not hidden) +# Ps = 3 0 -> Set foreground color to Black +# Ps = 3 1 -> Set foreground color to Red +# Ps = 3 2 -> Set foreground color to Green +# Ps = 3 3 -> Set foreground color to Yellow +# Ps = 3 4 -> Set foreground color to Blue +# Ps = 3 5 -> Set foreground color to Magenta +# Ps = 3 6 -> Set foreground color to Cyan +# Ps = 3 7 -> Set foreground color to White +# Ps = 3 9 -> Set foreground color to default (original) +# Ps = 4 0 -> Set background color to Black +# Ps = 4 1 -> Set background color to Red +# Ps = 4 2 -> Set background color to Green +# Ps = 4 3 -> Set background color to Yellow +# Ps = 4 4 -> Set background color to Blue +# Ps = 4 5 -> Set background color to Magenta +# Ps = 4 6 -> Set background color to Cyan +# Ps = 4 7 -> Set background color to White +# Ps = 4 9 -> Set background color to default (original). + +MSG_COMPILE = "\#\#\#\#\# Compiling $@ \#\#\#\#\#" +MSG_SUBDIR = "\#\#\#\#\# Making $@ in $$subdir \#\#\#\#\#" + + diff --git a/src/corwin@liarana.mk b/src/corwin@liarana.mk new file mode 100644 index 000000000..cd6f2febe --- /dev/null +++ b/src/corwin@liarana.mk @@ -0,0 +1,49 @@ + +ifndef ERESSEA + export ERESSEA=$(PWD) +endif + +# Hier definieren, damit nicht '@gcc' +CC = gcc -D_GNU_SOURCE -ansi -pedantic +DEPEND = @gcc -MM -MG -r +# CC = gcc -D_GNU_SOURCE +AR = ar +CTAGS = ctags-exuberant +LD = gcc +INSTALL = cp +# CFLAGS += -march=athlon -minline-all-stringops + +# Ps = 0 -> Normal (default) +# Ps = 1 -> Bold +# Ps = 4 -> Underlined +# Ps = 5 -> Blink (appears as Bold) +# Ps = 7 -> Inverse +# Ps = 8 -> Invisible (hidden) +# Ps = 2 2 -> Normal (neither bold nor faint) +# Ps = 2 4 -> Not underlined +# Ps = 2 5 -> Steady (not blinking) +# Ps = 2 7 -> Positive (not inverse) +# Ps = 2 8 -> Visible (not hidden) +# Ps = 3 0 -> Set foreground color to Black +# Ps = 3 1 -> Set foreground color to Red +# Ps = 3 2 -> Set foreground color to Green +# Ps = 3 3 -> Set foreground color to Yellow +# Ps = 3 4 -> Set foreground color to Blue +# Ps = 3 5 -> Set foreground color to Magenta +# Ps = 3 6 -> Set foreground color to Cyan +# Ps = 3 7 -> Set foreground color to White +# Ps = 3 9 -> Set foreground color to default (original) +# Ps = 4 0 -> Set background color to Black +# Ps = 4 1 -> Set background color to Red +# Ps = 4 2 -> Set background color to Green +# Ps = 4 3 -> Set background color to Yellow +# Ps = 4 4 -> Set background color to Blue +# Ps = 4 5 -> Set background color to Magenta +# Ps = 4 6 -> Set background color to Cyan +# Ps = 4 7 -> Set background color to White +# Ps = 4 9 -> Set background color to default (original). + +MSG_COMPILE = "\#\#\#\#\# Compiling $@ \#\#\#\#\#" +MSG_SUBDIR = "\#\#\#\#\# Making $@ in $$subdir \#\#\#\#\#" + +