コード例 #1
0
        public void AssignFightWounds()
        {
            foreach (Sim fighter in new Sim[] { Actor, Target })
            {
                // Chance of being wounded is calculated based on the sim's fight skill.
                // Could eventually take into account opponent sim or win/loss
                int wound_chance = kBaseWoundChance;
                int fight_level  = Math.Max(0, fighter.SkillManager.GetSkillLevel(EWPetFightingSkill.skillNameID));
                wound_chance -= kWoundChanceAdjPerSkillLevel * fight_level;
                wound_chance  = MathUtils.Clamp(wound_chance, 10, 90);
                if (RandomUtil.RandomChance(wound_chance))
                {
                    // Determine wound severity
                    // Would severity is also offset by skill. This may not be the best way to do it.

                    float[] woundChances = new float[3];
                    woundChances[0] = 10 + (2 * fight_level); // Chance of mild: wound
                    woundChances[1] = 10 + fight_level;       // Chance of serious wound
                    woundChances[2] = 10;                     // Chance of serious wound

                    WoundType wound = (WoundType)RandomUtil.GetWeightedIndex(woundChances);

                    switch (wound)
                    {
                    case WoundType.Mild:
                        fighter.BuffManager.AddElement(BuffEWMinorWound.StaticGuid, Origin.FromFight);
                        break;

                    case WoundType.Serious:
                        fighter.BuffManager.AddElement(BuffEWSeriousWound.StaticGuid, Origin.FromFight);
                        break;

                    case WoundType.Grave:
                        fighter.BuffManager.AddElement(BuffEWGraveWound.StaticGuid, Origin.FromFight);
                        break;
                    }
                }
            }
        }
コード例 #2
0
 /// <summary>Initializes a new instance of the <see cref="T:System.Object"></see> class.</summary>
 public Wound(uint damage, WoundType type, bool permanent = false)
 {
     Damage    = damage;
     Type      = type;
     Permanent = permanent;
 }