void resolveCombat(CharacterClass c, CharacterClass t) { int i = 0; DamageClass charWeapon = DamageClass.getActiveWeapon(c); int charWeaponSkill = SkillClass.getSkill(c, charWeapon); int charAttribute = c.getAttributeSkillValue(charWeapon); // DamageClass targetWeapon = DamageClass.getActiveWeapon(t); //int targetWeaponSkill = SkillClass.getSkill(t, targetWeapon); //int targetAttribute = c.getAttributeSkillValue(targetWeapon); RollerClass r = new RollerClass(); List <int> charRolls = r.Roll(charWeaponSkill + charAttribute, 0); int charSuccess = r.returnSuccesses(charRolls); List <int> targetRolls = r.Roll(t.Reaction + t.Intuition, 0); int targetSuccess = r.returnSuccesses(targetRolls); int netSuccesses = charSuccess - targetSuccess; EventClass.LogEvent(c.Name + " attack rolls (" + charSuccess + ") " + r.displayRolls(charRolls)); EventClass.LogEvent(t.Name + " defense rolls (" + targetSuccess + ") " + r.displayRolls(targetRolls)); if (netSuccesses > 0) { List <int> targetResistRolls = r.Roll(t.Body + t.Armor - charWeapon.armorPen, 0); int targetResistSuccess = r.returnSuccesses(targetResistRolls); EventClass.LogEvent(t.Name + " resist rolls (" + targetResistSuccess + ") " + r.displayRolls(targetResistRolls)); int dv = charWeapon.baseDamage + netSuccesses; int damage = dv - targetResistSuccess; EventClass.LogEvent(c.Name + " dv = " + dv + " damage = " + damage); if (dv >= (t.Armor - charWeapon.armorPen)) { //t.Health -= damage; EventClass.LogEvent(c.Name + " did physical damage of " + damage + " to " + t.Name); } else { //t.Stun -= damage; EventClass.LogEvent(c.Name + " did stun damage of " + damage + " to " + t.Name); } } else { EventClass.LogEvent(c.Name + " missed " + t.Name); } }
void addWeaponToChar(string line) { string[] parse = line.Replace("{", "").Replace("}", "").Split(','); bool found = false; DamageClass d = new DamageClass(); d.baseDamage = int.Parse(parse[1]); d.isPhysical = bool.Parse(parse[2]); d.armorPen = int.Parse(parse[3]); d.fullAuto = bool.Parse(parse[4]); d.semi = bool.Parse(parse[5]); d.single = bool.Parse(parse[6]); d.melee = bool.Parse(parse[7]); d.spell = bool.Parse(parse[8]); d.modifier = int.Parse(parse[9]); d.Name = parse[10]; d.attrib = parse[11]; d.skill = parse[12]; foreach (CharacterClass c in goodList) { if (c.Name == parse[0]) { c.weaponList.Items.Add(d.Name); c.damageList.Add(d); EventClass.LogEvent(d.Name + " weapon added to " + c.Name); found = true; return; } } foreach (CharacterClass c in badList) { if (c.Name == parse[0]) { c.weaponList.Items.Add(d.Name); c.damageList.Add(d); EventClass.LogEvent(d.Name + " weapon added to " + c.Name); found = true; return; } } }
public static int getSkill(CharacterClass c, DamageClass d) { foreach (SkillClass sk in c.skillList) { if (sk.Name == d.skill) { if (sk.Specialization == "false") { return(sk.Value); } else { return(sk.Value + 2); } } } return(-1); }
public int getAttributeSkillValue(DamageClass d) { if (d.attrib == "Agility") { return(Agility); } if (d.attrib == "Body") { return(Body); } if (d.attrib == "Intelligence") { return(Intelligence); } if (d.attrib == "Strength") { return(Strength); } if (d.attrib == "Intuition") { return(Intuition); } if (d.attrib == "Charisma") { return(Charisma); } if (d.attrib == "Willpower") { return(Willpower); } if (d.attrib == "Logic") { return(Logic); } return(-1); }