From dda147c1736a28370e0fb372980da58b6fd2e5e2 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Tue, 25 Dec 2018 12:51:25 +0100 Subject: [PATCH] newlands:: wandering monsters in Brownian and Variant --- complex2.cpp | 41 +++++++++++++++++++++++++++++++++++++++++ hyper.h | 2 ++ landgen.cpp | 40 ---------------------------------------- monstergen.cpp | 14 ++++++++++++++ 4 files changed, 57 insertions(+), 40 deletions(-) diff --git a/complex2.cpp b/complex2.cpp index 9b463708..6ac327d1 100644 --- a/complex2.cpp +++ b/complex2.cpp @@ -203,5 +203,46 @@ namespace westwall { } } +struct variant_feature { + color_t color_change; + int rate_change; + eMonster wanderer; + void (*build)(cell*); + }; + +#define VF [] (cell *c) + +const array variant_features {{ + variant_feature{(color_t)(-0x202020), 5, moNecromancer, VF { + if(hrand(1500) < 20) c->wall = waFreshGrave; + if(hrand(20000) < 10 + items[itVarTreasure]) + c->monst = moNecromancer; + }}, + {0x000010, 5, moLancer, VF { if(c->wall == waNone && !c->monst && hrand(80000) < 25 + items[itVarTreasure]) c->monst = moLancer; } }, + {0x100008,15, moMonk, VF { if(c->wall == waNone && !c->monst && hrand(80000) < 25 + items[itVarTreasure]) c->monst = moMonk; } }, + {0x080010, 5, moCrusher, VF { if(c->wall == waNone && !c->monst && hrand(80000) < 25 + items[itVarTreasure]) c->monst = moCrusher; } }, + {0x181418, 5, moSkeleton, VF { if(c->wall == waNone && !c->monst && hrand(80000) < 25 + items[itVarTreasure]) c->monst = moSkeleton, c->hitpoints = 3; } }, + {0x180000, 5, moPyroCultist, VF { if(c->wall == waNone && !c->monst && hrand(80000) < 25 + items[itVarTreasure]) c->monst = moPyroCultist; } }, + {0x00000C, 2, moFlailer, VF { if(c->wall == waNone && !c->monst && hrand(80000) < 25 + items[itVarTreasure]) c->monst = moFlailer; } }, + {0x1C0800, 1, moHedge, VF { if(c->wall == waNone && !c->monst && hrand(80000) < 25 + items[itVarTreasure] && VALENCE == 3) c->monst = moHedge; } }, + {0x001000,-1, moNone, VF { if(hrand(1500) < 30) createArrowTrapAt(c, laVariant); } }, + {0x001400,-1, moNone, VF { if(hrand(1500) < 50 && c->wall == waNone) c->wall = waTrapdoor; } }, + {0x001018,-1, moNone, VF { if(hrand(1500) < 30) build_pool(c, true); } }, + {0x040C00,-1, moNone, VF { if(c->wall == waNone && !c->monst && !c->monst && hrand(1500) < 10) c->wall = waThumperOff; } }, + {0x080C00,-1, moNone, VF { if(hrand(1500) < 20 && !c->monst && !c->wall) c->wall = waFireTrap; } }, + {0x0C0C00, 0, moNone, VF { if(c->wall == waNone && !c->monst && hrand(5000) < 100) c->wall = waExplosiveBarrel; } }, + {0x061004, 0, moNone, VF { + if(c->wall == waNone && !c->monst && pseudohept(c) && hrand(30000) < 25 + items[itVarTreasure]) + if(buildIvy(c, 0, c->type) && !peace::on) c->item = itVarTreasure; + }}, + {0x000C08, 0, moNone, VF { if(c->wall == waNone && !c->monst && hrand(5000) < 100) c->wall = waSmallTree; }}, + {0x100C10, 1, moRagingBull, VF { if(c->wall == waNone && hrand(10000) < 10 + items[itVarTreasure]) c->monst = moSleepBull, c->hitpoints = 3; }}, + {0x00140C, 0, moNone, VF { if(c->wall == waNone && !c->monst && hrand(5000) < 100) c->wall = waBigTree; }}, + {0x000C28, 1, moNone, VF { if(hrand(500) < 10) build_pool(c, false); } }, + {0x100C00, 2, moVariantWarrior, VF { if(c->wall == waNone && !c->monst && hrand(40000) < 25 + items[itVarTreasure]) c->monst = moVariantWarrior; }}, + {0x100808, 1, moRatling, VF { if(c->wall == waNone && !c->monst && hrand(50000) < 25 + items[itVarTreasure]) c->monst = moRatling; }} + }}; +#undef VF + } #endif diff --git a/hyper.h b/hyper.h index c8ea5357..cbee10d7 100644 --- a/hyper.h +++ b/hyper.h @@ -4723,5 +4723,7 @@ inline bool subscreen_split(reaction_t for_each_subscreen) { return false; } bool in_gravity_zone(cell *c); bool normal_gravity_at(cell *c); +void build_pool(cell *c, bool with_boat); +void createArrowTrapAt(cell *c, eLand land); } diff --git a/landgen.cpp b/landgen.cpp index 2453c8fe..0a39d621 100644 --- a/landgen.cpp +++ b/landgen.cpp @@ -142,46 +142,6 @@ void build_pool(cell *c, bool with_boat) { } } -struct variant_feature { - color_t color_change; - int rate_change; - void (*build)(cell*); - }; - -#define VF [] (cell *c) - -const array variant_features {{ - variant_feature{(color_t)(-0x202020), 5, VF { - if(hrand(1500) < 20) c->wall = waFreshGrave; - if(hrand(20000) < 10 + items[itVarTreasure]) - c->monst = moNecromancer; - }}, - {0x000010, 5, VF { if(c->wall == waNone && !c->monst && hrand(80000) < 25 + items[itVarTreasure]) c->monst = moLancer; } }, - {0x100008,15, VF { if(c->wall == waNone && !c->monst && hrand(80000) < 25 + items[itVarTreasure]) c->monst = moMonk; } }, - {0x080010, 5, VF { if(c->wall == waNone && !c->monst && hrand(80000) < 25 + items[itVarTreasure]) c->monst = moCrusher; } }, - {0x181418, 5, VF { if(c->wall == waNone && !c->monst && hrand(80000) < 25 + items[itVarTreasure]) c->monst = moSkeleton, c->hitpoints = 3; } }, - {0x180000, 5, VF { if(c->wall == waNone && !c->monst && hrand(80000) < 25 + items[itVarTreasure]) c->monst = moPyroCultist; } }, - {0x00000C, 2, VF { if(c->wall == waNone && !c->monst && hrand(80000) < 25 + items[itVarTreasure]) c->monst = moFlailer; } }, - {0x1C0800, 1, VF { if(c->wall == waNone && !c->monst && hrand(80000) < 25 + items[itVarTreasure] && VALENCE == 3) c->monst = moHedge; } }, - {0x001000,-1, VF { if(hrand(1500) < 30) createArrowTrapAt(c, laVariant); } }, - {0x001400,-1, VF { if(hrand(1500) < 50 && c->wall == waNone) c->wall = waTrapdoor; } }, - {0x001018,-1, VF { if(hrand(1500) < 30) build_pool(c, true); } }, - {0x040C00,-1, VF { if(c->wall == waNone && !c->monst && !c->monst && hrand(1500) < 10) c->wall = waThumperOff; } }, - {0x080C00,-1, VF { if(hrand(1500) < 20 && !c->monst && !c->wall) c->wall = waFireTrap; } }, - {0x0C0C00, 0, VF { if(c->wall == waNone && !c->monst && hrand(5000) < 100) c->wall = waExplosiveBarrel; } }, - {0x061004, 0, VF { - if(c->wall == waNone && !c->monst && pseudohept(c) && hrand(30000) < 25 + items[itVarTreasure]) - if(buildIvy(c, 0, c->type) && !peace::on) c->item = itVarTreasure; - }}, - {0x000C08, 0, VF { if(c->wall == waNone && !c->monst && hrand(5000) < 100) c->wall = waSmallTree; }}, - {0x100C10, 1, VF { if(c->wall == waNone && hrand(10000) < 10 + items[itVarTreasure]) c->monst = moSleepBull, c->hitpoints = 3; }}, - {0x00140C, 0, VF { if(c->wall == waNone && !c->monst && hrand(5000) < 100) c->wall = waBigTree; }}, - {0x000C28, 1, VF { if(hrand(500) < 10) build_pool(c, false); } }, - {0x100C00, 2, VF { if(c->wall == waNone && !c->monst && hrand(40000) < 25 + items[itVarTreasure]) c->monst = moVariantWarrior; }}, - {0x100808, 1, VF { if(c->wall == waNone && !c->monst && hrand(50000) < 25 + items[itVarTreasure]) c->monst = moRatling; }} - }}; -#undef VF - void place_elemental_wall(cell *c) { if(c->land == laEFire) c->wall = waEternalFire; else if(c->land == laEWater) c->wall = waSea; diff --git a/monstergen.cpp b/monstergen.cpp index 5698da85..52bb2fdb 100644 --- a/monstergen.cpp +++ b/monstergen.cpp @@ -413,6 +413,20 @@ void wandering() { continue; } + else if(c->land == laBrownian && wchance(items[itBrownian], 75)) { + c->monst = moAcidBird; + continue; + } + + else if(c->land == laVariant && wchance(items[itVarTreasure], 50)) { + int i = hrand(21); + if(getBits(c) & (1>>i)) { + eMonster m = variant_features[i].wanderer; + if(m) c->monst = m, c->hitpoints = 3; + } + continue; + } + else if(c->wall == waSea && !c->monst) { if(c->land == laCaribbean && wchance(items[itPirate], 15) && canReachPlayer(c, moPirate)) { c->monst = moCShark;