Merge pull request #906 from ennorehling/develop

Develop
This commit is contained in:
Enno Rehling 2020-05-23 12:37:37 +02:00 committed by GitHub
commit 43397ca792
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 87 additions and 27 deletions

View File

@ -3890,7 +3890,7 @@ msgstr "Ent"
msgctxt "iteminfo"
msgid "dwarfspoil"
msgstr "Beim Barte des Proheten! Ach nein, Zwergen. Irgendetwas riecht hier ranzig."
msgstr "Beim Barte des Propheten! Ach nein, Zwergen. Irgendetwas riecht hier ranzig."
msgctxt "race"
msgid "clone"
@ -6320,3 +6320,44 @@ msgctxt "race"
msgid "wolf"
msgstr "Wolf"
msgctxt "iteminfo"
msgid "elfspoil"
msgstr "Die Ohren sind spitz und beinahe trapezförmig. Wie kann
damit hören?"
msgctxt "iteminfo"
msgid "goblinspoil"
msgstr "Die Fratze des kleinen Kopfs wirkt beinahe etwas kindlich
zierlich, aber dennoch liegt etwas Listiges darin."
msgctxt "iteminfo"
msgid "halflingspoil"
msgstr "Die Sohle des behaarten Fußes ist deutlich dicker, beinahe
wie ein Huf."
msgctxt "iteminfo"
msgid "aquarianspoil"
msgstr "Die kleine, türkisfarbene Schuppe glänzt in der Sonne. Dennoch ist sie erstaunlich hart."
msgctxt "iteminfo"
msgid "humanspoil"
msgstr "Ob blond oder braun, ob kurz oder lang, du hast ein Büschel Haare mit einem Stück Haut in der Hand."
msgctxt "iteminfo"
msgid "catspoil"
msgstr "Wie ein kleines Seil aus weichem Fell."
msgctxt "iteminfo"
msgid "insectspoil"
msgstr "Das am Kopf der meisten Gliederfüßer auftretende,
gegliederte Extremitätenpaar, das mit Sensillen (Tastsinn, Geruchssinn)
ausgestattet ist."
msgctxt "iteminfo"
msgid "orcspoil"
msgstr "Große, spitze Zähne. Ob sie früher einem Ork oder doch einem Wildschwein gehörten ist nicht so leicht zu unterscheiden."
msgctxt "iteminfo"
msgid "demonspoil"
msgstr "Eine giftige und grüne Flüssigkeit in einer kleinen Phiole,
keine humanoide Rasse außer Dämonen wagt damit in Kontakt zu kommen."

View File

@ -76,7 +76,7 @@ static unit *random_unit(const region * r)
return u;
}
static void chaos(region * r)
static void chaos(region * r, faction *monsters)
{
if (rng_int() % 100 < 8) {
switch (rng_int() % 3) {
@ -84,10 +84,10 @@ static void chaos(region * r)
if (!(r->terrain->flags & SEA_REGION)) {
unit *u = random_unit(r);
if (u && !undeadrace(u_race(u))) {
ADDMSG(&u->faction->msgs, msg_message("chaos_disease", "unit", u));
u_setfaction(u, get_monsters());
u_freeorders(u);
u_setrace(u, get_race(RC_GHOUL));
if (join_monsters(u, monsters)) {
ADDMSG(&u->faction->msgs, msg_message("chaos_disease", "unit", u));
u_setrace(u, get_race(RC_GHOUL));
}
}
}
break;
@ -99,17 +99,17 @@ static void chaos(region * r)
case 0:
mfac = 100;
u =
create_unit(r, get_monsters(), rng_int() % 8 + 1,
create_unit(r, monsters, rng_int() % 8 + 1,
get_race(RC_FIREDRAGON), 0, NULL, NULL);
break;
case 1:
mfac = 500;
u = create_unit(r, get_monsters(), rng_int() % 4 + 1,
u = create_unit(r, monsters, rng_int() % 4 + 1,
get_race(RC_DRAGON), 0, NULL, NULL);
break;
default:
mfac = 1000;
u = create_unit(r, get_monsters(), rng_int() % 2 + 1,
u = create_unit(r, monsters, rng_int() % 2 + 1,
get_race(RC_WYRM), 0, NULL, NULL);
break;
}
@ -184,7 +184,7 @@ void chaos_update(void) {
/* Chaos */
for (r = regions; r; r = r->next) {
if ((r->flags & RF_CHAOTIC)) {
chaos(r);
chaos(r, get_monsters());
}
}
}

View File

@ -290,10 +290,10 @@ static int forget_cmd(unit * u, order * ord)
else {
unit *ufam = get_familiar(u);
if (ufam) {
a_removeall(&ufam->attribs, NULL);
u_setfaction(ufam, get_monsters());
u_freeorders(ufam);
unit_convert_race(ufam, NULL, "ghost");
if (join_monsters(ufam, NULL)) {
a_removeall(&ufam->attribs, NULL);
unit_convert_race(ufam, NULL, "ghost");
}
}
a_removeall(&u->attribs, &at_mage);
a_removeall(&u->attribs, &at_familiar);

View File

@ -43,9 +43,10 @@
#include <util/strings.h>
/* attributes includes */
#include <attributes/targetregion.h>
#include <attributes/otherfaction.h>
#include <attributes/hate.h>
#include <attributes/otherfaction.h>
#include <attributes/stealth.h>
#include <attributes/targetregion.h>
#include <spells/regioncurse.h>
@ -179,6 +180,22 @@ static order *monster_attack(unit * u, const unit * target)
return create_order(K_ATTACK, u->faction->locale, "%i", target->no);
}
bool join_monsters(unit *u, faction *monsters) {
if (monsters == NULL) {
monsters = get_monsters();
if (monsters == NULL) {
return false;
}
}
u_setfaction(u, monsters);
u->status = ST_FIGHT;
a_removeall(&u->attribs, &at_otherfaction);
u->flags &= ~UFL_ANON_FACTION;
u_seteffstealth(u, -1);
u_freeorders(u);
return true;
}
void monsters_desert(struct faction *monsters)
{
region *r;
@ -188,15 +205,15 @@ void monsters_desert(struct faction *monsters)
unit *u;
for (u = r->units; u; u = u->next) {
if (u->faction!=monsters
if (u->faction != monsters
&& (u_race(u)->flags & RCF_DESERT)) {
if (fval(u, UFL_ISNEW))
continue;
if (rng_int() % 100 < 5) {
ADDMSG(&u->faction->msgs, msg_message("desertion",
"unit region", u, r));
u_setfaction(u, monsters);
u_freeorders(u);
if (join_monsters(u, monsters)) {
ADDMSG(&u->faction->msgs, msg_message("desertion",
"unit region", u, r));
}
}
}
}
@ -1175,10 +1192,11 @@ void monster_kills_peasants(unit * u)
void make_zombie(unit * u)
{
u_setfaction(u, get_monsters());
u_freeorders(u);
scale_number(u, 1);
u->hp = unit_max_hp(u) * u->number;
u_setrace(u, get_race(RC_ZOMBIE));
u->irace = NULL;
if (join_monsters(u, NULL)) {
u_freeorders(u);
scale_number(u, 1);
u->hp = unit_max_hp(u) * u->number;
u_setrace(u, get_race(RC_ZOMBIE));
u->irace = NULL;
}
}

View File

@ -23,6 +23,7 @@ extern "C" {
void spawn_undead(void);
void plan_monsters(struct faction *f);
bool join_monsters(struct unit *u, struct faction *monsters);
#ifdef __cplusplus
}