private void update_value() { if (this.fData.Count != 1) { this.ValBox.Text = "(multiple tokens)"; return; } int _value = DamageForm.get_value((int)this.DmgBox.Value, this.fData[0].Modifier, this.HalveBtn.Checked); this.ValBox.Text = _value.ToString(); }
void apply_damage() { foreach (ListViewItem lvi in RollList.Items) { Pair <CombatData, int> roll = lvi.Tag as Pair <CombatData, int>; if (roll.First == null) { continue; } int damage = 0; if (roll.Second == 20) { damage = int.Parse(CritValueLbl.Text); } else if (lvi.ForeColor == SystemColors.WindowText) { // Hit damage = (int)DamageBox.Value; } else { // Miss // TODO: Does the power do half damage on a miss? // Remember that minions are unaffected by this } if (damage == 0) { continue; } // Determine damage type(s) Array array = Enum.GetValues(typeof(DamageType)); List <DamageType> types = new List <DamageType>(); foreach (DamageType type in array) { string details = fPower.Details.ToLower(); string dmg = type.ToString().ToLower(); if (details.Contains(dmg)) { types.Add(type); } } EncounterSlot slot = fEncounter.FindSlot(roll.First); EncounterCard card = (slot != null) ? slot.Card : null; DamageForm.DoDamage(roll.First, card, damage, types, false); } }
internal void DoDamage(CombatData data, EncounterCard card, int damage, List <DamageType> types, bool halve_damage) { int damageModifier = 0; if (card != null) { damageModifier = card.GetDamageModifier(types, data); } int _value = DamageForm.get_value(damage, damageModifier, halve_damage); this.DamageCommand.AddTarget(data, _value); //if (data.TempHP > 0) //{ // int num = Math.Min(data.TempHP, _value); // CombatData tempHP = data; // tempHP.TempHP = tempHP.TempHP - num; // _value -= num; //} //CombatData combatDatum = data; //combatDatum.Damage = combatDatum.Damage + _value; }