mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-01-01 21:10:35 +00:00
wandering monsters
This commit is contained in:
parent
03dcd5fa17
commit
421d04e98e
68
landgen.cpp
68
landgen.cpp
@ -229,6 +229,44 @@ EX bool is_zebra_trapdoor(cell *c) {
|
||||
return (randomPatternsMode ? RANDPAT : (zebra40(c)&2));
|
||||
}
|
||||
|
||||
EX void gen_eclectic_monster(cell *c) {
|
||||
cell *c2 = c->move(hrand(c->type));
|
||||
if(c2->wall == waRed1 || c2->wall == waRed2 || c2->wall == waRed3)
|
||||
c->monst = moRedTroll;
|
||||
|
||||
else if(c2->wall == waDeadwall)
|
||||
c->monst = pick(moMiner, moTroll);
|
||||
|
||||
else if(c2->wall == waSmallTree || c2->wall == waBigTree)
|
||||
c->monst = moFireFairy;
|
||||
|
||||
else if(c2->wall == waSandstone || c2->wall == waCharged)
|
||||
c->monst = moMetalBeast, c->hitpoints = 2;
|
||||
|
||||
else if(c2->wall == waPalace)
|
||||
c->monst = moPalace, c->hitpoints = 2;
|
||||
|
||||
else if(c2->wall == waIcewall)
|
||||
c->monst = pick(moWolf, moIceGolem);
|
||||
|
||||
else if(c2->wall == waNone && !c2->monst && hrand(100) < 5) {
|
||||
cell *c1 = c;
|
||||
c1->monst = moPair;
|
||||
c2->monst = moPair;
|
||||
c1->mondir = neighborId(c1, c2);
|
||||
c2->mondir = neighborId(c2, c1);
|
||||
}
|
||||
|
||||
else {
|
||||
|
||||
/* more wolves! */
|
||||
forCellEx(c3, c) if(c3->wall == waIcewall) {
|
||||
c->monst = moWolf;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EX void giantLandSwitch(cell *c, int d, cell *from) {
|
||||
bool fargen = d == min(BARLEV, 9);
|
||||
switch(c->land) {
|
||||
@ -2521,34 +2559,8 @@ EX void giantLandSwitch(cell *c, int d, cell *from) {
|
||||
forCellEx(c1, c) if(!c1->wall) locked = false;
|
||||
if(locked) c->item = itEclectic;
|
||||
|
||||
if(c->wall == waNone && hrand_monster(2500) < 30 + items[itEclectic] + yendor::hardness() && !safety) {
|
||||
cell *c2 = c->move(hrand(c->type));
|
||||
if(c2->wall == waRed1 || c2->wall == waRed2 || c2->wall == waRed3)
|
||||
c->monst = moRedTroll;
|
||||
|
||||
else if(c2->wall == waDeadwall)
|
||||
c->monst = pick(moMiner, moTroll);
|
||||
|
||||
else if(c2->wall == waSmallTree || c2->wall == waBigTree)
|
||||
c->monst = moFireFairy;
|
||||
|
||||
else if(c2->wall == waSandstone || c2->wall == waCharged)
|
||||
c->monst = moMetalBeast, c->hitpoints = 2;
|
||||
|
||||
else if(c2->wall == waPalace)
|
||||
c->monst = moPalace, c->hitpoints = 2;
|
||||
|
||||
else if(c2->wall == waIcewall)
|
||||
c->monst = pick(moWolf, moIceGolem);
|
||||
|
||||
else if(c2->wall == waNone && !c2->monst && hrand(100) < 5) {
|
||||
cell *c1 = c;
|
||||
c1->monst = moPair;
|
||||
c2->monst = moPair;
|
||||
c1->mondir = neighborId(c1, c2);
|
||||
c2->mondir = neighborId(c2, c1);
|
||||
}
|
||||
}
|
||||
if(c->wall == waNone && hrand_monster(2500) < 30 + items[itEclectic] + yendor::hardness() && !safety)
|
||||
gen_eclectic_monster(c);
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -458,6 +458,21 @@ EX void wandering() {
|
||||
}
|
||||
#endif
|
||||
|
||||
else if(c->land == laFrog && !c->monst && wchance(items[itFrog], 25)) {
|
||||
eMonster m = pick(moFrog, moPhaser, moVaulter);
|
||||
if(canReachPlayer(c, m)) {
|
||||
c->monst = m;
|
||||
playSeenSound(c);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
else if(c->land == laWet && among(c->wall, waDeepWater, waShallow) && !c->monst && wchance(items[itWet], 15) && canReachPlayer(c, moShark)) {
|
||||
c->monst = hrand(100) < 10 ? moRusalka : moPike;
|
||||
playSeenSound(c);
|
||||
continue;
|
||||
}
|
||||
|
||||
else if(c->wall == waSea && !c->monst) {
|
||||
if(c->land == laCaribbean && wchance(items[itPirate], 15) && canReachPlayer(c, moPirate)) {
|
||||
c->monst = moCShark;
|
||||
@ -659,6 +674,10 @@ EX void wandering() {
|
||||
c->hitpoints = 3;
|
||||
}
|
||||
|
||||
else if(c->land == laEclectic && wchance(items[itEclectic], 20)) {
|
||||
gen_eclectic_monster(c);
|
||||
}
|
||||
|
||||
else if(c->land == laCaribbean && wchance(items[itPirate], 30))
|
||||
c->monst = moPirate;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user