private CombatActionModel applyDamageAbilityEffectToCombatant(AbilityEffectType abilityEffectType, int abilityID, int abilityCombatantOwnerID, int abilityAmount, CombatantModel combatantModel, int turnsRemaining, bool isCrit) { StatModifiersDeltas statModifiersDeltas = combatantModel.StatModifiersDeltas; CombatActionType combatActionType = CombatActionType.None; int damageDeltaWithStatModifiers = 0; switch (abilityEffectType) { case AbilityEffectType.MeleeDamage: damageDeltaWithStatModifiers = getDamageDeltaWithStatMod(statModifiersDeltas.ArmorStatModifiersDelta, abilityAmount); combatActionType = CombatActionType.ReceiveMeleeDamage; break; case AbilityEffectType.SpellDamage: damageDeltaWithStatModifiers = getDamageDeltaWithStatMod(statModifiersDeltas.SpellResistStatModifiersDelta, abilityAmount); combatActionType = CombatActionType.ReceiveSpellDamage; break; default: throw new Exception("Invalid AbilityEffectType"); } combatantModel.SetCurrentHealth(combatantModel.CurrentHealth + damageDeltaWithStatModifiers); Logging.Log.Info("Combatant ID : " + combatantModel.ID + " on team " + combatantModel.TeamID + " receives damage: " + damageDeltaWithStatModifiers + ". New health = " + combatantModel.CurrentHealth); return(new CombatActionModel( abilityCombatantOwnerID, combatActionType, abilityID, combatantModel.ID, damageDeltaWithStatModifiers, turnsRemaining, isCrit)); }
private CombatActionModel applyRegenAbilityEffectToCombatant(AbilityEffectType abilityEffectType, int abilityID, int abilityCombatantOwnerID, int abilityAmount, CombatantModel combatantModel, int turnsRemaining, bool isCrit) { // Don't consider stat modifiers for regen abilities (if an enemy casts increased spell damage on you, // we don't want it to boost the healing you receive) CombatActionType combatActionType = CombatActionType.None; switch (abilityEffectType) { case AbilityEffectType.HealthRegen: combatantModel.SetCurrentHealth(combatantModel.CurrentHealth + abilityAmount); combatActionType = CombatActionType.RegenHealth; break; case AbilityEffectType.ManaRegen: combatantModel.SetCurrentMana(combatantModel.CurrentMana + abilityAmount); combatActionType = CombatActionType.RegenMana; break; default: throw new Exception("Invalid AbilityEffectType"); } return(new CombatActionModel(abilityCombatantOwnerID, combatActionType, abilityID, combatantModel.ID, abilityAmount, turnsRemaining, isCrit)); }