소스 검색

Changed Sirens behavior to match H3 logic

Ivan Savenko 2 년 전
부모
커밋
7e8516f927
1개의 변경된 파일7개의 추가작업 그리고 1개의 파일을 삭제
  1. 7 1
      lib/mapObjects/MiscObjects.cpp

+ 7 - 1
lib/mapObjects/MiscObjects.cpp

@@ -1956,7 +1956,13 @@ void CGSirens::onHeroVisit( const CGHeroInstance * h ) const
 
 		for (auto i = h->Slots().begin(); i != h->Slots().end(); i++)
 		{
-			TQuantity drown = static_cast<TQuantity>(i->second->count * 0.3);
+			// 1-sized stacks are not affected by sirens
+			if (i->second->count == 1)
+				continue;
+
+			// tested H3 behavior: 30% (rounded up) of stack drowns
+			TQuantity drown = std::ceil(i->second->count * 0.3);
+
 			if(drown)
 			{
 				cb->changeStackCount(StackLocation(h, i->first), -drown);