Cokemonkey11
Spell Reviewer
- Joined
- May 9, 2006
- Messages
- 3,570
I've just discoverd this.
Here's the old thread:
[code=jass] - Hidden ATTACK_TYPE in the World Editor?
And here's the new numbers, as far as I can tell:
Wurst code:
Here's the old thread:
[code=jass] - Hidden ATTACK_TYPE in the World Editor?
And here's the new numbers, as far as I can tell:
JASS:
unarmored 400
medium 2048
light 1
heavy 1
hero 522
fortified 522
divine untested
"normal" untested
Wurst code:
JASS:
/// Made for use with STL 1.
package GetUnitArmorType
import AbilityObjEditing
import HashMap
import DamageDetection2
constant ID_BONUS_HP = '!at*'
constant BONUS_HP_VALUE = 10000
public enum ArmorType
_DUMMY // To pad the enum.
UNKNOWN
_MEDIUM_FORTIFIED // Old: 1 damage. New: impossible.
UNARMORED // Old: 25 damage. New: 400 damage.
_HERO // Old: 150 damage. New: impossible.
_DIVINE // Old: 400 damage. New: Untested.
_HEAVY_NORMAL // Old: 522 damage. New: Untested.
_LIGHT // Old: 2048 damage. New: impossible.
LIGHT_HEAVY // Old: impossible. New: 1 damage.
HERO_FORTIFIED // Old: impossible. New: 522 damage.
MEDIUM // Old: impossible. New: 2048 damage.
constant tab = new HashMap<int, ArmorType>
public function getUnitArmorType(unit u) returns ArmorType
let typ = GetUnitTypeId(u)
var ret = ArmorType.UNKNOWN
if tab.has(typ) and tab.get(typ) != ArmorType._DUMMY
return tab.get(typ)
else
let hp = GetWidgetLife(u)
UnitAddAbility(u, ID_BONUS_HP)
SetUnitState(u, UNIT_STATE_LIFE, BONUS_HP_VALUE.toReal())
disableDamageDetect()
UnitDamageTarget(u, u, 1., true, true, ConvertAttackType(7), DAMAGE_TYPE_UNIVERSAL, WEAPON_TYPE_WHOKNOWS)
enableDamageDetect()
let q = BONUS_HP_VALUE - GetWidgetLife(u)
print(q.toString())
if q == 1
// tab.put(typ, ArmorType.MEDIUM_FORTIFIED)
// ret = ArmorType.MEDIUM_FORTIFIED
tab.put(typ, ArmorType.LIGHT_HEAVY)
ret = ArmorType.LIGHT_HEAVY
else if q == 25
// tab.put(typ, ArmorType.UNARMORED)
// ret = ArmorType.UNARMORED
debugPrint("Unexpected `25` - are you using an old wc3 patch?", 0)
else if q == 150
// tab.put(typ, ArmorType.HERO)
// ret = ArmorType.HERO
debugPrint("Unexpected `150` - are you using an old wc3 patch?", 0)
else if q == 400
// tab.put(typ, ArmorType.DIVINE)
// ret = ArmorType.DIVINE
tab.put(typ, ArmorType.UNARMORED)
ret = ArmorType.UNARMORED
else if q == 522
// tab.put(typ, ArmorType.HEAVY_NORMAL)
// ret = ArmorType.HEAVY_NORMAL
tab.put(typ, ArmorType.HERO_FORTIFIED)
ret = ArmorType.HERO_FORTIFIED
else if q == 2048
// tab.put(typ, ArmorType.LIGHT)
// ret = ArmorType.LIGHT
tab.put(typ, ArmorType.MEDIUM)
ret = ArmorType.MEDIUM
else
tab.put(typ, ArmorType.UNKNOWN)
debugPrint("Debug GetUnitArmorType: Unknown armor type uncovered for " + GetUnitName(u) + "; q = " +R2S(q), 0)
ret = ArmorType.UNKNOWN
UnitRemoveAbility(u, ID_BONUS_HP)
SetWidgetLife(u, hp)
return ret
@compiletime function generateAbility()
new AbilityDefinitionMaxLifeBonusGreater(ID_BONUS_HP)
..setMaxLifeGained(1, BONUS_HP_VALUE)
..setItemAbility(false)
..setName("Life Bonus for GetUnitArmorType")
Last edited: