public void AddElementalWeakness(Elements.Type weak) { if (!_weaknesses.Contains(weak)) { _weaknesses.Add(weak); } }
public void RemoveElementalWeakness(Elements.Type weak) { if (_weaknesses.Contains(weak)) { _weaknesses.Remove(weak); } }
public void RemoveElementalStrength(Elements.Type str) { if (_strengths.Contains(str)) { _strengths.Remove(str); } }
public void AddElementalStrength(Elements.Type str) { if (!_strengths.Contains(str)) { _strengths.Add(str); } }
public void RemoveElementalImmunity(Elements.Type imm) { if (_immunities.Contains(imm)) { _immunities.Remove(imm); } }
public void AddElementalImmunity(Elements.Type imm) { if (!_immunities.Contains(imm)) { _immunities.Add(imm); } }
private static void Click(object sender, EventArgs e) { if (((Control)sender).Name == "ammeter") { type = Elements.Type.Ammeter; } else if (((Control)sender).Name == "voltmeter") { type = Elements.Type.Voltmeter; } else if (((Control)sender).Name == "multimeter") { type = Elements.Type.Multimeter; } else if (((Control)sender).Name == "conductor") { type = Elements.Type.Conductor; } else if (((Control)sender).Name == "resistor") { type = Elements.Type.Resistor; } else if (((Control)sender).Name == "rheostat") { type = Elements.Type.Rheostat; } else if (((Control)sender).Name == "voltage_source") { type = Elements.Type.VoltageSource; } else if (((Control)sender).Name == "capacitor") { type = Elements.Type.Capacitor; } else if (((Control)sender).Name == "single_switch") { type = Elements.Type.SingleSwitch; } else if (((Control)sender).Name == "double_switch") { type = Elements.Type.DoubleSwitch; } else if (((Control)sender).Name == "toggle") { type = Elements.Type.Toggle; } else if (((Control)sender).Name == "lamp") { type = Elements.Type.Lamp; } else if (((Control)sender).Name == "stopwatch") { type = Elements.Type.Stopwatch; } ShowPicture(); }
/// <summary> /// Checks how the element affects the character. /// </summary> /// <param name="element"></param> /// <returns>The affinity against that element</returns> public Elements.Affinity CheckElement(Elements.Type element) { Elements.Affinity elementStatus = Elements.Affinity.Neutral; // Strengths will overrule weaknesses. Immunities overrule both if (_immunities.Contains(element)) { elementStatus = Elements.Affinity.Immune; } else if (_strengths.Contains(element)) { elementStatus = Elements.Affinity.Strong; } else if (_weaknesses.Contains(element)) { elementStatus = Elements.Affinity.Weak; } return(elementStatus); }
private void MainForm_Load(object sender, EventArgs e) { this.BackColor = Color.FromArgb(237, 249, 255); Elements.Type[] types = new Elements.Type[13] { Elements.Type.Ammeter, Elements.Type.Voltmeter, Elements.Type.Multimeter, Elements.Type.Resistor, Elements.Type.Conductor, Elements.Type.Rheostat, Elements.Type.VoltageSource, Elements.Type.Capacitor, Elements.Type.SingleSwitch, Elements.Type.DoubleSwitch, Elements.Type.Toggle, Elements.Type.Lamp, Elements.Type.Stopwatch }; Design.CreatePanel(pictureBox3, types); }
/* * ROUND((A + B) / (100 + (A + B)) * (C + if(E, C,0) / 2) * C / (C + G) * D * 100 * H * F / (20 * 255)) * A = Character Level * B = Cloak Level * C = ATK of attacker * D = Ability Damage Modifier * E = True/False, determines if the ability Crit * F = Random Number from 217 to 255 * G = DEF of defender * H = Elemental damage modifier (Weaknesses/Strengths) */ public static int CalculateDamage(Character attacker, Character defender, float damageModifier, Elements.Type elementType) { if (IsSuccessful(attacker.GetAccuracy().Value - defender.GetAvoidability().Value)) { // (A + B) / (100 + (A + B)) float levelFactor = (attacker.GetCloakLevel().Value + attacker.GetLevel().Value) / (100.0f + (attacker.GetCloakLevel().Value + attacker.GetLevel().Value)); // (C + if(E, C,0) / 2) float critFactor = IsSuccessful(attacker.GetCrit().Value) ? attacker.GetAttack().Value + attacker.GetAttack().Value / 2.0f : attacker.GetAttack().Value; // C / (C + G) * D float attackFactor = (float)(attacker.GetAttack().Value) / (attacker.GetAttack().Value + defender.GetDefense().Value) * damageModifier; Elements.Affinity defElmStatus = defender.CheckElement(elementType); // H float elementFactor = 1.0f; switch (defElmStatus) { case (Elements.Affinity.Immune): // Take zero damage elementFactor = 0.0f; break; case (Elements.Affinity.Strong): // Take half damage elementFactor = _strengthMultiplier; break; case (Elements.Affinity.Weak): // Take extra damage elementFactor = _weaknessMultiplier; break; default: break; } // F float randomFactor = Random.Range(217, 255); return((int)(levelFactor * critFactor * attackFactor * elementFactor * randomFactor * _magicFactor)); } // The attack missed return(-1); }