From 8eba146750b54836309cea52c50e987e3c6f38bf Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Thu, 2 Apr 2020 13:21:51 +0200 Subject: [PATCH] The powers you get for Orb of Yendor are now consistent with useless/dangerous/forbidden rules --- yendor.cpp | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/yendor.cpp b/yendor.cpp index 4b5f4633..83493d75 100644 --- a/yendor.cpp +++ b/yendor.cpp @@ -758,20 +758,29 @@ EX namespace yendor { if(yendor::yi[i].path[0] == c2) changes.value_set(yendor::yi[i].foundOrb, true); // Shielding always, so that we know that it protects! - for(int i=0; i<4; i++) switch(hrand(13)) { - case 0: items[itOrbSpeed] += 31; break; - case 1: items[itOrbLightning] += 78; break; - case 2: items[itOrbFlash] += 78; break; - case 3: items[itOrbTime] += 78; break; - case 4: items[itOrbWinter] += 151; break; - case 5: items[itOrbDigging] += 151; break; - case 6: items[itOrbTeleport] += 151; break; - case 7: items[itOrbThorns] += 151; break; - case 8: items[itOrbInvis] += 151; break; - case 9: items[itOrbPsi] += 151; break; - case 10: items[itOrbAether] += 151; break; - case 11: items[itOrbFire] += 151; break; - case 12: items[itOrbSpace] += 78; break; + int powers = 0; + for(int i=0; i<1000 && powers < 4; i++) { + vector< pair > choices = { + {itOrbSpeed, 31}, + {itOrbLightning, 78}, + {itOrbFlash, 78}, + {itOrbTime, 78}, + {itOrbWinter, 151}, + {itOrbDigging, 151}, + {itOrbTeleport, 151}, + {itOrbThorns, 151}, + {itOrbInvis, 151}, + {itOrbPsi, 151}, + {itOrbAether, 151}, + {itOrbFire, 151}, + {itOrbSpace, 78} + }; + auto p = hrand_elt(choices); + auto orb = p.first; + if(items[orb] && i < 500) continue; + if(among(getOLR(orb, getPrizeLand()), olrDangerous, olrUseless, olrForbidden)) continue; + items[orb] += p.second; + powers++; } items[itOrbYendor]++; items[itKey]--;