diff --git a/src/common/items/items.c b/src/common/items/items.c index 4b665fd41..76e608913 100644 --- a/src/common/items/items.c +++ b/src/common/items/items.c @@ -18,6 +18,7 @@ #include "demonseye.h" #include "weapons.h" #include "xerewards.h" +#include "catapultammo.h" #if GROWING_TREES # include "seed.h" #endif @@ -36,6 +37,7 @@ register_items(void) #endif register_birthday_firework(); register_lebkuchenherz(); + register_catapultammo(); } void diff --git a/src/common/items/weapons.c b/src/common/items/weapons.c index efbf8dee1..59db24bfe 100644 --- a/src/common/items/weapons.c +++ b/src/common/items/weapons.c @@ -16,11 +16,14 @@ #include #include "weapons.h" +#include "catapultammo.h" + #include #include #include #include #include +#include /* util includes */ #include @@ -35,7 +38,7 @@ static weapon_mod wm_bow[] = { }; static weapon_mod wm_catapult[] = { - { 1, WMF_MISSILE_TARGET }, + { 4, WMF_MISSILE_TARGET }, { 0, 0 } }; @@ -187,6 +190,8 @@ attack_firesword(const troop * at, int *casualties, int row) return true; } +#define CATAPULT_ATTACKS 6 + static boolean attack_catapult(const troop * at, int * casualties, int row) { @@ -197,13 +202,20 @@ attack_catapult(const troop * at, int * casualties, int row) int d = 0, n; int minrow, maxrow; weapon * wp = af->person[at->index].weapon; - + assert(row>=FIGHT_ROW); if (row>BEHIND_ROW) return false; /* keine weiteren attacken */ - + assert(wp->type->itype==olditemtype[I_CATAPULT]); + assert(af->person[at->index].reload==0); + +#if CATAPULT_AMMUNITION + if(new_get_pooled(au, &rt_catapultammo, GET_SLACK|GET_RESERVE|GET_POOLED_SLACK|GET_POOLED_RESERVE|GET_POOLED_FORCE) <= 0) { + /* No ammo. Use other weapon if available. */ + return true; + } +#endif - assert (af->person[at->index].reload==0); if (af->catmsg == -1) { int i, k=0; for (i=0;i<=at->index;++i) { @@ -215,7 +227,12 @@ attack_catapult(const troop * at, int * casualties, int row) } minrow = FIGHT_ROW; maxrow = FIGHT_ROW; - n = min(10, count_enemies(b, af->side, FS_ENEMY, minrow, maxrow)); + + n = min(CATAPULT_ATTACKS, count_enemies(b, af->side, FS_ENEMY, minrow, maxrow)); + +#if CATAPULT_AMMUNITION + new_use_pooled(au, &rt_catapultammo, GET_SLACK|GET_RESERVE|GET_POOLED_SLACK|GET_POOLED_RESERVE|GET_POOLED_FORCE, 1); +#endif while (--n >= 0) { /* Select defender */ diff --git a/src/common/settings-eressea.h b/src/common/settings-eressea.h index f35460e07..68d6da0c5 100644 --- a/src/common/settings-eressea.h +++ b/src/common/settings-eressea.h @@ -34,3 +34,5 @@ #define GUARD_DISABLES_PRODUCTION 1 #define RESOURCE_QUANTITY 1.0 #define RECRUITFRACTION 5 +#define CATAPULT_AMMUNITION 0 /* Gebaut werden kann sie auch mit 0! */ + diff --git a/src/common/settings-tutorial.h b/src/common/settings-tutorial.h index 274b0dd46..09f0e81ba 100644 --- a/src/common/settings-tutorial.h +++ b/src/common/settings-tutorial.h @@ -30,8 +30,9 @@ #define SKILLPOINTS 0 #define NEW_MIGRATION 1 #define PEASANTS_DO_NOT_STARVE 0 -#define GUARD_DISABLES_RECRUIT 0 -#define GUARD_DISABLES_PRODUCTION 0 -#define RESOURCE_QUANTITY 1.0 -#define RECRUITFRACTION 20 +#define GUARD_DISABLES_RECRUIT 1 +#define GUARD_DISABLES_PRODUCTION 1 +#define RESOURCE_QUANTITY 0.5 +#define RECRUITFRACTION 5 +#define CATAPULT_AMMUNITION 1 diff --git a/src/common/settings-vinyambar-classic.h b/src/common/settings-vinyambar-classic.h index aea3262a3..830dd27ea 100644 --- a/src/common/settings-vinyambar-classic.h +++ b/src/common/settings-vinyambar-classic.h @@ -32,4 +32,5 @@ #define GUARD_DISABLES_PRODUCTION 0 #define RESOURCE_QUANTITY 1.0 #define RECRUITFRACTION 20 +#define CATAPULT_AMMUNITION 0 diff --git a/src/common/settings-vinyambar-murder.h b/src/common/settings-vinyambar-murder.h index 001061ce7..77a7658bc 100644 --- a/src/common/settings-vinyambar-murder.h +++ b/src/common/settings-vinyambar-murder.h @@ -33,7 +33,8 @@ #define GUARD_DISABLES_RECRUIT 1 #define GUARD_DISABLES_PRODUCTION 1 #define RESOURCE_QUANTITY 1.0 -#define RECRUITFRACTION 20 +#define RECRUITFRACTION 5 +#define CATAPULT_AMMUNITION 1 #define VICTORY_CONDITION VICTORY_MURDER #define VICTORY_DELAY 4 diff --git a/src/common/settings-vinyambar.h b/src/common/settings-vinyambar.h index 51eca8858..3a5c0806c 100644 --- a/src/common/settings-vinyambar.h +++ b/src/common/settings-vinyambar.h @@ -32,4 +32,5 @@ #define GUARD_DISABLES_PRODUCTION 0 #define RESOURCE_QUANTITY 1.0 #define RECRUITFRACTION 20 +#define CATAPULT_AMMUNITION 0 diff --git a/src/res/de/strings.xml b/src/res/de/strings.xml index 45b35479d..5f1bf200e 100644 --- a/src/res/de/strings.xml +++ b/src/res/de/strings.xml @@ -609,6 +609,14 @@ Phiolen + + Katapultmunition + catapult ammunition + + + Katapultmunition + catapult ammunition + Resourcen