UIKit0 / bwapi

Automatically exported from code.google.com/p/bwapi
0 stars 0 forks source link

automatic calculation of current dmg of an enemy or own unit type #476

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I would like to see a new feature in BWAPI that...
supports two methods:
1) getDamageByEnemy(Player* player, UnitType attackingUnitType, UnitType 
defendingUnitType) 
where: 
a) player is the enemy player in question
b) attackingUnitType is a unit type that the enemy player would have
c) defendingUnitType is a unit type that the self player would have
the method should return an integer of the amount of actual damage being dealt
if an enemy unit type of attackingUnitType would deal to our own unit of 
defendingUnitType considering the attackingUnitType dmg type and 
defendingUnitType armour type and upgrades and ONLY in the case when an enemy 
unit of the attackingUnitType is visible to consider the current upgrades of 
the enemy unit

2) getDamageBySelf(Player* player, UnitType attackingUnitType, UnitType 
defendingUnitType) - similar to the above but in this case attackingUnitType is 
our own unit type and defendingUnitType represents the enemy

Original issue reported on code.google.com by krasi...@gmail.com on 4 Jan 2013 at 8:41

GoogleCodeExporter commented 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

GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago
Added in r4303.

Original comment by AHeinerm on 23 Feb 2013 at 9:11

GoogleCodeExporter commented 9 years ago

Original comment by AHeinerm on 20 Jun 2013 at 4:40