private static RollResult getCloseCombatResult(Character attacker, Character defender) { RollResult result = getRollResult(); result.Value += getCloseCombatModifier(attacker, defender) + attacker.BasicSkills.Agility; if (attacker.CC_weapon.Weight > attacker.BasicSkills.Strength) result.Value -= attacker.CC_weapon.Weight - attacker.BasicSkills.Strength; return result; }
public static Character GetPeasant(int index, BehaviorType bh) { Character c = new Character(bh); c.BasicSkills = new BasicSkills(4, 2, 2, 2, 2, 2, 2, 1, 1, 1); c.CC_weapon = new Axe(); c.Armor = None(); if (index == 0) c.SetImage("Square1.png"); else c.SetImage("Square2.png"); return c; }
public static Character GetCommoner(int index) { Character c = new Character(); c.BasicSkills = new BasicSkills(5, 2, 3, 3, 3, 3, 3, 2, 2, 1); c.CC_weapon = new Sword(); c.Armor = GetShield(); if (index == 0) c.SetImage("Square1.png"); else c.SetImage("Square2.png"); return c; }
public static Character GetKnight(int index, BehaviorType bh) { Character c = new Character(bh); c.BasicSkills = new BasicSkills(5, 3, 6, 3, 4, 4, 4, 6, 8, 2); c.CC_weapon = new Sword(); c.Armor = FullPlate(); if (index == 0) c.SetImage("Square1.png"); else c.SetImage("Square2.png"); return c; }
// If at same time in combat with many guys // -1 to +3 private static int crowdModifier(Character attacker, Character defender) { int result = 0; // If someone is trying to hit you while you try to hit, get -1 if (attacker.InCombatWith.Count > 1) result--; // If someone is also in combat with guy u are trying to hit, get max +3 if (defender.InCombatWith.Count > 1) { result += defender.InCombatWith.Count >= 3 ? 3 : defender.InCombatWith.Count; } return result; }
public static void CloseCombat(Character attacker, Character defender) { RollResult attacker_result = getCloseCombatResult(attacker, defender); RollResult defender_result = getCloseCombatResult(defender, attacker); attacker_result.Value += crowdModifier(attacker, defender); if (attacker_result.Lucky && !defender_result.Lucky) { Hit(attacker, defender); } else if (attacker_result.Fumble) { if (!defender_result.Fumble) Hit(defender, attacker); } else if (attacker_result.Value > defender_result.Value) { Hit(attacker, defender); } }
private static void processDamage(Character hitter, Character target) { if (target.Wounded || target.Dead) { if (target.Wounded) hitter.Wounds.Add(target); else if (target.Dead) hitter.Kills.Add(target); hitter.Target = null; foreach(Character character in target.InCombatWith) { character.InCombatWith.Remove(target); if (character != hitter) { if (target.Wounded) character.WoundsAssist.Add(target); else if (target.Dead) character.KillsAssist.Add(target); } } target.InCombatWith.Clear(); } }
// One roll and lets see if it goes through.. private static void Hit(Character hitter, Character target) { int baseModifier = 5 - hitter.CC_weapon.Strength - strengthBonus(hitter.BasicSkills.Strength); // Check armour int neededRoll = target.Armor.ArmorClass + baseModifier; RollResult roll = getRollResult(); int result = roll.Value - neededRoll; if (!roll.Lucky && (roll.Fumble || result < 0)) return; // Check wounding neededRoll = target.BasicSkills.Thoughness + baseModifier - woundBonus(result); roll = getRollResult(); result = roll.Value - neededRoll; if (!roll.Lucky && ( roll.Fumble || result < 0)) return; result = result == 0 ? 1 : result; // If lucky make double damage or at least 1 int damage = roll.Lucky ? result * 2 : result; target.TakeDamage(damage); processDamage(hitter, target); }
private void checkLineOfMovement(Character c) { foreach (GameObject go in objects) { } }
public FastAttack(Character character) : base(character) { }
public BaseComponent(Character owner) { this.owner = owner; }
public BehaviorComponent(Character owner) : base(owner) { SetBehavior(BehaviorType.SmartAttack); }
public NoAI(Character character) : base(character) { }
public SmartAttack(Character character) : base(character) { }
public Flee(Character character) : base(character) { }
public MoveComponent(Character owner) : base(owner) { }
public CombatComponent(Character owner) : base(owner) { }
// TODO: Count again private static int getCloseCombatModifier(Character attacker, Character defender) { return attacker.BasicSkills.CloseCombat - defender.BasicSkills.CloseCombat; }
public EvadeAndShoot(Character character) : base(character) { }
public StandAndDefend(Character character) : base(character) { }
public static Character GetWarrior(int index) { Character c = new Character(); c.BasicSkills = new BasicSkills(6, 3, 4, 3, 4, 4, 4, 4, 6, 2); c.CC_weapon = new Sword(); c.Armor = FullPlate(); if (index == 0) c.SetImage("Square1.png"); else c.SetImage("Square2.png"); return c; }
public BehaviorComponent(Character owner, BehaviorType behavior) : base(owner) { SetBehavior(behavior); }
public Behavior(Character character) { this.character = character; }