I have been making an evasion system where all evasion stacks multiplicatively with each other.
So all Heroes start with a base evasion stat (Humans gets 15% and so on). Every 10 agility points, the Hero gains 1% evasion (This part is working correctly). I am now making a start on adding evasion items now. Planning on having three different evasion items (+15%, +25% and +35%). These items should all stack multiplicatively with themselves and all the other evasion stats as well.
The problem I have is detecting the number of items of a certain type a unit has in its inventory.
So lets say a Hero is carrying three Talisman of Evasion's, so that would be "1 - ( 1 - 0.15 ) x ( 1 - 0.15 ) x ( 1 - 0.15 )" giving a total of 0.386 or +38.6% evasion. This would then be multiplied on top of the Heroes base evasion and their agility evasion. Instead of having to write out ( 1 - 0.15 ) for every separate item the best way to write this is "( 1 - 0.15 ) ^ (number of items of type held in inventory)".
I cannot find a good method for detecting this number and was wondering if anyone had any advice. I made an attempt on the item part of the trigger, but it was a mess so I removed it so you can view my current trigger easier.
So all Heroes start with a base evasion stat (Humans gets 15% and so on). Every 10 agility points, the Hero gains 1% evasion (This part is working correctly). I am now making a start on adding evasion items now. Planning on having three different evasion items (+15%, +25% and +35%). These items should all stack multiplicatively with themselves and all the other evasion stats as well.
The problem I have is detecting the number of items of a certain type a unit has in its inventory.
So lets say a Hero is carrying three Talisman of Evasion's, so that would be "1 - ( 1 - 0.15 ) x ( 1 - 0.15 ) x ( 1 - 0.15 )" giving a total of 0.386 or +38.6% evasion. This would then be multiplied on top of the Heroes base evasion and their agility evasion. Instead of having to write out ( 1 - 0.15 ) for every separate item the best way to write this is "( 1 - 0.15 ) ^ (number of items of type held in inventory)".
I cannot find a good method for detecting this number and was wondering if anyone had any advice. I made an attempt on the item part of the trigger, but it was a mess so I removed it so you can view my current trigger easier.
-
Evasion
-
Events
- Unit - A unit Is attacked
-
Conditions
- True Equal to True
-
Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Level of Racial Passive (Human) for (Triggering unit)) Greater than or equal to 1
-
Then - Actions
- Set VariableSet E_RacialPassive = (1.00 - 0.10)
- Set VariableSet E_AgilityBonus = (1.00 - ((Real((Integer(((Real((Agility of (Triggering unit) (Include bonuses)))) x 0.10))))) x 0.01))
- Ability - Set Ability: (Unit: (Triggering unit)'s Ability with Ability Code: Racial Passive (Human) )'s Real Level Field: Chance to Evade ('Eev1') of Level: 0 to (1.00 - (E_RacialPassive x (E_AgilityBonus x 1.00)))
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Level of Racial Passive (Human - Horse) for (Triggering unit)) Greater than or equal to 1
-
Then - Actions
- Set VariableSet E_RacialPassive = (1.00 - 0.05)
- Set VariableSet E_AgilityBonus = (1.00 - ((Real((Integer(((Real((Agility of (Triggering unit) (Include bonuses)))) x 0.10))))) x 0.01))
- Ability - Set Ability: (Unit: (Triggering unit)'s Ability with Ability Code: Racial Passive (Human - Horse) )'s Real Level Field: Chance to Evade ('Eev1') of Level: 0 to (1.00 - (E_RacialPassive x (E_AgilityBonus x 1.00)))
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Events