Exemple #1
0
        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;
 }
Exemple #5
0
        // 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;
        }
Exemple #6
0
        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);
            }
        }
Exemple #7
0
        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();
            }
        }
Exemple #8
0
        // 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);
        }
Exemple #9
0
        private void checkLineOfMovement(Character c)
        {
            foreach (GameObject go in objects)
            {

            }
        }
Exemple #10
0
 public FastAttack(Character character)
     : base(character)
 {
 }
Exemple #11
0
 public BaseComponent(Character owner)
 {
     this.owner = owner;
 }
 public BehaviorComponent(Character owner)
     : base(owner)
 {
     SetBehavior(BehaviorType.SmartAttack);
 }
Exemple #13
0
 public NoAI(Character character)
     : base(character)
 {
 }
Exemple #14
0
 public SmartAttack(Character character)
     : base(character)
 {
 }
Exemple #15
0
 public Flee(Character character)
     : base(character)
 {
 }
Exemple #16
0
 public MoveComponent(Character owner)
     : base(owner)
 {
 }
 public CombatComponent(Character owner)
     : base(owner)
 {
 }
Exemple #18
0
 // TODO: Count again
 private static int getCloseCombatModifier(Character attacker, Character defender)
 {
     return attacker.BasicSkills.CloseCombat - defender.BasicSkills.CloseCombat;
 }
Exemple #19
0
 public EvadeAndShoot(Character character)
     : base(character)
 {
 }
Exemple #20
0
 public StandAndDefend(Character character)
     : base(character)
 {
 }
Exemple #21
0
 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);
 }
Exemple #23
0
 public Behavior(Character character)
 {
     this.character = character;
 }