I want to basically make orb of corruption, except it isn't an orb effect.
I have damage detection and I can tell when it is a normal attack. I can apply the armour reduction with a spell and dummy unit (already does this, actually). My problem is that I need the first hit to deal damage with the reduced armour as well.
Any idea how I can do this?
I can modify damage with the damage system, but how much damage do I need to add? Is there a nice way to quickly calculate how much damage to add?
My only idea is to:
- If the unit does not already have the armour reduction buff, then
- Make the damaged unit have full health
- Deal 100 damage
- Find actual damage dealt
- Make dummy unit and cast the armour reduction spell
- Make the damaged unit have full health
- Deal 100 damage
- Find actual damage dealt
- Reset damaged unit to previous health
- Divide second damage by first damage
- Multiply current hit damage by the result
Ignore that it could kill the unit - even when at full health - I can deal with that if I need to. I believe this will work, but holy hell that is a ton of steps. For reference, it is likely that only 2 or 3 units will have this ability at most, though it could have a ton (not in the players' interest since you would most definitely lose horribly).
Is there anything easier / less expensive to calculate?
I have damage detection and I can tell when it is a normal attack. I can apply the armour reduction with a spell and dummy unit (already does this, actually). My problem is that I need the first hit to deal damage with the reduced armour as well.
Any idea how I can do this?
I can modify damage with the damage system, but how much damage do I need to add? Is there a nice way to quickly calculate how much damage to add?
My only idea is to:
- If the unit does not already have the armour reduction buff, then
- Make the damaged unit have full health
- Deal 100 damage
- Find actual damage dealt
- Make dummy unit and cast the armour reduction spell
- Make the damaged unit have full health
- Deal 100 damage
- Find actual damage dealt
- Reset damaged unit to previous health
- Divide second damage by first damage
- Multiply current hit damage by the result
Ignore that it could kill the unit - even when at full health - I can deal with that if I need to. I believe this will work, but holy hell that is a ton of steps. For reference, it is likely that only 2 or 3 units will have this ability at most, though it could have a ton (not in the players' interest since you would most definitely lose horribly).
Is there anything easier / less expensive to calculate?