Example #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;
        }
Example #2
0
 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;
 }
Example #3
0
 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;
 }
Example #4
0
 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;
 }
Example #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;
        }
Example #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);
            }
        }
Example #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();
            }
        }
Example #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);
        }
Example #9
0
        private void checkLineOfMovement(Character c)
        {
            foreach (GameObject go in objects)
            {

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