public PaybackHolder(PaybackTypes paybackType, Enumerations.PhysicalAttributes physAttribute, Enumerations.Elements element, Enumerations.ContactTypes[] paybackContacts, Enumerations.ContactProperties[] contactProperties, Enumerations.ContactResult contactResult, Enumerations.ContactResult samePhysAttrResult, int constantDamage, params StatusChanceHolder[] statusesInflicted) : this(paybackType, physAttribute, element, paybackContacts, contactProperties, contactResult, samePhysAttrResult, statusesInflicted) { Damage = constantDamage; }
/// <summary> /// Gets the total Payback a BattleEntity has by combining all of the current Paybacks affecting the BattleEntity. /// </summary> /// <param name="additionalPaybacks">Any additional PaybackHolders to factor in. This is used when determining the total contact result.</param> /// <returns>A PaybackHolder with the combined properties of all the Paybacks the BattleEntity has</returns> public PaybackHolder GetPayback(params PaybackHolder[] additionalPaybacks) { //Gather all the entity's Paybacks in the list List <PaybackHolder> allPaybacks = new List <PaybackHolder>(Paybacks); //Add any additional Paybacks if (additionalPaybacks != null && additionalPaybacks.Length > 0) { allPaybacks.AddRange(additionalPaybacks); } //Initialize default values PaybackTypes totalType = PaybackTypes.Constant; Elements totalElement = Elements.Normal; int totalDamage = 0; List <StatusChanceHolder> totalStatuses = new List <StatusChanceHolder>(); //Go through all the Paybacks and add them up for (int i = 0; i < allPaybacks.Count; i++) { PaybackHolder paybackHolder = allPaybacks[i]; //If there's a Half or Full Payback, upgrade the current one from Half to Full if it's currently Half if (paybackHolder.PaybackType != PaybackTypes.Constant) { //If there are at least two Half Paybacks, upgrade it to Full if (totalType == PaybackTypes.Half && paybackHolder.PaybackType == PaybackTypes.Half) { totalType = PaybackTypes.Full; } else if (totalType != PaybackTypes.Full) { totalType = paybackHolder.PaybackType; } } //Check for a higher priority Element if (paybackHolder.Element > totalElement) { totalElement = paybackHolder.Element; } //Add up all the damage totalDamage += paybackHolder.Damage; //Add in all the StatusEffects - note that StatusEffects with the same StatusType will increase the chance of //that StatusEffect being inflicted, as the first one may not succeed in being inflicted depending on the BattleEntity if (paybackHolder.StatusesInflicted != null && paybackHolder.StatusesInflicted.Length > 0) { totalStatuses.AddRange(paybackHolder.StatusesInflicted); } } //Return the final Payback return(new PaybackHolder(totalType, totalElement, totalDamage, totalStatuses.ToArray())); }
public PaybackHolder(PaybackTypes paybackType, Enumerations.PhysicalAttributes physAttribute, Enumerations.Elements element, Enumerations.ContactTypes[] paybackContacts, Enumerations.ContactProperties[] contactProperties, Enumerations.ContactResult contactResult, Enumerations.ContactResult samePhysAttrResult, params StatusChanceHolder[] statusesInflicted) { PaybackType = paybackType; PhysAttribute = physAttribute; Element = element; PaybackContacts = paybackContacts; ContactProperties = contactProperties; PaybackContactResult = contactResult; SamePhysAttrResult = samePhysAttrResult; Damage = 0; StatusesInflicted = statusesInflicted; }