MantisBT

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000152VCMIMechanics - Battlespublic2009-10-13 11:172014-05-30 17:41
ReporterBoulie 
Assigned ToTow 
PrioritynormalSeverityfeatureReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version0.74 
Target VersionFixed in Version0.9 
Summary0000152: Range penalty not implemented (or else damage calculation is wrong)
DescriptionEither range penalty is not implemented or the dmg calculation is wrong.

See screenshots:

first VCMI - 14 liches attack with damage 148 (5 medusas perished)

second H3 - 14 liches attack with dmg 70 (2 medusas perished), two times less then in VCMI.
TagsNo tags attached.
Attached Filesjpg file icon bug dmg calculation.jpg [^] (257,869 bytes) 2009-10-13 11:17


jpg file icon bug dmg calculation org.jpg [^] (108,923 bytes) 2009-10-13 11:17


jpg file icon penalty.jpg [^] (669,489 bytes) 2010-06-08 14:05


jpg file icon shot range.jpg [^] (153,765 bytes) 2010-06-11 12:59


jpg file icon siege_03 with fort but no castle.jpg [^] (250,872 bytes) 2010-07-27 07:16


jpg file icon range penalty differences.jpg [^] (122,138 bytes) 2010-08-06 14:01


? file icon _test_SoD_map_by Boulie.h3m [^] (7,786 bytes) 2010-08-06 14:01

- Relationships
related to 0001130closedWarmonger If the 1st hex of a wide creature is within full shooting range, no penalty should be applied to its 2nd hex 

-  Notes
(0000100)
Boulie (reporter)
2009-10-13 11:26
edited on: 2009-10-13 15:33

chcialem edytowac ze to tyczy archery penalty ale nie wiem jak

EDIT:
@Zamolxis-> Yes, I wanted to edit my added bug to write it refer to archery penalty but I can't or I do not know how can I do it.

(0000101)
Zamolxis (viewer)
2009-10-13 15:14
edited on: 2009-10-13 17:36

As I think you already guessed correctly in the note above, range penalty is indeed not implemented yet (AFAIK).

EDIT: Report description & severity updated.

(0000947)
Boulie (reporter)
2010-06-08 14:04

So if now we have implemented ranged penalty I need to write few difference between OH3 and VCMI.
1. Range should have 10 hexes not like it is now 8 hexes, damage penalty should start from 11th hex.
2. If we have 2-hex unit to which we aim and her closer hex is in range, there should be no damage penalty on both hexes (10th and 11th) - no broken arrow. Now on further hex is broken arrow, but dmg is shown and dealt ok.
Added new screenshot

PS> Nice that dmg calculation seems to be ok, now.
(0000948)
Zamolxis (viewer)
2010-06-08 19:25

Thanks Boulie for the above. I did have a strong feeling the no-penalty range is smaller in VCMI, but I didn't know the actual OH3 values.
(0000953)
Boulie (reporter)
2010-06-11 12:59

One more think I didn't noticed before. Range is not a vertical line but radius.
Added one more screenshot.
(0001133)
Tow dragon (viewer)
2010-07-15 17:53

Distance penalty has been implemented in 0.81, additionally I've corrected the formula for distance in rev 1658. Please reopen if it's still wrong, I haven't checked it in-game, but the formula seems to be correct.
(0001186)
Boulie (reporter)
2010-07-27 07:16

Still wrong. If radius is implemented so the distance is 15 hexes.
Also point 2 from comment 947 isn't implemented.
Added one more screen.
PS> same was in 081b and now is in 081c
(0001195)
Tow (developer)
2010-07-27 13:02
edited on: 2010-07-27 13:02

@Boulie
If something that was marked as fixed still doesn't work, please reopen the issue (eg by changing status to feedback). Then we'll be easily able to see that something is wrong.

(0001215)
Tow dragon (viewer)
2010-07-28 12:34

hopefully (again) resolved in rev 1699. Here is the code for determining the penalty:

si8 BattleInfo::hasDistancePenalty( int stackID, int destHex )
{
    const CStack * stack = getStack(stackID);

    struct HLP
    {
        static bool lowerAnalyze(const CStack * stack, int hex)
        {
            int xDst = std::abs(hex % BFIELD_WIDTH - stack->position % BFIELD_WIDTH),
                yDst = std::abs(hex / BFIELD_WIDTH - stack->position / BFIELD_WIDTH);
            int distance = std::max(xDst, yDst) + std::min(xDst, yDst) - (yDst + 1)/2;

            //I hope it's approximately correct
            return distance > 10 && !stack->hasBonusOfType(Bonus::NO_DISTANCE_PENALTY);
        }
    };
    const CStack * dstStack = getStackT(destHex, false);

    if (dstStack->doubleWide())
        return HLP::lowerAnalyze(stack, destHex) && HLP::lowerAnalyze(stack, dstStack->occupiedHex());
    else
        return HLP::lowerAnalyze(stack, destHex);
    
}

I'm not sure about it but I'd like to avoid writing BFS.
(0001237)
Boulie (reporter)
2010-07-29 13:47

Nice ;) Tomorrow I'm starting learning C++ so I try before final version of VCMI (1.0 ) understand the code you attached ;)
and what is BFS?

this one is the most inspiring
"int distance = std::max(xDst, yDst) + std::min(xDst, yDst) - (yDst + 1)/2;"
(0001298)
Boulie (reporter)
2010-08-06 14:01
edited on: 2010-08-06 14:17

