Class BattleFormulas
Class in charge of calculating the damage between an attacking and a defending GameCharacter, and of reducing the life of the latter.
Namespace: AutoBattleFramework.Formulas
Assembly: cs.temp.dll.dll
Syntax
public class BattleFormulas
Methods
AddEnergyOnAttack(Single, GameCharacter, GameCharacter, Boolean)
Adds Energy to the attacking (based on EnergyRecoveryPerAttack) and defending (based on EnergyRecoveryOnHit) GameCharacter.
CurrentStats should be entered as parameters in most cases.
Declaration
protected static void AddEnergyOnAttack(float damage, GameCharacter defending, GameCharacter attacking, bool IsSpecial)
Parameters
Type | Name | Description |
---|---|---|
Single | damage | Amount of pre-calculatedd damage. |
GameCharacter | defending | Character who will recieve damage. |
GameCharacter | attacking | Character who makes damage. |
Boolean | IsSpecial | if is special damage, only the defending one gets energy. |
BasicAttackDamage(BattleFormulas.DamageType, GameCharacter, GameCharacter)
Calculates the normal attack damage between the CharacterStats of an attacking and a defending GameCharacter.
Check if the damage has been critical (based on CriticalProbability) and apply the critical damage bonus (based on CriticalDamage) accordingly.
Applies OnHitEffect of OnHitEffects, equipped GameItem (itemModificators), TraitModificators and active buffs (BuffList).
Subtract the calculated damage from the defender's remaining Health.
Adds Energy to the attacking (based on EnergyRecoveryPerAttack) and defending (based on EnergyRecoveryOnHit) GameCharacter.
CurrentStats should be entered as parameters in most cases.
Declaration
public static float BasicAttackDamage(BattleFormulas.DamageType damageType, GameCharacter defending, GameCharacter attacking)
Parameters
Type | Name | Description |
---|---|---|
BattleFormulas.DamageType | damageType | Type of the infringed damage. |
GameCharacter | defending | Character who will recieve damage. |
GameCharacter | attacking | Character who makes damage. |
Returns
Type | Description |
---|---|
Single | Damage done to the defending character. |
CalculateDamage(BattleFormulas.DamageType, CharacterStats, CharacterStats)
Calculates the damage between the CharacterStats of an attacking and a defending GameCharacter.
CurrentStats should be entered as parameters in most cases.
Declaration
protected static float CalculateDamage(BattleFormulas.DamageType damageType, CharacterStats defending, CharacterStats attacking)
Parameters
Type | Name | Description |
---|---|---|
BattleFormulas.DamageType | damageType | Type of the infringed damage. |
CharacterStats | defending | Character who will recieve damage. |
CharacterStats | attacking | Character who makes damage. |
Returns
Type | Description |
---|---|
Single |
CalculateSpecialDamage(BattleFormulas.DamageType, Single, CharacterStats, CharacterStats)
Calculates the damage between the CharacterStats of an attacking and a defending GameCharacter, given a pre-calculated damage (usually from a special ability).
CurrentStats should be entered as parameters in most cases.
Declaration
protected static float CalculateSpecialDamage(BattleFormulas.DamageType damageType, float damage, CharacterStats defending, CharacterStats attacking)
Parameters
Type | Name | Description |
---|---|---|
BattleFormulas.DamageType | damageType | Type of the infringed damage. |
Single | damage | Amount of pre-calculatedd damage. |
CharacterStats | defending | Character who will recieve damage. |
CharacterStats | attacking | Character who makes damage. |
Returns
Type | Description |
---|---|
Single |
CriticalHit(Single)
Returns true if an attack has been critical, given a probability (CriticalProbability in most cases).
Declaration
protected static bool CriticalHit(float probability)
Parameters
Type | Name | Description |
---|---|---|
Single | probability | Probability of attack being critical. |
Returns
Type | Description |
---|---|
Boolean |
RecieveDamage(GameCharacter, Single, BattleFormulas.DamageType, Color)
Subtracts Health from a GameCharacter and creates a popup with the damage received.
Declaration
public static void RecieveDamage(GameCharacter character, float damage, BattleFormulas.DamageType damageType, Color damageColor)
Parameters
Type | Name | Description |
---|---|---|
GameCharacter | character | Character who will recieve damage. |
Single | damage | Fixed amount of damage. |
BattleFormulas.DamageType | damageType | Type of damage being inflicted. |
Color | damageColor | Color of popup text. |
SpecialAttackDamage(BattleFormulas.DamageType, Single, GameCharacter, GameCharacter)
Calculates the special attack damage between the CharacterStats of an attacking and a defending GameCharacter.
Subtract the calculated damage from the defender's remaining Health.
/// Applies OnHitEffect of OnHitEffects.
Adds Energy to the defending (based on EnergyRecoveryOnHit) GameCharacter.
CurrentStats should be entered as parameters in most cases.
Declaration
public static float SpecialAttackDamage(BattleFormulas.DamageType damageType, float damage, GameCharacter defending, GameCharacter attacking)
Parameters
Type | Name | Description |
---|---|---|
BattleFormulas.DamageType | damageType | Type of the infringed damage. |
Single | damage | Amount of pre-calculatedd damage. |
GameCharacter | defending | Character who will recieve damage. |
GameCharacter | attacking | Character who makes damage. |
Returns
Type | Description |
---|---|
Single | Damage done to the defending character. |