MantisBT

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0001081VCMIMechanics - Battlespublic2012-09-21 01:422014-05-30 17:41
ReporterGrayFace 
Assigned ToIvan 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version0.9 
Summary0001081: Incorrect Death Stare algorythm
DescriptionHere is the correct one from Heroes 3:
if (<target is alive>)
{
  int x = 0;
  for (int i = 0; i < gorgons_count; i++)
  {
    if (1 + rand()%100 <= 10) x++;
  }
  x = min(x, (gorgons_count + 9)/10);
  <kill x creatures>;
}
Note that no magic resistance is applied.
TagsNo tags attached.
Attached Files

- Relationships
related to 0001137closedWarmonger Mighty Gorgon's Death Stare vs Dwarf's Magic Resistance 

-  Notes
(0003040)
Ivan (developer)
2012-09-21 10:31
edited on: 2012-09-21 11:27

That's how current version works.
Only difference is implementation: instead of for loop random distribution is used

Used distribution: http://en.wikipedia.org/wiki/Poisson_distribution [^]

(0003041)
GrayFace (reporter)
2012-09-21 14:10

Not at all.
1) It uses Poisson distribution instead of the correct one, Bernulli distribution. Bernulli would act like Poisson when there are many gorgons, but when there's 1 gorgon it would be able to kill more than 1 enemy if Poisson distribution is used.
2) It doesn't cap killed count at (gorgons_count + 9)/10.
(0003045)
Warmonger (administrator)
2012-09-26 09:32

Oh, right about distribution. I forgot it already :P

Keep in mind that Death Stare can have different probability than 10%. I would change it to

int cap = 100/probability;
x = min(x, (gorgons_count + probability-1)/cap);
(0003046)
Ivan (developer)
2012-09-26 09:52

Right now probability comes from valOfBonuses so 10% are not hardcoded. But cap is missing. Will fix.
(0003047)
GrayFace (reporter)
2012-09-26 10:28

Warmonger, perhaps you mean this: x = min(x, (gorgons_count*probability + 99)/100); I think that would be right.
BTW, WoG does much more calculations on each step of the loop. I've checked and 9999 gorgons still don't cause any delays. WoG also doesn't change the cap when using different probability, which is wrong.
(0003048)
Ivan (developer)
2012-09-26 13:14

fixed in rev 2924

- Issue History
Date Modified Username Field Change
2012-09-21 01:42 GrayFace New Issue
2012-09-21 10:31 Ivan Note Added: 0003040
2012-09-21 10:31 Ivan Status new => feedback
2012-09-21 11:27 Ivan Note Edited: 0003040 View Revisions
2012-09-21 14:10 GrayFace Note Added: 0003041
2012-09-21 14:10 GrayFace Status feedback => new
2012-09-26 09:04 Ivan Assigned To => Ivan
2012-09-26 09:04 Ivan Status new => assigned
2012-09-26 09:32 Warmonger Note Added: 0003045
2012-09-26 09:52 Ivan Note Added: 0003046
2012-09-26 10:28 GrayFace Note Added: 0003047
2012-09-26 13:14 Ivan Note Added: 0003048
2012-09-26 13:14 Ivan Status assigned => resolved
2012-09-26 13:14 Ivan Fixed in Version => 0.9
2012-09-26 13:14 Ivan Resolution open => fixed
2012-10-06 09:22 Zamolxis Issue cloned: 0001137
2012-10-06 09:22 Zamolxis Relationship added related to 0001137
2014-05-30 17:41 beegee Status resolved => closed

Site | Forums | Wiki | Slack | GitHub


Copyright © 2000 - 2024 MantisBT Team
Hosting provided by DigitalOcean