OK! I felt that something wrong is with this formula.
        {
            int xDst = std::abs(hex % BFIELD_WIDTH - stack->position % BFIELD_WIDTH),
                yDst = std::abs(hex / BFIELD_WIDTH - stack->position / BFIELD_WIDTH);
            int distance = std::max(xDst, yDst) + std::min(xDst, yDst) - (yDst + 1)/2;
}
Fast learning C++ by doing a lot of tests in VCMI (I think it took me more than 2 hours;) and I have the results.
See attached screenshot .
It is nearly ok but it depends from the row in which shooting stack is.
On the screenshot you have marked which row is wrong for red or blue player.
Also there is example for one of the Blue player's Cyclops. (with exclamation marks). Note that there is 11-hexes radius. In straight line (stack are in the same row) it is ok (broken arrow) but for one rows up and down it is full arrow. Next row is broken, next row is full.but in every row arrow should be broken.
I've added the test map with this creatures. You can try it. Run it in MP and attack Christian (red) vs Sir Mullich (blue).
PS.
Also aiming in the 2 hex stack is wrong. If first hex(head) is 10th (so there is full arrow) also on the 11th hex should full arrow.

I hope it is more less clear - it was hard for me to explain it in English. ;)
If you don't follow my bad English I can write it in Polish.

(0001299)
Warmonger (administrator)
2010-08-06 17:32
edited on: 2010-08-06 17:34

Why don't you just use formula from creature movement? If a target is 10 tiles away, it's position will be in range of flying creature with speed 10.

(0001300)
Boulie (reporter)
2010-08-06 22:27

Yes Wormonger! You are right! I will use it but I don't know this formula, yet ;)
Ofc a little joke.
@Tow - do it! ;)
(0002942)
Tow (developer)
2012-08-28 12:32

Should be finally fixed in r2853.
I found a new formula and double checked it.

- Issue History
Date Modified Username Field Change
2009-10-13 11:17 Boulie New Issue
2009-10-13 11:17 Boulie File Added: bug dmg calculation.jpg
2009-10-13 11:17 Boulie File Added: bug dmg calculation org.jpg
2009-10-13 11:25 Boulie Note Added: 0000099
2009-10-13 11:25 Boulie Note Deleted: 0000099
2009-10-13 11:26 Boulie Note Added: 0000100
2009-10-13 11:26 Boulie Note Edited: 0000100 View Revisions
2009-10-13 15:14 Zamolxis Note Added: 0000101
2009-10-13 15:33 Boulie Note Edited: 0000100 View Revisions
2009-10-13 17:35 Zamolxis Severity major => feature
2009-10-13 17:35 Zamolxis Summary Bug not proper damage calculation => Range penalty not implemented (or else damage calculation is wrong)
2009-10-13 17:35 Zamolxis Description Updated View Revisions
2009-10-13 17:36 Zamolxis Note Edited: 0000101 View Revisions
2010-06-08 14:04 Boulie Note Added: 0000947
2010-06-08 14:05 Boulie File Added: penalty.jpg
2010-06-08 19:25 Zamolxis Note Added: 0000948
2010-06-11 12:59 Boulie Note Added: 0000953
2010-06-11 12:59 Boulie File Added: shot range.jpg
2010-07-15 17:53 Tow dragon Note Added: 0001133
2010-07-15 17:53 Tow dragon Status assigned => resolved
2010-07-15 17:53 Tow dragon Fixed in Version => 0.89
2010-07-15 17:53 Tow dragon Resolution open => fixed
2010-07-27 07:16 Boulie Note Added: 0001186
2010-07-27 07:16 Boulie File Added: siege_03 with fort but no castle.jpg
2010-07-27 13:00 anonymous Status resolved => feedback
2010-07-27 13:00 anonymous Resolution fixed => reopened
2010-07-27 13:02 Tow Note Added: 0001195
2010-07-27 13:02 Tow Note Edited: 0001195 View Revisions
2010-07-28 12:34 Tow dragon Note Added: 0001215
2010-07-28 12:34 Tow dragon Status feedback => resolved
2010-07-28 12:34 Tow dragon Resolution reopened => fixed
2010-07-29 13:47 Boulie Note Added: 0001237
2010-08-06 14:01 Boulie Note Added: 0001298
2010-08-06 14:01 Boulie Status resolved => feedback
2010-08-06 14:01 Boulie Resolution fixed => reopened
2010-08-06 14:01 Boulie File Added: range penalty differences.jpg
2010-08-06 14:01 Boulie File Added: _test_SoD_map_by Boulie.h3m
2010-08-06 14:16 Boulie Note Edited: 0001298 View Revisions
2010-08-06 14:17 Boulie Note Edited: 0001298 View Revisions
2010-08-06 17:32 Warmonger Note Added: 0001299
2010-08-06 17:33 Warmonger Note Edited: 0001299 View Revisions
2010-08-06 17:34 Warmonger Note Edited: 0001299 View Revisions
2010-08-06 17:34 Warmonger Note Edited: 0001299 View Revisions
2010-08-06 22:27 Boulie Note Added: 0001300
2010-08-06 22:27 Boulie Status feedback => assigned
2012-02-27 12:23 Warmonger Assigned To Tow dragon => Warmonger
2012-08-28 12:32 Tow Note Added: 0002942
2012-08-28 12:32 Tow Status assigned => resolved
2012-08-28 12:32 Tow Fixed in Version 0.82 => 0.9
2012-08-28 12:32 Tow Resolution reopened => fixed
2012-08-28 12:32 Tow Assigned To Warmonger => Tow
2012-10-01 13:12 Zamolxis Issue cloned: 0001130
2012-10-01 13:12 Zamolxis Relationship added related to 0001130
2014-05-30 17:41 beegee Status resolved => closed

Site | Forums | Wiki | Slack | GitHub


Copyright © 2000 - 2024 MantisBT Team
Hosting provided by DigitalOcean