Measure the skill effectiveness in real time

I am assigned to solve a task that demonstrates a realistic problem in C++.

A laser cannon may have the following skill :

Recoil Armor :
HP reduces 10% then damage taken reduces xx%. When HP is 0, this hero can still fight for xx seconds.

So assume I have a number of soldiers (for example, 20 DPS, 20 damage per attack) fight against a heavily upgraded laser cannon which has 3888 HP. We can assume the laser cannon never attacks. The laser cannon is equipped with "Recoil Armor" skill as the following :

HP reduces 10% then damage taken reduces 3.8%. When HP is 0, this hero can still fight for 3.6 seconds.

When the laser cannon's HP runs out, invincibility is activated. If the laser cannon continue to get hit after 3.6 seconds of invincibility has passed, the laser cannon is destroyed.

So I have to calculate exactly how many times we need to hit the laser cannon over and over and the time needed to destroy this cannon. All soldiers don't necessarily attack all at the same time, those who come first will attack first and repeat. I need to count the number of hits, total HP dealt and time needed to destroy the building.

The purpose of this task is to measure the effectiveness of the "Recoil Armor" skill when it is applied to laser cannons. I would appreciate it if anyone has some great inspiration how to implement this. It is done in console application, and information should present as fast as possible as soon as the calculation starts.
Sounds like an interesting exercise. Have fun!

You are aware that you've posted your message in the forum that is specifically for discussions that aren't related to C++ programming, right?
it sure looks to me like this can be calculated instantly for a given scenario. It looks like each scenario would be a calc equation (a form of the old "fill the bucket at x rate, drain it at y rate, does it overflow or empty, and after how long..?). The same form equation will work each time, I think, just need to cook it up, and then change the variables per scenario. Get that working, then you can add the "similation" stuff like randomly having some of the soldiers shoot at it each time slice with some criteria. But it sure looks to be mostly a straight computation outside of any self-inflicted randomization.





Topic archived. No new replies allowed.