Example #1
0
        public int AttackDamage(Combatant combatant)
        {
            int strength = combatant.Strength;

            int equipmentDamage = GetCombatantTotalAttack(combatant);

            if (equipmentDamage < strength) 
            {
                return randomGenerator.Next(equipmentDamage, equipmentDamage + (strength / 2) + 1);
            }
            else
            {
                return randomGenerator.Next(strength, strength + (equipmentDamage / 2) + 1);
            }
        }
Example #2
0
        public int DefenseValue(Combatant combatant)
        {
            int strength = combatant.Strength;

            int equipmentDefense = GetCombatantTotalDefense(combatant);

            if (equipmentDefense < strength)
            {
                return randomGenerator.Next(equipmentDefense, equipmentDefense + (strength / 4) + 1);
            }
            else
            {
                return randomGenerator.Next(strength, strength + (equipmentDefense / 4) + 1);
            }
        }
Example #3
0
        public int GetCombatantTotalAttack(Combatant combatant)
        {
            int armorAttack = 0;

            if (combatant.ArmorID != null)
            {
                armorAttack += Service.GetEquipmentStats(null, null, combatant.ArmorID).Damage;
            }

            if (combatant.WeaponID != null)
            {
                armorAttack += Service.GetEquipmentStats(null, null, combatant.WeaponID).Damage;
            }

            if (combatant.ShieldID != null)
            {
                armorAttack += Service.GetEquipmentStats(null, null, combatant.ShieldID).Damage;
            }

            return armorAttack;
        }
Example #4
0
        public int GetCombatantTotalDefense(Combatant combatant)
        {
            int armorDefense = 0;

            if (combatant.ArmorID != null)
            {
                armorDefense += Service.GetEquipmentStats(null, null, combatant.ArmorID).Defense;
            }

            if (combatant.WeaponID != null)
            {
                armorDefense += Service.GetEquipmentStats(null, null, combatant.WeaponID).Defense;
            }

            if (combatant.ShieldID != null)
            {
                armorDefense += Service.GetEquipmentStats(null, null, combatant.ShieldID).Defense;
            }

            return armorDefense;
        }
Example #5
0
        public void AttackCleanUp(ref Combatant attacker, ref Combatant defender, ref List<Combatant> combatants)
        {
            // Both combatants lose stanima for their participation in the attack.
            attacker.Stanima -= 1;
            defender.Stanima -= 1;

            if (defender.Stanima <= 0 || ((double)defender.Health / defender.MaxHealth) <= defender.GiveUpPercent)
            {
                combatantsGiveUp.Add(defender);
                if(((double)defender.Health / defender.MaxHealth) <= defender.GiveUpPercent) 
                {
                    combatLog.Add(new CombatLog(combatLogID, String.Format(strings.GetString("GiveUpString"), defender.Name), null, null, null, null));
                }
                else
                {
                    combatLog.Add(new CombatLog(combatLogID, String.Format(strings.GetString("GiveUpStanimaString"), defender.Name), null, null, null, null));
                }
                combatLogID++;
                Combatant defenderToRemove = defender;
                combatants.Remove(combatants.Find(x => x.CombatantID == defenderToRemove.CombatantID));
            }

            if (attacker.Stanima <= 0 || ((double)attacker.Health / attacker.MaxHealth) <= attacker.GiveUpPercent)
            {
                combatantsGiveUp.Add(attacker);
                if (((double)attacker.Health / attacker.MaxHealth) <= attacker.GiveUpPercent)
                {
                    combatLog.Add(new CombatLog(combatLogID, String.Format(strings.GetString("GiveUpString"), attacker.Name), null, null, null, null));
                }
                else
                {
                    combatLog.Add(new CombatLog(combatLogID, String.Format(strings.GetString("GiveUpStanimaString"), attacker.Name), null, null, null, null));
                }
                combatLogID++;
                Combatant attackerToRemove = attacker;
                combatants.Remove(combatants.Find(x => x.CombatantID == attackerToRemove.CombatantID));
            }
        }
Example #6
0
 public Combatant CopyCombatant(Combatant combatantToCopy)
 {
     return new Combatant
     {
         CharID = combatantToCopy.CharID,
         UserID = combatantToCopy.UserID,
         Race = combatantToCopy.Race,
         Name = combatantToCopy.Name,
         Level = combatantToCopy.Level,
         Experience = combatantToCopy.Experience,
         Health = combatantToCopy.Health,
         MaxHealth = combatantToCopy.MaxHealth,
         Stanima = combatantToCopy.Stanima,
         MaxStanima = combatantToCopy.MaxStanima,
         Strength = combatantToCopy.Strength,
         Speed = combatantToCopy.Speed,
         Dexterity = combatantToCopy.Dexterity,
         Agility = combatantToCopy.Agility,
         WeaponID = combatantToCopy.WeaponID,
         ShieldID = combatantToCopy.ShieldID,
         ArmorID = combatantToCopy.ArmorID,
         GiveUpPercent = combatantToCopy.GiveUpPercent,
         TeamNumber = combatantToCopy.TeamNumber,
         CombatantID = combatantToCopy.CombatantID
     };
 }
Example #7
0
 // Only used by CloneCombatantList
 public static Combatant ReturnCombatant(Combatant combatant)
 {
     return combatant;
 }