@@ -1901,7 +1901,7 @@ void PrintDebugInfo() {
19011901 std::stringstream ss;
19021902 int isActivated = -1 ;
19031903 if (pcursmonst != -1 ) { isActivated = monster[pcursmonst].isActivated ; }
1904- ss << " debuginfo: " << MouseX << " " << MouseY << " " << ( int )plr[myplr]. _pSplLvl [plr[myplr]. _pRSpell ] << " " << ( int )plr[myplr]. _pISplLvlAdd ;
1904+ ss << " debuginfo: " << MouseX << " " << MouseY << " " << globalScrollZoom ;
19051905 if (played == false ) {
19061906 PlaySFX (num++);
19071907 played = true ;
@@ -2016,6 +2016,46 @@ void DrawXpBar()
20162016 }
20172017 }
20182018}
2019+ bool AreAffixesGoodForItem (int i, char affix) {
2020+ std::set<char > uselessAffixes;
2021+ uselessAffixes.insert (IPL_DUR);
2022+ uselessAffixes.insert (IPL_INDESTRUCTIBLE);
2023+
2024+ switch (item[i]._itype ) {
2025+ case ITYPE_SWORD:
2026+ case ITYPE_AXE:
2027+ case ITYPE_STAFF:
2028+ case ITYPE_MACE:
2029+ uselessAffixes.insert (IPL_ACP);
2030+ uselessAffixes.insert (IPL_LIGHT_ARROWS);
2031+ uselessAffixes.insert (IPL_FIRE_ARROWS);
2032+ break ;
2033+ case ITYPE_BOW:
2034+ uselessAffixes.insert (IPL_ACP);
2035+ uselessAffixes.insert (IPL_LIGHTDAM);
2036+ uselessAffixes.insert (IPL_FIREDAM);
2037+
2038+ break ;
2039+ case ITYPE_SHIELD:
2040+ uselessAffixes.insert (IPL_LIGHT_ARROWS);
2041+ uselessAffixes.insert (IPL_FIRE_ARROWS);
2042+ break ;
2043+ case ITYPE_LARMOR:
2044+ case ITYPE_HELM:
2045+ case ITYPE_MARMOR:
2046+ case ITYPE_HARMOR:
2047+ break ;
2048+ case ITYPE_RING:
2049+ case ITYPE_AMULET:
2050+ uselessAffixes.insert (IPL_ACP);
2051+ break ;
2052+ default :
2053+ break ;
2054+ }
2055+ return uselessAffixes.find (affix) == uselessAffixes.end ();
2056+ }
2057+
2058+
20192059bool AreAffixesGood (char p1, char p2) {
20202060 if (p1 == p2) { return false ; }
20212061 map<int , set<int > > sadAffix;
@@ -2038,6 +2078,7 @@ bool AreAffixesGood(char p1, char p2) {
20382078
20392079 sadAffix[IPL_GETHIT] = { IPL_GETHIT_CURSE };
20402080 sadAffix[IPL_LIFE] = { IPL_LIFE_CURSE };
2081+ sadAffix[IPL_ACP] = { IPL_ACP_CURSE};
20412082 sadAffix[IPL_MANA] = { IPL_MANA_CURSE };
20422083 sadAffix[IPL_DUR_CURSE] = { IPL_DUR,IPL_INDESTRUCTIBLE };
20432084 sadAffix[IPL_TOHIT_DAMP_CURSE] = { IPL_TOHIT_CURSE,IPL_TOHIT,IPL_TOHIT_DAMP,IPL_DAMP };
@@ -2068,7 +2109,8 @@ void GenerateRareUniqueAffix(int i, int x, int y, int minlvl, int maxlvl, std::s
20682109 for (auto f : powers) {
20692110 if (!AreAffixesGood (f, PL_UPrefix[prefIter].PLPower )) { allGood = false ; break ; }
20702111 }
2071- if (PL_UPrefix[prefIter].PLMinLvl >= minlvl && PL_UPrefix[prefIter].PLMinLvl <= maxlvl && PL_UPrefix[prefIter].PLOk && allGood==true )
2112+ bool affixGood = AreAffixesGoodForItem (i, PL_UPrefix[prefIter].PLPower );
2113+ if (PL_UPrefix[prefIter].PLMinLvl >= minlvl && PL_UPrefix[prefIter].PLMinLvl <= maxlvl && PL_UPrefix[prefIter].PLOk && allGood==true && affixGood==true )
20722114 {
20732115 pref[local_pref_iter++] = prefIter;
20742116 if (PL_Prefix[prefIter].PLDouble ) {
@@ -2103,7 +2145,8 @@ void GenerateRareUniqueAffix(int i, int x, int y, int minlvl, int maxlvl, std::s
21032145 for (auto f : powers) {
21042146 if (!AreAffixesGood (f, PL_USuffix[sufIter].PLPower )) { allGood = false ; break ; }
21052147 }
2106- if (PL_USuffix[sufIter].PLMinLvl >= minlvl && PL_USuffix[sufIter].PLMinLvl <= maxlvl && PL_Suffix[sufIter].PLOk && allGood==true )
2148+ bool affixGood = AreAffixesGoodForItem (i, PL_USuffix[sufIter].PLPower );
2149+ if (PL_USuffix[sufIter].PLMinLvl >= minlvl && PL_USuffix[sufIter].PLMinLvl <= maxlvl && PL_Suffix[sufIter].PLOk && allGood==true && affixGood==true )
21072150 {
21082151 suf[local_suf_iter++] = sufIter;
21092152 if (PL_USuffix[sufIter].PLDouble ) {
@@ -2147,7 +2190,8 @@ void GenerateRareAffix(int i,int x, int y, int minlvl, int maxlvl, char prefPowe
21472190 do {
21482191 bool prefGood = AreAffixesGood (prefPower, PL_UPrefix[prefIter].PLPower );
21492192 bool sufGood = AreAffixesGood (sufPower, PL_UPrefix[prefIter].PLPower );
2150- if (PL_UPrefix[prefIter].PLMinLvl >= minlvl && PL_UPrefix[prefIter].PLMinLvl <= maxlvl && PL_UPrefix[prefIter].PLOk && prefGood && sufGood)
2193+ bool affixGood = AreAffixesGoodForItem (i, PL_UPrefix[prefIter].PLPower );
2194+ if (PL_UPrefix[prefIter].PLMinLvl >= minlvl && PL_UPrefix[prefIter].PLMinLvl <= maxlvl && PL_UPrefix[prefIter].PLOk && prefGood && sufGood && affixGood)
21512195 {
21522196 pref[local_pref_iter++] = prefIter;
21532197 if (PL_Prefix[prefIter].PLDouble ) {
@@ -2180,7 +2224,8 @@ void GenerateRareAffix(int i,int x, int y, int minlvl, int maxlvl, char prefPowe
21802224 do {
21812225 bool prefGood = AreAffixesGood (prefPower, PL_USuffix[sufIter].PLPower );
21822226 bool sufGood = AreAffixesGood (sufPower, PL_USuffix[sufIter].PLPower );
2183- if (PL_USuffix[sufIter].PLMinLvl >= minlvl && PL_USuffix[sufIter].PLMinLvl <= maxlvl && PL_Suffix[sufIter].PLOk && prefGood && sufGood)
2227+ bool affixGood = AreAffixesGoodForItem (i, PL_USuffix[sufIter].PLPower );
2228+ if (PL_USuffix[sufIter].PLMinLvl >= minlvl && PL_USuffix[sufIter].PLMinLvl <= maxlvl && PL_Suffix[sufIter].PLOk && prefGood && sufGood && affixGood)
21842229 {
21852230 suf[local_suf_iter++] = sufIter;
21862231 if (PL_USuffix[sufIter].PLDouble ) {
0 commit comments