Closed GoogleCodeExporter closed 9 years ago
Heinermann improved on the idea:
int getDamageFrom(UnitType from, Player *fromPlayer, UnitType to, Player
*toPlayer = nullptr);
int getDamageTo(UnitType to, Player *toPlayer, UnitType from, Player
*fromPlayer = nullptr);
where nullptr = self and the second method is a shortcut for rearranging the
arguments in the first
Also Unit::getDamageTo(Unit *target); which calls the method above having in
mind that both units should be visible at the time the method is called
Original comment by krasi...@gmail.com
on 4 Jan 2013 at 9:05
Updated proposal (reordered parameters):
int getDamageFrom(UnitType fromType, UnitType toType, Player *fromPlayer =
nullptr, Player *toPlayer = nullptr);
int getDamageTo(UnitType toType, UnitType fromType, Player *toPlayer = nullptr,
Player *fromPlayer = nullptr);
If the second last parameter (opponent player) is omitted, then it will compute
against a type with no upgrades (but still include your own upgrades).
This is not difficult to implement and will not need an interface function, but
the precise calculations need a few lines and 2D array for the damage types
which most people aren't aware of.
Original comment by AHeinerm
on 4 Jan 2013 at 9:11
Added in r4303.
Original comment by AHeinerm
on 23 Feb 2013 at 9:11
Original comment by AHeinerm
on 20 Jun 2013 at 4:40
Original issue reported on code.google.com by
krasi...@gmail.com
on 4 Jan 2013 at 8:41